mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
ported to 68K Mac; changed suffix to .slb
This commit is contained in:
parent
0acd4b6e82
commit
6a75d26622
1 changed files with 18 additions and 26 deletions
|
@ -42,8 +42,7 @@ extern int verbose; /* Defined in pythonrun.c */
|
||||||
_AIX -- AIX style dynamic linking
|
_AIX -- AIX style dynamic linking
|
||||||
NT -- NT style dynamic linking (using DLLs)
|
NT -- NT style dynamic linking (using DLLs)
|
||||||
_DL_FUNCPTR_DEFINED -- if the typedef dl_funcptr has been defined
|
_DL_FUNCPTR_DEFINED -- if the typedef dl_funcptr has been defined
|
||||||
WITH_MAC_DL -- Mac dynamic linking (highly experimental)
|
USE_MAC_SHARED_LIBRARY -- Mac CFM shared libraries
|
||||||
USE_MAC_SHARED_LIBRARY -- Another mac dynamic linking method
|
|
||||||
SHORT_EXT -- short extension for dynamic module, e.g. ".so"
|
SHORT_EXT -- short extension for dynamic module, e.g. ".so"
|
||||||
LONG_EXT -- long extension, e.g. "module.so"
|
LONG_EXT -- long extension, e.g. "module.so"
|
||||||
hpux -- HP-UX Dynamic Linking - defined by the compiler
|
hpux -- HP-UX Dynamic Linking - defined by the compiler
|
||||||
|
@ -95,14 +94,14 @@ typedef FARPROC dl_funcptr;
|
||||||
#define USE_DL
|
#define USE_DL
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_MAC_DL
|
#ifdef __CFM68K__
|
||||||
#define DYNAMIC_LINK
|
#define USE_MAC_SHARED_LIBRARY
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef USE_MAC_SHARED_LIBRARY
|
#ifdef USE_MAC_SHARED_LIBRARY
|
||||||
#define DYNAMIC_LINK
|
#define DYNAMIC_LINK
|
||||||
#define SHORT_EXT ".shlb"
|
#define SHORT_EXT ".slb"
|
||||||
#define LONG_EXT "module.shlb"
|
#define LONG_EXT "module.slb"
|
||||||
#ifndef _DL_FUNCPTR_DEFINED
|
#ifndef _DL_FUNCPTR_DEFINED
|
||||||
typedef void (*dl_funcptr)();
|
typedef void (*dl_funcptr)();
|
||||||
#endif
|
#endif
|
||||||
|
@ -144,12 +143,12 @@ typedef void (*dl_funcptr)();
|
||||||
#include "dl.h"
|
#include "dl.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef WITH_MAC_DL
|
|
||||||
#include "dynamic_load.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef USE_MAC_SHARED_LIBRARY
|
#ifdef USE_MAC_SHARED_LIBRARY
|
||||||
#include <CodeFragments.h>
|
#include <CodeFragments.h>
|
||||||
|
#ifdef __SC__ /* Really just an older version of Universal Headers */
|
||||||
|
#define CFragConnectionID ConnectionID
|
||||||
|
#define kLoadCFrag 0x01
|
||||||
|
#endif
|
||||||
#include <Files.h>
|
#include <Files.h>
|
||||||
#include "macdefs.h"
|
#include "macdefs.h"
|
||||||
#include "macglue.h"
|
#include "macglue.h"
|
||||||
|
@ -180,7 +179,7 @@ extern char *getprogramname();
|
||||||
|
|
||||||
#endif /* DYNAMIC_LINK */
|
#endif /* DYNAMIC_LINK */
|
||||||
|
|
||||||
/* Max length of module suffix searched for -- accommodates "module.shlb" */
|
/* Max length of module suffix searched for -- accommodates "module.slb" */
|
||||||
#ifndef MAXSUFFIXSIZE
|
#ifndef MAXSUFFIXSIZE
|
||||||
#define MAXSUFFIXSIZE 12
|
#define MAXSUFFIXSIZE 12
|
||||||
#endif
|
#endif
|
||||||
|
@ -213,29 +212,23 @@ load_dynamic_module(name, pathname)
|
||||||
char funcname[258];
|
char funcname[258];
|
||||||
dl_funcptr p = NULL;
|
dl_funcptr p = NULL;
|
||||||
sprintf(funcname, FUNCNAME_PATTERN, name);
|
sprintf(funcname, FUNCNAME_PATTERN, name);
|
||||||
#ifdef WITH_MAC_DL
|
|
||||||
{
|
|
||||||
object *v = dynamic_load(pathname);
|
|
||||||
if (v == NULL)
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
#else /* !WITH_MAC_DL */
|
|
||||||
#ifdef USE_MAC_SHARED_LIBRARY
|
#ifdef USE_MAC_SHARED_LIBRARY
|
||||||
/* Another way to do dynloading on the mac, use CFM */
|
/* Dynamic loading of CFM shared libraries on the Mac */
|
||||||
{
|
{
|
||||||
FSSpec libspec;
|
FSSpec libspec;
|
||||||
CFragConnectionID connID;
|
CFragConnectionID connID;
|
||||||
Ptr mainAddr;
|
Ptr mainAddr;
|
||||||
Str255 errMessage;
|
Str255 errMessage;
|
||||||
OSErr err;
|
OSErr err;
|
||||||
|
|
||||||
(void)FSMakeFSSpec(0, 0, Pstring(pathname), &libspec);
|
(void)FSMakeFSSpec(0, 0, Pstring(pathname), &libspec);
|
||||||
err = GetDiskFragment(&libspec, 0, 0, Pstring(name), kLoadCFrag, &connID, &mainAddr,
|
err = GetDiskFragment(&libspec, 0, 0, Pstring(name),
|
||||||
errMessage);
|
kLoadCFrag, &connID, &mainAddr,
|
||||||
|
errMessage);
|
||||||
if ( err ) {
|
if ( err ) {
|
||||||
char buf[512];
|
char buf[512];
|
||||||
|
|
||||||
sprintf(buf, "%#s: %s", errMessage, macstrerror(err));
|
sprintf(buf, "%#s: %s", errMessage, PyMac_StrError(err));
|
||||||
err_setstr(ImportError, buf);
|
err_setstr(ImportError, buf);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -355,7 +348,6 @@ load_dynamic_module(name, pathname)
|
||||||
}
|
}
|
||||||
(*p)();
|
(*p)();
|
||||||
|
|
||||||
#endif /* !WITH_MAC_DL */
|
|
||||||
m = dictlookup(import_modules, name);
|
m = dictlookup(import_modules, name);
|
||||||
if (m == NULL) {
|
if (m == NULL) {
|
||||||
if (err_occurred() == NULL)
|
if (err_occurred() == NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue