summaryrefslogtreecommitdiff
path: root/libguile
diff options
context:
space:
mode:
authorMichael Livshin <mlivshin@bigfoot.com>2001-05-28 14:18:35 +0000
committerMichael Livshin <mlivshin@bigfoot.com>2001-05-28 14:18:35 +0000
commitfde504077bf4f73e3f9983de6ae8599d3fbb8895 (patch)
tree61f5da144f8c1ae4b7262afadc4c94792f41eaf8 /libguile
parentdd85ce4758260f712d0efc806df6643aca8e3b74 (diff)
downloadguile-fde504077bf4f73e3f9983de6ae8599d3fbb8895.tar.gz
* 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.
Diffstat (limited to 'libguile')
-rw-r--r--libguile/ChangeLog7
-rw-r--r--libguile/gc.c4
-rw-r--r--libguile/hooks.c42
-rw-r--r--libguile/hooks.h5
4 files changed, 31 insertions, 27 deletions
diff --git a/libguile/ChangeLog b/libguile/ChangeLog
index f0fdd1572..4c719f2ec 100644
--- a/libguile/ChangeLog
+++ b/libguile/ChangeLog
@@ -1,5 +1,12 @@
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.
* socket.c (s_scm_inet_pton): fix docstring quoting.
diff --git a/libguile/gc.c b/libguile/gc.c
index 0a0f92288..48f688b93 100644
--- a/libguile/gc.c
+++ b/libguile/gc.c
@@ -2840,8 +2840,8 @@ scm_init_gc ()
{
SCM after_gc_thunk;
- /* Dirk:FIXME:: scm_create_hook is strange. */
- scm_after_gc_hook = scm_create_hook ("after-gc-hook", 0);
+ scm_after_gc_hook = scm_permanent_object (scm_make_hook (SCM_INUM0));
+ scm_c_define ("after-gc-hook", scm_after_gc_hook);
after_gc_thunk = scm_c_make_subr ("%gc-thunk", scm_tc7_subr_0,
gc_async_thunk);
diff --git a/libguile/hooks.c b/libguile/hooks.c
index 166394818..737e92353 100644
--- a/libguile/hooks.c
+++ b/libguile/hooks.c
@@ -150,26 +150,6 @@ scm_c_hook_run (scm_c_hook_t *hook, void *data)
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
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;
}
+#if (SCM_DEBUG_DEPRECATED == 0)
SCM
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_gc_protect_object (hook); /* cmm:FIXME:: qua? */
- return hook;
+ return scm_permanent_object (hook);
}
+#endif
SCM_DEFINE (scm_make_hook, "make-hook", 0, 1, 0,
(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.")
#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
diff --git a/libguile/hooks.h b/libguile/hooks.h
index 216d63062..ff9d9d5d4 100644
--- a/libguile/hooks.h
+++ b/libguile/hooks.h
@@ -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))
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_empty_p (SCM hook);
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 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 */
/*