blob: 78e914046a787a46f7830d877aebd8647cb76fc6 [file] [log] [blame]
Guido van Rossum1b2fe8e1995-02-17 14:49:28 +00001Python and MPW
2==============
Guido van Rossum8ce65b41994-08-29 08:58:39 +00003
Guido van Rossum1b2fe8e1995-02-17 14:49:28 +00004There is conditional code in Python for MPW. This has been used with
5different compilers at various points in time. Right now it is being
6used to turn the entire interpreter into a shared library on 68K Macs,
7so we can build "applets". I have used MPW 3.2 and the OpenDoc
8development environment from an OpenDoc CD released in 1984. This
9contains the Symantec C compiler for MPW, version 7.XXX, the
10Universal Headers version 2.0a1 (XXX), and early versions of CFM-68K
11(the Code Fragment Manager ported back to the 68K Mac) and
12MixedModeInit, which are required to use shared libraries.
Guido van Rossum8ce65b41994-08-29 08:58:39 +000013
Guido van Rossum1b2fe8e1995-02-17 14:49:28 +000014I've created a Makefile that does everything, plus a three-line Build
15script that calls Make and runs its output. The Makefile assumes that
16it lives in a 1-deep subdirectory of the root, so e.g. the Python
17Include directory can be referenced through "::Include". All object
18files are collected in the subsubdirectory Objcode.
Guido van Rossum8ce65b41994-08-29 08:58:39 +000019
Guido van Rossum1b2fe8e1995-02-17 14:49:28 +000020I use these feature test macros:
Guido van Rossum8ce65b41994-08-29 08:58:39 +000021
Guido van Rossum1b2fe8e1995-02-17 14:49:28 +000022MPW for all MPW compilers (e.g. long double in <math.h>)
23__SC__ for things specific to the Symantec C compiler
24 (e.g. doesn't like static forward)
25__CFM68K__ for things specific to CFM-68K
26 (e.g. it requires the use of #pragma lib_export on|off)
27HAVE_UNIVERSAL_HEADERS for things not yet in Think's headers (e.g. UPPs)
28GENERATINGCFM for both PPC and 68K Code Fragment Manager
Guido van Rossum8ce65b41994-08-29 08:58:39 +000029
Guido van Rossum1b2fe8e1995-02-17 14:49:28 +000030MPW is defined in config.h (if it finds that applec is defined);
31HAVE_UNIVERSAL_HEADERS is defined in macglue.h depending on whether it
32thinks we are using Universal Headers. The others are defined by the
33compiler or by the system headers.
Guido van Rossum8ce65b41994-08-29 08:58:39 +000034
Guido van Rossum1b2fe8e1995-02-17 14:49:28 +000035Compiler switches were a nightmare until I found I had to use -b.
36This wasn't mentioned in the CFM-68K docs that came on the OpenDoc
37CD-ROM.
Guido van Rossum8ce65b41994-08-29 08:58:39 +000038
Guido van Rossum8ce65b41994-08-29 08:58:39 +000039
Guido van Rossum1b2fe8e1995-02-17 14:49:28 +000040Applets
41=======
Guido van Rossum8ce65b41994-08-29 08:58:39 +000042
Guido van Rossum1b2fe8e1995-02-17 14:49:28 +000043(XXX This text file is on my Mac)
Guido van Rossum8ce65b41994-08-29 08:58:39 +000044
Guido van Rossumc0af2aa1994-09-09 12:10:21 +000045
Guido van Rossum1b2fe8e1995-02-17 14:49:28 +000046Warning: Mixing Think C and MPW
47===============================
Guido van Rossumc0af2aa1994-09-09 12:10:21 +000048
Guido van Rossum1b2fe8e1995-02-17 14:49:28 +000049(XXX Need to check what convention SC uses -- I hope it uses Think's.)
Guido van Rossumc0af2aa1994-09-09 12:10:21 +000050
Guido van Rossum1b2fe8e1995-02-17 14:49:28 +000051If you are mixing Think C and MPW, you may experience weird errors in
Guido van Rossum31e76421994-09-16 11:08:31 +000052previously correct modules. These disappear when you throw away the
Guido van Rossumc0af2aa1994-09-09 12:10:21 +000053module's .pyc file. The errors usually have to do with string
54literals containing '\n' or '\r'. The reason is an incompatibility
55between their handling of '\n' and '\r' -- in MPW C, '\n' actually is
56ASCII CR while '\r' is ASCII LF, which is the reverse situation from
57any other ASCII based C implementation. This behaviour is inherited
Guido van Rossum31e76421994-09-16 11:08:31 +000058by Python compiled with MPW C. This is normally not a problem, but
59*binary* files written by one system will be mis-interpreted by the
60other, and this is what happens to the .pyc files. There is no easy
61way to fix this in the source. (This is a real shame, since the
62format of .pyc files was carefully designed to be independent of byte
63order and integer size -- deviations in the ASCII character codes were
64never anticipated.)