/[m4]/m4/lib/regex.h
ViewVC logotype

Diff of /m4/lib/regex.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.1.1 by jbailey, Thu Feb 17 03:03:19 2000 UTC revision 1.1.1.1.2.1 by gary, Fri Feb 4 13:03:11 2005 UTC
# Line 1  Line 1 
1  /* Definitions for data structures and routines for the regular  /* Definitions for data structures and routines for the regular
2     expression library, version 0.12.     expression library.
3       Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003
4     Copyright (C) 1985, 89, 90, 91, 92, 1993 Free Software Foundation, Inc.     Free Software Foundation, Inc.
5       This file is part of the GNU C Library.
6    
7     This program is free software; you can redistribute it and/or modify     This program is free software; you can redistribute it and/or modify
8     it under the terms of the GNU General Public License as published by     it under the terms of the GNU General Public License as published by
# Line 13  Line 14 
14     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15     GNU General Public License for more details.     GNU General Public License for more details.
16    
17     You should have received a copy of the GNU General Public License     You should have received a copy of the GNU General Public License along
18     along with this program; if not, write to the Free Software     with this program; if not, write to the Free Software Foundation,
19     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */     Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.  */
20    
21  #ifndef __REGEXP_LIBRARY_H__  #ifndef _REGEX_H
22  #define __REGEXP_LIBRARY_H__  #define _REGEX_H 1
23    
24    #include <sys/types.h>
25    
26    /* Allow the use in C++ code.  */
27    #ifdef __cplusplus
28    extern "C" {
29    #endif
30    
31  /* POSIX says that <sys/types.h> must be included (by the caller) before  /* POSIX says that <sys/types.h> must be included (by the caller) before
32     <regex.h>.  */     <regex.h>.  */
33    
34  #ifdef VMS  #if !defined _POSIX_C_SOURCE && !defined _POSIX_SOURCE && defined VMS
35  /* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it  /* VMS doesn't have `size_t' in <sys/types.h>, even though POSIX says it
36     should be there.  */     should be there.  */
37  #include <stddef.h>  # include <stddef.h>
38  #endif  #endif
39    
40    /* The following two types have to be signed and unsigned integer type
41       wide enough to hold a value of a pointer.  For most ANSI compilers
42       ptrdiff_t and size_t should be likely OK.  Still size of these two
43       types is 2 for Microsoft C.  Ugh... */
44    typedef long int s_reg_t;
45    typedef unsigned long int active_reg_t;
46    
47  /* The following bits are used to determine the regexp syntax we  /* The following bits are used to determine the regexp syntax we
48     recognize.  The set/not-set meanings are chosen so that Emacs syntax     recognize.  The set/not-set meanings are chosen so that Emacs syntax
49     remains the value 0.  The bits are given in alphabetical order, and     remains the value 0.  The bits are given in alphabetical order, and
50     the definitions shifted by one from the previous bit; thus, when we     the definitions shifted by one from the previous bit; thus, when we
51     add or remove a bit, only one other definition need change.  */     add or remove a bit, only one other definition need change.  */
52  typedef unsigned reg_syntax_t;  typedef unsigned long int reg_syntax_t;
53    
54  /* If this bit is not set, then \ inside a bracket expression is literal.  /* If this bit is not set, then \ inside a bracket expression is literal.
55     If set, then such a \ quotes the following character.  */     If set, then such a \ quotes the following character.  */
56  #define RE_BACKSLASH_ESCAPE_IN_LISTS (1)  #define RE_BACKSLASH_ESCAPE_IN_LISTS ((unsigned long int) 1)
57    
58  /* If this bit is not set, then + and ? are operators, and \+ and \? are  /* If this bit is not set, then + and ? are operators, and \+ and \? are
59       literals.       literals.
60     If set, then \+ and \? are operators and + and ? are literals.  */     If set, then \+ and \? are operators and + and ? are literals.  */
61  #define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)  #define RE_BK_PLUS_QM (RE_BACKSLASH_ESCAPE_IN_LISTS << 1)
62    
# Line 58  typedef unsigned reg_syntax_t; Line 72  typedef unsigned reg_syntax_t;
72          ^  is an anchor if it is at the beginning of a regular          ^  is an anchor if it is at the beginning of a regular
73             expression or after an open-group or an alternation operator;             expression or after an open-group or an alternation operator;
74          $  is an anchor if it is at the end of a regular expression, or          $  is an anchor if it is at the end of a regular expression, or
75             before a close-group or an alternation operator.               before a close-group or an alternation operator.
76    
77     This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because     This bit could be (re)combined with RE_CONTEXT_INDEP_OPS, because
78     POSIX draft 11.2 says that * etc. in leading positions is undefined.     POSIX draft 11.2 says that * etc. in leading positions is undefined.
# Line 69  typedef unsigned reg_syntax_t; Line 83  typedef unsigned reg_syntax_t;
83  /* If this bit is set, then special characters are always special  /* If this bit is set, then special characters are always special
84       regardless of where they are in the pattern.       regardless of where they are in the pattern.
85     If this bit is not set, then special characters are special only in     If this bit is not set, then special characters are special only in
86       some contexts; otherwise they are ordinary.  Specifically,       some contexts; otherwise they are ordinary.  Specifically,
87       * + ? and intervals are only special when not after the beginning,       * + ? and intervals are only special when not after the beginning,
88       open-group, or alternation operator.  */       open-group, or alternation operator.  */
89  #define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)  #define RE_CONTEXT_INDEP_OPS (RE_CONTEXT_INDEP_ANCHORS << 1)
# Line 91  typedef unsigned reg_syntax_t; Line 105  typedef unsigned reg_syntax_t;
105  #define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)  #define RE_HAT_LISTS_NOT_NEWLINE (RE_DOT_NOT_NULL << 1)
106    
107  /* If this bit is set, either \{...\} or {...} defines an  /* If this bit is set, either \{...\} or {...} defines an
108       interval, depending on RE_NO_BK_BRACES.       interval, depending on RE_NO_BK_BRACES.
109     If not set, \{, \}, {, and } are literals.  */     If not set, \{, \}, {, and } are literals.  */
110  #define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)  #define RE_INTERVALS (RE_HAT_LISTS_NOT_NEWLINE << 1)
111    
# Line 116  typedef unsigned reg_syntax_t; Line 130  typedef unsigned reg_syntax_t;
130     If not set, then \<digit> is a back-reference.  */     If not set, then \<digit> is a back-reference.  */
131  #define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)  #define RE_NO_BK_REFS (RE_NO_BK_PARENS << 1)
132    
133  /* If this bit is set, then | is an alternation operator, and \| is literal.  /* If this bit is set, then | is an alternation operator, and \| is literal.
134     If not set, then \| is an alternation operator, and | is literal.  */     If not set, then \| is an alternation operator, and | is literal.  */
135  #define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)  #define RE_NO_BK_VBAR (RE_NO_BK_REFS << 1)
136    
# Line 130  typedef unsigned reg_syntax_t; Line 144  typedef unsigned reg_syntax_t;
144     If not set, then an unmatched ) is invalid.  */     If not set, then an unmatched ) is invalid.  */
145  #define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)  #define RE_UNMATCHED_RIGHT_PAREN_ORD (RE_NO_EMPTY_RANGES << 1)
146    
147    /* If this bit is set, succeed as soon as we match the whole pattern,
148       without further backtracking.  */
149    #define RE_NO_POSIX_BACKTRACKING (RE_UNMATCHED_RIGHT_PAREN_ORD << 1)
150    
151    /* If this bit is set, do not process the GNU regex operators.
152       If not set, then the GNU regex operators are recognized. */
153    #define RE_NO_GNU_OPS (RE_NO_POSIX_BACKTRACKING << 1)
154    
155    /* If this bit is set, turn on internal regex debugging.
156       If not set, and debugging was on, turn it off.
157       This only works if regex.c is compiled -DDEBUG.
158       We define this bit always, so that all that's needed to turn on
159       debugging is to recompile regex.c; the calling code can always have
160       this bit set, and it won't affect anything in the normal case. */
161    #define RE_DEBUG (RE_NO_GNU_OPS << 1)
162    
163    /* If this bit is set, a syntactically invalid interval is treated as
164       a string of ordinary characters.  For example, the ERE 'a{1' is
165       treated as 'a\{1'.  */
166    #define RE_INVALID_INTERVAL_ORD (RE_DEBUG << 1)
167    
168    /* If this bit is set, then ignore case when matching.
169       If not set, then case is significant.  */
170    #define RE_ICASE (RE_INVALID_INTERVAL_ORD << 1)
171    
172  /* This global variable defines the particular regexp syntax to use (for  /* This global variable defines the particular regexp syntax to use (for
173     some interfaces).  When a regexp is compiled, the syntax used is     some interfaces).  When a regexp is compiled, the syntax used is
174     stored in the pattern buffer, so changing this does not affect     stored in the pattern buffer, so changing this does not affect
# Line 138  extern reg_syntax_t re_syntax_options; Line 177  extern reg_syntax_t re_syntax_options;
177    
178  /* Define combinations of the above bits for the standard possibilities.  /* Define combinations of the above bits for the standard possibilities.
179     (The [[[ comments delimit what gets put into the Texinfo file, so     (The [[[ comments delimit what gets put into the Texinfo file, so
180     don't delete them!)  */     don't delete them!)  */
181  /* [[[begin syntaxes]]] */  /* [[[begin syntaxes]]] */
182  #define RE_SYNTAX_EMACS 0  #define RE_SYNTAX_EMACS 0
183    
184  #define RE_SYNTAX_AWK                                                   \  #define RE_SYNTAX_AWK                                                   \
185    (RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DOT_NOT_NULL                       \    (RE_BACKSLASH_ESCAPE_IN_LISTS   | RE_DOT_NOT_NULL                     \
186     | RE_NO_BK_PARENS            | RE_NO_BK_REFS                         \     | RE_NO_BK_PARENS              | RE_NO_BK_REFS                       \
187     | RE_NO_BK_VBAR               | RE_NO_EMPTY_RANGES                   \     | RE_NO_BK_VBAR                | RE_NO_EMPTY_RANGES                  \
188     | RE_UNMATCHED_RIGHT_PAREN_ORD)     | RE_DOT_NEWLINE               | RE_CONTEXT_INDEP_ANCHORS            \
189       | RE_UNMATCHED_RIGHT_PAREN_ORD | RE_NO_GNU_OPS)
190    
191    #define RE_SYNTAX_GNU_AWK                                               \
192      ((RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS | RE_DEBUG) \
193       & ~(RE_DOT_NOT_NULL | RE_INTERVALS | RE_CONTEXT_INDEP_OPS            \
194           | RE_CONTEXT_INVALID_OPS ))
195    
196  #define RE_SYNTAX_POSIX_AWK                                             \  #define RE_SYNTAX_POSIX_AWK                                             \
197    (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS)    (RE_SYNTAX_POSIX_EXTENDED | RE_BACKSLASH_ESCAPE_IN_LISTS              \
198       | RE_INTERVALS           | RE_NO_GNU_OPS)
199    
200  #define RE_SYNTAX_GREP                                                  \  #define RE_SYNTAX_GREP                                                  \
201    (RE_BK_PLUS_QM              | RE_CHAR_CLASSES                         \    (RE_BK_PLUS_QM              | RE_CHAR_CLASSES                         \
# Line 163  extern reg_syntax_t re_syntax_options; Line 209  extern reg_syntax_t re_syntax_options;
209     | RE_NO_BK_VBAR)     | RE_NO_BK_VBAR)
210    
211  #define RE_SYNTAX_POSIX_EGREP                                           \  #define RE_SYNTAX_POSIX_EGREP                                           \
212    (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES)    (RE_SYNTAX_EGREP | RE_INTERVALS | RE_NO_BK_BRACES                     \
213       | RE_INVALID_INTERVAL_ORD)
214    
215  /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff.  */  /* P1003.2/D11.2, section 4.20.7.1, lines 5078ff.  */
216  #define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC  #define RE_SYNTAX_ED RE_SYNTAX_POSIX_BASIC
# Line 185  extern reg_syntax_t re_syntax_options; Line 232  extern reg_syntax_t re_syntax_options;
232    (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)    (_RE_SYNTAX_POSIX_COMMON | RE_LIMITED_OPS)
233    
234  #define RE_SYNTAX_POSIX_EXTENDED                                        \  #define RE_SYNTAX_POSIX_EXTENDED                                        \
235    (_RE_SYNTAX_POSIX_COMMON | RE_CONTEXT_INDEP_ANCHORS                   \    (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS                  \
236     | RE_CONTEXT_INDEP_OPS  | RE_NO_BK_BRACES                            \     | RE_CONTEXT_INDEP_OPS   | RE_NO_BK_BRACES                           \
237     | RE_NO_BK_PARENS       | RE_NO_BK_VBAR                              \     | RE_NO_BK_PARENS        | RE_NO_BK_VBAR                             \
238     | RE_UNMATCHED_RIGHT_PAREN_ORD)     | RE_CONTEXT_INVALID_OPS | RE_UNMATCHED_RIGHT_PAREN_ORD)
239    
240  /* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INVALID_OPS  /* Differs from ..._POSIX_EXTENDED in that RE_CONTEXT_INDEP_OPS is
241     replaces RE_CONTEXT_INDEP_OPS and RE_NO_BK_REFS is added.  */     removed and RE_NO_BK_REFS is added.  */
242  #define RE_SYNTAX_POSIX_MINIMAL_EXTENDED                                \  #define RE_SYNTAX_POSIX_MINIMAL_EXTENDED                                \
243    (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS                  \    (_RE_SYNTAX_POSIX_COMMON  | RE_CONTEXT_INDEP_ANCHORS                  \
244     | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES                           \     | RE_CONTEXT_INVALID_OPS | RE_NO_BK_BRACES                           \
# Line 203  extern reg_syntax_t re_syntax_options; Line 250  extern reg_syntax_t re_syntax_options;
250     (erroneously) define this in other header files, but we want our     (erroneously) define this in other header files, but we want our
251     value, so remove any previous define.  */     value, so remove any previous define.  */
252  #ifdef RE_DUP_MAX  #ifdef RE_DUP_MAX
253  #undef RE_DUP_MAX  # undef RE_DUP_MAX
254  #endif  #endif
255  #define RE_DUP_MAX ((1 << 15) - 1)  /* If sizeof(int) == 2, then ((1 << 15) - 1) overflows.  */
256    #define RE_DUP_MAX (0x7fff)
257    
258    
259  /* POSIX `cflags' bits (i.e., information for `regcomp').  */  /* POSIX `cflags' bits (i.e., information for `regcomp').  */
# Line 217  extern reg_syntax_t re_syntax_options; Line 265  extern reg_syntax_t re_syntax_options;
265  /* If this bit is set, then ignore case when matching.  /* If this bit is set, then ignore case when matching.
266     If not set, then case is significant.  */     If not set, then case is significant.  */
267  #define REG_ICASE (REG_EXTENDED << 1)  #define REG_ICASE (REG_EXTENDED << 1)
268    
269  /* If this bit is set, then anchors do not match at newline  /* If this bit is set, then anchors do not match at newline
270       characters in the string.       characters in the string.
271     If not set, then anchors do match at newlines.  */     If not set, then anchors do match at newlines.  */
# Line 245  extern reg_syntax_t re_syntax_options; Line 293  extern reg_syntax_t re_syntax_options;
293     `re_error_msg' table in regex.c.  */     `re_error_msg' table in regex.c.  */
294  typedef enum  typedef enum
295  {  {
296    #ifdef _XOPEN_SOURCE
297      REG_ENOSYS = -1,      /* This will never happen for this implementation.  */
298    #endif
299    
300    REG_NOERROR = 0,      /* Success.  */    REG_NOERROR = 0,      /* Success.  */
301    REG_NOMATCH,          /* Didn't find a match (for regexec).  */    REG_NOMATCH,          /* Didn't find a match (for regexec).  */
302    
# Line 256  typedef enum Line 308  typedef enum
308    REG_EESCAPE,          /* Trailing backslash.  */    REG_EESCAPE,          /* Trailing backslash.  */
309    REG_ESUBREG,          /* Invalid back reference.  */    REG_ESUBREG,          /* Invalid back reference.  */
310    REG_EBRACK,           /* Unmatched left bracket.  */    REG_EBRACK,           /* Unmatched left bracket.  */
311    REG_EPAREN,           /* Parenthesis imbalance.  */    REG_EPAREN,           /* Parenthesis imbalance.  */
312    REG_EBRACE,           /* Unmatched \{.  */    REG_EBRACE,           /* Unmatched \{.  */
313    REG_BADBR,            /* Invalid contents of \{\}.  */    REG_BADBR,            /* Invalid contents of \{\}.  */
314    REG_ERANGE,           /* Invalid range end.  */    REG_ERANGE,           /* Invalid range end.  */
# Line 275  typedef enum Line 327  typedef enum
327     compiled, the `re_nsub' field is available.  All other fields are     compiled, the `re_nsub' field is available.  All other fields are
328     private to the regex routines.  */     private to the regex routines.  */
329    
330    #ifndef RE_TRANSLATE_TYPE
331    # define RE_TRANSLATE_TYPE char *
332    #endif
333    
334  struct re_pattern_buffer  struct re_pattern_buffer
335  {  {
336  /* [[[begin pattern_buffer]]] */  /* [[[begin pattern_buffer]]] */
# Line 284  struct re_pattern_buffer Line 340  struct re_pattern_buffer
340    unsigned char *buffer;    unsigned char *buffer;
341    
342          /* Number of bytes to which `buffer' points.  */          /* Number of bytes to which `buffer' points.  */
343    unsigned long allocated;    unsigned long int allocated;
344    
345          /* Number of bytes actually used in `buffer'.  */          /* Number of bytes actually used in `buffer'.  */
346    unsigned long used;      unsigned long int used;
347    
348          /* Syntax setting with which the pattern was compiled.  */          /* Syntax setting with which the pattern was compiled.  */
349    reg_syntax_t syntax;    reg_syntax_t syntax;
# Line 301  struct re_pattern_buffer Line 357  struct re_pattern_buffer
357             comparing them, or zero for no translation.  The translation             comparing them, or zero for no translation.  The translation
358             is applied to a pattern when it is compiled and to a string             is applied to a pattern when it is compiled and to a string
359             when it is matched.  */             when it is matched.  */
360    char *translate;    RE_TRANSLATE_TYPE translate;
361    
362          /* Number of subexpressions found by the compiler.  */          /* Number of subexpressions found by the compiler.  */
363    size_t re_nsub;    size_t re_nsub;
# Line 331  struct re_pattern_buffer Line 387  struct re_pattern_buffer
387    unsigned no_sub : 1;    unsigned no_sub : 1;
388    
389          /* If set, a beginning-of-line anchor doesn't match at the          /* If set, a beginning-of-line anchor doesn't match at the
390             beginning of the string.  */             beginning of the string.  */
391    unsigned not_bol : 1;    unsigned not_bol : 1;
392    
393          /* Similarly for an end-of-line anchor.  */          /* Similarly for an end-of-line anchor.  */
# Line 363  struct re_registers Line 419  struct re_registers
419     `re_match_2' returns information about at least this many registers     `re_match_2' returns information about at least this many registers
420     the first time a `regs' structure is passed.  */     the first time a `regs' structure is passed.  */
421  #ifndef RE_NREGS  #ifndef RE_NREGS
422  #define RE_NREGS 30  # define RE_NREGS 30
423  #endif  #endif
424    
425    
# Line 378  typedef struct Line 434  typedef struct
434    
435  /* Declarations for routines.  */  /* Declarations for routines.  */
436    
 /* To avoid duplicating every routine declaration -- once with a  
    prototype (if we are ANSI), and once without (if we aren't) -- we  
    use the following macro to declare argument types.  This  
    unfortunately clutters up the declarations a bit, but I think it's  
    worth it.  */  
   
 #if __STDC__  
   
 #define _RE_ARGS(args) args  
   
 #else /* not __STDC__ */  
   
 #define _RE_ARGS(args) ()  
   
 #endif /* not __STDC__ */  
   
437  /* Sets the current default syntax to SYNTAX, and return the old syntax.  /* Sets the current default syntax to SYNTAX, and return the old syntax.
438     You can also simply assign to the `re_syntax_options' variable.  */     You can also simply assign to the `re_syntax_options' variable.  */
439  extern reg_syntax_t re_set_syntax _RE_ARGS ((reg_syntax_t syntax));  extern reg_syntax_t re_set_syntax (reg_syntax_t syntax);
440    
441  /* Compile the regular expression PATTERN, with length LENGTH  /* Compile the regular expression PATTERN, with length LENGTH
442     and syntax given by the global `re_syntax_options', into the buffer     and syntax given by the global `re_syntax_options', into the buffer
443     BUFFER.  Return NULL if successful, and an error string if not.  */     BUFFER.  Return NULL if successful, and an error string if not.  */
444  extern const char *re_compile_pattern  extern const char *re_compile_pattern (const char *pattern, size_t length,
445    _RE_ARGS ((const char *pattern, int length,                                         struct re_pattern_buffer *buffer);
              struct re_pattern_buffer *buffer));  
446    
447    
448  /* Compile a fastmap for the compiled pattern in BUFFER; used to  /* Compile a fastmap for the compiled pattern in BUFFER; used to
449     accelerate searches.  Return 0 if successful and -2 if was an     accelerate searches.  Return 0 if successful and -2 if was an
450     internal error.  */     internal error.  */
451  extern int re_compile_fastmap _RE_ARGS ((struct re_pattern_buffer *buffer));  extern int re_compile_fastmap (struct re_pattern_buffer *buffer);
452    
453    
454  /* Search in the string STRING (with length LENGTH) for the pattern  /* Search in the string STRING (with length LENGTH) for the pattern
# Line 417  extern int re_compile_fastmap _RE_ARGS ( Line 456  extern int re_compile_fastmap _RE_ARGS (
456     characters.  Return the starting position of the match, -1 for no     characters.  Return the starting position of the match, -1 for no
457     match, or -2 for an internal error.  Also return register     match, or -2 for an internal error.  Also return register
458     information in REGS (if REGS and BUFFER->no_sub are nonzero).  */     information in REGS (if REGS and BUFFER->no_sub are nonzero).  */
459  extern int re_search  extern int re_search (struct re_pattern_buffer *buffer, const char *string,
460    _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,                        int length, int start, int range,
461              int length, int start, int range, struct re_registers *regs));                        struct re_registers *regs);
462    
463    
464  /* Like `re_search', but search in the concatenation of STRING1 and  /* Like `re_search', but search in the concatenation of STRING1 and
465     STRING2.  Also, stop searching at index START + STOP.  */     STRING2.  Also, stop searching at index START + STOP.  */
466  extern int re_search_2  extern int re_search_2 (struct re_pattern_buffer *buffer, const char *string1,
467    _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,                          int length1, const char *string2, int length2,
468               int length1, const char *string2, int length2,                          int start, int range, struct re_registers *regs,
469               int start, int range, struct re_registers *regs, int stop));                          int stop);
470    
471    
472  /* Like `re_search', but return how many characters in STRING the regexp  /* Like `re_search', but return how many characters in STRING the regexp
473     in BUFFER matched, starting at position START.  */     in BUFFER matched, starting at position START.  */
474  extern int re_match  extern int re_match (struct re_pattern_buffer *buffer, const char *string,
475    _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string,                       int length, int start, struct re_registers *regs);
              int length, int start, struct re_registers *regs));  
