Go to the SVN repository for this file.
59 #define PCRE2_DFTABLES 61 #define PCRE2_CODE_UNIT_WIDTH 0 69 "space",
"xdigit",
"digit",
"upper",
"lower",
70 "word",
"graph",
"print",
"punct",
"cntrl" 83 "Usage: pcre2_dftables [options] <output file>\n" 84 " -b Write output in binary (default is source code)\n" 85 " -L Use locale from LC_ALL (default is \"C\" locale)\n" 95 int main(
intargc,
char**argv)
101 char*
env= (
char*)
"C";
107 for(
i= 1;
i< argc;
i++)
109 char*arg = argv[
i];
110 if(*arg !=
'-')
break;
112 if(
strcmp(arg,
"-help") == 0 ||
strcmp(arg,
"--help") == 0)
118 else if(
strcmp(arg,
"-L") == 0)
120 if(setlocale(LC_ALL,
"") ==
NULL)
122(void)fprintf(stderr,
"pcre2_dftables: setlocale() failed\n");
125 env= getenv(
"LC_ALL");
128 else if(
strcmp(arg,
"-b") == 0)
133(void)fprintf(stderr,
"pcre2_dftables: unrecognized option %s\n", arg);
140(void)fprintf(stderr,
"pcre2_dftables: one filename argument is required\n");
146tables = maketables();
147base_of_tables = tables;
149 f= fopen(argv[
i],
"wb");
152fprintf(stderr,
"pcre2_dftables: failed to open %s for writing\n", argv[1]);
164(void)fprintf(stderr,
"pcre2_dftables: fwrite() returned wrong length %d " 169 free((
void*)base_of_tables);
178 "/*************************************************\n" 179 "* Perl-Compatible Regular Expressions *\n" 180 "*************************************************/\n\n" 181 "/* This file was automatically written by the pcre2_dftables auxiliary\n" 182 "program. It contains character tables that are used when no external\n" 183 "tables are passed to PCRE2 by the application that calls it. The tables\n" 184 "are used only for characters whose code values are less than 256, and\n" 185 "only relevant if not in UCP mode. */\n\n");
188 "/* This set of tables was written in the %s locale. */\n\n",
env);
191 "/* The pcre2_ftables program (which is distributed with PCRE2) can be used\n" 192 "to build alternative versions of this file. This is necessary if you are\n" 193 "running in an EBCDIC environment, or if you want to default to a different\n" 194 "encoding, for example ISO-8859-1. When pcre2_dftables is run, it creates\n" 195 "these tables in the \"C\" locale by default. This happens automatically if\n" 196 "PCRE2 is configured with --enable-rebuild-chartables. However, you can run\n" 197 "pcre2_dftables manually with the -L option to build tables using the LC_ALL\n" 202 #if defined NATIVE_ZOS 204 "/* For z/OS, config.h is forced */\n" 205 "#ifndef HAVE_CONFIG_H\n" 206 "#define HAVE_CONFIG_H 1\n" 211 "#ifdef HAVE_CONFIG_H\n" 212 "#include \"config.h\"\n" 214 "#include \"pcre2_internal.h\"\n\n");
217 "const uint8_t PRIV(default_tables)[] = {\n\n" 218 "/* This table is a lower casing table. */\n\n");
220(void)fprintf(
f,
" ");
221 for(
i= 0;
i< 256;
i++)
223 if((
i& 7) == 0 &&
i!= 0) fprintf(
f,
"\n ");
224fprintf(
f,
"%3d", *tables++);
225 if(
i!= 255) fprintf(
f,
",");
227(void)fprintf(
f,
",\n\n");
229(void)fprintf(
f,
"/* This table is a case flipping table. */\n\n");
231(void)fprintf(
f,
" ");
232 for(
i= 0;
i< 256;
i++)
234 if((
i& 7) == 0 &&
i!= 0) fprintf(
f,
"\n ");
235fprintf(
f,
"%3d", *tables++);
236 if(
i!= 255) fprintf(
f,
",");
238(void)fprintf(
f,
",\n\n");
241 "/* This table contains bit maps for various character classes. Each map is 32\n" 242 "bytes long and the bits run from the least significant end of each byte. The\n" 243 "classes that have their own maps are: space, xdigit, digit, upper, lower, word,\n" 244 "graph, print, punct, and cntrl. Other classes are built from combinations. */\n\n");
246(void)fprintf(
f,
" ");
249 if((
i& 7) == 0 &&
i!= 0)
251 if((
i& 31) == 0) (
void)fprintf(
f,
"\n");
252 if((
i& 24) == 8) (void)fprintf(
f,
" /* %s */",
classlist[nclass++]);
253(void)fprintf(
f,
"\n ");
255(void)fprintf(
f,
"0x%02x", *tables++);
258(void)fprintf(
f,
",\n\n");
261 "/* This table identifies various classes of character by individual bits:\n" 262 " 0x%02x white space character\n" 264 " 0x%02x lower case letter\n" 265 " 0x%02x decimal digit\n" 266 " 0x%02x word (alphanumeric or '_')\n*/\n\n",
269(void)fprintf(
f,
" ");
270 for(
i= 0;
i< 256;
i++)
272 if((
i& 7) == 0 &&
i!= 0)
274(void)fprintf(
f,
" /* ");
275 if(
isprint(
i-8)) (
void)fprintf(
f,
" %c -",
i-8);
276 else(
void)fprintf(
f,
"%3d-",
i-8);
277 if(
isprint(
i-1)) (void)fprintf(
f,
" %c ",
i-1);
278 else(
void)fprintf(
f,
"%3d",
i-1);
279(void)fprintf(
f,
" */\n ");
281(void)fprintf(
f,
"0x%02x", *tables++);
282 if(
i!= 255) (void)fprintf(
f,
",");
285(void)fprintf(
f,
"};/* ");
286 if(
isprint(
i-8)) (
void)fprintf(
f,
" %c -",
i-8);
287 else(
void)fprintf(
f,
"%3d-",
i-8);
288 if(
isprint(
i-1)) (void)fprintf(
f,
" %c ",
i-1);
289 else(
void)fprintf(
f,
"%3d",
i-1);
290(void)fprintf(
f,
" */\n\n/* End of pcre2_chartables.c */\n");
293 free((
void*)base_of_tables);
int strcmp(const char *str1, const char *str2)
#define TRUE
bool replacment for C indicating true.
#define FALSE
bool replacment for C indicating false.
int main(int argc, char **argv)
static const char * classlist[]
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4