home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / scheme / scheme2c / rec-28se.pat / patches next >
Encoding:
Text File  |  1994-06-30  |  26.1 KB  |  1,031 lines

  1. diff -c -r 28sep90/makefile s2c/makefile
  2. *** 28sep90/makefile    Tue Apr 10 16:48:28 1990
  3. --- s2c/makefile    Tue Nov 13 23:14:42 1990
  4. ***************
  5. *** 16,22 ****
  6. --- 16,51 ----
  7.   VAXBIN = /wrl/vax/bin
  8.   VAXLIB = /wrl/vax/lib
  9.   
  10. + # Architecture specific makefiles are constructed by the
  11. + # following commands.
  12.   
  13. + inplaceCPU:
  14. +     test -f makefile-tail || cp makefile makefile-tail
  15. +     echo "BINDIR = ${BINDIR}"  > makefile
  16. +     echo "LIBDIR = ${LIBDIR}" >> makefile
  17. +     cat makefile-tail            >> makefile
  18. +     test -f doc/makefile-tail || cp doc/makefile doc/makefile-tail
  19. +     echo "SRCDIR = ${SRCDIR}/doc"  > doc/makefile
  20. +     cat doc/makefile-tail           >> doc/makefile
  21. +     cat ${CPU}             > scrt/makefile
  22. +     echo "SRCDIR = ${SRCDIR}/scrt" >> scrt/makefile 
  23. +     echo "CPUDIR = ${CPUDIR}/scrt" >> scrt/makefile
  24. +     echo "BINDIR = ${BINDIR}"      >> scrt/makefile
  25. +     echo "LIBDIR = ${LIBDIR}"      >> scrt/makefile
  26. +     cat scrt/makefile-tail         >> scrt/makefile
  27. +     cat ${CPU}             > scsc/makefile
  28. +     echo "SRCDIR = ${SRCDIR}/scsc" >> scsc/makefile 
  29. +     echo "CPUDIR = ${CPUDIR}/scsc" >> scsc/makefile
  30. +     echo "BINDIR = ${BINDIR}"      >> scsc/makefile
  31. +     echo "LIBDIR = ${LIBDIR}"      >> scsc/makefile
  32. +     cat scsc/makefile-tail         >> scsc/makefile
  33. +     cat ${CPU}             > test/makefile
  34. +     echo "SRCDIR = ${SRCDIR}/test" >> test/makefile 
  35. +     echo "CPUDIR = ${CPUDIR}/test" >> test/makefile
  36. +     echo "BINDIR = ${BINDIR}"      >> test/makefile
  37. +     echo "LIBDIR = ${LIBDIR}"      >> test/makefile
  38. +     cat test/makefile-tail           >> test/makefile
  39.   # Architecture specific directories and links to the source files are
  40.   # constructed by the following commands which follow:
  41.   
  42. ***************
  43. *** 74,79 ****
  44. --- 103,123 ----
  45.   forVAX:
  46.       make "CPU = VAX" "CPUDIR = ${VAXDIR}" \
  47.            "BINDIR = ${VAXBIN}" "LIBDIR = ${VAXLIB}" forCPU
  48. + forI386:
  49. +     make "CPU = I386" "CPUDIR = /usr/local/src/24mar90" \
  50. +          "SRCDIR = /usr/local/src/24mar90" \
  51. +          "BINDIR = /usr/local/bin" "LIBDIR = /usr/local/lib" inplaceCPU
  52. + forISC386IX:
  53. +     make "CPU = ISC386IX" "CPUDIR = /home/28sep90" \
  54. +          "SRCDIR = /home/28sep90" \
  55. +          "BINDIR = /usr/local/bin" "LIBDIR = /usr/local/lib" inplaceCPU
  56. + forSPARC:
  57. +     make "CPU = SPARC" "CPUDIR = /var/tmp/24mar90" \
  58. +          "SRCDIR = /var/tmp/24mar90" \
  59. +          "BINDIR = /usr/local/bin" "LIBDIR = /usr/local/lib" inplaceCPU
  60.   
  61.   # The Scheme->C system is initially compiled from the C sources by the
  62.   # following:
  63. diff -c -r 28sep90/scrt/apply.h s2c/scrt/apply.h
  64. *** 28sep90/scrt/apply.h    Fri Sep 21 15:51:11 1990
  65. --- s2c/scrt/apply.h    Tue Nov 13 23:13:15 1990
  66. ***************
  67. *** 44,49 ****
  68. --- 44,57 ----
  69.      by the compiler to call unknown functions.
  70.   */
  71.   
  72. + #ifdef SPARC
  73. + #define MAXARGS 25
  74. + #endif
  75. + #ifdef I386
  76. + #define MAXARGS 25    /* gcc doesn't appear to set any limit */
  77. + #endif
  78.   #ifdef MIPS
  79.   #define MAXARGS 25    /* Maximum number of required arguments permitted.
  80.                  Note that this does not preclude an optional
  81. diff -c -r 28sep90/scrt/callcc.c s2c/scrt/callcc.c
  82. *** 28sep90/scrt/callcc.c    Fri Sep 21 15:51:55 1990
  83. --- s2c/scrt/callcc.c    Tue Nov 13 23:13:20 1990
  84. ***************
  85. *** 57,62 ****
  86. --- 57,70 ----
  87.   #include "callcc.h"
  88.   #include "apply.h"
  89.   #include "signal.h"
  90. + #ifdef SPARC
  91. + extern    sc_setjmp();
  92. + #pragma unknown_control_flow(sc_setjmp)
  93. + #define setjmp( x )    sc_setjmp( x )
  94. + #define longjmp( x, y )    sc_longjmp( x, y )
  95. + #endif
  96.   #ifdef MIPS
  97.   extern  sc_setsp();
  98.   #endif
  99. diff -c -r 28sep90/scrt/cio.c s2c/scrt/cio.c
  100. *** 28sep90/scrt/cio.c    Fri Sep 21 15:52:03 1990
  101. --- s2c/scrt/cio.c    Tue Nov 13 23:13:26 1990
  102. ***************
  103. *** 46,51 ****
  104. --- 46,69 ----
  105.   #include <sys/time.h>
  106.   #include "objects.h"
  107.   
  108. + #if ISC386IX
  109. + #include <stropts.h>
  110. + #include <poll.h>
  111. + #include <errno.h>
  112. + int rename(old, new) char *old, *new;
  113. + {
  114. +   if (link(old, new) < 0)
  115. +     if (errno == EEXIST && unlink(new) == 0 && link(old, new) < 0)
  116. +       return 0;
  117. +     else
  118. +       return -1;
  119. +   else if (unlink(old) == 0)
  120. +     return 0;
  121. +   return -1;
  122. + }
  123. + #endif
  124.   int  sc_libc_eof = EOF;
  125.   
  126.   /*  feof(stream)  */
  127. ***************
  128. *** 88,100 ****
  129. --- 106,128 ----
  130.       FILE *stream;
  131.   {
  132.       int  readfds, nfound;
  133. + #if ! ISC386IX
  134.       struct  timeval  timeout;
  135. + #else
  136. +     struct pollfd pollfd;
  137. + #endif
  138.       
  139.       if  (((stream)->_cnt) <= 0)  {
  140. + #if ! ISC386IX
  141.          readfds = 1<<(fileno( stream ));
  142.          timeout.tv_sec = 0;
  143.          timeout.tv_usec = 0;
  144.          nfound = select( fileno( stream )+1, &readfds, 0, 0, &timeout );
  145. + #else
  146. +       pollfd.fd = fileno( stream );
  147. +       pollfd.events = POLLIN;
  148. +       nfound = poll(&pollfd, 1, 0);
  149. + #endif
  150.          if  (nfound == 0)  return( 0 );
  151.       }
  152.       return( 1 );
  153. diff -c -r 28sep90/scrt/heap.c s2c/scrt/heap.c
  154. *** 28sep90/scrt/heap.c    Fri Sep 21 15:54:45 1990
  155. --- s2c/scrt/heap.c    Tue Nov 13 23:13:33 1990
  156. ***************
  157. *** 100,108 ****
  158. --- 100,110 ----
  159.   
  160.   int    sc_gcinfo;        /* controls logging */
  161.   
  162. + #if ! SYSV
  163.   static struct rusage gcru,    /* resource consumption during collection */
  164.                    startru,
  165.                      stopru;
  166. + #endif
  167.   
  168.   int    *sc_stackbase;        /* pointer to base of the stack */
  169.   
  170. ***************
  171. *** 111,116 ****
  172. --- 113,119 ----
  173.   
  174.   TSCP    sc_after_2dcollect_v;    /* Collection status callback */
  175.   
  176. + #if ! SYSV
  177.   /* The following function converts a rusage structure into an 18 word Scheme
  178.      vector composed of the same items.
  179.   */
  180. ***************
  181. *** 240,245 ****
  182. --- 243,252 ----
  183.   {
  184.       return( rusagevector( &gcru ) );
  185.   }
  186. + #else
  187. + #define    getrusage(x,y)    /* no operation */
  188. + #define updategcru()    /* no operation */
  189. + #endif        /* SYSV-BSD dependency */
  190.   
  191.   /* Errors detected during garbage collection are logged by the following
  192.      procedure.  If any errors occur, the program will abort after logging
  193. ***************
  194. *** 402,407 ****
  195. --- 409,455 ----
  196.   }
  197.   #endif MIPS
  198.   
  199. + #ifdef SPARC
  200. + /* All processor registers which might contain pointers are traced by the
  201. +    following procedure.
  202. + */
  203. + static  trace_stack_and_registers()
  204. + {
  205. +     int  i, *pp;
  206. +     jmp_buf tmp;
  207. +     pp = STACKPTR;
  208. +     while  (pp != sc_stackbase)  move_continuation_ptr( *pp++ );
  209. + }
  210. + #endif SPARC
  211. + #ifdef I386
  212. + /* The following code is used to read the stack pointer.  The register
  213. +    number is passed in to force an argument to be on the stack, which in
  214. +    turn can be used to find the address of the top of stack.
  215. + */
  216. + int  *sc_processor_register( reg )
  217. +     int  reg;
  218. + {
  219. +     return( ® );
  220. + }
  221. + /* All processor registers which might contain pointers are traced by the
  222. +    following procedure.
  223. + */
  224. + static  trace_stack_and_registers()
  225. + {
  226. +     int  i, *pp;
  227. +     jmp_buf tmp;
  228. +     setjmp(tmp);
  229. +     pp = STACKPTR;
  230. +     while  (pp != sc_stackbase)  move_continuation_ptr( *pp++ );
  231. + }
  232. + #endif I386
  233.   
  234.   /* The size of an extended object in words is returned by the following
  235.      function.
  236. ***************
  237. *** 1421,1426 ****
  238. --- 1469,1475 ----
  239.       getrusage( 0, &stopru );
  240.       updategcru();
  241.       if  (sc_gcinfo)  { 
  242. + #if ! SYSV
  243.          fprintf( stderr,
  244.                   "              %d%% locked  %d%% retained  %d user ms",
  245.               (sc_lockcnt*100)/sc_heappages,
  246. ***************
  247. *** 1430,1435 ****
  248. --- 1479,1490 ----
  249.                  "  %d system ms  %d page faults\n",
  250.               stopru.ru_stime.tv_sec*1000+stopru.ru_stime.tv_usec/1000,
  251.               stopru.ru_majflt );
  252. + #else
  253. +        fprintf( stderr,
  254. +                 "              %d%% locked  %d%% retained\n",
  255. +             (sc_lockcnt*100)/sc_heappages,
  256. +                 (sc_generationpages*100)/sc_heappages);
  257. + #endif
  258.       }
  259.       if  (sc_gcinfo == 2)  {
  260.          /* Perform additional consistency checks */
  261. diff -c -r 28sep90/scrt/heap.h s2c/scrt/heap.h
  262. *** 28sep90/scrt/heap.h    Fri Sep 21 15:54:58 1990
  263. --- s2c/scrt/heap.h    Tue Nov 13 23:13:38 1990
  264. ***************
  265. *** 42,50 ****
  266. --- 42,57 ----
  267.   /* Import definitions */
  268.   
  269.   #ifndef rusage
  270. + #ifdef SPARC
  271. + #include <sys/time.h>
  272. + #include <sys/resource.h>
  273. + #else
  274. + #ifndef SYSV
  275.   #include <time.h>
  276.   #include <sys/resource.h>
  277.   #endif
  278. + #endif
  279. + #endif
  280.   
  281.   /* This module implements the object storage storage system for SCHEME->C.
  282.   
  283. ***************
  284. *** 306,311 ****
  285. --- 313,326 ----
  286.   */
  287.   
  288.   extern int  *sc_stackbase;
  289. + #ifdef I386
  290. + #define STACKPTR sc_processor_register( 4 )
  291. + #endif
  292. + #ifdef SPARC
  293. + #define STACKPTR sc_processor_register( 0 )
  294. + #endif
  295.   
  296.   #ifdef MIPS
  297.   #define STACKPTR sc_processor_register( 29 )
  298. diff -c -r 28sep90/scrt/makefile-tail s2c/scrt/makefile-tail
  299. *** 28sep90/scrt/makefile-tail    Tue Nov 20 01:30:39 1990
  300. --- s2c/scrt/makefile-tail    Tue Nov 13 23:13:44 1990
  301. ***************
  302. *** 66,77 ****
  303.   Xsci:        ${Sruntimec} ${Sruntime} ${Cruntime} ${Aruntime} \
  304.            sci.c sci.o
  305.       ${CC} -o Xsci ${CFLAGS} ${Sruntime} ${Cruntime} ${Aruntime} sci.o \
  306. !           -lm
  307.   
  308.   GGCi:        ${Sruntimec} ${Sruntime} ${Aruntime} GGC.o sci.c sci.o
  309.       make "CFLAGS = -DGGC ${CFLAGS}" GGCheap.o GGCscinit.o
  310.       ${CC} -o GGCi ${CFLAGS} ${Sruntime} ${GGCCruntime} ${Aruntime} sci.o \
  311. !           -lXaw -lXt -lX11 -lm
  312.   
  313.   Xmv:        Xsci Xlibsc.a
  314.       mv Xsci sci
  315. --- 66,77 ----
  316.   Xsci:        ${Sruntimec} ${Sruntime} ${Cruntime} ${Aruntime} \
  317.            sci.c sci.o
  318.       ${CC} -o Xsci ${CFLAGS} ${Sruntime} ${Cruntime} ${Aruntime} sci.o \
  319. !           ${CLIBS}
  320.   
  321.   GGCi:        ${Sruntimec} ${Sruntime} ${Aruntime} GGC.o sci.c sci.o
  322.       make "CFLAGS = -DGGC ${CFLAGS}" GGCheap.o GGCscinit.o
  323.       ${CC} -o GGCi ${CFLAGS} ${Sruntime} ${GGCCruntime} ${Aruntime} sci.o \
  324. !           -lXaw -lXt -lX11 ${CLIBS}
  325.   
  326.   Xmv:        Xsci Xlibsc.a
  327.       mv Xsci sci
  328. diff -c -r 28sep90/scrt/objects.h s2c/scrt/objects.h
  329. *** 28sep90/scrt/objects.h    Fri Sep 21 15:56:06 1990
  330. --- s2c/scrt/objects.h    Tue Nov 13 23:13:51 1990
  331. ***************
  332. *** 44,52 ****
  333. --- 44,60 ----
  334.   
  335.   /* Default the value of CPUTYPE if not currently defined. */
  336.   
  337. + #ifndef SPARC
  338. + #ifndef I386
  339.   #ifndef MIPS
  340.   #ifndef TITAN
  341.   #ifndef VAX
  342. + #ifdef sparc
  343. + #define SPARC 1
  344. + #endif
  345. + #ifdef i386
  346. + #define I386 1
  347. + #endif
  348.   #ifdef mips
  349.   #define MIPS 1
  350.   #endif
  351. ***************
  352. *** 59,64 ****
  353. --- 67,81 ----
  354.   #endif
  355.   #endif
  356.   #endif
  357. + #endif
  358. + #endif
  359. + #ifdef SPARC
  360. + #define MATHTRAPS 0
  361. + #endif
  362. + #ifdef I386
  363. + #define MATHTRAPS 0
  364. + #endif
  365.   
  366.   /* The Scheme->C installer may elect to have arithmetic overflow handled
  367.      gracefully on either the MIPS or the VAX implementations.  The default
  368. ***************
  369. *** 71,76 ****
  370. --- 88,102 ----
  371.   
  372.   /* A machine dependent definition:  the setjmp/longjmp buffer.  */
  373.   
  374. + #ifdef SPARC
  375. + typedef int jmp_buf[2+7+8+8+1];
  376. + #define DOUBLE_ALIGN 1
  377. + #endif
  378. + #ifdef I386
  379. + #include <setjmp.h>
  380. + #define CPUTYPE I386
  381. + #endif
  382.   #ifdef MIPS
  383.   #include <setjmp.h>
  384.   #define CPUTYPE MIPS
  385. ***************
  386. *** 130,141 ****
  387. --- 156,177 ----
  388.             unsigned  gned;
  389.          }  unsi;
  390.          struct {    /* EXTENDEDOBJ */
  391. + #ifndef SPARC
  392.             unsigned  tag:8;
  393.             unsigned  rest:24;
  394. + #else
  395. +           unsigned  rest:24;
  396. +           unsigned  tag:8;
  397. + #endif
  398.          }  extendedobj;
  399.          struct {    /* SYMBOL */
  400. + #ifndef SPARC
  401.             unsigned  tag:8;
  402.             unsigned  rest:24;
  403. + #else
  404. +           unsigned  rest:24;
  405. +           unsigned  tag:8;
  406. + #endif
  407.             TSCP  name;
  408.             TSCP  *ptrtovalue;
  409.             TSCP  value;
  410. ***************
  411. *** 142,172 ****
  412. --- 178,234 ----
  413.             TSCP  propertylist;
  414.          }  symbol;
  415.          struct {    /* STRING */
  416. + #ifndef SPARC
  417.             unsigned  tag:8;
  418.             unsigned  length:24;
  419. + #else
  420. +           unsigned  length:24;
  421. +           unsigned  tag:8;
  422. + #endif
  423.             char  char0;
  424.          }  string;
  425.          struct {    /* VECTOR */
  426. + #ifndef SPARC
  427.             unsigned  tag:8;
  428.             unsigned  length:24;
  429. + #else
  430. +           unsigned  length:24;
  431. +           unsigned  tag:8;
  432. + #endif
  433.             TSCP  element0;
  434.          }  vector;
  435.          struct {    /* PROCEDURE */
  436. + #ifndef SPARC
  437.             unsigned  tag:8;
  438.             unsigned  required:8;
  439.             unsigned  optional:16;
  440. + #else
  441. +           unsigned  optional:16;
  442. +           unsigned  required:8;
  443. +           unsigned  tag:8;
  444. + #endif
  445.             TSCP  (*code)();
  446.             TSCP  closure;
  447.          }  procedure;
  448.          struct {    /* CLOSURE */
  449. + #ifndef SPARC
  450.             unsigned  tag:8;
  451.             unsigned  length:24;
  452. + #else
  453. +           unsigned  length:24;
  454. +           unsigned  tag:8;
  455. + #endif
  456.             TSCP  closure;
  457.             TSCP  var0;
  458.          }  closure;
  459.          struct {    /* CONTINUATION */
  460. + #ifndef SPARC
  461.             unsigned  tag:8;
  462.             unsigned  length:24;
  463. + #else
  464. +           unsigned  length:24;
  465. +           unsigned  tag:8;
  466. + #endif
  467.             TSCP  continuation;
  468.             jmp_buf  savedstate;
  469.             int  *address;
  470. ***************
  471. *** 174,196 ****
  472. --- 236,278 ----
  473.             int  word0;
  474.          }  continuation;
  475.          struct {    /* FLOAT32 */
  476. + #ifndef SPARC
  477.             unsigned  tag:8;
  478.             unsigned  rest:24;
  479. + #else
  480. +           unsigned  rest:24;
  481. +           unsigned  tag:8;
  482. + #endif
  483.             float  value;
  484.          }  float32;
  485.          struct {    /* FLOAT64 */
  486. + #ifndef SPARC
  487.             unsigned  tag:8;
  488.             unsigned  rest:24;
  489. + #else
  490. +           unsigned  rest:24;
  491. +           unsigned  tag:8;
  492. + #endif
  493.             double  value;
  494.          }  float64;
  495.          struct {    /* FORWARD */
  496. + #ifndef SPARC
  497.             unsigned  tag:8;
  498.             unsigned  length:24;
  499. + #else
  500. +           unsigned  length:24;
  501. +           unsigned  tag:8;
  502. + #endif
  503.             TSCP  forward;
  504.          } forward;
  505.          struct {    /* WORDALIGN */
  506. + #ifndef SPARC
  507.             unsigned  tag:8;
  508.             unsigned  length:24;
  509. + #else
  510. +           unsigned  length:24;
  511. +           unsigned  tag:8;
  512. + #endif
  513.          }  wordalign;
  514.          struct {    /* PAIR */
  515.             TSCP  car;
  516. ***************
  517. *** 208,213 ****
  518. --- 290,303 ----
  519.   #define  U_TX( scp ) ((TSCP)((char*)(scp)+EXTENDEDTAG))
  520.   #define  U_TP( scp ) ((TSCP)((char*)(scp)+PAIRTAG))
  521.   #define  T_U( tscp ) ((SCP)((int)(tscp) & (~TAGMASK)))
  522. + #ifdef SPARC
  523. + #define  TX_U( tscp ) ((SCP)((char*)tscp-EXTENDEDTAG))
  524. + #define  TP_U( tscp ) ((SCP)((char*)tscp-PAIRTAG))
  525. + #endif
  526. + #ifdef I386
  527. + #define  TX_U( tscp ) ((SCP)((char*)tscp-EXTENDEDTAG))
  528. + #define  TP_U( tscp ) ((SCP)((char*)tscp-PAIRTAG))
  529. + #endif
  530.   #ifdef MIPS
  531.   #define  TX_U( tscp ) ((SCP)((char*)tscp-EXTENDEDTAG))
  532.   #define  TP_U( tscp ) ((SCP)((char*)tscp-PAIRTAG))
  533. ***************
  534. *** 725,730 ****
  535. --- 815,826 ----
  536.   #define STRING_CHAR( tscp, n )  (*(((unsigned char*)tscp)+FIXED_C( n )+3))
  537.   
  538.   #define VECTOR_LENGTH( tscp )     (TX_U( tscp )->vector.length)
  539. + #ifdef SPARC
  540. + #define VECTOR_ELEMENT( tscp, n ) (*((PATSCP)(((char*)( tscp ))+3+((int)n))))
  541. + #endif
  542. + #ifdef I386
  543. + #define VECTOR_ELEMENT( tscp, n ) (*((PATSCP)(((char*)( tscp ))+3+((int)n))))
  544. + #endif
  545.   #ifdef MIPS
  546.   #define VECTOR_ELEMENT( tscp, n ) (*((PATSCP)(((char*)( tscp ))+3+((int)n))))
  547.   #endif
  548. ***************
  549. *** 752,768 ****
  550. --- 848,880 ----
  551.   
  552.   /* C declarations */
  553.   
  554. + #ifndef SPARC
  555.   #define DEFSTRING( name, chars, len ) \
  556.       static struct { unsigned tag:8; \
  557.                   unsigned length:24; \
  558.                   char char0[len+(4-(len % 4))]; } \
  559.       name = { STRINGTAG, len, chars }
  560. + #else
  561. + #define DEFSTRING( name, chars, len ) \
  562. +     static struct { unsigned length:24; \
  563. +                 unsigned tag:8; \
  564. +                 char char0[len+(4-(len % 4))]; } \
  565. +     name = { len, STRINGTAG, chars }
  566. + #endif
  567.   
  568. + #ifndef SPARC
  569.   #define DEFFLOAT( name, value ) \
  570.       static struct { unsigned tag:8; \
  571.                   unsigned length: 24; \
  572.                   FLOATTYPE f; } \
  573.       name = { FLOATTAG, 0, value }
  574. + #else
  575. + #define DEFFLOAT( name, value ) \
  576. +     static struct { unsigned length:24; \
  577. +                 unsigned tag:8; \
  578. +                 FLOATTYPE f; } \
  579. +     name = { 0, FLOATTAG, value }
  580. + #endif
  581.   
  582.   #define DEFTSCP( name ) TSCP  name
  583.   
  584. diff -c -r 28sep90/scrt/scinit.c s2c/scrt/scinit.c
  585. *** 28sep90/scrt/scinit.c    Fri Sep 21 15:57:01 1990
  586. --- s2c/scrt/scinit.c    Tue Nov 13 23:13:56 1990
  587. ***************
  588. *** 53,58 ****
  589. --- 53,76 ----
  590.   extern  errno;            /* C-library Error flag */
  591.   
  592.   extern  etext;
  593. + #ifdef SPARC
  594. + #define ETEXT    ((int)&etext)    /* First address after text */
  595. + #include <sun4/vmparam.h>
  596. + #define STACKBASE (int*)USRSTACK
  597. + #endif
  598. + #ifdef ISC386IX
  599. + #if I386SHLIB
  600. + int *sc__etext;
  601. + #define ETEXT    ((int)sc__etext) /* first address after text */
  602. + #else
  603. + #define ETEXT    ((int)&etext)    /* first address after text */
  604. + #endif
  605. + #include <sys/types.h>
  606. + #include <sys/fcntl.h>        /* probably should be elsewhere */
  607. + #include <sys/immu.h>
  608. + #define STACKBASE (int*)UVSTACK
  609. + #endif
  610. + /* ditto for SCO */
  611.   #ifdef MIPS
  612.   #define ETEXT    ((int)&etext)    /* First address after text */
  613.   #include <mips/param.h>
  614. ***************
  615. *** 71,80 ****
  616.   #define STACKBASE (int*)USRSTACK
  617.   #endif
  618.   
  619. - #include <sys/file.h>
  620.   #include <sys/types.h>
  621.   #include <sys/uio.h>
  622.   #include <strings.h>
  623.   #include <varargs.h>
  624.   
  625.   /* Definitions for objects within sc */
  626. --- 89,102 ----
  627.   #define STACKBASE (int*)USRSTACK
  628.   #endif
  629.   
  630.   #include <sys/types.h>
  631. + #include <sys/file.h>
  632.   #include <sys/uio.h>
  633. + #if ! SYSV
  634.   #include <strings.h>
  635. + #else
  636. + #include <string.h>
  637. + #endif
  638.   #include <varargs.h>
  639.   
  640.   /* Definitions for objects within sc */
  641. ***************
  642. *** 183,188 ****
  643. --- 205,211 ----
  644.   
  645.   static  init_procs()
  646.   {
  647. + #if ! SYSV
  648.           INITIALIZEVAR( U_TX( ADR( t1030 ) ), 
  649.                          ADR( sc_my_2drusage_v ), 
  650.                          MAKEPROCEDURE( 0, 
  651. ***************
  652. *** 192,197 ****
  653. --- 215,221 ----
  654.                          MAKEPROCEDURE( 0, 
  655.                                         0, 
  656.                                         sc_collect_2drusage, EMPTYLIST ) );
  657. + #endif
  658.           INITIALIZEVAR( U_TX( ADR( t1034 ) ), 
  659.                          ADR( sc_collect_v ), 
  660.                          MAKEPROCEDURE( 0, 
  661. ***************
  662. *** 721,726 ****
  663. --- 745,756 ----
  664.             sc_cons(
  665.                sc_cstringtostring( "28sep90jfb" ),
  666.                sc_cons(
  667. + #ifdef SPARC
  668. +             sc_cstringtostring( "SparcStation-1" ),
  669. + #endif
  670. + #ifdef I386
  671. +             sc_cstringtostring( "AT/386" ),
  672. + #endif
  673.   #ifdef MIPS
  674.               sc_cstringtostring( "DECstation3100" ),
  675.   #endif
  676. ***************
  677. *** 731,736 ****
  678. --- 761,772 ----
  679.               sc_cstringtostring( "VAX" ),
  680.   #endif
  681.               sc_cons(
  682. + #ifdef SPARC
  683. +                sc_cstringtostring( "SPARC" ),
  684. + #endif
  685. + #ifdef I386
  686. +                sc_cstringtostring( "Intel 386" ),
  687. + #endif
  688.   #ifdef MIPS
  689.                  sc_cstringtostring( "R2000" ),
  690.   #endif
  691. ***************
  692. *** 741,747 ****
  693. --- 777,792 ----
  694.                  sc_cstringtostring( "VAX" ),
  695.   #endif
  696.                  sc_cons(
  697. + #ifdef SPARC
  698. +               sc_cstringtostring( "SunOS" ),
  699. + #else
  700. + #if VAX || TITAN || MIPS
  701.                     sc_cstringtostring( "ULTRIX" ),
  702. + #endif
  703. + #if SYSV
  704. +               sc_cstringtostring( "System V.3.2" ),
  705. + #endif
  706. + #endif
  707.                     sc_cons(
  708.                     FALSEVALUE,
  709.                     EMPTYLIST
  710. ***************
  711. *** 752,755 ****
  712. --- 797,805 ----
  713.                )
  714.                 )
  715.             );
  716.   }
  717. diff -c -r 28sep90/scrt/signal.c s2c/scrt/signal.c
  718. *** 28sep90/scrt/signal.c    Fri Sep 21 16:00:13 1990
  719. --- s2c/scrt/signal.c    Sat Nov 17 12:44:37 1990
  720. ***************
  721. *** 92,101 ****
  722. --- 92,106 ----
  723.      hardware traps.
  724.   */
  725.   
  726. + #if SYSV
  727. + void  sc_onsignal1( signal )
  728. +     int  signal;
  729. + #else
  730.   void  sc_onsignal1( signal, code, scp )
  731.       int  signal,
  732.            code;
  733.       struct sigcontext*  scp;
  734. + #endif
  735.   {
  736.       int  i;
  737.       struct  {            /* Save sc_unknowncall's state here */
  738. ***************
  739. *** 104,109 ****
  740. --- 109,122 ----
  741.          int     count;
  742.       } save;
  743.   
  744. + #if SYSV
  745. +     /* Reset the signal, might be more prudent later? */
  746. +     {
  747. +       extern TSCP scrt4_signals_v;
  748. +       scrt4_signal(INT_TSCP(signal),
  749. +                VECTOR_ELEMENT(scrt4_signals_v, INT_TSCP(signal)));
  750. +     }
  751. + #endif
  752.       if  (sc_mutex == 0  &&  gcinprogress == 0)  {
  753.          /* Save sc_unknowncall's state */
  754.          for  (i = 0; i < 4; i++)  save.proc[ i ] = sc_unknownproc[ i ];
  755. ***************
  756. *** 118,124 ****
  757. --- 131,141 ----
  758.       }
  759.       else  {
  760.          /* Signal must be defered */
  761. + #if SYSV
  762. +        sighold( signal );
  763. + #else
  764.          sigblock( 1<<signal );
  765. + #endif
  766.          pendingsignals = pendingsignals | (1<<signal);
  767.          if  (gcinprogress == 0)  sc_pendingsignals = 1;
  768.       }
  769. ***************
  770. *** 150,161 ****
  771.       /* Send the pending signals and exit the critical section */
  772.       sc_pendingsignals = 0;
  773.       self = getpid();
  774.       oldmask = sigblock( -1 ) & ~pendingsignals;
  775.       for  (i = 0; i < 32; i++)
  776. !        if  (pendingsignals & (1<<i))  kill( self, i );
  777.       pendingsignals = 0;
  778.       sc_mutex = 0;
  779.       sigsetmask( oldmask );
  780.   
  781.       /* Apply the when-unreferenced procedures */
  782.       while  (freed != EMPTYLIST)  {
  783. --- 167,187 ----
  784.       /* Send the pending signals and exit the critical section */
  785.       sc_pendingsignals = 0;
  786.       self = getpid();
  787. + #if ! SYSV
  788.       oldmask = sigblock( -1 ) & ~pendingsignals;
  789. + #endif
  790.       for  (i = 0; i < 32; i++)
  791. !       if  (pendingsignals & (1<<i)) {
  792. ! #if SYSV
  793. !         sigrelse( i );
  794. ! #endif
  795. !         kill( self, i );
  796. !       }
  797.       pendingsignals = 0;
  798.       sc_mutex = 0;
  799. + #if ! SYSV
  800.       sigsetmask( oldmask );
  801. + #endif
  802.   
  803.       /* Apply the when-unreferenced procedures */
  804.       while  (freed != EMPTYLIST)  {
  805. ***************
  806. *** 182,191 ****
  807. --- 208,226 ----
  808.      exceptions.
  809.   */
  810.   
  811. + #if SYSV
  812. + sc_trap_handler (sig)
  813. +     int  sig;
  814. + #else
  815.   sc_trap_handler (sig,code,scp)
  816.       int sig, code;
  817.       struct sigcontext *scp;
  818. + #endif
  819.   {
  820. + #if SYSV
  821. +     signal(sig, sc_trap_handler);
  822. +     sc_error( "???? (in sc_trap_handler)", "Floating point exception", 0 );
  823. + #endif
  824.   #if  (TITAN || (MATHTRAPS == 0))
  825.       sc_error( "???? (in sc_trap_handler)", "Floating point exception", 0 );
  826.   #endif
  827. diff -c -r 28sep90/scsc/makefile-tail s2c/scsc/makefile-tail
  828. *** 28sep90/scsc/makefile-tail    Thu Aug 17 14:25:26 1989
  829. --- s2c/scsc/makefile-tail    Tue Nov 13 23:14:09 1990
  830. ***************
  831. *** 35,41 ****
  832.   sc-to-c:    ${scc}
  833.   
  834.   Xsccomp:    ${scc} ${sco} ${rt}
  835. !     ${CC} -o Xsccomp ${CFLAGS} ${sco} ${rt} -lm
  836.       
  837.   Xsccomp.heap:    Xsccomp
  838.       Xsccomp ../scrt/predef.sc ../scrt/objects.h ../scrt/libsc.a \
  839. --- 35,41 ----
  840.   sc-to-c:    ${scc}
  841.   
  842.   Xsccomp:    ${scc} ${sco} ${rt}
  843. !     ${CC} -o Xsccomp ${CFLAGS} ${sco} ${rt} ${CLIBS}
  844.       
  845.   Xsccomp.heap:    Xsccomp
  846.       Xsccomp ../scrt/predef.sc ../scrt/objects.h ../scrt/libsc.a \
  847. diff -c -r 28sep90/test/makefile-tail s2c/test/makefile-tail
  848. *** 28sep90/test/makefile-tail    Mon Apr  9 20:03:14 1990
  849. --- s2c/test/makefile-tail    Tue Nov 13 23:14:15 1990
  850. ***************
  851. *** 3,9 ****
  852.   #
  853.   
  854.   sccomp = ../scsc/sccomp
  855. - CC = cc
  856.   CFLAGS = -g
  857.   rt = ../scrt/libsc.a
  858.   n = n must be defined
  859. --- 3,8 ----
  860. ***************
  861. *** 46,72 ****
  862.       ${sccomp} -schf ${sccomp}.heap -c ${CFLAGS} $*.c
  863.   
  864.   test:    test.c test.o testchk.c testchk.o ${batch-c} ${batch-o}
  865. !     ${CC} -o test ${CFLAGS} test.o testchk.o ${batch-o} ${rt} -lm
  866.   
  867.   testn:    testchk.c testchk.o ${rt} 
  868. !     ${sccomp} -schf ${sccomp}.heap -i ${CFLAGS} -o test${n} test${n}.sc \
  869.             testchk.o ${rt}
  870.   
  871.   test50:    test50.c test50.o
  872. !     ${CC} -o test50 ${CFLAGS} test50.o ${rt} -lm
  873.   
  874.   test51:    test51.c test51.o
  875. !     ${CC} -o test51 ${CFLAGS} test51.o ${rt} -lm
  876.   
  877.   test52:    test52.c test52.o
  878. !     ${CC} -o test52 ${CFLAGS} test52.o ${rt} -lm
  879.   
  880.   test53:    test53.sc
  881.       ${sccomp} -schf ${sccomp}.heap -i -o test53 ${CFLAGS} test53.sc \
  882. !           ${rt} -lm
  883.   
  884.   test54:    test54.c test54.o test54c.o testchk.o
  885. !     ${CC} -o test54 ${CFLAGS} test54.o test54c.o testchk.o ${rt} -lm
  886.   
  887.   port:
  888.   
  889. --- 45,72 ----
  890.       ${sccomp} -schf ${sccomp}.heap -c ${CFLAGS} $*.c
  891.   
  892.   test:    test.c test.o testchk.c testchk.o ${batch-c} ${batch-o}
  893. !     ${CC} -o test ${CFLAGS} test.o testchk.o ${batch-o} ${rt} ${CLIBS}
  894.   
  895.   testn:    testchk.c testchk.o ${rt} 
  896. !     ${sccomp} -schf ${sccomp}.heap -cc ${CC} -i ${CFLAGS}\
  897. !           -o test${n} test${n}.sc \
  898.             testchk.o ${rt}
  899.   
  900.   test50:    test50.c test50.o
  901. !     ${CC} -o test50 ${CFLAGS} test50.o ${rt} ${CLIBS}
  902.   
  903.   test51:    test51.c test51.o
  904. !     ${CC} -o test51 ${CFLAGS} test51.o ${rt} ${CLIBS}
  905.   
  906.   test52:    test52.c test52.o
  907. !     ${CC} -o test52 ${CFLAGS} test52.o ${rt} ${CLIBS}
  908.   
  909.   test53:    test53.sc
  910.       ${sccomp} -schf ${sccomp}.heap -i -o test53 ${CFLAGS} test53.sc \
  911. !           ${rt} ${CLIBS}
  912.   
  913.   test54:    test54.c test54.o test54c.o testchk.o
  914. !     ${CC} -o test54 ${CFLAGS} test54.o test54c.o testchk.o ${rt} ${CLIBS}
  915.   
  916.   port:
  917.   
  918. diff -c -r 28sep90/test/test16.sc s2c/test/test16.sc
  919. *** 28sep90/test/test16.sc    Thu Feb 22 21:11:07 1990
  920. --- s2c/test/test16.sc    Tue Nov 13 23:14:21 1990
  921. ***************
  922. *** 52,57 ****
  923. --- 52,60 ----
  924.   ;;; *.*  Extensions for accessing C structures.  At the moment, they assume
  925.   ;;;      that the bits are ordered like the VAX.
  926.   
  927. +   (let ((big-endian (member (list-ref (implementation-information) 3)
  928. +                 '("SPARC"))))
  929.       (let ((s (make-string 10 #\*)))
  930.        (c-byte-set! s 0 (char->integer #\S))
  931.        (c-byte-set! s 1 (char->integer #\c))
  932. ***************
  933. *** 71,84 ****
  934.       (let ((s (make-string 10 #\*)))
  935.        (c-int-set! s 0 #xffff)
  936.        (chk 10 (c-int-ref s 0) #xffff)
  937. !      (chk 11 (c-shortunsigned-ref s 0) #xffff)
  938. !      (chk 12 (c-shortunsigned-ref s 2) 0)
  939. !      (chk 13 (c-shortint-ref s 0) -1)
  940. !      (chk 14 (c-shortint-ref s 2) 0)
  941. !      (c-shortint-set! s 2 -1)
  942. !      (chk 15 (c-int-ref s 0) -1)
  943. !      (c-shortunsigned-set! s 0 #xfffe)
  944. !      (chk 16 (c-int-ref s 0) -2))
  945.   
  946.       (let ((s (make-string 10 #\*)))
  947.        (c-unsigned-set! s 0 (- (expt 2 32) 1))
  948. --- 74,98 ----
  949.       (let ((s (make-string 10 #\*)))
  950.        (c-int-set! s 0 #xffff)
  951.        (chk 10 (c-int-ref s 0) #xffff)
  952. !      (if big-endian
  953. !          (begin
  954. !            (chk 11 (c-shortunsigned-ref s 2) #xffff)
  955. !            (chk 12 (c-shortunsigned-ref s 0) 0)
  956. !            (chk 13 (c-shortint-ref s 2) -1)
  957. !            (chk 14 (c-shortint-ref s 0) 0)
  958. !            (c-shortint-set! s 0 -1)
  959. !            (chk 15 (c-int-ref s 0) -1)
  960. !            (c-shortunsigned-set! s 2 #xfffe)
  961. !            (chk 16 (c-int-ref s 0) -2))
  962. !          (begin
  963. !            (chk 11 (c-shortunsigned-ref s 0) #xffff)
  964. !            (chk 12 (c-shortunsigned-ref s 2) 0)
  965. !            (chk 13 (c-shortint-ref s 0) -1)
  966. !            (chk 14 (c-shortint-ref s 2) 0)
  967. !            (c-shortint-set! s 2 -1)
  968. !            (chk 15 (c-int-ref s 0) -1)
  969. !            (c-shortunsigned-set! s 0 #xfffe)
  970. !            (chk 16 (c-int-ref s 0) -2))))
  971.   
  972.       (let ((s (make-string 10 #\*)))
  973.        (c-unsigned-set! s 0 (- (expt 2 32) 1))
  974. ***************
  975. *** 99,105 ****
  976.   
  977.       (let ((s (make-string 10 #\*))
  978.         (v (make-vector 10 -1)))
  979. !      (chk 40 (scheme-byte-ref s 1) 10)
  980.        (chk 41 (scheme-byte-ref s 4) (char->integer #\*))
  981.        (chk 42 (scheme-byte-ref s 14) 0)
  982.        (scheme-byte-set! s 5 (char->integer #\^))
  983. --- 113,121 ----
  984.   
  985.       (let ((s (make-string 10 #\*))
  986.         (v (make-vector 10 -1)))
  987. !          (if big-endian
  988. !          (chk 40 (scheme-byte-ref s 2) 10)
  989. !          (chk 40 (scheme-byte-ref s 1) 10))
  990.        (chk 41 (scheme-byte-ref s 4) (char->integer #\*))
  991.        (chk 42 (scheme-byte-ref s 14) 0)
  992.        (scheme-byte-set! s 5 (char->integer #\^))
  993. ***************
  994. *** 123,126 ****
  995.        (chk 55 (bit-or 1 3 5) 7)
  996.        (chk 56 (bit-xor 1 3 5) 7)
  997.        (chk 57 (bit-lsh 1 31) 2147483648.)
  998. !      (chk 58 (bit-rsh -1 31) 1))
  999. --- 139,142 ----
  1000.        (chk 55 (bit-or 1 3 5) 7)
  1001.        (chk 56 (bit-xor 1 3 5) 7)
  1002.        (chk 57 (bit-lsh 1 31) 2147483648.)
  1003. !      (chk 58 (bit-rsh -1 31) 1)))
  1004.