rend2.red 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. COMMENT The material in this file introduces extensions or redefinitions of
  2. code in the REDUCE source files, and is not really necessary to run
  3. a basic system;
  4. COMMENT Introduction of Infix Character Strings Peculiar to the PDP-10;
  5. PUT(INTERN ASCII 27,'NEWNAM,'!$);
  6. PUT(INTERN ASCII 125,'NEWNAM,'!$);
  7. PUT('!^,'NEWNAM,'EXPT);
  8. COMMENT REDUCE Functions defined in front end for greater efficiency;
  9. COMMENT The following routine is used by DETQ;
  10. LAP '((TWOMEM EXPR 2)
  11. (MOVE C B)
  12. (CALL 1 (E NUMVAL))
  13. (EXCH A C)
  14. (CALL 1 (E NUMVAL))
  15. (133120 A C)
  16. (JUMPE A TAG)
  17. (MOVEI A (QUOTE T))
  18. TAG (POPJ P));
  19. FLAG('(TWOMEM),'LOSE);
  20. GLOBAL '(TTYPE!* SCNVAL);
  21. REMFLAG('(TOKEN),'LOSE);
  22. SYMBOLIC PROCEDURE TOKEN;
  23. IF NULL IFL!* AND !*INT THEN TOKEN1()
  24. ELSE IF (TTYPE!*:=!%SCAN()) = 0 THEN INTERN SCNVAL
  25. ELSE IF SCNVAL EQ '!' THEN LIST('QUOTE,RREAD())
  26. ELSE SCNVAL;
  27. FLAG('(TOKEN),'LOSE);
  28. COMMENT Redefinition of REDUCE IO functions for greater flexibility;
  29. %SYMBOLIC PROCEDURE SLREADFN;
  30. % BEGIN SCALAR !*MODE,!*SLIN;
  31. % !*MODE := 'SYMBOLIC;
  32. % !*SLIN := T;
  33. % BEGIN1();
  34. % RESETPARSER(); %since SCANSET seems to get set to NIL
  35. % END;
  36. %PUT('SL,'ACTION,'SLREADFN);
  37. PUT('LOAD,'STAT,'RLIS); %to make available as a command;
  38. FLAG('(LOAD),'NOFORM);
  39. PUT('TR,'STAT,'RLIS);
  40. PUT('TRST,'STAT,'RLIS);
  41. FLAG('(TR TRST UNTR UNTRST),'IGNORE);
  42. COMMENT SIMPFG properties for various flags;
  43. PUT('CREF,'SIMPFG,'((T (PROG NIL (FISLM (QUOTE RCREF)) (CREFON)))
  44. (NIL (CREFOFF))));
  45. COMMENT Declarations needed for FAP building;
  46. %ALG1:
  47. FLAG('(CDIF CMINUS CMOD CPLUS CTIMES SETMOD),'LOSE);
  48. % FACTOR:
  49. FLUID '(LARGEST!-SMALL!-MODULUS);
  50. LARGEST!-SMALL!-MODULUS := 2**32;
  51. SYMBOLIC PROCEDURE LOGAND2(M,N); BOOLE(1,M,N);
  52. SYMBOLIC PROCEDURE LOGOR2(M,N); BOOLE(7,M,N);
  53. SYMBOLIC PROCEDURE LOGXOR2(M,N); BOOLE(6,M,N);
  54. SYMBOLIC SMACRO PROCEDURE LEFTSHIFT(U,N); LSH(U,N);
  55. %RLISP:
  56. FLAG('(TOKEN COMMAND ATSOC PRINTPROMPT RESETPARSER),'LOSE);
  57. COMMENT redefining COMMAND;
  58. GLOBAL '(EDIT!* !*DEMO !*PRET);
  59. REMFLAG('(COMMAND),'LOSE);
  60. SYMBOLIC PROCEDURE COMMAND;
  61. BEGIN SCALAR X,Y;
  62. IF !*DEMO AND (X := IFL!*)
  63. THEN PROGN(TERPRI(),RDS NIL,READCH(),RDS CDR X);
  64. IF EDIT!* THEN EDITLINE() ELSE IF FLG!* THEN GO TO A;
  65. IF !*SLIN THEN
  66. <<!%NEXTTYI(); KEY!* := SEMIC!* := '!;;
  67. CLOC!* := IF IFL!* THEN CAR IFL!* . PGLINE() ELSE NIL;
  68. X := IF LREADFN!* THEN APPLY(LREADFN!*,NIL) ELSE READ();
  69. IF KEY!* EQ '!; THEN KEY!* := IF ATOM X THEN X ELSE CAR X>>
  70. ELSE <<SCAN();
  71. CLOC!* := IF IFL!* THEN CAR IFL!* . PGLINE() ELSE NIL;
  72. KEY!* := CURSYM!*; X := XREAD1 NIL>>;
  73. IF !*PRET THEN PROGN(TERPRI(),RPRINT X);
  74. % IF IFL!*='(DSK!: (INPUT . TMP)) AND
  75. % (Y:= PGLINE()) NEQ '(1 . 0)
  76. % THEN LPL!*:= Y; %use of IN(noargs);
  77. A: IF FLG!* AND IFL!* THEN BEGIN
  78. CLOSE CDR IFL!*;
  79. IPL!* := DELETE(IFL!*,IPL!*);
  80. IF IPL!* THEN RDS CDAR IPL!* ELSE RDS NIL;
  81. IFL!* := NIL END;
  82. FLG!* := NIL;
  83. IF NULL !*SLIN THEN X := FORM X;
  84. IF CLOC!* AND NOT ATOM X AND CAR X MEMQ '(DE DF DM)
  85. THEN PUT(CADR X,'LOCN,CLOC!*)
  86. ELSE IF CLOC!* AND EQCAR(X,'PROGN)
  87. AND CDDR X AND NOT ATOM CADDR X
  88. AND CAADDR X MEMQ '(DE DF DM)
  89. THEN PUT(CADR CADDR X,'LOCN,CLOC!*);
  90. RETURN X
  91. END;
  92. FLAG('(COMMAND),'LOSE);
  93. FLUID '(TSLIN!* !*SLIN);
  94. SYMBOLIC PROCEDURE RDFNEV(X,Y,Z,U);
  95. <<IF (X EQ !*SLIN OR X AND !*SLIN) AND Y EQ LREADFN!* THEN Z:=NIL
  96. ELSE <<IF U THEN TSLIN!* := (!*SLIN . LREADFN!*);
  97. !*SLIN := X;
  98. LREADFN!* := Y>>;
  99. IF U THEN EVAL CAR U ELSE Z>>;
  100. REMFLAG('(SLISP RLISP),'GO);
  101. FEXPR PROCEDURE SLISP U;
  102. RDFNEV(T,NIL,"Standard Lisp parsing . . .",U);
  103. FEXPR PROCEDURE RLISP U;
  104. RDFNEV(NIL,NIL,"Rlisp parsing . . .",U);
  105. PUTD('LISP,'FEXPR,CDR GETD 'RLISP);
  106. GLOBAL '(!*BACKTRACE);
  107. SYMBOLIC PROCEDURE RMOSTAT;
  108. BEGIN SCALAR TMODE,X,Y;
  109. IF NOT(KEY!* EQ (X:=CURSYM!*)) THEN SYMERR("SYNTAX ERROR",NIL)
  110. ELSE IF FLAGP(SCAN(),'DELIM)
  111. THEN <<!*MODE:='SYMBOLIC; RETURN LIST X>>;
  112. KEY!* := CURSYM!*;
  113. TMODE := !*MODE;
  114. !*MODE := 'SYMBOLIC;
  115. Y := ERRORSET('(XREAD1 NIL),NIL,!*BACKTRACE);
  116. !*MODE := TMODE;
  117. IF ATOM Y OR CDR Y THEN ERROR(10,NIL);
  118. RETURN X . CAR Y
  119. END;
  120. PUT('RLISP,'STAT,'RMOSTAT);
  121. PUT('SLISP,'STAT,'RMOSTAT);
  122. FLAG('(SLISP RLISP),'GO);
  123. FLAG('(SLISP RLISP),'EVAL);
  124. FLAG('(SLISP RLISP),'IGNORE);
  125. REMFLAG('(RESETPARSER),'LOSE);
  126. SYMBOLIC PROCEDURE RESETPARSER;
  127. IF !*SLIN THEN <<RDSLSH NIL; SCANSET T>> ELSE COMM1 T;
  128. FLAG('(RESETPARSER),'LOSE);
  129. REMFLAG('(OFF),'EVAL);
  130. COMMENT fixups for build of REDUCE;
  131. %MAPOBL FUNCTION LAMBDA J;
  132. % <<REMFLAG(LIST J,'LOSE); REMFLAG(LIST J,'FLUID)>>;
  133. FLAG('(!*S!* !*S1!* !*PI!*),'FLUID);
  134. REMPROP('U,'VALUE);
  135. REMPROP('W,'VALUE);
  136. REMPROP('X,'VALUE);
  137. REMPROP('Y,'VALUE);
  138. IF SYSTEM!*=-1 THEN PUTD('SETSITE,'EXPR,'(LAMBDA NIL NIL));
  139. FLAG('(CORE),'OPFN);
  140. COMMENT some global variable initializations;
  141. INITFN!* := 'BEGIN;
  142. !*GCGAG := NIL;
  143. !*INT := T;
  144. !*NOUUO := NIL;
  145. !*RAISE := T;
  146. KLIST := NIL;
  147. TMODE!* := NIL;
  148. TSLIN!* := NIL;
  149. !*BEGIN := NIL;
  150. !*COMP := NIL;
  151. !*FSLOUT := NIL;
  152. COMMENT Some additional constructs for TOPS-10;
  153. IF SYSTEM!* EQ 0 THEN <<FLAG('(EXCORE),'OPFN);
  154. FISLSIZE := 1500; %big enough for factor;
  155. PUT('BFLOAT,'FAPSIZE,7);
  156. PUT('COMPLR,'FAPSIZE,6);
  157. PUT('FACTOR,'FAPSIZE,27);
  158. PUT('FAP,'FAPSIZE,3);
  159. PUT('HEPHYS,'FAPSIZE,3);
  160. PUT('INT,'FAPSIZE,11);
  161. PUT('MATR,'FAPSIZE,2);
  162. PUT('RCREF,'FAPSIZE,3);
  163. PUT('RPRINT,'FAPSIZE,2);
  164. PUT('SOLVE,'FAPSIZE,4)>>;
  165. COMMENT The following two functions are only needed for TENEX;
  166. IF SYSTEM!* EQ 1 THEN BEGIN
  167. PUTD('STDIR,'EXPR,'(LAMBDA (U)
  168. (PROG (A)
  169. (SETQ A (ERRORSET (LIST 'JSYS 32 0 (MKQUOTE U) 0 1)
  170. NIL NIL))
  171. (RETURN (COND ((ATOM A) 0)
  172. (T (BOOLE 1 (CAR A) 262143)))))));
  173. PUTD('SETSYS!:,'EXPR,'(LAMBDA (U) (SETSYS (STDIR U))))
  174. END;
  175. END;