1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2011 Index Data
3 * See the file LICENSE for details.
7 * \brief Implements misc ODR types.
15 int odr_external(ODR o, Odr_external **p, int opt, const char *name)
18 static Odr_arm arm[] =
20 {ODR_EXPLICIT, ODR_CONTEXT, 0, ODR_EXTERNAL_single,
21 (Odr_fun)odr_any, "single"},
22 {ODR_IMPLICIT, ODR_CONTEXT, 1, ODR_EXTERNAL_octet,
23 (Odr_fun)odr_octetstring, "octet"},
24 {ODR_IMPLICIT, ODR_CONTEXT, 2, ODR_EXTERNAL_arbitrary,
25 (Odr_fun)odr_bitstring, "arbitrary"},
26 {-1, -1, -1, -1, 0, 0}
29 odr_implicit_settag(o, ODR_UNIVERSAL, ODR_EXTERNAL);
30 if (!odr_sequence_begin(o, p, sizeof(Odr_external), name))
31 return odr_missing(o, opt, name);
34 odr_oid(o, &pp->direct_reference, 1, "direct") &&
35 odr_integer(o, &pp->indirect_reference, 1, "indirect") &&
36 odr_graphicstring(o, &pp->descriptor, 1, "descriptor") &&
37 odr_choice(o, arm, &pp->u, &pp->which, 0) &&
41 int odr_visiblestring(ODR o, char **p, int opt, const char *name)
43 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
44 ODR_VISIBLESTRING, opt, name);
48 * a char may not be sufficient to hold a general string, but we'll deal
49 * with that once we start looking more closely at UniCode & co.
51 int odr_generalstring(ODR o, char **p, int opt, const char *name)
53 return odr_implicit_tag(o, odr_iconv_string, p, ODR_UNIVERSAL,
54 ODR_GENERALSTRING,opt, name);
57 int odr_graphicstring(ODR o, char **p, int opt, const char *name)
59 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
60 ODR_GRAPHICSTRING, opt, name);
63 int odr_generalizedtime(ODR o, char **p, int opt, const char *name)
65 return odr_implicit_tag(o, odr_cstring, p, ODR_UNIVERSAL,
66 ODR_GENERALIZEDTIME, opt, name);
71 * c-file-style: "Stroustrup"
72 * indent-tabs-mode: nil
74 * vim: shiftwidth=4 tabstop=8 expandtab