mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-09 05:30:21 +02:00
* libguile/ephemerons.h: * libguile/ephemerons.c (scm_c_make_ephemeron): (scm_c_ephemeron_key): (scm_c_ephemeron_value): (scm_c_ephemeron_mark_dead_x): (scm_c_ephemeron_swap_x): (scm_c_ephemeron_next): Add C ephemeron API. (scm_make_ephemeron, scm_ephemeron_key, scm_ephemeron_value) (scm_ephemeron_mark_dead_x): Dispatch to helpers above. (scm_ephemeron_swap_x, scm_ephemeron_mark_dead_x): New Scheme-exposed functions. (scm_c_make_ephemeron_table): (scm_c_ephemeron_table_length): (scm_c_ephemeron_table_ref): (scm_c_ephemeron_table_push_x): (scm_c_ephemeron_table_try_push_x): New C API for tables of ephemerons. (scm_ephemeron_table_length): (scm_ephemeron_table_ref): (scm_ephemeron_table_push_x): (scm_ephemeron_table_try_push_x): New Scheme-exposed API. (scm_c_ephemeron_hash_table_refq): (scm_c_ephemeron_hash_table_setq_x): (scm_c_ephemeron_hash_table_copy): New C API for use by internal weak table users (dynamic states, etc). * module/ice-9/ephemerons.scm: Add new Scheme API. * libguile/evalext.c (scm_self_evaluating_p): * libguile/goops.c (scm_class_of, %goops-early-init): * libguile/print.c (iprin1): * module/oop/goops.scm: * libguile/scm.h (scm_tc7_ephemeron_table): Add new tc7 for ephemeron tables. * test-suite/tests/ephemerons.test ("ephemeron tables"): Add tests.
66 lines
2.7 KiB
C
66 lines
2.7 KiB
C
#ifndef SCM_EPHEMERONS_H
|
||
#define SCM_EPHEMERONS_H
|
||
|
||
/* Copyright 2025 Free Software Foundation, Inc.
|
||
|
||
This file is part of Guile.
|
||
|
||
Guile is free software: you can redistribute it and/or modify it
|
||
under the terms of the GNU Lesser General Public License as published
|
||
by the Free Software Foundation, either version 3 of the License, or
|
||
(at your option) any later version.
|
||
|
||
Guile is distributed in the hope that it will be useful, but WITHOUT
|
||
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
||
License for more details.
|
||
|
||
You should have received a copy of the GNU Lesser General Public
|
||
License along with Guile. If not, see
|
||
<https://www.gnu.org/licenses/>. */
|
||
|
||
|
||
|
||
#include "libguile/scm.h"
|
||
|
||
|
||
|
||
struct gc_ephemeron;
|
||
struct scm_ephemeron_table;
|
||
|
||
SCM_INTERNAL struct gc_ephemeron* scm_c_make_ephemeron (SCM k, SCM v);
|
||
SCM_INTERNAL SCM scm_c_ephemeron_key (struct gc_ephemeron *e);
|
||
SCM_INTERNAL SCM scm_c_ephemeron_value (struct gc_ephemeron *e);
|
||
SCM_INTERNAL struct gc_ephemeron* scm_c_ephemeron_next (struct gc_ephemeron *e);
|
||
SCM_INTERNAL SCM scm_c_ephemeron_swap_x (struct gc_ephemeron *e, SCM new_val);
|
||
SCM_INTERNAL void scm_c_ephemeron_mark_dead_x (struct gc_ephemeron *e);
|
||
SCM_INTERNAL int scm_i_print_ephemeron (SCM exp, SCM port,
|
||
scm_print_state *pstate SCM_UNUSED);
|
||
|
||
SCM_INTERNAL struct scm_ephemeron_table* scm_c_make_ephemeron_table (size_t count);
|
||
SCM_INTERNAL size_t scm_c_ephemeron_table_length (struct scm_ephemeron_table *et);
|
||
SCM_INTERNAL struct gc_ephemeron*
|
||
scm_c_ephemeron_table_ref (struct scm_ephemeron_table *et, size_t idx);
|
||
SCM_INTERNAL void scm_c_ephemeron_table_push_x (struct scm_ephemeron_table *et,
|
||
size_t idx,
|
||
struct gc_ephemeron * e);
|
||
SCM_INTERNAL struct gc_ephemeron*
|
||
scm_c_ephemeron_table_try_push_x (struct scm_ephemeron_table *et,
|
||
size_t idx,
|
||
struct gc_ephemeron * e,
|
||
struct gc_ephemeron *prev);
|
||
SCM_INTERNAL int scm_i_print_ephemeron_table (SCM exp, SCM port,
|
||
scm_print_state *pstate SCM_UNUSED);
|
||
|
||
SCM_INTERNAL SCM
|
||
scm_c_ephemeron_hash_table_refq (struct scm_ephemeron_table *et, SCM k,
|
||
SCM default_value);
|
||
SCM_INTERNAL void
|
||
scm_c_ephemeron_hash_table_setq_x (struct scm_ephemeron_table *et, SCM k, SCM v);
|
||
SCM_INTERNAL struct scm_ephemeron_table*
|
||
scm_c_ephemeron_hash_table_copy (struct scm_ephemeron_table *et);
|
||
|
||
|
||
SCM_INTERNAL void scm_register_ephemerons (void);
|
||
|
||
#endif /* SCM_EPHEMERONS_H */
|