[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gEDA: gnetlist ERROR: Stack overflow



On Sun, 6 Jan 2002, Steve Tell wrote:

> On Sun, 6 Jan 2002, Dave Lawrence wrote:
> 
> > my problem goes away.  Can we set the guile stack limit from the backend files
> > instead of recompiling guile??
> 
> perhaps try:
> 	 (eval-options (list 'stack 200000))
> 
> This form is also mentioned in the manual, but doesn't seem to work:
> 	(eval-set! 'stack 200000)

I tried to resolve the error at it's root. I hacked the pads backend, but
other backends crashing have probably the same problem.

The backends Ales mentioned had in thing in common; they utilized
gnetlist:wrap, a function written by me to make make sure lines in the
output are not longer than a certain number. Removing the call to
gnetlist:wrap didn't help though. To make the long lines to be wrapped
there is a function called pads:display-connections. That one is calling
string-append recursivly on a very long list. No wonder stack space ran
out...

I took the freedom to rewrite that function to non-recursive. It first
changes the list of connections to a list of strings describing each
connection (map). Then it goes through the list and appends all partial
strings to one giant string (for-each). Before returning the long list it
adds on a newline.

(define (pads:display-connections nets)
  (let ((k ""))
    (for-each (lambda (in-string)
                (set! k (string-append k in-string)))
              (map (lambda (net)
                     (string-append " " (car net) "." (car (cdr net))))
                   nets))
    (string-append k "\n")))

Hope it works better, it does for me at least...

Regards,
/spe
/----------------------------------\
! Stefan Petersen, MSc EE         !  \    
! http://www.stacken.kth.se/~spe/ !    \_________________________
! spe@stacken.kth.se              !    /  ! umop apisdn 'sdoo !
! stefan.petersen@home.se         !  /    ---------------------
\----------------------------------/