mirror of
https://github.com/python/cpython.git
synced 2025-10-17 12:18:23 +00:00
SF patch 473749 compile under OS/2 VA C++, from Michael Muller.
Changes enabling Python to compile under OS/2 Visual Age C++.
This commit is contained in:
parent
c44403995e
commit
603c6831d0
7 changed files with 68 additions and 36 deletions
|
@ -142,13 +142,16 @@ Socket methods:
|
||||||
#include <netdb.h>
|
#include <netdb.h>
|
||||||
#include <sys/socket.h>
|
#include <sys/socket.h>
|
||||||
#include <netinet/in.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>
|
#include <netinet/tcp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Headers needed for inet_ntoa() and inet_addr() */
|
/* Headers needed for inet_ntoa() and inet_addr() */
|
||||||
#ifdef __BEOS__
|
#ifdef __BEOS__
|
||||||
#include <net/netdb.h>
|
#include <net/netdb.h>
|
||||||
|
#elif defined(PYOS_OS2) && defined(PYCC_VACPP)
|
||||||
|
#include <netdb.h>
|
||||||
|
typedef size_t socklen_t;
|
||||||
#else
|
#else
|
||||||
#ifndef USE_GUSI1
|
#ifndef USE_GUSI1
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
|
|
|
@ -34,7 +34,6 @@ extern void initrotor(void);
|
||||||
extern void initsignal(void);
|
extern void initsignal(void);
|
||||||
extern void initselect(void);
|
extern void initselect(void);
|
||||||
extern void init_socket(void);
|
extern void init_socket(void);
|
||||||
extern void initsoundex(void);
|
|
||||||
extern void initstrop(void);
|
extern void initstrop(void);
|
||||||
extern void initstruct(void);
|
extern void initstruct(void);
|
||||||
extern void inittime(void);
|
extern void inittime(void);
|
||||||
|
@ -82,7 +81,6 @@ struct _inittab _PyImport_Inittab[] = {
|
||||||
{"_socket", init_socket},
|
{"_socket", init_socket},
|
||||||
{"select", initselect},
|
{"select", initselect},
|
||||||
#endif
|
#endif
|
||||||
{"soundex", initsoundex},
|
|
||||||
{"strop", initstrop},
|
{"strop", initstrop},
|
||||||
{"struct", initstruct},
|
{"struct", initstruct},
|
||||||
{"time", inittime},
|
{"time", inittime},
|
||||||
|
|
|
@ -65,8 +65,7 @@ MKMF_SRCS = $(PY_MODULES)\*.c $(PY_OBJECTS)\*.c $(PY_PARSER)\*.c $(PY_PYTHON)\*.
|
||||||
|
|
||||||
#.HDRPATH.c := $(PROJINCLUDE,;= ) $(.HDRPATH.c)
|
#.HDRPATH.c := $(PROJINCLUDE,;= ) $(.HDRPATH.c)
|
||||||
#.PATH.c = .;$(PY_MODULES);$(PY_OBJECTS);$(PY_PARSER);$(PY_PYTHON)
|
#.PATH.c = .;$(PY_MODULES);$(PY_OBJECTS);$(PY_PARSER);$(PY_PYTHON)
|
||||||
OTHERLIBS = $(OS2TCPIP)\lib\so32dll.lib $(OS2TCPIP)\lib\tcp32dll.lib \
|
OTHERLIBS = so32dll.lib tcp32dll.lib # Tcl76.lib Tk42.lib
|
||||||
$(TCLTK)\Lib\Tcl76.lib $(TCLTK)\Lib\Tk42.lib
|
|
||||||
|
|
||||||
#################
|
#################
|
||||||
# Inference Rules
|
# Inference Rules
|
||||||
|
@ -121,7 +120,14 @@ PYTHON = \
|
||||||
$(PATHOBJ)\SysModule.obj \
|
$(PATHOBJ)\SysModule.obj \
|
||||||
$(PATHOBJ)\Thread.obj \
|
$(PATHOBJ)\Thread.obj \
|
||||||
$(PATHOBJ)\TraceBack.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
|
# Python's Internal Parser
|
||||||
PARSER = \
|
PARSER = \
|
||||||
|
@ -154,7 +160,13 @@ OBJECTS = \
|
||||||
$(PATHOBJ)\SliceObject.obj \
|
$(PATHOBJ)\SliceObject.obj \
|
||||||
$(PATHOBJ)\StringObject.obj \
|
$(PATHOBJ)\StringObject.obj \
|
||||||
$(PATHOBJ)\TupleObject.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)
|
# Extension Modules (Built-In or as Separate DLLs)
|
||||||
MODULES = \
|
MODULES = \
|
||||||
|
@ -181,12 +193,13 @@ MODULES = \
|
||||||
$(PATHOBJ)\SelectModule.obj \
|
$(PATHOBJ)\SelectModule.obj \
|
||||||
$(PATHOBJ)\SignalModule.obj \
|
$(PATHOBJ)\SignalModule.obj \
|
||||||
$(PATHOBJ)\SocketModule.obj \
|
$(PATHOBJ)\SocketModule.obj \
|
||||||
$(PATHOBJ)\SoundEx.obj \
|
|
||||||
$(PATHOBJ)\StropModule.obj \
|
$(PATHOBJ)\StropModule.obj \
|
||||||
$(PATHOBJ)\StructModule.obj \
|
$(PATHOBJ)\StructModule.obj \
|
||||||
$(PATHOBJ)\TimeModule.obj \
|
$(PATHOBJ)\TimeModule.obj \
|
||||||
$(PATHOBJ)\ThreadModule.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)
|
# Standalone Parser Generator Program (Shares Some of Python's Modules)
|
||||||
PGEN = \
|
PGEN = \
|
||||||
|
@ -211,7 +224,7 @@ _GEN = /G4 /Gm /Gd-
|
||||||
# /Gm = Use Multithread Runtime
|
# /Gm = Use Multithread Runtime
|
||||||
# /Gd = Dynamically Load Runtime
|
# /Gd = Dynamically Load Runtime
|
||||||
# /Ms = Use _System Calling Convention (vs _Optlink)
|
# /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
|
_OPT = /O /Gl
|
||||||
# /O = Enable Speed-Optimizations
|
# /O = Enable Speed-Optimizations
|
||||||
|
@ -246,8 +259,8 @@ CFLAGS = $(_BASE) $(_GEN) $(_OPT) $(_DBG) $(_OUT) $(_EXE) /Ss
|
||||||
###################
|
###################
|
||||||
# Primary Target(s)
|
# Primary Target(s)
|
||||||
###################
|
###################
|
||||||
All: obj noise PyCore.lib Python15.lib PGen.exe \
|
All: obj noise PyCore.lib Python22.lib PGen.exe \
|
||||||
Python.exe PythonPM.exe Python15.dll _tkinter.dll
|
Python.exe PythonPM.exe Python22.dll # _tkinter.dll
|
||||||
|
|
||||||
Modules: $(MODULES)
|
Modules: $(MODULES)
|
||||||
Objects: $(OBJECTS)
|
Objects: $(OBJECTS)
|
||||||
|
@ -267,43 +280,43 @@ noise:
|
||||||
##############
|
##############
|
||||||
|
|
||||||
# Python Extension DLL: Tcl/Tk Interface
|
# Python Extension DLL: Tcl/Tk Interface
|
||||||
_tkinter.dll: $(PATHOBJ)\_tkinter.obj Python15.lib _tkinter.def
|
#_tkinter.dll: $(PATHOBJ)\_tkinter.obj Python22.lib _tkinter.def
|
||||||
@ Echo Linking $@ As DLL
|
# @ Echo Linking $@ As DLL
|
||||||
@ $(CC) $(CFLAGS) /B"/NOE" $(_DLL) /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
|
# @ $(CC) $(CFLAGS) /B"/NOE" $(_DLL) /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
|
||||||
|
|
||||||
$(PATHOBJ)\_tkinter.obj: $(PY_MODULES)\_tkinter.c
|
#$(PATHOBJ)\_tkinter.obj: $(PY_MODULES)\_tkinter.c
|
||||||
@ Echo Compiling $**
|
# @ Echo Compiling $**
|
||||||
@ $(CC) -c $(CFLAGS) $(_DLL) -Fo$@ $** >>$(ERRS)
|
# @ $(CC) -c $(CFLAGS) $(_DLL) -Fo$@ $** >>$(ERRS)
|
||||||
|
|
||||||
# Object Library of All Essential Python Routines
|
# Object Library of All Essential Python Routines
|
||||||
PyCore.lib: $(MODULES) $(OBJECTS) $(PARSER) $(PYTHON) $(PATHOBJ)\Config.obj
|
PyCore.lib: $(MODULES) $(OBJECTS) $(PARSER) $(PYTHON) $(PATHOBJ)\Config.obj
|
||||||
@ Echo Adding Updated Object Files to Link Library $@
|
@ Echo Adding Updated Object Files to Link Library $@
|
||||||
@ ! ILIB $@ /NOLOGO /NOBACKUP -+$? ; >>$(ERRS)
|
@ ! 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
|
@ Echo Linking $@ As DLL
|
||||||
@ $(CC) $(CFLAGS) /B"/NOE" $(_DLL) /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
|
@ $(CC) $(CFLAGS) /B"/NOE" $(_DLL) /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
|
||||||
@ Echo Compressing $@ with LxLite
|
# @ Echo Compressing $@ with LxLite
|
||||||
@ lxlite $@
|
# @ lxlite $@
|
||||||
|
|
||||||
# IBM Linker Requires One Explicit .OBJ To Build a .DLL from a .LIB
|
# IBM Linker Requires One Explicit .OBJ To Build a .DLL from a .LIB
|
||||||
$(PATHOBJ)\Compile.obj: $(PY_PYTHON)\Compile.c
|
$(PATHOBJ)\Compile.obj: $(PY_PYTHON)\Compile.c
|
||||||
@ Echo Compiling $**
|
@ Echo Compiling $**
|
||||||
@ $(CC) -c $(CFLAGS) $(_DLL) -Fo$@ $** >>$(ERRS)
|
@ $(CC) -c $(CFLAGS) $(_DLL) -Fo$@ $** >>$(ERRS)
|
||||||
|
|
||||||
# Import Library for Using the Python15.dll
|
# Import Library for Using the Python22.dll
|
||||||
Python15.lib: Python.def
|
Python22.lib: Python.def
|
||||||
@ Echo Making $@
|
@ Echo Making $@
|
||||||
@ IMPLIB /NOLOGO /NOIGNORE $@ $** >>$(ERRS)
|
@ IMPLIB /NOLOGO /NOIGNORE $@ $** >>$(ERRS)
|
||||||
@ ILIB /NOLOGO /CONVFORMAT /NOEXTDICTIONARY /NOBROWSE /NOBACKUP $@; >>$(ERRS)
|
@ ILIB /NOLOGO /CONVFORMAT /NOEXTDICTIONARY /NOBROWSE /NOBACKUP $@; >>$(ERRS)
|
||||||
|
|
||||||
# Small Command-Line Program to Start Interpreter in Python15.dll
|
# Small Command-Line Program to Start Interpreter in Python22.dll
|
||||||
Python.exe: $(PATHOBJ)\Python.obj Python15.lib
|
Python.exe: $(PATHOBJ)\Python.obj Python22.lib
|
||||||
@ Echo Linking $@ As EXE
|
@ Echo Linking $@ As EXE
|
||||||
@ $(CC) $(CFLAGS) $(_EXE) /B"/PM:VIO /STACK:360000" /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
|
@ $(CC) $(CFLAGS) $(_EXE) /B"/PM:VIO /STACK:360000" /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
|
||||||
|
|
||||||
# Small PM-GUI Program to Start Interpreter in Python15.dll
|
# Small PM-GUI Program to Start Interpreter in Python22.dll
|
||||||
PythonPM.exe: $(PATHOBJ)\Python.obj Python15.lib
|
PythonPM.exe: $(PATHOBJ)\Python.obj Python22.lib
|
||||||
@ Echo Linking $@ As EXE
|
@ Echo Linking $@ As EXE
|
||||||
@ $(CC) $(CFLAGS) $(_EXE) /B"/PM:PM /STACK:360000" /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
|
@ $(CC) $(CFLAGS) $(_EXE) /B"/PM:PM /STACK:360000" /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
|
||||||
|
|
||||||
|
@ -323,13 +336,13 @@ clean:
|
||||||
|
|
||||||
# Remove All Targets, Including Final Binaries
|
# Remove All Targets, Including Final Binaries
|
||||||
distclean: clean
|
distclean: clean
|
||||||
-- Del /Q PyCore.lib Python15.lib >NUL 2>&1
|
-- Del /Q PyCore.lib Python22.lib >NUL 2>&1
|
||||||
-- Del /Q Python15.dll Python.exe PGen.exe >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 Python.exe D:\EXEs
|
||||||
-- @Echo Y | copy /U Python15.dll D:\DLLs
|
-- @Echo Y | copy /U Python22.dll D:\DLLs
|
||||||
-- @Echo Y | copy /U Python15.lib E:\Tau\Lib
|
-- @Echo Y | copy /U Python22.lib E:\Tau\Lib
|
||||||
-- @Echo Y | copy /U _tkinter.dll D:\Python
|
-- @Echo Y | copy /U _tkinter.dll D:\Python
|
||||||
|
|
||||||
test:
|
test:
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
/* Provide a default library so writers of extension modules
|
/* Provide a default library so writers of extension modules
|
||||||
* won't have to explicitly specify it anymore
|
* 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 */
|
/* 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 HAVE_LONG_LONG 1 */ /* VAC++ does not support (long long) */
|
||||||
/* #define SIZEOF_LONG_LONG 8 */ /* Count of Bytes in a (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. */
|
/* Define if type char is unsigned and you are not using gcc. */
|
||||||
#ifndef __CHAR_UNSIGNED__
|
#ifndef __CHAR_UNSIGNED__
|
||||||
/* #undef __CHAR_UNSIGNED__ */
|
/* #undef __CHAR_UNSIGNED__ */
|
||||||
|
@ -188,7 +196,7 @@ typedef int pid_t;
|
||||||
/* #define HAVE_GETUID 1 */
|
/* #define HAVE_GETUID 1 */
|
||||||
|
|
||||||
/* Unix-Specific */
|
/* 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_UTSNAME_H 1 */ /* #include <sys/utsname.h> */
|
||||||
/* #define HAVE_SYS_WAIT_H 1 */ /* #include <sys/wait.h> */
|
/* #define HAVE_SYS_WAIT_H 1 */ /* #include <sys/wait.h> */
|
||||||
/* #define HAVE_UNISTD_H 1 */ /* #include <unistd.h> */
|
/* #define HAVE_UNISTD_H 1 */ /* #include <unistd.h> */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
LIBRARY PYTHON15 INITINSTANCE TERMINSTANCE
|
LIBRARY PYTHON22 INITINSTANCE TERMINSTANCE
|
||||||
DESCRIPTION 'Python 1.5 Core DLL'
|
DESCRIPTION 'Python 2.2 Core DLL'
|
||||||
PROTMODE
|
PROTMODE
|
||||||
DATA MULTIPLE NONSHARED
|
DATA MULTIPLE NONSHARED
|
||||||
|
|
||||||
|
@ -472,4 +472,9 @@ EXPORTS
|
||||||
_Py_re_search
|
_Py_re_search
|
||||||
_Py_re_set_syntax
|
_Py_re_set_syntax
|
||||||
; _Py_samebitset
|
; _Py_samebitset
|
||||||
|
PyBuffer_Type
|
||||||
|
PyBuffer_FromObject
|
||||||
|
PyBuffer_FromMemory
|
||||||
|
PyBuffer_FromReadWriteMemory
|
||||||
|
PyBuffer_New
|
||||||
|
|
||||||
|
|
|
@ -567,7 +567,11 @@ builtin_execfile(PyObject *self, PyObject *args)
|
||||||
#ifndef RISCOS
|
#ifndef RISCOS
|
||||||
if (!stat(filename, &s)) {
|
if (!stat(filename, &s)) {
|
||||||
if (S_ISDIR(s.st_mode))
|
if (S_ISDIR(s.st_mode))
|
||||||
|
#if defined(PYOS_OS2) && defined(PYCC_VACPP)
|
||||||
|
errno = EOS2ERR;
|
||||||
|
#else
|
||||||
errno = EISDIR;
|
errno = EISDIR;
|
||||||
|
#endif
|
||||||
else
|
else
|
||||||
exists = 1;
|
exists = 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,6 +38,7 @@ extern PyObject *_PyImport_LoadDynamicModule(char *name, char *pathname,
|
||||||
typedef FARPROC dl_funcptr;
|
typedef FARPROC dl_funcptr;
|
||||||
#else
|
#else
|
||||||
#ifdef PYOS_OS2
|
#ifdef PYOS_OS2
|
||||||
|
#include <os2def.h>
|
||||||
typedef int (* APIENTRY dl_funcptr)();
|
typedef int (* APIENTRY dl_funcptr)();
|
||||||
#else
|
#else
|
||||||
typedef void (*dl_funcptr)(void);
|
typedef void (*dl_funcptr)(void);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue