source: trunk/gsdl/packages/yaz/odr/odr_tag.c@ 1343

Last change on this file since 1343 was 1343, checked in by johnmcp, 24 years ago

Added the YAZ toolkit source to the packages directory (for z39.50 stuff)

  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
Line 
1/*
2 * Copyright (c) 1995-2000, Index Data
3 * See the file LICENSE for details.
4 * Sebastian Hammer, Adam Dickmeiss
5 *
6 * $Log$
7 * Revision 1.1 2000/08/03 03:11:24 johnmcp
8 * Added the YAZ toolkit source to the packages directory (for z39.50 stuff)
9 *
10 * Revision 1.11 2000/02/29 13:44:55 adam
11 * Check for config.h (currently not generated).
12 *
13 * Revision 1.10 1999/11/30 13:47:11 adam
14 * Improved installation. Moved header files to include/yaz.
15 *
16 * Revision 1.9 1998/02/11 11:53:34 adam
17 * Changed code so that it compiles as C++.
18 *
19 * Revision 1.8 1997/05/14 06:53:59 adam
20 * C++ support.
21 *
22 * Revision 1.7 1996/02/20 12:52:54 quinn
23 * Added odr_peektag
24 *
25 * Revision 1.6 1995/12/14 16:28:26 quinn
26 * More explain stuff.
27 *
28 * Revision 1.5 1995/09/29 17:12:27 quinn
29 * Smallish
30 *
31 * Revision 1.4 1995/09/27 15:03:00 quinn
32 * Modified function heads & prototypes.
33 *
34 * Revision 1.3 1995/05/16 08:51:00 quinn
35 * License, documentation, and memory fixes
36 *
37 * Revision 1.2 1995/03/08 12:12:31 quinn
38 * Added better error checking.
39 *
40 * Revision 1.1 1995/02/02 16:21:54 quinn
41 * First kick.
42 *
43 */
44#if HAVE_CONFIG_H
45#include <config.h>
46#endif
47
48#include <yaz/odr.h>
49
50int odr_peektag(ODR o, int *zclass, int *tag, int *cons)
51{
52 if (o->direction != ODR_DECODE)
53 {
54 o->error = OOTHER;
55 return 0;
56 }
57 if (o->stackp > -1 && !odr_constructed_more(o))
58 return 0;
59 if (ber_dectag(o->bp, zclass, tag, cons) <= 0)
60 {
61 o->error = OREQUIRED;
62 return 0;
63 }
64 return 1;
65}
66
67int odr_implicit_settag(ODR o, int zclass, int tag)
68{
69 if (o->error)
70 return 0;
71 if (o->t_class < 0)
72 {
73 o->t_class = zclass;
74 o->t_tag = tag;
75 }
76 return 1;
77}
78
79int odr_initmember(ODR o, void *p, int size)
80{
81 char **pp = (char **) p;
82
83 if (o->error)
84 return 0;
85 if (o->direction == ODR_DECODE)
86 *pp = (char *)odr_malloc(o, size);
87 else if (!*pp)
88 {
89 o->t_class = -1;
90 return 0;
91 }
92 return 1;
93}
Note: See TracBrowser for help on using the repository browser.