YAZ 5.35.1
proxunit.c
Go to the documentation of this file.
1/* This file is part of the YAZ toolkit.
2 * Copyright (C) Index Data
3 * See the file LICENSE for details.
4 */
9#if HAVE_CONFIG_H
10#include <config.h>
11#endif
12
13#include <string.h>
14#include <yaz/proxunit.h>
15#include <yaz/z-core.h>
16
17/* Hand-written, but in reality depends on z3950v3.asn */
18static const char *units[] = {
19 0,
20 "character",
21 "word",
22 "sentence",
23 "paragraph",
24 "section",
25 "chapter",
26 "document",
27 "element",
28 "subelement",
29 "elementType",
30 "byte"
31};
32
33const char *z_ProxUnit_to_str(int u)
34{
36 return units[u];
37 return 0;
38}
39
40int z_str_to_ProxUnit(const char *str)
41{
42 int i;
43 for (i = 1; i <= Z_ProxUnit_byte; i++)
44 if (!strcmp(units[i], str))
45 return i;
46 return 0;
47}
48
49/*
50 * Local variables:
51 * c-basic-offset: 4
52 * c-file-style: "Stroustrup"
53 * indent-tabs-mode: nil
54 * End:
55 * vim: shiftwidth=4 tabstop=8 expandtab
56 */
static const char * units[]
Definition proxunit.c:18
int z_str_to_ProxUnit(const char *str)
converts unit name string to unit integer
Definition proxunit.c:40
const char * z_ProxUnit_to_str(int u)
converts prox unit integer to string
Definition proxunit.c:33
Header for JSON functions.
ASN.1 Module Z39-50-APDU-1995.
#define Z_ProxUnit_byte
Definition z-core.h:621
#define Z_ProxUnit_character
Definition z-core.h:611