mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-06 07:30:28 +02:00
Prepare structs for new finalization API
* libguile/struct.h: * libguile/struct.c (scm_i_finalize_struct): New helper. (struct_finalizer_trampoline): Implement as shim.
This commit is contained in:
parent
5e97645b81
commit
9774b3e551
2 changed files with 10 additions and 4 deletions
|
@ -310,16 +310,21 @@ SCM_DEFINE (scm_struct_vtable_p, "struct-vtable?", 1, 0, 0,
|
||||||
|
|
||||||
|
|
||||||
/* Finalization: invoke the finalizer of the struct pointed to by PTR. */
|
/* Finalization: invoke the finalizer of the struct pointed to by PTR. */
|
||||||
static void
|
void
|
||||||
struct_finalizer_trampoline (void *ptr, void *unused_data)
|
scm_i_finalize_struct (struct scm_thread *thread, SCM obj)
|
||||||
{
|
{
|
||||||
SCM obj = PTR2SCM (ptr);
|
|
||||||
scm_t_struct_finalize finalize = SCM_STRUCT_FINALIZER (obj);
|
scm_t_struct_finalize finalize = SCM_STRUCT_FINALIZER (obj);
|
||||||
|
|
||||||
if (finalize)
|
if (finalize)
|
||||||
finalize (obj);
|
finalize (obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
struct_finalizer_trampoline (void *ptr, void *data)
|
||||||
|
{
|
||||||
|
scm_i_finalize_struct (SCM_I_CURRENT_THREAD, PTR2SCM (ptr));
|
||||||
|
}
|
||||||
|
|
||||||
/* A struct is a sequence of words preceded by a pointer to the struct's
|
/* A struct is a sequence of words preceded by a pointer to the struct's
|
||||||
vtable. The vtable reference is tagged with the struct tc3. */
|
vtable. The vtable reference is tagged with the struct tc3. */
|
||||||
static SCM
|
static SCM
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef SCM_STRUCT_H
|
#ifndef SCM_STRUCT_H
|
||||||
#define SCM_STRUCT_H
|
#define SCM_STRUCT_H
|
||||||
|
|
||||||
/* Copyright 1995,1997,1999-2001,2006-2013,2015,2017-2018
|
/* Copyright 1995,1997,1999-2001,2006-2013,2015,2017-2018,2025
|
||||||
Free Software Foundation, Inc.
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This file is part of Guile.
|
This file is part of Guile.
|
||||||
|
@ -188,6 +188,7 @@ SCM_API void scm_print_struct (SCM exp, SCM port, scm_print_state *);
|
||||||
SCM_INTERNAL SCM scm_i_struct_equalp (SCM s1, SCM s2);
|
SCM_INTERNAL SCM scm_i_struct_equalp (SCM s1, SCM s2);
|
||||||
SCM_INTERNAL unsigned long scm_struct_ihashq (SCM, unsigned long, void *);
|
SCM_INTERNAL unsigned long scm_struct_ihashq (SCM, unsigned long, void *);
|
||||||
SCM_INTERNAL void scm_i_struct_inherit_vtable_magic (SCM vtable, SCM obj);
|
SCM_INTERNAL void scm_i_struct_inherit_vtable_magic (SCM vtable, SCM obj);
|
||||||
|
SCM_INTERNAL void scm_i_finalize_struct (struct scm_thread *thread, SCM obj);
|
||||||
SCM_INTERNAL void scm_init_struct (void);
|
SCM_INTERNAL void scm_init_struct (void);
|
||||||
|
|
||||||
#endif /* SCM_STRUCT_H */
|
#endif /* SCM_STRUCT_H */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue