main9.red 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. % MAIN9.RED READ-EVAL-PRINT, RECLAIM, CATCH and PROG
  2. IN "xxx-header.red"$
  3. %/ in "pt:stubs3.red" % -- real gc installed as SUB8
  4. in "pt:stubs4.red"$
  5. in "pt:stubs5.red"$
  6. in "pt:stubs6.red"$
  7. in "pt:stubs7.red"$
  8. in "pt:stubs8.red"$
  9. in "pt:stubs9.red"$
  10. in "pt:psl-timer.sl"$
  11. on syslisp;
  12. Compiletime GLOBAL '(DEBUG IN!* OUT!* !$EOF!$ !*PVAL);
  13. FLUID '(Heap!-Warn!-Level);
  14. Procedure FirstCall;
  15. Begin scalar x, Done, Hcount;
  16. INIT();
  17. InitHeap();
  18. InitObList();
  19. InitEval();
  20. InitRead();
  21. LispVar(DEBUG) := 'NIL; % For nice I/O
  22. Lispvar(Heap!-Warn!-Level) := 0; % Set for Non-trap
  23. LispVar(!*GC) :=T;
  24. LispVar(GCKnt!*) :=0;
  25. LispVar(GCTime!*) :=0;
  26. LispVar(!*RAISE) := 'T; % Upcase Input IDs
  27. LispVar(!*PVAL) := 'T; % Print VALUEs
  28. LispVar(!$EOF!$) := MKID Char EOF; % Check for EOF
  29. Hcount :=0;
  30. Prin2t "Invoking STARTUP Code";
  31. InitCode();
  32. LISPVAR(IN!*):=0;
  33. LISPVAR(OUT!*):=1;
  34. Hcount :=0;
  35. ClearIo();
  36. Prin2T "Reading the INIT files";
  37. Lapin "INIT9";
  38. Prin2t '"MINI-PSL with File I/O, RECLAIM and CATCH/THROW";
  39. While Not Done do
  40. <<Hcount:=Hcount+1;
  41. Prin2 Hcount; Prin2 '" lisp> ";
  42. x:=READ();
  43. if x EQ !$EOF!$ then
  44. <<Terpri();
  45. Prin2T " *** Top Level EOF *** ">>
  46. else if x eq 'QUIT then Done := 'T
  47. else <<Terpri();
  48. x:=EVAL x;
  49. if Lispvar(!*PVAL) then Print x>>;
  50. >>;
  51. Quit;
  52. End;
  53. Off syslisp;
  54. End;