1 /* $Id: util.h,v 1.9 2006-10-10 14:45:42 adam Exp $
2 Copyright (C) 1995-2006
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>
31 /* check that we don't have all too old yaz */
33 #error Need a modern yaz with YLOG_ defines
39 * \brief Zebra integer
41 * This integer is used in various Zebra APIs to specify record identifires,
42 * number of occurrences etc. It is a "large" integer and is usually
43 * 64-bit on newer architectures.
47 #define ZINT_FORMAT0 "I64d"
51 #error ZEBRA_ZINT undefined. idzebra-config not in use?
55 typedef long long int zint;
56 #define ZINT_FORMAT0 "lld"
59 #define ZINT_FORMAT0 "ld"
64 #define ZINT_FORMAT "%" ZINT_FORMAT0
66 /** \var typedef ZEBRA_RES
67 * \brief Common return type for Zebra API
69 * This return code indicates success with code ZEBRA_OK and failure
72 typedef short ZEBRA_RES;
79 zint atoi_zn (const char *buf, zint len);
82 void zebra_zint_encode(char **dst, zint pos);
85 void zebra_zint_decode(const char **src, zint *pos);
89 #define CAST_ZINT_TO_INT(x) (int)(x)
90 #define CAST_ZINT_TO_DOUBLE(x) (double)(x)
96 * indent-tabs-mode: nil
98 * vim: shiftwidth=4 tabstop=8 expandtab