asoma.dev · the C reference for libose
libose
the C library every o.se host is built on
Loading...
Searching...
No Matches
Macros | Enumerations | Functions
ose_match.h File Reference

Pattern matching functions. More...

Go to the source code of this file.

Macros

#define OSE_MATCH_BACKTRACK_LIMIT   100
 Set this to control the number of backtracking branches.
 
#define OSE_MATCH_ENABLE_2STARS   1
 Switch this off to disable matching against a pattern with 2 stars.
 
#define OSE_MATCH_ENABLE_NSTARS   1
 Switch this off to disable matching against a pattern with more than 2 stars which will be done recursively.
 
#define OSE_MATCH_ALLOW_STAR_IN_ADDRESS
 Allow the star wildcard in addresses.
 
#define OSE_MATCH_DESCENDANTS
 
#define OSE_MATCH_REPETITION
 

Enumerations

enum  ose_match_retval {
  OSE_MATCH_NOMATCH = 0 , OSE_MATCH_ADDRESS_COMPLETE , OSE_MATCH_PATTERN_COMPLETE , OSE_MATCH_BOTH_COMPLETE ,
  OSE_MATCH_ERROR_UNMATCHED_LEFT_SQUARE_BRACKET , OSE_MATCH_ERROR_UNMATCHED_RIGHT_SQUARE_BRACKET , OSE_MATCH_ERROR_UNMATCHED_LEFT_CURLY_BRACE , OSE_MATCH_ERROR_UNMATCHED_RIGHT_CURLY_BRACE ,
  OSE_MATCH_ERROR_PATTERN_NO_LEADING_SLASH , OSE_MATCH_ERROR_ADDRESS_NO_LEADING_SLASH , OSE_MATCH_ERROR_INVALID_CHARACTER_CLASS , OSE_MATCH_ERROR_BACKTRACK_LIMIT_EXCEEDED ,
  OSE_MATCH_ERROR_INVALID_REPETITION
}
 Pattern matching return codes.
 

Functions

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.
 

Detailed Description

Pattern matching functions.

Macro Definition Documentation

◆ OSE_MATCH_ALLOW_STAR_IN_ADDRESS

#define OSE_MATCH_ALLOW_STAR_IN_ADDRESS

Allow the star wildcard in addresses.

Wildcards are only allowed in patterns since matching patterns against patterns can be ambiguous and confusing. One exception is the star wildcard, which, if enabled here and found in an address, simply skips that address container.

Note
Use of the star wildcard in an address is restricted: an address container that contains a star, may only contain that star.

Function Documentation

◆ ose_match_pattern()

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.

Parameters
patternthe pattern to match
addressthe address to match
pattern_offsetthe number of bytes into the pattern that were matched successfully
address_offsetthe number of bytes into the address that were matched successfully
Return values
ose_match_retval