X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=include%2Fidzebra%2Futil.h;h=3e7a8902fcbcdd48a490f9c284cf8db6b2628f30;hb=5a8a42bede922e70156e7b289db071592c71529b;hp=59526557804e1e0b6fcd81d5d969f6b63fdca13c;hpb=4478d785b7769691261005c98063b98a5a5971b3;p=idzebra-moved-to-github.git diff --git a/include/idzebra/util.h b/include/idzebra/util.h index 5952655..3e7a890 100644 --- a/include/idzebra/util.h +++ b/include/idzebra/util.h @@ -1,5 +1,5 @@ -/* $Id: util.h,v 1.8 2006-08-14 10:40:14 adam Exp $ - Copyright (C) 1995-2006 +/* $Id: util.h,v 1.15 2007-01-15 20:08:24 adam Exp $ + Copyright (C) 1995-2007 Index Data ApS This file is part of the Zebra server. @@ -28,6 +28,24 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA #include +/** + expand GCC_ATTRIBUTE if GCC is in use. See : + http://gcc.gnu.org/onlinedocs/gcc/Function-Attributes.html + + To see gcc pre-defines for c: + gcc -E -dM -x c /dev/null +*/ + +#ifdef __GNUC__ +#if __GNUC__ >= 4 +#define ZEBRA_GCC_ATTR(x) __attribute__ (x) +#endif +#endif + +#ifndef ZEBRA_GCC_ATTR +#define ZEBRA_GCC_ATTR(x) +#endif + /* check that we don't have all too old yaz */ #ifndef YLOG_ERRNO #error Need a modern yaz with YLOG_ defines @@ -42,22 +60,27 @@ YAZ_BEGIN_CDECL * number of occurrences etc. It is a "large" integer and is usually * 64-bit on newer architectures. */ -#ifdef __GNUC__ -typedef long long int zint; -#define ZINT_FORMAT "%lld" -#define ZINT_FORMAT0 "lld" -#else #ifdef WIN32 typedef __int64 zint; -#define ZINT_FORMAT "%I64d" #define ZINT_FORMAT0 "I64d" #else + +#ifndef ZEBRA_ZINT +#error ZEBRA_ZINT undefined. idzebra-config not in use? +#endif + +#if ZEBRA_ZINT > 0 +typedef long long int zint; +#define ZINT_FORMAT0 "lld" +#else typedef long zint; -#define ZINT_FORMAT "%ld" #define ZINT_FORMAT0 "ld" #endif + #endif +#define ZINT_FORMAT "%" ZINT_FORMAT0 + /** \var typedef ZEBRA_RES * \brief Common return type for Zebra API * @@ -68,16 +91,15 @@ typedef short ZEBRA_RES; #define ZEBRA_FAIL -1 #define ZEBRA_OK 0 -typedef zint SYSNO; +YAZ_EXPORT zint atoi_zn(const char *buf, zint len); + +YAZ_EXPORT void zebra_zint_encode(char **dst, zint pos); -YAZ_EXPORT -zint atoi_zn (const char *buf, zint len); +YAZ_EXPORT void zebra_zint_decode(const char **src, zint *pos); -YAZ_EXPORT -void zebra_zint_encode(char **dst, zint pos); +YAZ_EXPORT void zebra_exit(const char *msg); -YAZ_EXPORT -void zebra_zint_decode(const char **src, zint *pos); +YAZ_EXPORT zint atozint(const char *src); YAZ_END_CDECL