Code: Select all
;; (load "test.lsp")
#
; pressing key1 returns true, key2 returns nil, all other keys ignored
(define (torf key1 key2)
(setq keypress2 "")
(while (and (!= keypress2 key1) (!= keypress2 key2))
(setq keypress2 (upper-case (char (read-key)))))
(= keypress2 key1) )
#
; dummy compile/link code for testing
(define (linkme)
(setq compile true
exename "test")
(println "\ncompile/link code runs here")
nil) ; return no errors
#
; mainline program edited for testing
(define (doit)
(println "do main program here")
(sleep 5000) ; pause for effect
(println "then exit")
(fake-exit) )
#
; entry point for this test
(define (run)
(if (not compiled)
(begin
(print "\n \"C\"ompile or \"R\"un ? " )
(if (torf "C" "R")
(begin
(if (not (linkme))
(println (string "\n Compile of " exename " was successful. "))
(println (string "\n Compile of " exename " failed! ")))
(print " \"E\"xit or \"T\"est ? ")
(if (torf "T" "E")
(doit)
(print "\nfinished")))
(doit)))
(doit))
true
)
true
;eof
Code: Select all
newLISP v.10.7.1 64-bit on Linux IPv4/6 UTF-8 libffi, options: newlisp -h
> (load "test.lsp")
true
> (run)
"C"ompile or "R"un ? [i]; entered "c" for compile[/i]
compile/link code runs here
Compile of test was successful.
"E"xit or "T"est ?
finished
Code: Select all
root@bsd1:/home/bob # newlisp
newLISP v.10.6.2 64-bit on BSD IPv4/6 UTF-8 libffi, options: newlisp -h
> (load "test.lsp")
true
> (run)
;[i] the program stops at this point waiting on input with no prompt.
; enter an "c" to exit as if the prompt was there and it
; flushes the print buffer and continues.[/i]
"C"ompile or "R"un ?
compile/link code runs here
[i]; and stops again waiting on input with no prompt.
; enter an "e" to exit as if the prompt was there again
; flushes the print buffer and we continue to the exit.[/i]
Compile of test was successful.
"E"xit or "T"est ?
finished
>