From 4ac273afbe3ac08ab8da04332de6fd881e2e0bb5 Mon Sep 17 00:00:00 2001 From: Steven Wallace Date: Thu, 29 Dec 1994 23:35:47 +0000 Subject: [PATCH] Scheme to C compiler and interpreter - 15mar93 Submitted by: jmacd@uclink.berkeley.edu (Josh MacDonald) --- lang/schemetoc/Makefile | 15 + lang/schemetoc/distinfo | 1 + lang/schemetoc/files/Makefile | 38 +++ lang/schemetoc/files/makefile-head | 27 ++ lang/schemetoc/files/options-server.h | 426 ++++++++++++++++++++++++++ lang/schemetoc/files/options.h | 426 ++++++++++++++++++++++++++ lang/schemetoc/files/x86.s | 34 ++ lang/schemetoc/pkg-comment | 1 + lang/schemetoc/pkg-descr | 11 + lang/schemetoc/pkg-plist | 11 + 10 files changed, 990 insertions(+) create mode 100644 lang/schemetoc/Makefile create mode 100644 lang/schemetoc/distinfo create mode 100644 lang/schemetoc/files/Makefile create mode 100644 lang/schemetoc/files/makefile-head create mode 100644 lang/schemetoc/files/options-server.h create mode 100644 lang/schemetoc/files/options.h create mode 100644 lang/schemetoc/files/x86.s create mode 100644 lang/schemetoc/pkg-comment create mode 100644 lang/schemetoc/pkg-descr create mode 100644 lang/schemetoc/pkg-plist diff --git a/lang/schemetoc/Makefile b/lang/schemetoc/Makefile new file mode 100644 index 000000000000..bb8c48c18024 --- /dev/null +++ b/lang/schemetoc/Makefile @@ -0,0 +1,15 @@ +# New ports collection makefile for: Scheme-to-C +# Version required: 15mar93 +# Date created: 28 Dec 1994 +# Whom: jmacd@uclink.berkeley.edu +# +# $Id: Makefile,v 1.2 1994/10/06 07:52:04 swallace Exp $ +# + +DISTNAME= Scheme-to-C +MASTER_SITES= ftp://gatekeeper.dec.com/pub/DEC/Scheme-to-C/ +EXTRACT_SUFX= tar.Z +DISTFILES= 15mar93.tar.Z +NO_WRKSUBDIR= + +.include diff --git a/lang/schemetoc/distinfo b/lang/schemetoc/distinfo new file mode 100644 index 000000000000..133e19b57e11 --- /dev/null +++ b/lang/schemetoc/distinfo @@ -0,0 +1 @@ +MD5 (15mar93.tar.Z) = 461d238d55a1ef4bde31bc8571bc963c diff --git a/lang/schemetoc/files/Makefile b/lang/schemetoc/files/Makefile new file mode 100644 index 000000000000..9f19403d3e93 --- /dev/null +++ b/lang/schemetoc/files/Makefile @@ -0,0 +1,38 @@ +# Makefile for FreeBSD Scheme-to-C port + +MAN_DIR = ${PREFIX}/man/man1 +BIN_DIR = ${PREFIX}/bin +LIB_DIR = ${PREFIX}/lib +SCHEME_DIR = ${LIB_DIR}/schemetoc + +all: + make -f makefile forFREEBSD + (cd FREEBSD;make port) + (cd FREEBSD/cdecl; make all) + (cd FREEBSD/xlib; make all) +install: + mkdir -p ${SCHEME_DIR}/doc + (cd FREEBSD/scrt; make "LIBDIR = ${LIB_DIR}" \ + "BINDIR = ${BIN_DIR}" install) + (cd FREEBSD/scsc; make "LIBDIR = ${LIB_DIR}" \ + "BINDIR = ${BIN_DIR}" install) + strip ${BIN_DIR}/sccomp ${BIN_DIR}/sci + cp FREEBSD/xlib/scxl.a ${SCHEME_DIR} + ranlib ${SCHEME_DIR}/scxl.a + install -cs -g bin -o bin FREEBSD/xlib/scixl ${BIN_DIR} + (cd doc; install -c -m 444 index.psf \ + embedded.psf \ + intro.psf \ + r4rs.psf \ + smithnotes.psf \ + ${SCHEME_DIR}/doc) + cp test/test51.sc ${SCHEME_DIR}/doc/test.sc + cp xlib/hello.sc ${SCHEME_DIR}/doc + cp xlib/puzzle.sc ${SCHEME_DIR}/doc + cp doc/scc.l ${MAN_DIR}/scc.1 + cp doc/sci.l ${MAN_DIR}/sci.1 + gzip -f ${MAN_DIR}/sci.1 ${MAN_DIR}/scc.1 + @if [ ! -e ${MAN_DIR}/scixl.1.gz ] ; then ln ${MAN_DIR}/sci.1.gz ${MAN_DIR}/scixl.1.gz;fi + @if [ ! -e ${MAN_DIR}/sccxl.1.gz ] ; then ln ${MAN_DIR}/scc.1.gz ${MAN_DIR}/sccxl.1.gz;fi + chown -R bin:bin ${SCHEME_DIR} + diff --git a/lang/schemetoc/files/makefile-head b/lang/schemetoc/files/makefile-head new file mode 100644 index 000000000000..b090736aa8e1 --- /dev/null +++ b/lang/schemetoc/files/makefile-head @@ -0,0 +1,27 @@ +# +# This is the header file for constructing make files for FreeBSD. +# + +# Default flags to use when invoking the C compiler. + +CFLAGS = -O2 +CC = gcc + +# Assembly language object files. + +Aruntime = x86.o + +# Profiled library + +Plib = libsc_p.a + +# Installation tools + +RANLIB = ranlib + +# X library + +XLIB = -lX11 +XLIBCFLAGS = + +# End of FREEBSD header. diff --git a/lang/schemetoc/files/options-server.h b/lang/schemetoc/files/options-server.h new file mode 100644 index 000000000000..1f1c082fb3bf --- /dev/null +++ b/lang/schemetoc/files/options-server.h @@ -0,0 +1,426 @@ +/* SCHEME->C */ + +/* Copyright 1989-1993 Digital Equipment Corporation + * All Rights Reserved + * + * Permission to use, copy, and modify this software and its documentation is + * hereby granted only under the following terms and conditions. Both the + * above copyright notice and this permission notice must appear in all copies + * of the software, derivative works or modified versions, and any portions + * thereof, and both notices must appear in supporting documentation. + * + * Users of this software agree to the terms and conditions set forth herein, + * and hereby grant back to Digital a non-exclusive, unrestricted, royalty-free + * right and license under any changes, enhancements or extensions made to the + * core functions of the software, including but not limited to those affording + * compatibility with other hardware or software environments, but excluding + * applications which incorporate this software. Users further agree to use + * their best efforts to return to Digital any such changes, enhancements or + * extensions that they make and inform Digital of noteworthy uses of this + * software. Correspondence should be provided to Digital at: + * + * Director of Licensing + * Western Research Laboratory + * Digital Equipment Corporation + * 250 University Avenue + * Palo Alto, California 94301 + * + * This software may be distributed (but not offered for sale or transferred + * for compensation) to third parties, provided such third parties agree to + * abide by the terms and conditions of this notice. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. +*/ + +/* This file defines compilation options for a specific implementation */ + +#define CHECKSTACK 1 /* 0 = don't check stack height */ + /* 1 = check stack height */ + +#define TIMESLICE 1 /* 0 = don't time slice execution */ + /* 1 = time slice execution */ + +#define COMPACTPUSHTRACE 0 /* 0 = inline procedure entry checks. + 1 = emit procedure call for procedure + entry checks. + */ + +#define COMPACTPOPTRACE 0 /* 0 = inline procedure exit cleanup. + 1 = emit procedure call for procedure exit + cleanup. + */ + +#define S2CSIGNALS 0 /* 0 = Scheme->C doesn't handle signals */ + /* 1 = Scheme->C does handle signals */ + +#define MATHTRAPS 0 /* 0 = don't detect fixed point overflow */ + /* 1 = recover on fixed point overflow */ + +/* Define only one of the supported processor types: + + AOSF Alpha AXP OSF/1 + HP700 HP 9000/700 + MAC Macintosh system 7.1 with Think-C 5.0 + MC680X0 HP 9000/300, Sun 3, Next + MIPS DECstation, SGI, Sony News + VAX Vax ULTRIX + FREEBSD x86 FreeBSD + WIN16 Microsoft Windows 3.1 +*/ + +#define FREEBSD 1 + +/* Attributes of the selected architecture: + + The following four macros define specific aspects of the system. They + are defined as strings, or specifically undefined: + + IMPLEMENTATION_MACHINE machine type + IMPLEMENTATION_CPU cpu type + IMPLEMENTATION_OS operating system + IMPLEMENTATION_FS file system + + Big endian vs. little endian: + + BIGENDIAN defined to 1 to denote bigendian systems + + C compiler: + + OLD_FASHIONED_C defined to 1 for pre-ANSI compilers + + Alignment: + + DOUBLE_ALIGN defined to 1 to force doubles to be aligned on + an even S2CINT boundary + + Macro expansion: + + NEED_MACRO_ARGS defined to 1 to declare a macro like X() as + X(dummy) + + The types S2CINT and S2CUINT are defined to be signed and unsigned integers + that are the same size as pointers. This is the basic "word" used by + Scheme->C. + + The machine state when a continuation is created is captured in the + sc_jmp_buf data structure. + + STACKPTR( x ) is a define that stores the address of the stack pointer + in x. + + Unix flavors: + + POSIX POSIX.1 compliant + SYSV System V or derivative + SYSV4 System V release 4 (also define SYSV, POSIX) +*/ + +/**************/ +/* AOSF */ +/**************/ + +#ifdef AOSF +#define IMPLEMENTATION_MACHINE "Alpha AXP" +#undef IMPLEMENTATION_CPU +#define IMPLEMENTATION_OS "OSF/1" +#undef IMPLEMENTATION_FS + +typedef long int S2CINT; /* Signed pointer size integer */ +typedef long unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef int PAGELINK; /* 32-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffffffffffffL /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x8000000000000000L /* S2CUINT with 1 in the MSB */ + +typedef long int sc_jmp_buf[ 9 ]; /* The buffer contains the following items: + s0-s6 saved registers + ra return address + sp stack pointer + */ + +#define STACKPTR( x ) x = sc_getsp() +extern S2CINT* sc_getsp(); + +#define NEED_MACRO_ARGS 1 +#endif + +/***************/ +/* HP700 */ +/***************/ + +#ifdef HP700 + +#ifdef __hp9000s700 +#define IMPLEMENTATION_MACHINE "HP9000/700" +#else +#ifdef __hp9000s800 +#define IMPLEMENTATION_MACHINE "HP9000/800" +#endif +#endif + +#define IMPLEMENTATION_CPU "HP-PA" + +#define BIGENDIAN 1 + +#define DOUBLE_ALIGN 1 + +typedef int S2CINT; /* Signed pointer size integer */ +typedef unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef int PAGELINK; /* 32-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */ + +#define STACKPTR(x) ((x) = (sc_processor_register (30))) + +#define STACK_GROWS_POSITIVE 1 + +#endif + +#ifdef __hpux +#define IMPLEMENTATION_OS "HP-UX" +#undef IMPLEMENTATION_FS + +#ifdef __STDC__ +#undef OLD_FASHIONED_C +#else +#define OLD_FASHIONED_C 1 +#endif + +#include +typedef jmp_buf sc_jmp_buf; + +#define SYSV 1 +#define POSIX 1 + +#endif + +/*************/ +/* MAC */ +/*************/ + +#ifdef MAC +#define IMPLEMENTATION_MACHINE "Apple Macintosh" +#define IMPLEMENTATION_CPU "680x0" +#define IMPLEMENTATION_OS "7.1" +#undef IMPLEMENTATION_FS + +#define BIGENDIAN 1 + +typedef long int S2CINT; /* Signed pointer size integer */ +typedef long unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef short int PAGELINK; /* 16-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffffL /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000L /* S2CUINT with 1 in the MSB */ + +#include +typedef jmp_buf sc_jmp_buf; +#undef TRUE +#undef FALSE + +#define STACKPTR( x ) x = sc_getsp() +extern S2CINT* sc_getsp(); + +#define SCHEAP 1 +#define SCMAXHEAP 15 +#endif + +/****************/ +/* MC680X0 */ +/****************/ + +#ifdef MC680X0 +#define IMPLEMENTATION_CPU "680x0" + +#define BIGENDIAN 1 + +typedef int S2CINT; /* Signed pointer size integer */ +typedef unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef int PAGELINK; /* 32-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */ + +#define STACKPTR(x) ((x) = (sc_processor_register (15))) + +#ifdef __hp9000s400 +#define IMPLEMENTATION_MACHINE "HP9000/400" +#else +#ifdef __hp9000s300 +#define IMPLEMENTATION_MACHINE "HP9000/300" +#endif +#endif + +/* HP-UX dependent conditionalizations performed above. */ + +#endif + +/**************/ +/* MIPS */ +/**************/ + +#ifdef MIPS +#define IMPLEMENTATION_MACHINE "DECstation" +#define IMPLEMENTATION_CPU "Rx000" +#define IMPLEMENTATION_OS "ULTRIX" +#undef IMPLEMENTATION_FS + +#define DOUBLE_ALIGN 1 + +typedef int S2CINT; /* Signed pointer size integer */ +typedef unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef int PAGELINK; /* 32-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */ + +#ifndef MIPSEL +#define BIGMIPS 1 +#define BIGENDIAN 1 +#undef IMPLEMENTATION_MACHINE +#define IMPLEMENTATION_MACHINE "Big Endian MIPS" +#undef IMPLEMENTATION_OS + +/* Not sure what the correct conditionalization is here -- NEWS-OS + 5.xx defines both "sony" and "sonyrisc", but apparently NEWS-OS + 4.xx defines "sony_mips", because the previous version of Scheme->C + was conditionalized on "sony_mips" which is *not* defined by + NEWS-OS 5.xx. If there's an intersection between the symbols + defined by 4.xx and 5.xx then a member of that intersection should + be used for the conditionalization; otherwise test for both. +*/ +#ifdef sonyrisc + +#undef IMPLEMENTATION_MACHINE +#define IMPLEMENTATION_MACHINE "Sony MIPS" +#undef IMPLEMENTATION_CPU +#define IMPLEMENTATION_CPU "R3000" +#undef IMPLEMENTATION_OS +#define IMPLEMENTATION_OS "NEWS-OS" + +#ifdef SYSTYPE_SYSV + +#define SYSV4 1 +#define SYSV 1 +#define POSIX 1 + +/* This can be implemented but requires generalizing the signal + handler to know about SYSV4 siginfo structure. +*/ + +#undef MATHTRAPS +#define MATHTRAPS 0 + +#define NEED_MACRO_ARGS 1 + +#define COPY_STACK_BEFORE_LONGJMP 1 + +#endif +#endif +#endif + +#include +typedef jmp_buf sc_jmp_buf; + +#define STACKPTR( x ) x = sc_processor_register( 29 ) +#endif + +/*************/ +/* VAX */ +/*************/ + +#ifdef VAX +#define IMPLEMENTATION_MACHINE "VAX" +#undef IMPLEMENTATION_CPU +#define IMPLEMENTATION_OS "ULTRIX" +#undef IMPLEMENTATION_FS + +#define OLD_FASHIONED_C 1 + +typedef int S2CINT; /* Signed pointer size integer */ +typedef unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef int PAGELINK; /* 32-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */ + +typedef int sc_jmp_buf[ 16 ]; /* The buffer contains the following items: + R2-R11 saved registers + SIGM saved signal mask + SP stack pointer on entry to + setjmp + PSW PSW word from stack frame + AP saved argument ptr from frame + FP saved frame ptr from frame + PC saved program cntr from frame + */ + +#define STACKPTR( x ) x = sc_processor_register( 14 ) +#endif + +/***************/ +/* FREEBSD */ +/***************/ + +#ifdef FREEBSD +#define IMPLEMENTATION_MACHINE "Generic PC" +#define IMPLEMENTATION_CPU "Intelx86" +#define IMPLEMENTATION_OS "FreeBSD" +#undef IMPLEMENTATION_FS + +typedef int S2CINT; /* Signed pointer size integer */ +typedef unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef int PAGELINK; /* 32-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */ + +#define STACKPTR( x ) x = sc_processor_register( 0 ) + +#include +typedef jmp_buf sc_jmp_buf; + +/* Horrid kludge. See callcc.c for the full story: */ +#define LAZY_STACK_POP 1 +#define LAZY_STACK_INCREMENT 4 + +#endif + +/***************/ +/* WIN16 */ +/***************/ + +#ifdef WIN16 +#define IMPLEMENTATION_MACHINE "Generic PC" +#define IMPLEMENTATION_CPU "Intelx86" +#define IMPLEMENTATION_OS "Microsoft Windows 3.1" +#undef IMPLEMENTATION_FS + +typedef long int S2CINT; /* Signed pointer size integer */ +typedef long unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef short int PAGELINK; /* 16-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffffL /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000L /* S2CUINT with 1 in the MSB */ + +#include +#undef TRUE +#undef FALSE +typedef CATCHBUF sc_jmp_buf; + +#define STACKPTR( x ) x = sc_processor_register( 0 ) + +#define MAXSTRINGSIZE ((S2CINT)65532) +#define MAXVECTORSIZE ((S2CINT)16383) + +#define SCHEAP 2 +#define SCMAXHEAP 15 +#endif diff --git a/lang/schemetoc/files/options.h b/lang/schemetoc/files/options.h new file mode 100644 index 000000000000..69d8132f6740 --- /dev/null +++ b/lang/schemetoc/files/options.h @@ -0,0 +1,426 @@ +/* SCHEME->C */ + +/* Copyright 1989-1993 Digital Equipment Corporation + * All Rights Reserved + * + * Permission to use, copy, and modify this software and its documentation is + * hereby granted only under the following terms and conditions. Both the + * above copyright notice and this permission notice must appear in all copies + * of the software, derivative works or modified versions, and any portions + * thereof, and both notices must appear in supporting documentation. + * + * Users of this software agree to the terms and conditions set forth herein, + * and hereby grant back to Digital a non-exclusive, unrestricted, royalty-free + * right and license under any changes, enhancements or extensions made to the + * core functions of the software, including but not limited to those affording + * compatibility with other hardware or software environments, but excluding + * applications which incorporate this software. Users further agree to use + * their best efforts to return to Digital any such changes, enhancements or + * extensions that they make and inform Digital of noteworthy uses of this + * software. Correspondence should be provided to Digital at: + * + * Director of Licensing + * Western Research Laboratory + * Digital Equipment Corporation + * 250 University Avenue + * Palo Alto, California 94301 + * + * This software may be distributed (but not offered for sale or transferred + * for compensation) to third parties, provided such third parties agree to + * abide by the terms and conditions of this notice. + * + * THE SOFTWARE IS PROVIDED "AS IS" AND DIGITAL EQUIPMENT CORP. DISCLAIMS ALL + * WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DIGITAL EQUIPMENT + * CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL + * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR + * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS + * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS + * SOFTWARE. +*/ + +/* This file defines compilation options for a specific implementation */ + +#define CHECKSTACK 1 /* 0 = don't check stack height */ + /* 1 = check stack height */ + +#define TIMESLICE 0 /* 0 = don't time slice execution */ + /* 1 = time slice execution */ + +#define COMPACTPUSHTRACE 0 /* 0 = inline procedure entry checks. + 1 = emit procedure call for procedure + entry checks. + */ + +#define COMPACTPOPTRACE 0 /* 0 = inline procedure exit cleanup. + 1 = emit procedure call for procedure exit + cleanup. + */ + +#define S2CSIGNALS 1 /* 0 = Scheme->C doesn't handle signals */ + /* 1 = Scheme->C does handle signals */ + +#define MATHTRAPS 0 /* 0 = don't detect fixed point overflow */ + /* 1 = recover on fixed point overflow */ + +/* Define only one of the supported processor types: + + AOSF Alpha AXP OSF/1 + HP700 HP 9000/700 + MAC Macintosh system 7.1 with Think-C 5.0 + MC680X0 HP 9000/300, Sun 3, Next + MIPS DECstation, SGI, Sony News + VAX Vax ULTRIX + FREEBSD x86 FreeBSD + WIN16 Microsoft Windows 3.1 +*/ + +#define FREEBSD 1 + +/* Attributes of the selected architecture: + + The following four macros define specific aspects of the system. They + are defined as strings, or specifically undefined: + + IMPLEMENTATION_MACHINE machine type + IMPLEMENTATION_CPU cpu type + IMPLEMENTATION_OS operating system + IMPLEMENTATION_FS file system + + Big endian vs. little endian: + + BIGENDIAN defined to 1 to denote bigendian systems + + C compiler: + + OLD_FASHIONED_C defined to 1 for pre-ANSI compilers + + Alignment: + + DOUBLE_ALIGN defined to 1 to force doubles to be aligned on + an even S2CINT boundary + + Macro expansion: + + NEED_MACRO_ARGS defined to 1 to declare a macro like X() as + X(dummy) + + The types S2CINT and S2CUINT are defined to be signed and unsigned integers + that are the same size as pointers. This is the basic "word" used by + Scheme->C. + + The machine state when a continuation is created is captured in the + sc_jmp_buf data structure. + + STACKPTR( x ) is a define that stores the address of the stack pointer + in x. + + Unix flavors: + + POSIX POSIX.1 compliant + SYSV System V or derivative + SYSV4 System V release 4 (also define SYSV, POSIX) +*/ + +/**************/ +/* AOSF */ +/**************/ + +#ifdef AOSF +#define IMPLEMENTATION_MACHINE "Alpha AXP" +#undef IMPLEMENTATION_CPU +#define IMPLEMENTATION_OS "OSF/1" +#undef IMPLEMENTATION_FS + +typedef long int S2CINT; /* Signed pointer size integer */ +typedef long unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef int PAGELINK; /* 32-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffffffffffffL /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x8000000000000000L /* S2CUINT with 1 in the MSB */ + +typedef long int sc_jmp_buf[ 9 ]; /* The buffer contains the following items: + s0-s6 saved registers + ra return address + sp stack pointer + */ + +#define STACKPTR( x ) x = sc_getsp() +extern S2CINT* sc_getsp(); + +#define NEED_MACRO_ARGS 1 +#endif + +/***************/ +/* HP700 */ +/***************/ + +#ifdef HP700 + +#ifdef __hp9000s700 +#define IMPLEMENTATION_MACHINE "HP9000/700" +#else +#ifdef __hp9000s800 +#define IMPLEMENTATION_MACHINE "HP9000/800" +#endif +#endif + +#define IMPLEMENTATION_CPU "HP-PA" + +#define BIGENDIAN 1 + +#define DOUBLE_ALIGN 1 + +typedef int S2CINT; /* Signed pointer size integer */ +typedef unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef int PAGELINK; /* 32-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */ + +#define STACKPTR(x) ((x) = (sc_processor_register (30))) + +#define STACK_GROWS_POSITIVE 1 + +#endif + +#ifdef __hpux +#define IMPLEMENTATION_OS "HP-UX" +#undef IMPLEMENTATION_FS + +#ifdef __STDC__ +#undef OLD_FASHIONED_C +#else +#define OLD_FASHIONED_C 1 +#endif + +#include +typedef jmp_buf sc_jmp_buf; + +#define SYSV 1 +#define POSIX 1 + +#endif + +/*************/ +/* MAC */ +/*************/ + +#ifdef MAC +#define IMPLEMENTATION_MACHINE "Apple Macintosh" +#define IMPLEMENTATION_CPU "680x0" +#define IMPLEMENTATION_OS "7.1" +#undef IMPLEMENTATION_FS + +#define BIGENDIAN 1 + +typedef long int S2CINT; /* Signed pointer size integer */ +typedef long unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef short int PAGELINK; /* 16-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffffL /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000L /* S2CUINT with 1 in the MSB */ + +#include +typedef jmp_buf sc_jmp_buf; +#undef TRUE +#undef FALSE + +#define STACKPTR( x ) x = sc_getsp() +extern S2CINT* sc_getsp(); + +#define SCHEAP 1 +#define SCMAXHEAP 15 +#endif + +/****************/ +/* MC680X0 */ +/****************/ + +#ifdef MC680X0 +#define IMPLEMENTATION_CPU "680x0" + +#define BIGENDIAN 1 + +typedef int S2CINT; /* Signed pointer size integer */ +typedef unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef int PAGELINK; /* 32-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */ + +#define STACKPTR(x) ((x) = (sc_processor_register (15))) + +#ifdef __hp9000s400 +#define IMPLEMENTATION_MACHINE "HP9000/400" +#else +#ifdef __hp9000s300 +#define IMPLEMENTATION_MACHINE "HP9000/300" +#endif +#endif + +/* HP-UX dependent conditionalizations performed above. */ + +#endif + +/**************/ +/* MIPS */ +/**************/ + +#ifdef MIPS +#define IMPLEMENTATION_MACHINE "DECstation" +#define IMPLEMENTATION_CPU "Rx000" +#define IMPLEMENTATION_OS "ULTRIX" +#undef IMPLEMENTATION_FS + +#define DOUBLE_ALIGN 1 + +typedef int S2CINT; /* Signed pointer size integer */ +typedef unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef int PAGELINK; /* 32-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */ + +#ifndef MIPSEL +#define BIGMIPS 1 +#define BIGENDIAN 1 +#undef IMPLEMENTATION_MACHINE +#define IMPLEMENTATION_MACHINE "Big Endian MIPS" +#undef IMPLEMENTATION_OS + +/* Not sure what the correct conditionalization is here -- NEWS-OS + 5.xx defines both "sony" and "sonyrisc", but apparently NEWS-OS + 4.xx defines "sony_mips", because the previous version of Scheme->C + was conditionalized on "sony_mips" which is *not* defined by + NEWS-OS 5.xx. If there's an intersection between the symbols + defined by 4.xx and 5.xx then a member of that intersection should + be used for the conditionalization; otherwise test for both. +*/ +#ifdef sonyrisc + +#undef IMPLEMENTATION_MACHINE +#define IMPLEMENTATION_MACHINE "Sony MIPS" +#undef IMPLEMENTATION_CPU +#define IMPLEMENTATION_CPU "R3000" +#undef IMPLEMENTATION_OS +#define IMPLEMENTATION_OS "NEWS-OS" + +#ifdef SYSTYPE_SYSV + +#define SYSV4 1 +#define SYSV 1 +#define POSIX 1 + +/* This can be implemented but requires generalizing the signal + handler to know about SYSV4 siginfo structure. +*/ + +#undef MATHTRAPS +#define MATHTRAPS 0 + +#define NEED_MACRO_ARGS 1 + +#define COPY_STACK_BEFORE_LONGJMP 1 + +#endif +#endif +#endif + +#include +typedef jmp_buf sc_jmp_buf; + +#define STACKPTR( x ) x = sc_processor_register( 29 ) +#endif + +/*************/ +/* VAX */ +/*************/ + +#ifdef VAX +#define IMPLEMENTATION_MACHINE "VAX" +#undef IMPLEMENTATION_CPU +#define IMPLEMENTATION_OS "ULTRIX" +#undef IMPLEMENTATION_FS + +#define OLD_FASHIONED_C 1 + +typedef int S2CINT; /* Signed pointer size integer */ +typedef unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef int PAGELINK; /* 32-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */ + +typedef int sc_jmp_buf[ 16 ]; /* The buffer contains the following items: + R2-R11 saved registers + SIGM saved signal mask + SP stack pointer on entry to + setjmp + PSW PSW word from stack frame + AP saved argument ptr from frame + FP saved frame ptr from frame + PC saved program cntr from frame + */ + +#define STACKPTR( x ) x = sc_processor_register( 14 ) +#endif + +/***************/ +/* FREEBSD */ +/***************/ + +#ifdef FREEBSD +#define IMPLEMENTATION_MACHINE "Generic PC" +#define IMPLEMENTATION_CPU "Intelx86" +#define IMPLEMENTATION_OS "FreeBSD" +#undef IMPLEMENTATION_FS + +typedef int S2CINT; /* Signed pointer size integer */ +typedef unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef int PAGELINK; /* 32-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffff /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000 /* S2CUINT with 1 in the MSB */ + +#define STACKPTR( x ) x = sc_processor_register( 0 ) + +#include +typedef jmp_buf sc_jmp_buf; + +/* Horrid kludge. See callcc.c for the full story: */ +#define LAZY_STACK_POP 1 +#define LAZY_STACK_INCREMENT 4 + +#endif + +/***************/ +/* WIN16 */ +/***************/ + +#ifdef WIN16 +#define IMPLEMENTATION_MACHINE "Generic PC" +#define IMPLEMENTATION_CPU "Intelx86" +#define IMPLEMENTATION_OS "Microsoft Windows 3.1" +#undef IMPLEMENTATION_FS + +typedef long int S2CINT; /* Signed pointer size integer */ +typedef long unsigned S2CUINT; /* Unsigned pointer size interger */ + +typedef short int PAGELINK; /* 16-bit sc_pagelink values */ +#define MAXS2CINT 0x7fffffffL /* Maximum value of an S2CINT */ +#define MSBS2CUINT 0x80000000L /* S2CUINT with 1 in the MSB */ + +#include +#undef TRUE +#undef FALSE +typedef CATCHBUF sc_jmp_buf; + +#define STACKPTR( x ) x = sc_processor_register( 0 ) + +#define MAXSTRINGSIZE ((S2CINT)65532) +#define MAXVECTORSIZE ((S2CINT)16383) + +#define SCHEAP 2 +#define SCMAXHEAP 15 +#endif diff --git a/lang/schemetoc/files/x86.s b/lang/schemetoc/files/x86.s new file mode 100644 index 000000000000..1cedbc50ce29 --- /dev/null +++ b/lang/schemetoc/files/x86.s @@ -0,0 +1,34 @@ +/* + * SCHEME->C + * + * x86 assembly code. + * + * This code originally came from the Linux port, so someone else gets + * the credit for writing it. + * + */ + +#ifdef __i486__ + .align 4 +#else + .align 2 +#endif +.globl _sc_geti386regs + +_sc_geti386regs: + pushl %ebp + movl %esp,%ebp + pushl %ecx + movl %eax,%ecx + movl 8(%ebp),%eax + movl %ecx,(%eax) + popl %ecx + movl %ecx,4(%eax) + movl %edx,8(%eax) + movl %ebx,12(%eax) + movl %esi,16(%eax) + movl %edi,20(%eax) + movl %ebp,%esp + popl %ebp + ret + diff --git a/lang/schemetoc/pkg-comment b/lang/schemetoc/pkg-comment new file mode 100644 index 000000000000..1bc6bf6ecd4c --- /dev/null +++ b/lang/schemetoc/pkg-comment @@ -0,0 +1 @@ +Scheme-to-C, a compiler and interpreter for compiling scheme into C. diff --git a/lang/schemetoc/pkg-descr b/lang/schemetoc/pkg-descr new file mode 100644 index 000000000000..8e1943d9936c --- /dev/null +++ b/lang/schemetoc/pkg-descr @@ -0,0 +1,11 @@ +Scheme->C is an implementation of the language Scheme as described +in the Revised^4 Report on the Algorithmic Language Scheme (Lisp +Pointers, Volume Iv, Number 3, July-September 1991). + +This implementation has certain extensions to the language which +allows Scheme to be compiled to C into standalone programs, combined +with other languages, or compiled into the interpreter itself. + +Scheme->C also includes an X interface library. + +Ported to FreeBSD by Josh MacDonald, jmacd@uclink.berkeley.edu diff --git a/lang/schemetoc/pkg-plist b/lang/schemetoc/pkg-plist new file mode 100644 index 000000000000..83810624ce3b --- /dev/null +++ b/lang/schemetoc/pkg-plist @@ -0,0 +1,11 @@ +@cwd /usr/local +bin/sci +bin/scc +bin/sccomp +bin/scixl +bin/sccxl +man/man1/sci.1.gz +man/man1/scc.1.gz +man/man1/scixl.1.gz +man/man1/sccxl.1.gz +lib/schemetoc