rlispcomp.sl 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  2. %
  3. % RLISPCOMP.SL
  4. %
  5. % Author: Alan Snyder
  6. % Hewlett-Packard/CRC
  7. % Date: 27 September 1982
  8. %
  9. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  10. % This program reads and interprets
  11. % the program command string as a list of source files to be compiled.
  12. (CompileTime (load common pathnames))
  13. (load pathnamex parse-command-string get-command-string compiler)
  14. %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  15. (fluid '(*usermode *redefmsg CurrentReadMacroIndicator* CurrentScanTable*))
  16. (fluid '(*quiet_faslout *WritingFASLFile))
  17. (de rlispcomp ()
  18. (let ((c-list (parse-command-string (get-command-string)))
  19. (*usermode nil)
  20. (*redefmsg nil))
  21. (compile-files c-list)
  22. )
  23. )
  24. (de compile-files (c-list)
  25. (cond ((null c-list)
  26. (PrintF "RLisp Compiler%n")
  27. (PrintF "Usage: RLISPCOMP source-file ...%n")
  28. )
  29. (t
  30. (for (in fn c-list)
  31. (do (attempt-to-compile-file fn))
  32. )
  33. (quit)
  34. )))
  35. (de attempt-to-compile-file (fn)
  36. (let* ((form (list 'COMPILE-FILE fn))
  37. (*break NIL)
  38. (result (ErrorSet form T NIL))
  39. )
  40. (cond ((FixP result)
  41. (if *WritingFASLFile (faslend))
  42. (printf "%n ***** Error during compilation of %w.%n" fn)
  43. ))
  44. ))
  45. (de compile-file (fn)
  46. (let ((source-fn (namestring (pathname-set-default-type fn "RED")))
  47. (binary-fn (namestring (pathname-set-type fn "B")))
  48. (*quiet_faslout T)
  49. )
  50. (if (not (FileP source-fn))
  51. (printf "Unable to open source file: %w%n" source-fn)
  52. % else
  53. (printf "%n----- Compiling %w%n" source-fn binary-fn)
  54. (faslout (namestring (pathname-without-type binary-fn)))
  55. (eval (list 'in source-fn)) % Damn FEXPRs
  56. (faslend)
  57. (printf "%nDone compiling %w%n%n" source-fn)
  58. )))