mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 04:10:18 +02:00
* hooks.c (scm_create_hook): deprecated.
(make_hook): deleted. (scm_make_hook): all the hook creation code is now here. * gc.c (scm_init_gc): don't call `scm_create_hook'. instead make a hook, make it permanent, and do a `scm_c_define' on it.
This commit is contained in:
parent
dd85ce4758
commit
fde504077b
4 changed files with 31 additions and 27 deletions
|
@ -1,5 +1,12 @@
|
||||||
2001-05-28 Michael Livshin <mlivshin@bigfoot.com>
|
2001-05-28 Michael Livshin <mlivshin@bigfoot.com>
|
||||||
|
|
||||||
|
* hooks.c (scm_create_hook): deprecated.
|
||||||
|
(make_hook): deleted.
|
||||||
|
(scm_make_hook): all the hook creation code is now here.
|
||||||
|
|
||||||
|
* gc.c (scm_init_gc): don't call `scm_create_hook'. instead make
|
||||||
|
a hook, make it permanent, and do a `scm_c_define' on it.
|
||||||
|
|
||||||
* strop.c (s_scm_string_capitalize_x): fix docstring quoting.
|
* strop.c (s_scm_string_capitalize_x): fix docstring quoting.
|
||||||
|
|
||||||
* socket.c (s_scm_inet_pton): fix docstring quoting.
|
* socket.c (s_scm_inet_pton): fix docstring quoting.
|
||||||
|
|
|
@ -2840,8 +2840,8 @@ scm_init_gc ()
|
||||||
{
|
{
|
||||||
SCM after_gc_thunk;
|
SCM after_gc_thunk;
|
||||||
|
|
||||||
/* Dirk:FIXME:: scm_create_hook is strange. */
|
scm_after_gc_hook = scm_permanent_object (scm_make_hook (SCM_INUM0));
|
||||||
scm_after_gc_hook = scm_create_hook ("after-gc-hook", 0);
|
scm_c_define ("after-gc-hook", scm_after_gc_hook);
|
||||||
|
|
||||||
after_gc_thunk = scm_c_make_subr ("%gc-thunk", scm_tc7_subr_0,
|
after_gc_thunk = scm_c_make_subr ("%gc-thunk", scm_tc7_subr_0,
|
||||||
gc_async_thunk);
|
gc_async_thunk);
|
||||||
|
|
|
@ -150,26 +150,6 @@ scm_c_hook_run (scm_c_hook_t *hook, void *data)
|
||||||
scm_bits_t scm_tc16_hook;
|
scm_bits_t scm_tc16_hook;
|
||||||
|
|
||||||
|
|
||||||
static SCM
|
|
||||||
make_hook (SCM n_args, const char *subr)
|
|
||||||
{
|
|
||||||
int n;
|
|
||||||
|
|
||||||
if (SCM_UNBNDP (n_args))
|
|
||||||
{
|
|
||||||
n = 0;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
SCM_ASSERT (SCM_INUMP (n_args), n_args, SCM_ARGn, subr);
|
|
||||||
n = SCM_INUM (n_args);
|
|
||||||
if (n < 0 || n > 16)
|
|
||||||
scm_out_of_range (subr, n_args);
|
|
||||||
}
|
|
||||||
SCM_RETURN_NEWSMOB (scm_tc16_hook + (n << 16), SCM_UNPACK (SCM_EOL));
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static int
|
static int
|
||||||
hook_print (SCM hook, SCM port, scm_print_state *pstate)
|
hook_print (SCM hook, SCM port, scm_print_state *pstate)
|
||||||
{
|
{
|
||||||
|
@ -193,16 +173,17 @@ hook_print (SCM hook, SCM port, scm_print_state *pstate)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if (SCM_DEBUG_DEPRECATED == 0)
|
||||||
|
|
||||||
SCM
|
SCM
|
||||||
scm_create_hook (const char *name, int n_args)
|
scm_create_hook (const char *name, int n_args)
|
||||||
{
|
{
|
||||||
SCM hook = make_hook (SCM_MAKINUM (n_args), "scm_create_hook");
|
SCM hook = scm_make_hook (SCM_MAKINUM (n_args));
|
||||||
scm_c_define (name, hook);
|
scm_c_define (name, hook);
|
||||||
scm_gc_protect_object (hook); /* cmm:FIXME:: qua? */
|
return scm_permanent_object (hook);
|
||||||
return hook;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
SCM_DEFINE (scm_make_hook, "make-hook", 0, 1, 0,
|
SCM_DEFINE (scm_make_hook, "make-hook", 0, 1, 0,
|
||||||
(SCM n_args),
|
(SCM n_args),
|
||||||
|
@ -210,7 +191,20 @@ SCM_DEFINE (scm_make_hook, "make-hook", 0, 1, 0,
|
||||||
"@var{n_args}. @var{n_args} defaults to zero.")
|
"@var{n_args}. @var{n_args} defaults to zero.")
|
||||||
#define FUNC_NAME s_scm_make_hook
|
#define FUNC_NAME s_scm_make_hook
|
||||||
{
|
{
|
||||||
return make_hook (n_args, FUNC_NAME);
|
int n;
|
||||||
|
|
||||||
|
if (SCM_UNBNDP (n_args))
|
||||||
|
{
|
||||||
|
n = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
SCM_VALIDATE_INUM_COPY (SCM_ARG1, n_args, n);
|
||||||
|
if (n < 0 || n > 16)
|
||||||
|
SCM_OUT_OF_RANGE (SCM_ARG1, n_args);
|
||||||
|
}
|
||||||
|
|
||||||
|
SCM_RETURN_NEWSMOB (scm_tc16_hook + (n << 16), SCM_UNPACK (SCM_EOL));
|
||||||
}
|
}
|
||||||
#undef FUNC_NAME
|
#undef FUNC_NAME
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,6 @@ extern scm_bits_t scm_tc16_hook;
|
||||||
#define SCM_SET_HOOK_PROCEDURES(hook, procs) SCM_SET_CELL_OBJECT_1 ((hook), (procs))
|
#define SCM_SET_HOOK_PROCEDURES(hook, procs) SCM_SET_CELL_OBJECT_1 ((hook), (procs))
|
||||||
|
|
||||||
extern SCM scm_make_hook (SCM n_args);
|
extern SCM scm_make_hook (SCM n_args);
|
||||||
extern SCM scm_create_hook (const char* name, int n_args);
|
|
||||||
extern SCM scm_hook_p (SCM x);
|
extern SCM scm_hook_p (SCM x);
|
||||||
extern SCM scm_hook_empty_p (SCM hook);
|
extern SCM scm_hook_empty_p (SCM hook);
|
||||||
extern SCM scm_add_hook_x (SCM hook, SCM thunk, SCM appendp);
|
extern SCM scm_add_hook_x (SCM hook, SCM thunk, SCM appendp);
|
||||||
|
@ -115,6 +114,10 @@ extern void scm_c_run_hook (SCM hook, SCM args);
|
||||||
extern SCM scm_hook_to_list (SCM hook);
|
extern SCM scm_hook_to_list (SCM hook);
|
||||||
extern void scm_init_hooks (void);
|
extern void scm_init_hooks (void);
|
||||||
|
|
||||||
|
#if (SCM_DEBUG_DEPRECATED == 0)
|
||||||
|
extern SCM scm_create_hook (const char* name, int n_args);
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* SCM_HOOKS_H */
|
#endif /* SCM_HOOKS_H */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue