* readline.scm: moved to ./ice-9/
[bpt/guile.git] / libguile / pairs.h
1 /* classes: h_files */
2
3 #ifndef SCM_PAIRS_H
4 #define SCM_PAIRS_H
5
6 /* Copyright (C) 1995,1996,2000,2001 Free Software Foundation, Inc.
7 *
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.
12 *
13 * This library is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
16 * Lesser General Public License for more details.
17 *
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 */
22
23 \f
24
25 #include "libguile/__scm.h"
26
27 \f
28
29 #if (SCM_DEBUG_PAIR_ACCESSES == 1)
30 # define SCM_VALIDATE_PAIR(cell, expr) \
31 ((!SCM_CONSP (cell) ? scm_error_pair_access (cell), 0 : 0), (expr))
32 #else
33 # define SCM_VALIDATE_PAIR(cell, expr) (expr)
34 #endif
35
36 #define SCM_NULLP(x) (SCM_EQ_P ((x), SCM_EOL))
37 #define SCM_NNULLP(x) (!SCM_NULLP (x))
38
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)))
41
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))))
44
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
76 \f
77
78 #if (SCM_DEBUG_PAIR_ACCESSES == 1)
79 SCM_API void scm_error_pair_access (SCM);
80 #endif
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);
87
88 #endif /* SCM_PAIRS_H */
89
90 /*
91 Local Variables:
92 c-file-style: "gnu"
93 End:
94 */