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