More explain stuff.
[yaz-moved-to-github.git] / odr / odr_tag.c
1 /*
2  * Copyright (c) 1995, Index Data
3  * See the file LICENSE for details.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: odr_tag.c,v $
7  * Revision 1.6  1995-12-14 16:28:26  quinn
8  * More explain stuff.
9  *
10  * Revision 1.5  1995/09/29  17:12:27  quinn
11  * Smallish
12  *
13  * Revision 1.4  1995/09/27  15:03:00  quinn
14  * Modified function heads & prototypes.
15  *
16  * Revision 1.3  1995/05/16  08:51:00  quinn
17  * License, documentation, and memory fixes
18  *
19  * Revision 1.2  1995/03/08  12:12:31  quinn
20  * Added better error checking.
21  *
22  * Revision 1.1  1995/02/02  16:21:54  quinn
23  * First kick.
24  *
25  */
26
27 #include <odr.h>
28
29 int odr_implicit_settag(ODR o, int class, int tag)
30 {
31     if (o->error)
32         return 0;
33     if (o->t_class < 0)
34     {
35         o->t_class = class;
36         o->t_tag = tag;
37     }
38     return 1;
39 }
40
41 int odr_initmember(ODR o, void *p, int size)
42 {
43     char **pp = (char **) p;
44
45     if (o->error)
46         return 0;
47     if (o->direction == ODR_DECODE)
48         *pp = odr_malloc(o, size);
49     else if (!*pp)
50     {
51         o->t_class = -1;
52         return 0;
53     }
54     return 1;
55 }