+/* $Cambridge: exim/src/src/pcre/dftables.c,v 1.3 2005/08/08 10:22:14 ph10 Exp $ */
+
/*************************************************
* Perl-Compatible Regular Expressions *
*************************************************/
-/*
-PCRE is a library of functions to support regular expressions whose syntax
+/* PCRE is a library of functions to support regular expressions whose syntax
and semantics are as close as possible to those of the Perl 5 language.
-Written by: Philip Hazel <ph10@cam.ac.uk>
-
- Copyright (c) 1997-2004 University of Cambridge
+ Written by Philip Hazel
+ Copyright (c) 1997-2005 University of Cambridge
-----------------------------------------------------------------------------
Redistribution and use in source and binary forms, with or without
*/
-/* This is a support program to generate the file chartables.c, containing
-character tables of various kinds. They are built according to the default C
-locale and used as the default tables by PCRE. Now that pcre_maketables is
-a function visible to the outside world, we make use of its code from here in
-order to be consistent. */
+/* This is a freestanding support program to generate a file containing default
+character tables for PCRE. The tables are built according to the default C
+locale. Now that pcre_maketables is a function visible to the outside world, we
+make use of its code from here in order to be consistent. */
#include <ctype.h>
#include <stdio.h>
#include <string.h>
-#include "internal.h"
+#include "pcre_internal.h"
-#define DFTABLES /* maketables.c notices this */
-#include "maketables.c"
+#define DFTABLES /* pcre_maketables.c notices this */
+#include "pcre_maketables.c"
int main(int argc, char **argv)
int i;
FILE *f;
const unsigned char *tables = pcre_maketables();
+const unsigned char *base_of_tables = tables;
if (argc != 2)
{
return 1;
}
-f = fopen(argv[1], "w");
+f = fopen(argv[1], "wb");
if (f == NULL)
{
fprintf(stderr, "dftables: failed to open %s for writing\n", argv[1]);
"program. If you edit it by hand, you might like to edit the Makefile to \n"
"prevent its ever being regenerated.\n\n");
fprintf(f,
- "This file is #included in the compilation of pcre.c to build the default\n"
- "character tables which are used when no tables are passed to the compile\n"
- "function. */\n\n"
- "static unsigned char pcre_default_tables[] = {\n\n"
+ "This file contains the default tables for characters with codes less than\n"
+ "128 (ASCII characters). These tables are used when no external tables are\n"
+ "passed to PCRE. */\n\n"
+ "const unsigned char _pcre_default_tables[] = {\n\n"
"/* This table is a lower casing table. */\n\n");
fprintf(f, " ");
fprintf(f, " */\n\n/* End of chartables.c */\n");
fclose(f);
+free((void *)base_of_tables);
return 0;
}