new-sym.red 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. % Replacements for functions in usual xxx-CROSS.EXE which only read/write
  2. % xxx.SYM if flags !*symread/!*symwrite are T; otherwise symbols are
  3. % assumed to be already loaded (read case) or the cross-compiler is to
  4. % be saved intact with symbols (write case).
  5. lisp procedure ASMEnd;
  6. << off SysLisp;
  7. if !*MainFound then
  8. << CompileUncompiledExpressions();
  9. % WriteInitFile();
  10. InitializeSymbolTable() >>
  11. else WriteSymFile();
  12. CodeFileTrailer();
  13. Close CodeOut!*;
  14. DataFileTrailer();
  15. Close DataOut!*;
  16. Close InitOut!*;
  17. RemD 'Lap;
  18. PutD('Lap, 'EXPR, cdr GetD 'OldLap);
  19. DFPRINT!* := NIL;
  20. !*DEFN := NIL;
  21. WriteSaveFile()
  22. >>;
  23. lisp procedure ReadSymFile();
  24. if !*symread then
  25. LapIN InputSymFile!*
  26. else off usermode;
  27. lisp procedure WriteSymFile();
  28. begin scalar NewOut, OldOut;
  29. if !*symwrite then <<
  30. OldOut := WRS(NewOut := Open(OutputSymFile!*, 'OUTPUT));
  31. print list('SaveForCompilation,
  32. MkQuote('progn . car ToBeCompiledExpressions!*));
  33. SaveIDList();
  34. SetqPrint 'NextIDNumber!*;
  35. SetqPrint 'StringGenSym!*;
  36. MapObl function PutPrintEntryAndSym;
  37. WRS OldOut;
  38. Close NewOut; >>;
  39. end;
  40. lisp procedure WriteSaveFile();
  41. if !*symsave and (null !*mainfound) then
  42. % restore some initial conditions
  43. <<!*usermode := nil;
  44. DataExporteds!* := DataExternals!* := nil;
  45. CodeExporteds!* := CodeExternals!* := nil;
  46. !*MainFound:= nil;
  47. % save the cross-compiler with symbol tables intact
  48. dumplisp(cross!-compiler!-name)
  49. >>;
  50. !*symwrite := !*symread := nil;
  51. !*symsave := T;