diff options
author | Aaron M. Ucko <ucko@debian.org> | 2005-12-08 22:58:31 +0000 |
---|---|---|
committer | Aaron M. Ucko <ucko@debian.org> | 2005-12-08 22:58:31 +0000 |
commit | 4b1edc60532e16ec7d0255e1c3552c2e6a33737e (patch) | |
tree | acef5e2808d7dbc8a9c41da8ef71b1436f51718e /corelib | |
parent | 23f1d44b259776e399f7fe0fe883c7e9445e192b (diff) |
Load /tmp/.../ncbi-tools6-6.1.20051206 into
branches/upstream/current.
Diffstat (limited to 'corelib')
-rw-r--r-- | corelib/ncbienv.c | 72 | ||||
-rw-r--r-- | corelib/ncbilcl.dwn | 37 | ||||
-rw-r--r-- | corelib/ncbimisc.c | 9 | ||||
-rw-r--r-- | corelib/ncbiopt.h | 8 |
4 files changed, 104 insertions, 22 deletions
diff --git a/corelib/ncbienv.c b/corelib/ncbienv.c index acc2a3de..9529e122 100644 --- a/corelib/ncbienv.c +++ b/corelib/ncbienv.c @@ -29,7 +29,7 @@ * * Version Creation Date: 7/7/91 * -* $Revision: 6.38 $ +* $Revision: 6.43 $ * * File Description: * portable environment functions, companions for ncbimain.c @@ -37,6 +37,21 @@ * Modifications: * -------------------------------------------------------------------------- * $Log: ncbienv.c,v $ +* Revision 6.43 2005/12/02 13:40:00 rsmith +* In ProgramPath on Mac use case-insensitive compare to check the file extension. +* +* Revision 6.42 2005/12/01 19:52:19 rsmith +* Change impl of Mac's Nlm_ProgramPath_ST to only use CoreFoundation calls. +* +* Revision 6.41 2005/11/28 21:04:25 rsmith +* Don't need to call GetProcess in Mac's ProgramPath +* +* Revision 6.40 2005/11/22 20:53:19 rsmith +* Nlm_ProgramPath on Mac always return path to the .app bundle. +* +* Revision 6.39 2005/11/16 16:36:11 kans +* support for PowerPC and Intel chips for Macintosh +* * Revision 6.38 2004/10/27 20:00:44 kans * Ncbienv_FileOpen suppresses missing file error post * @@ -1935,24 +1950,37 @@ static Nlm_Boolean Nlm_SetupArguments_ST_Mac(void) } #if defined(OS_UNIX_DARWIN) -#ifndef __GNUC__ -/* At least in 10.1, this seems to introduce an unwanted dep. on Carbon. */ +/* this requires the CoreFoundation framework, but nothing more. */ static void Nlm_ProgramPath_ST(Nlm_Char* appPath, size_t pathSize) { - OSErr err; - ProcessSerialNumber psn; - - if (appPath != NULL) { - FSRef fsRef; - appPath[0] = '\0'; - GetCurrentProcess (&psn); - err = GetProcessBundleLocation (&psn, &fsRef); - if (err == noErr) { - FSRefMakePath (&fsRef, (UInt8 *) appPath, pathSize); - } - } + CFBundleRef thisBundle; + CFURLRef thisURL; + int pathsuffix_pos; + static const char* appsuffix = ".app"; + + thisBundle = CFBundleGetMainBundle(); + if (thisBundle == NULL) + return; + + thisURL = CFBundleCopyBundleURL(thisBundle); + if (thisURL == NULL) return; + if (!CFURLGetFileSystemRepresentation( thisURL, true, (UInt8 *) appPath, pathSize)) { + return; + } + /* Does this path end with the .app suffix? */ + pathsuffix_pos = strlen(appPath) - strlen(appsuffix); + if (pathsuffix_pos > 0 && + 0 == Nlm_StrICmp(appPath + pathsuffix_pos, appsuffix) ) { + /* this is a bundled app. */ + return; + } + + /* this is not a bundled app. The above got me my directory. */ + thisURL = CFBundleCopyExecutableURL(thisBundle); + if (thisURL == NULL) + return; + CFURLGetFileSystemRepresentation( thisURL, true, (UInt8 *) appPath, pathSize); } -#endif /* is the application at filePath actually a application bundle/package? @@ -2026,7 +2054,7 @@ static void Nlm_ProgramPath_ST(Nlm_Char* buf, size_t maxsize) #endif /* OS_MSWIN || OS_VMS */ -#if defined(OS_UNIX) && (defined(__GNUC__) || !defined(OS_UNIX_DARWIN)) +#if defined(OS_UNIX) && !defined(OS_UNIX_DARWIN) static void Nlm_ProgramPath_ST(Nlm_Char* buf, size_t maxsize) { Nlm_Char path [PATH_MAX]; @@ -2391,9 +2419,19 @@ NLM_EXTERN Nlm_CharPtr Nlm_GetOpSysString (void) #ifdef OS_UNIX /* initial nonspecific UNIX string */ str = "UNIX"; + #ifdef OS_UNIX_DARWIN +#ifdef PROC_PPC + str = "MAC PPC on OS X"; +#else +#ifdef PROC_I80X86 + str = "MAC 386 on OS X"; +#else str = "MAC UNIX on OS X"; #endif +#endif +#endif + #ifdef OS_UNIX_SYSV str = "SYSV UNIX"; #endif diff --git a/corelib/ncbilcl.dwn b/corelib/ncbilcl.dwn index 660faafc..cf0bfadd 100644 --- a/corelib/ncbilcl.dwn +++ b/corelib/ncbilcl.dwn @@ -29,7 +29,7 @@ * * Version Creation Date: 8/1/94 * -* $Revision: 6.6 $ +* $Revision: 6.7 $ * * File Description: * system dependent header @@ -41,6 +41,9 @@ * ------- ---------- --------------------------------------------------- * * $Log: ncbilcl.dwn,v $ +* Revision 6.7 2005/11/16 16:22:32 kans +* support for PowerPC and Intel chips in PROC_ and _ENDIAN flags +* * Revision 6.6 2003/09/05 21:22:58 beloslyu * add DARWIN def * @@ -82,7 +85,23 @@ #define OS_UNIX #define DARWIN #define OS_UNIX_DARWIN + +/* Mac may be PowerPC or Intel chip */ +#ifdef PER_ARCH_CFLAGS_ppc #define PROC_PPC +#endif +#ifdef PER_ARCH_CFLAGS_i386 +#define PROC_I80X86 +#define PROC_I80_386 +#endif + +/* for backward compatibility */ +#ifndef PROC_I80X86 +#ifndef PROC_PPC +#define PROC_PPC +#endif +#endif + #define WIN_DUMB /*----------------------------------------------------------------------*/ @@ -150,7 +169,21 @@ #define KBYTE (1024) #define MBYTE (1048576) -#define IS_BIG_ENDIAN +/* Mac may be PowerPC or Intel chip */ +#ifdef __BIG_ENDIAN__ +#define IS_BIG_ENDIAN +#endif +#ifdef __LITTLE_ENDIAN__ +#define IS_LITTLE_ENDIAN +#endif + +/* for backward compatibility */ +#ifndef IS_LITTLE_ENDIAN +#ifndef IS_BIG_ENDIAN +#define IS_BIG_ENDIAN +#endif +#endif + #define TEMPNAM_AVAIL /*----------------------------------------------------------------------*/ diff --git a/corelib/ncbimisc.c b/corelib/ncbimisc.c index 88ac6628..96e2ab64 100644 --- a/corelib/ncbimisc.c +++ b/corelib/ncbimisc.c @@ -29,7 +29,7 @@ * * Version Creation Date: 10/23/91 * -* $Revision: 6.29 $ +* $Revision: 6.30 $ * * File Description: * miscellaneous functions @@ -43,6 +43,9 @@ * 02-16-94 Epstein Retired Gestalt functions and definitions * * $Log: ncbimisc.c,v $ +* Revision 6.30 2005/11/16 16:36:11 kans +* support for PowerPC and Intel chips for Macintosh +* * Revision 6.29 2005/04/13 21:36:18 kans * restored mac ifdefs around Nlm_P2Cstr and Nlm_C2Pstr functions * @@ -1677,7 +1680,9 @@ NLM_EXTERN const Nlm_Char* Nlm_PlatformName(void) /* Mac */ #if defined(OS_MAC) # if defined(PROC_PPC) - return "PowerPC"; + return "MacOS_PPC"; +# elif defined(PROC_I80X86) + return "MacOS_386"; # elif defined(PROC_MC680X0) return "MacOS_68K"; # else diff --git a/corelib/ncbiopt.h b/corelib/ncbiopt.h index d3f38828..0813062c 100644 --- a/corelib/ncbiopt.h +++ b/corelib/ncbiopt.h @@ -1,7 +1,7 @@ #ifndef _NCBIOPT_ #define _NCBIOPT_ -/* $Id: ncbiopt.h,v 6.15 2004/07/15 15:11:45 ucko Exp $ +/* $Id: ncbiopt.h,v 6.16 2005/11/16 16:36:11 kans Exp $ * ========================================================================== * * PUBLIC DOMAIN NOTICE @@ -34,6 +34,9 @@ * * -------------------------------------------------------------------------- * $Log: ncbiopt.h,v $ +* Revision 6.16 2005/11/16 16:36:11 kans +* support for PowerPC and Intel chips for Macintosh +* * Revision 6.15 2004/07/15 15:11:45 ucko * Disable workaround for Linux distributions (RH7?) that misdefine LONG_BIT. * @@ -167,6 +170,9 @@ by including it first. # if defined(PROC_PPC) # define Int8 long long # define Uint8 unsigned long long +# elif defined(PROC_I80X86) +# define Int8 long long +# define Uint8 unsigned long long # elif defined(PROC_MC680X0) # define Int8 long long # define Uint8 unsigned long long |