IDZEBRA 2.2.8
util.h
Go to the documentation of this file.
1/* This file is part of the Zebra server.
2 Copyright (C) Index Data
3
4Zebra is free software; you can redistribute it and/or modify it under
5the terms of the GNU General Public License as published by the Free
6Software Foundation; either version 2, or (at your option) any later
7version.
8
9Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
10WARRANTY; without even the implied warranty of MERCHANTABILITY or
11FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12for more details.
13
14You should have received a copy of the GNU General Public License
15along with this program; if not, write to the Free Software
16Foundation, 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
44YAZ_BEGIN_CDECL
45
53#ifdef WIN32
54typedef __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
63typedef long long int zint;
64#define ZINT_FORMAT0 "lld"
65#else
66typedef long zint;
67#define ZINT_FORMAT0 "ld"
68#endif
69
70#endif
71
72#define ZINT_FORMAT "%" ZINT_FORMAT0
73
80typedef short ZEBRA_RES;
81#define ZEBRA_FAIL -1
82#define ZEBRA_OK 0
83
84YAZ_EXPORT zint atoi_zn(const char *buf, zint len);
85
86YAZ_EXPORT void zebra_zint_encode(char **dst, zint pos);
87
88YAZ_EXPORT void zebra_zint_decode(const char **src, zint *pos);
89
90YAZ_EXPORT void zebra_exit(const char *msg);
91
92YAZ_EXPORT zint atozint(const char *src);
93
94YAZ_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
long zint
Zebra integer.
Definition util.h:66
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
zint atozint(const char *src)
Definition zint.c:55
short ZEBRA_RES
Common return type for Zebra API.
Definition util.h:80
zint atoi_zn(const char *buf, zint len)
Definition atoi_zn.c:27