18 Aug 1999
This distribution contains the following files:
(1) Folder 'SWIG' contains binaries of SWIG 1.1p5 compiled for PowerPC.
There is a console application, an MPW tool, a Preferences file for the
console app, and an MPW startup file for the MPW tool.
(2) Folder 'Examples' contains the tutorial examples. The buildprocedures
for these are identical to the build procedures for XS, once the C source
has been produced. Furthermore, any extra work that you encounter will be
due to porting of original C code, which is outside the scope of this
tutorial, or in preparation of the SWIG interface, which is what most
of the tutorial is about, and for which plenty of other examples exist in
the standard SWIG distribution.
The Mac versions of SWIG in this distribution are functionally identical,
once the command-line argument handling code is stripped away, to the UNIX
version; hence they produce exactly the same code for given inputs
(combinations of command-line options and interface files). Once SWIG has
been run on an .i file, the build procedure is exactly the same as it is
for XS, so there is not much point in repeating myself ad nauseam.
NOTE: the code produced by SWIG is platform-independent. The code that it
wraps may not be. There is no guarantee that just because SWIG didn't burp
that the Metrowerks C/C++ compilers will like the code that it produces.
Probably about half of the Perl5 examples in the standard SWIG distribution
do not compile right out of the box. Most can be made to work, though.
INSTALLATION:
(1) You *must* obtain the standard UNIX distribution of SWIG 1.1p5 from
http://www.swig.org. This contains documentation, but what is essential,
it contains a folder named 'swig_lib', which is the "library". Put this
folder anywhere you like.
(2) Console Application: you can put this anywhere you like, as it suits
your purposes. It's probably best to keep the real app in one place,
probably in your SWIG folder, and keep aliases handy to your work files,
so as to keep path specs manageable.
The console app looks for a file called 'SWIG Prefs' in the
:System:Preferences: folder. The name of the file that it looks for is
actually set in the STR# 128 resource, if you want to change it. Take the
'SWIG Prefs' file that comes with this distribution, edit it to reflect
the actual location of the 'swig_lib' folder, and put it in
:System:Preferences.
(3) MPW Tool: It's best to put the 'swig' tool in your "{MPW}Tools"
folder, but it can be anywhere in the command path specified by the
environment variable {Commands}.
A skeleton SWIG MPW startup file, named "UserStartup„SWIG", is supplied. Put
this file in your "{MPW}Startup Items" folder. Edit it to reflect the
actual location of the 'swig_lib' folder. The function of this file is to
set the value of the SWIG_LIB environment variable when MPW is launched.
This variable is then checked for by the MPW tool.
(3) Defaults: both applications also look for the 'swig_lib' folder in the
current directory. Finally, if all else fails, use the SWIG -I switch (-I
as in 'eye') to set the library path.
RUNNING:
(1) The command line for SWIG in MPW is precisely the same as it is for
UNIX. Caveat - you may have to quote some stuff. For example, the -c++
switch must be quoted.
(2) The command line for SWIG using the console app is precisely the same
as it is for UNIX. Quote filenames with spaces etc. As for any Metrowerks
console app, leave out the name of the app itself, i.e. don't type in
'swig'.
TECHNICAL NOTES:
(1) You may wonder why no CFM68K version. The size of the parser.cxx file
is to blame - this file is generated from parser.y using Bison. I
regenerated it for these builds, which is recommended practise. Short of
chopping the source code up, I cannot get a file this size to link for
CFM68K. The yacc parser for SWIG is expected to get considerably smaller.
At such time as a CFM68K build becomes possible, I will endeavour to
supply it.
(2) Code specific to MacOS resides only in two files in the standard
distribution - main.cxx and swigmain.cxx. I took out the Tcl GUI, added the
code for handling preferences, and changed the command-line argument
handling. Sources are available upon request.
(3) IMPORTANT - MacSWIG 1.1p2 crashes routinely using the -shadow option.
So did the 1.1p5 build. I traced the problem to stuff happening in
perl5.cxx, specifically an attempt to 'delete' a non-allocated pointer. My
fix for this has worked since, without fail. It doesn't appear to reduce
functionality, but I cannot swear to this. The existence of the problem,
and my fix for it, has been communicated to David Beazley. There may be
changes as a result in the future.
BUGS:
If something doesn't work, please let me know. If you have MacsBug
running, email me the StdLog. Thank you. As it stands right now, SWIG
ought not to crash. If it does, something is broken that I don't know about.
CONTACT INFO:
Don't bother David Beazley with comments about this port of SWIG. Direct
complaints or suggestions to me. If you would like to participate in
efforts to improve this build, please let me know. Among projects I have
underway, a SWIG mode for Alpha and a proper PowerPlant GUI are first and
foremost.
I am, your humble servant,
Arved Sandstrom
Arved_37@chebucto.ns.ca