1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2012 Index Data
3 * See the file LICENSE for details.
8 * \brief Implements ODR BOOLEAN codec
18 * Top level boolean en/decoder.
19 * Returns 1 on success, 0 on error.
21 int odr_bool(ODR o, Odr_bool **p, int opt, const char *name)
27 if (o->op->t_class < 0)
29 o->op->t_class = ODR_UNIVERSAL;
30 o->op->t_tag = ODR_BOOLEAN;
32 res = ber_tag(o, p, o->op->t_class, o->op->t_tag, &cons, opt, name);
36 return odr_missing(o, opt, name);
37 if (o->direction == ODR_PRINT)
40 odr_printf(o, "%s\n", (**p ? "TRUE" : "FALSE"));
45 if (o->direction == ODR_DECODE)
46 *p = (int *)odr_malloc(o, sizeof(int));
47 return ber_boolean(o, *p);
52 * c-file-style: "Stroustrup"
53 * indent-tabs-mode: nil
55 * vim: shiftwidth=4 tabstop=8 expandtab