2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.3 1995-02-07 14:13:46 quinn
10 * Revision 1.2 1995/02/06 16:45:03 quinn
13 * Revision 1.1 1995/02/02 16:21:54 quinn
20 int odr_sequence_begin(ODR o, void *p, int size)
22 char **pp = (char**) p;
26 o->t_class = ODR_UNIVERSAL;
27 o->t_tag = ODR_SEQUENCE;
30 if (odr_constructed_begin(o, p, o->t_class, o->t_tag, 0))
32 if (o->direction == ODR_DECODE && size)
33 *pp = nalloc(o, size);
40 int odr_sequence_end(ODR o)
42 return odr_constructed_end(o);
45 int odr_sequence_more(ODR o)
49 if (o->stack[o->stackp].len >= 0)
50 return o->bp - o->stack[o->stackp].base < o->stack[o->stackp].len;
52 return (!(*o->bp == 0 && *(o->bp + 1) == 0));
55 int odr_sequence_of(ODR o, Odr_fun type, void *p, int *num)
57 char ***pp = (char***) p; /* for dereferencing */
61 if (!odr_sequence_begin(o, p, 0))
68 while (odr_sequence_more(o))
71 if (*num * sizeof(void*) >= size)
73 /* double the buffer size */
74 tmp = nalloc(o, sizeof(void*) * (size += size ? size :
78 memcpy(tmp, *pp, *num * sizeof(void*));
80 * For now, we just throw the old *p away, since we use
81 * nibble memory anyway (disgusting, isn't it?).
86 if (!(*type)(o, (*pp) + *num, 0))
92 for (i = 0; i < *num; i++)
93 if (!(*type)(o, *pp + i, 0))
96 case ODR_PRINT: return 1;
99 return odr_sequence_end(o);