Kaydet (Commit) e8afe516 authored tarafından Guido van Rossum's avatar Guido van Rossum

New set of files for the OS/2 port by Jeff Rush.

üst be70450f
LIBRARY _TKINTER INITINSTANCE TERMINSTANCE
DESCRIPTION 'Python Extension DLL v1.0 for Access to Tcl/Tk Environment'
PROTMODE
DATA MULTIPLE NONSHARED
EXPORTS
init_tkinter
......@@ -50,7 +50,6 @@ extern void initos2();
extern void initoperator();
extern void initposix();
extern void initregex();
extern void initreop();
extern void initrgbimg();
extern void initrotor();
extern void initsignal();
......@@ -97,7 +96,6 @@ struct _inittab _PyImport_Inittab[] = {
#endif
{"operator", initoperator},
{"regex", initregex},
{"reop", initreop},
// {"rgbimg", initrgbimg},
// {"rotor", initrotor},
{"signal", initsignal},
......
This diff is collapsed.
......@@ -26,6 +26,7 @@
#
# History (Most Recent First)
#
# 26-Sep-98 jrr Retested and adjusted for building w/Python 1.5.2a1
# 20-Nov-97 jrr Cleaned Up for Applying to Distribution
# 29-Oct-97 jrr Modified for Use with Python 1.5 Alpha 4
# 03-Aug-96 jrr Original for Use with Python 1.4 Release
......@@ -48,18 +49,24 @@ ERRS = make.out
# Where to Find the IBM TCP/IP Socket Includes and Libraries
OS2TCPIP = C:\MPTN
# Where to Find the Tcl/Tk Base Directory for Libs/Includes
TCLTK = D:\TclTk
TCLBASE = D:\Tcl7.6\OS2
TKBASE = D:\Tk4.2\OS2
# Where to Put the .OBJ Files, To Keep Them Out of the Way
PATHOBJ = obj
# Search Path for Include Files
PROJINCLUDE = .;$(OS2TCPIP)\Include;$(PY_INCLUDES)
PROJINCLUDE = .;$(TCLBASE);$(TKBASE);$(OS2TCPIP)\Include;$(PY_INCLUDES)
# Place to Search for Sources re OpusMAKE Dependency Generator (Commercial)
MKMF_SRCS = $(PY_MODULES)\*.c $(PY_OBJECTS)\*.c $(PY_PARSER)\*.c $(PY_PYTHON)\*.c
#.HDRPATH.c := $(PROJINCLUDE,;= ) $(.HDRPATH.c)
#.PATH.c = .;$(PY_MODULES);$(PY_OBJECTS);$(PY_PARSER);$(PY_PYTHON)
OTHERLIBS = $(OS2TCPIP)\lib\so32dll.lib $(OS2TCPIP)\lib\tcp32dll.lib
OTHERLIBS = $(OS2TCPIP)\lib\so32dll.lib $(OS2TCPIP)\lib\tcp32dll.lib \
$(TCLTK)\Lib\Tcl76.lib $(TCLTK)\Lib\Tk42.lib
#################
# Inference Rules
......@@ -171,7 +178,6 @@ MODULES = \
$(PATHOBJ)\PosixModule.obj \
$(PATHOBJ)\RegexModule.obj \
$(PATHOBJ)\RegExpr.obj \
$(PATHOBJ)\ReopModule.obj \
$(PATHOBJ)\SelectModule.obj \
$(PATHOBJ)\SignalModule.obj \
$(PATHOBJ)\SocketModule.obj \
......@@ -204,6 +210,8 @@ _GEN = /G4 /Gm /Gd-
# /G4 = Generate Code for 486 (Use 386 for Debugger)
# /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)
_OPT = /O /Gl
# /O = Enable Speed-Optimizations
......@@ -238,7 +246,8 @@ CFLAGS = $(_BASE) $(_GEN) $(_OPT) $(_DBG) $(_OUT) $(_EXE) /Ss
###################
# Primary Target(s)
###################
All: obj noise PyCore.lib Python15.lib Python15.dll Python.exe PGen.exe
All: obj noise PyCore.lib Python15.lib PGen.exe \
Python.exe PythonPM.exe Python15.dll _tkinter.dll
Modules: $(MODULES)
Objects: $(OBJECTS)
......@@ -257,6 +266,15 @@ 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)
$(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 $@
......@@ -265,6 +283,8 @@ PyCore.lib: $(MODULES) $(OBJECTS) $(PARSER) $(PYTHON) $(PATHOBJ)\Config.obj
Python15.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 $@
# IBM Linker Requires One Explicit .OBJ To Build a .DLL from a .LIB
$(PATHOBJ)\Compile.obj: $(PY_PYTHON)\Compile.c
......@@ -277,10 +297,15 @@ Python15.lib: Python.def
@ IMPLIB /NOLOGO /NOIGNORE $@ $** >>$(ERRS)
@ ILIB /NOLOGO /CONVFORMAT /NOEXTDICTIONARY /NOBROWSE /NOBACKUP $@; >>$(ERRS)
# Small Program to Start Interpreter in Python15.dll
# Small Command-Line Program to Start Interpreter in Python15.dll
Python.exe: $(PATHOBJ)\Python.obj Python15.lib
@ Echo Linking $@ As EXE
@ $(CC) $(CFLAGS) $(_EXE) /B"/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
PythonPM.exe: $(PATHOBJ)\Python.obj Python15.lib
@ Echo Linking $@ As EXE
@ $(CC) $(CFLAGS) $(_EXE) /B"/PM:PM /STACK:360000" /Fe$@ $(_MAP) $** $(OTHERLIBS) >>$(ERRS)
PGen.exe: $(PGEN) PyCore.lib
@ Echo Linking $@ As EXE
......@@ -305,6 +330,7 @@ release: Python.exe Python15.dll Python15.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 _tkinter.dll D:\Python
test:
python ..\..\lib\test\regrtest.py
......@@ -947,19 +973,6 @@ regexpr.obj: $(PY_INCLUDE)\abstract.h $(PY_PARSER)\assert.h $(PY_INCLUDE)\ceval.
$(PY_INCLUDE)\stringobject.h $(PY_INCLUDE)\sysmodule.h $(PY_INCLUDE)\traceback.h \
$(PY_INCLUDE)\tupleobject.h
reopmodule.obj: $(PY_INCLUDE)\abstract.h $(PY_INCLUDE)\ceval.h $(PY_INCLUDE)\classobject.h \
$(PY_INCLUDE)\cobject.h $(PY_INCLUDE)\complexobject.h config.h \
$(PY_INCLUDE)\dictobject.h $(PY_INCLUDE)\fileobject.h $(PY_INCLUDE)\floatobject.h \
$(PY_INCLUDE)\funcobject.h $(PY_INCLUDE)\import.h $(PY_INCLUDE)\intobject.h \
$(PY_INCLUDE)\intrcheck.h $(PY_INCLUDE)\listobject.h $(PY_INCLUDE)\longobject.h \
$(PY_INCLUDE)\methodobject.h $(PY_INCLUDE)\modsupport.h \
$(PY_INCLUDE)\moduleobject.h $(PY_INCLUDE)\mymalloc.h $(PY_INCLUDE)\myproto.h \
$(PY_INCLUDE)\object.h $(PY_INCLUDE)\objimpl.h $(PY_INCLUDE)\pydebug.h \
$(PY_INCLUDE)\pyerrors.h $(PY_INCLUDE)\pyfpe.h $(PY_INCLUDE)\pystate.h \
$(PY_INCLUDE)\python.h $(PY_INCLUDE)\pythonrun.h $(PY_INCLUDE)\rangeobject.h \
$(PY_MODULES)\regexpr.h $(PY_INCLUDE)\sliceobject.h $(PY_INCLUDE)\stringobject.h \
$(PY_INCLUDE)\sysmodule.h $(PY_INCLUDE)\traceback.h $(PY_INCLUDE)\tupleobject.h
resource.obj: $(PY_INCLUDE)\abstract.h $(OS2TCPIP)\Include\sys\time.h $(PY_INCLUDE)\ceval.h \
$(PY_INCLUDE)\classobject.h $(PY_INCLUDE)\cobject.h $(PY_INCLUDE)\complexobject.h \
config.h $(PY_INCLUDE)\dictobject.h $(PY_INCLUDE)\fileobject.h \
......
This diff is collapsed.
IBM VisualAge C/C++ for OS/2
============================
To build Python for OS/2, change into ./os2vacpp and issue an 'NMAKE'
command. This will build a PYTHON15.DLL containing the set of Python
modules listed in config.c and a small PYTHON.EXE to start the
interpreter.
By changing the C compiler flag /Gd- in the makefile to /Gd+, you can
reduce the size of these by causing Python to dynamically link to the
C runtime DLLs instead of including their bulk in your binaries.
However, this means that any system on which you run Python must have
the VAC++ compiler installed in order to have those DLLs available.
During the build process you may see a couple of harmless warnings:
From the C Compiler, "No function prototype given for XXX", which
comes from the use of K&R parameters within Python for portability.
From the ILIB librarian, "Module Not Found (XXX)", which comes
from its attempt to perform the (-+) operation, which removes and
then adds a .OBJ to the library. The first time a build is done,
it obviously cannot remove what is not yet built.
This build includes support for most Python functionality as well as
TCP/IP sockets. It omits the Posix ability to 'fork' a process but
supports threads using OS/2 native capabilities. I have tried to
support everything possible but here are a few usage notes.
-- os.popen() Usage Warnings
With respect to my implementation of popen() under OS/2:
import os
fd = os.popen("pkzip.exe -@ junk.zip", 'wb')
fd.write("file1.txt\n")
fd.write("file2.txt\n")
fd.write("file3.txt\n")
fd.write("\x1a") # Should Not Be Necessary But Is
fd.close()
There is a bug, either in the VAC++ compiler or OS/2 itself, where the
simple closure of the write-side of a pipe -to- a process does not
send an EOF to that process. I find I must explicitly write a
control-Z (EOF) before closing the pipe. This is not a problem when
using popen() in read mode.
One other slight difference with my popen() is that I return None
from the close(), instead of the Unix convention of the return code
of the spawned program. I could find no easy way to do this under
OS/2.
-- BEGINLIBPATH/ENDLIBPATH
With respect to environment variables, this OS/2 port supports the
special-to-OS/2 magic names of 'BEGINLIBPATH' and 'ENDLIBPATH' to
control where to load conventional DLLs from. Those names are
intercepted and converted to calls on the OS/2 kernel APIs and
are inherited by child processes, whether Python-based or not.
A few new attributes have been added to the os module:
os.meminstalled # Count of Bytes of RAM Installed on Machine
os.memkernel # Count of Bytes of RAM Reserved (Non-Swappable)
os.memvirtual # Count of Bytes of Virtual RAM Possible
os.timeslice # Duration of Scheduler Timeslice, in Milliseconds
os.maxpathlen # Maximum Length of a Path Specification, in chars
os.maxnamelen # Maximum Length of a Single Dir/File Name, in chars
os.version # Version of OS/2 Being Run e.g. "4.00"
os.revision # Revision of OS/2 Being Run (usually zero)
os.bootdrive # Drive that System Booted From e.g. "C:"
# (useful to find the CONFIG.SYS used to boot with)
-- Using Python as the Default OS/2 Batch Language
Note that OS/2 supports the Unix technique of putting the special
comment line at the time of scripts e.g. "#!/usr/bin/python" in
a different syntactic form. To do this, put your script into a file
with a .CMD extension and added 'extproc' to the top as follows:
extproc C:\Python\Python.exe -x
import os
print "Hello from Python"
The '-x' option tells Python to skip the first line of the file
while processing the rest as normal Python source.
-- Suggested Environment Variable Setup
With respect to the environment variables for Python, I use the
following setup:
Set PYTHONHOME=E:\Tau\Projects\Python;D:\DLLs
Set PYTHONPATH=.;E:\Tau\Projects\Python\Lib; \
E:\Tau\Projects\Python\Lib\plat-win
The EXEC_PREFIX (optional second pathspec on PYTHONHOME) is where
you put any Python extension DLLs you may create/obtain. There
are none provided with this release.
-- Contact Info
If you have questions, suggestions or problems specifically with
the OS/2 VAC++ port of Python, please contact me at:
Jeff Rush <jrush@summit-research.com>.
I support no other platform but OS/2 (and eventually AmigaDOS).
IBM VisualAge C/C++ for OS/2
============================
To build Python for OS/2, change into ./os2vacpp and issue an 'NMAKE'
command. This will build a PYTHON15.DLL containing the set of Python
modules listed in config.c and a small PYTHON.EXE to start the
interpreter.
By changing the C compiler flag /Gd- in the makefile to /Gd+, you can
reduce the size of these by causing Python to dynamically link to the
C runtime DLLs instead of including their bulk in your binaries.
However, this means that any system on which you run Python must have
the VAC++ compiler installed in order to have those DLLs available.
During the build process you may see a couple of harmless warnings:
From the C Compiler, "No function prototype given for XXX", which
comes from the use of K&R parameters within Python for portability.
From the ILIB librarian, "Module Not Found (XXX)", which comes
from its attempt to perform the (-+) operation, which removes and
then adds a .OBJ to the library. The first time a build is done,
it obviously cannot remove what is not yet built.
This build includes support for most Python functionality as well as
TCP/IP sockets. It omits the Posix ability to 'fork' a process but
supports threads using OS/2 native capabilities. I have tried to
support everything possible but here are a few usage notes.
-- os.popen() Usage Warnings
With respect to my implementation of popen() under OS/2:
import os
fd = os.popen("pkzip.exe -@ junk.zip", 'wb')
fd.write("file1.txt\n")
fd.write("file2.txt\n")
fd.write("file3.txt\n")
fd.write("\x1a") # Should Not Be Necessary But Is
fd.close()
There is a bug, either in the VAC++ compiler or OS/2 itself, where the
simple closure of the write-side of a pipe -to- a process does not
send an EOF to that process. I find I must explicitly write a
control-Z (EOF) before closing the pipe. This is not a problem when
using popen() in read mode.
One other slight difference with my popen() is that I return None
from the close(), instead of the Unix convention of the return code
of the spawned program. I could find no easy way to do this under
OS/2.
-- BEGINLIBPATH/ENDLIBPATH
With respect to environment variables, this OS/2 port supports the
special-to-OS/2 magic names of 'BEGINLIBPATH' and 'ENDLIBPATH' to
control where to load conventional DLLs from. Those names are
intercepted and converted to calls on the OS/2 kernel APIs and
are inherited by child processes, whether Python-based or not.
A few new attributes have been added to the os module:
os.meminstalled # Count of Bytes of RAM Installed on Machine
os.memkernel # Count of Bytes of RAM Reserved (Non-Swappable)
os.memvirtual # Count of Bytes of Virtual RAM Possible
os.timeslice # Duration of Scheduler Timeslice, in Milliseconds
os.maxpathlen # Maximum Length of a Path Specification, in chars
os.maxnamelen # Maximum Length of a Single Dir/File Name, in chars
os.version # Version of OS/2 Being Run e.g. "4.00"
os.revision # Revision of OS/2 Being Run (usually zero)
os.bootdrive # Drive that System Booted From e.g. "C:"
# (useful to find the CONFIG.SYS used to boot with)
-- Using Python as the Default OS/2 Batch Language
Note that OS/2 supports the Unix technique of putting the special
comment line at the time of scripts e.g. "#!/usr/bin/python" in
a different syntactic form. To do this, put your script into a file
with a .CMD extension and added 'extproc' to the top as follows:
extproc C:\Python\Python.exe -x
import os
print "Hello from Python"
The '-x' option tells Python to skip the first line of the file
while processing the rest as normal Python source.
-- Suggested Environment Variable Setup
With respect to the environment variables for Python, I use the
following setup:
Set PYTHONHOME=E:\Tau\Projects\Python;D:\DLLs
Set PYTHONPATH=.;E:\Tau\Projects\Python\Lib; \
E:\Tau\Projects\Python\Lib\plat-win
The EXEC_PREFIX (optional second pathspec on PYTHONHOME) is where
you put any Python extension DLLs you may create/obtain. There
are none provided with this release.
-- Contact Info
If you have questions, suggestions or problems specifically with
the OS/2 VAC++ port of Python, please contact me at:
Jeff Rush <jrush@summit-research.com>.
I support no other platform but OS/2 (and eventually AmigaDOS).
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment