[MKISOFS]
[reactos.git] / reactos / sdk / tools / mkisofs / schilytools / include / schily / patmatch.h
1 /* @(#)patmatch.h 1.15 10/08/27 Copyright 1985,1993-2010 J. Schilling */
2
3 #ifndef _SCHILY_PATMATCH_H
4 #define _SCHILY_PATMATCH_H
5 /*
6 * Definitions for the pattern matching functions.
7 *
8 * Copyright (c) 1985,1993-2010 J. Schilling
9 */
10 /*
11 * The contents of this file are subject to the terms of the
12 * Common Development and Distribution License, Version 1.0 only
13 * (the "License"). You may not use this file except in compliance
14 * with the License.
15 *
16 * See the file CDDL.Schily.txt in this distribution for details.
17 *
18 * When distributing Covered Code, include this CDDL HEADER in each
19 * file and include the License file CDDL.Schily.txt from this distribution.
20 */
21 /*
22 * The pattern matching functions are based on the algorithm
23 * presented by Martin Richards in:
24 *
25 * "A Compact Function for Regular Expression Pattern Matching",
26 * Software-Practice and Experience, Vol. 9, 527-534 (1979)
27 *
28 * Several changes have been made to the original source which has been
29 * written in BCPL:
30 *
31 * '/' is replaced by '!' (to allow UNIX filenames)
32 * '(',')' are replaced by '{', '}'
33 * '\'' is replaced by '\\' (UNIX compatible quote)
34 *
35 * Character classes have been added to allow "[<character list>]"
36 * to be used.
37 * Start of line '^' and end of line '$' have been added.
38 *
39 * Any number in the following comment is zero or more occurrencies
40 */
41 #ifndef _SCHILY_MCONFIG_H
42 #include <schily/mconfig.h>
43 #endif
44
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48
49 #define ALT '!' /* Alternation in match i.e. this!that!the_other */
50 #define REP '#' /* Any number of occurrences of the following expr */
51 #define NIL '%' /* Empty string (exactly nothing) */
52 #define STAR '*' /* Any number of any character (equivalent of #?) */
53 #define ANY '?' /* Any one character */
54 #define QUOTE '\\' /* Quotes the next character */
55 #define LBRACK '{' /* Begin of precedence grouping */
56 #define RBRACK '}' /* End of precedence grouping */
57 #define LCLASS '[' /* Begin of character set */
58 #define RCLASS ']' /* End of character set */
59 #define NOT '^' /* If first in set: invert set content */
60 #define RANGE '-' /* Range notation in sets */
61 #define START '^' /* Begin of a line */
62 #define END '$' /* End of a line */
63
64 /*
65 * A list of case statements that may be used for a issimple() or ispattern()
66 * funtion that checks whether a string conrtains characters that need the
67 * pattern matcher.
68 *
69 * Note that this list does not contain NOT or RANGE because you need
70 * LCLASS and RCLASS in addition.
71 */
72 #define casePAT case ALT: case REP: case NIL: case STAR: case ANY: \
73 case QUOTE: case LBRACK: case RBRACK: \
74 case LCLASS: case RCLASS: case START: case END:
75
76
77 #define MAXPAT 128 /* Max length of pattern for opatmatch()/opatlmatch() */
78
79 extern int patcompile __PR((const unsigned char *__pat, int __patlen,
80 int *__aux));
81
82 extern unsigned char *opatmatch __PR((const unsigned char *__pat,
83 const int *__aux,
84 const unsigned char *__str,
85 int __soff, int __slen,
86 int __alt));
87 extern unsigned char *opatlmatch __PR((const unsigned char *__pat,
88 const int *__aux,
89 const unsigned char *__str,
90 int __soff, int __slen,
91 int __alt));
92 extern unsigned char *patmatch __PR((const unsigned char *__pat,
93 const int *__aux,
94 const unsigned char *__str,
95 int __soff, int __slen,
96 int __alt, int __state[]));
97 extern unsigned char *patlmatch __PR((const unsigned char *__pat,
98 const int *__aux,
99 const unsigned char *__str,
100 int __soff, int __slen,
101 int __alt, int __state[]));
102
103 #ifdef __cplusplus
104 }
105 #endif
106
107 #ifdef _SCHILY_WCHAR_H
108
109 #ifdef __cplusplus
110 extern "C" {
111 #endif
112
113 extern int patwcompile __PR((const wchar_t *__pat, int __patlen,
114 int *__aux));
115 extern wchar_t *patwmatch __PR((const wchar_t *__pat, const int *__aux,
116 const wchar_t *__str,
117 int __soff, int __slen,
118 int __alt, int __state[]));
119 extern wchar_t *patwlmatch __PR((const wchar_t *__pat, const int *__aux,
120 const wchar_t *__str,
121 int __soff, int __slen,
122 int __alt, int __state[]));
123
124
125 #ifdef __cplusplus
126 }
127 #endif
128 #endif /* _SCHILY_WCHAR_H */
129
130 #endif /* _SCHILY_PATMATCH_H */