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 2
00054 # define SHWILD_VER_SHWILD_H_SHWILD_REVISION 18
00055 # define SHWILD_VER_SHWILD_H_SHWILD_EDIT 28
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 # define SHWILD_VER_0_9_3 0x00090300
00078 # define SHWILD_VER_0_9_4 0x00090400
00079 # define SHWILD_VER_0_9_5 0x00090500
00080 # define SHWILD_VER_0_9_6 0x00090600
00081 # define SHWILD_VER_0_9_7 0x00090700
00082 # define SHWILD_VER_0_9_8 0x00090800
00083 # define SHWILD_VER_0_9_9 0x00090900
00084 # define SHWILD_VER_0_9_10 0x00090a00
00085 # define SHWILD_VER_0_9_11 0x00090b00
00086 # define SHWILD_VER_0_9_12 0x00090cff
00087 # define SHWILD_VER_0_9_13 0x00090dff
00088 # define SHWILD_VER_0_9_14 0x00090eff
00089 # define SHWILD_VER_0_9_15 0x00090fff
00090 # define SHWILD_VER_0_9_16 0x000910ff
00091 # define SHWILD_VER_0_9_17 0x000911ff
00092 # define SHWILD_VER_0_9_18 0x000912ff
00093 #endif
00094
00095 #define SHWILD_VER_MAJOR 0
00096 #define SHWILD_VER_MINOR 9
00097 #define SHWILD_VER_REVISION 18
00098
00099 #define SHWILD_VER SHWILD_VER_0_9_18
00100
00101
00102
00103
00104
00105 #include <stddef.h>
00106
00107
00108
00109
00110
00124
00125
00126
00127
00131 struct shwild_handle_t_;
00132
00138 typedef struct shwild_handle_t_ *shwild_handle_t;
00139
00148 struct shwild_slice_t
00149 {
00150 size_t len;
00151 char const* ptr;
00153 #ifdef __cplusplus
00154 public:
00156 shwild_slice_t();
00158 shwild_slice_t(shwild_slice_t const& rhs);
00164 shwild_slice_t(size_t n, char const* s);
00165 #endif
00166 };
00167 #ifndef SHWILD_DOCUMENTATION_SKIP_SECTION
00168 typedef struct shwild_slice_t shwild_slice_t;
00169 #endif
00170
00171
00172
00173
00174
00199 #define SHWILD_F_SUPPRESS_RANGE_SUPPORT (0x0001)
00200 #define SHWILD_F_SUPPRESS_BACKSLASH_ESCAPE (0x0002)
00201 #define SHWILD_F_SUPPRESS_RANGE_CONTINUUM_SUPPORT (0x0004)
00202 #define SHWILD_F_SUPPRESS_RANGE_CONTINUUM_HIGHLOW_SUPPORT (0x0008)
00203 #define SHWILD_F_SUPPRESS_RANGE_CONTINUUM_CROSSCASE_SUPPORT (0x0010)
00204 #define SHWILD_F_SUPPRESS_RANGE_LITERAL_WILDCARD_SUPPORT (0x0020)
00205 #define SHWILD_F_SUPPRESS_RANGE_LEADTRAIL_LITERAL_HYPHEN_SUPPORT (0x0040)
00206 #define SHWILD_F_SUPPRESS_RANGE_NOT_SUPPORT (0x0400)
00207 #define SHWILD_F_IGNORE_CASE (0x0200)
00209 #if 0
00210
00211 #define SHWILD_F_ALLOW_RANGE_LITERAL_BRACKET_SUPPORT (0x0080)
00212 #define SHWILD_F_ALLOW_RANGE_QUANTIFICATION_SUPPORT (0x0100)
00213 #define SHWILD_F_FNM_PATHNAME_SEMANTICS (0x0800)
00214 #endif
00215
00225 #define SHWILD_RC_SUCCESS (0)
00226 #define SHWILD_RC_ERROR_BASE_ (-2000)
00227 #define SHWILD_RC_ALLOC_ERROR (SHWILD_RC_ERROR_BASE_ - 1)
00228 #define SHWILD_RC_PARSE_ERROR (SHWILD_RC_ERROR_BASE_ - 2)
00229 #define SHWILD_RC_UNSPECIFIED (SHWILD_RC_ERROR_BASE_ - 3)
00233
00234
00235
00236
00237 #ifdef __cplusplus
00238 extern "C"
00239 {
00240 #endif
00241
00248 int shwild_init(void);
00249
00254 void shwild_uninit(void);
00255
00268 int shwild_match(char const* pattern, char const* string, unsigned flags);
00269
00273 int shwild_match_s(shwild_slice_t const* pattern, shwild_slice_t const* string, unsigned flags);
00274
00289 int shwild_compile_pattern(char const* pattern, unsigned flags, shwild_handle_t* phCompiledPattern);
00290
00294 int shwild_compile_pattern_s(shwild_slice_t const* pattern, unsigned flags, shwild_handle_t* phCompiledPattern);
00295
00306 int shwild_match_pattern(shwild_handle_t hCompiledPattern, char const* string);
00307
00311 int shwild_match_pattern_s(shwild_handle_t hCompiledPattern, shwild_slice_t const* string);
00312
00318 void shwild_destroy_pattern(shwild_handle_t hCompiledPattern);
00319
00320 #ifdef __cplusplus
00321 }
00322 #endif
00323
00324
00325
00326
00327
00328 #if !defined(__cplusplus) && \
00329 !defined(SHWILD_DOCUMENTATION_SKIP_SECTION) && \
00330 !defined(SHWILD_NO_NAMESPACE)
00331 # define SHWILD_NO_NAMESPACE
00332 #endif
00333
00334 #if !defined(SHWILD_NO_NAMESPACE)
00335
00337 namespace shwild
00338 {
00339 #endif
00340
00341
00342
00343
00344
00345 #ifdef __cplusplus
00346
00358 typedef shwild_slice_t slice_t;
00359
00363 inline int match(char const* pattern, char const* string, unsigned flags = 0)
00364 {
00365 return shwild_match(pattern, string, flags);
00366 }
00370 inline int compile_pattern(char const* pattern, unsigned flags, shwild_handle_t* phCompiledPattern)
00371 {
00372 return shwild_compile_pattern(pattern, flags, phCompiledPattern);
00373 }
00377 inline int match_pattern(shwild_handle_t hCompiledPattern, char const* string)
00378 {
00379 return shwild_match_pattern(hCompiledPattern, string);
00380 }
00384 inline void destroy_pattern(shwild_handle_t hCompiledPattern)
00385 {
00386 shwild_destroy_pattern(hCompiledPattern);
00387 }
00388
00391 #endif
00392
00393
00394
00395
00396
00397 #if !defined(SHWILD_NO_NAMESPACE)
00398 }
00399 #endif
00400
00401
00402
00403
00404
00405 #ifndef SHWILD_DOCUMENTATION_SKIP_SECTION
00406
00407 # ifdef __cplusplus
00408
00409 # if defined(__BORLANDC__) && \
00410 __BORLANDC__ >= 0x0582
00411 # pragma warn -8026
00412 # endif
00413
00414
00415 inline shwild_slice_t::shwild_slice_t()
00416 : len(0)
00417 , ptr(NULL)
00418 {}
00419 inline shwild_slice_t::shwild_slice_t(shwild_slice_t const& rhs)
00420 : len(rhs.len)
00421 , ptr(rhs.ptr)
00422 {}
00423 inline shwild_slice_t::shwild_slice_t(size_t n, char const* s)
00424 : len(n)
00425 , ptr(s)
00426 {}
00427
00428 # if defined(__BORLANDC__) && \
00429 __BORLANDC__ >= 0x0582
00430 # pragma warn .8026
00431 # endif
00432
00433 # endif
00434
00435 #endif
00436
00437
00438
00439 #endif
00440
00441