Commit | Line | Data |
---|---|---|
0f2d19dd JB |
1 | /* classes: h_files */ |
2 | ||
e81d98ec DH |
3 | #ifndef SCM_PAIRS_H |
4 | #define SCM_PAIRS_H | |
0527e687 | 5 | |
e81d98ec | 6 | /* Copyright (C) 1995,1996,2000,2001 Free Software Foundation, Inc. |
0527e687 | 7 | * |
73be1d9e MV |
8 | * This library is free software; you can redistribute it and/or |
9 | * modify it under the terms of the GNU Lesser General Public | |
10 | * License as published by the Free Software Foundation; either | |
11 | * version 2.1 of the License, or (at your option) any later version. | |
0527e687 | 12 | * |
73be1d9e | 13 | * This library is distributed in the hope that it will be useful, |
0f2d19dd | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
73be1d9e MV |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
16 | * Lesser General Public License for more details. | |
0527e687 | 17 | * |
73be1d9e MV |
18 | * You should have received a copy of the GNU Lesser General Public |
19 | * License along with this library; if not, write to the Free Software | |
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
21 | */ | |
1bbd0b84 | 22 | |
0f2d19dd JB |
23 | \f |
24 | ||
b4309c3c | 25 | #include "libguile/__scm.h" |
0f2d19dd JB |
26 | |
27 | \f | |
28 | ||
e81d98ec | 29 | #if (SCM_DEBUG_PAIR_ACCESSES == 1) |
e81d98ec | 30 | # define SCM_VALIDATE_PAIR(cell, expr) \ |
6cf69537 | 31 | ((!SCM_CONSP (cell) ? scm_error_pair_access (cell), 0 : 0), (expr)) |
e81d98ec DH |
32 | #else |
33 | # define SCM_VALIDATE_PAIR(cell, expr) (expr) | |
34 | #endif | |
35 | ||
bc36d050 | 36 | #define SCM_NULLP(x) (scm_is_eq ((x), SCM_EOL)) |
dd039d6d | 37 | #define SCM_NNULLP(x) (!SCM_NULLP (x)) |
0f2d19dd | 38 | |
e81d98ec DH |
39 | #define SCM_CAR(x) (SCM_VALIDATE_PAIR (x, SCM_CELL_OBJECT_0 (x))) |
40 | #define SCM_CDR(x) (SCM_VALIDATE_PAIR (x, SCM_CELL_OBJECT_1 (x))) | |
76a369d9 | 41 | |
e81d98ec DH |
42 | #define SCM_SETCAR(x, v) (SCM_VALIDATE_PAIR (x, SCM_SET_CELL_OBJECT_0 ((x), (v)))) |
43 | #define SCM_SETCDR(x, v) (SCM_VALIDATE_PAIR (x, SCM_SET_CELL_OBJECT_1 ((x), (v)))) | |
24e68a57 | 44 | |
0f2d19dd JB |
45 | #define SCM_CAAR(OBJ) SCM_CAR (SCM_CAR (OBJ)) |
46 | #define SCM_CDAR(OBJ) SCM_CDR (SCM_CAR (OBJ)) | |
47 | #define SCM_CADR(OBJ) SCM_CAR (SCM_CDR (OBJ)) | |
48 | #define SCM_CDDR(OBJ) SCM_CDR (SCM_CDR (OBJ)) | |
49 | ||
50 | #define SCM_CAAAR(OBJ) SCM_CAR (SCM_CAR (SCM_CAR (OBJ))) | |
51 | #define SCM_CDAAR(OBJ) SCM_CDR (SCM_CAR (SCM_CAR (OBJ))) | |
52 | #define SCM_CADAR(OBJ) SCM_CAR (SCM_CDR (SCM_CAR (OBJ))) | |
53 | #define SCM_CDDAR(OBJ) SCM_CDR (SCM_CDR (SCM_CAR (OBJ))) | |
54 | #define SCM_CAADR(OBJ) SCM_CAR (SCM_CAR (SCM_CDR (OBJ))) | |
55 | #define SCM_CDADR(OBJ) SCM_CDR (SCM_CAR (SCM_CDR (OBJ))) | |
56 | #define SCM_CADDR(OBJ) SCM_CAR (SCM_CDR (SCM_CDR (OBJ))) | |
57 | #define SCM_CDDDR(OBJ) SCM_CDR (SCM_CDR (SCM_CDR (OBJ))) | |
58 | ||
59 | #define SCM_CAAAAR(OBJ) SCM_CAR (SCM_CAR (SCM_CAR (SCM_CAR (OBJ)))) | |
60 | #define SCM_CDAAAR(OBJ) SCM_CDR (SCM_CAR (SCM_CAR (SCM_CAR (OBJ)))) | |
61 | #define SCM_CADAAR(OBJ) SCM_CAR (SCM_CDR (SCM_CAR (SCM_CAR (OBJ)))) | |
62 | #define SCM_CDDAAR(OBJ) SCM_CDR (SCM_CDR (SCM_CAR (SCM_CAR (OBJ)))) | |
63 | #define SCM_CAADAR(OBJ) SCM_CAR (SCM_CAR (SCM_CDR (SCM_CAR (OBJ)))) | |
64 | #define SCM_CDADAR(OBJ) SCM_CDR (SCM_CAR (SCM_CDR (SCM_CAR (OBJ)))) | |
65 | #define SCM_CADDAR(OBJ) SCM_CAR (SCM_CDR (SCM_CDR (SCM_CAR (OBJ)))) | |
66 | #define SCM_CDDDAR(OBJ) SCM_CDR (SCM_CDR (SCM_CDR (SCM_CAR (OBJ)))) | |
67 | #define SCM_CAAADR(OBJ) SCM_CAR (SCM_CAR (SCM_CAR (SCM_CDR (OBJ)))) | |
68 | #define SCM_CDAADR(OBJ) SCM_CDR (SCM_CAR (SCM_CAR (SCM_CDR (OBJ)))) | |
69 | #define SCM_CADADR(OBJ) SCM_CAR (SCM_CDR (SCM_CAR (SCM_CDR (OBJ)))) | |
70 | #define SCM_CDDADR(OBJ) SCM_CDR (SCM_CDR (SCM_CAR (SCM_CDR (OBJ)))) | |
71 | #define SCM_CAADDR(OBJ) SCM_CAR (SCM_CAR (SCM_CDR (SCM_CDR (OBJ)))) | |
72 | #define SCM_CDADDR(OBJ) SCM_CDR (SCM_CAR (SCM_CDR (SCM_CDR (OBJ)))) | |
73 | #define SCM_CADDDR(OBJ) SCM_CAR (SCM_CDR (SCM_CDR (SCM_CDR (OBJ)))) | |
74 | #define SCM_CDDDDR(OBJ) SCM_CDR (SCM_CDR (SCM_CDR (SCM_CDR (OBJ)))) | |
75 | ||
0f2d19dd | 76 | \f |
1cc91f1b | 77 | |
e81d98ec | 78 | #if (SCM_DEBUG_PAIR_ACCESSES == 1) |
33b001fd | 79 | SCM_API void scm_error_pair_access (SCM); |
e81d98ec | 80 | #endif |
33b001fd MV |
81 | SCM_API SCM scm_cons (SCM x, SCM y); |
82 | SCM_API SCM scm_cons2 (SCM w, SCM x, SCM y); | |
83 | SCM_API SCM scm_pair_p (SCM x); | |
84 | SCM_API SCM scm_set_car_x (SCM pair, SCM value); | |
85 | SCM_API SCM scm_set_cdr_x (SCM pair, SCM value); | |
86 | SCM_API void scm_init_pairs (void); | |
1cc91f1b | 87 | |
e81d98ec | 88 | #endif /* SCM_PAIRS_H */ |
89e00824 ML |
89 | |
90 | /* | |
91 | Local Variables: | |
92 | c-file-style: "gnu" | |
93 | End: | |
94 | */ |