summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTim Peters <tim.peters@gmail.com>2001-11-05 02:45:59 (GMT)
committerTim Peters <tim.peters@gmail.com>2001-11-05 02:45:59 (GMT)
commit603c6831d08d8598f76e767acdd6d37227b3e9ec (patch)
tree81814cbe1ce174dfa90f5ed0177a55f570202d7f
parentc44403995e6fd1a55b39ca86ceb71955cbbf5e25 (diff)
downloadcpython-603c6831d08d8598f76e767acdd6d37227b3e9ec.zip
cpython-603c6831d08d8598f76e767acdd6d37227b3e9ec.tar.gz
cpython-603c6831d08d8598f76e767acdd6d37227b3e9ec.tar.bz2
SF patch 473749 compile under OS/2 VA C++, from Michael Muller.
Changes enabling Python to compile under OS/2 Visual Age C++.
-rw-r--r--Modules/socketmodule.c5
-rw-r--r--PC/os2vacpp/config.c2
-rw-r--r--PC/os2vacpp/makefile71
-rw-r--r--PC/os2vacpp/pyconfig.h12
-rw-r--r--PC/os2vacpp/python.def9
-rw-r--r--Python/bltinmodule.c4
-rw-r--r--Python/importdl.h1
7 files changed, 68 insertions, 36 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 1ecb281..fea6b85 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -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>
diff --git a/PC/os2vacpp/config.c b/PC/os2vacpp/config.c
index 3d54e53..109f455 100644
--- a/PC/os2vacpp/config.c
+++ b/PC/os2vacpp/config.c
@@ -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},
diff --git a/PC/os2vacpp/makefile b/PC/os2vacpp/makefile
index 66dfc32..1c3d008 100644
--- a/PC/os2vacpp/makefile
+++ b/PC/os2vacpp/makefile
@@ -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:
diff --git a/PC/os2vacpp/pyconfig.h b/PC/os2vacpp/pyconfig.h
index a5a2f51..1ce73c7 100644
--- a/PC/os2vacpp/pyconfig.h
+++ b/PC/os2vacpp/pyconfig.h
@@ -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 */
@@ -79,6 +79,14 @@
/* #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> */
diff --git a/PC/os2vacpp/python.def b/PC/os2vacpp/python.def
index 6477536..5376935 100644
--- a/PC/os2vacpp/python.def
+++ b/PC/os2vacpp/python.def
@@ -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
diff --git a/Python/bltinmodule.c b/Python/bltinmodule.c
index 5f5ae4c..b6e4460 100644
--- a/Python/bltinmodule.c
+++ b/Python/bltinmodule.c
@@ -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;
}
diff --git a/Python/importdl.h b/Python/importdl.h
index 4193620..76fd05d 100644
--- a/Python/importdl.h
+++ b/Python/importdl.h
@@ -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);