Page 1 of 1
development release newLISP v.9.9.94
Posted: Thu Nov 13, 2008 9:19 pm
by Lutz
• command line switch -n to suppress init file loading
• a bug fix for self referential keys in replace
files and changes notes:
http://www.newlisp.org/downloads/development
Posted: Fri Nov 14, 2008 7:09 am
by HPW
command line switch -n to suppress init file loading
How about a similar solution for the DLL?
Remove the init-code from OnLoadLibrary and export a separate command InitNewLISP.
InitNewLISP would execute the same code as LoadLibrary did before.
Posted: Fri Nov 14, 2008 11:08 am
by Lutz
Just define NEWLISPLIB_INIT with an empty file, that will suppress initloading for the DLL completely. Then use newlispEvalStr to do a (load "myinit.lsp") from the parent for whatever you have to load.
Posted: Fri Nov 14, 2008 3:31 pm
by HPW
I was aware of this option, because you gave this advice prior to this thread.
But it is not the same as the -n switch.
The -n switch user has not to provide a global enviroment variable and an empty file.
For the EXE the workaround with an empty file would also work, but is not needed now because of the -n switch.
Posted: Fri Nov 14, 2008 11:37 pm
by Lutz
Perhaps the normal routine of looking for .init.lsp or init.lsp should be completely excluded for newisp.dll. Instead you have to define NEWLISPLIB_INIT if you want a system wide initialization for newlisp.dll.
So by default nothing is loaded from newlisp.dll
Perhaps this is the best solution, because it permits several applications using newlisp.dll to live together on the same machine. So if NEWLISPLIB_INIT is defined it would do only system-wide stuff.
Posted: Sat Nov 15, 2008 6:30 am
by HPW
I agree that it would be a good solution, which makes sense.
Your argument about sharing the DLL is the real big point to do so.
So you have my vote!
Posted: Sun Nov 16, 2008 8:49 am
by newdep
Yes this is the best solution... That way you can run infinite different init.lsp too.. good idea !
Posted: Sun Nov 16, 2008 9:20 am
by cormullion
Lutz - as a related (MacOSX) question, do you know if it's possible to supply command-line arguments in the first line of a newLISP file when it's running from an editor such as TextWrangler or BBEdit? My attempts to make it recognize any haven't been successful so far...
Also, I prefer to use #!/usr/bin/env newlisp to run newLISP files - because newLISP isn't always in the system /usr/bin location - I can't use command-line arguments there either...
Posted: Sun Nov 16, 2008 4:12 pm
by Lutz
On Mac OS X that works well, running the following program:
Code: Select all
#!/usr/bin/env newlisp -s 100000 a b c
(println (sys-info))
(println (main-args))
(exit)
from the shell command line gives me:
Code: Select all
Users/lutz> ./test
(412 268435456 371 2 0 100000 566 9994 131)
("newlisp" "-s" "100000" "a" "b" "c" "./test")
/Users/lutz>
both the stack size and main-args are set.
On FreeBSD (i.e. neearlyfreespeech.net) this will not with env, but the following works:
Code: Select all
#!/usr/local/bin/newlisp -s 100000 a b c
(println (sys-info))
(println (main-args))
(exit)
gives output:
Code: Select all
[me@newlisp /home/public]$ ./test
(372 268435456 358 2 0 100000 9300 2)
("/usr/local/bin/newlisp" "-s 100000 a b c" "./test")
[me@newlisp /home/public]$
But note, that main-args has all this: "-s 100000 a b c" as one argument, while in Mac OS X they where correctly separated. So it all depends on the plaform you are running on.
Posted: Sun Nov 16, 2008 7:18 pm
by cormullion
OK, great! - I can do this in a script. It's only TextWrangler/BBEdit that don't allow command-line arguments in the shebang line... No problem.
Posted: Mon Nov 17, 2008 2:08 pm
by newdep
perhpas a strange way of doing things...
But is this legal ? -->
-> (set 'a:b "c")
"c"
-> (set 'd (copy a:b))
"c"
-> d
"c"
I know.. why use copy ;-) but i just wanted to know if 'copy equals 'set