The question is interesting for me too.
I read Lutz answer, but it is not enough for Windows-OS.
If I have no installed JavaVM(it can be a lot of reason), how I can run newlisp-edit.lsp?
If You have answer, tell, please :-)
This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Show posts Menu
@newlisp.exe %0 %* & goto :EOF
# begin newlisp-program
(println "Hello World!")
(exit)
# end newlisp-program
:-)
@newlisp.exe "%~f0" %* & goto :EOF
Quote
upx.exe -oNL.exe newlisp.exe
> (set 'test ".?")
".?"
> (regex test "abcde")
("a" 0 1)
> (set 'test "?")
"?"
> (regex test "abcde")
regular expression in function regex : "offset 0 nothing to repeat:"
>
;; _test.lsp
(println (main-args))
(exit)
;; lsp2exe.lsp
(load "link.lsp")
(link "newlisp.exe" "_test.exe" "_test.lsp")
(exit)
S:tempnewlispbin>newlisp lsp2exe.lsp
S:tempnewlispbin>newlisp _test.lsp 1 2 3 4 5
("newlisp" "_test.lsp" "1" "2" "3" "4" "5")
S:tempnewlispbin>_test.exe 1 2 3 4 5
("_test.exe" "1" "2" "3" "4" "5")
S:tempnewlispbin>
Microsoft Windows XP [Версия 5.1.2600]
(С) Корпорация Майкрософт, 1985-2001.
c:newlisp>newlisp
newLISP v.8.7.10 on Win32 MinGW, execute 'newlisp -h' for more info.
> (replace "(.{1})" (dup "0" 500) "1" 0)
"1111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
11111111111111111111111111111111111111111111111111111111111111111111111111111111
111111111111111111111"
> (replace "(.{1})" (dup "0" 500000000) "1" 0)
c:newlisp>
;; Transform integer to special string format(see example)
;;
;; syntax: (pretty-int num)
;; syntax: (pretty-int num delimiter)
;;
;; Example:
;; (pretty-int 20482048) -> "20 482 048"
;; (pretty-int 1234567890 "'") -> "1'234'567'890"
;;
(define (pretty-int num delimiter)
(unless delimiter (setq delimiter " "))
(trim (reverse (replace {(d{3})} (reverse (string num)) (append $1 delimiter) 0)) delimiter)
)
Can anybody propose more simple or useful variant?
#It is the simplest example of object program:
(println
[text]
I have (You must choose object!):
1.cat
2.dog
3.mother
4.wife
5.girl-friend
[/text]
)
(read-line)
(println
[text]
Ha-Haaaaaaaaaaaa
You are winner!
You can kiss Your object!!!!!
(as addon, may be)
Press any key to continue...
[/text]
)
(read-line)
(exit)
# 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)
E:dictenrufull>7za l enrufull.dic.dos.7z
7-Zip (A) 4.20 Copyright (c) 1999-2005 Igor Pavlov 2005-05-30
Listing archive: enrufull.dic.dos.7z
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------
2006-02-15 19:15:18 ....A 37193160 10484024 enrufull.dic.dos
------------------- ----- ------------ ------------ ------------
37193160 10484024 1 files
(setq my-dict (exec "7za e -so E:\dict\enrufull\enrufull.dic.dos.7z"))
(read-line) # "pause"
Quote
G:>newlisp
newLISP v.8.7.2 on Win32 MinGW, execute 'newlisp -h' for more info.
> (setq zzz:aaa 1)
1
> (context? zzz)
true
> (exit)
G:>newlisp
newLISP v.8.7.2 on Win32 MinGW, execute 'newlisp -h' for more info.
> (context? zzz)
nil
> (setq zzz:aaa 1)
context expected in function setq : zzz
>