| 1 | /* |
| 2 | * tclRegexp.h -- |
| 3 | * |
| 4 | * This file contains definitions used internally by Henry |
| 5 | * Spencer's regular expression code. |
| 6 | * |
| 7 | * Copyright (c) 1998 by Sun Microsystems, Inc. |
| 8 | * Copyright (c) 1998-1999 by Scriptics Corporation. |
| 9 | * |
| 10 | * See the file "license.terms" for information on usage and redistribution |
| 11 | * of this file, and for a DISCLAIMER OF ALL WARRANTIES. |
| 12 | * |
| 13 | * RCS: @(#) $Id: tclRegexp.h,v 1.11 1999/08/02 17:45:38 redman Exp $ |
| 14 | */ |
| 15 | |
| 16 | #ifndef _TCLREGEXP |
| 17 | #define _TCLREGEXP |
| 18 | |
| 19 | #include "regex.h" |
| 20 | |
| 21 | #ifdef BUILD_tcl |
| 22 | # undef TCL_STORAGE_CLASS |
| 23 | # define TCL_STORAGE_CLASS DLLEXPORT |
| 24 | #endif |
| 25 | |
| 26 | /* |
| 27 | * The TclRegexp structure encapsulates a compiled regex_t, |
| 28 | * the flags that were used to compile it, and an array of pointers |
| 29 | * that are used to indicate subexpressions after a call to Tcl_RegExpExec. |
| 30 | * Note that the string and objPtr are mutually exclusive. These values |
| 31 | * are needed by Tcl_RegExpRange in order to return pointers into the |
| 32 | * original string. |
| 33 | */ |
| 34 | |
| 35 | typedef struct TclRegexp { |
| 36 | int flags; /* Regexp compile flags. */ |
| 37 | regex_t re; /* Compiled re, includes number of |
| 38 | * subexpressions. */ |
| 39 | CONST char *string; /* Last string passed to Tcl_RegExpExec. */ |
| 40 | Tcl_Obj *objPtr; /* Last object passed to Tcl_RegExpExecObj. */ |
| 41 | regmatch_t *matches; /* Array of indices into the Tcl_UniChar |
| 42 | * representation of the last string matched |
| 43 | * with this regexp to indicate the location |
| 44 | * of subexpressions. */ |
| 45 | rm_detail_t details; /* Detailed information on match (currently |
| 46 | * used only for REG_EXPECT). */ |
| 47 | int refCount; /* Count of number of references to this |
| 48 | * compiled regexp. */ |
| 49 | } TclRegexp; |
| 50 | |
| 51 | #endif /* _TCLREGEXP */ |