]> git.donarmstrong.com Git - lilypond.git/blob - guile18/libguile/gh_list.c
New upstream version 2.19.65
[lilypond.git] / guile18 / libguile / gh_list.c
1 /*      Copyright (C) 1995,1996,1997, 2000, 2001, 2004, 2006, 2008 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 #ifdef HAVE_CONFIG_H
19 # include <config.h>
20 #endif
21
22
23 /* list manipulation */
24
25 #include "libguile/gh.h"
26
27 #if SCM_ENABLE_DEPRECATED
28
29 /* returns the length of a list */
30 unsigned long 
31 gh_length (SCM l)
32 {
33   return gh_scm2ulong (scm_length (l));
34 }
35
36 /* list operations */
37
38 /* gh_list(SCM elt, ...) is implemented as a macro in gh.h. */
39
40 /* gh_append() takes a args, which is a list of lists, and appends
41    them all together into a single list, which is returned.  This is
42    equivalent to the Scheme procedure (append list1 list2 ...) */
43 SCM
44 gh_append (SCM args)
45 {
46   return scm_append (args);
47 }
48
49 SCM
50 gh_append2 (SCM l1, SCM l2)
51 {
52   return scm_append (scm_list_2 (l1, l2));
53 }
54
55 SCM
56 gh_append3(SCM l1, SCM l2, SCM l3)
57 {
58   return scm_append (scm_list_3 (l1, l2, l3));
59 }
60
61 SCM
62 gh_append4 (SCM l1, SCM l2, SCM l3, SCM l4)
63 {
64   return scm_append (scm_list_4 (l1, l2, l3, l4));
65 }
66
67 /* gh_reverse() is defined as a macro in gh.h */
68 /* gh_list_tail() is defined as a macro in gh.h */
69 /* gh_list_ref() is defined as a macro in gh.h */
70 /* gh_memq() is defined as a macro in gh.h */
71 /* gh_memv() is defined as a macro in gh.h */
72 /* gh_member() is defined as a macro in gh.h */
73 /* gh_assq() is defined as a macro in gh.h */
74 /* gh_assv() is defined as a macro in gh.h */
75 /* gh_assoc() is defined as a macro in gh.h */
76
77 /* analogous to the Scheme cons operator */
78 SCM 
79 gh_cons (SCM x, SCM y)
80 {
81   return scm_cons (x, y);
82 }
83
84 /* analogous to the Scheme car operator */
85 SCM 
86 gh_car (SCM x)
87 {
88   return scm_car (x);
89 }
90
91 /* analogous to the Scheme cdr operator */
92 SCM 
93 gh_cdr (SCM x)
94 {
95   return scm_cdr (x);
96 }
97
98 /* now for the multiple car/cdr utility procedures */
99 SCM 
100 gh_caar (SCM x)
101 {
102   return scm_caar (x);
103 }
104 SCM 
105 gh_cadr (SCM x)
106 {
107   return scm_cadr (x);
108 }
109 SCM 
110 gh_cdar (SCM x)
111 {
112   return scm_cdar (x);
113 }
114 SCM 
115 gh_cddr (SCM x)
116 {
117   return scm_cddr (x);
118 }
119
120 SCM 
121 gh_caaar (SCM x)
122 {
123   return scm_caaar (x);
124 }
125 SCM 
126 gh_caadr (SCM x)
127 {
128   return scm_caadr (x);
129 }
130 SCM 
131 gh_cadar (SCM x)
132 {
133   return scm_cadar (x);
134 }
135 SCM 
136 gh_caddr (SCM x)
137 {
138   return scm_caddr (x);
139 }
140 SCM 
141 gh_cdaar (SCM x)
142 {
143   return scm_cdaar (x);
144 }
145 SCM 
146 gh_cdadr (SCM x)
147 {
148   return scm_cdadr (x);
149 }
150 SCM 
151 gh_cddar (SCM x)
152 {
153   return scm_cddar (x);
154 }
155 SCM 
156 gh_cdddr (SCM x)
157 {
158   return scm_cdddr (x);
159 }
160
161 /* equivalent to (set-car! pair value) */
162 SCM
163 gh_set_car_x(SCM pair, SCM value)
164 {
165   return scm_set_car_x(pair, value);
166 }
167
168 /* equivalent to (set-cdr! pair value) */
169 SCM
170 gh_set_cdr_x(SCM pair, SCM value)
171 {
172   return scm_set_cdr_x(pair, value);
173 }
174
175 #endif /* SCM_ENABLE_DEPRECATED */
176
177 /*
178   Local Variables:
179   c-file-style: "gnu"
180   End:
181 */