conditional compilation?

Q&A's, tips, howto's
Post Reply
mark5009
Posts: 6
Joined: Sat Oct 25, 2014 6:33 am

conditional compilation?

Post by mark5009 »

Hi.

Running under OSX/Unix, I like to first test my code with a #! , then compile them with a -x for use. So,

Code: Select all

$ cat foo.lsp
#! /usr/bin/env newlisp
(println "args -> " (main-args))
(exit)
$ ./foo.lsp bob
args -> ("newlisp" "./foo.lsp" "bob")
$ newlisp -x foo.lsp foo
$ ./foo bob
args -> ("./foo" "bob")
If I want that first arg, it has gone from position 2 to position 1 in the args.

My question is the obvious one: is there a way I can get around this behavior? Use a condition compile flag? Or is there a better solution than editing the file each time I want to compile it?

Thanks in advance .. mark

Post Reply