1 #ifndef SCM_ALIST_H
2 #define SCM_ALIST_H
3 
4 /* Copyright 1995-1996,2000,2006,2008,2018
5      Free Software Foundation, Inc.
6 
7    This file is part of Guile.
8 
9    Guile is free software: you can redistribute it and/or modify it
10    under the terms of the GNU Lesser General Public License as published
11    by the Free Software Foundation, either version 3 of the License, or
12    (at your option) any later version.
13 
14    Guile is distributed in the hope that it will be useful, but WITHOUT
15    ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16    FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser General Public
17    License for more details.
18 
19    You should have received a copy of the GNU Lesser General Public
20    License along with Guile.  If not, see
21    <https://www.gnu.org/licenses/>.  */
22 
23 
24 
25 #include <libguile/error.h>
26 #include "libguile/pairs.h"
27 
28 
29 
30 
31 #define SCM_VALIDATE_ALISTCELL(pos, alist) \
32   do { \
33     SCM_ASSERT (scm_is_pair (alist) && scm_is_pair (SCM_CAR (alist)), \
34                 alist, pos, FUNC_NAME); \
35   } while (0)
36 
37 #define SCM_VALIDATE_ALISTCELL_COPYSCM(pos, alist, cvar) \
38   do { \
39     SCM_ASSERT (scm_is_pair (alist), alist, pos, FUNC_NAME); \
40     cvar = SCM_CAR (alist); \
41     SCM_ASSERT (scm_is_pair (cvar), alist, pos, FUNC_NAME); \
42   } while (0)
43 
44 
45 
46 
47 SCM_API SCM scm_acons (SCM w, SCM x, SCM y);
48 SCM_API SCM scm_sloppy_assq (SCM x, SCM alist);
49 SCM_API SCM scm_sloppy_assv (SCM x, SCM alist);
50 SCM_API SCM scm_sloppy_assoc (SCM x, SCM alist);
51 SCM_API SCM scm_assq (SCM x, SCM alist);
52 SCM_API SCM scm_assv (SCM x, SCM alist);
53 SCM_API SCM scm_assoc (SCM x, SCM alist);
54 SCM_API SCM scm_assq_ref (SCM alist, SCM key);
55 SCM_API SCM scm_assv_ref (SCM alist, SCM key);
56 SCM_API SCM scm_assoc_ref (SCM alist, SCM key);
57 SCM_API SCM scm_assq_set_x (SCM alist, SCM key, SCM val);
58 SCM_API SCM scm_assv_set_x (SCM alist, SCM key, SCM val);
59 SCM_API SCM scm_assoc_set_x (SCM alist, SCM key, SCM val);
60 SCM_API SCM scm_assq_remove_x (SCM alist, SCM key);
61 SCM_API SCM scm_assv_remove_x (SCM alist, SCM key);
62 SCM_API SCM scm_assoc_remove_x (SCM alist, SCM key);
63 SCM_INTERNAL void scm_init_alist (void);
64 
65 #endif  /* SCM_ALIST_H */
66