Commit | Line | Data |
---|---|---|
6e7d5622 | 1 | /* Copyright (C) 1999,2000,2001,2003, 2006 Free Software Foundation, Inc. |
896f6179 RB |
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 | |
92205699 | 15 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
896f6179 RB |
16 | */ |
17 | ||
12255c58 | 18 | #include "libguile.h" |
896f6179 RB |
19 | |
20 | long asmob000; | |
21 | long asmob100; | |
22 | long asmob010; | |
23 | long asmob001; | |
24 | long asmob200; | |
25 | long asmob110; | |
26 | long asmob020; | |
27 | long asmob101; | |
28 | long asmob011; | |
29 | long asmob300; | |
30 | long asmob210; | |
31 | long asmob120; | |
32 | long asmob030; | |
33 | long asmob201; | |
34 | long asmob021; | |
35 | long asmob111; | |
36 | ||
37 | /* since we don't have SCM_DEFINE_STATIC or similar */ | |
38 | SCM scm_make_asmob000 (void); | |
39 | SCM scm_make_asmob001 (void); | |
40 | SCM scm_make_asmob010 (void); | |
41 | SCM scm_make_asmob011 (void); | |
42 | SCM scm_make_asmob100 (void); | |
43 | SCM scm_make_asmob101 (void); | |
44 | SCM scm_make_asmob110 (void); | |
45 | SCM scm_make_asmob111 (void); | |
46 | SCM scm_make_asmob120 (void); | |
47 | SCM scm_make_asmob020 (void); | |
48 | SCM scm_make_asmob021 (void); | |
49 | SCM scm_make_asmob200 (void); | |
50 | SCM scm_make_asmob201 (void); | |
51 | SCM scm_make_asmob210 (void); | |
52 | SCM scm_make_asmob030 (void); | |
53 | SCM scm_make_asmob300 (void); | |
54 | ||
55 | ||
56 | SCM_DEFINE (scm_make_asmob000, "make-asmob000", 0, 0, 0, (), "") | |
57 | { | |
58 | SCM_RETURN_NEWSMOB (asmob000, 0); | |
59 | } | |
60 | ||
61 | SCM_DEFINE (scm_make_asmob100, "make-asmob100", 0, 0, 0, (), "") | |
62 | { | |
63 | SCM_RETURN_NEWSMOB (asmob100, 0); | |
64 | } | |
65 | ||
66 | SCM_DEFINE (scm_make_asmob010, "make-asmob010", 0, 0, 0, (), "") | |
67 | { | |
68 | SCM_RETURN_NEWSMOB (asmob010, 0); | |
69 | } | |
70 | ||
71 | SCM_DEFINE (scm_make_asmob001, "make-asmob001", 0, 0, 0, (), "") | |
72 | { | |
73 | SCM_RETURN_NEWSMOB (asmob001, 0); | |
74 | } | |
75 | ||
76 | SCM_DEFINE (scm_make_asmob200, "make-asmob200", 0, 0, 0, (), "") | |
77 | { | |
78 | SCM_RETURN_NEWSMOB (asmob200, 0); | |
79 | } | |
80 | ||
81 | SCM_DEFINE (scm_make_asmob110, "make-asmob110", 0, 0, 0, (), "") | |
82 | { | |
83 | SCM_RETURN_NEWSMOB (asmob110, 0); | |
84 | } | |
85 | ||
86 | SCM_DEFINE (scm_make_asmob020, "make-asmob020", 0, 0, 0, (), "") | |
87 | { | |
88 | SCM_RETURN_NEWSMOB (asmob020, 0); | |
89 | } | |
90 | ||
91 | SCM_DEFINE (scm_make_asmob101, "make-asmob101", 0, 0, 0, (), "") | |
92 | { | |
93 | SCM_RETURN_NEWSMOB (asmob101, 0); | |
94 | } | |
95 | ||
96 | SCM_DEFINE (scm_make_asmob011, "make-asmob011", 0, 0, 0, (), "") | |
97 | { | |
98 | SCM_RETURN_NEWSMOB (asmob011, 0); | |
99 | } | |
100 | ||
101 | SCM_DEFINE (scm_make_asmob300, "make-asmob300", 0, 0, 0, (), "") | |
102 | { | |
103 | SCM_RETURN_NEWSMOB (asmob300, 0); | |
104 | } | |
105 | ||
106 | SCM_DEFINE (scm_make_asmob210, "make-asmob210", 0, 0, 0, (), "") | |
107 | { | |
108 | SCM_RETURN_NEWSMOB (asmob210, 0); | |
109 | } | |
110 | ||
111 | SCM_DEFINE (scm_make_asmob120, "make-asmob120", 0, 0, 0, (), "") | |
112 | { | |
113 | SCM_RETURN_NEWSMOB (asmob120, 0); | |
114 | } | |
115 | ||
116 | SCM_DEFINE (scm_make_asmob030, "make-asmob030", 0, 0, 0, (), "") | |
117 | { | |
118 | SCM_RETURN_NEWSMOB (asmob030, 0); | |
119 | } | |
120 | ||
121 | SCM_DEFINE (scm_make_asmob201, "make-asmob201", 0, 0, 0, (), "") | |
122 | { | |
123 | SCM_RETURN_NEWSMOB (asmob201, 0); | |
124 | } | |
125 | ||
126 | SCM_DEFINE (scm_make_asmob021, "make-asmob021", 0, 0, 0, (), "") | |
127 | { | |
128 | SCM_RETURN_NEWSMOB (asmob021, 0); | |
129 | } | |
130 | ||
131 | SCM_DEFINE (scm_make_asmob111, "make-asmob111", 0, 0, 0, (), "") | |
132 | { | |
133 | SCM_RETURN_NEWSMOB (asmob111, 0); | |
134 | } | |
135 | ||
136 | static SCM | |
137 | apply0 (SCM smob) | |
138 | { | |
139 | return SCM_EOL; | |
140 | } | |
141 | ||
142 | static SCM | |
143 | apply1 (SCM smob, SCM a1) | |
144 | { | |
145 | if (SCM_UNBNDP (a1)) a1 = SCM_BOOL_F; | |
146 | return scm_list_1 (a1); | |
147 | } | |
148 | ||
149 | static SCM | |
150 | apply2 (SCM smob, SCM a1, SCM a2) | |
151 | { | |
152 | if (SCM_UNBNDP (a1)) a1 = SCM_BOOL_F; | |
153 | if (SCM_UNBNDP (a2)) a2 = SCM_BOOL_F; | |
154 | return scm_list_2 (a1, a2); | |
155 | } | |
156 | ||
157 | static SCM | |
158 | apply3 (SCM smob, SCM a1, SCM a2, SCM rest) | |
159 | { | |
160 | if (SCM_UNBNDP (a1)) a1 = SCM_BOOL_F; | |
161 | if (SCM_UNBNDP (a2)) a2 = SCM_BOOL_F; | |
162 | if (SCM_UNBNDP (rest)) rest = SCM_BOOL_F; | |
163 | return scm_list_3 (a1, a2, rest); | |
164 | } | |
165 | ||
166 | void libtest_asmobs_init (void); | |
167 | ||
168 | void | |
169 | libtest_asmobs_init () | |
170 | { | |
171 | asmob000 = scm_make_smob_type ("asmob000", 0); | |
172 | scm_set_smob_apply (asmob000, apply0, 0, 0, 0); | |
173 | asmob100 = scm_make_smob_type ("asmob100", 0); | |
174 | scm_set_smob_apply (asmob100, apply1, 1, 0, 0); | |
175 | asmob010 = scm_make_smob_type ("asmob010", 0); | |
176 | scm_set_smob_apply (asmob010, apply1, 0, 1, 0); | |
177 | asmob001 = scm_make_smob_type ("asmob001", 0); | |
178 | scm_set_smob_apply (asmob001, apply1, 0, 0, 1); | |
179 | asmob200 = scm_make_smob_type ("asmob200", 0); | |
180 | scm_set_smob_apply (asmob200, apply2, 2, 0, 0); | |
181 | asmob110 = scm_make_smob_type ("asmob110", 0); | |
182 | scm_set_smob_apply (asmob110, apply2, 1, 1, 0); | |
183 | asmob020 = scm_make_smob_type ("asmob020", 0); | |
184 | scm_set_smob_apply (asmob020, apply2, 0, 2, 0); | |
185 | asmob101 = scm_make_smob_type ("asmob101", 0); | |
186 | scm_set_smob_apply (asmob101, apply2, 1, 0, 1); | |
187 | asmob011 = scm_make_smob_type ("asmob011", 0); | |
188 | scm_set_smob_apply (asmob011, apply2, 0, 1, 1); | |
189 | asmob300 = scm_make_smob_type ("asmob300", 0); | |
190 | scm_set_smob_apply (asmob300, apply3, 3, 0, 0); | |
191 | asmob210 = scm_make_smob_type ("asmob210", 0); | |
192 | scm_set_smob_apply (asmob210, apply3, 2, 1, 0); | |
193 | asmob120 = scm_make_smob_type ("asmob120", 0); | |
194 | scm_set_smob_apply (asmob120, apply3, 1, 2, 0); | |
195 | asmob030 = scm_make_smob_type ("asmob030", 0); | |
196 | scm_set_smob_apply (asmob030, apply3, 0, 3, 0); | |
197 | asmob201 = scm_make_smob_type ("asmob201", 0); | |
198 | scm_set_smob_apply (asmob201, apply3, 2, 0, 1); | |
199 | asmob021 = scm_make_smob_type ("asmob021", 0); | |
200 | scm_set_smob_apply (asmob021, apply3, 0, 2, 1); | |
201 | asmob111 = scm_make_smob_type ("asmob111", 0); | |
202 | scm_set_smob_apply (asmob111, apply3, 1, 1, 1); | |
479c46ea | 203 | # include "test-asmobs-lib.x" |
896f6179 | 204 | } |