]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
SF patch 473749 compile under OS/2 VA C++, from Michael Muller.
authorTim Peters <tim.peters@gmail.com>
Mon, 5 Nov 2001 02:45:59 +0000 (02:45 +0000)
committerTim Peters <tim.peters@gmail.com>
Mon, 5 Nov 2001 02:45:59 +0000 (02:45 +0000)
Changes enabling Python to compile under OS/2 Visual Age C++.

Modules/socketmodule.c
PC/os2vacpp/config.c
PC/os2vacpp/makefile
PC/os2vacpp/pyconfig.h
PC/os2vacpp/python.def
Python/bltinmodule.c
Python/importdl.h

index 1ecb2810c95187cc92770842c03c673c18bd66fa..fea6b85b392619b3f3ea0114ff894535c245a005 100644 (file)
@@ -142,13 +142,16 @@ Socket methods:
 #include <netdb.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
-#if !(defined(__BEOS__) || defined(__CYGWIN__))
+#if !(defined(__BEOS__) || defined(__CYGWIN__) || (defined(PYOS_OS2) && defined(PYCC_VACPP)))
 #include <netinet/tcp.h>
 #endif
 
 /* Headers needed for inet_ntoa() and inet_addr() */
 #ifdef __BEOS__
 #include <net/netdb.h>
+#elif defined(PYOS_OS2) && defined(PYCC_VACPP)
+#include <netdb.h>
+typedef size_t socklen_t;
 #else
 #ifndef USE_GUSI1
 #include <arpa/inet.h>
index 3d54e53b3c9169aceda2751d27b00e87c88112e5..109f455a1d933637bfb5d93a06d54548301348aa 100644 (file)
@@ -34,7 +34,6 @@ extern void initrotor(void);
 extern void initsignal(void);
 extern void initselect(void);
 extern void init_socket(void);
-extern void initsoundex(void);
 extern void initstrop(void);
 extern void initstruct(void);
 extern void inittime(void);
@@ -82,7 +81,6 @@ struct _inittab _PyImport_Inittab[] = {
         {"_socket", init_socket},
         {"select", initselect},
 #endif
-        {"soundex", initsoundex},
         {"strop", initstrop},
         {"struct", initstruct},
         {"time", inittime},
index 66dfc32d41c396f89c2554625f5bc2c271694f14..1c3d008a9d6c6b93806b3f6cc5b9d411a691e2fc 100644 (file)
@@ -65,8 +65,7 @@ MKMF_SRCS     = $(PY_MODULES)\*.c $(PY_OBJECTS)\*.c $(PY_PARSER)\*.c $(PY_PYTHON)\*.
 
 #.HDRPATH.c    := $(PROJINCLUDE,;= ) $(.HDRPATH.c)
 #.PATH.c         = .;$(PY_MODULES);$(PY_OBJECTS);$(PY_PARSER);$(PY_PYTHON)
-OTHERLIBS      = $(OS2TCPIP)\lib\so32dll.lib $(OS2TCPIP)\lib\tcp32dll.lib \
-                  $(TCLTK)\Lib\Tcl76.lib $(TCLTK)\Lib\Tk42.lib
+OTHERLIBS      = so32dll.lib tcp32dll.lib # Tcl76.lib Tk42.lib
 
 #################
 # Inference Rules
@@ -121,7 +120,14 @@ PYTHON             =                               \
                   $(PATHOBJ)\SysModule.obj      \
                   $(PATHOBJ)\Thread.obj         \
                   $(PATHOBJ)\TraceBack.obj      \
-                  $(PATHOBJ)\FrozenMain.obj
+                  $(PATHOBJ)\FrozenMain.obj     \
+                  $(PATHOBJ)\exceptions.obj     \
+                  $(PATHOBJ)\symtable.obj       \
+                  $(PATHOBJ)\codecs.obj         \
+                  $(PATHOBJ)\future.obj         \
+                  $(PATHOBJ)\dynload_os2.obj    \
+                  $(PATHOBJ)\mysnprintf.obj     \
+                  $(PATHOBJ)\iterobject.obj
 
 # Python's Internal Parser
 PARSER         =                              \
@@ -154,7 +160,13 @@ OBJECTS            =                              \
                   $(PATHOBJ)\SliceObject.obj   \
                   $(PATHOBJ)\StringObject.obj  \
                   $(PATHOBJ)\TupleObject.obj   \
-                  $(PATHOBJ)\TypeObject.obj
+                  $(PATHOBJ)\TypeObject.obj    \
+                  $(PATHOBJ)\unicodeobject.obj \
+                  $(PATHOBJ)\unicodectype.obj  \
+                  $(PATHOBJ)\cellobject.obj    \
+                  $(PATHOBJ)\descrobject.obj   \
+                  $(PATHOBJ)\weakrefobject.obj \
+                  $(PATHOBJ)\structseq.obj
 
 # Extension Modules (Built-In or as Separate DLLs)
 MODULES                =                              \
@@ -181,12 +193,13 @@ MODULES           =                              \
                   $(PATHOBJ)\SelectModule.obj  \
                   $(PATHOBJ)\SignalModule.obj  \
                   $(PATHOBJ)\SocketModule.obj  \
-                  $(PATHOBJ)\SoundEx.obj       \
                   $(PATHOBJ)\StropModule.obj   \
                   $(PATHOBJ)\StructModule.obj  \
                   $(PATHOBJ)\TimeModule.obj    \
                   $(PATHOBJ)\ThreadModule.obj  \
-                  $(PATHOBJ)\YUVConvert.obj
+                  $(PATHOBJ)\YUVConvert.obj    \
+                  $(PATHOBJ)\bufferobject.obj  \
+                  $(PATHOBJ)\gcmodule.obj
 
 # Standalone Parser Generator Program (Shares Some of Python's Modules)
 PGEN            =                              \
@@ -211,7 +224,7 @@ _GEN                = /G4 /Gm /Gd-
                # /Gm  = Use Multithread Runtime
                # /Gd  = Dynamically Load Runtime
                # /Ms  = Use _System Calling Convention (vs _Optlink)
-               #        (to allow non-VAC++ code to call into Python15.dll)
+               #        (to allow non-VAC++ code to call into Python22.dll)
 
 _OPT           = /O /Gl
                # /O   = Enable Speed-Optimizations
@@ -246,8 +259,8 @@ CFLAGS              = $(_BASE) $(_GEN) $(_OPT) $(_DBG) $(_OUT) $(_EXE) /Ss
 ###################
 # Primary Target(s)
 ###################
-All:  obj noise PyCore.lib Python15.lib PGen.exe \
-      Python.exe PythonPM.exe Python15.dll _tkinter.dll
+All:  obj noise PyCore.lib Python22.lib PGen.exe \
+      Python.exe PythonPM.exe Python22.dll # _tkinter.dll
 
 Modules: $(MODULES)
 Objects: $(OBJECTS)
@@ -267,43 +280,43 @@ noise:
 ##############
 
 # Python Extension DLL: Tcl/Tk Interface
-_tkinter.dll: $(PATHOBJ)\_tkinter.obj Python15.lib _tkinter.def
-       @ Echo Linking $@ As DLL
-       @ $(CC) $(CFLAGS) /B"/NOE" $(_DLL) /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
+#_tkinter.dll: $(PATHOBJ)\_tkinter.obj Python22.lib _tkinter.def
+#      @ Echo Linking $@ As DLL
+#      @ $(CC) $(CFLAGS) /B"/NOE" $(_DLL) /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
 
-$(PATHOBJ)\_tkinter.obj: $(PY_MODULES)\_tkinter.c
-       @ Echo Compiling $**
-       @ $(CC) -c $(CFLAGS) $(_DLL) -Fo$@ $** >>$(ERRS)
+#$(PATHOBJ)\_tkinter.obj: $(PY_MODULES)\_tkinter.c
+#      @ Echo Compiling $**
+#      @ $(CC) -c $(CFLAGS) $(_DLL) -Fo$@ $** >>$(ERRS)
 
 # Object Library of All Essential Python Routines
 PyCore.lib: $(MODULES) $(OBJECTS) $(PARSER) $(PYTHON) $(PATHOBJ)\Config.obj
        @ Echo Adding Updated Object Files to Link Library $@
        @ ! ILIB $@ /NOLOGO /NOBACKUP -+$? ; >>$(ERRS)
 
-Python15.dll: $(PATHOBJ)\Compile.obj PyCore.lib Python.def
+Python22.dll: $(PATHOBJ)\Compile.obj PyCore.lib Python.def
        @ Echo Linking $@ As DLL
        @ $(CC) $(CFLAGS) /B"/NOE" $(_DLL) /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
-       @ Echo Compressing $@ with LxLite
-       @ lxlite $@
+#      @ Echo Compressing $@ with LxLite
+#      @ lxlite $@
 
 # IBM Linker Requires One Explicit .OBJ To Build a .DLL from a .LIB
 $(PATHOBJ)\Compile.obj: $(PY_PYTHON)\Compile.c
        @ Echo Compiling $**
        @ $(CC) -c $(CFLAGS) $(_DLL) -Fo$@ $** >>$(ERRS)
 
-# Import Library for Using the Python15.dll
-Python15.lib: Python.def
+# Import Library for Using the Python22.dll
+Python22.lib: Python.def
        @ Echo Making $@
        @ IMPLIB /NOLOGO /NOIGNORE $@ $** >>$(ERRS)
        @ ILIB /NOLOGO /CONVFORMAT /NOEXTDICTIONARY /NOBROWSE /NOBACKUP $@; >>$(ERRS)
 
-# Small Command-Line Program to Start Interpreter in Python15.dll
-Python.exe: $(PATHOBJ)\Python.obj Python15.lib
+# Small Command-Line Program to Start Interpreter in Python22.dll
+Python.exe: $(PATHOBJ)\Python.obj Python22.lib
        @ Echo Linking $@ As EXE
        @ $(CC) $(CFLAGS) $(_EXE) /B"/PM:VIO /STACK:360000" /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
 
-# Small PM-GUI Program to Start Interpreter in Python15.dll
-PythonPM.exe: $(PATHOBJ)\Python.obj Python15.lib
+# Small PM-GUI Program to Start Interpreter in Python22.dll
+PythonPM.exe: $(PATHOBJ)\Python.obj Python22.lib
        @ Echo Linking $@ As EXE
        @ $(CC) $(CFLAGS) $(_EXE) /B"/PM:PM /STACK:360000" /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
 
@@ -323,13 +336,13 @@ clean:
 
 # Remove All Targets, Including Final Binaries
 distclean: clean
-        -- Del /Q PyCore.lib Python15.lib       >NUL 2>&1
-        -- Del /Q Python15.dll Python.exe PGen.exe >NUL 2>&1
+        -- Del /Q PyCore.lib Python22.lib       >NUL 2>&1
+        -- Del /Q Python22.dll Python.exe PGen.exe >NUL 2>&1
 
-release: Python.exe Python15.dll Python15.lib
+release: Python.exe Python22.dll Python22.lib
        -- @Echo Y | copy /U Python.exe   D:\EXEs
-       -- @Echo Y | copy /U Python15.dll D:\DLLs
-       -- @Echo Y | copy /U Python15.lib E:\Tau\Lib
+       -- @Echo Y | copy /U Python22.dll D:\DLLs
+       -- @Echo Y | copy /U Python22.lib E:\Tau\Lib
        -- @Echo Y | copy /U _tkinter.dll D:\Python
 
 test:
index a5a2f5178845a22380e3931ac0e881f81bc37e1c..1ce73c7e89564c8cec435fa24632e291b4b07569 100644 (file)
@@ -54,7 +54,7 @@
 /* Provide a default library so writers of extension modules
  * won't have to explicitly specify it anymore
  */
-#pragma library("Python15.lib")
+#pragma library("Python22.lib")
 
 /***************************************************/
 /*    32-Bit IBM VisualAge C/C++ v3.0 for OS/2     */
 /* #define HAVE_LONG_LONG     1 */ /* VAC++ does not support (long long)    */
 /* #define SIZEOF_LONG_LONG   8 */ /* Count of Bytes in a (long long)       */
 
+/* unicode definines */
+#define Py_USING_UNICODE
+#define PY_UNICODE_TYPE    wchar_t
+#define Py_UNICODE_SIZE SIZEOF_SHORT
+
+/* dynamic loading */
+#define HAVE_DYNAMIC_LOADING 1
+
 /* Define if type char is unsigned and you are not using gcc.  */
 #ifndef __CHAR_UNSIGNED__
 /* #undef __CHAR_UNSIGNED__ */
@@ -188,7 +196,7 @@ typedef int pid_t;
 /* #define HAVE_GETUID        1 */
 
   /* Unix-Specific */
-#define HAVE_SYS_UN_H            1 /* #include <sys/un.h>                   */
+/* #define HAVE_SYS_UN_H            1 /* #include <sys/un.h>                   */
 /* #define HAVE_SYS_UTSNAME_H 1 */ /* #include <sys/utsname.h>              */
 /* #define HAVE_SYS_WAIT_H    1 */ /* #include <sys/wait.h>                 */
 /* #define HAVE_UNISTD_H      1 */ /* #include <unistd.h>                   */
index 64775361d5233e9c94c4db543c896c794926a160..53769355f35b724b32978078e4749ed2fdb42001 100644 (file)
@@ -1,5 +1,5 @@
-LIBRARY        PYTHON15 INITINSTANCE TERMINSTANCE
-DESCRIPTION    'Python 1.5 Core DLL'
+LIBRARY        PYTHON22 INITINSTANCE TERMINSTANCE
+DESCRIPTION    'Python 2.2 Core DLL'
 PROTMODE
 DATA           MULTIPLE NONSHARED
 
@@ -472,4 +472,9 @@ EXPORTS
                _Py_re_search
                _Py_re_set_syntax
 ;               _Py_samebitset
+               PyBuffer_Type
+               PyBuffer_FromObject
+               PyBuffer_FromMemory
+               PyBuffer_FromReadWriteMemory
+               PyBuffer_New
 
index 5f5ae4ca427cdba3ede9431e590fa0c11d19ba0a..b6e44608133d87a2fa89d31c541b5711aa16c9f4 100644 (file)
@@ -567,7 +567,11 @@ builtin_execfile(PyObject *self, PyObject *args)
 #ifndef RISCOS
        if (!stat(filename, &s)) {
                if (S_ISDIR(s.st_mode))
+#if defined(PYOS_OS2) && defined(PYCC_VACPP)
+                       errno = EOS2ERR;
+#else
                        errno = EISDIR;
+#endif
                else
                        exists = 1;
        }
index 4193620bd2806be45a4abe9b699ef3202ef9ec39..76fd05d29337ccf4947fd76d68b8ad67224e34b2 100644 (file)
@@ -38,6 +38,7 @@ extern PyObject *_PyImport_LoadDynamicModule(char *name, char *pathname,
 typedef FARPROC dl_funcptr;
 #else
 #ifdef PYOS_OS2
+#include <os2def.h>
 typedef int (* APIENTRY dl_funcptr)();
 #else
 typedef void (*dl_funcptr)(void);