00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00044 #ifndef SHWILD_INCL_SHWILD_H_SHWILD
00045 #define SHWILD_INCL_SHWILD_H_SHWILD
00046
00047
00048
00049
00050
00051 #ifndef SHWILD_DOCUMENTATION_SKIP_SECTION
00052 # define SHWILD_VER_SHWILD_H_SHWILD_MAJOR 1
00053 # define SHWILD_VER_SHWILD_H_SHWILD_MINOR 1
00054 # define SHWILD_VER_SHWILD_H_SHWILD_REVISION 1
00055 # define SHWILD_VER_SHWILD_H_SHWILD_EDIT 5
00056 #endif
00057
00074 #ifndef SHWILD_DOCUMENTATION_SKIP_SECTION
00075 # define SHWILD_VER_0_9_1 0x00090100
00076 # define SHWILD_VER_0_9_2 0x00090200
00077 #endif
00078
00079 #define SHWILD_VER_MAJOR 0
00080 #define SHWILD_VER_MINOR 9
00081 #define SHWILD_VER_REVISION 2
00082
00083 #define SHWILD_VER SHWILD_VER_0_9_2
00084
00085
00086
00087
00088
00089 #include <stddef.h>
00090
00091
00092
00093
00094
00108
00109
00110
00111
00115 struct shwild_handle_t_;
00116
00122 typedef struct shwild_handle_t_ *shwild_handle_t;
00123
00132 struct shwild_slice_t
00133 {
00134 size_t len;
00135 char const *ptr;
00137 #ifdef __cplusplus
00138 public:
00140 shwild_slice_t();
00142 shwild_slice_t(shwild_slice_t const &rhs);
00148 shwild_slice_t(size_t n, char const *s);
00149 #endif
00150 };
00151 #ifndef SHWILD_DOCUMENTATION_SKIP_SECTION
00152 typedef struct shwild_slice_t shwild_slice_t;
00153 #endif
00154
00155
00156
00157
00158
00183 #define SHWILD_F_SUPPRESS_RANGE_SUPPORT (0x0001)
00184 #define SHWILD_F_SUPPRESS_BACKSLASH_ESCAPE (0x0002)
00185 #define SHWILD_F_SUPPRESS_RANGE_CONTINUUM_SUPPORT (0x0004)
00186 #define SHWILD_F_SUPPRESS_RANGE_CONTINUUM_HIGHLOW_SUPPORT (0x0008)
00187 #define SHWILD_F_SUPPRESS_RANGE_CONTINUUM_CROSSCASE_SUPPORT (0x0010)
00188 #define SHWILD_F_SUPPRESS_RANGE_LITERAL_WILDCARD_SUPPORT (0x0020)
00189 #define SHWILD_F_SUPPRESS_RANGE_LEADTRAIL_LITERAL_HYPHEN_SUPPORT (0x0040)
00190 #define SHWILD_F_SUPPRESS_RANGE_NOT_SUPPORT (0x0400)
00191 #if 0
00192 #define SHWILD_F_ALLOW_RANGE_LITERAL_BRACKET_SUPPORT (0x0080)
00193 #define SHWILD_F_ALLOW_RANGE_QUANTIFICATION_SUPPORT (0x0100)
00194 #endif
00195 #define SHWILD_F_IGNORE_CASE (0x0200)
00197 #if 0
00198
00199 #define SHWILD_F_FNM_PATHNAME_SEMANTICS (0x0800)
00200 #endif
00201
00211 #define SHWILD_RC_SUCCESS (0)
00212 #define SHWILD_RC_ERROR_BASE_ (-2000)
00213 #define SHWILD_RC_ALLOC_ERROR (SHWILD_RC_ERROR_BASE_ - 1)
00214 #define SHWILD_RC_PARSE_ERROR (SHWILD_RC_ERROR_BASE_ - 2)
00218
00219
00220
00221
00222 #ifdef __cplusplus
00223 extern "C"
00224 {
00225 #endif
00226
00239 int shwild_match(char const *pattern, char const *string, unsigned flags);
00240
00244 int shwild_match_s(shwild_slice_t const *pattern, shwild_slice_t const *string, unsigned flags);
00245
00260 int shwild_compile_pattern(char const *pattern, unsigned flags, shwild_handle_t *phCompiledPattern);
00261
00265 int shwild_compile_pattern_s(shwild_slice_t const *pattern, unsigned flags, shwild_handle_t *phCompiledPattern);
00266
00277 int shwild_match_pattern(shwild_handle_t hCompiledPattern, char const *string);
00278
00282 int shwild_match_pattern_s(shwild_handle_t hCompiledPattern, shwild_slice_t const *string);
00283
00289 void shwild_destroy_pattern(shwild_handle_t hCompiledPattern);
00290
00291 #ifdef __cplusplus
00292 }
00293 #endif
00294
00295
00296
00297
00298
00299 #if !defined(__cplusplus) && \
00300 !defined(SHWILD_DOCUMENTATION_SKIP_SECTION) && \
00301 !defined(SHWILD_NO_NAMESPACE)
00302 # define SHWILD_NO_NAMESPACE
00303 #endif
00304
00305 #if !defined(SHWILD_NO_NAMESPACE)
00306
00308 namespace shwild
00309 {
00310 #endif
00311
00312
00313
00314
00315
00316 #ifdef __cplusplus
00317
00329 typedef shwild_slice_t slice_t;
00330
00334 inline int match(char const *pattern, char const *string, unsigned flags = 0)
00335 {
00336 return shwild_match(pattern, string, flags);
00337 }
00341 inline int compile_pattern(char const *pattern, unsigned flags, shwild_handle_t *phCompiledPattern)
00342 {
00343 return shwild_compile_pattern(pattern, flags, phCompiledPattern);
00344 }
00348 inline int match_pattern(shwild_handle_t hCompiledPattern, char const *string)
00349 {
00350 return shwild_match_pattern(hCompiledPattern, string);
00351 }
00355 inline void destroy_pattern(shwild_handle_t hCompiledPattern)
00356 {
00357 shwild_destroy_pattern(hCompiledPattern);
00358 }
00359
00362 #endif
00363
00364
00365
00366
00367
00368 #if !defined(SHWILD_NO_NAMESPACE)
00369 }
00370
00371 #endif
00372
00373
00374
00375
00376
00377 #ifndef SHWILD_DOCUMENTATION_SKIP_SECTION
00378
00379 # ifdef __cplusplus
00380 inline shwild_slice_t::shwild_slice_t()
00381 : len(0)
00382 , ptr(NULL)
00383 {}
00384 inline shwild_slice_t::shwild_slice_t(shwild_slice_t const &rhs)
00385 : len(rhs.len)
00386 , ptr(rhs.ptr)
00387 {}
00388 inline shwild_slice_t::shwild_slice_t(size_t n, char const *s)
00389 : len(n)
00390 , ptr(s)
00391 {}
00392 # endif
00393
00394 #endif
00395
00396
00397
00398 #endif
00399
00400