compile.lsp

Notices and updates
Locked
jsmall
Posts: 26
Joined: Mon Sep 20, 2004 1:44 am

compile.lsp

Post by jsmall »

Code: Select all

;; 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)

Locked