diff options
author | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 12:57:07 +0300 |
---|---|---|
committer | Arnold D. Robbins <arnold@skeeve.com> | 2010-07-16 12:57:07 +0300 |
commit | 3ca7f0b16d0a5c105380b284a81c6a1b2c210908 (patch) | |
tree | c2153d226b9cba3ebca0c3556b19bf3e52cd20dd /regex.c | |
parent | f20ab7c3039a4023f41372bfe4bde3b16d481df7 (diff) | |
download | egawk-3ca7f0b16d0a5c105380b284a81c6a1b2c210908.tar.gz egawk-3ca7f0b16d0a5c105380b284a81c6a1b2c210908.tar.bz2 egawk-3ca7f0b16d0a5c105380b284a81c6a1b2c210908.zip |
Move to gawk-3.0.5.
Diffstat (limited to 'regex.c')
-rw-r--r-- | regex.c | 79 |
1 files changed, 38 insertions, 41 deletions
@@ -3,7 +3,7 @@ (Implements POSIX draft P1003.2/D11.2, except for some of the internationalization features.) - Copyright (C) 1993,1994,1995,1996,1997,1999 Free Software Foundation, Inc. + Copyright (C) 1993,1994,1995,1996,1997,1999,2000 Free Software Foundation, Inc. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -124,46 +124,6 @@ char *realloc (); #define SWITCH_ENUM_CAST(x) (x) #endif -/* How many characters in the character set. */ -#define CHAR_SET_SIZE 256 - -#ifdef SYNTAX_TABLE - -extern char *re_syntax_table; - -#else /* not SYNTAX_TABLE */ - -static char re_syntax_table[CHAR_SET_SIZE]; - -static void -init_syntax_once () -{ - register int c; - static int done = 0; - - if (done) - return; - - bzero (re_syntax_table, sizeof re_syntax_table); - - for (c = 'a'; c <= 'z'; c++) - re_syntax_table[c] = Sword; - - for (c = 'A'; c <= 'Z'; c++) - re_syntax_table[c] = Sword; - - for (c = '0'; c <= '9'; c++) - re_syntax_table[c] = Sword; - - re_syntax_table['_'] = Sword; - - done = 1; -} - -#endif /* not SYNTAX_TABLE */ - -#define SYNTAX(c) re_syntax_table[c] - #endif /* not emacs */ /* Get the interface, including the syntax bits. */ @@ -227,6 +187,43 @@ init_syntax_once () #define SIGN_EXTEND_CHAR(c) ((((unsigned char) (c)) ^ 128) - 128) #endif +#ifndef emacs +/* How many characters in the character set. */ +#define CHAR_SET_SIZE 256 + +#ifdef SYNTAX_TABLE + +extern char *re_syntax_table; + +#else /* not SYNTAX_TABLE */ + +static char re_syntax_table[CHAR_SET_SIZE]; + +static void +init_syntax_once () +{ + register int c; + static int done = 0; + + if (done) + return; + bzero (re_syntax_table, sizeof re_syntax_table); + + for (c = 0; c < CHAR_SET_SIZE; c++) + if (ISALNUM (c)) + re_syntax_table[c] = Sword; + + re_syntax_table['_'] = Sword; + + done = 1; +} + +#endif /* not SYNTAX_TABLE */ + +#define SYNTAX(c) re_syntax_table[(unsigned char) (c)] + +#endif /* emacs */ + /* Should we use malloc or alloca? If REGEX_MALLOC is not defined, we use `alloca' instead of `malloc'. This is because using malloc in re_search* or re_match* could cause memory leaks when C-g is used in |