~ubuntu-branches/ubuntu/utopic/cdrdao/utopic

« back to all changes in this revision

Viewing changes to scsilib/include/patmatch.h

  • Committer: Bazaar Package Importer
  • Author(s): Andrew Suffield
  • Date: 2004-06-24 22:33:16 UTC
  • Revision ID: james.westby@ubuntu.com-20040624223316-534onzugaeeyq61j
Tags: upstream-1.1.9
ImportĀ upstreamĀ versionĀ 1.1.9

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* @(#)patmatch.h       1.10 03/08/24 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 along with
 
22
 * this program; see the file COPYING.  If not, write to the Free Software
 
23
 * Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, 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
#ifndef _PROTOTYP_H
 
49
#include <prototyp.h>
 
50
#endif
 
51
 
 
52
#ifdef  __cplusplus
 
53
extern "C" {
 
54
#endif
 
55
 
 
56
#define ALT     '!'     /* Alternation in match i.e. this!that!the_other */
 
57
#define REP     '#'     /* Any number of occurrences of the following expr */
 
58
#define NIL     '%'     /* Empty string (exactly nothing) */
 
59
#define STAR    '*'     /* Any number of any character (equivalent of #?) */
 
60
#define ANY     '?'     /* Any one character */
 
61
#define QUOTE   '\\'    /* Quotes the next character */
 
62
#define LBRACK  '{'     /* Begin of precedence grouping */
 
63
#define RBRACK  '}'     /* End of precedence grouping */
 
64
#define LCLASS  '['     /* Begin of character set */
 
65
#define RCLASS  ']'     /* End of character set */
 
66
#define NOT     '^'     /* If first in set: invert set content */
 
67
#define RANGE   '-'     /* Range notation in sets */
 
68
#define START   '^'     /* Begin of a line */
 
69
#define END     '$'     /* End of a line */
 
70
 
 
71
/*
 
72
 * A list of case statements that may be used for a issimple() or ispattern()
 
73
 * funtion that checks whether a string conrtains characters that need the
 
74
 * pattern matcher.
 
75
 *
 
76
 * Note that this list does not contain NOT or RANGE because you need
 
77
 * LCLASS and RCLASS in addition.
 
78
 */
 
79
#define casePAT case ALT: case REP: case NIL: case STAR: case ANY:      \
 
80
                case QUOTE: case LBRACK: case RBRACK:                   \
 
81
                case LCLASS: case RCLASS: case START: case END:
 
82
 
 
83
 
 
84
#define MAXPAT  128     /* Maximum length of pattern */
 
85
 
 
86
extern  int         patcompile  __PR((const unsigned char * __pat, int __patlen, int * __aux));
 
87
 
 
88
extern  unsigned char *opatmatch        __PR((const unsigned char * __pat, const int * __aux,
 
89
                                                const  unsigned char * __str, int __soff, int __slen,
 
90
                                                int __alt));
 
91
extern  unsigned char *opatlmatch __PR((const unsigned char * __pat, const int * __aux,
 
92
                                                const  unsigned char * __str, int __soff, int __slen,
 
93
                                                int __alt));
 
94
extern  unsigned char *patmatch __PR((const unsigned char * __pat, const int * __aux,
 
95
                                                const  unsigned char * __str, int __soff, int __slen,
 
96
                                                int __alt, int __state[]));
 
97
extern  unsigned char *patlmatch __PR((const unsigned char * __pat, const int * __aux,
 
98
                                                const  unsigned char * __str, int __soff, int __slen,
 
99
                                                int __alt, int __state[]));
 
100
 
 
101
#ifdef  __cplusplus
 
102
}
 
103
#endif
 
104
 
 
105
#endif  /* _PATMATCH_H */