development release newLISP v.10.0.3

Started by Lutz, March 25, 2009, 04:16:22 AM

Previous topic - Next topic

newdep

#15
Haaa slick!  yeah I did not know that 'module existed..



Actualy.. How do I catch an (exit) from a module or load?



If a library cant be found then i.e. crypto exists, but the Main program too,

and thats not what i want..



I tried renaming 'exit with a constant but its not realy charming..



any idea?
-- (define? (Cornflakes))

Lutz

#16

(if-not (catch (module "odbc.lsp") 'err) (println "Could not load: " err))
Could not load: ERR: problem loading library in function import : "dlopen(odbc32.dll, 9): image not found"


but this works only on older modules, newer modules should be rewritten to throw a user error with 'throw-error', which then can be handled from the top call.



In crypto.lsp instead of:


(set 'library (files (or
    (find true (map file? files))
    (begin (println "cannot find crypto library") (exit)))))


change to:


(set 'library (files (or
    (find true (map file? files))
    (throw-error "cannot find crypto library"))))


then it will work with a 'module' call like shown above.

newdep

#17
Yes that is correct for local files,

but I like more the remote loading aproche, where Im not the maintainer...



(load "http://www.newlisp.org/code/modules/crypto.lsp">http://www.newlisp.org/code/modules/crypto.lsp")



This is what I use now in the main script



(constant (global 'quit) exit)

(constant (global 'exit) nil)



This still throws the error from (exit) but at least the main script continue's running..Still not very reliable because it can be overruled.. but it works..



Now I only need a way to Catch the output of the module when it

cant find the library's... (silent (catch  doesnt seems to do the trick...
-- (define? (Cornflakes))

newdep

#18
actualy the only proper way currently is to pre-check the

library existence in the main-script.



using a 'exit rewrite isnt a good solution because the update.lsp

script is also embeded. (and i need to rewrite the (exit) inside the

script also to a throw ;-)



but still it would be nice to catch an external (exit) somehow

without modification of the original script & suppress messages

from a loaded newlisp script/module. (I cant get Catch to fully do it)
-- (define? (Cornflakes))

Cyril

#19
Quote from: "newdep"Haaa slick!  yeah I did not know that 'module existed..


Me too! Searching for more surprises...


newLISP v.10.0.3 on Win32 IPv4, execute 'newlisp -h' for more info.

> (filter (fn (x) (lambda? (eval x))) (symbols))
(module)


No luck! ;-)
With newLISP you can grow your lists from the right side!