Process Hacker
pcre_config.c
Go to the documentation of this file.
1 /*************************************************
2 * Perl-Compatible Regular Expressions *
3 *************************************************/
4 
5 /* PCRE is a library of functions to support regular expressions whose syntax
6 and semantics are as close as possible to those of the Perl 5 language.
7 
8  Written by Philip Hazel
9  Copyright (c) 1997-2009 University of Cambridge
10 
11 -----------------------------------------------------------------------------
12 Redistribution and use in source and binary forms, with or without
13 modification, are permitted provided that the following conditions are met:
14 
15  * Redistributions of source code must retain the above copyright notice,
16  this list of conditions and the following disclaimer.
17 
18  * Redistributions in binary form must reproduce the above copyright
19  notice, this list of conditions and the following disclaimer in the
20  documentation and/or other materials provided with the distribution.
21 
22  * Neither the name of the University of Cambridge nor the names of its
23  contributors may be used to endorse or promote products derived from
24  this software without specific prior written permission.
25 
26 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
27 AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
28 IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
29 ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
30 LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
31 CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
32 SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
33 INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
34 CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
35 ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
36 POSSIBILITY OF SUCH DAMAGE.
37 -----------------------------------------------------------------------------
38 */
39 
40 
41 /* This module contains the external function pcre_config(). */
42 
43 
44 #define HAVE_CONFIG_H
45 #ifdef HAVE_CONFIG_H
46 #include "config.h"
47 #endif
48 
49 #include "pcre_internal.h"
50 
51 
52 /*************************************************
53 * Return info about what features are configured *
54 *************************************************/
55 
56 /* This function has an extensible interface so that additional items can be
57 added compatibly.
58 
59 Arguments:
60  what what information is required
61  where where to put the information
62 
63 Returns: 0 if data returned, negative on error
64 */
65 
67 pcre_config(int what, void *where)
68 {
69 switch (what)
70  {
71  case PCRE_CONFIG_UTF8:
72 #ifdef SUPPORT_UTF8
73  *((int *)where) = 1;
74 #else
75  *((int *)where) = 0;
76 #endif
77  break;
78 
80 #ifdef SUPPORT_UCP
81  *((int *)where) = 1;
82 #else
83  *((int *)where) = 0;
84 #endif
85  break;
86 
88  *((int *)where) = NEWLINE;
89  break;
90 
91  case PCRE_CONFIG_BSR:
92 #ifdef BSR_ANYCRLF
93  *((int *)where) = 1;
94 #else
95  *((int *)where) = 0;
96 #endif
97  break;
98 
100  *((int *)where) = LINK_SIZE;
101  break;
102 
104  *((int *)where) = POSIX_MALLOC_THRESHOLD;
105  break;
106 
108  *((unsigned long int *)where) = MATCH_LIMIT;
109  break;
110 
112  *((unsigned long int *)where) = MATCH_LIMIT_RECURSION;
113  break;
114 
116 #ifdef NO_RECURSE
117  *((int *)where) = 0;
118 #else
119  *((int *)where) = 1;
120 #endif
121  break;
122 
123  default: return PCRE_ERROR_BADOPTION;
124  }
125 
126 return 0;
127 }
128 
129 /* End of pcre_config.c */