📄 regex.c
字号:
/* Extended regular expression matching and search library, version 0.12. (Implements POSIX draft P10003.2/D11.2, except for internationalization features.) Copyright (C) 1993 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 the Free Software Foundation; either version 2, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *//* AIX requires this to be the first thing in the file. */#if defined (_AIX) && !defined (REGEX_MALLOC) #pragma alloca#endif#define _GNU_SOURCE/* We need this for `regex.h', and perhaps for the Emacs include files. */#include <sys/types.h>#ifdef HAVE_CONFIG_H#include "config.h"#endif/* The `emacs' switch turns on certain matching commands that make sense only in Emacs. */#ifdef emacs#include "lisp.h"#include "buffer.h"#include "syntax.h"/* Emacs uses `NULL' as a predicate. */#undef NULL#else /* not emacs *//* We used to test for `BSTRING' here, but only GCC and Emacs define `BSTRING', as far as I know, and neither of them use this code. */#if HAVE_STRING_H || STDC_HEADERS#include <string.h>#ifndef bcmp#define bcmp(s1, s2, n) memcmp ((s1), (s2), (n))#endif#ifndef bcopy#define bcopy(s, d, n) memcpy ((d), (s), (n))#endif#ifndef bzero#define bzero(s, n) memset ((s), 0, (n))#endif#else#include <strings.h>#endif#ifdef STDC_HEADERS#include <stdlib.h>#elsechar *malloc ();char *realloc ();#endif/* Define the syntax stuff for \<, \>, etc. *//* This must be nonzero for the wordchar and notwordchar pattern commands in re_match_2. */#ifndef Sword #define Sword 1#endif/* isalpha etc. are used for the character classes. */#include <ctype.h>#ifdef SYNTAX_TABLEextern char *re_syntax_table;#else /* not SYNTAX_TABLE *//* How many characters in the character set. */#define CHAR_SET_SIZE 256static char re_syntax_table[CHAR_SET_SIZE];static voidinit_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;#if 1 re_syntax_table[(unsigned char)'
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -