IDZEBRA  2.1.2
util.h
Go to the documentation of this file.
1 /* This file is part of the Zebra server.
2  Copyright (C) Index Data
3 
4 Zebra is free software; you can redistribute it and/or modify it under
5 the terms of the GNU General Public License as published by the Free
6 Software Foundation; either version 2, or (at your option) any later
7 version.
8 
9 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10 WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 for more details.
13 
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
17 
18 */
19 
20 #ifndef ZEBRA_UTIL_H
21 #define ZEBRA_UTIL_H
22 
23 #include <yaz/yconfig.h>
24 #include <yaz/log.h>
25 
34 #ifdef __GNUC__
35 #if __GNUC__ >= 4
36 #define ZEBRA_GCC_ATTR(x) __attribute__ (x)
37 #endif
38 #endif
39 
40 #ifndef ZEBRA_GCC_ATTR
41 #define ZEBRA_GCC_ATTR(x)
42 #endif
43 
44 YAZ_BEGIN_CDECL
45 
53 #ifdef WIN32
54 typedef __int64 zint;
55 #define ZINT_FORMAT0 "I64d"
56 #else
57 
58 #ifndef ZEBRA_ZINT
59 #error ZEBRA_ZINT undefined. idzebra-config not in use?
60 #endif
61 
62 #if ZEBRA_ZINT > 0
63 typedef long long int zint;
64 #define ZINT_FORMAT0 "lld"
65 #else
66 typedef long zint;
67 #define ZINT_FORMAT0 "ld"
68 #endif
69 
70 #endif
71 
72 #define ZINT_FORMAT "%" ZINT_FORMAT0
73 
80 typedef short ZEBRA_RES;
81 #define ZEBRA_FAIL -1
82 #define ZEBRA_OK 0
83 
84 YAZ_EXPORT zint atoi_zn(const char *buf, zint len);
85 
86 YAZ_EXPORT void zebra_zint_encode(char **dst, zint pos);
87 
88 YAZ_EXPORT void zebra_zint_decode(const char **src, zint *pos);
89 
90 YAZ_EXPORT void zebra_exit(const char *msg);
91 
92 YAZ_EXPORT zint atozint(const char *src);
93 
94 YAZ_END_CDECL
95 
96 #define CAST_ZINT_TO_INT(x) (int)(x)
97 #define CAST_ZINT_TO_DOUBLE(x) (double)(x)
98 
99 #endif
100 /*
101  * Local variables:
102  * c-basic-offset: 4
103  * c-file-style: "Stroustrup"
104  * indent-tabs-mode: nil
105  * End:
106  * vim: shiftwidth=4 tabstop=8 expandtab
107  */
108 
zint atoi_zn(const char *buf, zint len)
Definition: atoi_zn.c:27
zint atozint(const char *src)
Definition: zint.c:55
void zebra_zint_decode(const char **src, zint *pos)
Definition: zint.c:39
void zebra_exit(const char *msg)
Definition: exit.c:26
void zebra_zint_encode(char **dst, zint pos)
Definition: zint.c:26
long zint
Zebra integer.
Definition: util.h:66
short ZEBRA_RES
Common return type for Zebra API.
Definition: util.h:80