83 |
#include <stdlib.h> |
#include <stdlib.h> |
84 |
#include <string.h> |
#include <string.h> |
85 |
|
|
86 |
#ifndef PCRE_SPY |
/* When compiling a DLL for Windows, the exported symbols have to be declared |
87 |
#define PCRE_DEFINITION /* Win32 __declspec(export) trigger for .dll */ |
using some MS magic. I found some useful information on this web page: |
88 |
|
http://msdn2.microsoft.com/en-us/library/y4h7bcy6(VS.80).aspx. According to the |
89 |
|
information there, using __declspec(dllesport) without "extern" we have a |
90 |
|
definition; with "extern" we have a declaration. The settings here override the |
91 |
|
setting in pcre.h (which is included below); it defines only PCRE_EXP_DECL, |
92 |
|
which is all that is needed for applications, which import the symbols. We use: |
93 |
|
|
94 |
|
PCRE_EXP_DECL for declarations |
95 |
|
PCRE_EXP_DEFN for definitions of exported functions |
96 |
|
PCRE_EXP_DATA_DEFN for definitions of exported variables |
97 |
|
|
98 |
|
The reason for the two DEFN macros is that in non-Windows environments, one |
99 |
|
does not want to have "extern" before variable definitions because it leads to |
100 |
|
compiler warnings. So we distinguish between functions and variables. In |
101 |
|
Windows, the two should always be the same. |
102 |
|
|
103 |
|
The reason for wrapping this in #ifndef PCRE_EXP_DECL is so that pcretest, |
104 |
|
which is an application, but needs to import this file in order to "peek" at |
105 |
|
internals, can #include pcre.h first, can get an application's-eye view. |
106 |
|
|
107 |
|
In principle, people compiling for non-Windows, non-Unix-like (i.e. uncommon, |
108 |
|
special-purpose environments) might want to stick other stuff in front of |
109 |
|
exported symbols. That's why, in the non-Windows case, we set PCRE_EXP_DEFN and |
110 |
|
PCRE_EXP_DATA_DEFN only if they are not already set. */ |
111 |
|
|
112 |
|
#ifndef PCRE_EXP_DECL |
113 |
|
# ifdef _WIN32 |
114 |
|
# ifdef DLL_EXPORT |
115 |
|
# define PCRE_EXP_DECL extern __declspec(dllexport) |
116 |
|
# define PCRE_EXP_DEFN __declspec(dllexport) |
117 |
|
# define PCRE_EXP_DATA_DEFN __declspec(dllexport) |
118 |
|
# else |
119 |
|
# define PCRE_EXP_DECL extern |
120 |
|
# define PCRE_EXP_DEFN |
121 |
|
# define PCRE_EXP_DATA_DEFN |
122 |
|
# endif |
123 |
|
# |
124 |
|
# else |
125 |
|
# ifdef __cplusplus |
126 |
|
# define PCRE_EXP_DECL extern "C" |
127 |
|
# else |
128 |
|
# define PCRE_EXP_DECL extern |
129 |
|
# endif |
130 |
|
# ifndef PCRE_EXP_DEFN |
131 |
|
# define PCRE_EXP_DEFN PCRE_EXP_DECL |
132 |
|
# endif |
133 |
|
# ifndef PCRE_EXP_DATA_DEFN |
134 |
|
# define PCRE_EXP_DATA_DEFN |
135 |
|
# endif |
136 |
|
# endif |
137 |
#endif |
#endif |
138 |
|
|
139 |
/* We need to have types that specify unsigned 16-bit and 32-bit integers. We |
/* We need to have types that specify unsigned 16-bit and 32-bit integers. We |
227 |
#define USPTR const unsigned char * |
#define USPTR const unsigned char * |
228 |
#endif |
#endif |
229 |
|
|
230 |
|
|
231 |
|
|
232 |
/* Include the public PCRE header and the definitions of UCP character property |
/* Include the public PCRE header and the definitions of UCP character property |
233 |
values. */ |
values. */ |
234 |
|
|
235 |
#include "pcre.h" |
#include <pcre.h> |
236 |
#include "ucp.h" |
#include "ucp.h" |
237 |
|
|
238 |
/* When compiling for use with the Virtual Pascal compiler, these functions |
/* When compiling for use with the Virtual Pascal compiler, these functions |
253 |
is set. Otherwise, include an emulating function for those systems that have |
is set. Otherwise, include an emulating function for those systems that have |
254 |
neither (there some non-Unix environments where this is the case). */ |
neither (there some non-Unix environments where this is the case). */ |
255 |
|
|
256 |
#if ! HAVE_MEMMOVE |
#ifndef HAVE_MEMMOVE |
257 |
#undef memmove /* some systems may have a macro */ |
#undef memmove /* some systems may have a macro */ |
258 |
#if HAVE_BCOPY |
#ifdef HAVE_BCOPY |
259 |
#define memmove(a, b, c) bcopy(b, a, c) |
#define memmove(a, b, c) bcopy(b, a, c) |
260 |
#else /* HAVE_BCOPY */ |
#else /* HAVE_BCOPY */ |
261 |
static void * |
static void * |
274 |
else |
else |
275 |
{ |
{ |
276 |
for (i = 0; i < n; ++i) *dest++ = *src++; |
for (i = 0; i < n; ++i) *dest++ = *src++; |
277 |
return (void *)(dest - n); |
return (void *)(dest - n); |
278 |
} |
} |
279 |
} |
} |
280 |
#define memmove(a, b, c) pcre_memmove(a, b, c) |
#define memmove(a, b, c) pcre_memmove(a, b, c) |
281 |
#endif /* not HAVE_BCOPY */ |
#endif /* not HAVE_BCOPY */ |