home *** CD-ROM | disk | FTP | other *** search
/ linuxmafia.com 2016 / linuxmafia.com.tar / linuxmafia.com / pub / linux / backup / star-1.3.1.tar.gz / star-1.3.1.tar / star-1.3.1 / include / patmatch.h < prev    next >
C/C++ Source or Header  |  2000-11-12  |  3KB  |  90 lines

  1. /* @(#)patmatch.h    1.7 00/11/12 Copyright 1985 J. Schilling */
  2.  
  3. #ifndef    _PATMATCH_H
  4. #define    _PATMATCH_H
  5. /*
  6.  *    Definitions for the pattern matching functions.
  7.  *
  8.  *    Copyright (c) 1985,1995 J. Schilling
  9.  */
  10. /*
  11.  * This program is free software; you can redistribute it and/or modify
  12.  * it under the terms of the GNU General Public License as published by
  13.  * the Free Software Foundation; either version 2, or (at your option)
  14.  * any later version.
  15.  *
  16.  * This program is distributed in the hope that it will be useful,
  17.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  19.  * GNU General Public License for more details.
  20.  *
  21.  * You should have received a copy of the GNU General Public License
  22.  * along with this program; see the file COPYING.  If not, write to
  23.  * the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
  24.  */
  25. /*
  26.  *    The pattern matching functions are based on the algorithm
  27.  *    presented by Martin Richards in:
  28.  *
  29.  *    "A Compact Function for Regular Expression Pattern Matching", 
  30.  *    Software-Practice and Experience, Vol. 9, 527-534 (1979)
  31.  *
  32.  *    Several changes have been made to the original source which has been
  33.  *    written in BCPL:
  34.  *
  35.  *    '/'    is replaced by    '!'        (to allow UNIX filenames)
  36.  *    '(',')' are replaced by    '{', '}'
  37.  *    '\''    is replaced by    '\\'        (UNIX compatible quote)
  38.  *
  39.  *    Character classes have been added to allow "[<character list>]"
  40.  *    to be used.
  41.  *    Start of line '^' and end of line '$' have been added.
  42.  *
  43.  *    Any number in the following comment is zero or more occurrencies
  44.  */
  45. #ifndef _MCONFIG_H
  46. #include <mconfig.h>
  47. #endif
  48.  
  49. #ifdef    __cplusplus
  50. extern "C" {
  51. #endif
  52.  
  53. #define    ALT    '!'    /* Alternation in match i.e. this!that!the_other */
  54. #define    REP    '#'    /* Any number of occurrences of the following expr */
  55. #define    NIL    '%'    /* Empty string (exactly nothing) */
  56. #define    STAR    '*'    /* Any number of any character (equivalent of #?) */
  57. #define    ANY    '?'    /* Any one character */
  58. #define    QUOTE    '\\'    /* Quotes the next character */
  59. #define    LBRACK    '{'    /* Begin of precedence grouping */
  60. #define    RBRACK    '}'    /* End of precedence grouping */
  61. #define    LCLASS    '['    /* Begin of character set */
  62. #define    RCLASS    ']'    /* End of character set */
  63. #define    NOT    '^'    /* If first in set: invert set content */
  64. #define    RANGE    '-'    /* Range notation in sets */
  65. #define    START    '^'    /* Begin of a line */
  66. #define    END    '$'    /* End of a line */
  67.  
  68. #define    MAXPAT    128    /* Maximum length of pattern */
  69.  
  70. extern    int         patcompile    __PR((const unsigned char * __pat, int __patlen, int * __aux));
  71.  
  72. extern    unsigned char *opatmatch    __PR((const unsigned char * __pat, const int * __aux,
  73.                         const  unsigned char * __str, int __soff, int __slen,
  74.                         int __alt));
  75. extern    unsigned char *opatlmatch __PR((const unsigned char * __pat, const int * __aux,
  76.                         const  unsigned char * __str, int __soff, int __slen,
  77.                         int __alt));
  78. extern    unsigned char *patmatch    __PR((const unsigned char * __pat, const int * __aux,
  79.                         const  unsigned char * __str, int __soff, int __slen,
  80.                         int __alt, int __state[]));
  81. extern    unsigned char *patlmatch __PR((const unsigned char * __pat, const int * __aux,
  82.                         const  unsigned char * __str, int __soff, int __slen,
  83.                         int __alt, int __state[]));
  84.  
  85. #ifdef    __cplusplus
  86. }
  87. #endif
  88.  
  89. #endif    /* _PATMATCH_H */
  90.