development release newLISP v.9.9.94

Started by Lutz, November 13, 2008, 01:19:37 PM

Previous topic - Next topic

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">http://www.newlisp.org/downloads/development

HPW

#1
Quotecommand 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.
Hans-Peter

Lutz

#2
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.

HPW

#3
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.
Hans-Peter

Lutz

#4
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.

HPW

#5
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!
Hans-Peter

newdep

#6
Yes this is the best solution... That way you can run infinite different init.lsp too.. good idea !
-- (define? (Cornflakes))

cormullion

#7
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...

Lutz

#8
On Mac OS X that works well, running the following program:


#!/usr/bin/env newlisp -s 100000 a b c

(println (sys-info))
(println (main-args))

(exit)


from the shell command line gives me:


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:


#!/usr/local/bin/newlisp -s 100000 a b c

(println (sys-info))
(println (main-args))

(exit)


gives output:


[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.

cormullion

#9
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.

newdep

#10
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
-- (define? (Cornflakes))