lisp2exe.lsp

Machine-specific discussion
Unix, Linux, OS X, OS/2, Windows, ..?
Locked
Cyril
Posts: 183
Joined: Tue Oct 30, 2007 6:27 pm
Location: Moscow, Russia
Contact:

lisp2exe.lsp

Post by Cyril »

I have hack this up back in November when writing my first end-user application in newlisp, and now I am convinced in its usefulness. Get link.lsp from util subdirectory, add the following lines to the end of file after ';; eof' comment, and save it as lisp2exe.lsp somewhere in the PATH.

Code: Select all

;; eof

(unless (and (member (length (main-args)) '(3 4))
             (ends-with (main-args 0) "newlisp.exe" nil)
             (ends-with (main-args 1) "lisp2exe.lsp" nil)
             (ends-with (main-args 2) ".lsp" nil))
  (begin (println "Usage: lisp2exe file.lsp [file.exe]") (exit)))

(map set '(interpreter script lispfile exefile) (main-args))

(unless exefile
  (setq exefile (replace {\.lsp$} (begin lispfile) ".exe" 1)))

(link interpreter exefile lispfile)

(exit)
Oh, just forgot: you must make the .lsp extension executable (unless you already have this done).
With newLISP you can grow your lists from the right side!

Locked