[gambit-list] Gambit for plan9?

Marc Feeley feeley at iro.umontreal.ca
Tue Feb 12 14:06:57 EST 2013


On 2013-02-12, at 1:47 PM, Bakul Shah <bakul at bitblocks.com> wrote:

> On Tue, 12 Feb 2013 13:38:17 EST Marc Feeley <feeley at iro.umontreal.ca> wrote:
>> 
>> On 2013-02-12, at 1:30 PM, Bakul Shah <bakul at bitblocks.com> wrote:
>> 
>>> On Tue, 12 Feb 2013 13:20:13 EST Marc Feeley <feeley at iro.umontreal.ca> =
>> wrote:
>>>> Gambit requires *no* external libraries (except for libc)
>>>> and its code is compilable by C, C++ and Objective-C compilers
>>>> without any fancy command-line options.
>>> =20
>>> This leads me to ask if anyone has tried porting gambit to
>>> plan9? Thanks
>> 
>> Not that I know of, but it should be trivial to get something basic 
>> going.
> 
> Any hints on how to go about a new port?

You could try

   ./configure
   make

and report back which errors you get.

If the configure fails, from a fresh Gambit distribution directory you could:

1) Create a new include/gambit.h file with

echo #ifndef ___VOIDSTAR_WIDTH                > include/gambit.h
echo #define ___VOIDSTAR_WIDTH ___LONG_WIDTH >> include/gambit.h
echo #endif                                  >> include/gambit.h
echo #ifndef ___MAX_CHR                      >> include/gambit.h
echo #define ___MAX_CHR 0x10ffff             >> include/gambit.h
echo #endif                                  >> include/gambit.h
cat include/gambit.h.in                      >> include/gambit.h

Usually the gambit.h file is created by the configure script, but here we'll avoid using the configure script because it may have issues on plan9.

2) In lib/ compile all the .c files to .o files using -D___LIBRARY and -D___PRIMAL and -D___HAVE_STDIO_H and -D___HAVE_STDLIB_H.  Some of the files (os*.c) are operating system dependent, so most of your problems will be in compiling these files.  By default, only stdio functions will be called for I/O and only malloc/free are used for memory allocation. Obviously you won't have a bunch of functionality such as sockets, process ports, time measurement, etc but these can be ported one by one as the need arises by adding the appropriate -DHAVE_XXX and adapting the os*.c files.

Once step #2 is completed, you are almost done!

3) In gsi/ compile all the .c files to .o files.  Then link all the .o files from lib/ and gsi/ to produce the interpreter "gsi".

4) Repeat step #3 in the gsc/ to produce the compiler "gsc".

Marc







More information about the Gambit-list mailing list