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 | * |
0f2d19dd JB |
8 | * This program is free software; you can redistribute it and/or modify |
9 | * it under the terms of the GNU General Public License as published by | |
10 | * the Free Software Foundation; either version 2, or (at your option) | |
11 | * any later version. | |
0527e687 | 12 | * |
0f2d19dd JB |
13 | * This program 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 | |
16 | * GNU General Public License for more details. | |
0527e687 | 17 | * |
0f2d19dd JB |
18 | * You should have received a copy of the GNU General Public License |
19 | * along with this software; see the file COPYING. If not, write to | |
82892bed JB |
20 | * the Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
21 | * Boston, MA 02111-1307 USA | |
0f2d19dd JB |
22 | * |
23 | * As a special exception, the Free Software Foundation gives permission | |
24 | * for additional uses of the text contained in its release of GUILE. | |
25 | * | |
26 | * The exception is that, if you link the GUILE library with other files | |
27 | * to produce an executable, this does not by itself cause the | |
28 | * resulting executable to be covered by the GNU General Public License. | |
29 | * Your use of that executable is in no way restricted on account of | |
30 | * linking the GUILE library code into it. | |
31 | * | |
32 | * This exception does not however invalidate any other reasons why | |
33 | * the executable file might be covered by the GNU General Public License. | |
34 | * | |
35 | * This exception applies only to the code released by the | |
36 | * Free Software Foundation under the name GUILE. If you copy | |
37 | * code from other Free Software Foundation releases into a copy of | |
38 | * GUILE, as the General Public License permits, the exception does | |
39 | * not apply to the code that you add in this way. To avoid misleading | |
40 | * anyone as to the status of such modified files, you must delete | |
41 | * this exception notice from them. | |
42 | * | |
43 | * If you write modifications of your own for GUILE, it is your choice | |
44 | * whether to permit this exception to apply to your modifications. | |
82892bed | 45 | * If you do not wish that, delete this exception notice. */ |
1bbd0b84 | 46 | |
0f2d19dd JB |
47 | \f |
48 | ||
b4309c3c | 49 | #include "libguile/__scm.h" |
0f2d19dd JB |
50 | |
51 | \f | |
52 | ||
e81d98ec DH |
53 | #if (SCM_DEBUG_PAIR_ACCESSES == 1) |
54 | # include "libguile/struct.h" | |
55 | # define SCM_VALIDATE_PAIR(cell, expr) \ | |
6cf69537 | 56 | ((!SCM_CONSP (cell) ? scm_error_pair_access (cell), 0 : 0), (expr)) |
e81d98ec DH |
57 | #else |
58 | # define SCM_VALIDATE_PAIR(cell, expr) (expr) | |
59 | #endif | |
60 | ||
dd039d6d DH |
61 | #define SCM_NULLP(x) (SCM_EQ_P ((x), SCM_EOL)) |
62 | #define SCM_NNULLP(x) (!SCM_NULLP (x)) | |
0f2d19dd | 63 | |
e81d98ec DH |
64 | #define SCM_CAR(x) (SCM_VALIDATE_PAIR (x, SCM_CELL_OBJECT_0 (x))) |
65 | #define SCM_CDR(x) (SCM_VALIDATE_PAIR (x, SCM_CELL_OBJECT_1 (x))) | |
76a369d9 | 66 | |
e81d98ec DH |
67 | #define SCM_SETCAR(x, v) (SCM_VALIDATE_PAIR (x, SCM_SET_CELL_OBJECT_0 ((x), (v)))) |
68 | #define SCM_SETCDR(x, v) (SCM_VALIDATE_PAIR (x, SCM_SET_CELL_OBJECT_1 ((x), (v)))) | |
24e68a57 | 69 | |
0f2d19dd JB |
70 | #define SCM_CAAR(OBJ) SCM_CAR (SCM_CAR (OBJ)) |
71 | #define SCM_CDAR(OBJ) SCM_CDR (SCM_CAR (OBJ)) | |
72 | #define SCM_CADR(OBJ) SCM_CAR (SCM_CDR (OBJ)) | |
73 | #define SCM_CDDR(OBJ) SCM_CDR (SCM_CDR (OBJ)) | |
74 | ||
75 | #define SCM_CAAAR(OBJ) SCM_CAR (SCM_CAR (SCM_CAR (OBJ))) | |
76 | #define SCM_CDAAR(OBJ) SCM_CDR (SCM_CAR (SCM_CAR (OBJ))) | |
77 | #define SCM_CADAR(OBJ) SCM_CAR (SCM_CDR (SCM_CAR (OBJ))) | |
78 | #define SCM_CDDAR(OBJ) SCM_CDR (SCM_CDR (SCM_CAR (OBJ))) | |
79 | #define SCM_CAADR(OBJ) SCM_CAR (SCM_CAR (SCM_CDR (OBJ))) | |
80 | #define SCM_CDADR(OBJ) SCM_CDR (SCM_CAR (SCM_CDR (OBJ))) | |
81 | #define SCM_CADDR(OBJ) SCM_CAR (SCM_CDR (SCM_CDR (OBJ))) | |
82 | #define SCM_CDDDR(OBJ) SCM_CDR (SCM_CDR (SCM_CDR (OBJ))) | |
83 | ||
84 | #define SCM_CAAAAR(OBJ) SCM_CAR (SCM_CAR (SCM_CAR (SCM_CAR (OBJ)))) | |
85 | #define SCM_CDAAAR(OBJ) SCM_CDR (SCM_CAR (SCM_CAR (SCM_CAR (OBJ)))) | |
86 | #define SCM_CADAAR(OBJ) SCM_CAR (SCM_CDR (SCM_CAR (SCM_CAR (OBJ)))) | |
87 | #define SCM_CDDAAR(OBJ) SCM_CDR (SCM_CDR (SCM_CAR (SCM_CAR (OBJ)))) | |
88 | #define SCM_CAADAR(OBJ) SCM_CAR (SCM_CAR (SCM_CDR (SCM_CAR (OBJ)))) | |
89 | #define SCM_CDADAR(OBJ) SCM_CDR (SCM_CAR (SCM_CDR (SCM_CAR (OBJ)))) | |
90 | #define SCM_CADDAR(OBJ) SCM_CAR (SCM_CDR (SCM_CDR (SCM_CAR (OBJ)))) | |
91 | #define SCM_CDDDAR(OBJ) SCM_CDR (SCM_CDR (SCM_CDR (SCM_CAR (OBJ)))) | |
92 | #define SCM_CAAADR(OBJ) SCM_CAR (SCM_CAR (SCM_CAR (SCM_CDR (OBJ)))) | |
93 | #define SCM_CDAADR(OBJ) SCM_CDR (SCM_CAR (SCM_CAR (SCM_CDR (OBJ)))) | |
94 | #define SCM_CADADR(OBJ) SCM_CAR (SCM_CDR (SCM_CAR (SCM_CDR (OBJ)))) | |
95 | #define SCM_CDDADR(OBJ) SCM_CDR (SCM_CDR (SCM_CAR (SCM_CDR (OBJ)))) | |
96 | #define SCM_CAADDR(OBJ) SCM_CAR (SCM_CAR (SCM_CDR (SCM_CDR (OBJ)))) | |
97 | #define SCM_CDADDR(OBJ) SCM_CDR (SCM_CAR (SCM_CDR (SCM_CDR (OBJ)))) | |
98 | #define SCM_CADDDR(OBJ) SCM_CAR (SCM_CDR (SCM_CDR (SCM_CDR (OBJ)))) | |
99 | #define SCM_CDDDDR(OBJ) SCM_CDR (SCM_CDR (SCM_CDR (SCM_CDR (OBJ)))) | |
100 | ||
0f2d19dd | 101 | \f |
1cc91f1b | 102 | |
e81d98ec | 103 | #if (SCM_DEBUG_PAIR_ACCESSES == 1) |
5843e5c9 | 104 | extern void scm_error_pair_access (SCM); |
e81d98ec | 105 | #endif |
7866a09b GB |
106 | extern SCM scm_cons (SCM x, SCM y); |
107 | extern SCM scm_cons2 (SCM w, SCM x, SCM y); | |
108 | extern SCM scm_pair_p (SCM x); | |
109 | extern SCM scm_set_car_x (SCM pair, SCM value); | |
110 | extern SCM scm_set_cdr_x (SCM pair, SCM value); | |
111 | extern void scm_init_pairs (void); | |
1cc91f1b | 112 | |
e81d98ec | 113 | #endif /* SCM_PAIRS_H */ |
89e00824 ML |
114 | |
115 | /* | |
116 | Local Variables: | |
117 | c-file-style: "gnu" | |
118 | End: | |
119 | */ |