This is the mail archive of the guile@cygnus.com mailing list for the guile project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Eric Buddington wrote: > I'm still trying to pound guile into my code, with various frustrations. > > At the moment, I have guile successfully starting up in an isolated > thread, and evaluating strings passed to it by other threads. I'm having > two straightforward (I hope) problems: Been there, done that. > 1) Passing garbage input to gh_eval_str() causes guile to spit out an > error and *exit*, thus taking down my entire server. This is not desirable > behavior. What is the proper way to trap/display such errors and avoid > termination? wrap some scheme code around the scheme code that does actual work,like this, roughly (_danger_ untested code): (define (do-real-work) ;; blah ) (define (do-work) "this one get called from C++" (catch #t ;; catches all exceptions (lambda () (do-real-work)) (lambda (tag . args) (for-each display `("caught error with tag " ,tag " and args " args "\n") #f) #t) Then C++ can test whether there was an error by looking at the return value from do-work. > 2) Is there a nice (i.e., already coded by you wonderful people :)) way > to get a string (char*) representation for an arbitrary SCM, or do I have > to test to see what type of data it is and do the conversions myself? I'd > hate to duplicate effort. (with-output-to-string (lambda () (write the-object-you-want-as-string))) > Sorry if either of these is documented; I looked in guile-doc but didn't > find anything. I'm convinced that Guile desperately needs a FAQ. -russ