/[guile]/guile/guile-core/doc/ref/scheme-control.texi
ViewVC logotype

Diff of /guile/guile-core/doc/ref/scheme-control.texi

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.13 by kryde, Fri Aug 29 23:22:30 2003 UTC revision 1.14 by kryde, Fri Aug 29 23:49:49 2003 UTC
# Line 662  the handler procedure itself throws an e Line 662  the handler procedure itself throws an e
662  only be caught by another active catch higher up the call stack, if  only be caught by another active catch higher up the call stack, if
663  there is one.  there is one.
664    
665    @sp 1
666    @deftypefn {C Function} SCM scm_internal_catch (SCM tag, scm_t_catch_body body, void *body_data, scm_t_catch_handler handler, void *handler_data)
667    The above @code{scm_catch} takes Scheme procedures as body and handler
668    arguments.  @code{scm_internal_catch} is an equivalent taking C
669    functions.
670    
671    @var{body} is called as @code{@var{body} (@var{body_data})} with a
672    catch on exceptions of the given @var{tag} type.  If an exception is
673    caught, @var{handler} is called @code{@var{handler}
674    (@var{handler_data}, @var{key}, @var{args})}.  @var{key} and
675    @var{args} are the @code{SCM} key and argument list from the
676    @code{throw}.
677    
678    @tpindex scm_t_catch_body
679    @tpindex scm_t_catch_handler
680    @var{body} and @var{handler} should have the following prototypes.
681    @code{scm_t_catch_body} and @code{scm_t_catch_handler} are pointer
682    typedefs for these.
683    
684    @example
685    SCM body (void *data);
686    SCM handler (void *data, SCM key, SCM args);
687    @end example
688    
689    The @var{body_data} and @var{handler_data} parameters are passed to
690    the respective calls so an application can communicate extra
691    information to those functions.
692    
693    If the data consists of an @code{SCM} object, care should be taken
694    that it isn't garbage collected while still required.  If the
695    @code{SCM} is a local C variable, one way to protect it is to pass a
696    pointer to that variable as the data parameter, since the C compiler
697    will then know the value must be held on the stack.  Another way is to
698    use @code{scm_remember_upto_here_1} (@pxref{Remembering During
699    Operations}).
700    @end deftypefn
701    
702    
703  @node Throw  @node Throw
704  @subsection Throwing Exceptions  @subsection Throwing Exceptions
# Line 745  The @var{handler} procedure is not allow Line 782  The @var{handler} procedure is not allow
782  it must throw to another catch, or otherwise exit non-locally.  it must throw to another catch, or otherwise exit non-locally.
783  @end deffn  @end deffn
784    
785    @deftypefn {C Function} SCM scm_internal_lazy_catch (SCM tag, scm_t_catch_body body, void *body_data, scm_t_catch_handler handler, void *handler_data)
786    The above @code{scm_lazy_catch} takes Scheme procedures as body and
787    handler arguments.  @code{scm_internal_lazy_catch} is an equivalent
788    taking C functions.  See @code{scm_internal_catch} (@pxref{Catch}) for
789    a description of the parameters, the behaviour however of course
790    follows @code{lazy-catch}.
791    @end deftypefn
792    
793  Typically, @var{handler} should save any desired state associated with  Typically, @var{handler} should save any desired state associated with
794  the stack at the point where the corresponding @code{throw} occurred,  the stack at the point where the corresponding @code{throw} occurred,
795  and then throw an exception itself --- usually the same exception as the  and then throw an exception itself --- usually the same exception as the

Legend:
Removed from v.1.13  
changed lines
  Added in v.1.14

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26