home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 22 gnu / 22-gnu.zip / gnurx.zip / rx / inst-rxposix.h < prev    next >
C/C++ Source or Header  |  1995-12-31  |  4KB  |  128 lines

  1. /* classes: h_files */
  2.  
  3. #ifndef INST_RXPOSIXH
  4. #define INST_RXPOSIXH
  5. /***********************************************************
  6.  
  7. Copyright 1995 by Tom Lord
  8.  
  9.                         All Rights Reserved
  10.  
  11. Permission to use, copy, modify, and distribute this software and its 
  12. documentation for any purpose and without fee is hereby granted, 
  13. provided that the above copyright notice appear in all copies and that
  14. both that copyright notice and this permission notice appear in 
  15. supporting documentation, and that the name of the copyright holder not be
  16. used in advertising or publicity pertaining to distribution of the
  17. software without specific, written prior permission.  
  18.  
  19. Tom Lord DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  20. INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  21. EVENT SHALL TOM LORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  22. CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
  23. USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
  24. OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  25. PERFORMANCE OF THIS SOFTWARE.
  26.  
  27. ******************************************************************/
  28.  
  29.  
  30.  
  31. struct rx_posix_regex
  32. {
  33.   struct rexp_node * pattern;
  34.   struct rexp_node ** subexps;
  35.   int n_subexps;
  36.   unsigned char * translate;
  37.   unsigned int newline_anchor:1;/* If true, an anchor at a newline matches.*/
  38.   unsigned int no_sub:1;    /* If set, don't  return register offsets. */
  39.   unsigned int is_anchored:1;
  40.   unsigned char fastmap[256];
  41. };
  42.  
  43. typedef struct rx_posix_regex regex_t;
  44.  
  45.  
  46. /*
  47.  * POSIX `cflags' bits (i.e., information for `regcomp').
  48.  */
  49.  
  50. /* If this bit is set, then use extended regular expression syntax.
  51.  * If not set, then use basic regular expression syntax.  
  52.  */
  53. #define REG_EXTENDED 1
  54.  
  55. /* If this bit is set, then ignore case when matching.
  56.  * If not set, then case is significant.
  57.  */
  58. #define REG_ICASE (REG_EXTENDED << 1)
  59.  
  60. /* If this bit is set, then anchors do not match at newline
  61.  *   characters in the string.
  62.  * If not set, then anchors do match at newlines.  
  63.  */
  64. #define REG_NEWLINE (REG_ICASE << 1)
  65.  
  66. /* If this bit is set, then report only success or fail in regexec.
  67.  * If not set, then returns differ between not matching and errors.  
  68.  */
  69. #define REG_NOSUB (REG_NEWLINE << 1)
  70.  
  71.  
  72. /*
  73.  * POSIX `eflags' bits (i.e., information for regexec).  
  74.  */
  75.  
  76. /* If this bit is set, then the beginning-of-line operator doesn't match
  77.  *   the beginning of the string (presumably because it's not the
  78.  *   beginning of a line).
  79.  * If not set, then the beginning-of-line operator does match the
  80.  *   beginning of the string.  
  81.  */
  82. #define REG_NOTBOL 1
  83.  
  84. /* Like REG_NOTBOL, except for the end-of-line.  
  85.  */
  86. #define REG_NOTEOL (1 << 1)
  87.  
  88.  
  89. #ifdef __STDC__
  90. extern int regcomp (regex_t * preg, const char * pattern, int cflags);
  91. extern size_t regerror (int errcode, const regex_t *preg,
  92.             char *errbuf, size_t errbuf_size);
  93. extern int rx_regmatch (regmatch_t pmatch[],
  94.             regex_t *preg,
  95.             struct rx_context_rules * rules,
  96.             int start, int end, char *string);
  97. extern int rx_regexec (regmatch_t pmatch[],
  98.                regex_t *preg,
  99.                struct rx_context_rules * rules,
  100.                int start,
  101.                int end,
  102.                char *string);
  103. extern int regnexec (regex_t *preg, int len, char *string,
  104.              size_t nmatch, regmatch_t pmatch[],
  105.              int eflags);
  106. extern int regexec (regex_t *preg, char *string,
  107.             size_t nmatch, regmatch_t pmatch[],
  108.             int eflags);
  109. extern void regfree (regex_t *preg);
  110.  
  111. #else /* STDC */
  112. extern int regcomp ();
  113. extern size_t regerror ();
  114. extern int rx_regmatch ();
  115. extern int rx_regexec ();
  116. extern int regnexec ();
  117. extern int regexec ();
  118. extern void regfree ();
  119.  
  120. #endif /* STDC */
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127. #endif  /* INST_RXPOSIXH */
  128.