summaryrefslogtreecommitdiff
path: root/extra/libtextcat/libtextcat-2.2-exportapi.patch
blob: acf84e099f8dadfd37addda6c387ebc27c5ebf85 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
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 <stdarg.h>
 #include <ctype.h>
-#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 <inttypes.h>
+#else
+#ifdef HAVE_STDINT_H
+#include <stdint.h>
+#endif
+#endif
+#ifdef HAVE_SYS_TIME_H
+#include <sys/time.h>
+#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 <ctype.h>
 
-#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 <alloca.h>
 #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 <string.h>
 #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 <stdio.h>
-#ifdef HAVE_INTTYPES_H
 #include <inttypes.h>
-#else
-#ifdef HAVE_STDINT_H
-#include <stdint.h>
-#endif
-#endif
-#ifdef HAVE_SYS_TIME_H
-#include <sys/time.h>
-#endif
 #include <time.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)
-
-#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 <sys/time.h>
+#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 <stdio.h>
 
+#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