PageRenderTime 71ms CodeModel.GetById 31ms RepoModel.GetById 0ms app.codeStats 1ms

/trunk/harbour/src/3rd/pcre/pcreinal.h

#
C Header | 1741 lines | 1126 code | 272 blank | 343 comment | 112 complexity | 304ca3a487d79e939bc373afa5ecbe05 MD5 | raw file
Possible License(s): AGPL-1.0, BSD-3-Clause, CC-BY-SA-3.0, LGPL-3.0, GPL-2.0, LGPL-2.0, LGPL-2.1

Large files files are truncated, but you can click here to view the full file

  1. /*************************************************
  2. * Perl-Compatible Regular Expressions *
  3. *************************************************/
  4. /* PCRE is a library of functions to support regular expressions whose syntax
  5. and semantics are as close as possible to those of the Perl 5 language.
  6. Written by Philip Hazel
  7. Copyright (c) 1997-2012 University of Cambridge
  8. -----------------------------------------------------------------------------
  9. Redistribution and use in source and binary forms, with or without
  10. modification, are permitted provided that the following conditions are met:
  11. * Redistributions of source code must retain the above copyright notice,
  12. this list of conditions and the following disclaimer.
  13. * Redistributions in binary form must reproduce the above copyright
  14. notice, this list of conditions and the following disclaimer in the
  15. documentation and/or other materials provided with the distribution.
  16. * Neither the name of the University of Cambridge nor the names of its
  17. contributors may be used to endorse or promote products derived from
  18. this software without specific prior written permission.
  19. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  20. AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  21. IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
  22. ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
  23. LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
  24. CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
  25. SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
  26. INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
  27. CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
  28. ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  29. POSSIBILITY OF SUCH DAMAGE.
  30. -----------------------------------------------------------------------------
  31. */
  32. /* This header contains definitions that are shared between the different
  33. modules, but which are not relevant to the exported API. This includes some
  34. functions whose names all begin with "_pcre_" or "_pcre16_" depending on
  35. the PRIV macro. */
  36. #ifndef PCRE_INTERNAL_H
  37. #define PCRE_INTERNAL_H
  38. /* Define PCRE_DEBUG to get debugging output on stdout. */
  39. #if 0
  40. #define PCRE_DEBUG
  41. #endif
  42. /* PCRE is compiled as an 8 bit library if it is not requested otherwise. */
  43. #ifndef COMPILE_PCRE16
  44. #define COMPILE_PCRE8
  45. #endif
  46. /* If SUPPORT_UCP is defined, SUPPORT_UTF must also be defined. The
  47. "configure" script ensures this, but not everybody uses "configure". */
  48. #if defined SUPPORT_UCP && !(defined SUPPORT_UTF)
  49. #define SUPPORT_UTF 1
  50. #endif
  51. /* We define SUPPORT_UTF if SUPPORT_UTF8 is enabled for compatibility
  52. reasons with existing code. */
  53. #if defined SUPPORT_UTF8 && !(defined SUPPORT_UTF)
  54. #define SUPPORT_UTF 1
  55. #endif
  56. /* Fixme: SUPPORT_UTF8 should be eventually disappear from the code.
  57. Until then we define it if SUPPORT_UTF is defined. */
  58. #if defined SUPPORT_UTF && !(defined SUPPORT_UTF8)
  59. #define SUPPORT_UTF8 1
  60. #endif
  61. /* We do not support both EBCDIC and UTF-8/16 at the same time. The "configure"
  62. script prevents both being selected, but not everybody uses "configure". */
  63. #if defined EBCDIC && defined SUPPORT_UTF
  64. #error The use of both EBCDIC and SUPPORT_UTF8/16 is not supported.
  65. #endif
  66. /* Use a macro for debugging printing, 'cause that eliminates the use of #ifdef
  67. inline, and there are *still* stupid compilers about that don't like indented
  68. pre-processor statements, or at least there were when I first wrote this. After
  69. all, it had only been about 10 years then...
  70. It turns out that the Mac Debugging.h header also defines the macro DPRINTF, so
  71. be absolutely sure we get our version. */
  72. #undef DPRINTF
  73. #ifdef PCRE_DEBUG
  74. #define DPRINTF(p) printf p
  75. #else
  76. #define DPRINTF(p) /* Nothing */
  77. #endif
  78. /* Standard C headers plus the external interface definition. The only time
  79. setjmp and stdarg are used is when NO_RECURSE is set. */
  80. #include <ctype.h>
  81. #include <limits.h>
  82. #include <stddef.h>
  83. #include <stdio.h>
  84. #include <stdlib.h>
  85. #include <string.h>
  86. /* When compiling a DLL for Windows, the exported symbols have to be declared
  87. 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(dllexport) 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 (they just import the symbols). We
  93. use:
  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. The reason for the two DEFN macros is that in non-Windows environments, one
  98. does not want to have "extern" before variable definitions because it leads to
  99. compiler warnings. So we distinguish between functions and variables. In
  100. Windows, the two should always be the same.
  101. The reason for wrapping this in #ifndef PCRE_EXP_DECL is so that pcretest,
  102. which is an application, but needs to import this file in order to "peek" at
  103. internals, can #include pcre.h first to get an application's-eye view.
  104. In principle, people compiling for non-Windows, non-Unix-like (i.e. uncommon,
  105. special-purpose environments) might want to stick other stuff in front of
  106. exported symbols. That's why, in the non-Windows case, we set PCRE_EXP_DEFN and
  107. PCRE_EXP_DATA_DEFN only if they are not already set. */
  108. #ifndef PCRE_EXP_DECL
  109. # ifdef _WIN32
  110. # ifndef PCRE_STATIC
  111. # define PCRE_EXP_DECL extern __declspec(dllexport)
  112. # define PCRE_EXP_DEFN __declspec(dllexport)
  113. # define PCRE_EXP_DATA_DEFN __declspec(dllexport)
  114. # else
  115. # define PCRE_EXP_DECL extern
  116. # define PCRE_EXP_DEFN
  117. # define PCRE_EXP_DATA_DEFN
  118. # endif
  119. # else
  120. # ifdef __cplusplus
  121. # define PCRE_EXP_DECL extern "C"
  122. # else
  123. # define PCRE_EXP_DECL extern
  124. # endif
  125. # ifndef PCRE_EXP_DEFN
  126. # define PCRE_EXP_DEFN PCRE_EXP_DECL
  127. # endif
  128. # ifndef PCRE_EXP_DATA_DEFN
  129. # define PCRE_EXP_DATA_DEFN
  130. # endif
  131. # endif
  132. #endif
  133. /* When compiling with the MSVC compiler, it is sometimes necessary to include
  134. a "calling convention" before exported function names. (This is secondhand
  135. information; I know nothing about MSVC myself). For example, something like
  136. void __cdecl function(....)
  137. might be needed. In order so make this easy, all the exported functions have
  138. PCRE_CALL_CONVENTION just before their names. It is rarely needed; if not
  139. set, we ensure here that it has no effect. */
  140. #ifndef PCRE_CALL_CONVENTION
  141. #define PCRE_CALL_CONVENTION
  142. #endif
  143. /* We need to have types that specify unsigned 8, 16 and 32-bit integers. We
  144. cannot determine these outside the compilation (e.g. by running a program as
  145. part of "configure") because PCRE is often cross-compiled for use on other
  146. systems. Instead we make use of the maximum sizes that are available at
  147. preprocessor time in standard C environments. */
  148. typedef unsigned char pcre_uint8;
  149. #if USHRT_MAX == 65535
  150. typedef unsigned short pcre_uint16;
  151. typedef short pcre_int16;
  152. #elif UINT_MAX == 65535
  153. typedef unsigned int pcre_uint16;
  154. typedef int pcre_int16;
  155. #else
  156. #error Cannot determine a type for 16-bit unsigned integers
  157. #endif
  158. #if UINT_MAX == 4294967295
  159. typedef unsigned int pcre_uint32;
  160. typedef int pcre_int32;
  161. #elif ULONG_MAX == 4294967295
  162. typedef unsigned long int pcre_uint32;
  163. typedef long int pcre_int32;
  164. #else
  165. #error Cannot determine a type for 32-bit unsigned integers
  166. #endif
  167. /* When checking for integer overflow in pcre_compile(), we need to handle
  168. large integers. If a 64-bit integer type is available, we can use that.
  169. Otherwise we have to cast to double, which of course requires floating point
  170. arithmetic. Handle this by defining a macro for the appropriate type. If
  171. stdint.h is available, include it; it may define INT64_MAX. Systems that do not
  172. have stdint.h (e.g. Solaris) may have inttypes.h. The macro int64_t may be set
  173. by "configure". */
  174. #if HAVE_STDINT_H
  175. #include <stdint.h>
  176. #elif HAVE_INTTYPES_H
  177. #include <inttypes.h>
  178. #endif
  179. #if defined INT64_MAX || defined int64_t
  180. #define INT64_OR_DOUBLE int64_t
  181. #else
  182. #define INT64_OR_DOUBLE double
  183. #endif
  184. /* All character handling must be done as unsigned characters. Otherwise there
  185. are problems with top-bit-set characters and functions such as isspace().
  186. However, we leave the interface to the outside world as char * or short *,
  187. because that should make things easier for callers. This character type is
  188. called pcre_uchar.
  189. The IN_UCHARS macro multiply its argument with the byte size of the current
  190. pcre_uchar type. Useful for memcpy and such operations, whose require the
  191. byte size of their input/output buffers.
  192. The MAX_255 macro checks whether its pcre_uchar input is less than 256.
  193. The TABLE_GET macro is designed for accessing elements of tables whose contain
  194. exactly 256 items. When the character is able to contain more than 256
  195. items, some check is needed before accessing these tables.
  196. */
  197. #ifdef COMPILE_PCRE8
  198. typedef unsigned char pcre_uchar;
  199. #define IN_UCHARS(x) (x)
  200. #define MAX_255(c) 1
  201. #define TABLE_GET(c, table, default) ((table)[c])
  202. #else
  203. #ifdef COMPILE_PCRE16
  204. #if USHRT_MAX != 65535
  205. /* This is a warning message. Change PCRE_UCHAR16 to a 16 bit data type in
  206. pcre.h(.in) and disable (comment out) this message. */
  207. #error Warning: PCRE_UCHAR16 is not a 16 bit data type.
  208. #endif
  209. typedef pcre_uint16 pcre_uchar;
  210. #define IN_UCHARS(x) ((x) << 1)
  211. #define MAX_255(c) ((c) <= 255u)
  212. #define TABLE_GET(c, table, default) (MAX_255(c)? ((table)[c]):(default))
  213. #else
  214. #error Unsupported compiling mode
  215. #endif /* COMPILE_PCRE16 */
  216. #endif /* COMPILE_PCRE8 */
  217. /* This is an unsigned int value that no character can ever have. UTF-8
  218. characters only go up to 0x7fffffff (though Unicode doesn't go beyond
  219. 0x0010ffff). */
  220. #define NOTACHAR 0xffffffff
  221. /* PCRE is able to support several different kinds of newline (CR, LF, CRLF,
  222. "any" and "anycrlf" at present). The following macros are used to package up
  223. testing for newlines. NLBLOCK, PSSTART, and PSEND are defined in the various
  224. modules to indicate in which datablock the parameters exist, and what the
  225. start/end of string field names are. */
  226. #define NLTYPE_FIXED 0 /* Newline is a fixed length string */
  227. #define NLTYPE_ANY 1 /* Newline is any Unicode line ending */
  228. #define NLTYPE_ANYCRLF 2 /* Newline is CR, LF, or CRLF */
  229. /* This macro checks for a newline at the given position */
  230. #define IS_NEWLINE(p) \
  231. ((NLBLOCK->nltype != NLTYPE_FIXED)? \
  232. ((p) < NLBLOCK->PSEND && \
  233. PRIV(is_newline)((p), NLBLOCK->nltype, NLBLOCK->PSEND, \
  234. &(NLBLOCK->nllen), utf)) \
  235. : \
  236. ((p) <= NLBLOCK->PSEND - NLBLOCK->nllen && \
  237. (p)[0] == NLBLOCK->nl[0] && \
  238. (NLBLOCK->nllen == 1 || (p)[1] == NLBLOCK->nl[1]) \
  239. ) \
  240. )
  241. /* This macro checks for a newline immediately preceding the given position */
  242. #define WAS_NEWLINE(p) \
  243. ((NLBLOCK->nltype != NLTYPE_FIXED)? \
  244. ((p) > NLBLOCK->PSSTART && \
  245. PRIV(was_newline)((p), NLBLOCK->nltype, NLBLOCK->PSSTART, \
  246. &(NLBLOCK->nllen), utf)) \
  247. : \
  248. ((p) >= NLBLOCK->PSSTART + NLBLOCK->nllen && \
  249. (p)[-NLBLOCK->nllen] == NLBLOCK->nl[0] && \
  250. (NLBLOCK->nllen == 1 || (p)[-NLBLOCK->nllen+1] == NLBLOCK->nl[1]) \
  251. ) \
  252. )
  253. /* When PCRE is compiled as a C++ library, the subject pointer can be replaced
  254. with a custom type. This makes it possible, for example, to allow pcre_exec()
  255. to process subject strings that are discontinuous by using a smart pointer
  256. class. It must always be possible to inspect all of the subject string in
  257. pcre_exec() because of the way it backtracks. Two macros are required in the
  258. normal case, for sign-unspecified and unsigned char pointers. The former is
  259. used for the external interface and appears in pcre.h, which is why its name
  260. must begin with PCRE_. */
  261. #ifdef CUSTOM_SUBJECT_PTR
  262. #define PCRE_PUCHAR CUSTOM_SUBJECT_PTR
  263. #else
  264. #define PCRE_PUCHAR const pcre_uchar *
  265. #endif
  266. /* Include the public PCRE header and the definitions of UCP character property
  267. values. */
  268. #include "pcre.h"
  269. #include "ucp.h"
  270. /* When compiling for use with the Virtual Pascal compiler, these functions
  271. need to have their names changed. PCRE must be compiled with the -DVPCOMPAT
  272. option on the command line. */
  273. #ifdef VPCOMPAT
  274. #define strlen(s) _strlen(s)
  275. #define strncmp(s1,s2,m) _strncmp(s1,s2,m)
  276. #define memcmp(s,c,n) _memcmp(s,c,n)
  277. #define memcpy(d,s,n) _memcpy(d,s,n)
  278. #define memmove(d,s,n) _memmove(d,s,n)
  279. #define memset(s,c,n) _memset(s,c,n)
  280. #else /* VPCOMPAT */
  281. /* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),
  282. define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY
  283. is set. Otherwise, include an emulating function for those systems that have
  284. neither (there some non-Unix environments where this is the case). */
  285. #ifndef HAVE_MEMMOVE
  286. #undef memmove /* some systems may have a macro */
  287. #ifdef HAVE_BCOPY
  288. #define memmove(a, b, c) bcopy(b, a, c)
  289. #else /* HAVE_BCOPY */
  290. static void *
  291. pcre_memmove(void *d, const void *s, size_t n)
  292. {
  293. size_t i;
  294. unsigned char *dest = (unsigned char *)d;
  295. const unsigned char *src = (const unsigned char *)s;
  296. if (dest > src)
  297. {
  298. dest += n;
  299. src += n;
  300. for (i = 0; i < n; ++i) *(--dest) = *(--src);
  301. return (void *)dest;
  302. }
  303. else
  304. {
  305. for (i = 0; i < n; ++i) *dest++ = *src++;
  306. return (void *)(dest - n);
  307. }
  308. }
  309. #define memmove(a, b, c) pcre_memmove(a, b, c)
  310. #endif /* not HAVE_BCOPY */
  311. #endif /* not HAVE_MEMMOVE */
  312. #endif /* not VPCOMPAT */
  313. /* PCRE keeps offsets in its compiled code as 2-byte quantities (always stored
  314. in big-endian order) by default. These are used, for example, to link from the
  315. start of a subpattern to its alternatives and its end. The use of 2 bytes per
  316. offset limits the size of the compiled regex to around 64K, which is big enough
  317. for almost everybody. However, I received a request for an even bigger limit.
  318. For this reason, and also to make the code easier to maintain, the storing and
  319. loading of offsets from the byte string is now handled by the macros that are
  320. defined here.
  321. The macros are controlled by the value of LINK_SIZE. This defaults to 2 in
  322. the config.h file, but can be overridden by using -D on the command line. This
  323. is automated on Unix systems via the "configure" command. */
  324. #ifdef COMPILE_PCRE8
  325. #if LINK_SIZE == 2
  326. #define PUT(a,n,d) \
  327. (a[n] = (d) >> 8), \
  328. (a[(n)+1] = (d) & 255)
  329. #define GET(a,n) \
  330. (((a)[n] << 8) | (a)[(n)+1])
  331. #define MAX_PATTERN_SIZE (1 << 16)
  332. #elif LINK_SIZE == 3
  333. #define PUT(a,n,d) \
  334. (a[n] = (d) >> 16), \
  335. (a[(n)+1] = (d) >> 8), \
  336. (a[(n)+2] = (d) & 255)
  337. #define GET(a,n) \
  338. (((a)[n] << 16) | ((a)[(n)+1] << 8) | (a)[(n)+2])
  339. #define MAX_PATTERN_SIZE (1 << 24)
  340. #elif LINK_SIZE == 4
  341. #define PUT(a,n,d) \
  342. (a[n] = (d) >> 24), \
  343. (a[(n)+1] = (d) >> 16), \
  344. (a[(n)+2] = (d) >> 8), \
  345. (a[(n)+3] = (d) & 255)
  346. #define GET(a,n) \
  347. (((a)[n] << 24) | ((a)[(n)+1] << 16) | ((a)[(n)+2] << 8) | (a)[(n)+3])
  348. /* Keep it positive */
  349. #define MAX_PATTERN_SIZE (1 << 30)
  350. #else
  351. #error LINK_SIZE must be either 2, 3, or 4
  352. #endif
  353. #else /* COMPILE_PCRE8 */
  354. #ifdef COMPILE_PCRE16
  355. #if LINK_SIZE == 2
  356. #undef LINK_SIZE
  357. #define LINK_SIZE 1
  358. #define PUT(a,n,d) \
  359. (a[n] = (d))
  360. #define GET(a,n) \
  361. (a[n])
  362. #define MAX_PATTERN_SIZE (1 << 16)
  363. #elif LINK_SIZE == 3 || LINK_SIZE == 4
  364. #undef LINK_SIZE
  365. #define LINK_SIZE 2
  366. #define PUT(a,n,d) \
  367. (a[n] = (d) >> 16), \
  368. (a[(n)+1] = (d) & 65535)
  369. #define GET(a,n) \
  370. (((a)[n] << 16) | (a)[(n)+1])
  371. /* Keep it positive */
  372. #define MAX_PATTERN_SIZE (1 << 30)
  373. #else
  374. #error LINK_SIZE must be either 2, 3, or 4
  375. #endif
  376. #else
  377. #error Unsupported compiling mode
  378. #endif /* COMPILE_PCRE16 */
  379. #endif /* COMPILE_PCRE8 */
  380. /* Convenience macro defined in terms of the others */
  381. #define PUTINC(a,n,d) PUT(a,n,d), a += LINK_SIZE
  382. /* PCRE uses some other 2-byte quantities that do not change when the size of
  383. offsets changes. There are used for repeat counts and for other things such as
  384. capturing parenthesis numbers in back references. */
  385. #ifdef COMPILE_PCRE8
  386. #define IMM2_SIZE 2
  387. #define PUT2(a,n,d) \
  388. a[n] = (d) >> 8; \
  389. a[(n)+1] = (d) & 255
  390. #define GET2(a,n) \
  391. (((a)[n] << 8) | (a)[(n)+1])
  392. #else /* COMPILE_PCRE8 */
  393. #ifdef COMPILE_PCRE16
  394. #define IMM2_SIZE 1
  395. #define PUT2(a,n,d) \
  396. a[n] = d
  397. #define GET2(a,n) \
  398. a[n]
  399. #else
  400. #error Unsupported compiling mode
  401. #endif /* COMPILE_PCRE16 */
  402. #endif /* COMPILE_PCRE8 */
  403. #define PUT2INC(a,n,d) PUT2(a,n,d), a += IMM2_SIZE
  404. /* When UTF encoding is being used, a character is no longer just a single
  405. character. The macros for character handling generate simple sequences when
  406. used in character-mode, and more complicated ones for UTF characters.
  407. GETCHARLENTEST and other macros are not used when UTF is not supported,
  408. so they are not defined. To make sure they can never even appear when
  409. UTF support is omitted, we don't even define them. */
  410. #ifndef SUPPORT_UTF
  411. /* #define MAX_VALUE_FOR_SINGLE_CHAR */
  412. /* #define HAS_EXTRALEN(c) */
  413. /* #define GET_EXTRALEN(c) */
  414. /* #define NOT_FIRSTCHAR(c) */
  415. #define GETCHAR(c, eptr) c = *eptr;
  416. #define GETCHARTEST(c, eptr) c = *eptr;
  417. #define GETCHARINC(c, eptr) c = *eptr++;
  418. #define GETCHARINCTEST(c, eptr) c = *eptr++;
  419. #define GETCHARLEN(c, eptr, len) c = *eptr;
  420. /* #define GETCHARLENTEST(c, eptr, len) */
  421. /* #define BACKCHAR(eptr) */
  422. /* #define FORWARDCHAR(eptr) */
  423. /* #define ACROSSCHAR(condition, eptr, action) */
  424. #else /* SUPPORT_UTF */
  425. #ifdef COMPILE_PCRE8
  426. /* These macros were originally written in the form of loops that used data
  427. from the tables whose names start with PRIV(utf8_table). They were rewritten by
  428. a user so as not to use loops, because in some environments this gives a
  429. significant performance advantage, and it seems never to do any harm. */
  430. /* Tells the biggest code point which can be encoded as a single character. */
  431. #define MAX_VALUE_FOR_SINGLE_CHAR 127
  432. /* Tests whether the code point needs extra characters to decode. */
  433. #define HAS_EXTRALEN(c) ((c) >= 0xc0)
  434. /* Returns with the additional number of characters if IS_MULTICHAR(c) is TRUE.
  435. Otherwise it has an undefined behaviour. */
  436. #define GET_EXTRALEN(c) (PRIV(utf8_table4)[(c) & 0x3f])
  437. /* Returns TRUE, if the given character is not the first character
  438. of a UTF sequence. */
  439. #define NOT_FIRSTCHAR(c) (((c) & 0xc0) == 0x80)
  440. /* Base macro to pick up the remaining bytes of a UTF-8 character, not
  441. advancing the pointer. */
  442. #define GETUTF8(c, eptr) \
  443. { \
  444. if ((c & 0x20) == 0) \
  445. c = ((c & 0x1f) << 6) | (eptr[1] & 0x3f); \
  446. else if ((c & 0x10) == 0) \
  447. c = ((c & 0x0f) << 12) | ((eptr[1] & 0x3f) << 6) | (eptr[2] & 0x3f); \
  448. else if ((c & 0x08) == 0) \
  449. c = ((c & 0x07) << 18) | ((eptr[1] & 0x3f) << 12) | \
  450. ((eptr[2] & 0x3f) << 6) | (eptr[3] & 0x3f); \
  451. else if ((c & 0x04) == 0) \
  452. c = ((c & 0x03) << 24) | ((eptr[1] & 0x3f) << 18) | \
  453. ((eptr[2] & 0x3f) << 12) | ((eptr[3] & 0x3f) << 6) | \
  454. (eptr[4] & 0x3f); \
  455. else \
  456. c = ((c & 0x01) << 30) | ((eptr[1] & 0x3f) << 24) | \
  457. ((eptr[2] & 0x3f) << 18) | ((eptr[3] & 0x3f) << 12) | \
  458. ((eptr[4] & 0x3f) << 6) | (eptr[5] & 0x3f); \
  459. }
  460. /* Get the next UTF-8 character, not advancing the pointer. This is called when
  461. we know we are in UTF-8 mode. */
  462. #define GETCHAR(c, eptr) \
  463. c = *eptr; \
  464. if (c >= 0xc0) GETUTF8(c, eptr);
  465. /* Get the next UTF-8 character, testing for UTF-8 mode, and not advancing the
  466. pointer. */
  467. #define GETCHARTEST(c, eptr) \
  468. c = *eptr; \
  469. if (utf && c >= 0xc0) GETUTF8(c, eptr);
  470. /* Base macro to pick up the remaining bytes of a UTF-8 character, advancing
  471. the pointer. */
  472. #define GETUTF8INC(c, eptr) \
  473. { \
  474. if ((c & 0x20) == 0) \
  475. c = ((c & 0x1f) << 6) | (*eptr++ & 0x3f); \
  476. else if ((c & 0x10) == 0) \
  477. { \
  478. c = ((c & 0x0f) << 12) | ((*eptr & 0x3f) << 6) | (eptr[1] & 0x3f); \
  479. eptr += 2; \
  480. } \
  481. else if ((c & 0x08) == 0) \
  482. { \
  483. c = ((c & 0x07) << 18) | ((*eptr & 0x3f) << 12) | \
  484. ((eptr[1] & 0x3f) << 6) | (eptr[2] & 0x3f); \
  485. eptr += 3; \
  486. } \
  487. else if ((c & 0x04) == 0) \
  488. { \
  489. c = ((c & 0x03) << 24) | ((*eptr & 0x3f) << 18) | \
  490. ((eptr[1] & 0x3f) << 12) | ((eptr[2] & 0x3f) << 6) | \
  491. (eptr[3] & 0x3f); \
  492. eptr += 4; \
  493. } \
  494. else \
  495. { \
  496. c = ((c & 0x01) << 30) | ((*eptr & 0x3f) << 24) | \
  497. ((eptr[1] & 0x3f) << 18) | ((eptr[2] & 0x3f) << 12) | \
  498. ((eptr[3] & 0x3f) << 6) | (eptr[4] & 0x3f); \
  499. eptr += 5; \
  500. } \
  501. }
  502. /* Get the next UTF-8 character, advancing the pointer. This is called when we
  503. know we are in UTF-8 mode. */
  504. #define GETCHARINC(c, eptr) \
  505. c = *eptr++; \
  506. if (c >= 0xc0) GETUTF8INC(c, eptr);
  507. /* Get the next character, testing for UTF-8 mode, and advancing the pointer.
  508. This is called when we don't know if we are in UTF-8 mode. */
  509. #define GETCHARINCTEST(c, eptr) \
  510. c = *eptr++; \
  511. if (utf && c >= 0xc0) GETUTF8INC(c, eptr);
  512. /* Base macro to pick up the remaining bytes of a UTF-8 character, not
  513. advancing the pointer, incrementing the length. */
  514. #define GETUTF8LEN(c, eptr, len) \
  515. { \
  516. if ((c & 0x20) == 0) \
  517. { \
  518. c = ((c & 0x1f) << 6) | (eptr[1] & 0x3f); \
  519. len++; \
  520. } \
  521. else if ((c & 0x10) == 0) \
  522. { \
  523. c = ((c & 0x0f) << 12) | ((eptr[1] & 0x3f) << 6) | (eptr[2] & 0x3f); \
  524. len += 2; \
  525. } \
  526. else if ((c & 0x08) == 0) \
  527. {\
  528. c = ((c & 0x07) << 18) | ((eptr[1] & 0x3f) << 12) | \
  529. ((eptr[2] & 0x3f) << 6) | (eptr[3] & 0x3f); \
  530. len += 3; \
  531. } \
  532. else if ((c & 0x04) == 0) \
  533. { \
  534. c = ((c & 0x03) << 24) | ((eptr[1] & 0x3f) << 18) | \
  535. ((eptr[2] & 0x3f) << 12) | ((eptr[3] & 0x3f) << 6) | \
  536. (eptr[4] & 0x3f); \
  537. len += 4; \
  538. } \
  539. else \
  540. {\
  541. c = ((c & 0x01) << 30) | ((eptr[1] & 0x3f) << 24) | \
  542. ((eptr[2] & 0x3f) << 18) | ((eptr[3] & 0x3f) << 12) | \
  543. ((eptr[4] & 0x3f) << 6) | (eptr[5] & 0x3f); \
  544. len += 5; \
  545. } \
  546. }
  547. /* Get the next UTF-8 character, not advancing the pointer, incrementing length
  548. if there are extra bytes. This is called when we know we are in UTF-8 mode. */
  549. #define GETCHARLEN(c, eptr, len) \
  550. c = *eptr; \
  551. if (c >= 0xc0) GETUTF8LEN(c, eptr, len);
  552. /* Get the next UTF-8 character, testing for UTF-8 mode, not advancing the
  553. pointer, incrementing length if there are extra bytes. This is called when we
  554. do not know if we are in UTF-8 mode. */
  555. #define GETCHARLENTEST(c, eptr, len) \
  556. c = *eptr; \
  557. if (utf && c >= 0xc0) GETUTF8LEN(c, eptr, len);
  558. /* If the pointer is not at the start of a character, move it back until
  559. it is. This is called only in UTF-8 mode - we don't put a test within the macro
  560. because almost all calls are already within a block of UTF-8 only code. */
  561. #define BACKCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr--
  562. /* Same as above, just in the other direction. */
  563. #define FORWARDCHAR(eptr) while((*eptr & 0xc0) == 0x80) eptr++
  564. /* Same as above, but it allows a fully customizable form. */
  565. #define ACROSSCHAR(condition, eptr, action) \
  566. while((condition) && ((eptr) & 0xc0) == 0x80) action
  567. #else /* COMPILE_PCRE8 */
  568. #ifdef COMPILE_PCRE16
  569. /* Tells the biggest code point which can be encoded as a single character. */
  570. #define MAX_VALUE_FOR_SINGLE_CHAR 65535
  571. /* Tests whether the code point needs extra characters to decode. */
  572. #define HAS_EXTRALEN(c) (((c) & 0xfc00) == 0xd800)
  573. /* Returns with the additional number of characters if IS_MULTICHAR(c) is TRUE.
  574. Otherwise it has an undefined behaviour. */
  575. #define GET_EXTRALEN(c) 1
  576. /* Returns TRUE, if the given character is not the first character
  577. of a UTF sequence. */
  578. #define NOT_FIRSTCHAR(c) (((c) & 0xfc00) == 0xdc00)
  579. /* Base macro to pick up the low surrogate of a UTF-16 character, not
  580. advancing the pointer. */
  581. #define GETUTF16(c, eptr) \
  582. { c = (((c & 0x3ff) << 10) | (eptr[1] & 0x3ff)) + 0x10000; }
  583. /* Get the next UTF-16 character, not advancing the pointer. This is called when
  584. we know we are in UTF-16 mode. */
  585. #define GETCHAR(c, eptr) \
  586. c = *eptr; \
  587. if ((c & 0xfc00) == 0xd800) GETUTF16(c, eptr);
  588. /* Get the next UTF-16 character, testing for UTF-16 mode, and not advancing the
  589. pointer. */
  590. #define GETCHARTEST(c, eptr) \
  591. c = *eptr; \
  592. if (utf && (c & 0xfc00) == 0xd800) GETUTF16(c, eptr);
  593. /* Base macro to pick up the low surrogate of a UTF-16 character, advancing
  594. the pointer. */
  595. #define GETUTF16INC(c, eptr) \
  596. { c = (((c & 0x3ff) << 10) | (*eptr++ & 0x3ff)) + 0x10000; }
  597. /* Get the next UTF-16 character, advancing the pointer. This is called when we
  598. know we are in UTF-16 mode. */
  599. #define GETCHARINC(c, eptr) \
  600. c = *eptr++; \
  601. if ((c & 0xfc00) == 0xd800) GETUTF16INC(c, eptr);
  602. /* Get the next character, testing for UTF-16 mode, and advancing the pointer.
  603. This is called when we don't know if we are in UTF-16 mode. */
  604. #define GETCHARINCTEST(c, eptr) \
  605. c = *eptr++; \
  606. if (utf && (c & 0xfc00) == 0xd800) GETUTF16INC(c, eptr);
  607. /* Base macro to pick up the low surrogate of a UTF-16 character, not
  608. advancing the pointer, incrementing the length. */
  609. #define GETUTF16LEN(c, eptr, len) \
  610. { c = (((c & 0x3ff) << 10) | (eptr[1] & 0x3ff)) + 0x10000; len++; }
  611. /* Get the next UTF-16 character, not advancing the pointer, incrementing
  612. length if there is a low surrogate. This is called when we know we are in
  613. UTF-16 mode. */
  614. #define GETCHARLEN(c, eptr, len) \
  615. c = *eptr; \
  616. if ((c & 0xfc00) == 0xd800) GETUTF16LEN(c, eptr, len);
  617. /* Get the next UTF-816character, testing for UTF-16 mode, not advancing the
  618. pointer, incrementing length if there is a low surrogate. This is called when
  619. we do not know if we are in UTF-16 mode. */
  620. #define GETCHARLENTEST(c, eptr, len) \
  621. c = *eptr; \
  622. if (utf && (c & 0xfc00) == 0xd800) GETUTF16LEN(c, eptr, len);
  623. /* If the pointer is not at the start of a character, move it back until
  624. it is. This is called only in UTF-16 mode - we don't put a test within the
  625. macro because almost all calls are already within a block of UTF-16 only
  626. code. */
  627. #define BACKCHAR(eptr) if ((*eptr & 0xfc00) == 0xdc00) eptr--
  628. /* Same as above, just in the other direction. */
  629. #define FORWARDCHAR(eptr) if ((*eptr & 0xfc00) == 0xdc00) eptr++
  630. /* Same as above, but it allows a fully customizable form. */
  631. #define ACROSSCHAR(condition, eptr, action) \
  632. if ((condition) && ((eptr) & 0xfc00) == 0xdc00) action
  633. #endif
  634. #endif /* COMPILE_PCRE8 */
  635. #endif /* SUPPORT_UTF */
  636. /* In case there is no definition of offsetof() provided - though any proper
  637. Standard C system should have one. */
  638. #ifndef offsetof
  639. #define offsetof(p_type,field) ((size_t)&(((p_type *)0)->field))
  640. #endif
  641. /* Private flags containing information about the compiled regex. They used to
  642. live at the top end of the options word, but that got almost full, so now they
  643. are in a 16-bit flags word. From release 8.00, PCRE_NOPARTIAL is unused, as
  644. the restrictions on partial matching have been lifted. It remains for backwards
  645. compatibility. */
  646. #ifdef COMPILE_PCRE8
  647. #define PCRE_MODE 0x0001 /* compiled in 8 bit mode */
  648. #endif
  649. #ifdef COMPILE_PCRE16
  650. #define PCRE_MODE 0x0002 /* compiled in 16 bit mode */
  651. #endif
  652. #define PCRE_FIRSTSET 0x0010 /* first_char is set */
  653. #define PCRE_FCH_CASELESS 0x0020 /* caseless first char */
  654. #define PCRE_REQCHSET 0x0040 /* req_byte is set */
  655. #define PCRE_RCH_CASELESS 0x0080 /* caseless requested char */
  656. #define PCRE_STARTLINE 0x0100 /* start after \n for multiline */
  657. #define PCRE_NOPARTIAL 0x0200 /* can't use partial with this regex */
  658. #define PCRE_JCHANGED 0x0400 /* j option used in regex */
  659. #define PCRE_HASCRORLF 0x0800 /* explicit \r or \n in pattern */
  660. #define PCRE_HASTHEN 0x1000 /* pattern contains (*THEN) */
  661. /* Flags for the "extra" block produced by pcre_study(). */
  662. #define PCRE_STUDY_MAPPED 0x0001 /* a map of starting chars exists */
  663. #define PCRE_STUDY_MINLEN 0x0002 /* a minimum length field exists */
  664. /* Masks for identifying the public options that are permitted at compile
  665. time, run time, or study time, respectively. */
  666. #define PCRE_NEWLINE_BITS (PCRE_NEWLINE_CR|PCRE_NEWLINE_LF|PCRE_NEWLINE_ANY| \
  667. PCRE_NEWLINE_ANYCRLF)
  668. #define PUBLIC_COMPILE_OPTIONS \
  669. (PCRE_CASELESS|PCRE_EXTENDED|PCRE_ANCHORED|PCRE_MULTILINE| \
  670. PCRE_DOTALL|PCRE_DOLLAR_ENDONLY|PCRE_EXTRA|PCRE_UNGREEDY|PCRE_UTF8| \
  671. PCRE_NO_AUTO_CAPTURE|PCRE_NO_UTF8_CHECK|PCRE_AUTO_CALLOUT|PCRE_FIRSTLINE| \
  672. PCRE_DUPNAMES|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE| \
  673. PCRE_JAVASCRIPT_COMPAT|PCRE_UCP|PCRE_NO_START_OPTIMIZE)
  674. #define PUBLIC_EXEC_OPTIONS \
  675. (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NOTEMPTY_ATSTART| \
  676. PCRE_NO_UTF8_CHECK|PCRE_PARTIAL_HARD|PCRE_PARTIAL_SOFT|PCRE_NEWLINE_BITS| \
  677. PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE|PCRE_NO_START_OPTIMIZE)
  678. #define PUBLIC_DFA_EXEC_OPTIONS \
  679. (PCRE_ANCHORED|PCRE_NOTBOL|PCRE_NOTEOL|PCRE_NOTEMPTY|PCRE_NOTEMPTY_ATSTART| \
  680. PCRE_NO_UTF8_CHECK|PCRE_PARTIAL_HARD|PCRE_PARTIAL_SOFT|PCRE_DFA_SHORTEST| \
  681. PCRE_DFA_RESTART|PCRE_NEWLINE_BITS|PCRE_BSR_ANYCRLF|PCRE_BSR_UNICODE| \
  682. PCRE_NO_START_OPTIMIZE)
  683. #define PUBLIC_STUDY_OPTIONS \
  684. PCRE_STUDY_JIT_COMPILE
  685. /* Magic number to provide a small check against being handed junk. */
  686. #define MAGIC_NUMBER 0x50435245UL /* 'PCRE' */
  687. /* This variable is used to detect a loaded regular expression
  688. in different endianness. */
  689. #define REVERSED_MAGIC_NUMBER 0x45524350UL /* 'ERCP' */
  690. /* Negative values for the firstchar and reqchar variables */
  691. #define REQ_UNSET (-2)
  692. #define REQ_NONE (-1)
  693. /* The maximum remaining length of subject we are prepared to search for a
  694. req_byte match. */
  695. #define REQ_BYTE_MAX 1000
  696. /* Miscellaneous definitions. The #ifndef is to pacify compiler warnings in
  697. environments where these macros are defined elsewhere. Unfortunately, there
  698. is no way to do the same for the typedef. */
  699. typedef int BOOL;
  700. #ifndef FALSE
  701. #define FALSE 0
  702. #define TRUE 1
  703. #endif
  704. /* If PCRE is to support UTF-8 on EBCDIC platforms, we cannot use normal
  705. character constants like '*' because the compiler would emit their EBCDIC code,
  706. which is different from their ASCII/UTF-8 code. Instead we define macros for
  707. the characters so that they always use the ASCII/UTF-8 code when UTF-8 support
  708. is enabled. When UTF-8 support is not enabled, the definitions use character
  709. literals. Both character and string versions of each character are needed, and
  710. there are some longer strings as well.
  711. This means that, on EBCDIC platforms, the PCRE library can handle either
  712. EBCDIC, or UTF-8, but not both. To support both in the same compiled library
  713. would need different lookups depending on whether PCRE_UTF8 was set or not.
  714. This would make it impossible to use characters in switch/case statements,
  715. which would reduce performance. For a theoretical use (which nobody has asked
  716. for) in a minority area (EBCDIC platforms), this is not sensible. Any
  717. application that did need both could compile two versions of the library, using
  718. macros to give the functions distinct names. */
  719. #ifndef SUPPORT_UTF
  720. /* UTF-8 support is not enabled; use the platform-dependent character literals
  721. so that PCRE works on both ASCII and EBCDIC platforms, in non-UTF-mode only. */
  722. #define CHAR_HT '\t'
  723. #define CHAR_VT '\v'
  724. #define CHAR_FF '\f'
  725. #define CHAR_CR '\r'
  726. #define CHAR_NL '\n'
  727. #define CHAR_BS '\b'
  728. #define CHAR_BEL '\a'
  729. #ifdef EBCDIC
  730. #define CHAR_ESC '\047'
  731. #define CHAR_DEL '\007'
  732. #else
  733. #define CHAR_ESC '\033'
  734. #define CHAR_DEL '\177'
  735. #endif
  736. #define CHAR_SPACE ' '
  737. #define CHAR_EXCLAMATION_MARK '!'
  738. #define CHAR_QUOTATION_MARK '"'
  739. #define CHAR_NUMBER_SIGN '#'
  740. #define CHAR_DOLLAR_SIGN '$'
  741. #define CHAR_PERCENT_SIGN '%'
  742. #define CHAR_AMPERSAND '&'
  743. #define CHAR_APOSTROPHE '\''
  744. #define CHAR_LEFT_PARENTHESIS '('
  745. #define CHAR_RIGHT_PARENTHESIS ')'
  746. #define CHAR_ASTERISK '*'
  747. #define CHAR_PLUS '+'
  748. #define CHAR_COMMA ','
  749. #define CHAR_MINUS '-'
  750. #define CHAR_DOT '.'
  751. #define CHAR_SLASH '/'
  752. #define CHAR_0 '0'
  753. #define CHAR_1 '1'
  754. #define CHAR_2 '2'
  755. #define CHAR_3 '3'
  756. #define CHAR_4 '4'
  757. #define CHAR_5 '5'
  758. #define CHAR_6 '6'
  759. #define CHAR_7 '7'
  760. #define CHAR_8 '8'
  761. #define CHAR_9 '9'
  762. #define CHAR_COLON ':'
  763. #define CHAR_SEMICOLON ';'
  764. #define CHAR_LESS_THAN_SIGN '<'
  765. #define CHAR_EQUALS_SIGN '='
  766. #define CHAR_GREATER_THAN_SIGN '>'
  767. #define CHAR_QUESTION_MARK '?'
  768. #define CHAR_COMMERCIAL_AT '@'
  769. #define CHAR_A 'A'
  770. #define CHAR_B 'B'
  771. #define CHAR_C 'C'
  772. #define CHAR_D 'D'
  773. #define CHAR_E 'E'
  774. #define CHAR_F 'F'
  775. #define CHAR_G 'G'
  776. #define CHAR_H 'H'
  777. #define CHAR_I 'I'
  778. #define CHAR_J 'J'
  779. #define CHAR_K 'K'
  780. #define CHAR_L 'L'
  781. #define CHAR_M 'M'
  782. #define CHAR_N 'N'
  783. #define CHAR_O 'O'
  784. #define CHAR_P 'P'
  785. #define CHAR_Q 'Q'
  786. #define CHAR_R 'R'
  787. #define CHAR_S 'S'
  788. #define CHAR_T 'T'
  789. #define CHAR_U 'U'
  790. #define CHAR_V 'V'
  791. #define CHAR_W 'W'
  792. #define CHAR_X 'X'
  793. #define CHAR_Y 'Y'
  794. #define CHAR_Z 'Z'
  795. #define CHAR_LEFT_SQUARE_BRACKET '['
  796. #define CHAR_BACKSLASH '\\'
  797. #define CHAR_RIGHT_SQUARE_BRACKET ']'
  798. #define CHAR_CIRCUMFLEX_ACCENT '^'
  799. #define CHAR_UNDERSCORE '_'
  800. #define CHAR_GRAVE_ACCENT '`'
  801. #define CHAR_a 'a'
  802. #define CHAR_b 'b'
  803. #define CHAR_c 'c'
  804. #define CHAR_d 'd'
  805. #define CHAR_e 'e'
  806. #define CHAR_f 'f'
  807. #define CHAR_g 'g'
  808. #define CHAR_h 'h'
  809. #define CHAR_i 'i'
  810. #define CHAR_j 'j'
  811. #define CHAR_k 'k'
  812. #define CHAR_l 'l'
  813. #define CHAR_m 'm'
  814. #define CHAR_n 'n'
  815. #define CHAR_o 'o'
  816. #define CHAR_p 'p'
  817. #define CHAR_q 'q'
  818. #define CHAR_r 'r'
  819. #define CHAR_s 's'
  820. #define CHAR_t 't'
  821. #define CHAR_u 'u'
  822. #define CHAR_v 'v'
  823. #define CHAR_w 'w'
  824. #define CHAR_x 'x'
  825. #define CHAR_y 'y'
  826. #define CHAR_z 'z'
  827. #define CHAR_LEFT_CURLY_BRACKET '{'
  828. #define CHAR_VERTICAL_LINE '|'
  829. #define CHAR_RIGHT_CURLY_BRACKET '}'
  830. #define CHAR_TILDE '~'
  831. #define STR_HT "\t"
  832. #define STR_VT "\v"
  833. #define STR_FF "\f"
  834. #define STR_CR "\r"
  835. #define STR_NL "\n"
  836. #define STR_BS "\b"
  837. #define STR_BEL "\a"
  838. #ifdef EBCDIC
  839. #define STR_ESC "\047"
  840. #define STR_DEL "\007"
  841. #else
  842. #define STR_ESC "\033"
  843. #define STR_DEL "\177"
  844. #endif
  845. #define STR_SPACE " "
  846. #define STR_EXCLAMATION_MARK "!"
  847. #define STR_QUOTATION_MARK "\""
  848. #define STR_NUMBER_SIGN "#"
  849. #define STR_DOLLAR_SIGN "$"
  850. #define STR_PERCENT_SIGN "%"
  851. #define STR_AMPERSAND "&"
  852. #define STR_APOSTROPHE "'"
  853. #define STR_LEFT_PARENTHESIS "("
  854. #define STR_RIGHT_PARENTHESIS ")"
  855. #define STR_ASTERISK "*"
  856. #define STR_PLUS "+"
  857. #define STR_COMMA ","
  858. #define STR_MINUS "-"
  859. #define STR_DOT "."
  860. #define STR_SLASH "/"
  861. #define STR_0 "0"
  862. #define STR_1 "1"
  863. #define STR_2 "2"
  864. #define STR_3 "3"
  865. #define STR_4 "4"
  866. #define STR_5 "5"
  867. #define STR_6 "6"
  868. #define STR_7 "7"
  869. #define STR_8 "8"
  870. #define STR_9 "9"
  871. #define STR_COLON ":"
  872. #define STR_SEMICOLON ";"
  873. #define STR_LESS_THAN_SIGN "<"
  874. #define STR_EQUALS_SIGN "="
  875. #define STR_GREATER_THAN_SIGN ">"
  876. #define STR_QUESTION_MARK "?"
  877. #define STR_COMMERCIAL_AT "@"
  878. #define STR_A "A"
  879. #define STR_B "B"
  880. #define STR_C "C"
  881. #define STR_D "D"
  882. #define STR_E "E"
  883. #define STR_F "F"
  884. #define STR_G "G"
  885. #define STR_H "H"
  886. #define STR_I "I"
  887. #define STR_J "J"
  888. #define STR_K "K"
  889. #define STR_L "L"
  890. #define STR_M "M"
  891. #define STR_N "N"
  892. #define STR_O "O"
  893. #define STR_P "P"
  894. #define STR_Q "Q"
  895. #define STR_R "R"
  896. #define STR_S "S"
  897. #define STR_T "T"
  898. #define STR_U "U"
  899. #define STR_V "V"
  900. #define STR_W "W"
  901. #define STR_X "X"
  902. #define STR_Y "Y"
  903. #define STR_Z "Z"
  904. #define STR_LEFT_SQUARE_BRACKET "["
  905. #define STR_BACKSLASH "\\"
  906. #define STR_RIGHT_SQUARE_BRACKET "]"
  907. #define STR_CIRCUMFLEX_ACCENT "^"
  908. #define STR_UNDERSCORE "_"
  909. #define STR_GRAVE_ACCENT "`"
  910. #define STR_a "a"
  911. #define STR_b "b"
  912. #define STR_c "c"
  913. #define STR_d "d"
  914. #define STR_e "e"
  915. #define STR_f "f"
  916. #define STR_g "g"
  917. #define STR_h "h"
  918. #define STR_i "i"
  919. #define STR_j "j"
  920. #define STR_k "k"
  921. #define STR_l "l"
  922. #define STR_m "m"
  923. #define STR_n "n"
  924. #define STR_o "o"
  925. #define STR_p "p"
  926. #define STR_q "q"
  927. #define STR_r "r"
  928. #define STR_s "s"
  929. #define STR_t "t"
  930. #define STR_u "u"
  931. #define STR_v "v"
  932. #define STR_w "w"
  933. #define STR_x "x"
  934. #define STR_y "y"
  935. #define STR_z "z"
  936. #define STR_LEFT_CURLY_BRACKET "{"
  937. #define STR_VERTICAL_LINE "|"
  938. #define STR_RIGHT_CURLY_BRACKET "}"
  939. #define STR_TILDE "~"
  940. #define STRING_ACCEPT0 "ACCEPT\0"
  941. #define STRING_COMMIT0 "COMMIT\0"
  942. #define STRING_F0 "F\0"
  943. #define STRING_FAIL0 "FAIL\0"
  944. #define STRING_MARK0 "MARK\0"
  945. #define STRING_PRUNE0 "PRUNE\0"
  946. #define STRING_SKIP0 "SKIP\0"
  947. #define STRING_THEN "THEN"
  948. #define STRING_alpha0 "alpha\0"
  949. #define STRING_lower0 "lower\0"
  950. #define STRING_upper0 "upper\0"
  951. #define STRING_alnum0 "alnum\0"
  952. #define STRING_ascii0 "ascii\0"
  953. #define STRING_blank0 "blank\0"
  954. #define STRING_cntrl0 "cntrl\0"
  955. #define STRING_digit0 "digit\0"
  956. #define STRING_graph0 "graph\0"
  957. #define STRING_print0 "print\0"
  958. #define STRING_punct0 "punct\0"
  959. #define STRING_space0 "space\0"
  960. #define STRING_word0 "word\0"
  961. #define STRING_xdigit "xdigit"
  962. #define STRING_DEFINE "DEFINE"
  963. #define STRING_CR_RIGHTPAR "CR)"
  964. #define STRING_LF_RIGHTPAR "LF)"
  965. #define STRING_CRLF_RIGHTPAR "CRLF)"
  966. #define STRING_ANY_RIGHTPAR "ANY)"
  967. #define STRING_ANYCRLF_RIGHTPAR "ANYCRLF)"
  968. #define STRING_BSR_ANYCRLF_RIGHTPAR "BSR_ANYCRLF)"
  969. #define STRING_BSR_UNICODE_RIGHTPAR "BSR_UNICODE)"
  970. #ifdef COMPILE_PCRE8
  971. #define STRING_UTF_RIGHTPAR "UTF8)"
  972. #endif
  973. #ifdef COMPILE_PCRE16
  974. #define STRING_UTF_RIGHTPAR "UTF16)"
  975. #endif
  976. #define STRING_UCP_RIGHTPAR "UCP)"
  977. #define STRING_NO_START_OPT_RIGHTPAR "NO_START_OPT)"
  978. #else /* SUPPORT_UTF */
  979. /* UTF-8 support is enabled; always use UTF-8 (=ASCII) character codes. This
  980. works in both modes non-EBCDIC platforms, and on EBCDIC platforms in UTF-8 mode
  981. only. */
  982. #define CHAR_HT '\011'
  983. #define CHAR_VT '\013'
  984. #define CHAR_FF '\014'
  985. #define CHAR_CR '\015'
  986. #define CHAR_NL '\012'
  987. #define CHAR_BS '\010'
  988. #define CHAR_BEL '\007'
  989. #define CHAR_ESC '\033'
  990. #define CHAR_DEL '\177'
  991. #define CHAR_SPACE '\040'
  992. #define CHAR_EXCLAMATION_MARK '\041'
  993. #define CHAR_QUOTATION_MARK '\042'
  994. #define CHAR_NUMBER_SIGN '\043'
  995. #define CHAR_DOLLAR_SIGN '\044'
  996. #define CHAR_PERCENT_SIGN '\045'
  997. #define CHAR_AMPERSAND '\046'
  998. #define CHAR_APOSTROPHE '\047'
  999. #define CHAR_LEFT_PARENTHESIS '\050'
  1000. #define CHAR_RIGHT_PARENTHESIS '\051'
  1001. #define CHAR_ASTERISK '\052'
  1002. #define CHAR_PLUS '\053'
  1003. #define CHAR_COMMA '\054'
  1004. #define CHAR_MINUS '\055'
  1005. #define CHAR_DOT '\056'
  1006. #define CHAR_SLASH '\057'
  1007. #define CHAR_0 '\060'
  1008. #define CHAR_1 '\061'
  1009. #define CHAR_2 '\062'
  1010. #define CHAR_3 '\063'
  1011. #define CHAR_4 '\064'
  1012. #define CHAR_5 '\065'
  1013. #define CHAR_6 '\066'
  1014. #define CHAR_7 '\067'
  1015. #define CHAR_8 '\070'
  1016. #define CHAR_9 '\071'
  1017. #define CHAR_COLON '\072'
  1018. #define CHAR_SEMICOLON '\073'
  1019. #define CHAR_LESS_THAN_SIGN '\074'
  1020. #define CHAR_EQUALS_SIGN '\075'
  1021. #define CHAR_GREATER_THAN_SIGN '\076'
  1022. #define CHAR_QUESTION_MARK '\077'
  1023. #define CHAR_COMMERCIAL_AT '\100'
  1024. #define CHAR_A '\101'
  1025. #define CHAR_B '\102'
  1026. #define CHAR_C '\103'
  1027. #define CHAR_D '\104'
  1028. #define CHAR_E '\105'
  1029. #define CHAR_F '\106'
  1030. #define CHAR_G '\107'
  1031. #define CHAR_H '\110'
  1032. #define CHAR_I '\111'
  1033. #define CHAR_J '\112'
  1034. #define CHAR_K '\113'
  1035. #define CHAR_L '\114'
  1036. #define CHAR_M '\115'
  1037. #define CHAR_N '\116'
  1038. #define CHAR_O '\117'
  1039. #define CHAR_P '\120'
  1040. #define CHAR_Q '\121'
  1041. #define CHAR_R '\122'
  1042. #define CHAR_S '\123'
  1043. #define CHAR_T '\124'
  1044. #define CHAR_U '\125'
  1045. #define CHAR_V '\126'
  1046. #define CHAR_W '\127'
  1047. #define CHAR_X '\130'
  1048. #define CHAR_Y '\131'
  1049. #define CHAR_Z '\132'
  1050. #define CHAR_LEFT_SQUARE_BRACKET '\133'
  1051. #define CHAR_BACKSLASH '\134'
  1052. #define CHAR_RIGHT_SQUARE_BRACKET '\135'
  1053. #define CHAR_CIRCUMFLEX_ACCENT '\136'
  1054. #define CHAR_UNDERSCORE '\137'
  1055. #define CHAR_GRAVE_ACCENT '\140'
  1056. #define CHAR_a '\141'
  1057. #define CHAR_b '\142'
  1058. #define CHAR_c '\143'
  1059. #define CHAR_d '\144'
  1060. #define CHAR_e '\145'
  1061. #define CHAR_f '\146'
  1062. #define CHAR_g '\147'
  1063. #define CHAR_h '\150'
  1064. #define CHAR_i '\151'
  1065. #define CHAR_j '\152'
  1066. #define CHAR_k '\153'
  1067. #define CHAR_l '\154'
  1068. #define CHAR_m '\155'
  1069. #define CHAR_n '\156'
  1070. #define CHAR_o '\157'
  1071. #define CHAR_p '\160'
  1072. #define CHAR_q '\161'
  1073. #define CHAR_r '\162'
  1074. #define CHAR_s '\163'
  1075. #define CHAR_t '\164'
  1076. #define CHAR_u '\165'
  1077. #define CHAR_v '\166'
  1078. #define CHAR_w '\167'
  1079. #define CHAR_x '\170'
  1080. #define CHAR_y '\171'
  1081. #define CHAR_z '\172'
  1082. #define CHAR_LEFT_CURLY_BRACKET '\173'
  1083. #define CHAR_VERTICAL_LINE '\174'
  1084. #define CHAR_RIGHT_CURLY_BRACKET '\175'
  1085. #define CHAR_TILDE '\176'
  1086. #define STR_HT "\011"
  1087. #define STR_VT "\013"
  1088. #define STR_FF "\014"
  1089. #define STR_CR "\015"
  1090. #define STR_NL "\012"
  1091. #define STR_BS "\010"
  1092. #define STR_BEL "\007"
  1093. #define STR_ESC "\033"
  1094. #define STR_DEL "\177"
  1095. #define STR_SPACE "\040"
  1096. #define STR_EXCLAMATION_MARK "\041"
  1097. #define STR_QUOTATION_MARK "\042"
  1098. #define STR_NUMBER_SIGN "\043"
  1099. #define STR_DOLLAR_SIGN "\044"
  1100. #define STR_PERCENT_SIGN "\045"
  1101. #define STR_AMPERSAND "\046"
  1102. #define STR_APOSTROPHE "\047"
  1103. #define STR_LEFT_PARENTHESIS "\050"
  1104. #define STR_RIGHT_PARENTHESIS "\051"
  1105. #define STR_ASTERISK "\052"
  1106. #define STR_PLUS "\053"
  1107. #define STR_COMMA "\054"
  1108. #define STR_MINUS "\055"
  1109. #define STR_DOT "\056"
  1110. #define STR_SLASH "\057"
  1111. #define STR_0 "\060"
  1112. #define STR_1 "\061"
  1113. #define STR_2 "\062"
  1114. #define STR_3 "\063"
  1115. #define STR_4 "\064"
  1116. #define STR_5 "\065"
  1117. #define STR_6 "\066"
  1118. #define STR_7 "\067"
  1119. #define STR_8 "\070"
  1120. #define STR_9 "\071"
  1121. #define STR_COLON "\072"
  1122. #define STR_SEMICOLON "\073"
  1123. #define STR_LESS_THAN_SIGN "\074"
  1124. #define STR_EQUALS_SIGN "\075"
  1125. #define STR_GREATER_THAN_SIGN "\076"
  1126. #define STR_QUESTION_MARK "\077"
  1127. #define STR_COMMERCIAL_AT "\100"
  1128. #define STR_A "\101"
  1129. #define STR_B "\102"
  1130. #define STR_C "\103"
  1131. #define STR_D "\104"
  1132. #define STR_E "\105"
  1133. #define STR_F "\106"
  1134. #define STR_G "\107"
  1135. #define STR_H "\110"
  1136. #define STR_I "\111"
  1137. #define STR_J "\112"
  1138. #define STR_K "\113"
  1139. #define STR_L "\114"
  1140. #define STR_M "\115"
  1141. #define STR_N "\116"
  1142. #define STR_O "\117"
  1143. #define STR_P "\120"
  1144. #define STR_Q "\121"
  1145. #define STR_R "\122"
  1146. #define STR_S "\123"
  1147. #define STR_T "\124"
  1148. #define STR_U "\125"
  1149. #define STR_V "\126"
  1150. #define STR_W "\127"
  1151. #define STR_X "\130"
  1152. #define STR_Y "\131"
  1153. #define STR_Z "\132"
  1154. #define STR_LEFT_SQUARE_BRACKET "\133"
  1155. #define STR_BACKSLASH "\134"
  1156. #define STR_RIGHT_SQUARE_BRACKET "\135"
  1157. #define STR_CIRCUMFLEX_ACCENT "\136"
  1158. #define STR_UNDERSCORE "\137"
  1159. #define STR_GRAVE_ACCENT "\140"
  1160. #define STR_a "\141"
  1161. #define STR_b "\142"
  1162. #define STR_c "\143"
  1163. #define STR_d "\144"
  1164. #define STR_e "\145"
  1165. #define STR_f "\146"
  1166. #define STR_g "\147"
  1167. #

Large files files are truncated, but you can click here to view the full file