asoma.dev · the C reference for libose
libose
the C library every o.se host is built on
Loading...
Searching...
No Matches
ose_match.h
Go to the documentation of this file.
1/*
2Written by John MacCallum, The Center for New Music and Audio
3Technologies, University of California, Berkeley. Copyright (c)
42009, The Regents of the University of California (Regents).
5Permission to use, copy, modify, distribute, and distribute
6modified versions of this software and its documentation without
7fee and without a signed licensing agreement, is hereby granted,
8provided that the above copyright notice, this paragraph and the
9following two paragraphs appear in all copies, modifications, and
10distributions.
11
12IN NO EVENT SHALL REGENTS BE LIABLE TO ANY PARTY FOR DIRECT,
13INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES,
14INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE
15AND ITS DOCUMENTATION, EVEN IF REGENTS HAS BEEN ADVISED OF THE
16POSSIBILITY OF SUCH DAMAGE.
17
18REGENTS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT
19LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20FOR A PARTICULAR PURPOSE. THE SOFTWARE AND ACCOMPANYING
21DOCUMENTATION, IF ANY, PROVIDED HEREUNDER IS PROVIDED "AS
22IS". REGENTS HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT,
23UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
24*/
25
32#ifndef OSE_MATCH_H
33#define OSE_MATCH_H
34
35#ifdef __cplusplus
36extern "C" {
37#endif
38
43#define OSE_MATCH_BACKTRACK_LIMIT 100
44
49#define OSE_MATCH_ENABLE_2STARS 1
50
56#define OSE_MATCH_ENABLE_NSTARS 1
57
71#define OSE_MATCH_ALLOW_STAR_IN_ADDRESS
72
73#define OSE_MATCH_DESCENDANTS
74
75/* The repetition operators, '#' and '##'.
76
77 This was never defined anywhere -- not in a header, a Makefile, or the
78 Xcode project -- while only 6 of the 19 sites in ose_match.c that handle
79 '#' were inside the #ifdef. So the operator has been running in a
80 half-compiled state: the gated half never built, the ungated half always
81 did, and turning the option off did nothing. */
82#define OSE_MATCH_REPETITION
83
88{
89 OSE_MATCH_NOMATCH = 0,
90 OSE_MATCH_ADDRESS_COMPLETE,
91 OSE_MATCH_PATTERN_COMPLETE,
92 OSE_MATCH_BOTH_COMPLETE,
93 OSE_MATCH_ERROR_UNMATCHED_LEFT_SQUARE_BRACKET,
94 OSE_MATCH_ERROR_UNMATCHED_RIGHT_SQUARE_BRACKET,
95 OSE_MATCH_ERROR_UNMATCHED_LEFT_CURLY_BRACE,
96 OSE_MATCH_ERROR_UNMATCHED_RIGHT_CURLY_BRACE,
97 OSE_MATCH_ERROR_PATTERN_NO_LEADING_SLASH,
98 OSE_MATCH_ERROR_ADDRESS_NO_LEADING_SLASH,
99 OSE_MATCH_ERROR_INVALID_CHARACTER_CLASS,
100 OSE_MATCH_ERROR_BACKTRACK_LIMIT_EXCEEDED,
101 OSE_MATCH_ERROR_INVALID_REPETITION
102};
103
115enum ose_match_retval ose_match_pattern(const char * const pattern,
116 const char * const address,
117 int32_t *pattern_offset,
118 int32_t *address_offset);
119
120#ifdef __cplusplus
121}
122#endif
123
124#endif /* OSE_MATCH_H */
ose_match_retval
Pattern matching return codes.
Definition ose_match.h:88
enum ose_match_retval ose_match_pattern(const char *const pattern, const char *const address, int32_t *pattern_offset, int32_t *address_offset)
Match an address against a pattern.
Definition ose_match.c:155