compile.lsp

Started by jsmall, October 15, 2004, 09:07:23 AM

Previous topic - Next topic

jsmall


;; usage:  newlisp compile.lsp executable source.lsp

;; Note: requires link.lsp in the same directory.

;; To compile.lsp rename this file to cnl.lsp
;; and copy and paste "link.lsp" inline replacing
;; (load "link.lsp") below with this inline copy.
;; Now you can compile cnl.lsp with:
;;
;;   newlisp compile.lsp cnl[.exe] cnl.lsp
;;
;; You can then use cnl like this:
;;
;;   cnl executable source


(load "link.lsp")


(set 'os (& 0x0F (last (sys-info))))

(if (find os '(5 6))
    (set 'newlisp "newlisp.exe")
    (set 'newlisp "newlisp"))

(set 'argv (main-args))

(if (starts-with (first argv) "newlisp")
    (set 'offset 1)
    (set 'offset 0))

(if (< (length argv) (+ 3 offset))
    (begin
      (println)
      (print "Usage: " (first argv))
      (if (> offset 0)
          (print " compile.lsp"))
      (println " executable source.lsp")
      (exit)))  

(set 'executable-file (nth (+ 1 offset) argv))
(set 'source-file (nth (+ 2 offset) argv))

(link newlisp executable-file source-file)

(exit)