home *** CD-ROM | disk | FTP | other *** search
/ PC Extra Super CD 1998 January / PCPLUS131.iso / DJGPP / V2 / DJDEV201.ZIP / include / regex.h < prev    next >
Encoding:
C/C++ Source or Header  |  1995-06-13  |  2.0 KB  |  90 lines

  1. /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
  2. #ifndef __dj_include_regex_h_
  3. #define __dj_include_regex_h_
  4.  
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8.  
  9. #ifndef __dj_ENFORCE_ANSI_FREESTANDING
  10.  
  11. #ifndef __STRICT_ANSI__
  12.  
  13. #define _POSIX2_RE_DUP_MAX 256
  14.   
  15.  
  16. typedef off_t regoff_t;
  17. typedef struct {
  18.     int re_magic;
  19.     size_t re_nsub;        /* number of parenthesized subexpressions */
  20.     const char *re_endp;    /* end pointer for REG_PEND */
  21.     struct re_guts *re_g;    /* none of your business :-) */
  22. } regex_t;
  23. typedef struct {
  24.     regoff_t rm_so;        /* start of match */
  25.     regoff_t rm_eo;        /* end of match */
  26. } regmatch_t;
  27.  
  28.  
  29.  
  30. extern int regcomp(regex_t *, const char *, int);
  31. #define    REG_BASIC    0000
  32. #define    REG_EXTENDED    0001
  33. #define    REG_ICASE    0002
  34. #define    REG_NOSUB    0004
  35. #define    REG_NEWLINE    0010
  36. #define    REG_NOSPEC    0020
  37. #define    REG_PEND    0040
  38. #define    REG_DUMP    0200
  39.  
  40.  
  41.  
  42. #define    REG_NOMATCH     1
  43. #define    REG_BADPAT     2
  44. #define    REG_ECOLLATE     3
  45. #define    REG_ECTYPE     4
  46. #define    REG_EESCAPE     5
  47. #define    REG_ESUBREG     6
  48. #define    REG_EBRACK     7
  49. #define    REG_EPAREN     8
  50. #define    REG_EBRACE     9
  51. #define    REG_BADBR    10
  52. #define    REG_ERANGE    11
  53. #define    REG_ESPACE    12
  54. #define    REG_BADRPT    13
  55. #define    REG_EMPTY    14
  56. #define    REG_ASSERT    15
  57. #define    REG_INVARG    16
  58. #define    REG_ATOI    255    /* convert name to number (!) */
  59. #define    REG_ITOA    0400    /* convert number to name (!) */
  60. extern size_t regerror(int, const regex_t *, char *, size_t);
  61.  
  62.  
  63.  
  64. extern int regexec(const regex_t *, const char *, size_t, regmatch_t [], int);
  65. #define    REG_NOTBOL    00001
  66. #define    REG_NOTEOL    00002
  67. #define    REG_STARTEND    00004
  68. #define    REG_TRACE    00400    /* tracing of execution */
  69. #define    REG_LARGE    01000    /* force large representation */
  70. #define    REG_BACKR    02000    /* force use of backref code */
  71.  
  72.  
  73.  
  74. extern void regfree(regex_t *);
  75.  
  76. #ifndef _POSIX_SOURCE
  77.  
  78. #endif /* !_POSIX_SOURCE */
  79. #endif /* !__STRICT_ANSI__ */
  80. #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
  81.  
  82. #ifndef __dj_ENFORCE_FUNCTION_CALLS
  83. #endif /* !__dj_ENFORCE_FUNCTION_CALLS */
  84.  
  85. #ifdef __cplusplus
  86. }
  87. #endif
  88.  
  89. #endif /* !__dj_include_regex_h_ */
  90.