Subject: Tail recursion From: Daniel Shane <daniel@xxxxxxxx> Date: Thu, 27 Jul 2000 22:26:05 -0400 |
Hello, I wanted to let all of you know that we (iNsu Innovations) have made some small modifications to the scheme code which handles the docbook area tag. This modification does not add any new features but greatly improves the speed of the algorithm by at least a factor of 100 if not more. Unfortunately, we have a also a big problem. Everything seems to work find with small to medium sized areas but with a big area, openjade will segfault awfully. This arrises because it seems that one of our functions is not considered tail recursive and we eventualy run out of stack space. Now, I am no scheme expert but I have posted my scheme function and if anyone could colaborate the fact that this function is tail recursive then we have found a bug in openjades autodetection of tail recurisve functions. The frame that doesnt get popped is the call to append-sosofo. After 5062 calls to that function, we bomb out of stack space. (define ($callout-linespecific-content$ indent line-numbers?) ;; Print linespecific content in a callout with line numbers (let ( (callouts-table ($build-callouts-table$))) (make sequence ($line-start$ indent line-numbers? 1) (let loop ((kl (children (current-node))) (co-table callouts-table) (linecount 1) (colcount 1) (res (empty-sosofo))) (if (node-list-empty? kl) res (let* ((c (node-list-first kl)) (eol? (char=? (node-property 'char c default: #\U-0000) #\U-000D)) (line-assoc (if (null? co-table) #f (car co-table)))) (loop (debug (node-list-rest kl)) (if eol? (if (and line-assoc (equal? linecount (car line-assoc))) (if (null? co-table) '() (cdr co-table)) co-table) co-table) (if eol? (+ linecount 1) linecount) (if eol? 1 (if (char=? (node-property 'char c default: #\U-0000) #\U-0000) colcount (+ colcount 1))) (if eol? (if (and line-assoc (equal? linecount (car line-assoc))) (sosofo-append res ($look-for-callout$ (cdr line-assoc) colcount #t) (debug (process-node-list c)) ($line-start$ indent line-numbers? (+ linecount 1))) (sosofo-append res (process-node-list c) ($line-start$ indent line-numbers? (+ linecount 1)))) (if (and line-assoc (equal? linecount (car line-assoc))) (sosofo-append res ($look-for-callout$ (cdr line-assoc) colcount) (process-node-list c)) (sosofo-append res (process-node-list c))))))))))) Any help would be greatly appreciated Daniel Shane -- daniel@xxxxxxxx GNU/Linux developper iNsu Innovations inc. DSSSList info and archive: http://www.mulberrytech.com/dsssl/dssslist
Current Thread |
---|
|
<- Previous | Index | Next -> |
---|---|---|
FOCR: meta-DTD does not allow data , Yasushi Shoji | Thread | Re: Tail recursion, Brandon Ibach |
FOCR: meta-DTD does not allow data , Yasushi Shoji | Date | XT and ServletDestination vs Output, Noll, Jeff HS |
Month |