490 |
matches the order in which those procedures would be called if the hook |
matches the order in which those procedures would be called if the hook |
491 |
was run using @code{run-hook}. |
was run using @code{run-hook}. |
492 |
|
|
493 |
|
Note that the C functions in the following entries are for handling |
494 |
|
@dfn{Scheme-level} hooks in C. There are also @dfn{C-level} hooks which |
495 |
|
have their own interface (@pxref{C Hooks}). |
496 |
|
|
497 |
@deffn {Scheme Procedure} make-hook [n_args] |
@deffn {Scheme Procedure} make-hook [n_args] |
498 |
@deffnx {C Function} scm_make_hook (n_args) |
@deffnx {C Function} scm_make_hook (n_args) |
499 |
Create a hook for storing procedure of arity @var{n_args}. |
Create a hook for storing procedure of arity @var{n_args}. |
555 |
well-formed list matching the arity of the hook. |
well-formed list matching the arity of the hook. |
556 |
@end deftypefn |
@end deftypefn |
557 |
|
|
558 |
|
For C code, @code{SCM_HOOKP} is a faster alternative to |
559 |
|
@code{scm_hook_p}: |
560 |
|
|
561 |
|
@deftypefn {C Macro} int SCM_HOOKP (x) |
562 |
|
Return 1 if @var{x} is a Scheme-level hook, 0 otherwise. |
563 |
|
@end deftypefn |
564 |
|
|
565 |
|
|
566 |
|
@subsection Handling Scheme-level hooks from C code |
567 |
|
|
568 |
|
Here is an example of how to handle Scheme-level hooks from C code using |
569 |
|
the above functions. |
570 |
|
|
571 |
|
@example |
572 |
|
if (SCM_NFALSEP (scm_hook_p (obj))) |
573 |
|
/* handle Scheme-level hook using C functions */ |
574 |
|
scm_reset_hook_x (obj); |
575 |
|
else |
576 |
|
/* do something else (obj is not a hook) */ |
577 |
|
@end example |
578 |
|
|
579 |
|
|
580 |
@node C Hooks |
@node C Hooks |
581 |
@subsection Hooks For C Code. |
@subsection Hooks For C Code. |