1 /* $Id: util.h,v 1.15 2007-01-15 20:08:24 adam Exp $
2 Copyright (C) 1995-2007
5 This file is part of the Zebra server.
7 Zebra is free software; you can redistribute it and/or modify it under
8 the terms of the GNU General Public License as published by the Free
9 Software Foundation; either version 2, or (at your option) any later
12 Zebra is distributed in the hope that it will be useful, but WITHOUT ANY
13 WARRANTY; without even the implied warranty of MERCHANTABILITY or
14 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
26 #include <yaz/yconfig.h>
29 #include <idzebra/version.h>
32 expand GCC_ATTRIBUTE if GCC is in use. See :
33 http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html
35 To see gcc pre-defines for c:
36 gcc -E -dM -x c /dev/null
41 #define ZEBRA_GCC_ATTR(x) __attribute__ (x)
45 #ifndef ZEBRA_GCC_ATTR
46 #define ZEBRA_GCC_ATTR(x)
49 /* check that we don't have all too old yaz */
51 #error Need a modern yaz with YLOG_ defines
57 * \brief Zebra integer
59 * This integer is used in various Zebra APIs to specify record identifires,
60 * number of occurrences etc. It is a "large" integer and is usually
61 * 64-bit on newer architectures.
65 #define ZINT_FORMAT0 "I64d"
69 #error ZEBRA_ZINT undefined. idzebra-config not in use?
73 typedef long long int zint;
74 #define ZINT_FORMAT0 "lld"
77 #define ZINT_FORMAT0 "ld"
82 #define ZINT_FORMAT "%" ZINT_FORMAT0
84 /** \var typedef ZEBRA_RES
85 * \brief Common return type for Zebra API
87 * This return code indicates success with code ZEBRA_OK and failure
90 typedef short ZEBRA_RES;
94 YAZ_EXPORT zint atoi_zn(const char *buf, zint len);
96 YAZ_EXPORT void zebra_zint_encode(char **dst, zint pos);
98 YAZ_EXPORT void zebra_zint_decode(const char **src, zint *pos);
100 YAZ_EXPORT void zebra_exit(const char *msg);
102 YAZ_EXPORT zint atozint(const char *src);
106 #define CAST_ZINT_TO_INT(x) (int)(x)
107 #define CAST_ZINT_TO_DOUBLE(x) (double)(x)
113 * indent-tabs-mode: nil
115 * vim: shiftwidth=4 tabstop=8 expandtab