476    
477    
478  /* Relates to `re_match' as `re_search_2' relates to `re_search'.  */  /* Relates to `re_match' as `re_search_2' relates to `re_search'.  */
479  extern int re_match_2  extern int re_match_2 (struct re_pattern_buffer *buffer, const char *string1,
480    _RE_ARGS ((struct re_pattern_buffer *buffer, const char *string1,                         int length1, const char *string2, int length2,
481               int length1, const char *string2, int length2,                         int start, struct re_registers *regs, int stop);
              int start, struct re_registers *regs, int stop));  
482    
483    
484  /* Set REGS to hold NUM_REGS registers, storing them in STARTS and  /* Set REGS to hold NUM_REGS registers, storing them in STARTS and
# Line 456  extern int re_match_2 Line 493  extern int re_match_2
493     Unless this function is called, the first search or match using     Unless this function is called, the first search or match using
494     PATTERN_BUFFER will allocate its own register data, without     PATTERN_BUFFER will allocate its own register data, without
495     freeing the old data.  */     freeing the old data.  */
496  extern void re_set_registers  extern void re_set_registers (struct re_pattern_buffer *buffer,
497    _RE_ARGS ((struct re_pattern_buffer *buffer, struct re_registers *regs,                                struct re_registers *regs, unsigned num_regs,
498               unsigned num_regs, regoff_t *starts, regoff_t *ends));                                regoff_t *starts, regoff_t *ends);
499    
500  #ifdef _REGEX_RE_COMP  #if defined _REGEX_RE_COMP || defined _LIBC
501    # ifndef _CRAY
502  /* 4.2 bsd compatibility.  */  /* 4.2 bsd compatibility.  */
503  extern char *re_comp _RE_ARGS ((const char *));  extern char *re_comp (const char *);
504  extern int re_exec _RE_ARGS ((const char *));  extern int re_exec (const char *);
505    # endif
506    #endif
507    
508    /* GCC 2.95 and later have "__restrict"; C99 compilers have
509       "restrict", and "configure" may have defined "restrict".  */
510    #ifndef __restrict
511    # if ! (2 < __GNUC__ || (2 == __GNUC__ && 95 <= __GNUC_MINOR__))
512    #  if defined restrict || 199901L <= __STDC_VERSION__
513    #   define __restrict restrict
514    #  else
515    #   define __restrict
516    #  endif
517    # endif
518    #endif
519    /* gcc 3.1 and up support the [restrict] syntax.  */
520    #ifndef __restrict_arr
521    # if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 1)
522    #  define __restrict_arr __restrict
523    # else
524    #  define __restrict_arr
525    # endif
526  #endif  #endif
527    
528  /* POSIX compatibility.  */  /* POSIX compatibility.  */
529  extern int regcomp _RE_ARGS ((regex_t *preg, const char *pattern, int cflags));  extern int regcomp (regex_t *__restrict __preg,
530  extern int regexec                      const char *__restrict __pattern,
531    _RE_ARGS ((const regex_t *preg, const char *string, size_t nmatch,                      int __cflags);
532               regmatch_t pmatch[], int eflags));  
533  extern size_t regerror  extern int regexec (const regex_t *__restrict __preg,
534    _RE_ARGS ((int errcode, const regex_t *preg, char *errbuf,                      const char *__restrict __string, size_t __nmatch,
535               size_t errbuf_size));                      regmatch_t __pmatch[__restrict_arr],
536  extern void regfree _RE_ARGS ((regex_t *preg));                      int __eflags);
537    
538    extern size_t regerror (int __errcode, const regex_t *__preg,
539                            char *__errbuf, size_t __errbuf_size);
540    
541    extern void regfree (regex_t *__preg);
542    
543    
544    #ifdef __cplusplus
545    }
546    #endif  /* C++ */
547    
548  #endif /* not __REGEXP_LIBRARY_H__ */  #endif /* regex.h */
549    
550  /*  /*
551  Local variables:  Local variables:

Legend:
Removed from v.1.1.1.1  
changed lines
  Added in v.1.1.1.1.2.1

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26