SCM now has routines to make calling back to Scheme procedures easier. The source code for these routines are found in rope.c.
Loads the Scheme source file file. Returns 0 if successful, non-0 if not. This function is used to load SCM’s initialization file Init5f3.scm.
Loads the Scheme source file
file). Returns 0 if successful, non-0 if not.
This function is useful for compiled code init_ functions to load
non-compiled Scheme (source) files.
program-vicinity is the
directory from which the calling code was loaded
(see Vicinity in SLIB).
Returns the result of reading an expression from str and evaluating it.
Reads and evaluates all the expressions from str.
If you wish to catch errors during execution of Scheme code, then you can use a wrapper like this for your Scheme procedures:
(define (srv:protect proc) (lambda args (define result #f) ; put default value here (call-with-current-continuation (lambda (cont) (dynamic-wind (lambda () #t) (lambda () (set! result (apply proc args)) (set! cont #f)) (lambda () (if cont (cont #f)))))) result))
Calls to procedures so wrapped will return even if an error occurs.