Manual and release notes for upcoming 10.2.0

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

Re: Manual and release notes for upcoming 10.2.0

Post by Lutz »

Thanks to Kosh and Sammo (in a different thread) for the latest manual corrections, online since yesterday:

http://www.newlisp.org/downloads/newlisp_manual.html

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

Re: Manual and release notes for upcoming 10.2.0

Post by cormullion »

What could be the cause of this error?

Code: Select all

ERR: call or result stack overflow : args<3670>
called from user defined function br
called from user defined function h4
called from user defined function body
called from user defined function html
Is it that the list is too deeply nested, or that the list is too long?

sys-info reports this at the beginning:

(78309 268435456 501 8 0 2048 0 56523 10110 131)

and this just before the overflow:

(86380 268435456 501 8 0 2048 0 56523 10110 131)

but I can't see where a 'call stack' would be exceeded...?

Setting a value with the -s switch doesn't appear to change these figures:

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

Re: Manual and release notes for upcoming 10.2.0

Post by Lutz »

Currently on a trip with internet on a phone only. Will look into it on Friday.

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

Re: Manual and release notes for upcoming 10.2.0

Post by Lutz »

I assume you have the body tag defined as a 'begin' operation. The 'begin' function is limited to 4096 expressions, but you could use either 'lambda/fn' or 'dolist' to evaluate longer lists of expressions:

Code: Select all

(apply (append (fn ()) long-list-of-expressions))

; or

(dolist (ex long-list-of-expressions)
    (eval x))

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

Re: Manual and release notes for upcoming 10.2.0

Post by cormullion »

Hi Lutz - thanks for the idea. But I think the problem may be elsewhere. Sorry about my code, it's not the best, but I'm just hacking to see if this is a valid path for a project.... Can't see where I've gone wrong. (And sorry about the wrong thread, too...:)

This code expects the manual to be in XHTML format...

Code: Select all

(set 'f (read-file {/usr/share/doc/newlisp/newlisp_manual.html}))
(xml-type-tags nil nil nil)
(set 'xf (xml-parse f 31))

(set-ref-all 'div xf '_div)
(set-ref-all 'name xf '_name)
(set-ref-all '@ xf '_@)

(define (_@) 
    (dolist (ex (args))
        (eval ex)))

(dolist (tag '(html a align alink b bgcolor blockquote 
body border br cellpadding center class color 
content em font h1 h2 h3 h4 head hr href 
http-equiv i id li link media meta ol p 
pre size span style summary table td text 
th title tr tt type u ul valign vlink 
width xmlns _div _name))
    (letex 
       ((f-name (sym (string tag))))
       (define (f-name) (string  "{"  (join (args) "\n")  "}"))))

(println (eval xf))

ERR: call or result stack overflow : dolist<E5E3>
called from user defined function _@
called from user defined function span
called from user defined function pre
called from user defined function body
called from user defined function html


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

Re: Manual and release notes for upcoming 10.2.0

Post by Lutz »

Put 'println' statements at the beginning of both 'dolist' loops (tag and _@) and see what is going on. This will show you the path of execution and the reason for the overflow message. Note that only callstack depth is reflected in 'sys-info' and only before the error occurs. The error itself will cause a stack cleanup. The result stack cannot be traced with 'sys-info'.

The other possibility would be:

Code: Select all

(debug (eval xf))
to see what is happening.

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

Re: Manual and release notes for upcoming 10.2.0

Post by cormullion »

Thanks, Lutz. Which is the call stack depth - (sys-info 4) (= "Environment stack level")? This is nearly always 0, and occasionally 1.

It says this just before the call or result stack overflow

(86755 268435456 449 10 0 2048 0 60948 10201 131)

I've gone through with the debugger - just can't work out what I should be looking for. The code is simple, but fails after about 21000 function calls.

Locked