1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-02 15:40:38 +02:00

Deprecate C hooks

* libguile/chooks.c:
* libguile/chooks.h: Remove.
* libguile/deprecated.h:
* libguile/deprecated.c: Add deprecated implementations.
* libguile/gc.c:
* libguile/gc.h: Arrange to call before/after C hooks if deprecated code
is enabled.
* libguile/Makefile.am:
* libguile.h: Remove chooks.[ch] references.
This commit is contained in:
Andy Wingo 2025-06-25 09:49:58 +02:00
parent 08296e6022
commit a6b848dcba
8 changed files with 148 additions and 204 deletions

View file

@ -130,6 +130,49 @@ SCM_DEPRECATED void scm_i_simple_vector_set_x (SCM v, size_t k, SCM val);
#define SCM_SIMPLE_VECTOR_REF(x,idx) (scm_i_simple_vector_ref (x, idx))
#define SCM_SIMPLE_VECTOR_SET(x,idx,val) (scm_i_simple_vector_set_x (x, idx, val))
typedef enum scm_t_c_hook_type {
SCM_C_HOOK_NORMAL,
SCM_C_HOOK_OR,
SCM_C_HOOK_AND
} scm_t_c_hook_type;
typedef void *(*scm_t_c_hook_function) (void *hook_data, void *fn_data,
void *data);
typedef struct scm_t_c_hook_entry {
struct scm_t_c_hook_entry *next;
scm_t_c_hook_function func;
void *data;
} scm_t_c_hook_entry;
typedef struct scm_t_c_hook {
scm_t_c_hook_entry *first;
scm_t_c_hook_type type;
void *data;
} scm_t_c_hook;
SCM_DEPRECATED void scm_c_hook_init (scm_t_c_hook *hook,
void *hook_data,
scm_t_c_hook_type type);
SCM_DEPRECATED void scm_c_hook_add (scm_t_c_hook *hook,
scm_t_c_hook_function func,
void *fn_data,
int appendp);
SCM_DEPRECATED void scm_c_hook_remove (scm_t_c_hook *hook,
scm_t_c_hook_function func,
void *fn_data);
SCM_DEPRECATED void *scm_c_hook_run (scm_t_c_hook *hook, void *data);
SCM_INTERNAL void *scm_i_c_hook_run (scm_t_c_hook *hook, void *data);
/* Mark a couple of these as SCM_API so that they can be invoked
internally without triggering deprecation warnings at
compile-time. */
SCM_API scm_t_c_hook scm_before_gc_c_hook;
SCM_DEPRECATED scm_t_c_hook scm_before_mark_c_hook;
SCM_DEPRECATED scm_t_c_hook scm_before_sweep_c_hook;
SCM_DEPRECATED scm_t_c_hook scm_after_sweep_c_hook;
SCM_API scm_t_c_hook scm_after_gc_c_hook;
/* Deprecated declarations go here. */
void scm_i_init_deprecated (void);