/*
- * Copyright (c) 1995-2003, Index Data
+ * Copyright (C) 1995-2005, Index Data ApS
* See the file LICENSE for details.
*
- * $Id: odr_cons.c,v 1.1 2003-10-27 12:21:33 adam Exp $
+ * $Id: odr_cons.c,v 1.5 2005-01-15 19:47:14 adam Exp $
*
*/
+
+/**
+ * \file odr_cons.c
+ * \brief Implements ODR constructed codec.
+ */
+
#if HAVE_CONFIG_H
#include <config.h>
#endif
}
o->op->stack[++(o->op->stackp)].lenb = o->bp;
o->op->stack[o->op->stackp].len_offset = odr_tell(o);
+ o->op->stack_names[o->op->stackp] = name ? name : "?";
+ o->op->stack_names[o->op->stackp + 1] = 0;
#ifdef ODR_DEBUG
fprintf(stderr, "[cons_begin(%d)]", o->op->stackp);
#endif
if (odr_write(o, dummy, lenlen) < 0) /* dummy */
{
+ o->op->stack_names[o->op->stackp] = 0;
--(o->op->stackp);
return 0;
}
odr_max(o))) < 0)
{
odr_seterror(o, OOTHER, 31);
+ o->op->stack_names[o->op->stackp] = 0;
--(o->op->stackp);
return 0;
}
if (o->op->stack[o->op->stackp].len > odr_max(o))
{
odr_seterror(o, OOTHER, 32);
+ o->op->stack_names[o->op->stackp] = 0;
--(o->op->stackp);
return 0;
}
else if (o->direction == ODR_PRINT)
{
odr_prname(o, name);
- fprintf(o->print, "{\n");
+ odr_printf(o, "{\n");
o->indent++;
}
else
{
odr_seterror(o, OOTHER, 33);
+ o->op->stack_names[o->op->stackp] = 0;
--(o->op->stackp);
return 0;
}
odr_seterror(o, OOTHER, 34);
return 0;
}
+ o->op->stack_names[o->op->stackp] = 0;
switch (o->direction)
{
case ODR_DECODE:
o->op->stackp--;
o->indent--;
odr_prname(o, 0);
- fprintf(o->print, "}\n");
+ odr_printf(o, "}\n");
return 1;
default:
odr_seterror(o, OOTHER, 38);