mirror of
https://github.com/postgres/postgres.git
synced 2025-07-03 20:02:46 +03:00
pgindent run.
This commit is contained in:
@ -1,19 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
|
||||
*
|
||||
* Development of this software was funded, in part, by Cray Research Inc.,
|
||||
* UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics
|
||||
* Corporation, none of whom are responsible for the results. The author
|
||||
* thanks all of them.
|
||||
*
|
||||
* thanks all of them.
|
||||
*
|
||||
* Redistribution and use in source and binary forms -- with or without
|
||||
* modification -- are permitted for any purpose, provided that
|
||||
* redistributions in source form retain this entire copyright notice and
|
||||
* indicate the origin and nature of any modifications.
|
||||
*
|
||||
*
|
||||
* I'd appreciate being given credit for this package in the documentation
|
||||
* of software which uses it, but that is not a requirement.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
@ -25,7 +25,7 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: regcustom.h,v 1.1 2003/02/05 17:41:32 tgl Exp $
|
||||
* $Id: regcustom.h,v 1.2 2003/08/04 00:43:32 momjian Exp $
|
||||
*/
|
||||
|
||||
/* headers if any */
|
||||
@ -38,27 +38,31 @@
|
||||
|
||||
|
||||
/* overrides for regguts.h definitions, if any */
|
||||
#define FUNCPTR(name, args) (*name) args
|
||||
#define MALLOC(n) malloc(n)
|
||||
#define FREE(p) free(VS(p))
|
||||
#define REALLOC(p,n) realloc(VS(p),n)
|
||||
#define FUNCPTR(name, args) (*name) args
|
||||
#define MALLOC(n) malloc(n)
|
||||
#define FREE(p) free(VS(p))
|
||||
#define REALLOC(p,n) realloc(VS(p),n)
|
||||
|
||||
/* internal character type and related */
|
||||
typedef pg_wchar chr; /* the type itself */
|
||||
typedef unsigned uchr; /* unsigned type that will hold a chr */
|
||||
typedef int celt; /* type to hold chr, MCCE number, or NOCELT */
|
||||
#define NOCELT (-1) /* celt value which is not valid chr or MCCE */
|
||||
#define CHR(c) ((unsigned char) (c)) /* turn char literal into chr literal */
|
||||
#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */
|
||||
#define CHRBITS 32 /* bits in a chr; must not use sizeof */
|
||||
#define CHR_MIN 0x00000000 /* smallest and largest chr; the value */
|
||||
#define CHR_MAX 0xfffffffe /* CHR_MAX-CHR_MIN+1 should fit in uchr */
|
||||
typedef pg_wchar chr; /* the type itself */
|
||||
typedef unsigned uchr; /* unsigned type that will hold a chr */
|
||||
typedef int celt; /* type to hold chr, MCCE number, or
|
||||
* NOCELT */
|
||||
|
||||
#define NOCELT (-1) /* celt value which is not valid chr or
|
||||
* MCCE */
|
||||
#define CHR(c) ((unsigned char) (c)) /* turn char literal into chr
|
||||
* literal */
|
||||
#define DIGITVAL(c) ((c)-'0') /* turn chr digit into its value */
|
||||
#define CHRBITS 32 /* bits in a chr; must not use sizeof */
|
||||
#define CHR_MIN 0x00000000 /* smallest and largest chr; the value */
|
||||
#define CHR_MAX 0xfffffffe /* CHR_MAX-CHR_MIN+1 should fit in uchr */
|
||||
|
||||
/* functions operating on chr */
|
||||
#define iscalnum(x) pg_isalnum(x)
|
||||
#define iscalpha(x) pg_isalpha(x)
|
||||
#define iscdigit(x) pg_isdigit(x)
|
||||
#define iscspace(x) pg_isspace(x)
|
||||
#define iscalnum(x) pg_isalnum(x)
|
||||
#define iscalpha(x) pg_isalpha(x)
|
||||
#define iscdigit(x) pg_isdigit(x)
|
||||
#define iscspace(x) pg_isspace(x)
|
||||
|
||||
/* and pick up the standard header */
|
||||
#include "regex.h"
|
||||
|
@ -1,22 +1,75 @@
|
||||
/*
|
||||
* $Id: regerrs.h,v 1.1 2003/02/05 17:41:32 tgl Exp $
|
||||
* $Id: regerrs.h,v 1.2 2003/08/04 00:43:32 momjian Exp $
|
||||
*/
|
||||
|
||||
{ REG_OKAY, "REG_OKAY", "no errors detected" },
|
||||
{ REG_NOMATCH, "REG_NOMATCH", "failed to match" },
|
||||
{ REG_BADPAT, "REG_BADPAT", "invalid regexp (reg version 0.8)" },
|
||||
{ REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element" },
|
||||
{ REG_ECTYPE, "REG_ECTYPE", "invalid character class" },
|
||||
{ REG_EESCAPE, "REG_EESCAPE", "invalid escape \\ sequence" },
|
||||
{ REG_ESUBREG, "REG_ESUBREG", "invalid backreference number" },
|
||||
{ REG_EBRACK, "REG_EBRACK", "brackets [] not balanced" },
|
||||
{ REG_EPAREN, "REG_EPAREN", "parentheses () not balanced" },
|
||||
{ REG_EBRACE, "REG_EBRACE", "braces {} not balanced" },
|
||||
{ REG_BADBR, "REG_BADBR", "invalid repetition count(s)" },
|
||||
{ REG_ERANGE, "REG_ERANGE", "invalid character range" },
|
||||
{ REG_ESPACE, "REG_ESPACE", "out of memory" },
|
||||
{ REG_BADRPT, "REG_BADRPT", "quantifier operand invalid" },
|
||||
{ REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug" },
|
||||
{ REG_INVARG, "REG_INVARG", "invalid argument to regex function" },
|
||||
{ REG_MIXED, "REG_MIXED", "character widths of regex and string differ" },
|
||||
{ REG_BADOPT, "REG_BADOPT", "invalid embedded option" },
|
||||
{
|
||||
REG_OKAY, "REG_OKAY", "no errors detected"
|
||||
},
|
||||
|
||||
{
|
||||
REG_NOMATCH, "REG_NOMATCH", "failed to match"
|
||||
},
|
||||
|
||||
{
|
||||
REG_BADPAT, "REG_BADPAT", "invalid regexp (reg version 0.8)"
|
||||
},
|
||||
|
||||
{
|
||||
REG_ECOLLATE, "REG_ECOLLATE", "invalid collating element"
|
||||
},
|
||||
|
||||
{
|
||||
REG_ECTYPE, "REG_ECTYPE", "invalid character class"
|
||||
},
|
||||
|
||||
{
|
||||
REG_EESCAPE, "REG_EESCAPE", "invalid escape \\ sequence"
|
||||
},
|
||||
|
||||
{
|
||||
REG_ESUBREG, "REG_ESUBREG", "invalid backreference number"
|
||||
},
|
||||
|
||||
{
|
||||
REG_EBRACK, "REG_EBRACK", "brackets [] not balanced"
|
||||
},
|
||||
|
||||
{
|
||||
REG_EPAREN, "REG_EPAREN", "parentheses () not balanced"
|
||||
},
|
||||
|
||||
{
|
||||
REG_EBRACE, "REG_EBRACE", "braces {} not balanced"
|
||||
},
|
||||
|
||||
{
|
||||
REG_BADBR, "REG_BADBR", "invalid repetition count(s)"
|
||||
},
|
||||
|
||||
{
|
||||
REG_ERANGE, "REG_ERANGE", "invalid character range"
|
||||
},
|
||||
|
||||
{
|
||||
REG_ESPACE, "REG_ESPACE", "out of memory"
|
||||
},
|
||||
|
||||
{
|
||||
REG_BADRPT, "REG_BADRPT", "quantifier operand invalid"
|
||||
},
|
||||
|
||||
{
|
||||
REG_ASSERT, "REG_ASSERT", "\"can't happen\" -- you found a bug"
|
||||
},
|
||||
|
||||
{
|
||||
REG_INVARG, "REG_INVARG", "invalid argument to regex function"
|
||||
},
|
||||
|
||||
{
|
||||
REG_MIXED, "REG_MIXED", "character widths of regex and string differ"
|
||||
},
|
||||
|
||||
{
|
||||
REG_BADOPT, "REG_BADOPT", "invalid embedded option"
|
||||
},
|
||||
|
@ -1,15 +1,15 @@
|
||||
#ifndef _REGEX_H_
|
||||
#define _REGEX_H_ /* never again */
|
||||
#define _REGEX_H_ /* never again */
|
||||
/*
|
||||
* regular expressions
|
||||
*
|
||||
* Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
|
||||
*
|
||||
* Development of this software was funded, in part, by Cray Research Inc.,
|
||||
* UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics
|
||||
* Corporation, none of whom are responsible for the results. The author
|
||||
* thanks all of them.
|
||||
*
|
||||
* thanks all of them.
|
||||
*
|
||||
* Redistribution and use in source and binary forms -- with or without
|
||||
* modification -- are permitted for any purpose, provided that
|
||||
* redistributions in source form retain this entire copyright notice and
|
||||
@ -17,7 +17,7 @@
|
||||
*
|
||||
* I'd appreciate being given credit for this package in the documentation
|
||||
* of software which uses it, but that is not a requirement.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
@ -29,7 +29,7 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: regex.h,v 1.23 2003/02/05 17:41:32 tgl Exp $
|
||||
* $Id: regex.h,v 1.24 2003/08/04 00:43:32 momjian Exp $
|
||||
*/
|
||||
|
||||
/*
|
||||
@ -52,77 +52,81 @@ typedef long regoff_t;
|
||||
*/
|
||||
|
||||
/* the biggie, a compiled RE (or rather, a front end to same) */
|
||||
typedef struct {
|
||||
int re_magic; /* magic number */
|
||||
size_t re_nsub; /* number of subexpressions */
|
||||
long re_info; /* information about RE */
|
||||
# define REG_UBACKREF 000001
|
||||
# define REG_ULOOKAHEAD 000002
|
||||
# define REG_UBOUNDS 000004
|
||||
# define REG_UBRACES 000010
|
||||
# define REG_UBSALNUM 000020
|
||||
# define REG_UPBOTCH 000040
|
||||
# define REG_UBBS 000100
|
||||
# define REG_UNONPOSIX 000200
|
||||
# define REG_UUNSPEC 000400
|
||||
# define REG_UUNPORT 001000
|
||||
# define REG_ULOCALE 002000
|
||||
# define REG_UEMPTYMATCH 004000
|
||||
# define REG_UIMPOSSIBLE 010000
|
||||
# define REG_USHORTEST 020000
|
||||
int re_csize; /* sizeof(character) */
|
||||
char *re_endp; /* backward compatibility kludge */
|
||||
typedef struct
|
||||
{
|
||||
int re_magic; /* magic number */
|
||||
size_t re_nsub; /* number of subexpressions */
|
||||
long re_info; /* information about RE */
|
||||
#define REG_UBACKREF 000001
|
||||
#define REG_ULOOKAHEAD 000002
|
||||
#define REG_UBOUNDS 000004
|
||||
#define REG_UBRACES 000010
|
||||
#define REG_UBSALNUM 000020
|
||||
#define REG_UPBOTCH 000040
|
||||
#define REG_UBBS 000100
|
||||
#define REG_UNONPOSIX 000200
|
||||
#define REG_UUNSPEC 000400
|
||||
#define REG_UUNPORT 001000
|
||||
#define REG_ULOCALE 002000
|
||||
#define REG_UEMPTYMATCH 004000
|
||||
#define REG_UIMPOSSIBLE 010000
|
||||
#define REG_USHORTEST 020000
|
||||
int re_csize; /* sizeof(character) */
|
||||
char *re_endp; /* backward compatibility kludge */
|
||||
/* the rest is opaque pointers to hidden innards */
|
||||
char *re_guts; /* `char *' is more portable than `void *' */
|
||||
char *re_fns;
|
||||
char *re_guts; /* `char *' is more portable than `void *' */
|
||||
char *re_fns;
|
||||
} regex_t;
|
||||
|
||||
/* result reporting (may acquire more fields later) */
|
||||
typedef struct {
|
||||
regoff_t rm_so; /* start of substring */
|
||||
regoff_t rm_eo; /* end of substring */
|
||||
typedef struct
|
||||
{
|
||||
regoff_t rm_so; /* start of substring */
|
||||
regoff_t rm_eo; /* end of substring */
|
||||
} regmatch_t;
|
||||
|
||||
/* supplementary control and reporting */
|
||||
typedef struct {
|
||||
regmatch_t rm_extend; /* see REG_EXPECT */
|
||||
} rm_detail_t;
|
||||
typedef struct
|
||||
{
|
||||
regmatch_t rm_extend; /* see REG_EXPECT */
|
||||
} rm_detail_t;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* regex compilation flags
|
||||
*/
|
||||
#define REG_BASIC 000000 /* BREs (convenience) */
|
||||
#define REG_EXTENDED 000001 /* EREs */
|
||||
#define REG_ADVF 000002 /* advanced features in EREs */
|
||||
#define REG_ADVANCED 000003 /* AREs (which are also EREs) */
|
||||
#define REG_QUOTE 000004 /* no special characters, none */
|
||||
#define REG_NOSPEC REG_QUOTE /* historical synonym */
|
||||
#define REG_ICASE 000010 /* ignore case */
|
||||
#define REG_NOSUB 000020 /* don't care about subexpressions */
|
||||
#define REG_EXPANDED 000040 /* expanded format, white space & comments */
|
||||
#define REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */
|
||||
#define REG_NLANCH 000200 /* ^ matches after \n, $ before */
|
||||
#define REG_NEWLINE 000300 /* newlines are line terminators */
|
||||
#define REG_PEND 000400 /* ugh -- backward-compatibility hack */
|
||||
#define REG_EXPECT 001000 /* report details on partial/limited matches */
|
||||
#define REG_BOSONLY 002000 /* temporary kludge for BOS-only matches */
|
||||
#define REG_DUMP 004000 /* none of your business :-) */
|
||||
#define REG_FAKE 010000 /* none of your business :-) */
|
||||
#define REG_PROGRESS 020000 /* none of your business :-) */
|
||||
#define REG_BASIC 000000 /* BREs (convenience) */
|
||||
#define REG_EXTENDED 000001 /* EREs */
|
||||
#define REG_ADVF 000002 /* advanced features in EREs */
|
||||
#define REG_ADVANCED 000003 /* AREs (which are also EREs) */
|
||||
#define REG_QUOTE 000004 /* no special characters, none */
|
||||
#define REG_NOSPEC REG_QUOTE /* historical synonym */
|
||||
#define REG_ICASE 000010 /* ignore case */
|
||||
#define REG_NOSUB 000020 /* don't care about subexpressions */
|
||||
#define REG_EXPANDED 000040 /* expanded format, white space & comments */
|
||||
#define REG_NLSTOP 000100 /* \n doesn't match . or [^ ] */
|
||||
#define REG_NLANCH 000200 /* ^ matches after \n, $ before */
|
||||
#define REG_NEWLINE 000300 /* newlines are line terminators */
|
||||
#define REG_PEND 000400 /* ugh -- backward-compatibility hack */
|
||||
#define REG_EXPECT 001000 /* report details on partial/limited
|
||||
* matches */
|
||||
#define REG_BOSONLY 002000 /* temporary kludge for BOS-only matches */
|
||||
#define REG_DUMP 004000 /* none of your business :-) */
|
||||
#define REG_FAKE 010000 /* none of your business :-) */
|
||||
#define REG_PROGRESS 020000 /* none of your business :-) */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* regex execution flags
|
||||
*/
|
||||
#define REG_NOTBOL 0001 /* BOS is not BOL */
|
||||
#define REG_NOTEOL 0002 /* EOS is not EOL */
|
||||
#define REG_STARTEND 0004 /* backward compatibility kludge */
|
||||
#define REG_FTRACE 0010 /* none of your business */
|
||||
#define REG_MTRACE 0020 /* none of your business */
|
||||
#define REG_SMALL 0040 /* none of your business */
|
||||
#define REG_NOTBOL 0001 /* BOS is not BOL */
|
||||
#define REG_NOTEOL 0002 /* EOS is not EOL */
|
||||
#define REG_STARTEND 0004 /* backward compatibility kludge */
|
||||
#define REG_FTRACE 0010 /* none of your business */
|
||||
#define REG_MTRACE 0020 /* none of your business */
|
||||
#define REG_SMALL 0040 /* none of your business */
|
||||
|
||||
|
||||
/*
|
||||
@ -130,36 +134,37 @@ typedef struct {
|
||||
* Be careful if modifying the list of error codes -- the table used by
|
||||
* regerror() is generated automatically from this file!
|
||||
*/
|
||||
#define REG_OKAY 0 /* no errors detected */
|
||||
#define REG_NOMATCH 1 /* failed to match */
|
||||
#define REG_BADPAT 2 /* invalid regexp */
|
||||
#define REG_ECOLLATE 3 /* invalid collating element */
|
||||
#define REG_ECTYPE 4 /* invalid character class */
|
||||
#define REG_EESCAPE 5 /* invalid escape \ sequence */
|
||||
#define REG_ESUBREG 6 /* invalid backreference number */
|
||||
#define REG_EBRACK 7 /* brackets [] not balanced */
|
||||
#define REG_EPAREN 8 /* parentheses () not balanced */
|
||||
#define REG_EBRACE 9 /* braces {} not balanced */
|
||||
#define REG_BADBR 10 /* invalid repetition count(s) */
|
||||
#define REG_ERANGE 11 /* invalid character range */
|
||||
#define REG_ESPACE 12 /* out of memory */
|
||||
#define REG_BADRPT 13 /* quantifier operand invalid */
|
||||
#define REG_ASSERT 15 /* "can't happen" -- you found a bug */
|
||||
#define REG_INVARG 16 /* invalid argument to regex function */
|
||||
#define REG_MIXED 17 /* character widths of regex and string differ */
|
||||
#define REG_BADOPT 18 /* invalid embedded option */
|
||||
#define REG_OKAY 0 /* no errors detected */
|
||||
#define REG_NOMATCH 1 /* failed to match */
|
||||
#define REG_BADPAT 2 /* invalid regexp */
|
||||
#define REG_ECOLLATE 3 /* invalid collating element */
|
||||
#define REG_ECTYPE 4 /* invalid character class */
|
||||
#define REG_EESCAPE 5 /* invalid escape \ sequence */
|
||||
#define REG_ESUBREG 6 /* invalid backreference number */
|
||||
#define REG_EBRACK 7 /* brackets [] not balanced */
|
||||
#define REG_EPAREN 8 /* parentheses () not balanced */
|
||||
#define REG_EBRACE 9 /* braces {} not balanced */
|
||||
#define REG_BADBR 10 /* invalid repetition count(s) */
|
||||
#define REG_ERANGE 11 /* invalid character range */
|
||||
#define REG_ESPACE 12 /* out of memory */
|
||||
#define REG_BADRPT 13 /* quantifier operand invalid */
|
||||
#define REG_ASSERT 15 /* "can't happen" -- you found a bug */
|
||||
#define REG_INVARG 16 /* invalid argument to regex function */
|
||||
#define REG_MIXED 17 /* character widths of regex and string
|
||||
* differ */
|
||||
#define REG_BADOPT 18 /* invalid embedded option */
|
||||
/* two specials for debugging and testing */
|
||||
#define REG_ATOI 101 /* convert error-code name to number */
|
||||
#define REG_ITOA 102 /* convert error-code number to name */
|
||||
#define REG_ATOI 101 /* convert error-code name to number */
|
||||
#define REG_ITOA 102 /* convert error-code number to name */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* the prototypes for exported functions
|
||||
*/
|
||||
extern int pg_regcomp(regex_t *, const pg_wchar *, size_t, int);
|
||||
extern int pg_regexec(regex_t *, const pg_wchar *, size_t, rm_detail_t *, size_t, regmatch_t [], int);
|
||||
extern int pg_regcomp(regex_t *, const pg_wchar *, size_t, int);
|
||||
extern int pg_regexec(regex_t *, const pg_wchar *, size_t, rm_detail_t *, size_t, regmatch_t[], int);
|
||||
extern void pg_regfree(regex_t *);
|
||||
extern size_t pg_regerror(int, const regex_t *, char *, size_t);
|
||||
|
||||
#endif /* _REGEX_H_ */
|
||||
#endif /* _REGEX_H_ */
|
||||
|
@ -1,21 +1,21 @@
|
||||
/*
|
||||
* Internal interface definitions, etc., for the reg package
|
||||
*
|
||||
* Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
|
||||
*
|
||||
* Copyright (c) 1998, 1999 Henry Spencer. All rights reserved.
|
||||
*
|
||||
* Development of this software was funded, in part, by Cray Research Inc.,
|
||||
* UUNET Communications Services Inc., Sun Microsystems Inc., and Scriptics
|
||||
* Corporation, none of whom are responsible for the results. The author
|
||||
* thanks all of them.
|
||||
*
|
||||
* thanks all of them.
|
||||
*
|
||||
* Redistribution and use in source and binary forms -- with or without
|
||||
* modification -- are permitted for any purpose, provided that
|
||||
* redistributions in source form retain this entire copyright notice and
|
||||
* indicate the origin and nature of any modifications.
|
||||
*
|
||||
*
|
||||
* I'd appreciate being given credit for this package in the documentation
|
||||
* of software which uses it, but that is not a requirement.
|
||||
*
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
|
||||
* AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
|
||||
@ -27,7 +27,7 @@
|
||||
* OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
|
||||
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
* $Id: regguts.h,v 1.1 2003/02/05 17:41:32 tgl Exp $
|
||||
* $Id: regguts.h,v 1.2 2003/08/04 00:43:32 momjian Exp $
|
||||
*/
|
||||
|
||||
|
||||
@ -47,34 +47,34 @@
|
||||
|
||||
/* assertions */
|
||||
#ifndef assert
|
||||
# ifndef REG_DEBUG
|
||||
# define NDEBUG /* no assertions */
|
||||
# endif
|
||||
#ifndef REG_DEBUG
|
||||
#define NDEBUG /* no assertions */
|
||||
#endif
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
/* voids */
|
||||
#ifndef DISCARD
|
||||
#define DISCARD void /* for throwing values away */
|
||||
#define DISCARD void /* for throwing values away */
|
||||
#endif
|
||||
#ifndef VS
|
||||
#define VS(x) ((void *)(x)) /* cast something to generic ptr */
|
||||
#define VS(x) ((void *)(x)) /* cast something to generic ptr */
|
||||
#endif
|
||||
|
||||
/* function-pointer declarator */
|
||||
#ifndef FUNCPTR
|
||||
#define FUNCPTR(name, args) (*name) args
|
||||
#define FUNCPTR(name, args) (*name) args
|
||||
#endif
|
||||
|
||||
/* memory allocation */
|
||||
#ifndef MALLOC
|
||||
#define MALLOC(n) malloc(n)
|
||||
#define MALLOC(n) malloc(n)
|
||||
#endif
|
||||
#ifndef REALLOC
|
||||
#define REALLOC(p, n) realloc(VS(p), n)
|
||||
#define REALLOC(p, n) realloc(VS(p), n)
|
||||
#endif
|
||||
#ifndef FREE
|
||||
#define FREE(p) free(VS(p))
|
||||
#define FREE(p) free(VS(p))
|
||||
#endif
|
||||
|
||||
/* want size of a char in bits, and max value in bounded quantifiers */
|
||||
@ -82,7 +82,7 @@
|
||||
#include <limits.h>
|
||||
#endif
|
||||
#ifndef _POSIX2_RE_DUP_MAX
|
||||
#define _POSIX2_RE_DUP_MAX 255 /* normally from <limits.h> */
|
||||
#define _POSIX2_RE_DUP_MAX 255 /* normally from <limits.h> */
|
||||
#endif
|
||||
|
||||
|
||||
@ -91,13 +91,13 @@
|
||||
* misc
|
||||
*/
|
||||
|
||||
#define NOTREACHED 0
|
||||
#define xxx 1
|
||||
#define NOTREACHED 0
|
||||
#define xxx 1
|
||||
|
||||
#define DUPMAX _POSIX2_RE_DUP_MAX
|
||||
#define INFINITY (DUPMAX+1)
|
||||
#define DUPMAX _POSIX2_RE_DUP_MAX
|
||||
#define INFINITY (DUPMAX+1)
|
||||
|
||||
#define REMAGIC 0xfed7 /* magic number for main struct */
|
||||
#define REMAGIC 0xfed7 /* magic number for main struct */
|
||||
|
||||
|
||||
|
||||
@ -106,12 +106,12 @@
|
||||
*/
|
||||
#ifdef REG_DEBUG
|
||||
/* FDEBUG does finite-state tracing */
|
||||
#define FDEBUG(arglist) { if (v->eflags®_FTRACE) printf arglist; }
|
||||
#define FDEBUG(arglist) { if (v->eflags®_FTRACE) printf arglist; }
|
||||
/* MDEBUG does higher-level tracing */
|
||||
#define MDEBUG(arglist) { if (v->eflags®_MTRACE) printf arglist; }
|
||||
#define MDEBUG(arglist) { if (v->eflags®_MTRACE) printf arglist; }
|
||||
#else
|
||||
#define FDEBUG(arglist) {}
|
||||
#define MDEBUG(arglist) {}
|
||||
#define FDEBUG(arglist) {}
|
||||
#define MDEBUG(arglist) {}
|
||||
#endif
|
||||
|
||||
|
||||
@ -119,24 +119,25 @@
|
||||
/*
|
||||
* bitmap manipulation
|
||||
*/
|
||||
#define UBITS (CHAR_BIT * sizeof(unsigned))
|
||||
#define BSET(uv, sn) ((uv)[(sn)/UBITS] |= (unsigned)1 << ((sn)%UBITS))
|
||||
#define ISBSET(uv, sn) ((uv)[(sn)/UBITS] & ((unsigned)1 << ((sn)%UBITS)))
|
||||
#define UBITS (CHAR_BIT * sizeof(unsigned))
|
||||
#define BSET(uv, sn) ((uv)[(sn)/UBITS] |= (unsigned)1 << ((sn)%UBITS))
|
||||
#define ISBSET(uv, sn) ((uv)[(sn)/UBITS] & ((unsigned)1 << ((sn)%UBITS)))
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* We dissect a chr into byts for colormap table indexing. Here we define
|
||||
* a byt, which will be the same as a byte on most machines... The exact
|
||||
* We dissect a chr into byts for colormap table indexing. Here we define
|
||||
* a byt, which will be the same as a byte on most machines... The exact
|
||||
* size of a byt is not critical, but about 8 bits is good, and extraction
|
||||
* of 8-bit chunks is sometimes especially fast.
|
||||
*/
|
||||
#ifndef BYTBITS
|
||||
#define BYTBITS 8 /* bits in a byt */
|
||||
#define BYTBITS 8 /* bits in a byt */
|
||||
#endif
|
||||
#define BYTTAB (1<<BYTBITS) /* size of table with one entry per byt value */
|
||||
#define BYTMASK (BYTTAB-1) /* bit mask for byt */
|
||||
#define NBYTS ((CHRBITS+BYTBITS-1)/BYTBITS)
|
||||
#define BYTTAB (1<<BYTBITS) /* size of table with one entry per byt
|
||||
* value */
|
||||
#define BYTMASK (BYTTAB-1) /* bit mask for byt */
|
||||
#define NBYTS ((CHRBITS+BYTBITS-1)/BYTBITS)
|
||||
/* the definition of GETCOLOR(), below, assumes NBYTS <= 4 */
|
||||
|
||||
|
||||
@ -145,79 +146,86 @@
|
||||
* As soon as possible, we map chrs into equivalence classes -- "colors" --
|
||||
* which are of much more manageable number.
|
||||
*/
|
||||
typedef short color; /* colors of characters */
|
||||
typedef int pcolor; /* what color promotes to */
|
||||
#define COLORLESS (-1) /* impossible color */
|
||||
#define WHITE 0 /* default color, parent of all others */
|
||||
typedef short color; /* colors of characters */
|
||||
typedef int pcolor; /* what color promotes to */
|
||||
|
||||
#define COLORLESS (-1) /* impossible color */
|
||||
#define WHITE 0 /* default color, parent of all others */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* A colormap is a tree -- more precisely, a DAG -- indexed at each level
|
||||
* by a byt of the chr, to map the chr to a color efficiently. Because
|
||||
* by a byt of the chr, to map the chr to a color efficiently. Because
|
||||
* lower sections of the tree can be shared, it can exploit the usual
|
||||
* sparseness of such a mapping table. The tree is always NBYTS levels
|
||||
* sparseness of such a mapping table. The tree is always NBYTS levels
|
||||
* deep (in the past it was shallower during construction but was "filled"
|
||||
* to full depth at the end of that); areas that are unaltered as yet point
|
||||
* to "fill blocks" which are entirely WHITE in color.
|
||||
*/
|
||||
|
||||
/* the tree itself */
|
||||
struct colors {
|
||||
color ccolor[BYTTAB];
|
||||
struct colors
|
||||
{
|
||||
color ccolor[BYTTAB];
|
||||
};
|
||||
struct ptrs {
|
||||
struct ptrs
|
||||
{
|
||||
union tree *pptr[BYTTAB];
|
||||
};
|
||||
union tree {
|
||||
union tree
|
||||
{
|
||||
struct colors colors;
|
||||
struct ptrs ptrs;
|
||||
};
|
||||
#define tcolor colors.ccolor
|
||||
#define tptr ptrs.pptr
|
||||
|
||||
#define tcolor colors.ccolor
|
||||
#define tptr ptrs.pptr
|
||||
|
||||
/* internal per-color structure for the color machinery */
|
||||
struct colordesc {
|
||||
uchr nchrs; /* number of chars of this color */
|
||||
color sub; /* open subcolor (if any); free chain ptr */
|
||||
# define NOSUB COLORLESS
|
||||
struct arc *arcs; /* color chain */
|
||||
int flags;
|
||||
# define FREECOL 01 /* currently free */
|
||||
# define PSEUDO 02 /* pseudocolor, no real chars */
|
||||
# define UNUSEDCOLOR(cd) ((cd)->flags&FREECOL)
|
||||
union tree *block; /* block of solid color, if any */
|
||||
struct colordesc
|
||||
{
|
||||
uchr nchrs; /* number of chars of this color */
|
||||
color sub; /* open subcolor (if any); free chain ptr */
|
||||
#define NOSUB COLORLESS
|
||||
struct arc *arcs; /* color chain */
|
||||
int flags;
|
||||
#define FREECOL 01 /* currently free */
|
||||
#define PSEUDO 02 /* pseudocolor, no real chars */
|
||||
#define UNUSEDCOLOR(cd) ((cd)->flags&FREECOL)
|
||||
union tree *block; /* block of solid color, if any */
|
||||
};
|
||||
|
||||
/* the color map itself */
|
||||
struct colormap {
|
||||
int magic;
|
||||
# define CMMAGIC 0x876
|
||||
struct vars *v; /* for compile error reporting */
|
||||
size_t ncds; /* number of colordescs */
|
||||
size_t max; /* highest in use */
|
||||
color free; /* beginning of free chain (if non-0) */
|
||||
struct colormap
|
||||
{
|
||||
int magic;
|
||||
#define CMMAGIC 0x876
|
||||
struct vars *v; /* for compile error reporting */
|
||||
size_t ncds; /* number of colordescs */
|
||||
size_t max; /* highest in use */
|
||||
color free; /* beginning of free chain (if non-0) */
|
||||
struct colordesc *cd;
|
||||
# define CDEND(cm) (&(cm)->cd[(cm)->max + 1])
|
||||
# define NINLINECDS ((size_t)10)
|
||||
#define CDEND(cm) (&(cm)->cd[(cm)->max + 1])
|
||||
#define NINLINECDS ((size_t)10)
|
||||
struct colordesc cdspace[NINLINECDS];
|
||||
union tree tree[NBYTS]; /* tree top, plus fill blocks */
|
||||
union tree tree[NBYTS]; /* tree top, plus fill blocks */
|
||||
};
|
||||
|
||||
/* optimization magic to do fast chr->color mapping */
|
||||
#define B0(c) ((c) & BYTMASK)
|
||||
#define B1(c) (((c)>>BYTBITS) & BYTMASK)
|
||||
#define B2(c) (((c)>>(2*BYTBITS)) & BYTMASK)
|
||||
#define B3(c) (((c)>>(3*BYTBITS)) & BYTMASK)
|
||||
#define B0(c) ((c) & BYTMASK)
|
||||
#define B1(c) (((c)>>BYTBITS) & BYTMASK)
|
||||
#define B2(c) (((c)>>(2*BYTBITS)) & BYTMASK)
|
||||
#define B3(c) (((c)>>(3*BYTBITS)) & BYTMASK)
|
||||
#if NBYTS == 1
|
||||
#define GETCOLOR(cm, c) ((cm)->tree->tcolor[B0(c)])
|
||||
#define GETCOLOR(cm, c) ((cm)->tree->tcolor[B0(c)])
|
||||
#endif
|
||||
/* beware, for NBYTS>1, GETCOLOR() is unsafe -- 2nd arg used repeatedly */
|
||||
#if NBYTS == 2
|
||||
#define GETCOLOR(cm, c) ((cm)->tree->tptr[B1(c)]->tcolor[B0(c)])
|
||||
#define GETCOLOR(cm, c) ((cm)->tree->tptr[B1(c)]->tcolor[B0(c)])
|
||||
#endif
|
||||
#if NBYTS == 4
|
||||
#define GETCOLOR(cm, c) ((cm)->tree->tptr[B3(c)]->tptr[B2(c)]->tptr[B1(c)]->tcolor[B0(c)])
|
||||
#define GETCOLOR(cm, c) ((cm)->tree->tptr[B3(c)]->tptr[B2(c)]->tptr[B1(c)]->tcolor[B0(c)])
|
||||
#endif
|
||||
|
||||
|
||||
@ -226,22 +234,23 @@ struct colormap {
|
||||
* Interface definitions for locale-interface functions in locale.c.
|
||||
* Multi-character collating elements (MCCEs) cause most of the trouble.
|
||||
*/
|
||||
struct cvec {
|
||||
int nchrs; /* number of chrs */
|
||||
int chrspace; /* number of chrs possible */
|
||||
chr *chrs; /* pointer to vector of chrs */
|
||||
int nranges; /* number of ranges (chr pairs) */
|
||||
int rangespace; /* number of chrs possible */
|
||||
chr *ranges; /* pointer to vector of chr pairs */
|
||||
int nmcces; /* number of MCCEs */
|
||||
int mccespace; /* number of MCCEs possible */
|
||||
int nmccechrs; /* number of chrs used for MCCEs */
|
||||
chr *mcces[1]; /* pointers to 0-terminated MCCEs */
|
||||
/* and both batches of chrs are on the end */
|
||||
struct cvec
|
||||
{
|
||||
int nchrs; /* number of chrs */
|
||||
int chrspace; /* number of chrs possible */
|
||||
chr *chrs; /* pointer to vector of chrs */
|
||||
int nranges; /* number of ranges (chr pairs) */
|
||||
int rangespace; /* number of chrs possible */
|
||||
chr *ranges; /* pointer to vector of chr pairs */
|
||||
int nmcces; /* number of MCCEs */
|
||||
int mccespace; /* number of MCCEs possible */
|
||||
int nmccechrs; /* number of chrs used for MCCEs */
|
||||
chr *mcces[1]; /* pointers to 0-terminated MCCEs */
|
||||
/* and both batches of chrs are on the end */
|
||||
};
|
||||
|
||||
/* caution: this value cannot be changed easily */
|
||||
#define MAXMCCE 2 /* length of longest MCCE */
|
||||
#define MAXMCCE 2 /* length of longest MCCE */
|
||||
|
||||
|
||||
|
||||
@ -253,54 +262,59 @@ struct cvec {
|
||||
*/
|
||||
struct state;
|
||||
|
||||
struct arc {
|
||||
int type;
|
||||
# define ARCFREE '\0'
|
||||
color co;
|
||||
struct state *from; /* where it's from (and contained within) */
|
||||
struct state *to; /* where it's to */
|
||||
struct arc *outchain; /* *from's outs chain or free chain */
|
||||
# define freechain outchain
|
||||
struct arc *inchain; /* *to's ins chain */
|
||||
struct arc *colorchain; /* color's arc chain */
|
||||
struct arc
|
||||
{
|
||||
int type;
|
||||
#define ARCFREE '\0'
|
||||
color co;
|
||||
struct state *from; /* where it's from (and contained within) */
|
||||
struct state *to; /* where it's to */
|
||||
struct arc *outchain; /* *from's outs chain or free chain */
|
||||
#define freechain outchain
|
||||
struct arc *inchain; /* *to's ins chain */
|
||||
struct arc *colorchain; /* color's arc chain */
|
||||
};
|
||||
|
||||
struct arcbatch { /* for bulk allocation of arcs */
|
||||
struct arcbatch
|
||||
{ /* for bulk allocation of arcs */
|
||||
struct arcbatch *next;
|
||||
# define ABSIZE 10
|
||||
struct arc a[ABSIZE];
|
||||
#define ABSIZE 10
|
||||
struct arc a[ABSIZE];
|
||||
};
|
||||
|
||||
struct state {
|
||||
int no;
|
||||
# define FREESTATE (-1)
|
||||
char flag; /* marks special states */
|
||||
int nins; /* number of inarcs */
|
||||
struct arc *ins; /* chain of inarcs */
|
||||
int nouts; /* number of outarcs */
|
||||
struct arc *outs; /* chain of outarcs */
|
||||
struct arc *free; /* chain of free arcs */
|
||||
struct state *tmp; /* temporary for traversal algorithms */
|
||||
struct state *next; /* chain for traversing all */
|
||||
struct state *prev; /* back chain */
|
||||
struct arcbatch oas; /* first arcbatch, avoid malloc in easy case */
|
||||
int noas; /* number of arcs used in first arcbatch */
|
||||
struct state
|
||||
{
|
||||
int no;
|
||||
#define FREESTATE (-1)
|
||||
char flag; /* marks special states */
|
||||
int nins; /* number of inarcs */
|
||||
struct arc *ins; /* chain of inarcs */
|
||||
int nouts; /* number of outarcs */
|
||||
struct arc *outs; /* chain of outarcs */
|
||||
struct arc *free; /* chain of free arcs */
|
||||
struct state *tmp; /* temporary for traversal algorithms */
|
||||
struct state *next; /* chain for traversing all */
|
||||
struct state *prev; /* back chain */
|
||||
struct arcbatch oas; /* first arcbatch, avoid malloc in easy
|
||||
* case */
|
||||
int noas; /* number of arcs used in first arcbatch */
|
||||
};
|
||||
|
||||
struct nfa {
|
||||
struct state *pre; /* pre-initial state */
|
||||
struct state *init; /* initial state */
|
||||
struct state *final; /* final state */
|
||||
struct state *post; /* post-final state */
|
||||
int nstates; /* for numbering states */
|
||||
struct state *states; /* state-chain header */
|
||||
struct state *slast; /* tail of the chain */
|
||||
struct state *free; /* free list */
|
||||
struct colormap *cm; /* the color map */
|
||||
color bos[2]; /* colors, if any, assigned to BOS and BOL */
|
||||
color eos[2]; /* colors, if any, assigned to EOS and EOL */
|
||||
struct vars *v; /* simplifies compile error reporting */
|
||||
struct nfa *parent; /* parent NFA, if any */
|
||||
struct nfa
|
||||
{
|
||||
struct state *pre; /* pre-initial state */
|
||||
struct state *init; /* initial state */
|
||||
struct state *final; /* final state */
|
||||
struct state *post; /* post-final state */
|
||||
int nstates; /* for numbering states */
|
||||
struct state *states; /* state-chain header */
|
||||
struct state *slast; /* tail of the chain */
|
||||
struct state *free; /* free list */
|
||||
struct colormap *cm; /* the color map */
|
||||
color bos[2]; /* colors, if any, assigned to BOS and BOL */
|
||||
color eos[2]; /* colors, if any, assigned to EOS and EOL */
|
||||
struct vars *v; /* simplifies compile error reporting */
|
||||
struct nfa *parent; /* parent NFA, if any */
|
||||
};
|
||||
|
||||
|
||||
@ -308,58 +322,64 @@ struct nfa {
|
||||
/*
|
||||
* definitions for compacted NFA
|
||||
*/
|
||||
struct carc {
|
||||
color co; /* COLORLESS is list terminator */
|
||||
int to; /* state number */
|
||||
struct carc
|
||||
{
|
||||
color co; /* COLORLESS is list terminator */
|
||||
int to; /* state number */
|
||||
};
|
||||
|
||||
struct cnfa {
|
||||
int nstates; /* number of states */
|
||||
int ncolors; /* number of colors */
|
||||
int flags;
|
||||
# define HASLACONS 01 /* uses lookahead constraints */
|
||||
int pre; /* setup state number */
|
||||
int post; /* teardown state number */
|
||||
color bos[2]; /* colors, if any, assigned to BOS and BOL */
|
||||
color eos[2]; /* colors, if any, assigned to EOS and EOL */
|
||||
struct carc **states; /* vector of pointers to outarc lists */
|
||||
struct carc *arcs; /* the area for the lists */
|
||||
struct cnfa
|
||||
{
|
||||
int nstates; /* number of states */
|
||||
int ncolors; /* number of colors */
|
||||
int flags;
|
||||
#define HASLACONS 01 /* uses lookahead constraints */
|
||||
int pre; /* setup state number */
|
||||
int post; /* teardown state number */
|
||||
color bos[2]; /* colors, if any, assigned to BOS and BOL */
|
||||
color eos[2]; /* colors, if any, assigned to EOS and EOL */
|
||||
struct carc **states; /* vector of pointers to outarc lists */
|
||||
struct carc *arcs; /* the area for the lists */
|
||||
};
|
||||
#define ZAPCNFA(cnfa) ((cnfa).nstates = 0)
|
||||
#define NULLCNFA(cnfa) ((cnfa).nstates == 0)
|
||||
|
||||
#define ZAPCNFA(cnfa) ((cnfa).nstates = 0)
|
||||
#define NULLCNFA(cnfa) ((cnfa).nstates == 0)
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* subexpression tree
|
||||
*/
|
||||
struct subre {
|
||||
char op; /* '|', '.' (concat), 'b' (backref), '(', '=' */
|
||||
char flags;
|
||||
# define LONGER 01 /* prefers longer match */
|
||||
# define SHORTER 02 /* prefers shorter match */
|
||||
# define MIXED 04 /* mixed preference below */
|
||||
# define CAP 010 /* capturing parens below */
|
||||
# define BACKR 020 /* back reference below */
|
||||
# define INUSE 0100 /* in use in final tree */
|
||||
# define LOCAL 03 /* bits which may not propagate up */
|
||||
# define LMIX(f) ((f)<<2) /* LONGER -> MIXED */
|
||||
# define SMIX(f) ((f)<<1) /* SHORTER -> MIXED */
|
||||
# define UP(f) (((f)&~LOCAL) | (LMIX(f) & SMIX(f) & MIXED))
|
||||
# define MESSY(f) ((f)&(MIXED|CAP|BACKR))
|
||||
# define PREF(f) ((f)&LOCAL)
|
||||
# define PREF2(f1, f2) ((PREF(f1) != 0) ? PREF(f1) : PREF(f2))
|
||||
# define COMBINE(f1, f2) (UP((f1)|(f2)) | PREF2(f1, f2))
|
||||
short retry; /* index into retry memory */
|
||||
int subno; /* subexpression number (for 'b' and '(') */
|
||||
short min; /* min repetitions, for backref only */
|
||||
short max; /* max repetitions, for backref only */
|
||||
struct subre *left; /* left child, if any (also freelist chain) */
|
||||
struct subre *right; /* right child, if any */
|
||||
struct state *begin; /* outarcs from here... */
|
||||
struct state *end; /* ...ending in inarcs here */
|
||||
struct cnfa cnfa; /* compacted NFA, if any */
|
||||
struct subre *chain; /* for bookkeeping and error cleanup */
|
||||
struct subre
|
||||
{
|
||||
char op; /* '|', '.' (concat), 'b' (backref), '(',
|
||||
* '=' */
|
||||
char flags;
|
||||
#define LONGER 01 /* prefers longer match */
|
||||
#define SHORTER 02 /* prefers shorter match */
|
||||
#define MIXED 04 /* mixed preference below */
|
||||
#define CAP 010 /* capturing parens below */
|
||||
#define BACKR 020 /* back reference below */
|
||||
#define INUSE 0100 /* in use in final tree */
|
||||
#define LOCAL 03 /* bits which may not propagate up */
|
||||
#define LMIX(f) ((f)<<2) /* LONGER -> MIXED */
|
||||
#define SMIX(f) ((f)<<1) /* SHORTER -> MIXED */
|
||||
#define UP(f) (((f)&~LOCAL) | (LMIX(f) & SMIX(f) & MIXED))
|
||||
#define MESSY(f) ((f)&(MIXED|CAP|BACKR))
|
||||
#define PREF(f) ((f)&LOCAL)
|
||||
#define PREF2(f1, f2) ((PREF(f1) != 0) ? PREF(f1) : PREF(f2))
|
||||
#define COMBINE(f1, f2) (UP((f1)|(f2)) | PREF2(f1, f2))
|
||||
short retry; /* index into retry memory */
|
||||
int subno; /* subexpression number (for 'b' and '(') */
|
||||
short min; /* min repetitions, for backref only */
|
||||
short max; /* max repetitions, for backref only */
|
||||
struct subre *left; /* left child, if any (also freelist
|
||||
* chain) */
|
||||
struct subre *right; /* right child, if any */
|
||||
struct state *begin; /* outarcs from here... */
|
||||
struct state *end; /* ...ending in inarcs here */
|
||||
struct cnfa cnfa; /* compacted NFA, if any */
|
||||
struct subre *chain; /* for bookkeeping and error cleanup */
|
||||
};
|
||||
|
||||
|
||||
@ -368,8 +388,9 @@ struct subre {
|
||||
* table of function pointers for generic manipulation functions
|
||||
* A regex_t's re_fns points to one of these.
|
||||
*/
|
||||
struct fns {
|
||||
void FUNCPTR(free, (regex_t *));
|
||||
struct fns
|
||||
{
|
||||
void FUNCPTR(free, (regex_t *));
|
||||
};
|
||||
|
||||
|
||||
@ -377,17 +398,18 @@ struct fns {
|
||||
/*
|
||||
* the insides of a regex_t, hidden behind a void *
|
||||
*/
|
||||
struct guts {
|
||||
int magic;
|
||||
# define GUTSMAGIC 0xfed9
|
||||
int cflags; /* copy of compile flags */
|
||||
long info; /* copy of re_info */
|
||||
size_t nsub; /* copy of re_nsub */
|
||||
struct guts
|
||||
{
|
||||
int magic;
|
||||
#define GUTSMAGIC 0xfed9
|
||||
int cflags; /* copy of compile flags */
|
||||
long info; /* copy of re_info */
|
||||
size_t nsub; /* copy of re_nsub */
|
||||
struct subre *tree;
|
||||
struct cnfa search; /* for fast preliminary search */
|
||||
int ntree;
|
||||
struct cnfa search; /* for fast preliminary search */
|
||||
int ntree;
|
||||
struct colormap cmap;
|
||||
int FUNCPTR(compare, (const chr *, const chr *, size_t));
|
||||
struct subre *lacons; /* lookahead-constraint vector */
|
||||
int nlacons; /* size of lacons */
|
||||
int FUNCPTR(compare, (const chr *, const chr *, size_t));
|
||||
struct subre *lacons; /* lookahead-constraint vector */
|
||||
int nlacons; /* size of lacons */
|
||||
};
|
||||
|
Reference in New Issue
Block a user