X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=include%2Fidzebra%2Futil.h;h=831ef3f7aeaa12075ce670feb0074603ba62bdbf;hb=b04a1cdb1a0345252a78caa8f7731089df314ad0;hp=ea7baec7805fd2aff4d6c0cc1a5194ad9137570d;hpb=34552d7bc714468512b1873f1d6b75608d6b4655;p=idzebra-moved-to-github.git diff --git a/include/idzebra/util.h b/include/idzebra/util.h index ea7baec..831ef3f 100644 --- a/include/idzebra/util.h +++ b/include/idzebra/util.h @@ -1,5 +1,5 @@ -/* $Id: util.h,v 1.5 2005-11-09 11:51:29 adam Exp $ - Copyright (C) 1995-2005 +/* $Id: util.h,v 1.13 2006-12-22 13:48:20 adam Exp $ + Copyright (C) 1995-2006 Index Data ApS This file is part of the Zebra server. @@ -15,9 +15,9 @@ FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with Zebra; see the file LICENSE.zebra. If not, write to the -Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA -02111-1307, USA. +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + */ #ifndef ZEBRA_UTIL_H @@ -28,6 +28,24 @@ Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA #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,23 +91,44 @@ 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 -zint atoi_zn (const char *buf, zint len); +YAZ_EXPORT void zebra_zint_encode(char **dst, zint pos); -YAZ_EXPORT -void zebra_zint_encode(char **dst, zint pos); +YAZ_EXPORT void zebra_zint_decode(const char **src, zint *pos); + +YAZ_EXPORT void zebra_exit(const char *msg); +typedef struct zebra_timing *zebra_timing_t; + +YAZ_EXPORT +zebra_timing_t zebra_timing_create(void); YAZ_EXPORT -void zebra_zint_decode(const char **src, zint *pos); +void zebra_timing_start(zebra_timing_t t); +YAZ_EXPORT +void zebra_timing_stop(zebra_timing_t t); +YAZ_EXPORT +double zebra_timing_get_real(zebra_timing_t t); +YAZ_EXPORT +double zebra_timing_get_user(zebra_timing_t t); +YAZ_EXPORT +double zebra_timing_get_sys(zebra_timing_t t); +YAZ_EXPORT +void zebra_timing_destroy(zebra_timing_t *tp); + +YAZ_EXPORT zint atozint(const char *src); YAZ_END_CDECL #define CAST_ZINT_TO_INT(x) (int)(x) #define CAST_ZINT_TO_DOUBLE(x) (double)(x) -/* NATTR=1 for string-attribute architecture, =0 for set+use . */ -#define NATTR 0 - #endif +/* + * Local variables: + * c-basic-offset: 4 + * indent-tabs-mode: nil + * End: + * vim: shiftwidth=4 tabstop=8 expandtab + */ +