diff -ruN libtextcat-2.2.orig/src/common.c libtextcat-2.2/src/common.c --- libtextcat-2.2.orig/src/common.c 2007-06-27 17:02:34.000000000 +0100 +++ libtextcat-2.2/src/common.c 2007-06-27 17:45:16.000000000 +0100 @@ -45,7 +45,7 @@ #endif #include #include -#include "common.h" +#include "common_impl.h" extern void wgmem_error( const char *fmt, ... ) { @@ -55,8 +55,6 @@ va_start(ap, fmt); vfprintf(stderr, fmt, ap); va_end(ap); - - exit(-1); } diff -ruN libtextcat-2.2.orig/src/common_impl.h libtextcat-2.2/src/common_impl.h --- libtextcat-2.2.orig/src/common_impl.h 1970-01-01 01:00:00.000000000 +0100 +++ libtextcat-2.2/src/common_impl.h 2007-06-27 17:45:16.000000000 +0100 @@ -0,0 +1,66 @@ +#ifndef _COMMON_IMPL_H_ +#define _COMMON_IMPL_H_ +/** + * common_impl.h -- a mixed bag of helper functions + * + * Copyright (C) 2003 WiseGuys Internet B.V. + * + * THE BSD LICENSE + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * - Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * + * - Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the + * distribution. + * + * - Neither the name of the WiseGuys Internet B.V. nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR + * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT + * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#ifndef HAVE_MALLOC +#error "This library needs a GNU like malloc to compile. 'configure' says there isn't one." +#endif +#ifndef HAVE_REALLOC +#error "This library needs a GNU like realloc to compile. 'configure' says there isn't one." +#endif +#ifndef HAVE_STRDUP +#error "This library needs a GNU like strdup to compile. 'configure' says there isn't one." +#endif +#ifdef HAVE_INTTYPES_H +#include +#else +#ifdef HAVE_STDINT_H +#include +#endif +#endif +#ifdef HAVE_SYS_TIME_H +#include +#endif +#include "common.h" + +#define WGMIN(x,y) ((x)<=(y)?(x):(y)) +#define WGMAX(x,y) ((x)<=(y)?(y):(x)) +#define __STR__(x) #x +#define WGSTR(x) __STR__(x) + +#endif diff -ruN libtextcat-2.2.orig/src/createfp.c libtextcat-2.2/src/createfp.c --- libtextcat-2.2.orig/src/createfp.c 2007-06-27 17:02:34.000000000 +0100 +++ libtextcat-2.2/src/createfp.c 2007-06-27 17:45:16.000000000 +0100 @@ -44,7 +44,7 @@ #endif #include "fingerprint.h" -#include "common.h" +#include "common_impl.h" #define BLOCKSIZE 4096 diff -ruN libtextcat-2.2.orig/src/fingerprint.c libtextcat-2.2/src/fingerprint.c --- libtextcat-2.2.orig/src/fingerprint.c 2007-06-27 17:02:34.000000000 +0100 +++ libtextcat-2.2/src/fingerprint.c 2007-06-27 17:45:16.000000000 +0100 @@ -76,7 +76,7 @@ #endif #include -#include "common.h" +#include "common_impl.h" #include "wg_mempool.h" #include "constants.h" diff -ruN libtextcat-2.2.orig/src/Makefile.am libtextcat-2.2/src/Makefile.am --- libtextcat-2.2.orig/src/Makefile.am 2007-06-27 17:02:34.000000000 +0100 +++ libtextcat-2.2/src/Makefile.am 2007-06-27 17:47:40.000000000 +0100 @@ -8,7 +8,11 @@ AM_LDFLAGS = -g noinst_HEADERS = \ - common.h constants.h fingerprint.h textcat.h wg_mempool.h + common_impl.h wg_mempool.h + +libtextcat_includedir = $(includedir)/libtextcat +libtextcat_include_HEADERS = \ + common.h constants.h fingerprint.h textcat.h lib_LTLIBRARIES = libtextcat.la libtextcat_la_SOURCES = \ diff -ruN libtextcat-2.2.orig/src/testtextcat.c libtextcat-2.2/src/testtextcat.c --- libtextcat-2.2.orig/src/testtextcat.c 2007-06-27 17:02:34.000000000 +0100 +++ libtextcat-2.2/src/testtextcat.c 2007-06-27 17:45:16.000000000 +0100 @@ -47,7 +47,7 @@ #endif #include "textcat.h" -#include "common.h" +#include "common_impl.h" #define BLOCKSIZE 4096 diff -ruN libtextcat-2.2.orig/src/textcat.c libtextcat-2.2/src/textcat.c --- libtextcat-2.2.orig/src/textcat.c 2007-06-27 17:02:34.000000000 +0100 +++ libtextcat-2.2/src/textcat.c 2007-06-27 17:45:16.000000000 +0100 @@ -65,7 +65,7 @@ #include #endif -#include "common.h" +#include "common_impl.h" #include "fingerprint.h" #include "textcat.h" #include "constants.h" diff -ruN libtextcat-2.2.orig/src/wg_mempool.c libtextcat-2.2/src/wg_mempool.c --- libtextcat-2.2.orig/src/wg_mempool.c 2007-06-27 17:02:34.000000000 +0100 +++ libtextcat-2.2/src/wg_mempool.c 2007-06-27 17:45:16.000000000 +0100 @@ -41,7 +41,7 @@ #ifdef HAVE_STRING_H #include #endif -#include "common.h" +#include "common_impl.h" typedef struct memblock_s { char *pool; diff -ru libtextcat-2.2.orig/src/common.h libtextcat-2.2/src/common.h --- libtextcat-2.2.orig/src/common.h 2003-05-22 14:02:29.000000000 +0100 +++ libtextcat-2.2/src/common.h 2007-06-28 09:10:42.000000000 +0100 @@ -1,7 +1,7 @@ #ifndef _COMMON_H_ #define _COMMON_H_ /** - * common.h -- a mixed bag of helper functions + * common.h * * Copyright (C) 2003 WiseGuys Internet B.V. * @@ -36,56 +36,25 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#include "config.h" -#ifndef HAVE_MALLOC -#error "This library needs a GNU like malloc to compile. 'configure' says there isn't one." -#endif -#ifndef HAVE_REALLOC -#error "This library needs a GNU like realloc to compile. 'configure' says there isn't one." -#endif -#ifndef HAVE_STRDUP -#error "This library needs a GNU like strdup to compile. 'configure' says there isn't one." -#endif #include -#ifdef HAVE_INTTYPES_H #include -#else -#ifdef HAVE_STDINT_H -#include -#endif -#endif -#ifdef HAVE_SYS_TIME_H -#include -#endif #include -#define WGMIN(x,y) ((x)<=(y)?(x):(y)) -#define WGMAX(x,y) ((x)<=(y)?(y):(x)) -#define __STR__(x) #x -#define WGSTR(x) __STR__(x) - -#ifdef HAVE_INTTYPES_H -typedef uint32_t uint4; -typedef uint16_t uint2; -typedef uint8_t uchar; - -typedef int32_t sint4; -typedef int16_t sint2; -typedef int8_t schar; - -typedef int8_t boole; -#else -typedef unsigned long uint4; -typedef unsigned int uint2; -typedef unsigned char uchar; - -typedef long sint4; -typedef int sint2; -typedef char schar; - -typedef char boole; +#include +#ifdef __cplusplus +extern "C" { #endif +typedef uint32_t uint4; +typedef uint16_t uint2; +typedef uint8_t uchar; + +typedef int32_t sint4; +typedef int16_t sint2; +typedef int8_t schar; + +typedef int8_t boole; + typedef struct wgtimer_s { struct timeval start; struct timeval stop; @@ -108,6 +76,8 @@ extern char *wg_strgmov( char *dest, const char *src, const char *destlimit ); extern char *wg_trim( char *dest, const char *src ); +#ifdef __cplusplus +} +#endif #endif - diff -ru libtextcat-2.2.orig/src/fingerprint.h libtextcat-2.2/src/fingerprint.h --- libtextcat-2.2.orig/src/fingerprint.h 2003-05-19 13:16:31.000000000 +0100 +++ libtextcat-2.2/src/fingerprint.h 2007-06-28 09:11:17.000000000 +0100 @@ -35,6 +35,10 @@ */ #include "common.h" +#ifdef __cplusplus +extern "C" { +#endif + extern void *fp_Init(const char *name); extern void fp_Done( void *handle ); extern int fp_Create( void *handle, const char *buffer, uint4 bufsize, uint4 maxngrams ); @@ -44,4 +48,8 @@ extern const char *fp_Name( void *handle ); extern void fp_Print( void *handle, FILE *fp ); +#ifdef __cplusplus +} +#endif + #endif --- libtextcat-2.2.orig/src/textcat.h 2007-06-28 09:19:26.000000000 +0100 +++ libtextcat-2.2/src/textcat.h 2007-06-28 09:20:19.000000000 +0100 @@ -37,6 +37,10 @@ */ #include +#ifdef __cplusplus +extern "C" { +#endif + #define _TEXTCAT_RESULT_UNKOWN "UNKNOWN" #define _TEXTCAT_RESULT_SHORT "SHORT" @@ -77,4 +81,9 @@ * textcat_Version() - Returns a string describing the version of this classifier. */ extern char *textcat_Version(); + +#ifdef __cplusplus +} +#endif + #endif