development release newLISP v.9.9.94

Notices and updates
Locked
Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

development release newLISP v.9.9.94

Post 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

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post 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.
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

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

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post 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.
Hans-Peter

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

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

HPW
Posts: 1390
Joined: Thu Sep 26, 2002 9:15 am
Location: Germany
Contact:

Post 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!
Hans-Peter

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

Post by newdep »

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

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

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

Lutz
Posts: 5289
Joined: Thu Sep 26, 2002 4:45 pm
Location: Pasadena, California
Contact:

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

cormullion
Posts: 2038
Joined: Tue Nov 29, 2005 8:28 pm
Location: latiitude 50N longitude 3W
Contact:

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

newdep
Posts: 2038
Joined: Mon Feb 23, 2004 7:40 pm
Location: Netherlands

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

Locked