// $Id$ --*- c -*--
-// Copyright (C) 2003 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
+// Copyright (C) 2004 Enrico Scholz <enrico.scholz@informatik.tu-chemnitz.de>
//
// This program is free software; you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-#ifndef H_VSERVER_DJINNI_SRC_FMT_H
-#define H_VSERVER_DJINNI_SRC_FMT_H
+#ifndef H_UTIL_VSERVER_LIB_FMT_H
+#define H_UTIL_VSERVER_LIB_FMT_H
-#include <stdlib.h>
-#include <stdint.h>
+#include "../ensc_fmt/fmt.h"
-#ifndef FMT_PREFIX
-# define FMT_PREFIX fmt_
-#endif
-
-#define FMT_P__(X,Y) X ## Y
-#define FMT_P_(X,Y) FMT_P__(X,Y)
-#define FMT_P(X) FMT_P_(FMT_PREFIX, X)
-
-#define STRINGIFY_(X) #X
-#define STRINGIFY(X) STRINGIFY_(X)
-#define WEAKFUNC(X) __attribute__((__weak__,__alias__(STRINGIFY(FMT_P(X)))))
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-size_t FMT_P(xuint64)(char *ptr, uint_least64_t val);
-size_t FMT_P( xint64)(char *ptr, int_least64_t val);
-
-size_t FMT_P(xuint32)(char *ptr, uint_least32_t val);
-size_t FMT_P( xint32)(char *ptr, int_least32_t val);
-
-size_t FMT_P(uint64_base)(char *ptr, uint_least64_t val, char base);
-size_t FMT_P( int64_base)(char *ptr, int_least64_t val, char base);
-
-size_t FMT_P(uint32_base)(char *ptr, uint_least32_t val, char base);
-size_t FMT_P( int32_base)(char *ptr, int_least32_t val, char base);
-
-#if __WORDSIZE == 64
-size_t FMT_P(ulong_base)(char *ptr, unsigned long val, char base) WEAKFUNC(uint64_base);
-size_t FMT_P( long_base)(char *ptr, long val, char base) WEAKFUNC( int64_base);
-size_t FMT_P(xulong) (char *ptr, unsigned long val) WEAKFUNC(xuint64);
-size_t FMT_P( xlong) (char *ptr, long val) WEAKFUNC( xint64);
-#else
-size_t FMT_P(ulong_base)(char *ptr, unsigned long val, char base) WEAKFUNC(uint32_base);
-size_t FMT_P( long_base)(char *ptr, long val, char base) WEAKFUNC( int32_base);
-size_t FMT_P(xulong) (char *ptr, unsigned long val) WEAKFUNC(xuint32);
-size_t FMT_P( xlong) (char *ptr, long val) WEAKFUNC( xint32);
-#endif
-
-size_t FMT_P(uint_base)(char *ptr, unsigned int val, char base) WEAKFUNC(uint32_base);
-size_t FMT_P( int_base)(char *ptr, int val, char base) WEAKFUNC( int32_base);
-size_t FMT_P(xuint) (char *ptr, unsigned int val, char base) WEAKFUNC(xuint32);
-size_t FMT_P( xint) (char *ptr, int val, char base) WEAKFUNC( xint32);
-
-inline static size_t
-FMT_P(uint64)(char *ptr, uint_least64_t val)
-{
- return FMT_P(uint64_base)(ptr, val, 10);
-}
-
-inline static size_t
-FMT_P(int64)(char *ptr, uint_least64_t val)
-{
- return FMT_P(int64_base)(ptr, val, 10);
-}
-
-inline static size_t
-FMT_P(uint32)(char *ptr, uint_least32_t val)
-{
- return FMT_P(uint32_base)(ptr, val, 10);
-}
-
-inline static size_t
-FMT_P(int32)(char *ptr, uint_least32_t val)
-{
- return FMT_P(int32_base)(ptr, val, 10);
-}
-
-inline static size_t
-FMT_P(ulong)(char *ptr, unsigned long val)
-{
- return FMT_P(ulong_base)(ptr, val, 10);
-}
-
-inline static size_t
-FMT_P(long)(char *ptr, long val)
-{
- return FMT_P(long_base)(ptr, val, 10);
-}
-
-
-inline static size_t
-FMT_P(uint)(char *ptr, unsigned int val)
-{
- return FMT_P(uint_base)(ptr, val, 10);
-}
-
-inline static size_t
-FMT_P(int)(char *ptr, int val)
-{
- return FMT_P(int_base)(ptr, val, 10);
-}
-
-
-#ifdef __cplusplus
-}
-#endif
-
-#undef WEAKFUNC
-#undef STRINGIFY
-#undef STRINGIFY_
-#undef FMT_P
-#undef FMT_P_
-#undef FMT_P__
-
-#endif // H_VSERVER_DJINNI_SRC_FMT_H
+#endif // H_UTIL_VSERVER_LIB_FMT_H