~ubuntu-branches/ubuntu/intrepid/ecl/intrepid

« back to all changes in this revision

Viewing changes to src/c/structure.d

  • Committer: Bazaar Package Importer
  • Author(s): Peter Van Eynde
  • Date: 2007-04-09 11:51:51 UTC
  • mfrom: (1.1.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20070409115151-ql8cr0kalzx1jmla
Tags: 0.9i-20070324-2
Upload to unstable. 

Show diffs side-by-side

added added

removed removed

Lines of Context:
64
64
 
65
65
        s = si_get_sysprop(SNAME(x), @'si::structure-slot-descriptions');
66
66
        p = &CDR(r = CONS(SNAME(x), Cnil));
67
 
        for (i=0, n=SLENGTH(x);  !endp(s) && i<n;  s=CDR(s), i++) {
 
67
        for (i=0, n=SLENGTH(x);  !ecl_endp(s) && i<n;  s=CDR(s), i++) {
68
68
                p = &(CDR(*p = CONS(cl_car(CAR(s)), Cnil)));
69
69
                p = &(CDR(*p = CONS(SLOT(x, i), Cnil)));
70
70
        }
119
119
                s = ecl_copy_structure(s);
120
120
                break;
121
121
        case t_cons:
 
122
#ifdef ECL_UNICODE
 
123
        case t_string:
 
124
#endif
122
125
        case t_base_string:
123
126
        case t_bitvector:
124
127
        case t_vector:
150
153
}
151
154
 
152
155
cl_object
153
 
structure_ref(cl_object x, cl_object name, int n)
 
156
ecl_structure_ref(cl_object x, cl_object name, int n)
154
157
{
155
158
 
156
159
        if (type_of(x) != T_STRUCTURE ||
170
173
}
171
174
 
172
175
cl_object
173
 
structure_set(cl_object x, cl_object name, int n, cl_object v)
 
176
ecl_structure_set(cl_object x, cl_object name, int n, cl_object v)
174
177
{
175
178
 
176
179
        if (type_of(x) != T_STRUCTURE ||
194
197
        else
195
198
                return Cnil;
196
199
}
197
 
 
198
 
cl_object
199
 
si_rplaca_nthcdr(cl_object x, cl_object idx, cl_object v)
200
 
{
201
 
/*
202
 
        Used in DEFSETF forms generated by DEFSTRUCT.
203
 
        (si:rplaca-nthcdr x i v) is equivalent to 
204
 
        (progn (rplaca (nthcdr i x) v) v).
205
 
*/
206
 
        cl_fixnum i;
207
 
        cl_object l;
208
 
 
209
 
        assert_type_cons(x);
210
 
        for (i = fixnnint(idx), l = x;  i > 0; --i) {
211
 
                l = CDR(l);
212
 
                if (endp(l)) FEtype_error_index(x, idx);
213
 
        }
214
 
        CAR(l) = v;
215
 
        @(return v)
216
 
}
217
 
 
218
 
cl_object
219
 
si_list_nth(cl_object idx, cl_object x)
220
 
{
221
 
/*
222
 
        Used in structure access functions generated by DEFSTRUCT.
223
 
        si:list-nth is similar to nth except that
224
 
        (si:list-nth i x) is error if the length of the list x is less than i.
225
 
*/
226
 
        cl_fixnum i;
227
 
        cl_object l;
228
 
 
229
 
        assert_type_cons(x);
230
 
        for (i = fixnnint(idx), l = x;  i > 0; --i) {
231
 
                l = CDR(l);
232
 
                if (endp(l)) FEtype_error_index(x, idx);
233
 
        }
234
 
        @(return CAR(l))
235
 
}