tclRegexp.h 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * tclRegexp.h --
  3. *
  4. * This file contains definitions used internally by Henry Spencer's
  5. * 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 of
  11. * this file, and for a DISCLAIMER OF ALL WARRANTIES.
  12. */
  13. #ifndef _TCLREGEXP
  14. #define _TCLREGEXP
  15. #include "regex.h"
  16. /*
  17. * The TclRegexp structure encapsulates a compiled regex_t, the flags that
  18. * were used to compile it, and an array of pointers that are used to indicate
  19. * subexpressions after a call to Tcl_RegExpExec. Note that the string and
  20. * objPtr are mutually exclusive. These values are needed by Tcl_RegExpRange
  21. * in order to return pointers into the original string.
  22. */
  23. typedef struct TclRegexp {
  24. int flags; /* Regexp compile flags. */
  25. regex_t re; /* Compiled re, includes number of
  26. * subexpressions. */
  27. const char *string; /* Last string passed to Tcl_RegExpExec. */
  28. Tcl_Obj *objPtr; /* Last object passed to Tcl_RegExpExecObj. */
  29. Tcl_Obj *globObjPtr; /* Glob pattern rep of RE or NULL if none. */
  30. regmatch_t *matches; /* Array of indices into the Tcl_UniChar
  31. * representation of the last string matched
  32. * with this regexp to indicate the location
  33. * of subexpressions. */
  34. rm_detail_t details; /* Detailed information on match (currently
  35. * used only for REG_EXPECT). */
  36. int refCount; /* Count of number of references to this
  37. * compiled regexp. */
  38. } TclRegexp;
  39. #endif /* _TCLREGEXP */
  40. /*
  41. * Local Variables:
  42. * mode: c
  43. * c-basic-offset: 4
  44. * fill-column: 78
  45. * End:
  46. */