(exception:string-contains-nul): New exception pattern.
[bpt/guile.git] / libguile / gh_list.c
1 /* Copyright (C) 1995,1996,1997, 2000, 2001, 2004, 2006 Free Software Foundation, Inc.
2
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16 */
17 \f
18
19 /* list manipulation */
20
21 #include "libguile/gh.h"
22
23 #if SCM_ENABLE_DEPRECATED
24
25 /* returns the length of a list */
26 unsigned long
27 gh_length (SCM l)
28 {
29 return gh_scm2ulong (scm_length (l));
30 }
31
32 /* list operations */
33
34 /* gh_list(SCM elt, ...) is implemented as a macro in gh.h. */
35
36 /* gh_append() takes a args, which is a list of lists, and appends
37 them all together into a single list, which is returned. This is
38 equivalent to the Scheme procedure (append list1 list2 ...) */
39 SCM
40 gh_append (SCM args)
41 {
42 return scm_append (args);
43 }
44
45 SCM
46 gh_append2 (SCM l1, SCM l2)
47 {
48 return scm_append (scm_list_2 (l1, l2));
49 }
50
51 SCM
52 gh_append3(SCM l1, SCM l2, SCM l3)
53 {
54 return scm_append (scm_list_3 (l1, l2, l3));
55 }
56
57 SCM
58 gh_append4 (SCM l1, SCM l2, SCM l3, SCM l4)
59 {
60 return scm_append (scm_list_4 (l1, l2, l3, l4));
61 }
62
63 /* gh_reverse() is defined as a macro in gh.h */
64 /* gh_list_tail() is defined as a macro in gh.h */
65 /* gh_list_ref() is defined as a macro in gh.h */
66 /* gh_memq() is defined as a macro in gh.h */
67 /* gh_memv() is defined as a macro in gh.h */
68 /* gh_member() is defined as a macro in gh.h */
69 /* gh_assq() is defined as a macro in gh.h */
70 /* gh_assv() is defined as a macro in gh.h */
71 /* gh_assoc() is defined as a macro in gh.h */
72
73 /* analogous to the Scheme cons operator */
74 SCM
75 gh_cons (SCM x, SCM y)
76 {
77 return scm_cons (x, y);
78 }
79
80 /* analogous to the Scheme car operator */
81 SCM
82 gh_car (SCM x)
83 {
84 return scm_car (x);
85 }
86
87 /* analogous to the Scheme cdr operator */
88 SCM
89 gh_cdr (SCM x)
90 {
91 return scm_cdr (x);
92 }
93
94 /* now for the multiple car/cdr utility procedures */
95 SCM
96 gh_caar (SCM x)
97 {
98 return scm_caar (x);
99 }
100 SCM
101 gh_cadr (SCM x)
102 {
103 return scm_cadr (x);
104 }
105 SCM
106 gh_cdar (SCM x)
107 {
108 return scm_cdar (x);
109 }
110 SCM
111 gh_cddr (SCM x)
112 {
113 return scm_cddr (x);
114 }
115
116 SCM
117 gh_caaar (SCM x)
118 {
119 return scm_caaar (x);
120 }
121 SCM
122 gh_caadr (SCM x)
123 {
124 return scm_caadr (x);
125 }
126 SCM
127 gh_cadar (SCM x)
128 {
129 return scm_cadar (x);
130 }
131 SCM
132 gh_caddr (SCM x)
133 {
134 return scm_caddr (x);
135 }
136 SCM
137 gh_cdaar (SCM x)
138 {
139 return scm_cdaar (x);
140 }
141 SCM
142 gh_cdadr (SCM x)
143 {
144 return scm_cdadr (x);
145 }
146 SCM
147 gh_cddar (SCM x)
148 {
149 return scm_cddar (x);
150 }
151 SCM
152 gh_cdddr (SCM x)
153 {
154 return scm_cdddr (x);
155 }
156
157 /* equivalent to (set-car! pair value) */
158 SCM
159 gh_set_car_x(SCM pair, SCM value)
160 {
161 return scm_set_car_x(pair, value);
162 }
163
164 /* equivalent to (set-cdr! pair value) */
165 SCM
166 gh_set_cdr_x(SCM pair, SCM value)
167 {
168 return scm_set_cdr_x(pair, value);
169 }
170
171 #endif /* SCM_ENABLE_DEPRECATED */
172
173 /*
174 Local Variables:
175 c-file-style: "gnu"
176 End:
177 */