+
+int odr_sequence_more(ODR o)
+{
+ return odr_constructed_more(o);
+}
+
+int odr_sequence_of(ODR o, Odr_fun type, void *p, int *num)
+{
+ char ***pp = (char***) p; /* for dereferencing */
+ char **tmp = 0;
+ int size = 0, i;
+
+ if (!odr_sequence_begin(o, p, 0))
+ return 0;
+
+ switch (o->direction)
+ {
+ case ODR_DECODE:
+ *num = 0;
+ *pp = ODR_NULLVAL;
+ while (odr_sequence_more(o))
+ {
+ /* outgrown array? */
+ if (*num * sizeof(void*) >= size)
+ {
+ /* double the buffer size */
+ tmp = odr_malloc(o, sizeof(void*) * (size += size ? size :
+ 128));
+ if (*num)
+ {
+ memcpy(tmp, *pp, *num * sizeof(void*));
+ /*
+ * For now, we just throw the old *p away, since we use
+ * nibble memory anyway (disgusting, isn't it?).
+ */
+ }
+ *pp = tmp;
+ }
+ if (!(*type)(o, (*pp) + *num, 0))
+ return 0;
+ (*num)++;
+ }
+ break;
+ case ODR_ENCODE: case ODR_PRINT:
+#ifdef ODR_DEBUG
+ fprintf(stderr, "[seqof: num=%d]", *num);
+#endif
+ for (i = 0; i < *num; i++)
+ {
+#ifdef ODR_DEBUG
+ fprintf(stderr, "[seqof: elem #%d]", i);
+#endif
+ if (!(*type)(o, *pp + i, 0))
+ return 0;
+ }
+ break;
+ default:
+ o->error = OOTHER;
+ return 0;
+ }
+ return odr_sequence_end(o);
+}