[4. update] Removed some stupid patch ideas.
[3. update]
Solution for 10.5.4: viewtopic.php?f=16&t=4416#p21792
Solution for later versions: viewtopic.php?f=16&t=4416#p21794
'[HowTo]' added to title.
[2. update] Changed title away from feature request: some discussion revealed a very good solution (see posts thereafter); and the patches are not a good idea compared with it.
[update] Better patch - IMHO - in self-reply to this post.
Doing more and more scripting with newLISP, it's important to me to have interactive debugging facilities.
Furthermore it's good to have some separation between CLI args targeted to the interpreter and others targeted to a script interpreted by it.
Assumed there is the following code:
Code: Select all
#!/usr/bin/newlisp
(module "getopts.lsp")
(shortopt "p" (println "players: " getopts:arg) "int" "num of players")
(shortopt "h" (println (getopts:usage)) nil "usage")
(getopts (2 (main-args)))
;; some code here: if something goes wrong, or just for interactive development
;; no (exit) could be a good idea here...
(exit)
Code: Select all
sr@free:~/NewLisp$ ./game.lsp -p 10
players: 10
sr@free:~/NewLisp$
But if something goes wrong, or we just want to inspect some symbols before (exit), commenting out (exit) does not work:
Code: Select all
#!/usr/bin/newlisp
(module "getopts.lsp")
(shortopt "p" (println "players: " getopts:arg) "int" "num of players")
(shortopt "h" (println (getopts:usage)) nil "usage")
(getopts (2 (main-args)))
;; some code here: if something goes wrong, or just for interactive development
;; no (exit) could be a good idea here...
;(exit)
Code: Select all
sr@free:~/NewLisp$ ./game.lsp -p 10
players: 10
newLISP server setup on 10 failed.
sr@free:~/NewLisp$
[4. update]: Removed some stupid patch ideas.
What do you think?