summaryrefslogtreecommitdiffstats
path: root/Python
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1997-11-22 21:53:48 (GMT)
committerGuido van Rossum <guido@python.org>1997-11-22 21:53:48 (GMT)
commit8e9ebfd337f18f7b707853a3f2f49cc6245c0596 (patch)
treefe6a0f373d376dede8ad635c250ab83c19965a3f /Python
parentc0b93191e6e12fb391461545031808f74a8ae956 (diff)
downloadcpython-8e9ebfd337f18f7b707853a3f2f49cc6245c0596.zip
cpython-8e9ebfd337f18f7b707853a3f2f49cc6245c0596.tar.gz
cpython-8e9ebfd337f18f7b707853a3f2f49cc6245c0596.tar.bz2
os2 patch by Jeff Rush
Diffstat (limited to 'Python')
-rw-r--r--Python/importdl.c38
-rw-r--r--Python/thread.c4
-rw-r--r--Python/thread_os2.h4
3 files changed, 44 insertions, 2 deletions
diff --git a/Python/importdl.c b/Python/importdl.c
index 7f35d13..b11e1e3 100644
--- a/Python/importdl.c
+++ b/Python/importdl.c
@@ -47,6 +47,7 @@ PERFORMANCE OF THIS SOFTWARE.
_AIX -- AIX style dynamic linking
MS_WIN32 -- Windows NT style dynamic linking (using DLLs)
MS_WIN16 -- Windows 16-bit dynamic linking (using DLLs)
+ PYOS_OS2 -- IBM OS/2 dynamic linking (using DLLs)
_DL_FUNCPTR_DEFINED -- if the typedef dl_funcptr has been defined
USE_MAC_DYNAMIC_LOADING -- Mac CFM shared libraries
SHORT_EXT -- short extension for dynamic module, e.g. ".so"
@@ -76,6 +77,17 @@ typedef void (*dl_funcptr)();
#define LONG_EXT "module.sl"
#endif
+#if defined(PYOS_OS2)
+#define DYNAMIC_LINK
+#define INCL_DOSERRORS
+#define INCL_DOSMODULEMGR
+#include <os2.h>
+typedef int (* APIENTRY dl_funcptr)();
+#define _DL_FUNCPTR_DEFINED 1
+#define SHORT_EXT ".pyd"
+#define LONG_EXT ".dll"
+#endif
+
#if defined(__NetBSD__)
#define DYNAMIC_LINK
#define USE_SHLIB
@@ -458,6 +470,32 @@ _PyImport_LoadDynamicModule(name, pathname, fp)
p = GetProcAddress(hDLL, funcname);
}
#endif /* MS_WIN16 */
+
+#if defined(PYOS_OS2)
+ {
+ APIRET rc;
+ HMODULE hDLL;
+ char failreason[256];
+
+ rc = DosLoadModule(failreason,
+ sizeof(failreason),
+ pathname,
+ &hDLL);
+
+ if (rc != NO_ERROR) {
+ char errBuf[256];
+ sprintf(errBuf,
+ "DLL load failed, rc = %d, problem '%s': %s", rc, failreason);
+ PyErr_SetString(PyExc_ImportError, errBuf);
+ return NULL;
+ }
+
+ rc = DosQueryProcAddr(hDLL, 0L, funcname, &p);
+ if (rc != NO_ERROR)
+ p = NULL; /* Signify Failure to Acquire Entrypoint */
+ }
+#endif /* PYOS_OS2 */
+
#ifdef USE_DL
p = dl_loadmod(Py_GetProgramName(), pathname, funcname);
#endif /* USE_DL */
diff --git a/Python/thread.c b/Python/thread.c
index 1698b07..f441752 100644
--- a/Python/thread.c
+++ b/Python/thread.c
@@ -149,6 +149,10 @@ void init_thread _P0()
#include "thread_nt.h"
#endif
+#ifdef OS2_THREADS
+#include "thread_os2.h"
+#endif
+
/*
#ifdef FOOBAR_THREADS
#include "thread_foobar.h"
diff --git a/Python/thread_os2.h b/Python/thread_os2.h
index 314b4cb..d52b236 100644
--- a/Python/thread_os2.h
+++ b/Python/thread_os2.h
@@ -56,7 +56,7 @@ int start_new_thread(void (*func)(void *), void *arg)
int aThread;
int success = 1;
- aThread = _beginthread(func,4096,arg);
+ aThread = _beginthread(func,NULL,65536,arg);
if( aThread == -1 ) {
success = 0;
@@ -210,7 +210,7 @@ void free_sema(type_sema aSemaphore)
}
-void down_sema(type_sema aSemaphore, int waitflag)
+int down_sema(type_sema aSemaphore, int waitflag)
{
return -1;
}