diff options
author | Aaron M. Ucko <ucko@debian.org> | 2005-04-29 15:34:56 +0000 |
---|---|---|
committer | Aaron M. Ucko <ucko@debian.org> | 2005-04-29 15:34:56 +0000 |
commit | 402b112099aa816a02fd502b7f0261a99fe7126a (patch) | |
tree | 614fef3fedb6a920352586fc76cd1b0c828cffd2 /corelib | |
parent | e0f3c07fe198b2ecfa46997942fd22a48655373e (diff) |
Load /tmp/.../ncbi-tools6-6.1.20050429 into
ncbi-tools6/branches/upstream/current.
Diffstat (limited to 'corelib')
-rw-r--r-- | corelib/drwnflpt.c | 12 | ||||
-rw-r--r-- | corelib/drwnfspc.c | 12 | ||||
-rw-r--r-- | corelib/drwnmfls.c | 12 | ||||
-rw-r--r-- | corelib/ncbienv.c | 65 | ||||
-rw-r--r-- | corelib/ncbierr.c | 10 | ||||
-rw-r--r-- | corelib/ncbifile.c | 6 | ||||
-rw-r--r-- | corelib/ncbimisc.c | 38 |
7 files changed, 95 insertions, 60 deletions
diff --git a/corelib/drwnflpt.c b/corelib/drwnflpt.c index dde90caf..99ee823b 100644 --- a/corelib/drwnflpt.c +++ b/corelib/drwnflpt.c @@ -1,4 +1,10 @@ #include <ncbilcl.h> -#if defined(OS_MAC) || defined(OS_UNIX_DARWIN) -#include "FullPath.c" -#endif /* defined(OS_MAC) || defined(OS_UNIX_DARWIN) */ +#ifdef OS_UNIX_DARWIN +# include <AvailabilityMacros.h> +# ifndef MAC_OS_X_VERSION_10_2 +# define OS_UNIX_DARWIN_OLD +# endif +#endif +#if defined(OS_MAC) || defined(OS_UNIX_DARWIN_OLD) +# include "FullPath.c" +#endif
\ No newline at end of file diff --git a/corelib/drwnfspc.c b/corelib/drwnfspc.c index 34c4fbd4..1d81f740 100644 --- a/corelib/drwnfspc.c +++ b/corelib/drwnfspc.c @@ -1,4 +1,10 @@ #include <ncbilcl.h> -#if defined(OS_MAC) || defined(OS_UNIX_DARWIN) -#include "FSpCompat.c" -#endif /* defined(OS_MAC) || defined(OS_UNIX_DARWIN) */ +#ifdef OS_UNIX_DARWIN +# include <AvailabilityMacros.h> +# ifndef MAC_OS_X_VERSION_10_2 +# define OS_UNIX_DARWIN_OLD +# endif +#endif +#if defined(OS_MAC) || defined(OS_UNIX_DARWIN_OLD) +# include "FSpCompat.c" +#endif
\ No newline at end of file diff --git a/corelib/drwnmfls.c b/corelib/drwnmfls.c index 2cf270e5..fb69b829 100644 --- a/corelib/drwnmfls.c +++ b/corelib/drwnmfls.c @@ -1,4 +1,10 @@ #include <ncbilcl.h> -#if defined(OS_MAC) || defined(OS_UNIX_DARWIN) -#include "MoreFilesX.c" -#endif /* defined(OS_MAC) || defined(OS_UNIX_DARWIN) */ +#ifdef OS_UNIX_DARWIN +# include <AvailabilityMacros.h> +# ifndef MAC_OS_X_VERSION_10_2 +# define OS_UNIX_DARWIN_OLD +# endif +#endif +#if defined(OS_MAC) || defined(OS_UNIX_DARWIN_OLD) +# include "MoreFilesX.c" +#endif
\ No newline at end of file diff --git a/corelib/ncbienv.c b/corelib/ncbienv.c index 9b20295b..acc2a3de 100644 --- a/corelib/ncbienv.c +++ b/corelib/ncbienv.c @@ -29,7 +29,7 @@ * * Version Creation Date: 7/7/91 * -* $Revision: 6.37 $ +* $Revision: 6.38 $ * * File Description: * portable environment functions, companions for ncbimain.c @@ -37,6 +37,9 @@ * Modifications: * -------------------------------------------------------------------------- * $Log: ncbienv.c,v $ +* Revision 6.38 2004/10/27 20:00:44 kans +* Ncbienv_FileOpen suppresses missing file error post +* * Revision 6.37 2004/08/06 20:56:27 kans * G/SetAppParam on PC no longer uses PrivateProfileString functions - instead it checks USERPROFILE, SYSTEMROOT, and then NCBI environment variables * @@ -337,6 +340,18 @@ static Nlm_Boolean destroyDeadComments = FALSE; * *****************************************************************************/ +static FILE* LIBCALL Ncbienv_FileOpen (const char *filename, const char *mode) + +{ + FILE *fp; + ErrSev sev; + + sev = ErrSetMessageLevel (SEV_ERROR); + fp = FileOpen (filename, mode); + ErrSetMessageLevel (sev); + return fp; +} + static Nlm_Int2 Nlm_WorkGetAppParam(const Nlm_Char* file, const Nlm_Char* section, @@ -713,15 +728,15 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm Nlm_FileBuildPath(path, "Library", NULL); Nlm_FileBuildPath(path, "Preferences", NULL); Nlm_FileBuildPath(path, NULL, str); - fp = Nlm_FileOpen (path, "r"); + fp = Ncbienv_FileOpen (path, "r"); if (fp == NULL && create) { - fp = Nlm_FileOpen (path, "w"); + fp = Ncbienv_FileOpen (path, "w"); Nlm_FileClose (fp); - fp = Nlm_FileOpen (path, "r"); + fp = Ncbienv_FileOpen (path, "r"); } if (writeMode && fp != NULL) { Nlm_FileClose (fp); - fp = Nlm_FileOpen (path, "w"); + fp = Ncbienv_FileOpen (path, "w"); } if (fp != NULL) { return fp; @@ -733,7 +748,7 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm FileBuildPath(path, "Contents", NULL); FileBuildPath (path, "Resources", NULL); Nlm_FileBuildPath (path, NULL, str); - fp = Nlm_FileOpen (path, "r"); + fp = Ncbienv_FileOpen (path, "r"); if (fp != NULL) { return fp; } @@ -755,7 +770,7 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm Nlm_StringNCpy_0(path, str, sizeof(path)); if (! dontUseLocalConfig) - fp = Nlm_FileOpen (path, "r"); + fp = Ncbienv_FileOpen (path, "r"); if (fp == NULL) { if (Nlm_GetHome (path, sizeof (path))) { Nlm_FileBuildPath(path, NULL, str); @@ -763,11 +778,11 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm Nlm_StringNCpy_0(path, str, sizeof(path)); } if (! dontUseLocalConfig) - fp = Nlm_FileOpen (path, "r"); + fp = Ncbienv_FileOpen (path, "r"); if (fp == NULL && create) { - newfp = Nlm_FileOpen (path, "w"); + newfp = Ncbienv_FileOpen (path, "w"); Nlm_FileClose (newfp); - newfp = Nlm_FileOpen (path, "r"); + newfp = Ncbienv_FileOpen (path, "r"); } } if (fp == NULL) { @@ -775,11 +790,11 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm pth = getenv ("NCBI"); if (pth != NULL) { Nlm_FileBuildPath(path, pth, str + 1); - fp = Nlm_FileOpen (path, "r"); + fp = Ncbienv_FileOpen (path, "r"); if (fp == NULL) { path[0] = '\0'; Nlm_FileBuildPath(path, pth, str); - fp = Nlm_FileOpen (path, "r"); + fp = Ncbienv_FileOpen (path, "r"); } } } @@ -793,7 +808,7 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm } if (writeMode && fp != NULL) { Nlm_FileClose (fp); - fp = Nlm_FileOpen (path, "w"); + fp = Ncbienv_FileOpen (path, "w"); } } return fp; @@ -857,11 +872,11 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm if (tmp != NULL && *tmp != '\0') { StringNCpy_0 (path, tmp, sizeof (path)); Nlm_FileBuildPath(path, NULL, str); - fp = Nlm_FileOpen (path, "r"); + fp = Ncbienv_FileOpen (path, "r"); if (fp == NULL && create) { - newfp = Nlm_FileOpen (path, "w"); + newfp = Ncbienv_FileOpen (path, "w"); Nlm_FileClose (newfp); - newfp = Nlm_FileOpen (path, "r"); + newfp = Ncbienv_FileOpen (path, "r"); } } @@ -872,7 +887,7 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm if (tmp != NULL && *tmp != '\0') { StringNCpy_0 (path, tmp, sizeof (path)); Nlm_FileBuildPath(path, NULL, str); - fp = Nlm_FileOpen (path, "r"); + fp = Ncbienv_FileOpen (path, "r"); } } @@ -883,7 +898,7 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm if (tmp != NULL && *tmp != '\0') { StringNCpy_0 (path, tmp, sizeof (path)); Nlm_FileBuildPath(path, NULL, str); - fp = Nlm_FileOpen (path, "r"); + fp = Ncbienv_FileOpen (path, "r"); } } @@ -897,7 +912,7 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm } if (writeMode && fp != NULL) { Nlm_FileClose (fp); - fp = Nlm_FileOpen (path, "w"); + fp = Ncbienv_FileOpen (path, "w"); } } return fp; @@ -1090,18 +1105,18 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm } Nlm_StringNCpy_0(path, str, sizeof(path)); - fp = Nlm_FileOpen (path, "r"); /* File exists? */ + fp = Ncbienv_FileOpen (path, "r"); /* File exists? */ if (fp == NULL) { if (Nlm_GetHome (path, sizeof (path))) { Nlm_FileBuildPath(path, NULL, str); } else { Nlm_StringNCpy_0(path, str, sizeof(path)); } - fp = Nlm_FileOpen (path, "r"); /* File exists? */ + fp = Ncbienv_FileOpen (path, "r"); /* File exists? */ if (fp == NULL && create) { - newfp = Nlm_FileOpen (path, "w"); + newfp = Ncbienv_FileOpen (path, "w"); Nlm_FileClose (newfp); - newfp = Nlm_FileOpen (path, "r"); + newfp = Ncbienv_FileOpen (path, "r"); } } @@ -1110,7 +1125,7 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm pth = getenv ("NCBI"); if (pth != NULL) { Nlm_FileBuildPath(path, pth, str); - fp = Nlm_FileOpen (path, "r"); + fp = Ncbienv_FileOpen (path, "r"); } } @@ -1143,7 +1158,7 @@ static FILE* Nlm_OpenConfigFile(const Nlm_Char* file, Nlm_Boolean writeMode, Nlm fgetname(fp,temp); Nlm_FileClose (fp); delete(temp); - fp = Nlm_FileOpen (path, "w"); + fp = Ncbienv_FileOpen (path, "w"); } } return fp; diff --git a/corelib/ncbierr.c b/corelib/ncbierr.c index 58a643af..83f31fb5 100644 --- a/corelib/ncbierr.c +++ b/corelib/ncbierr.c @@ -23,9 +23,9 @@ * * =========================================================================== * -* $Id: ncbierr.c,v 6.21 2003/03/25 14:56:08 ivanov Exp $ +* $Id: ncbierr.c,v 6.22 2005/04/06 19:34:13 lavr Exp $ * -* $Revision: 6.21 $ +* $Revision: 6.22 $ * * Authors: Schuler, Sirotkin (UserErr stuff) * @@ -71,6 +71,9 @@ * 03-06-95 Schuler Fixed problem with ErrMsgRoot_fopen * * $Log: ncbierr.c,v $ +* Revision 6.22 2005/04/06 19:34:13 lavr +* Reassign severity (if found in message file) in case of C++ Tkit hook +* * Revision 6.21 2003/03/25 14:56:08 ivanov * Nlm_AbnormalExitPure(): FatalAppExit() call changed to exit() under MS Windows (by Howard Feldman feldman@mshri.on.ca) * @@ -521,6 +524,7 @@ NLM_EXTERN int LIBCALL Nlm_ErrPostStr (ErrSev sev, int lev1, int lev2, const cha if (info->hook != NULL) { int retval; + info->desc.severity = severity; if ((retval = (*info->hook)(&info->desc)) != 0) { ErrClear(); @@ -529,7 +533,7 @@ NLM_EXTERN int LIBCALL Nlm_ErrPostStr (ErrSev sev, int lev1, int lev2, const cha } if ( s_HookOnly ) { - die_if_necessary(sev, info); + die_if_necessary(severity, info); ErrClear(); return ANS_NONE; } diff --git a/corelib/ncbifile.c b/corelib/ncbifile.c index f0c05cfa..30211d3b 100644 --- a/corelib/ncbifile.c +++ b/corelib/ncbifile.c @@ -29,7 +29,7 @@ * * Version Creation Date: 3/4/91 * -* $Revision: 6.37 $ +* $Revision: 6.38 $ * * File Description: * portable file routines @@ -43,6 +43,9 @@ * 11-27-94 Ostell moved includes to ncbiwin.h to avoid conflict MSC * * $Log: ncbifile.c,v $ +* Revision 6.38 2005/04/20 20:14:31 lavr +* +<assert.h> +* * Revision 6.37 2004/07/21 18:08:30 kans * FileCacheSetup calls _setmode (_fileno (fp), _O_BINARY) if OS_MSWIN * @@ -204,6 +207,7 @@ Removed disabled CD routines. #define THIS_FILE _this_file #include <ncbilcl.h> +#include <assert.h> #include "corepriv.h" #ifdef OS_MAC diff --git a/corelib/ncbimisc.c b/corelib/ncbimisc.c index 85e716ba..88ac6628 100644 --- a/corelib/ncbimisc.c +++ b/corelib/ncbimisc.c @@ -29,7 +29,7 @@ * * Version Creation Date: 10/23/91 * -* $Revision: 6.26 $ +* $Revision: 6.29 $ * * File Description: * miscellaneous functions @@ -43,6 +43,15 @@ * 02-16-94 Epstein Retired Gestalt functions and definitions * * $Log: ncbimisc.c,v $ +* Revision 6.29 2005/04/13 21:36:18 kans +* restored mac ifdefs around Nlm_P2Cstr and Nlm_C2Pstr functions +* +* Revision 6.28 2005/04/13 21:28:44 kans +* Nlm_CtoPstr and Nlm_PtoCstr always uses our own code so we are not dependent on a particular version of Carbon +* +* Revision 6.27 2005/04/13 18:03:21 rsmith +* On OSX don't define C2Pstr/P2Cstr, just implement Nlm_CtoPstr. +* * Revision 6.26 2004/03/25 15:37:24 lavr * Change UINT64_MAX into UINT8_MAX back for the toolkit to compile portably * @@ -1143,11 +1152,11 @@ NLM_EXTERN Nlm_Boolean LIBCALL NodeListDelete (ValNodePtr head, Nlm_Int2 item) #if defined(OS_MAC) || defined(OS_UNIX_DARWIN) -// 2001-03-22: Joshua Juran -// C2PStr() and P2CStr() do not exist in Carbon, so we roll our own. -# if TARGET_API_MAC_CARBON -static void C2PStr(char *ioStr) +/* C2PStr() and P2CStr() may or may not exist in Carbon, so we now always roll our own. */ + +void Nlm_CtoPstr (Nlm_CharPtr str) { + char *ioStr = (char *) str; size_t len = strlen(ioStr); if (len > 255) { len = 255; @@ -1156,32 +1165,17 @@ static void C2PStr(char *ioStr) ioStr[0] = len; } -static void P2CStr(StringPtr ioStr) +void Nlm_PtoCstr (Nlm_CharPtr str) { + StringPtr ioStr = (StringPtr) str; Byte len = ioStr[0]; memmove(ioStr, ioStr + 1, len); ioStr[len] = '\0'; } -# endif - -/* p_churchill 12/99 removed conditional compilation support for - * THINKC and MPW - */ -void Nlm_CtoPstr (Nlm_CharPtr str) -{ - C2PStr ((char *) str); -} - -void Nlm_PtoCstr (Nlm_CharPtr str) - -{ - P2CStr ((StringPtr) str); -} #endif - NLM_EXTERN Nlm_Uint2 Nlm_SwitchUint2 (Nlm_Uint2 value) { |