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
00041
00045 #ifndef SHWILD_INCL_SHWILD_H_SHWILD
00046 #define SHWILD_INCL_SHWILD_H_SHWILD
00047
00048
00049
00050
00051
00052 #ifndef SHWILD_DOCUMENTATION_SKIP_SECTION
00053 # define SHWILD_VER_SHWILD_H_SHWILD_MAJOR 1
00054 # define SHWILD_VER_SHWILD_H_SHWILD_MINOR 2
00055 # define SHWILD_VER_SHWILD_H_SHWILD_REVISION 20
00056 # define SHWILD_VER_SHWILD_H_SHWILD_EDIT 30
00057 #endif
00058
00075 #ifndef SHWILD_DOCUMENTATION_SKIP_SECTION
00076 # define SHWILD_VER_0_9_1 0x00090100
00077 # define SHWILD_VER_0_9_2 0x00090200
00078 # define SHWILD_VER_0_9_3 0x00090300
00079 # define SHWILD_VER_0_9_4 0x00090400
00080 # define SHWILD_VER_0_9_5 0x00090500
00081 # define SHWILD_VER_0_9_6 0x00090600
00082 # define SHWILD_VER_0_9_7 0x00090700
00083 # define SHWILD_VER_0_9_8 0x00090800
00084 # define SHWILD_VER_0_9_9 0x00090900
00085 # define SHWILD_VER_0_9_10 0x00090a00
00086 # define SHWILD_VER_0_9_11 0x00090b00
00087 # define SHWILD_VER_0_9_12 0x00090cff
00088 # define SHWILD_VER_0_9_13 0x00090dff
00089 # define SHWILD_VER_0_9_14 0x00090eff
00090 # define SHWILD_VER_0_9_15 0x00090fff
00091 # define SHWILD_VER_0_9_16 0x000910ff
00092 # define SHWILD_VER_0_9_17 0x000911ff
00093 # define SHWILD_VER_0_9_18 0x000912ff
00094 # define SHWILD_VER_0_9_19 0x000913ff
00095 # define SHWILD_VER_0_9_20 0x000914ff
00096 #endif
00097
00098 #define SHWILD_VER_MAJOR 0
00099 #define SHWILD_VER_MINOR 9
00100 #define SHWILD_VER_REVISION 20
00101
00102 #define SHWILD_VER SHWILD_VER_0_9_20
00103
00104
00105
00106
00107
00108 #include <stddef.h>
00109
00110
00111
00112
00113
00127
00128
00129
00130
00134 struct shwild_handle_t_;
00135
00141 typedef struct shwild_handle_t_* shwild_handle_t;
00142
00151 struct shwild_slice_t
00152 {
00153 size_t len;
00154 char const* ptr;
00156 #ifdef __cplusplus
00157 public:
00159 shwild_slice_t();
00161 shwild_slice_t(shwild_slice_t const& rhs);
00167 shwild_slice_t(size_t n, char const* s);
00168 #endif
00169 };
00170 #ifndef SHWILD_DOCUMENTATION_SKIP_SECTION
00171 typedef struct shwild_slice_t shwild_slice_t;
00172 #endif
00173
00174
00175
00176
00177
00202 #define SHWILD_F_SUPPRESS_RANGE_SUPPORT (0x0001)
00203 #define SHWILD_F_SUPPRESS_BACKSLASH_ESCAPE (0x0002)
00204 #define SHWILD_F_SUPPRESS_RANGE_CONTINUUM_SUPPORT (0x0004)
00205 #define SHWILD_F_SUPPRESS_RANGE_CONTINUUM_HIGHLOW_SUPPORT (0x0008)
00206 #define SHWILD_F_SUPPRESS_RANGE_CONTINUUM_CROSSCASE_SUPPORT (0x0010)
00207 #define SHWILD_F_SUPPRESS_RANGE_LITERAL_WILDCARD_SUPPORT (0x0020)
00208 #define SHWILD_F_SUPPRESS_RANGE_LEADTRAIL_LITERAL_HYPHEN_SUPPORT (0x0040)
00209 #define SHWILD_F_SUPPRESS_RANGE_NOT_SUPPORT (0x0400)
00210 #define SHWILD_F_IGNORE_CASE (0x0200)
00212 #if 0
00213
00214 #define SHWILD_F_ALLOW_RANGE_LITERAL_BRACKET_SUPPORT (0x0080)
00215 #define SHWILD_F_ALLOW_RANGE_QUANTIFICATION_SUPPORT (0x0100)
00216 #define SHWILD_F_FNM_PATHNAME_SEMANTICS (0x0800)
00217 #endif
00218
00228 #define SHWILD_RC_SUCCESS (0)
00229 #define SHWILD_RC_ERROR_BASE_ (-2000)
00230 #define SHWILD_RC_ALLOC_ERROR (SHWILD_RC_ERROR_BASE_ - 1)
00231 #define SHWILD_RC_PARSE_ERROR (SHWILD_RC_ERROR_BASE_ - 2)
00232 #define SHWILD_RC_UNSPECIFIED (SHWILD_RC_ERROR_BASE_ - 3)
00236
00237
00238
00239
00240 #ifdef __cplusplus
00241 extern "C"
00242 {
00243 #endif
00244
00251 int shwild_init(void);
00252
00257 void shwild_uninit(void);
00258
00271 int shwild_match(char const* pattern, char const* string, unsigned flags);
00272
00276 int shwild_match_s(shwild_slice_t const* pattern, shwild_slice_t const* string, unsigned flags);
00277
00292 int shwild_compile_pattern(char const* pattern, unsigned flags, shwild_handle_t* phCompiledPattern);
00293
00297 int shwild_compile_pattern_s(shwild_slice_t const* pattern, unsigned flags, shwild_handle_t* phCompiledPattern);
00298
00309 int shwild_match_pattern(shwild_handle_t hCompiledPattern, char const* string);
00310
00314 int shwild_match_pattern_s(shwild_handle_t hCompiledPattern, shwild_slice_t const* string);
00315
00321 void shwild_destroy_pattern(shwild_handle_t hCompiledPattern);
00322
00323 #ifdef __cplusplus
00324 }
00325 #endif
00326
00327
00328
00329
00330
00331 #if !defined(__cplusplus) && \
00332 !defined(SHWILD_DOCUMENTATION_SKIP_SECTION) && \
00333 !defined(SHWILD_NO_NAMESPACE)
00334 # define SHWILD_NO_NAMESPACE
00335 #endif
00336
00337 #if !defined(SHWILD_NO_NAMESPACE)
00338
00340 namespace shwild
00341 {
00342 #endif
00343
00344
00345
00346
00347
00348 #ifdef __cplusplus
00349
00361 typedef shwild_slice_t slice_t;
00362
00366 inline int match(char const* pattern, char const* string, unsigned flags = 0)
00367 {
00368 return shwild_match(pattern, string, flags);
00369 }
00373 inline int compile_pattern(char const* pattern, unsigned flags, shwild_handle_t* phCompiledPattern)
00374 {
00375 return shwild_compile_pattern(pattern, flags, phCompiledPattern);
00376 }
00380 inline int match_pattern(shwild_handle_t hCompiledPattern, char const* string)
00381 {
00382 return shwild_match_pattern(hCompiledPattern, string);
00383 }
00387 inline void destroy_pattern(shwild_handle_t hCompiledPattern)
00388 {
00389 shwild_destroy_pattern(hCompiledPattern);
00390 }
00391
00394 #endif
00395
00396
00397
00398
00399
00400 #if !defined(SHWILD_NO_NAMESPACE)
00401 }
00402 #endif
00403
00404
00405
00406
00407
00408 #ifndef SHWILD_DOCUMENTATION_SKIP_SECTION
00409
00410 # ifdef __cplusplus
00411
00412 # if defined(__BORLANDC__) && \
00413 __BORLANDC__ >= 0x0582
00414 # pragma warn -8026
00415 # endif
00416
00417
00418 inline shwild_slice_t::shwild_slice_t()
00419 : len(0)
00420 , ptr(NULL)
00421 {}
00422 inline shwild_slice_t::shwild_slice_t(shwild_slice_t const& rhs)
00423 : len(rhs.len)
00424 , ptr(rhs.ptr)
00425 {}
00426 inline shwild_slice_t::shwild_slice_t(size_t n, char const* s)
00427 : len(n)
00428 , ptr(s)
00429 {}
00430
00431 # if defined(__BORLANDC__) && \
00432 __BORLANDC__ >= 0x0582
00433 # pragma warn .8026
00434 # endif
00435
00436 # endif
00437
00438 #endif
00439
00440
00441
00442 #endif
00443
00444