diff options
Diffstat (limited to 'generic/tclRegexp.h')
| -rw-r--r-- | generic/tclRegexp.h | 80 |
1 files changed, 42 insertions, 38 deletions
diff --git a/generic/tclRegexp.h b/generic/tclRegexp.h index eeda20d..3b2433e 100644 --- a/generic/tclRegexp.h +++ b/generic/tclRegexp.h @@ -1,48 +1,52 @@ /* - * Definitions etc. for regexp(3) routines. + * tclRegexp.h -- * - * Caveat: this is V8 regexp(3) [actually, a reimplementation thereof], - * not the System V one. + * This file contains definitions used internally by Henry Spencer's + * regular expression code. * - * RCS: @(#) $Id: tclRegexp.h,v 1.4 1998/09/14 18:40:02 stanton Exp $ + * Copyright (c) 1998 by Sun Microsystems, Inc. + * Copyright (c) 1998-1999 by Scriptics Corporation. + * + * See the file "license.terms" for information on usage and redistribution of + * this file, and for a DISCLAIMER OF ALL WARRANTIES. */ -#ifndef _REGEXP -#define _REGEXP 1 - -#ifndef _TCL -#include "tcl.h" -#endif +#ifndef _TCLREGEXP +#define _TCLREGEXP -#ifdef BUILD_tcl -# undef TCL_STORAGE_CLASS -# define TCL_STORAGE_CLASS DLLEXPORT -#endif +#include "regex.h" /* - * NSUBEXP must be at least 10, and no greater than 117 or the parser - * will not work properly. + * The TclRegexp structure encapsulates a compiled regex_t, the flags that + * were used to compile it, and an array of pointers that are used to indicate + * subexpressions after a call to Tcl_RegExpExec. Note that the string and + * objPtr are mutually exclusive. These values are needed by Tcl_RegExpRange + * in order to return pointers into the original string. */ -#define NSUBEXP 20 - -typedef struct regexp { - char *startp[NSUBEXP]; - char *endp[NSUBEXP]; - char regstart; /* Internal use only. */ - char reganch; /* Internal use only. */ - char *regmust; /* Internal use only. */ - int regmlen; /* Internal use only. */ - char program[1]; /* Unwarranted chumminess with compiler. */ -} regexp; - -EXTERN regexp *TclRegComp _ANSI_ARGS_((char *exp)); -EXTERN int TclRegExec _ANSI_ARGS_((regexp *prog, char *string, char *start)); -EXTERN void TclRegSub _ANSI_ARGS_((regexp *prog, char *source, char *dest)); -EXTERN void TclRegError _ANSI_ARGS_((char *msg)); -EXTERN char *TclGetRegError _ANSI_ARGS_((void)); - -# undef TCL_STORAGE_CLASS -# define TCL_STORAGE_CLASS DLLIMPORT - -#endif /* REGEXP */ +typedef struct TclRegexp { + int flags; /* Regexp compile flags. */ + regex_t re; /* Compiled re, includes number of + * subexpressions. */ + const char *string; /* Last string passed to Tcl_RegExpExec. */ + Tcl_Obj *objPtr; /* Last object passed to Tcl_RegExpExecObj. */ + Tcl_Obj *globObjPtr; /* Glob pattern rep of RE or NULL if none. */ + regmatch_t *matches; /* Array of indices into the Tcl_UniChar + * representation of the last string matched + * with this regexp to indicate the location + * of subexpressions. */ + rm_detail_t details; /* Detailed information on match (currently + * used only for REG_EXPECT). */ + int refCount; /* Count of number of references to this + * compiled regexp. */ +} TclRegexp; + +#endif /* _TCLREGEXP */ + +/* + * Local Variables: + * mode: c + * c-basic-offset: 4 + * fill-column: 78 + * End: + */ |
