# It is example of minimalistic IDE
# (Integrated Development Environment)
# for newlisp and, may be, not only :-)
#
# You can choose Your own app-file and
# Your own editor and define Your own
# (compile-run) function.
#
# After You save app-file in editor
# (hit Crtl-s in "notepad" for example),
# function (compile-run) compile
# and run Your application app-file. :-)
#
(set 'app-file "test.lsp")
(set 'editor "notepad")
(define (compile-run) (! (append "start newlisp " app-file)))
(println "Press Ctrl-Break to stop IDE")
(! (append "start " editor " " app-file))
(set 'filetime (nth 6 (file-info app-file)))
(while true
(set 'newfiletime (nth 6 (file-info app-file)))
(if (> newfiletime filetime) (compile-run))
(set 'filetime newfiletime)
(sleep 1000)
)
(exit)
It may be useful for small projects (IMHO) :-)
Excuse me for my bad English, please.
@goto RUNLISP
# It is example of minimalistic IDE
# (Integrated Development Environment)
#
# Because of some difficults in Windows2k-XP,
# the script is writen with NewLisp orientation only :-(
#
# You MUST use Your app-file as parameter to the script
# (and can use Windows drag-and-drop technology for this)
# Your can try define Your own editor (not without problems, may be)
#
# When You will change text of app-file in editor ("notepad")
# and save it (hit Crtl-s in "notepad"),
# function (compile-run) compile and run Your application.
#
# Finishing IDE = closing of editor
#
# Example for CMD.EXE:
# mini-IDE.cmd test.lsp
#
# Tested in WindowsXP and Windows2000
# (for console applications - work good!)
#
# by Alex version 2006.03.07
#
# PS. Examle of simplest "test.lsp"
# (println "TEST.LSP")
# (sleep 5000)
# (exit)
(set 'app-file (last (main-args)))
(set 'editor "@start /w notepad")
(define (compile-run) (! (append "start newlisp " app-file)))
(define (time-mark) (eval (append '(format "%04d%02d%02d%02d%02d%02d%06d") (slice (now) 0 7 ))))
(setq tempfile0 (append (env "TEMP") "\" "miniIDE_" (time-mark)))
(device (open tempfile0 "w"))
(println "")
(close (device))
(setq tempfile1 (append tempfile0 ".cmd"))
(device (open tempfile1 "w"))
(println editor " " app-file "n" "@del "" tempfile0 """)
(close (device))
###(process (append """ tempfile1 """) 0 0 0) # works in WinXP only
(process (append "cmd /C " """ tempfile1 """) 0 0 0) # works good in WinXP and Win2k
(set 'filetime (nth 6 (file-info app-file)))
(while (file? tempfile0)
(set 'newfiletime (nth 6 (file-info app-file)))
(if (> newfiletime filetime) (compile-run))
(set 'filetime newfiletime)
(sleep 1000)
)
(delete-file tempfile1)
(exit)
:RUNLISP
@if "%newlisp%" == "" set newlisp=newlisp.exe
@%newlisp% %0 %*
@exit
I feel, that it is not good example for process interaction...
Can You help me avoid writting to (env "TEMP") directory?
Hi Alex,
I like the trick you do here ;-) Though im unable to get the compile working after the Ctrl-S is pressed on XP...
Norman.
Hi, newdep,
I like the trick too. It is not my own trick.
I saw the trick five-six years ago in bash (Linux, of course) and wrote own realisation of it, but "translation" to Windows is not very easy ;)
Windows has own tricks in running scripts and programs :(
Hi, newdep once more!
It must work.
Are You sure, that newlisp.exe in current direcriry?