diff options
Diffstat (limited to 'doc/ref/scheme-utility.texi')
-rw-r--r-- | doc/ref/scheme-utility.texi | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/doc/ref/scheme-utility.texi b/doc/ref/scheme-utility.texi index f544ac0da..b82497ebb 100644 --- a/doc/ref/scheme-utility.texi +++ b/doc/ref/scheme-utility.texi @@ -490,6 +490,10 @@ The ordering of the list of procedures returned by @code{hook->list} matches the order in which those procedures would be called if the hook was run using @code{run-hook}. +Note that the C functions in the following entries are for handling +@dfn{Scheme-level} hooks in C. There are also @dfn{C-level} hooks which +have their own interface (@pxref{C Hooks}). + @deffn {Scheme Procedure} make-hook [n_args] @deffnx {C Function} scm_make_hook (n_args) Create a hook for storing procedure of arity @var{n_args}. @@ -551,6 +555,27 @@ that @var{hook} is actually a hook object and that @var{args} is a well-formed list matching the arity of the hook. @end deftypefn +For C code, @code{SCM_HOOKP} is a faster alternative to +@code{scm_hook_p}: + +@deftypefn {C Macro} int SCM_HOOKP (x) +Return 1 if @var{x} is a Scheme-level hook, 0 otherwise. +@end deftypefn + + +@subsection Handling Scheme-level hooks from C code + +Here is an example of how to handle Scheme-level hooks from C code using +the above functions. + +@example +if (SCM_NFALSEP (scm_hook_p (obj))) + /* handle Scheme-level hook using C functions */ + scm_reset_hook_x (obj); +else + /* do something else (obj is not a hook) */ +@end example + @node C Hooks @subsection Hooks For C Code. |