conditional compilation?

Q&A's, tips, howto's

conditional compilation?

Postby mark5009 » Fri Mar 03, 2017 4:35 am

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
mark5009
 
Posts: 6
Joined: Sat Oct 25, 2014 6:33 am

Return to newLISP in the real world

Who is online

Users browsing this forum: No registered users and 2 guests

cron