Re: Pico, EOF Overrun
Hi Jon, > right now, but if you try this ... > > (ifwarnfile "lib/form.l") Yes, it hangs. I traced 'read' and 'ifwarn' and found the reason to be line 1267: (mapc 'set> G ((: put) D I) '(T .)) ) '(T .) is a circular list, and 'mapcar' will loop infinitely. BTW, 'mapcar' builds a list which is not used, so 'mapc' might be more appropriate. > And thanks a lot for mentioning the 'who' function. I'll try it. 'who' by itself is not so very useful. I mostly call it like : (more (who 'something) pp) to pretty-print the functions one by one. Cheers, Alex -- Software Lab. Alexander Burger Bahnhofstr. 24a, D-86462 Langweid [EMAIL PROTECTED], www.software-lab.de, +49 8230 5060
Re: Pico, EOF Overrun
Hi Alex, > behaviour ;-), so I probably should use something else than 'str' for this. ... > (de ifwarnfile (Path) (in Path (ifwarn (str (till NIL T ) How about, for example, (in Path (while (read) (ifwarn @) ) ) Cheers, Alex Yes, I've now modified 'ifwarnfile' to use this 'while (read)', and it works very well. There is one case, however, where it seems to get stuck, as did my 'str'-version. I don't have time to investigate it right now, but if you try this ... (ifwarnfile "lib/form.l") .. then you'll probably notice. And thanks a lot for mentioning the 'who' function. I'll try it. /Jon
Re: Pico, EOF Overrun
Hi Jon, > I used 'str' when reading .l files to check my own and your use of > '(if x y)' vs. '(when x y)' BTW, there is a function 'who' which does similar things. (not documented yet) You can call it as : (who 'if) -> list of all functions calling 'if' or with a pattern : (who '(if . @Prg)) -> the same as above or with pattern plus expression : (who '(if @Cond . @Prg) (= 4 (length @Prg))) -> functions calling 'if' with 5 arguments Cheers, Alex -- Software Lab. Alexander Burger Bahnhofstr. 24a, D-86462 Langweid [EMAIL PROTECTED], www.software-lab.de, +49 8230 5060
Re: Pico, EOF Overrun
Hi Jon, > behaviour ;-), so I probably should use something else than 'str' for > this. > ... > (de ifwarnfile (Path) > (in Path (ifwarn (str (till NIL T ) How about, for example, (in Path (while (read) (ifwarn @) ) ) Cheers, Alex -- Software Lab. Alexander Burger Bahnhofstr. 24a, D-86462 Langweid [EMAIL PROTECTED], www.software-lab.de, +49 8230 5060
Re: Pico, EOF Overrun
Hi Alex, Hi Jon, > That was a quick fix! Thanks. Yes, because you triggered it finally :-) A few days ago, Henrik also stubled across this bug, and something had to be done about it. Having a '#' in an argument to 'str' is something not really intended. 'str' parses formally valid Lisp expression, and it is probably not a good idea to use it to parse arbitrary data (as Henrik tried with HTML text). It employs the full machinery of the reader, and this can have unexpected side effects. For example, read-macro characters like backquote, tilde or comma will cause the evaluation of following expressions. Cheers, Alex I used 'str' when reading .l files to check my own and your use of '(if x y)' vs. '(when x y)', but I did experience some strange behaviour ;-), so I probably should use something else than 'str' for this. Here's my little checker: # Checking a function/structure already in memory (de ifwarn (Prg) (when (lst? Prg) (when (and (= (car Prg) 'if) (<> (length Prg) 4)) (println Prg) ) (mapcar ifwarn Prg) NIL) ) # Checking a file (.l or other) (de ifwarnfile (Path) (in Path (ifwarn (str (till NIL T ) # Checking all .l files in a directory (de ifwarndir (Path) (if (=T (car (info Path))) (chdir Path (prinl (pwd)) (for F (dir) (ifwarndir F) ) ) (when (tail '(. l) (chop Path)) (prinl Path) (ifwarnfile Path) ) ) ) /Jon
Re: Pico, EOF Overrun
Hi Jon, > That was a quick fix! Thanks. Yes, because you triggered it finally :-) A few days ago, Henrik also stubled across this bug, and something had to be done about it. Having a '#' in an argument to 'str' is something not really intended. 'str' parses formally valid Lisp expression, and it is probably not a good idea to use it to parse arbitrary data (as Henrik tried with HTML text). It employs the full machinery of the reader, and this can have unexpected side effects. For example, read-macro characters like backquote, tilde or comma will cause the evaluation of following expressions. Cheers, Alex -- Software Lab. Alexander Burger Bahnhofstr. 24a, D-86462 Langweid [EMAIL PROTECTED], www.software-lab.de, +49 8230 5060
Re: Pico, EOF Overrun
Hi Alex, That was a quick fix! Thanks. /Jon On Wed, Apr 09, 2008 at 12:38:06PM +0200, Jon Kleiser wrote: I've stumbled across this: If I try to run (str "#"), then I get "EOF Overrun". My questions then are 1) What does it mean? Sorry, this is a known bug ;-) 'str' parses all tokens in the given string, and builds a list. If the comment character is encountered, it tries to skip to the next end-of-line character, but unfortunately there is none. The "EOF Overrun" error is issued then, as the partially constructed list cannot be closed. 2) Is it possible to catch this as an exception? In general, picoLisp does not catch errors under program control (only with the build-in error handler). Though there is the '*Rst' mechanism, which allows in principle to restart a program depending on an error message, it is not useful in this context. However, I fixed this bug now. (str "#") returns NIL, and (str "a b # c") returns (a b). The fix is avaiable in the testing release. Cheers, Alex -- Software Lab. Alexander Burger Bahnhofstr. 24a, D-86462 Langweid [EMAIL PROTECTED], www.software-lab.de, +49 8230 5060
Re: Pico, EOF Overrun
On Wed, Apr 09, 2008 at 12:38:06PM +0200, Jon Kleiser wrote: > I've stumbled across this: If I try to run (str "#"), then I get "EOF > Overrun". My questions then are > > 1) What does it mean? Sorry, this is a known bug ;-) 'str' parses all tokens in the given string, and builds a list. If the comment character is encountered, it tries to skip to the next end-of-line character, but unfortunately there is none. The "EOF Overrun" error is issued then, as the partially constructed list cannot be closed. > 2) Is it possible to catch this as an exception? In general, picoLisp does not catch errors under program control (only with the build-in error handler). Though there is the '*Rst' mechanism, which allows in principle to restart a program depending on an error message, it is not useful in this context. However, I fixed this bug now. (str "#") returns NIL, and (str "a b # c") returns (a b). The fix is avaiable in the testing release. Cheers, Alex -- Software Lab. Alexander Burger Bahnhofstr. 24a, D-86462 Langweid [EMAIL PROTECTED], www.software-lab.de, +49 8230 5060
Pico, EOF Overrun
Hi, I've stumbled across this: If I try to run (str "#"), then I get "EOF Overrun". My questions then are 1) What does it mean? 2) Is it possible to catch this as an exception? /Jon