2 * Copyright (C) 1994, Index Data I/S
4 * Sebastian Hammer, Adam Dickmeiss
7 * Revision 1.9 1995-04-10 10:23:11 quinn
10 * Revision 1.8 1995/03/17 10:17:43 quinn
11 * Added memory management.
13 * Revision 1.7 1995/03/10 11:44:41 quinn
14 * Fixed serious stack-bug in odr_cons_begin
16 * Revision 1.6 1995/03/08 12:12:15 quinn
17 * Added better error checking.
19 * Revision 1.5 1995/03/07 13:28:57 quinn
20 * *** empty log message ***
22 * Revision 1.4 1995/03/07 13:16:13 quinn
23 * Fixed bug in odr_reset
25 * Revision 1.3 1995/03/07 10:21:31 quinn
26 * odr_errno-->odr_error
28 * Revision 1.2 1995/03/07 10:19:05 quinn
29 * Addded some method functions to the ODR type.
31 * Revision 1.1 1995/03/07 09:23:15 quinn
32 * Installing top-level API and documentation.
45 "Memory allocation failed",
48 "Required data element missing",
56 void odr_perror(ODR o, char *message)
58 fprintf(stderr, "%s: %s\n", message, odr_errlist[o->error]);
61 int odr_geterror(ODR o)
66 void odr_setprint(ODR o, FILE *file)
71 ODR odr_createmem(int direction)
75 if (!(r = malloc(sizeof(*r))))
77 r->direction = direction;
95 odr_release_mem(o->mem);
99 void odr_destroy(ODR o)
101 odr_release_mem(o->mem);
102 if (o->print != stderr)
107 void odr_setbuf(ODR o, char *buf, int len)
109 o->buf = o->bp = (unsigned char *) buf;
110 o->buflen = o->left = len;
113 char *odr_getbuf(ODR o, int *len)
115 *len = o->bp - o->buf;
116 return (char *) o->buf;