rugged 0.28.3.1 → 0.28.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/rugged/version.rb +1 -1
- data/vendor/libgit2/AUTHORS +1 -0
- data/vendor/libgit2/CMakeLists.txt +36 -16
- data/vendor/libgit2/COPYING +28 -0
- data/vendor/libgit2/cmake/Modules/EnableWarnings.cmake +5 -1
- data/vendor/libgit2/cmake/Modules/FindCoreFoundation.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindGSSAPI.cmake +1 -1
- data/vendor/libgit2/cmake/Modules/FindGSSFramework.cmake +28 -0
- data/vendor/libgit2/cmake/Modules/FindPCRE.cmake +38 -0
- data/vendor/libgit2/cmake/Modules/FindPCRE2.cmake +37 -0
- data/vendor/libgit2/cmake/Modules/FindSecurity.cmake +2 -2
- data/vendor/libgit2/cmake/Modules/FindStatNsec.cmake +6 -0
- data/vendor/libgit2/cmake/Modules/PkgBuildConfig.cmake +110 -0
- data/vendor/libgit2/cmake/Modules/SelectGSSAPI.cmake +53 -0
- data/vendor/libgit2/cmake/Modules/SelectHTTPSBackend.cmake +124 -0
- data/vendor/libgit2/cmake/Modules/SelectHashes.cmake +66 -0
- data/vendor/libgit2/deps/http-parser/http_parser.c +11 -6
- data/vendor/libgit2/deps/ntlmclient/CMakeLists.txt +21 -0
- data/vendor/libgit2/deps/ntlmclient/compat.h +33 -0
- data/vendor/libgit2/deps/ntlmclient/crypt.h +64 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.c +120 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_commoncrypto.h +18 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.c +145 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_mbedtls.h +18 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.c +130 -0
- data/vendor/libgit2/deps/ntlmclient/crypt_openssl.h +21 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.c +1420 -0
- data/vendor/libgit2/deps/ntlmclient/ntlm.h +174 -0
- data/vendor/libgit2/deps/ntlmclient/ntlmclient.h +320 -0
- data/vendor/libgit2/deps/ntlmclient/unicode.h +36 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_builtin.c +445 -0
- data/vendor/libgit2/deps/ntlmclient/unicode_iconv.c +201 -0
- data/vendor/libgit2/deps/ntlmclient/utf8.h +1257 -0
- data/vendor/libgit2/deps/ntlmclient/util.c +21 -0
- data/vendor/libgit2/deps/ntlmclient/util.h +14 -0
- data/vendor/libgit2/deps/pcre/CMakeLists.txt +140 -0
- data/vendor/libgit2/deps/pcre/COPYING +5 -0
- data/vendor/libgit2/deps/pcre/cmake/COPYING-CMAKE-SCRIPTS +22 -0
- data/vendor/libgit2/deps/pcre/cmake/FindEditline.cmake +17 -0
- data/vendor/libgit2/deps/pcre/cmake/FindPackageHandleStandardArgs.cmake +58 -0
- data/vendor/libgit2/deps/pcre/cmake/FindReadline.cmake +29 -0
- data/vendor/libgit2/deps/pcre/config.h.in +57 -0
- data/vendor/libgit2/deps/pcre/pcre.h +641 -0
- data/vendor/libgit2/deps/pcre/pcre_byte_order.c +319 -0
- data/vendor/libgit2/deps/pcre/pcre_chartables.c +198 -0
- data/vendor/libgit2/deps/pcre/pcre_compile.c +9800 -0
- data/vendor/libgit2/deps/pcre/pcre_config.c +190 -0
- data/vendor/libgit2/deps/pcre/pcre_dfa_exec.c +3676 -0
- data/vendor/libgit2/deps/pcre/pcre_exec.c +7173 -0
- data/vendor/libgit2/deps/pcre/pcre_fullinfo.c +245 -0
- data/vendor/libgit2/deps/pcre/pcre_get.c +669 -0
- data/vendor/libgit2/deps/pcre/pcre_globals.c +86 -0
- data/vendor/libgit2/deps/pcre/pcre_internal.h +2787 -0
- data/vendor/libgit2/deps/pcre/pcre_jit_compile.c +11913 -0
- data/vendor/libgit2/deps/pcre/pcre_maketables.c +156 -0
- data/vendor/libgit2/deps/pcre/pcre_newline.c +210 -0
- data/vendor/libgit2/deps/pcre/pcre_ord2utf8.c +94 -0
- data/vendor/libgit2/deps/pcre/pcre_printint.c +834 -0
- data/vendor/libgit2/deps/pcre/pcre_refcount.c +92 -0
- data/vendor/libgit2/deps/pcre/pcre_string_utils.c +211 -0
- data/vendor/libgit2/deps/pcre/pcre_study.c +1686 -0
- data/vendor/libgit2/deps/pcre/pcre_tables.c +727 -0
- data/vendor/libgit2/deps/pcre/pcre_ucd.c +3644 -0
- data/vendor/libgit2/deps/pcre/pcre_valid_utf8.c +301 -0
- data/vendor/libgit2/deps/pcre/pcre_version.c +98 -0
- data/vendor/libgit2/deps/pcre/pcre_xclass.c +268 -0
- data/vendor/libgit2/deps/pcre/pcreposix.c +421 -0
- data/vendor/libgit2/deps/pcre/pcreposix.h +117 -0
- data/vendor/libgit2/deps/pcre/ucp.h +224 -0
- data/vendor/libgit2/deps/zlib/adler32.c +0 -7
- data/vendor/libgit2/deps/zlib/crc32.c +0 -7
- data/vendor/libgit2/include/git2.h +2 -0
- data/vendor/libgit2/include/git2/apply.h +22 -2
- data/vendor/libgit2/include/git2/attr.h +19 -12
- data/vendor/libgit2/include/git2/blame.h +2 -2
- data/vendor/libgit2/include/git2/blob.h +44 -12
- data/vendor/libgit2/include/git2/buffer.h +20 -14
- data/vendor/libgit2/include/git2/cert.h +135 -0
- data/vendor/libgit2/include/git2/checkout.h +46 -14
- data/vendor/libgit2/include/git2/cherrypick.h +3 -3
- data/vendor/libgit2/include/git2/clone.h +2 -2
- data/vendor/libgit2/include/git2/commit.h +23 -1
- data/vendor/libgit2/include/git2/common.h +7 -5
- data/vendor/libgit2/include/git2/config.h +12 -12
- data/vendor/libgit2/include/git2/cred.h +308 -0
- data/vendor/libgit2/include/git2/deprecated.h +243 -3
- data/vendor/libgit2/include/git2/describe.h +4 -4
- data/vendor/libgit2/include/git2/diff.h +16 -14
- data/vendor/libgit2/include/git2/filter.h +8 -0
- data/vendor/libgit2/include/git2/index.h +2 -1
- data/vendor/libgit2/include/git2/indexer.h +48 -4
- data/vendor/libgit2/include/git2/merge.h +6 -10
- data/vendor/libgit2/include/git2/net.h +0 -5
- data/vendor/libgit2/include/git2/object.h +2 -14
- data/vendor/libgit2/include/git2/odb.h +3 -2
- data/vendor/libgit2/include/git2/odb_backend.h +5 -4
- data/vendor/libgit2/include/git2/oid.h +1 -1
- data/vendor/libgit2/include/git2/pack.h +12 -1
- data/vendor/libgit2/include/git2/proxy.h +5 -3
- data/vendor/libgit2/include/git2/rebase.h +46 -2
- data/vendor/libgit2/include/git2/refs.h +19 -0
- data/vendor/libgit2/include/git2/remote.h +35 -12
- data/vendor/libgit2/include/git2/repository.h +24 -2
- data/vendor/libgit2/include/git2/revert.h +1 -1
- data/vendor/libgit2/include/git2/stash.h +3 -3
- data/vendor/libgit2/include/git2/status.h +25 -16
- data/vendor/libgit2/include/git2/submodule.h +20 -3
- data/vendor/libgit2/include/git2/sys/alloc.h +9 -9
- data/vendor/libgit2/include/git2/sys/cred.h +90 -0
- data/vendor/libgit2/include/git2/sys/odb_backend.h +48 -4
- data/vendor/libgit2/include/git2/sys/refdb_backend.h +57 -21
- data/vendor/libgit2/include/git2/sys/repository.h +5 -1
- data/vendor/libgit2/include/git2/sys/transport.h +2 -2
- data/vendor/libgit2/include/git2/tag.h +11 -2
- data/vendor/libgit2/include/git2/trace.h +2 -2
- data/vendor/libgit2/include/git2/transport.h +11 -340
- data/vendor/libgit2/include/git2/tree.h +1 -1
- data/vendor/libgit2/include/git2/types.h +4 -89
- data/vendor/libgit2/include/git2/version.h +2 -2
- data/vendor/libgit2/include/git2/worktree.h +5 -5
- data/vendor/libgit2/src/CMakeLists.txt +88 -222
- data/vendor/libgit2/src/alloc.c +2 -14
- data/vendor/libgit2/src/{stdalloc.c → allocators/stdalloc.c} +3 -4
- data/vendor/libgit2/src/{stdalloc.h → allocators/stdalloc.h} +4 -4
- data/vendor/libgit2/src/allocators/win32_crtdbg.c +118 -0
- data/vendor/libgit2/src/{transports/cred.h → allocators/win32_crtdbg.h} +5 -4
- data/vendor/libgit2/src/apply.c +60 -30
- data/vendor/libgit2/src/attr.c +70 -64
- data/vendor/libgit2/src/attr_file.c +189 -96
- data/vendor/libgit2/src/attr_file.h +9 -9
- data/vendor/libgit2/src/attrcache.c +44 -46
- data/vendor/libgit2/src/attrcache.h +2 -1
- data/vendor/libgit2/src/blame.c +17 -5
- data/vendor/libgit2/src/blame.h +1 -1
- data/vendor/libgit2/src/blame_git.c +21 -7
- data/vendor/libgit2/src/blob.c +81 -17
- data/vendor/libgit2/src/blob.h +2 -2
- data/vendor/libgit2/src/branch.c +29 -5
- data/vendor/libgit2/src/buffer.c +14 -7
- data/vendor/libgit2/src/cache.c +26 -33
- data/vendor/libgit2/src/cache.h +1 -1
- data/vendor/libgit2/src/cc-compat.h +5 -0
- data/vendor/libgit2/src/checkout.c +26 -16
- data/vendor/libgit2/src/cherrypick.c +9 -3
- data/vendor/libgit2/src/clone.c +29 -7
- data/vendor/libgit2/src/clone.h +4 -0
- data/vendor/libgit2/src/commit.c +69 -21
- data/vendor/libgit2/src/commit.h +6 -0
- data/vendor/libgit2/src/commit_list.c +28 -76
- data/vendor/libgit2/src/commit_list.h +2 -2
- data/vendor/libgit2/src/common.h +3 -75
- data/vendor/libgit2/src/config.c +31 -40
- data/vendor/libgit2/src/config.h +7 -6
- data/vendor/libgit2/src/config_backend.h +12 -0
- data/vendor/libgit2/src/config_cache.c +39 -39
- data/vendor/libgit2/src/config_entries.c +69 -99
- data/vendor/libgit2/src/config_entries.h +1 -0
- data/vendor/libgit2/src/config_file.c +337 -380
- data/vendor/libgit2/src/config_mem.c +12 -16
- data/vendor/libgit2/src/config_parse.c +49 -29
- data/vendor/libgit2/src/config_parse.h +13 -12
- data/vendor/libgit2/src/config_snapshot.c +206 -0
- data/vendor/libgit2/src/crlf.c +14 -14
- data/vendor/libgit2/src/describe.c +21 -20
- data/vendor/libgit2/src/diff.c +43 -58
- data/vendor/libgit2/src/diff.h +2 -1
- data/vendor/libgit2/src/diff_driver.c +37 -38
- data/vendor/libgit2/src/diff_file.c +9 -7
- data/vendor/libgit2/src/diff_file.h +1 -1
- data/vendor/libgit2/src/diff_generate.c +135 -85
- data/vendor/libgit2/src/diff_generate.h +2 -2
- data/vendor/libgit2/src/diff_parse.c +1 -1
- data/vendor/libgit2/src/diff_print.c +25 -13
- data/vendor/libgit2/src/diff_stats.c +1 -1
- data/vendor/libgit2/src/diff_tform.c +4 -4
- data/vendor/libgit2/src/errors.c +12 -22
- data/vendor/libgit2/src/errors.h +81 -0
- data/vendor/libgit2/src/features.h.in +9 -2
- data/vendor/libgit2/src/fetch.c +7 -2
- data/vendor/libgit2/src/fetchhead.c +1 -1
- data/vendor/libgit2/src/filebuf.c +6 -10
- data/vendor/libgit2/src/filebuf.h +2 -2
- data/vendor/libgit2/src/filter.c +16 -8
- data/vendor/libgit2/src/{fileops.c → futils.c} +21 -17
- data/vendor/libgit2/src/{fileops.h → futils.h} +5 -5
- data/vendor/libgit2/src/global.c +12 -40
- data/vendor/libgit2/src/global.h +0 -2
- data/vendor/libgit2/src/hash.c +61 -0
- data/vendor/libgit2/src/hash.h +19 -21
- data/vendor/libgit2/src/hash/sha1.h +38 -0
- data/vendor/libgit2/src/hash/{hash_collisiondetect.h → sha1/collisiondetect.c} +14 -17
- data/vendor/libgit2/src/hash/sha1/collisiondetect.h +19 -0
- data/vendor/libgit2/src/hash/{hash_common_crypto.h → sha1/common_crypto.c} +15 -19
- data/vendor/libgit2/src/hash/sha1/common_crypto.h +19 -0
- data/vendor/libgit2/src/hash/{hash_generic.c → sha1/generic.c} +22 -10
- data/vendor/libgit2/src/hash/{hash_generic.h → sha1/generic.h} +4 -14
- data/vendor/libgit2/src/hash/{hash_mbedtls.c → sha1/mbedtls.c} +15 -7
- data/vendor/libgit2/src/hash/{hash_mbedtls.h → sha1/mbedtls.h} +6 -11
- data/vendor/libgit2/src/hash/{hash_openssl.h → sha1/openssl.c} +14 -18
- data/vendor/libgit2/src/hash/sha1/openssl.h +19 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.c +14 -3
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/sha1.h +0 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.c +0 -0
- data/vendor/libgit2/src/hash/{sha1dc → sha1/sha1dc}/ubc_check.h +0 -0
- data/vendor/libgit2/src/hash/{hash_win32.c → sha1/win32.c} +34 -24
- data/vendor/libgit2/src/hash/{hash_win32.h → sha1/win32.h} +6 -19
- data/vendor/libgit2/src/hashsig.c +1 -1
- data/vendor/libgit2/src/idxmap.c +91 -65
- data/vendor/libgit2/src/idxmap.h +151 -15
- data/vendor/libgit2/src/ignore.c +32 -38
- data/vendor/libgit2/src/index.c +66 -43
- data/vendor/libgit2/src/index.h +1 -1
- data/vendor/libgit2/src/indexer.c +69 -70
- data/vendor/libgit2/src/integer.h +39 -4
- data/vendor/libgit2/src/iterator.c +27 -22
- data/vendor/libgit2/src/map.h +1 -1
- data/vendor/libgit2/src/merge.c +58 -44
- data/vendor/libgit2/src/merge_driver.c +4 -4
- data/vendor/libgit2/src/merge_file.c +1 -1
- data/vendor/libgit2/src/mwindow.c +18 -23
- data/vendor/libgit2/src/mwindow.h +4 -4
- data/vendor/libgit2/src/net.c +184 -0
- data/vendor/libgit2/src/net.h +36 -0
- data/vendor/libgit2/src/netops.c +55 -165
- data/vendor/libgit2/src/netops.h +3 -25
- data/vendor/libgit2/src/notes.c +2 -2
- data/vendor/libgit2/src/object.c +2 -2
- data/vendor/libgit2/src/object.h +2 -0
- data/vendor/libgit2/src/odb.c +41 -23
- data/vendor/libgit2/src/odb.h +3 -2
- data/vendor/libgit2/src/odb_loose.c +17 -10
- data/vendor/libgit2/src/odb_mempack.c +10 -23
- data/vendor/libgit2/src/odb_pack.c +4 -4
- data/vendor/libgit2/src/offmap.c +43 -55
- data/vendor/libgit2/src/offmap.h +102 -24
- data/vendor/libgit2/src/oid.c +6 -1
- data/vendor/libgit2/src/oidmap.c +39 -57
- data/vendor/libgit2/src/oidmap.h +99 -19
- data/vendor/libgit2/src/pack-objects.c +25 -32
- data/vendor/libgit2/src/pack-objects.h +1 -1
- data/vendor/libgit2/src/pack.c +45 -47
- data/vendor/libgit2/src/pack.h +12 -14
- data/vendor/libgit2/src/parse.c +10 -0
- data/vendor/libgit2/src/parse.h +3 -3
- data/vendor/libgit2/src/patch.c +1 -1
- data/vendor/libgit2/src/patch_generate.c +2 -2
- data/vendor/libgit2/src/patch_parse.c +124 -31
- data/vendor/libgit2/src/path.c +95 -27
- data/vendor/libgit2/src/path.h +2 -0
- data/vendor/libgit2/src/pathspec.c +13 -13
- data/vendor/libgit2/src/pool.c +26 -22
- data/vendor/libgit2/src/pool.h +7 -7
- data/vendor/libgit2/src/posix.c +7 -7
- data/vendor/libgit2/src/posix.h +12 -1
- data/vendor/libgit2/src/proxy.c +7 -2
- data/vendor/libgit2/src/push.c +10 -5
- data/vendor/libgit2/src/reader.c +2 -2
- data/vendor/libgit2/src/rebase.c +66 -7
- data/vendor/libgit2/src/refdb.c +12 -0
- data/vendor/libgit2/src/refdb_fs.c +214 -165
- data/vendor/libgit2/src/reflog.c +11 -13
- data/vendor/libgit2/src/refs.c +24 -18
- data/vendor/libgit2/src/refspec.c +9 -16
- data/vendor/libgit2/src/regexp.c +221 -0
- data/vendor/libgit2/src/regexp.h +97 -0
- data/vendor/libgit2/src/remote.c +50 -52
- data/vendor/libgit2/src/remote.h +2 -2
- data/vendor/libgit2/src/repository.c +115 -100
- data/vendor/libgit2/src/repository.h +49 -40
- data/vendor/libgit2/src/revert.c +8 -3
- data/vendor/libgit2/src/revparse.c +18 -19
- data/vendor/libgit2/src/revwalk.c +63 -30
- data/vendor/libgit2/src/revwalk.h +20 -0
- data/vendor/libgit2/src/settings.c +5 -0
- data/vendor/libgit2/src/sortedcache.c +12 -26
- data/vendor/libgit2/src/sortedcache.h +1 -1
- data/vendor/libgit2/src/stash.c +45 -65
- data/vendor/libgit2/src/status.c +15 -9
- data/vendor/libgit2/src/streams/openssl.c +20 -0
- data/vendor/libgit2/src/streams/socket.c +2 -2
- data/vendor/libgit2/src/strmap.c +37 -84
- data/vendor/libgit2/src/strmap.h +105 -33
- data/vendor/libgit2/src/submodule.c +102 -70
- data/vendor/libgit2/src/submodule.h +1 -1
- data/vendor/libgit2/src/sysdir.c +11 -1
- data/vendor/libgit2/src/tag.c +10 -2
- data/vendor/libgit2/src/trace.c +1 -1
- data/vendor/libgit2/src/trace.h +2 -2
- data/vendor/libgit2/src/trailer.c +46 -32
- data/vendor/libgit2/src/transaction.c +10 -9
- data/vendor/libgit2/src/transports/auth.c +10 -9
- data/vendor/libgit2/src/transports/auth.h +11 -4
- data/vendor/libgit2/src/transports/auth_negotiate.c +23 -9
- data/vendor/libgit2/src/transports/auth_negotiate.h +2 -2
- data/vendor/libgit2/src/transports/auth_ntlm.c +223 -0
- data/vendor/libgit2/src/transports/auth_ntlm.h +35 -0
- data/vendor/libgit2/src/transports/cred.c +6 -6
- data/vendor/libgit2/src/transports/git.c +11 -16
- data/vendor/libgit2/src/transports/http.c +419 -276
- data/vendor/libgit2/src/transports/http.h +1 -1
- data/vendor/libgit2/src/transports/local.c +9 -9
- data/vendor/libgit2/src/transports/smart.c +17 -17
- data/vendor/libgit2/src/transports/smart.h +2 -2
- data/vendor/libgit2/src/transports/smart_protocol.c +36 -60
- data/vendor/libgit2/src/transports/ssh.c +46 -36
- data/vendor/libgit2/src/transports/winhttp.c +231 -207
- data/vendor/libgit2/src/tree-cache.c +14 -7
- data/vendor/libgit2/src/tree.c +10 -24
- data/vendor/libgit2/src/unix/map.c +1 -1
- data/vendor/libgit2/src/unix/posix.h +1 -11
- data/vendor/libgit2/src/userdiff.h +3 -1
- data/vendor/libgit2/src/util.c +51 -53
- data/vendor/libgit2/src/util.h +16 -21
- data/vendor/libgit2/src/wildmatch.c +320 -0
- data/vendor/libgit2/src/wildmatch.h +23 -0
- data/vendor/libgit2/src/win32/map.c +3 -5
- data/vendor/libgit2/src/win32/path_w32.c +12 -2
- data/vendor/libgit2/src/win32/path_w32.h +0 -29
- data/vendor/libgit2/src/win32/posix.h +1 -4
- data/vendor/libgit2/src/win32/posix_w32.c +40 -5
- data/vendor/libgit2/src/win32/precompiled.h +0 -2
- data/vendor/libgit2/src/win32/thread.c +5 -10
- data/vendor/libgit2/src/win32/w32_buffer.c +7 -3
- data/vendor/libgit2/src/win32/w32_common.h +39 -0
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.c +0 -93
- data/vendor/libgit2/src/win32/w32_crtdbg_stacktrace.h +0 -2
- data/vendor/libgit2/src/win32/w32_stack.c +4 -9
- data/vendor/libgit2/src/win32/w32_stack.h +3 -3
- data/vendor/libgit2/src/win32/w32_util.c +31 -0
- data/vendor/libgit2/src/win32/w32_util.h +6 -32
- data/vendor/libgit2/src/worktree.c +36 -22
- data/vendor/libgit2/src/xdiff/xdiffi.c +1 -1
- data/vendor/libgit2/src/xdiff/xmerge.c +12 -0
- data/vendor/libgit2/src/xdiff/xpatience.c +3 -0
- metadata +98 -34
- data/vendor/libgit2/deps/regex/CMakeLists.txt +0 -2
- data/vendor/libgit2/deps/regex/COPYING +0 -502
- data/vendor/libgit2/deps/regex/config.h +0 -7
- data/vendor/libgit2/deps/regex/regcomp.c +0 -3857
- data/vendor/libgit2/deps/regex/regex.c +0 -92
- data/vendor/libgit2/deps/regex/regex.h +0 -582
- data/vendor/libgit2/deps/regex/regex_internal.c +0 -1744
- data/vendor/libgit2/deps/regex/regex_internal.h +0 -819
- data/vendor/libgit2/deps/regex/regexec.c +0 -4369
- data/vendor/libgit2/include/git2/inttypes.h +0 -309
- data/vendor/libgit2/include/git2/sys/time.h +0 -31
- data/vendor/libgit2/libgit2.pc.in +0 -13
- data/vendor/libgit2/src/fnmatch.c +0 -248
- data/vendor/libgit2/src/fnmatch.h +0 -48
@@ -1,819 +0,0 @@
|
|
1
|
-
/* Extended regular expression matching and search library.
|
2
|
-
Copyright (C) 2002-2005, 2007, 2008, 2010 Free Software Foundation, Inc.
|
3
|
-
This file is part of the GNU C Library.
|
4
|
-
Contributed by Isamu Hasegawa <isamu@yamato.ibm.com>.
|
5
|
-
|
6
|
-
The GNU C Library is free software; you can redistribute it and/or
|
7
|
-
modify it under the terms of the GNU Lesser General Public
|
8
|
-
License as published by the Free Software Foundation; either
|
9
|
-
version 2.1 of the License, or (at your option) any later version.
|
10
|
-
|
11
|
-
The GNU C Library is distributed in the hope that it will be useful,
|
12
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
-
Lesser General Public License for more details.
|
15
|
-
|
16
|
-
You should have received a copy of the GNU Lesser General Public
|
17
|
-
License along with the GNU C Library; if not, write to the Free
|
18
|
-
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
|
19
|
-
02111-1307 USA. */
|
20
|
-
|
21
|
-
#ifndef _REGEX_INTERNAL_H
|
22
|
-
#define _REGEX_INTERNAL_H 1
|
23
|
-
|
24
|
-
#include <assert.h>
|
25
|
-
#include <ctype.h>
|
26
|
-
#include <stdio.h>
|
27
|
-
#include <stdlib.h>
|
28
|
-
#include <string.h>
|
29
|
-
|
30
|
-
#ifndef UNUSED
|
31
|
-
# ifdef __GNUC__
|
32
|
-
# define UNUSED __attribute__((unused))
|
33
|
-
# else
|
34
|
-
# define UNUSED
|
35
|
-
# endif
|
36
|
-
#endif
|
37
|
-
|
38
|
-
#if defined HAVE_LANGINFO_H || defined HAVE_LANGINFO_CODESET || defined _LIBC
|
39
|
-
# include <langinfo.h>
|
40
|
-
#endif
|
41
|
-
#if defined HAVE_LOCALE_H || defined _LIBC
|
42
|
-
# include <locale.h>
|
43
|
-
#endif
|
44
|
-
#if defined HAVE_WCHAR_H || defined _LIBC
|
45
|
-
# include <wchar.h>
|
46
|
-
#endif /* HAVE_WCHAR_H || _LIBC */
|
47
|
-
#if defined HAVE_WCTYPE_H || defined _LIBC
|
48
|
-
# include <wctype.h>
|
49
|
-
#endif /* HAVE_WCTYPE_H || _LIBC */
|
50
|
-
#if defined HAVE_STDBOOL_H || defined _LIBC
|
51
|
-
# include <stdbool.h>
|
52
|
-
#endif /* HAVE_STDBOOL_H || _LIBC */
|
53
|
-
#if !defined(ZOS_USS)
|
54
|
-
#if defined HAVE_STDINT_H || defined _LIBC
|
55
|
-
# include <stdint.h>
|
56
|
-
#endif /* HAVE_STDINT_H || _LIBC */
|
57
|
-
#endif /* !ZOS_USS */
|
58
|
-
#if defined _LIBC
|
59
|
-
# include <bits/libc-lock.h>
|
60
|
-
#else
|
61
|
-
# define __libc_lock_define(CLASS,NAME)
|
62
|
-
# define __libc_lock_init(NAME) do { } while (0)
|
63
|
-
# define __libc_lock_lock(NAME) do { } while (0)
|
64
|
-
# define __libc_lock_unlock(NAME) do { } while (0)
|
65
|
-
#endif
|
66
|
-
|
67
|
-
#ifndef GAWK
|
68
|
-
/* In case that the system doesn't have isblank(). */
|
69
|
-
#if !defined _LIBC && !defined HAVE_ISBLANK && !defined isblank
|
70
|
-
# define isblank(ch) ((ch) == ' ' || (ch) == '\t')
|
71
|
-
#endif
|
72
|
-
#else /* GAWK */
|
73
|
-
/*
|
74
|
-
* This is a mess. On glibc systems you have to define
|
75
|
-
* a magic constant to get isblank() out of <ctype.h>, since it's
|
76
|
-
* a C99 function. To heck with all that and borrow a page from
|
77
|
-
* dfa.c's book.
|
78
|
-
*/
|
79
|
-
|
80
|
-
static int
|
81
|
-
is_blank (int c)
|
82
|
-
{
|
83
|
-
return (c == ' ' || c == '\t');
|
84
|
-
}
|
85
|
-
#endif /* GAWK */
|
86
|
-
|
87
|
-
#ifdef _LIBC
|
88
|
-
# ifndef _RE_DEFINE_LOCALE_FUNCTIONS
|
89
|
-
# define _RE_DEFINE_LOCALE_FUNCTIONS 1
|
90
|
-
# include <locale/localeinfo.h>
|
91
|
-
# include <locale/elem-hash.h>
|
92
|
-
# include <locale/coll-lookup.h>
|
93
|
-
# endif
|
94
|
-
#endif
|
95
|
-
|
96
|
-
/* This is for other GNU distributions with internationalized messages. */
|
97
|
-
#if (HAVE_LIBINTL_H && ENABLE_NLS) || defined _LIBC
|
98
|
-
# include <libintl.h>
|
99
|
-
# ifdef _LIBC
|
100
|
-
# undef gettext
|
101
|
-
# define gettext(msgid) \
|
102
|
-
INTUSE(__dcgettext) (_libc_intl_domainname, msgid, LC_MESSAGES)
|
103
|
-
# endif
|
104
|
-
#else
|
105
|
-
# define gettext(msgid) (msgid)
|
106
|
-
#endif
|
107
|
-
|
108
|
-
#ifndef gettext_noop
|
109
|
-
/* This define is so xgettext can find the internationalizable
|
110
|
-
strings. */
|
111
|
-
# define gettext_noop(String) String
|
112
|
-
#endif
|
113
|
-
|
114
|
-
/* For loser systems without the definition. */
|
115
|
-
#ifndef SIZE_MAX
|
116
|
-
# define SIZE_MAX ((size_t) -1)
|
117
|
-
#endif
|
118
|
-
|
119
|
-
#ifndef NO_MBSUPPORT
|
120
|
-
#include "mbsupport.h" /* gawk */
|
121
|
-
#endif
|
122
|
-
#ifndef MB_CUR_MAX
|
123
|
-
#define MB_CUR_MAX 1
|
124
|
-
#endif
|
125
|
-
|
126
|
-
#if (defined MBS_SUPPORT) || _LIBC
|
127
|
-
# define RE_ENABLE_I18N
|
128
|
-
#endif
|
129
|
-
|
130
|
-
#if __GNUC__ >= 3
|
131
|
-
# define BE(expr, val) __builtin_expect (expr, val)
|
132
|
-
#else
|
133
|
-
# define BE(expr, val) (expr)
|
134
|
-
# ifdef inline
|
135
|
-
# undef inline
|
136
|
-
# endif
|
137
|
-
# define inline
|
138
|
-
#endif
|
139
|
-
|
140
|
-
/* Number of single byte character. */
|
141
|
-
#define SBC_MAX 256
|
142
|
-
|
143
|
-
#define COLL_ELEM_LEN_MAX 8
|
144
|
-
|
145
|
-
/* The character which represents newline. */
|
146
|
-
#define NEWLINE_CHAR '\n'
|
147
|
-
#define WIDE_NEWLINE_CHAR L'\n'
|
148
|
-
|
149
|
-
/* Rename to standard API for using out of glibc. */
|
150
|
-
#ifndef _LIBC
|
151
|
-
# ifdef __wctype
|
152
|
-
# undef __wctype
|
153
|
-
# endif
|
154
|
-
# define __wctype wctype
|
155
|
-
# ifdef __iswctype
|
156
|
-
# undef __iswctype
|
157
|
-
# endif
|
158
|
-
# define __iswctype iswctype
|
159
|
-
# define __btowc btowc
|
160
|
-
# define __mbrtowc mbrtowc
|
161
|
-
#undef __mempcpy /* GAWK */
|
162
|
-
# define __mempcpy mempcpy
|
163
|
-
# define __wcrtomb wcrtomb
|
164
|
-
# define __regfree regfree
|
165
|
-
# define attribute_hidden
|
166
|
-
#endif /* not _LIBC */
|
167
|
-
|
168
|
-
#ifdef __GNUC__
|
169
|
-
# define __attribute(arg) __attribute__ (arg)
|
170
|
-
#else
|
171
|
-
# define __attribute(arg)
|
172
|
-
#endif
|
173
|
-
|
174
|
-
extern const char __re_error_msgid[] attribute_hidden;
|
175
|
-
extern const size_t __re_error_msgid_idx[] attribute_hidden;
|
176
|
-
|
177
|
-
/* An integer used to represent a set of bits. It must be unsigned,
|
178
|
-
and must be at least as wide as unsigned int. */
|
179
|
-
typedef unsigned long int bitset_word_t;
|
180
|
-
/* All bits set in a bitset_word_t. */
|
181
|
-
#define BITSET_WORD_MAX ULONG_MAX
|
182
|
-
/* Number of bits in a bitset_word_t. Cast to int as most code use it
|
183
|
-
* like that for counting */
|
184
|
-
#define BITSET_WORD_BITS ((int)(sizeof (bitset_word_t) * CHAR_BIT))
|
185
|
-
/* Number of bitset_word_t in a bit_set. */
|
186
|
-
#define BITSET_WORDS (SBC_MAX / BITSET_WORD_BITS)
|
187
|
-
typedef bitset_word_t bitset_t[BITSET_WORDS];
|
188
|
-
typedef bitset_word_t *re_bitset_ptr_t;
|
189
|
-
typedef const bitset_word_t *re_const_bitset_ptr_t;
|
190
|
-
|
191
|
-
#define bitset_set(set,i) \
|
192
|
-
(set[i / BITSET_WORD_BITS] |= (bitset_word_t) 1 << i % BITSET_WORD_BITS)
|
193
|
-
#define bitset_clear(set,i) \
|
194
|
-
(set[i / BITSET_WORD_BITS] &= ~((bitset_word_t) 1 << i % BITSET_WORD_BITS))
|
195
|
-
#define bitset_contain(set,i) \
|
196
|
-
(set[i / BITSET_WORD_BITS] & ((bitset_word_t) 1 << i % BITSET_WORD_BITS))
|
197
|
-
#define bitset_empty(set) memset (set, '\0', sizeof (bitset_t))
|
198
|
-
#define bitset_set_all(set) memset (set, '\xff', sizeof (bitset_t))
|
199
|
-
#define bitset_copy(dest,src) memcpy (dest, src, sizeof (bitset_t))
|
200
|
-
|
201
|
-
#define PREV_WORD_CONSTRAINT 0x0001
|
202
|
-
#define PREV_NOTWORD_CONSTRAINT 0x0002
|
203
|
-
#define NEXT_WORD_CONSTRAINT 0x0004
|
204
|
-
#define NEXT_NOTWORD_CONSTRAINT 0x0008
|
205
|
-
#define PREV_NEWLINE_CONSTRAINT 0x0010
|
206
|
-
#define NEXT_NEWLINE_CONSTRAINT 0x0020
|
207
|
-
#define PREV_BEGBUF_CONSTRAINT 0x0040
|
208
|
-
#define NEXT_ENDBUF_CONSTRAINT 0x0080
|
209
|
-
#define WORD_DELIM_CONSTRAINT 0x0100
|
210
|
-
#define NOT_WORD_DELIM_CONSTRAINT 0x0200
|
211
|
-
|
212
|
-
typedef enum
|
213
|
-
{
|
214
|
-
INSIDE_WORD = PREV_WORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
|
215
|
-
WORD_FIRST = PREV_NOTWORD_CONSTRAINT | NEXT_WORD_CONSTRAINT,
|
216
|
-
WORD_LAST = PREV_WORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
|
217
|
-
INSIDE_NOTWORD = PREV_NOTWORD_CONSTRAINT | NEXT_NOTWORD_CONSTRAINT,
|
218
|
-
LINE_FIRST = PREV_NEWLINE_CONSTRAINT,
|
219
|
-
LINE_LAST = NEXT_NEWLINE_CONSTRAINT,
|
220
|
-
BUF_FIRST = PREV_BEGBUF_CONSTRAINT,
|
221
|
-
BUF_LAST = NEXT_ENDBUF_CONSTRAINT,
|
222
|
-
WORD_DELIM = WORD_DELIM_CONSTRAINT,
|
223
|
-
NOT_WORD_DELIM = NOT_WORD_DELIM_CONSTRAINT
|
224
|
-
} re_context_type;
|
225
|
-
|
226
|
-
typedef struct
|
227
|
-
{
|
228
|
-
int alloc;
|
229
|
-
int nelem;
|
230
|
-
int *elems;
|
231
|
-
} re_node_set;
|
232
|
-
|
233
|
-
typedef enum
|
234
|
-
{
|
235
|
-
NON_TYPE = 0,
|
236
|
-
|
237
|
-
/* Node type, These are used by token, node, tree. */
|
238
|
-
CHARACTER = 1,
|
239
|
-
END_OF_RE = 2,
|
240
|
-
SIMPLE_BRACKET = 3,
|
241
|
-
OP_BACK_REF = 4,
|
242
|
-
OP_PERIOD = 5,
|
243
|
-
#ifdef RE_ENABLE_I18N
|
244
|
-
COMPLEX_BRACKET = 6,
|
245
|
-
OP_UTF8_PERIOD = 7,
|
246
|
-
#endif /* RE_ENABLE_I18N */
|
247
|
-
|
248
|
-
/* We define EPSILON_BIT as a macro so that OP_OPEN_SUBEXP is used
|
249
|
-
when the debugger shows values of this enum type. */
|
250
|
-
#define EPSILON_BIT 8
|
251
|
-
OP_OPEN_SUBEXP = EPSILON_BIT | 0,
|
252
|
-
OP_CLOSE_SUBEXP = EPSILON_BIT | 1,
|
253
|
-
OP_ALT = EPSILON_BIT | 2,
|
254
|
-
OP_DUP_ASTERISK = EPSILON_BIT | 3,
|
255
|
-
ANCHOR = EPSILON_BIT | 4,
|
256
|
-
|
257
|
-
/* Tree type, these are used only by tree. */
|
258
|
-
CONCAT = 16,
|
259
|
-
SUBEXP = 17,
|
260
|
-
|
261
|
-
/* Token type, these are used only by token. */
|
262
|
-
OP_DUP_PLUS = 18,
|
263
|
-
OP_DUP_QUESTION,
|
264
|
-
OP_OPEN_BRACKET,
|
265
|
-
OP_CLOSE_BRACKET,
|
266
|
-
OP_CHARSET_RANGE,
|
267
|
-
OP_OPEN_DUP_NUM,
|
268
|
-
OP_CLOSE_DUP_NUM,
|
269
|
-
OP_NON_MATCH_LIST,
|
270
|
-
OP_OPEN_COLL_ELEM,
|
271
|
-
OP_CLOSE_COLL_ELEM,
|
272
|
-
OP_OPEN_EQUIV_CLASS,
|
273
|
-
OP_CLOSE_EQUIV_CLASS,
|
274
|
-
OP_OPEN_CHAR_CLASS,
|
275
|
-
OP_CLOSE_CHAR_CLASS,
|
276
|
-
OP_WORD,
|
277
|
-
OP_NOTWORD,
|
278
|
-
OP_SPACE,
|
279
|
-
OP_NOTSPACE,
|
280
|
-
BACK_SLASH
|
281
|
-
|
282
|
-
} re_token_type_t;
|
283
|
-
|
284
|
-
#ifdef RE_ENABLE_I18N
|
285
|
-
typedef struct
|
286
|
-
{
|
287
|
-
/* Multibyte characters. */
|
288
|
-
wchar_t *mbchars;
|
289
|
-
|
290
|
-
/* Collating symbols. */
|
291
|
-
# ifdef _LIBC
|
292
|
-
int32_t *coll_syms;
|
293
|
-
# endif
|
294
|
-
|
295
|
-
/* Equivalence classes. */
|
296
|
-
# ifdef _LIBC
|
297
|
-
int32_t *equiv_classes;
|
298
|
-
# endif
|
299
|
-
|
300
|
-
/* Range expressions. */
|
301
|
-
# ifdef _LIBC
|
302
|
-
uint32_t *range_starts;
|
303
|
-
uint32_t *range_ends;
|
304
|
-
# else /* not _LIBC */
|
305
|
-
wchar_t *range_starts;
|
306
|
-
wchar_t *range_ends;
|
307
|
-
# endif /* not _LIBC */
|
308
|
-
|
309
|
-
/* Character classes. */
|
310
|
-
wctype_t *char_classes;
|
311
|
-
|
312
|
-
/* If this character set is the non-matching list. */
|
313
|
-
unsigned int non_match : 1;
|
314
|
-
|
315
|
-
/* # of multibyte characters. */
|
316
|
-
int nmbchars;
|
317
|
-
|
318
|
-
/* # of collating symbols. */
|
319
|
-
int ncoll_syms;
|
320
|
-
|
321
|
-
/* # of equivalence classes. */
|
322
|
-
int nequiv_classes;
|
323
|
-
|
324
|
-
/* # of range expressions. */
|
325
|
-
int nranges;
|
326
|
-
|
327
|
-
/* # of character classes. */
|
328
|
-
int nchar_classes;
|
329
|
-
} re_charset_t;
|
330
|
-
#endif /* RE_ENABLE_I18N */
|
331
|
-
|
332
|
-
typedef struct
|
333
|
-
{
|
334
|
-
union
|
335
|
-
{
|
336
|
-
unsigned char c; /* for CHARACTER */
|
337
|
-
re_bitset_ptr_t sbcset; /* for SIMPLE_BRACKET */
|
338
|
-
#ifdef RE_ENABLE_I18N
|
339
|
-
re_charset_t *mbcset; /* for COMPLEX_BRACKET */
|
340
|
-
#endif /* RE_ENABLE_I18N */
|
341
|
-
int idx; /* for BACK_REF */
|
342
|
-
re_context_type ctx_type; /* for ANCHOR */
|
343
|
-
} opr;
|
344
|
-
#if __GNUC__ >= 2
|
345
|
-
re_token_type_t type : 8;
|
346
|
-
#else
|
347
|
-
re_token_type_t type;
|
348
|
-
#endif
|
349
|
-
unsigned int constraint : 10; /* context constraint */
|
350
|
-
unsigned int duplicated : 1;
|
351
|
-
unsigned int opt_subexp : 1;
|
352
|
-
#ifdef RE_ENABLE_I18N
|
353
|
-
unsigned int accept_mb : 1;
|
354
|
-
/* These 2 bits can be moved into the union if needed (e.g. if running out
|
355
|
-
of bits; move opr.c to opr.c.c and move the flags to opr.c.flags). */
|
356
|
-
unsigned int mb_partial : 1;
|
357
|
-
#endif
|
358
|
-
unsigned int word_char : 1;
|
359
|
-
} re_token_t;
|
360
|
-
|
361
|
-
#define IS_EPSILON_NODE(type) ((type) & EPSILON_BIT)
|
362
|
-
|
363
|
-
struct re_string_t
|
364
|
-
{
|
365
|
-
/* Indicate the raw buffer which is the original string passed as an
|
366
|
-
argument of regexec(), re_search(), etc.. */
|
367
|
-
const unsigned char *raw_mbs;
|
368
|
-
/* Store the multibyte string. In case of "case insensitive mode" like
|
369
|
-
REG_ICASE, upper cases of the string are stored, otherwise MBS points
|
370
|
-
the same address that RAW_MBS points. */
|
371
|
-
unsigned char *mbs;
|
372
|
-
#ifdef RE_ENABLE_I18N
|
373
|
-
/* Store the wide character string which is corresponding to MBS. */
|
374
|
-
wint_t *wcs;
|
375
|
-
int *offsets;
|
376
|
-
mbstate_t cur_state;
|
377
|
-
#endif
|
378
|
-
/* Index in RAW_MBS. Each character mbs[i] corresponds to
|
379
|
-
raw_mbs[raw_mbs_idx + i]. */
|
380
|
-
int raw_mbs_idx;
|
381
|
-
/* The length of the valid characters in the buffers. */
|
382
|
-
int valid_len;
|
383
|
-
/* The corresponding number of bytes in raw_mbs array. */
|
384
|
-
int valid_raw_len;
|
385
|
-
/* The length of the buffers MBS and WCS. */
|
386
|
-
int bufs_len;
|
387
|
-
/* The index in MBS, which is updated by re_string_fetch_byte. */
|
388
|
-
int cur_idx;
|
389
|
-
/* length of RAW_MBS array. */
|
390
|
-
int raw_len;
|
391
|
-
/* This is RAW_LEN - RAW_MBS_IDX + VALID_LEN - VALID_RAW_LEN. */
|
392
|
-
int len;
|
393
|
-
/* End of the buffer may be shorter than its length in the cases such
|
394
|
-
as re_match_2, re_search_2. Then, we use STOP for end of the buffer
|
395
|
-
instead of LEN. */
|
396
|
-
int raw_stop;
|
397
|
-
/* This is RAW_STOP - RAW_MBS_IDX adjusted through OFFSETS. */
|
398
|
-
int stop;
|
399
|
-
|
400
|
-
/* The context of mbs[0]. We store the context independently, since
|
401
|
-
the context of mbs[0] may be different from raw_mbs[0], which is
|
402
|
-
the beginning of the input string. */
|
403
|
-
unsigned int tip_context;
|
404
|
-
/* The translation passed as a part of an argument of re_compile_pattern. */
|
405
|
-
RE_TRANSLATE_TYPE trans;
|
406
|
-
/* Copy of re_dfa_t's word_char. */
|
407
|
-
re_const_bitset_ptr_t word_char;
|
408
|
-
/* 1 if REG_ICASE. */
|
409
|
-
unsigned char icase;
|
410
|
-
unsigned char is_utf8;
|
411
|
-
unsigned char map_notascii;
|
412
|
-
unsigned char mbs_allocated;
|
413
|
-
unsigned char offsets_needed;
|
414
|
-
unsigned char newline_anchor;
|
415
|
-
unsigned char word_ops_used;
|
416
|
-
int mb_cur_max;
|
417
|
-
};
|
418
|
-
typedef struct re_string_t re_string_t;
|
419
|
-
|
420
|
-
|
421
|
-
struct re_dfa_t;
|
422
|
-
typedef struct re_dfa_t re_dfa_t;
|
423
|
-
|
424
|
-
#ifndef _LIBC
|
425
|
-
# ifdef __i386__
|
426
|
-
# define internal_function __attribute ((regparm (3), stdcall))
|
427
|
-
# else
|
428
|
-
# define internal_function
|
429
|
-
# endif
|
430
|
-
#endif
|
431
|
-
|
432
|
-
#ifndef NOT_IN_libc
|
433
|
-
static reg_errcode_t re_string_realloc_buffers (re_string_t *pstr,
|
434
|
-
int new_buf_len)
|
435
|
-
internal_function;
|
436
|
-
# ifdef RE_ENABLE_I18N
|
437
|
-
static void build_wcs_buffer (re_string_t *pstr) internal_function;
|
438
|
-
static reg_errcode_t build_wcs_upper_buffer (re_string_t *pstr)
|
439
|
-
internal_function;
|
440
|
-
# endif /* RE_ENABLE_I18N */
|
441
|
-
static void build_upper_buffer (re_string_t *pstr) internal_function;
|
442
|
-
static void re_string_translate_buffer (re_string_t *pstr) internal_function;
|
443
|
-
static unsigned int re_string_context_at (const re_string_t *input, int idx,
|
444
|
-
int eflags)
|
445
|
-
internal_function __attribute ((pure));
|
446
|
-
#endif
|
447
|
-
#define re_string_peek_byte(pstr, offset) \
|
448
|
-
((pstr)->mbs[(pstr)->cur_idx + offset])
|
449
|
-
#define re_string_fetch_byte(pstr) \
|
450
|
-
((pstr)->mbs[(pstr)->cur_idx++])
|
451
|
-
#define re_string_first_byte(pstr, idx) \
|
452
|
-
((idx) == (pstr)->valid_len || (pstr)->wcs[idx] != WEOF)
|
453
|
-
#define re_string_is_single_byte_char(pstr, idx) \
|
454
|
-
((pstr)->wcs[idx] != WEOF && ((pstr)->valid_len == (idx) + 1 \
|
455
|
-
|| (pstr)->wcs[(idx) + 1] != WEOF))
|
456
|
-
#define re_string_eoi(pstr) ((pstr)->stop <= (pstr)->cur_idx)
|
457
|
-
#define re_string_cur_idx(pstr) ((pstr)->cur_idx)
|
458
|
-
#define re_string_get_buffer(pstr) ((pstr)->mbs)
|
459
|
-
#define re_string_length(pstr) ((pstr)->len)
|
460
|
-
#define re_string_byte_at(pstr,idx) ((pstr)->mbs[idx])
|
461
|
-
#define re_string_skip_bytes(pstr,idx) ((pstr)->cur_idx += (idx))
|
462
|
-
#define re_string_set_index(pstr,idx) ((pstr)->cur_idx = (idx))
|
463
|
-
|
464
|
-
#ifndef _LIBC
|
465
|
-
# if HAVE_ALLOCA
|
466
|
-
# if (_MSC_VER)
|
467
|
-
# include <malloc.h>
|
468
|
-
# define __libc_use_alloca(n) 0
|
469
|
-
# else
|
470
|
-
# include <alloca.h>
|
471
|
-
/* The OS usually guarantees only one guard page at the bottom of the stack,
|
472
|
-
and a page size can be as small as 4096 bytes. So we cannot safely
|
473
|
-
allocate anything larger than 4096 bytes. Also care for the possibility
|
474
|
-
of a few compiler-allocated temporary stack slots. */
|
475
|
-
# define __libc_use_alloca(n) ((n) < 4032)
|
476
|
-
# endif
|
477
|
-
# else
|
478
|
-
/* alloca is implemented with malloc, so just use malloc. */
|
479
|
-
# define __libc_use_alloca(n) 0
|
480
|
-
# endif
|
481
|
-
#endif
|
482
|
-
|
483
|
-
#define re_malloc(t,n) ((t *) malloc ((n) * sizeof (t)))
|
484
|
-
/* SunOS 4.1.x realloc doesn't accept null pointers: pre-Standard C. Sigh. */
|
485
|
-
#define re_realloc(p,t,n) ((p != NULL) ? (t *) realloc (p,(n)*sizeof(t)) : (t *) calloc(n,sizeof(t)))
|
486
|
-
#define re_free(p) free (p)
|
487
|
-
|
488
|
-
struct bin_tree_t
|
489
|
-
{
|
490
|
-
struct bin_tree_t *parent;
|
491
|
-
struct bin_tree_t *left;
|
492
|
-
struct bin_tree_t *right;
|
493
|
-
struct bin_tree_t *first;
|
494
|
-
struct bin_tree_t *next;
|
495
|
-
|
496
|
-
re_token_t token;
|
497
|
-
|
498
|
-
/* `node_idx' is the index in dfa->nodes, if `type' == 0.
|
499
|
-
Otherwise `type' indicate the type of this node. */
|
500
|
-
int node_idx;
|
501
|
-
};
|
502
|
-
typedef struct bin_tree_t bin_tree_t;
|
503
|
-
|
504
|
-
#define BIN_TREE_STORAGE_SIZE \
|
505
|
-
((1024 - sizeof (void *)) / sizeof (bin_tree_t))
|
506
|
-
|
507
|
-
struct bin_tree_storage_t
|
508
|
-
{
|
509
|
-
struct bin_tree_storage_t *next;
|
510
|
-
bin_tree_t data[BIN_TREE_STORAGE_SIZE];
|
511
|
-
};
|
512
|
-
typedef struct bin_tree_storage_t bin_tree_storage_t;
|
513
|
-
|
514
|
-
#define CONTEXT_WORD 1
|
515
|
-
#define CONTEXT_NEWLINE (CONTEXT_WORD << 1)
|
516
|
-
#define CONTEXT_BEGBUF (CONTEXT_NEWLINE << 1)
|
517
|
-
#define CONTEXT_ENDBUF (CONTEXT_BEGBUF << 1)
|
518
|
-
|
519
|
-
#define IS_WORD_CONTEXT(c) ((c) & CONTEXT_WORD)
|
520
|
-
#define IS_NEWLINE_CONTEXT(c) ((c) & CONTEXT_NEWLINE)
|
521
|
-
#define IS_BEGBUF_CONTEXT(c) ((c) & CONTEXT_BEGBUF)
|
522
|
-
#define IS_ENDBUF_CONTEXT(c) ((c) & CONTEXT_ENDBUF)
|
523
|
-
#define IS_ORDINARY_CONTEXT(c) ((c) == 0)
|
524
|
-
|
525
|
-
#define IS_WORD_CHAR(ch) (isalnum (ch) || (ch) == '_')
|
526
|
-
#define IS_NEWLINE(ch) ((ch) == NEWLINE_CHAR)
|
527
|
-
#define IS_WIDE_WORD_CHAR(ch) (iswalnum (ch) || (ch) == L'_')
|
528
|
-
#define IS_WIDE_NEWLINE(ch) ((ch) == WIDE_NEWLINE_CHAR)
|
529
|
-
|
530
|
-
#define NOT_SATISFY_PREV_CONSTRAINT(constraint,context) \
|
531
|
-
((((constraint) & PREV_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \
|
532
|
-
|| ((constraint & PREV_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \
|
533
|
-
|| ((constraint & PREV_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context))\
|
534
|
-
|| ((constraint & PREV_BEGBUF_CONSTRAINT) && !IS_BEGBUF_CONTEXT (context)))
|
535
|
-
|
536
|
-
#define NOT_SATISFY_NEXT_CONSTRAINT(constraint,context) \
|
537
|
-
((((constraint) & NEXT_WORD_CONSTRAINT) && !IS_WORD_CONTEXT (context)) \
|
538
|
-
|| (((constraint) & NEXT_NOTWORD_CONSTRAINT) && IS_WORD_CONTEXT (context)) \
|
539
|
-
|| (((constraint) & NEXT_NEWLINE_CONSTRAINT) && !IS_NEWLINE_CONTEXT (context)) \
|
540
|
-
|| (((constraint) & NEXT_ENDBUF_CONSTRAINT) && !IS_ENDBUF_CONTEXT (context)))
|
541
|
-
|
542
|
-
struct re_dfastate_t
|
543
|
-
{
|
544
|
-
unsigned int hash;
|
545
|
-
re_node_set nodes;
|
546
|
-
re_node_set non_eps_nodes;
|
547
|
-
re_node_set inveclosure;
|
548
|
-
re_node_set *entrance_nodes;
|
549
|
-
struct re_dfastate_t **trtable, **word_trtable;
|
550
|
-
unsigned int context : 4;
|
551
|
-
unsigned int halt : 1;
|
552
|
-
/* If this state can accept `multi byte'.
|
553
|
-
Note that we refer to multibyte characters, and multi character
|
554
|
-
collating elements as `multi byte'. */
|
555
|
-
unsigned int accept_mb : 1;
|
556
|
-
/* If this state has backreference node(s). */
|
557
|
-
unsigned int has_backref : 1;
|
558
|
-
unsigned int has_constraint : 1;
|
559
|
-
};
|
560
|
-
typedef struct re_dfastate_t re_dfastate_t;
|
561
|
-
|
562
|
-
struct re_state_table_entry
|
563
|
-
{
|
564
|
-
int num;
|
565
|
-
int alloc;
|
566
|
-
re_dfastate_t **array;
|
567
|
-
};
|
568
|
-
|
569
|
-
/* Array type used in re_sub_match_last_t and re_sub_match_top_t. */
|
570
|
-
|
571
|
-
typedef struct
|
572
|
-
{
|
573
|
-
int next_idx;
|
574
|
-
int alloc;
|
575
|
-
re_dfastate_t **array;
|
576
|
-
} state_array_t;
|
577
|
-
|
578
|
-
/* Store information about the node NODE whose type is OP_CLOSE_SUBEXP. */
|
579
|
-
|
580
|
-
typedef struct
|
581
|
-
{
|
582
|
-
int node;
|
583
|
-
int str_idx; /* The position NODE match at. */
|
584
|
-
state_array_t path;
|
585
|
-
} re_sub_match_last_t;
|
586
|
-
|
587
|
-
/* Store information about the node NODE whose type is OP_OPEN_SUBEXP.
|
588
|
-
And information about the node, whose type is OP_CLOSE_SUBEXP,
|
589
|
-
corresponding to NODE is stored in LASTS. */
|
590
|
-
|
591
|
-
typedef struct
|
592
|
-
{
|
593
|
-
int str_idx;
|
594
|
-
int node;
|
595
|
-
state_array_t *path;
|
596
|
-
int alasts; /* Allocation size of LASTS. */
|
597
|
-
int nlasts; /* The number of LASTS. */
|
598
|
-
re_sub_match_last_t **lasts;
|
599
|
-
} re_sub_match_top_t;
|
600
|
-
|
601
|
-
struct re_backref_cache_entry
|
602
|
-
{
|
603
|
-
int node;
|
604
|
-
int str_idx;
|
605
|
-
int subexp_from;
|
606
|
-
int subexp_to;
|
607
|
-
char more;
|
608
|
-
char unused;
|
609
|
-
unsigned short int eps_reachable_subexps_map;
|
610
|
-
};
|
611
|
-
|
612
|
-
typedef struct
|
613
|
-
{
|
614
|
-
/* The string object corresponding to the input string. */
|
615
|
-
re_string_t input;
|
616
|
-
#if defined _LIBC || (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L)
|
617
|
-
const re_dfa_t *const dfa;
|
618
|
-
#else
|
619
|
-
const re_dfa_t *dfa;
|
620
|
-
#endif
|
621
|
-
/* EFLAGS of the argument of regexec. */
|
622
|
-
int eflags;
|
623
|
-
/* Where the matching ends. */
|
624
|
-
int match_last;
|
625
|
-
int last_node;
|
626
|
-
/* The state log used by the matcher. */
|
627
|
-
re_dfastate_t **state_log;
|
628
|
-
int state_log_top;
|
629
|
-
/* Back reference cache. */
|
630
|
-
int nbkref_ents;
|
631
|
-
int abkref_ents;
|
632
|
-
struct re_backref_cache_entry *bkref_ents;
|
633
|
-
int max_mb_elem_len;
|
634
|
-
int nsub_tops;
|
635
|
-
int asub_tops;
|
636
|
-
re_sub_match_top_t **sub_tops;
|
637
|
-
} re_match_context_t;
|
638
|
-
|
639
|
-
typedef struct
|
640
|
-
{
|
641
|
-
re_dfastate_t **sifted_states;
|
642
|
-
re_dfastate_t **limited_states;
|
643
|
-
int last_node;
|
644
|
-
int last_str_idx;
|
645
|
-
re_node_set limits;
|
646
|
-
} re_sift_context_t;
|
647
|
-
|
648
|
-
struct re_fail_stack_ent_t
|
649
|
-
{
|
650
|
-
int idx;
|
651
|
-
int node;
|
652
|
-
regmatch_t *regs;
|
653
|
-
re_node_set eps_via_nodes;
|
654
|
-
};
|
655
|
-
|
656
|
-
struct re_fail_stack_t
|
657
|
-
{
|
658
|
-
int num;
|
659
|
-
int alloc;
|
660
|
-
struct re_fail_stack_ent_t *stack;
|
661
|
-
};
|
662
|
-
|
663
|
-
struct re_dfa_t
|
664
|
-
{
|
665
|
-
re_token_t *nodes;
|
666
|
-
size_t nodes_alloc;
|
667
|
-
size_t nodes_len;
|
668
|
-
int *nexts;
|
669
|
-
int *org_indices;
|
670
|
-
re_node_set *edests;
|
671
|
-
re_node_set *eclosures;
|
672
|
-
re_node_set *inveclosures;
|
673
|
-
struct re_state_table_entry *state_table;
|
674
|
-
re_dfastate_t *init_state;
|
675
|
-
re_dfastate_t *init_state_word;
|
676
|
-
re_dfastate_t *init_state_nl;
|
677
|
-
re_dfastate_t *init_state_begbuf;
|
678
|
-
bin_tree_t *str_tree;
|
679
|
-
bin_tree_storage_t *str_tree_storage;
|
680
|
-
re_bitset_ptr_t sb_char;
|
681
|
-
int str_tree_storage_idx;
|
682
|
-
|
683
|
-
/* number of subexpressions `re_nsub' is in regex_t. */
|
684
|
-
unsigned int state_hash_mask;
|
685
|
-
int init_node;
|
686
|
-
int nbackref; /* The number of backreference in this dfa. */
|
687
|
-
|
688
|
-
/* Bitmap expressing which backreference is used. */
|
689
|
-
bitset_word_t used_bkref_map;
|
690
|
-
bitset_word_t completed_bkref_map;
|
691
|
-
|
692
|
-
unsigned int has_plural_match : 1;
|
693
|
-
/* If this dfa has "multibyte node", which is a backreference or
|
694
|
-
a node which can accept multibyte character or multi character
|
695
|
-
collating element. */
|
696
|
-
unsigned int has_mb_node : 1;
|
697
|
-
unsigned int is_utf8 : 1;
|
698
|
-
unsigned int map_notascii : 1;
|
699
|
-
unsigned int word_ops_used : 1;
|
700
|
-
int mb_cur_max;
|
701
|
-
bitset_t word_char;
|
702
|
-
reg_syntax_t syntax;
|
703
|
-
int *subexp_map;
|
704
|
-
#ifdef DEBUG
|
705
|
-
char* re_str;
|
706
|
-
#endif
|
707
|
-
#if defined _LIBC
|
708
|
-
__libc_lock_define (, lock)
|
709
|
-
#endif
|
710
|
-
};
|
711
|
-
|
712
|
-
#define re_node_set_init_empty(set) memset (set, '\0', sizeof (re_node_set))
|
713
|
-
#define re_node_set_remove(set,id) \
|
714
|
-
(re_node_set_remove_at (set, re_node_set_contains (set, id) - 1))
|
715
|
-
#define re_node_set_empty(p) ((p)->nelem = 0)
|
716
|
-
#define re_node_set_free(set) re_free ((set)->elems)
|
717
|
-
|
718
|
-
|
719
|
-
typedef enum
|
720
|
-
{
|
721
|
-
SB_CHAR,
|
722
|
-
MB_CHAR,
|
723
|
-
EQUIV_CLASS,
|
724
|
-
COLL_SYM,
|
725
|
-
CHAR_CLASS
|
726
|
-
} bracket_elem_type;
|
727
|
-
|
728
|
-
typedef struct
|
729
|
-
{
|
730
|
-
bracket_elem_type type;
|
731
|
-
union
|
732
|
-
{
|
733
|
-
unsigned char ch;
|
734
|
-
unsigned char *name;
|
735
|
-
wchar_t wch;
|
736
|
-
} opr;
|
737
|
-
} bracket_elem_t;
|
738
|
-
|
739
|
-
|
740
|
-
/* Inline functions for bitset operation. */
|
741
|
-
static inline void
|
742
|
-
bitset_not (bitset_t set)
|
743
|
-
{
|
744
|
-
int bitset_i;
|
745
|
-
for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i)
|
746
|
-
set[bitset_i] = ~set[bitset_i];
|
747
|
-
}
|
748
|
-
|
749
|
-
static inline void
|
750
|
-
bitset_merge (bitset_t dest, const bitset_t src)
|
751
|
-
{
|
752
|
-
int bitset_i;
|
753
|
-
for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i)
|
754
|
-
dest[bitset_i] |= src[bitset_i];
|
755
|
-
}
|
756
|
-
|
757
|
-
static inline void
|
758
|
-
bitset_mask (bitset_t dest, const bitset_t src)
|
759
|
-
{
|
760
|
-
int bitset_i;
|
761
|
-
for (bitset_i = 0; bitset_i < BITSET_WORDS; ++bitset_i)
|
762
|
-
dest[bitset_i] &= src[bitset_i];
|
763
|
-
}
|
764
|
-
|
765
|
-
#ifdef RE_ENABLE_I18N
|
766
|
-
/* Inline functions for re_string. */
|
767
|
-
static inline int
|
768
|
-
internal_function __attribute ((pure))
|
769
|
-
re_string_char_size_at (const re_string_t *pstr, int idx)
|
770
|
-
{
|
771
|
-
int byte_idx;
|
772
|
-
if (pstr->mb_cur_max == 1)
|
773
|
-
return 1;
|
774
|
-
for (byte_idx = 1; idx + byte_idx < pstr->valid_len; ++byte_idx)
|
775
|
-
if (pstr->wcs[idx + byte_idx] != WEOF)
|
776
|
-
break;
|
777
|
-
return byte_idx;
|
778
|
-
}
|
779
|
-
|
780
|
-
static inline wint_t
|
781
|
-
internal_function __attribute ((pure))
|
782
|
-
re_string_wchar_at (const re_string_t *pstr, int idx)
|
783
|
-
{
|
784
|
-
if (pstr->mb_cur_max == 1)
|
785
|
-
return (wint_t) pstr->mbs[idx];
|
786
|
-
return (wint_t) pstr->wcs[idx];
|
787
|
-
}
|
788
|
-
|
789
|
-
# ifndef NOT_IN_libc
|
790
|
-
static int
|
791
|
-
internal_function __attribute ((pure))
|
792
|
-
re_string_elem_size_at (const re_string_t *pstr, int idx)
|
793
|
-
{
|
794
|
-
# ifdef _LIBC
|
795
|
-
const unsigned char *p, *extra;
|
796
|
-
const int32_t *table, *indirect;
|
797
|
-
int32_t tmp;
|
798
|
-
# include <locale/weight.h>
|
799
|
-
uint_fast32_t nrules = _NL_CURRENT_WORD (LC_COLLATE, _NL_COLLATE_NRULES);
|
800
|
-
|
801
|
-
if (nrules != 0)
|
802
|
-
{
|
803
|
-
table = (const int32_t *) _NL_CURRENT (LC_COLLATE, _NL_COLLATE_TABLEMB);
|
804
|
-
extra = (const unsigned char *)
|
805
|
-
_NL_CURRENT (LC_COLLATE, _NL_COLLATE_EXTRAMB);
|
806
|
-
indirect = (const int32_t *) _NL_CURRENT (LC_COLLATE,
|
807
|
-
_NL_COLLATE_INDIRECTMB);
|
808
|
-
p = pstr->mbs + idx;
|
809
|
-
tmp = findidx (&p);
|
810
|
-
return p - pstr->mbs - idx;
|
811
|
-
}
|
812
|
-
else
|
813
|
-
# endif /* _LIBC */
|
814
|
-
return 1;
|
815
|
-
}
|
816
|
-
# endif
|
817
|
-
#endif /* RE_ENABLE_I18N */
|
818
|
-
|
819
|
-
#endif /* _REGEX_INTERNAL_H */
|