summaryrefslogtreecommitdiff
path: root/libguile/ephemerons.h
blob: 9f1fb8eb53a956a5f7d1862e8d7a42590247b5e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
#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 gc_ephemeron* scm_to_ephemeron (SCM e);
SCM_INTERNAL SCM scm_from_ephemeron (struct gc_ephemeron *e);

SCM_INTERNAL struct gc_ephemeron* scm_c_ephemeron_load (struct gc_ephemeron **loc);
SCM_INTERNAL void scm_c_ephemeron_push (struct gc_ephemeron **loc,
                                        struct gc_ephemeron *e);

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 struct scm_ephemeron_table*
scm_c_ephemeron_table_copy (struct scm_ephemeron_table *et);
SCM_INTERNAL int scm_i_print_ephemeron_table (SCM exp, SCM port,
                                              scm_print_state *pstate SCM_UNUSED);
SCM_INTERNAL struct scm_ephemeron_table* scm_to_ephemeron_table (SCM e);
SCM_INTERNAL SCM scm_from_ephemeron_table (struct scm_ephemeron_table *e);

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 void scm_register_ephemerons (void);

#endif  /* SCM_EPHEMERONS_H */