Subject: Re: Scheme->C
From: [email-masked] (David Fox)

24 Jun 1997 19:53:07 -0700
Approved: [email-masked]
Distribution: cygnus
Message-ID: <[email-masked]>
References: <[email-masked]>
Reply-To: [email-masked]
Original-To: Blake McBride <[email-masked]>
Original-CC: [email-masked]
In-Reply-To: <[email-masked]>
Original-Sender: [email-masked]

I basically use the Linux patches with a few tiny changes to get the
makefiles to work and a couple of other things.  To build I use these
commands, and the patch is appended.  I also apply my own patches to
add CLOS style keywords, but that is not required.  As I sort of
implied, I haven't tested this very extensively yet.  All the tricky
assembler bits may be broken for all I know, but it prints a prompt,
evaluates (car '(a b)) and passes its test suite.
--
David Fox           http://found.cs.nyu.edu/fox            xoF divaD
NYU Media Research Lab     [email-masked]     baL hcraeseR aideM UYN

Build script:

  gunzip < Scheme-to-C-cygwin32.tar.gz | tar xf -
  cd Scheme-to-C-cygwin32
  make forLINUX
  cd LINUX
  make port
  cd scrt
  make install LIBDIR=/gnuwin32/b18/H-i386-cygwin/lib/schemetoc
  BINDIR=/gnuwin32/b18/H-i386-cygwin/bin
  cd ..
  cd scsc
  make install BINDIR=/gnuwin32/b18/H-i386-cygwin/bin

Patch:

diff -ru s2cnt/scrt/cio.c~ s2cnt/scrt/cio.c
--- s2cnt/scrt/cio.c~	Fri Jun 20 08:42:16 1997
+++ s2cnt/scrt/cio.c	Fri Jun 20 09:04:07 1997
@@ -41,6 +41,7 @@
 
 /* This module supplies functions to access the system dependent facilities. */
 
+#include <time.h>
 #include "objects.h"
 #include "heap.h"
 #include "cio.h"
@@ -468,7 +469,7 @@
 
 	stream = (FILE*)TSCP_POINTER( file );
 #ifdef LINUX
-	if  (((stream)->_IO_read_end) <= ((stream)->_IO_read_ptr) )  {
+	if  (((stream)->_r) <= 0) {
 #else
 	if  (((stream)->_cnt) <= 0)  {
 #endif
diff -ru s2cnt/ports/LINUX/linux.s~ s2cnt/ports/LINUX/linux.s
--- s2cnt/ports/LINUX/linux.s~	Fri Jun 20 08:42:31 1997
+++ s2cnt/ports/LINUX/linux.s	Fri Jun 20 09:18:37 1997
@@ -3,9 +3,9 @@
 #else
 	.align 2
 #endif
-.globl	sc_geti386regs
+.globl	_sc_geti386regs
 
-sc_geti386regs:
+_sc_geti386regs:
 	pushl %ebp
 	movl %esp,%ebp
 	pushl %ecx
diff -ru Scheme-to-C-cygwin32/scrt/makefile.orig Scheme-to-C-cygwin32/scrt/makefile
--- Scheme-to-C-cygwin32/scrt/makefile.orig	Fri Jun 20 11:08:53 1997
+++ Scheme-to-C-cygwin32/scrt/makefile	Fri Jun 20 11:27:49 1997
@@ -73,7 +73,7 @@
 	      -lm
 
 Xmv:		Xsci Xlibsc.a
-	mv Xsci sci
+	mv Xsci.exe sci.exe
 	mv Xlibsc.a libsc.a
 
 port:
@@ -117,7 +117,7 @@
 	cp objects.h ${LIBDIR}/schemetoc
 	cp options.h ${LIBDIR}/schemetoc
 	cp predef.sc ${LIBDIR}/schemetoc
-	cp sci ${BINDIR}/sci
+	cp sci.exe ${BINDIR}/sci.exe
 
 clean:
 	rm -f ${Sruntime} ${Cruntime} ${Aruntime} sci.o embedded.o \
diff -ru Scheme-to-C-cygwin32/scsc/makefile.orig Scheme-to-C-cygwin32/scsc/makefile
--- Scheme-to-C-cygwin32/scsc/makefile.orig	Fri Jan 29 18:17:02 1993
+++ Scheme-to-C-cygwin32/scsc/makefile	Fri Jun 20 11:26:21 1997
@@ -47,7 +47,7 @@
 	${CC} -o Xsccomp ${CFLAGS} ${sco} ${RT} -lm
 
 Xmv:
-	mv Xsccomp sccomp
+	mv Xsccomp.exe sccomp.exe
 
 port:
 	make "CC = ${CC}" "CFLAGS = ${CFLAGS}" "SCC = echo"  Xsccomp Xmv
@@ -57,11 +57,7 @@
 	     "OWNER = -o `whoami`" install
 
 install:
-	echo '#! /bin/csh -f' > ${BINDIR}/scc
-	echo '${BINDIR}/sccomp -scl ${SCL} -scmh ${SCMH} \
-	     -cc ${CC} -LIBDIR ${LIBDIR}/schemetoc $$argv' >> ${BINDIR}/scc
-	chmod +x ${BINDIR}/scc
-	cp sccomp ${BINDIR}
+	cp sccomp.exe ${BINDIR}/scc.exe
 
 clean:
 	rm -f ${sco} *.BAK *.CKP scltext.* *.S2C
diff -ru s2cnt/ports/LINUX/makefile-head~ s2cnt/ports/LINUX/makefile-head
--- s2cnt/ports/LINUX/makefile-head~	Sat Mar 19 18:04:41 1994
+++ s2cnt/ports/LINUX/makefile-head	Fri Jun 20 10:15:31 1997
@@ -4,7 +4,7 @@
 
 # Default flags to use when invoking the C compiler.
 
-CFLAGS = -O2
+CFLAGS = -O2 -DLINUX
 CC = gcc
 
 # Assembly language object files.
diff -ru s2cnt/test/makefile~ s2cnt/test/makefile
--- s2cnt/test/makefile~	Tue Jan 19 20:55:32 1993
+++ s2cnt/test/makefile	Fri Jun 20 10:17:17 1997
@@ -2,7 +2,7 @@
 #  Scheme->C compiler and runtime tests.
 #
 
-SCC = ../scsc/scc
+SCC = ../scsc/sccomp -scl 40 -scmh 20 -cc gcc -LIBDIR ../scrt
 SCCFLAGS = -g
 
 n = n must be defined
diff -ru s2cnt/scsc/main.sc~ s2cnt/scsc/main.sc
--- s2cnt/scsc/main.sc~	Fri Jun 20 08:42:40 1997
+++ s2cnt/scsc/main.sc	Fri Jun 20 11:04:56 1997
@@ -69,24 +69,24 @@
 ;;; The following top-level variables define the implementation dependent
 ;;; information:
 
-(define PREDEF-DEFAULT "../scrt/predef.sc")
+(define PREDEF-DEFAULT "/gnuwin32/b18/H-i386-cygwin32/lib/schemetoc/predef.sc")
 				; File holding the declarations for predefined
 				; functions.
 
 (define C-INCLUDE-FILE "objects.h")
 				; #include file for the predefined functions.
 
-(define C-INCLUDE-DIR "../scrt")
+(define C-INCLUDE-DIR "/gnuwin32/b18/H-i386-cygwin32/lib/schemetoc")
     				; directory containing #include file for
 				; predefined functions.
 
-(define SC-LIBRARY "../scrt/libsc.a")
+(define SC-LIBRARY "/gnuwin32/b18/H-i386-cygwin32/lib/schemetoc/libsc.a")
 				; Scheme->C library file.
 
-(define SC-LIBRARY_P "../scrt/libsc_p.a")
+(define SC-LIBRARY_P "/gnuwin32/b18/H-i386-cygwin32/lib/schemetoc/libsc_p.a")
 				; Scheme->C profiled library file.
 
-(define SC-LIBRARY_G "../scrt/libsc_g.a")
+(define SC-LIBRARY_G "/gnuwin32/b18/H-i386-cygwin32/lib/schemetoc/libsc_g.a")
 				; Scheme->C debugging library file.
 
 ;;; When the compiler is invoked directly from the shell, the following
@@ -172,7 +172,7 @@
 		  "\\"
 		  "/"))
 	  (log '())
-	  (cc "cc"))
+	  (cc "gcc"))
 	 
 	 ;;; 1. Pick up the command line arguments.
 	 
diff -ru Scheme-to-C-cygwin32/scsc/main.c~ Scheme-to-C-cygwin32/scsc/main.c
--- Scheme-to-C-cygwin32/scsc/main.c~	Mon Feb 22 16:31:25 1993
+++ Scheme-to-C-cygwin32/scsc/main.c	Fri Jun 20 11:37:18 1997
@@ -29,7 +29,7 @@
 DEFSTATICTSCP( c2470 );
 DEFCSTRING( t2588, ".sc" );
 DEFSTATICTSCP( c2468 );
-DEFCSTRING( t2589, "cc" );
+DEFCSTRING( t2589, "gcc" );
 DEFSTATICTSCP( c2436 );
 DEFCSTRING( t2590, "\\" );
 DEFSTATICTSCP( c2435 );
@@ -146,15 +146,15 @@
 DEFCSTRING( t2657, "-f" );
 DEFSTATICTSCP( c2041 );
 DEFSTATICTSCP( c2015 );
-DEFCSTRING( t2658, "../scrt/libsc_p.a" );
+DEFCSTRING( t2658, "/gnuwin32/b18/H-i386-cygwin32/lib/schemetoc/libsc_p.a" );
 DEFSTATICTSCP( c2012 );
-DEFCSTRING( t2659, "../scrt/libsc.a" );
+DEFCSTRING( t2659, "/gnuwin32/b18/H-i386-cygwin32/lib/schemetoc/libsc.a" );
 DEFSTATICTSCP( c2010 );
-DEFCSTRING( t2660, "../scrt" );
+DEFCSTRING( t2660, "/gnuwin32/b18/H-i386-cygwin32/lib/schemetoc" );
 DEFSTATICTSCP( c2008 );
 DEFCSTRING( t2661, "objects.h" );
 DEFSTATICTSCP( c2006 );
-DEFCSTRING( t2662, "../scrt/predef.sc" );
+DEFCSTRING( t2662, "/gnuwin32/b18/H-i386-cygwin32/lib/schemetoc/predef.sc" );
 DEFSTATICTSCP( c2004 );
 DEFCSTRING( t2663, "15mar93jfb" );
 DEFSTATICTSCP( c2001 );
-
For help on using this list (especially unsubscribing), send a message to
"[email-masked]" with one line of text: "help".