2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.2 1995-02-06 16:45:03 quinn
10 * Revision 1.1 1995/02/02 16:21:54 quinn
17 int odr_sequence_begin(ODR o, void *p, int size)
19 char **pp = (char**) p;
23 o->t_class = ODR_UNIVERSAL;
24 o->t_tag = ODR_SEQUENCE;
27 if (odr_constructed_begin(o, p, o->t_class, o->t_tag, 0))
29 if (o->direction == ODR_DECODE && size)
30 *pp = nalloc(o, size);
37 int odr_sequence_end(ODR o)
39 return odr_constructed_end(o);
42 int odr_sequence_more(ODR o)
46 if (o->stack[o->stackp].len >= 0)
47 return o->bp - o->stack[o->stackp].base < o->stack[o->stackp].len;
49 return (!(*o->bp == 0 && *(o->bp + 1) == 0));
52 int odr_sequence_of(ODR o, Odr_fun type, void *p, int *num)
54 char **pp = (char**) p; /* for dereferencing */
58 if (!odr_sequence_begin(o, p, 0))
61 if (o->direction = ODR_DECODE)
63 while (odr_sequence_more(o))
66 if (*num * sizeof(void*) >= size)
68 /* double the buffer size */
69 tmp = nalloc(o, sizeof(void*) * (size += size ? size :
73 memcpy(tmp, *pp, *num * sizeof(void*));
75 * For now, we just throw the old *p away, since we use
76 * nibble memory anyway (disgusting, isn't it?).
81 if (!(*type)(o, (*pp)[*num++], 0))
85 return odr_sequence_end(o);