From 5f1254882f242514d4ceaf1ecebb140dcc2a511d Mon Sep 17 00:00:00 2001 From: Apple Date: Fri, 4 Sep 2015 17:19:25 +0000 Subject: [PATCH] Libc-1081.1.3.tar.gz --- Libc.xcodeproj/project.pbxproj | 192 +- Platforms/appletvos/Makefile.inc | 56 + Platforms/iphoneos/Makefile.inc | 3 + Platforms/macosx/Makefile.inc | 3 + Platforms/watchos/Makefile.inc | 56 + darwin/libc_private.h | 8 + gen/FreeBSD/daemon.3 | 20 + gen/FreeBSD/sysconf.c | 88 +- gen/NetBSD/rb.c | 4 +- gen/backtrace.c | 4 +- gen/strtofflags.c | 2 + include/NetBSD/utmpx.h | 4 +- include/assert.h | 11 + include/fts.h | 8 +- include/monitor.h | 15 + include/signal.h | 6 +- include/stdbool.h | 46 - include/stddef.h | 5 + include/stdlib.h | 9 +- include/unistd.h | 41 +- man/manpages.lst | 1 - os/assumes.c | 30 +- os/assumes.h | 50 +- regex/TRE/lib/regexec.c | 27 +- regex/TRE/lib/tre-compile.c | 6 +- regex/TRE/lib/tre-mem.c | 4 +- regex/TRE/lib/tre-parse.c | 2 +- stdio/FreeBSD/fflush.c | 10 +- stdio/FreeBSD/fopen.3 | 12 +- stdio/FreeBSD/printf.3 | 207 +- stdlib/FreeBSD/abort.c | 2 +- stdlib/FreeBSD/atof.3 | 10 +- stdlib/FreeBSD/atoi.3 | 10 +- stdlib/FreeBSD/system.c | 7 + string/FreeBSD/strcpy.3 | 61 +- string/FreeBSD/strstr.3 | 52 +- sys/sigaction.c | 16 +- tests/Libc.plist | 28 + tests/install.sh | 104 + tests/libctest.xcconfig | 18 + tests/libctest.xcodeproj/project.pbxproj | 582 ++++ tests/nxheap.c | 53 + tests/psort.c | 73 + tests/regex/README | 86 + tests/regex/datafiles/11991275.dat | 2 + tests/regex/datafiles/12221092.dat | 2 + tests/regex/datafiles/14189743.dat | 9 + tests/regex/datafiles/2692334.dat | 3 + tests/regex/datafiles/3734286.dat | 4 + tests/regex/datafiles/3835390.dat | 3 + tests/regex/datafiles/3936073.dat | 4 + tests/regex/datafiles/5518392.dat | 12 + tests/regex/datafiles/5549951.dat | 3 + tests/regex/datafiles/6440240.dat | 3 + tests/regex/datafiles/6481680.dat | 2 + tests/regex/datafiles/6487297.dat | 3 + tests/regex/datafiles/6487583.dat | 4 + tests/regex/datafiles/ISO8859-1.dat | 9 + tests/regex/datafiles/OpenBSD-enhanced.dat | 3 + tests/regex/datafiles/OpenBSD.dat | 74 + tests/regex/datafiles/UTF-8.dat | 16 + tests/regex/datafiles/basic.dat | 216 ++ tests/regex/datafiles/bracket.dat | 2351 +++++++++++++++++ tests/regex/datafiles/categorize.dat | 62 + tests/regex/datafiles/characterclass.dat | 2 + tests/regex/datafiles/conformance-vsc-ed.dat | 17 + .../datafiles/conformance-vsx-regcomp.dat | 130 + .../regex/datafiles/conformance-vsx-regex.dat | 1231 +++++++++ tests/regex/datafiles/empty.dat | 7 + tests/regex/datafiles/eucJP.dat | 9 + tests/regex/datafiles/forcedassoc.dat | 30 + tests/regex/datafiles/greediness-enhanced.dat | 83 + tests/regex/datafiles/greediness.dat | 57 + .../datafiles/implementation_choices.dat | 28 + tests/regex/datafiles/interpretation.dat | 93 + tests/regex/datafiles/iteration.dat | 5 + tests/regex/datafiles/misc-enhanced.dat | 1 + tests/regex/datafiles/misc.dat | 20 + .../datafiles/need-parenthesis-enhanced.dat | 3 + tests/regex/datafiles/need-parenthesis.dat | 11 + tests/regex/datafiles/nullsubexpr.dat | 73 + .../datafiles/regex-posix-unittest-1.1.dat | 79 + tests/regex/datafiles/repetition.dat | 140 + tests/regex/datafiles/rightassoc.dat | 16 + tests/regex/datafiles/rightbracket.dat | 3 + tests/regex/datafiles/rightparen.dat | 7 + tests/regex/datafiles/tre-bugs.dat | 6 + tests/regex/datafiles/tre-enhanced.dat | 17 + tests/regex/datafiles/tre-tests-enhanced.dat | 544 ++++ .../datafiles/tre-tests-extended-enhanced.dat | 119 + tests/regex/datafiles/tre-tests.dat | 577 ++++ tests/regex/datafiles/union-enhanced.dat | 1 + tests/regex/datafiles/union.dat | 4 + tests/regex/testregex.c | 2329 ++++++++++++++++ tests/regex/testregex.c.orig | 2286 ++++++++++++++++ tests/runtests | 69 + tests/strlcat.c | 56 + tests/test_list.txt | 3 + xcodescripts/abort_unsupported.sh | 11 + xcodescripts/eos.xcconfig | 4 + xcodescripts/generate_features.pl | 6 + xcodescripts/headers.sh | 5 +- xcodescripts/libc.xcconfig | 54 +- xcodescripts/manpages.sh | 2 +- xcodescripts/patch_headers_variants.pl | 5 + xcodescripts/sim-compat-symlink.sh | 9 + xcodescripts/variants.xcconfig | 7 +- 107 files changed, 12593 insertions(+), 383 deletions(-) create mode 100644 Platforms/appletvos/Makefile.inc create mode 100644 Platforms/watchos/Makefile.inc delete mode 100644 include/stdbool.h create mode 100644 tests/Libc.plist create mode 100644 tests/install.sh create mode 100644 tests/libctest.xcconfig create mode 100644 tests/libctest.xcodeproj/project.pbxproj create mode 100644 tests/nxheap.c create mode 100644 tests/psort.c create mode 100644 tests/regex/README create mode 100644 tests/regex/datafiles/11991275.dat create mode 100644 tests/regex/datafiles/12221092.dat create mode 100644 tests/regex/datafiles/14189743.dat create mode 100644 tests/regex/datafiles/2692334.dat create mode 100644 tests/regex/datafiles/3734286.dat create mode 100644 tests/regex/datafiles/3835390.dat create mode 100644 tests/regex/datafiles/3936073.dat create mode 100644 tests/regex/datafiles/5518392.dat create mode 100644 tests/regex/datafiles/5549951.dat create mode 100644 tests/regex/datafiles/6440240.dat create mode 100644 tests/regex/datafiles/6481680.dat create mode 100644 tests/regex/datafiles/6487297.dat create mode 100644 tests/regex/datafiles/6487583.dat create mode 100644 tests/regex/datafiles/ISO8859-1.dat create mode 100644 tests/regex/datafiles/OpenBSD-enhanced.dat create mode 100644 tests/regex/datafiles/OpenBSD.dat create mode 100644 tests/regex/datafiles/UTF-8.dat create mode 100644 tests/regex/datafiles/basic.dat create mode 100644 tests/regex/datafiles/bracket.dat create mode 100644 tests/regex/datafiles/categorize.dat create mode 100644 tests/regex/datafiles/characterclass.dat create mode 100644 tests/regex/datafiles/conformance-vsc-ed.dat create mode 100644 tests/regex/datafiles/conformance-vsx-regcomp.dat create mode 100644 tests/regex/datafiles/conformance-vsx-regex.dat create mode 100644 tests/regex/datafiles/empty.dat create mode 100644 tests/regex/datafiles/eucJP.dat create mode 100644 tests/regex/datafiles/forcedassoc.dat create mode 100644 tests/regex/datafiles/greediness-enhanced.dat create mode 100644 tests/regex/datafiles/greediness.dat create mode 100644 tests/regex/datafiles/implementation_choices.dat create mode 100644 tests/regex/datafiles/interpretation.dat create mode 100644 tests/regex/datafiles/iteration.dat create mode 100644 tests/regex/datafiles/misc-enhanced.dat create mode 100644 tests/regex/datafiles/misc.dat create mode 100644 tests/regex/datafiles/need-parenthesis-enhanced.dat create mode 100644 tests/regex/datafiles/need-parenthesis.dat create mode 100644 tests/regex/datafiles/nullsubexpr.dat create mode 100644 tests/regex/datafiles/regex-posix-unittest-1.1.dat create mode 100644 tests/regex/datafiles/repetition.dat create mode 100644 tests/regex/datafiles/rightassoc.dat create mode 100644 tests/regex/datafiles/rightbracket.dat create mode 100644 tests/regex/datafiles/rightparen.dat create mode 100644 tests/regex/datafiles/tre-bugs.dat create mode 100644 tests/regex/datafiles/tre-enhanced.dat create mode 100644 tests/regex/datafiles/tre-tests-enhanced.dat create mode 100644 tests/regex/datafiles/tre-tests-extended-enhanced.dat create mode 100644 tests/regex/datafiles/tre-tests.dat create mode 100644 tests/regex/datafiles/union-enhanced.dat create mode 100644 tests/regex/datafiles/union.dat create mode 100644 tests/regex/testregex.c create mode 100644 tests/regex/testregex.c.orig create mode 100644 tests/runtests create mode 100644 tests/strlcat.c create mode 100644 tests/test_list.txt create mode 100755 xcodescripts/abort_unsupported.sh create mode 100755 xcodescripts/sim-compat-symlink.sh diff --git a/Libc.xcodeproj/project.pbxproj b/Libc.xcodeproj/project.pbxproj index 8eb23f4..1c963b0 100644 --- a/Libc.xcodeproj/project.pbxproj +++ b/Libc.xcodeproj/project.pbxproj @@ -6,6 +6,20 @@ objectVersion = 46; objects = { +/* Begin PBXAggregateTarget section */ + 925E7FE619E8945900AC7889 /* Libc_tests */ = { + isa = PBXAggregateTarget; + buildConfigurationList = 925E7FF919E8945A00AC7889 /* Build configuration list for PBXAggregateTarget "Libc_tests" */; + buildPhases = ( + ); + dependencies = ( + 925E7FFB19E8946700AC7889 /* PBXTargetDependency */, + ); + name = Libc_tests; + productName = Libc_tests; + }; +/* End PBXAggregateTarget section */ + /* Begin PBXBuildFile section */ 2DF67CDE184F9CBE00B83A3D /* debug_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DF67CDD184F9CBE00B83A3D /* debug_private.c */; }; 2DF67CDF184F9CBE00B83A3D /* debug_private.c in Sources */ = {isa = PBXBuildFile; fileRef = 2DF67CDD184F9CBE00B83A3D /* debug_private.c */; }; @@ -2759,7 +2773,7 @@ C9765F57138EC61900741512 /* sysctlbyname.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53794138D9E990028D27C /* sysctlbyname.c */; }; C9765F58138EC61900741512 /* sysctlnametomib.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53795138D9E990028D27C /* sysctlnametomib.c */; }; C9765F59138EC61900741512 /* telldir.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B53796138D9E990028D27C /* telldir.c */; }; - C9765F5A138EC61900741512 /* termios.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379A138D9E990028D27C /* termios.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TCDRAIN"; }; }; + C9765F5A138EC61900741512 /* termios.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379A138D9E990028D27C /* termios.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_TCDRAIN -U__DARWIN_NON_CANCELABLE -D__DARWIN_NON_CANCELABLE=0"; }; }; C9765F5B138EC61900741512 /* time.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B5379E138D9E990028D27C /* time.c */; }; C9765F5C138EC61900741512 /* times.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A2138D9E990028D27C /* times.c */; }; C9765F5D138EC61900741512 /* timezone.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537A4138D9E990028D27C /* timezone.c */; }; @@ -2771,9 +2785,9 @@ C9765F63138EC61900741512 /* usleep.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537B6138D9E990028D27C /* usleep.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_USLEEP -U__DARWIN_NON_CANCELABLE -D__DARWIN_NON_CANCELABLE=0"; }; }; C9765F64138EC61900741512 /* utime.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BA138D9E990028D27C /* utime.c */; }; C9765F65138EC61900741512 /* vis.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BC138D9E990028D27C /* vis.c */; }; - C9765F66138EC61900741512 /* wait.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BE138D9E990028D27C /* wait.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAIT"; }; }; + C9765F66138EC61900741512 /* wait.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537BE138D9E990028D27C /* wait.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAIT -U__DARWIN_NON_CANCELABLE -D__DARWIN_NON_CANCELABLE=0"; }; }; C9765F67138EC61900741512 /* wait3.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C0138D9E990028D27C /* wait3.c */; }; - C9765F68138EC61900741512 /* waitpid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C1138D9E990028D27C /* waitpid.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAITPID"; }; }; + C9765F68138EC61900741512 /* waitpid.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C1138D9E990028D27C /* waitpid.c */; settings = {COMPILER_FLAGS = "$(FreeBSD_CFLAGS) -DLIBC_ALIAS_WAITPID -U__DARWIN_NON_CANCELABLE -D__DARWIN_NON_CANCELABLE=0"; }; }; C9765F69138EC61900741512 /* fts.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C4138D9E990028D27C /* fts.c */; }; C9765F6A138EC61900741512 /* get_compat.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537C6138D9E990028D27C /* get_compat.c */; }; C9765F6B138EC61900741512 /* getloadavg.c in Sources */ = {isa = PBXBuildFile; fileRef = C9B537CA138D9E990028D27C /* getloadavg.c */; }; @@ -4954,6 +4968,34 @@ remoteGlobalIDString = 3F51206A16C3174300AFB431; remoteInfo = FortifySource; }; + 925E7FFA19E8946700AC7889 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9268CA8919E4D1350058F6A6 /* libctest.xcodeproj */; + proxyType = 1; + remoteGlobalIDString = E4D01DC5108E708E00FAA873; + remoteInfo = all; + }; + 9268CAB219E4D1360058F6A6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9268CA8919E4D1350058F6A6 /* libctest.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = FC2897C8127FCD4500B86C0C; + remoteInfo = nxheap; + }; + 9268CAB419E4D1360058F6A6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9268CA8919E4D1350058F6A6 /* libctest.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = C99475AF15924ADA009FC2A7; + remoteInfo = strlcat; + }; + 9268CAB819E4D1360058F6A6 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 9268CA8919E4D1350058F6A6 /* libctest.xcodeproj */; + proxyType = 2; + remoteGlobalIDString = E423CC22199C5AC200A527F4; + remoteInfo = psort; + }; B122F2D81432BA8700AF95D0 /* PBXContainerItemProxy */ = { isa = PBXContainerItemProxy; containerPortal = C9B53597138D9A690028D27C /* Project object */; @@ -5092,6 +5134,7 @@ 3F267F36163FC8880089A0A6 /* rb.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rb.c; sourceTree = ""; }; 3F267F37163FC8880089A0A6 /* rbtree.3 */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = rbtree.3; sourceTree = ""; }; 3F267F39163FC8BD0089A0A6 /* rbtree.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = rbtree.h; sourceTree = ""; }; + 3F45E3121A6DC12E00AFF01E /* abort_unsupported.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = abort_unsupported.sh; sourceTree = ""; }; 3F5120F116C3174300AFB431 /* libFortifySource.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libFortifySource.a; sourceTree = BUILT_PRODUCTS_DIR; }; 3F89F3DC13E9194C00F6856C /* mkpath_np.3 */ = {isa = PBXFileReference; lastKnownFileType = text; path = mkpath_np.3; sourceTree = ""; }; 3F89F3DD13E9194C00F6856C /* mkpath_np.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = mkpath_np.c; sourceTree = ""; }; @@ -5099,6 +5142,7 @@ 3FA8F3091643AB4300D37078 /* strlcpy_chk.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = strlcpy_chk.c; sourceTree = ""; }; 3FB7E1B4146EF2E000843438 /* dirfd.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dirfd.c; sourceTree = ""; }; 3FD14572171D42B300B7BAF5 /* bcopy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = bcopy.c; sourceTree = ""; }; + 3FF283231A4764240098AD2C /* sim-compat-symlink.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = "sim-compat-symlink.sh"; sourceTree = ""; }; 4B2C64A215519BAF00342BFA /* assumes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; name = assumes.c; path = os/assumes.c; sourceTree = ""; }; 4B2C64AB15519C3400342BFA /* assumes.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = assumes.h; path = os/assumes.h; sourceTree = ""; }; 6310518613D4D966004F7BA8 /* strcpy.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strcpy.c; sourceTree = ""; }; @@ -5111,6 +5155,7 @@ 63D4060C13DDF26A0094DD56 /* strcat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strcat.c; sourceTree = ""; }; 63D4060F13DDF4340094DD56 /* strncat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strncat.c; sourceTree = ""; }; 63D4061213DDF6A20094DD56 /* strlcat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strlcat.c; sourceTree = ""; }; + 9268CA8919E4D1350058F6A6 /* libctest.xcodeproj */ = {isa = PBXFileReference; lastKnownFileType = "wrapper.pb-project"; name = libctest.xcodeproj; path = tests/libctest.xcodeproj; sourceTree = ""; }; B122F2AD1432B8E600AF95D0 /* libTRE.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libTRE.a; sourceTree = BUILT_PRODUCTS_DIR; }; B122F2AF1432B95B00AF95D0 /* config.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = config.h; sourceTree = ""; }; B122F2B11432B95B00AF95D0 /* regcomp.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = regcomp.c; sourceTree = ""; }; @@ -5177,6 +5222,7 @@ C976616B138EF14100741512 /* generate_features.pl */ = {isa = PBXFileReference; lastKnownFileType = text.script.perl; path = generate_features.pl; sourceTree = ""; }; C97A721C1517AF53005E1998 /* libc_eOS.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libc_eOS.a; sourceTree = BUILT_PRODUCTS_DIR; }; C9950E6A1390D2CA009863B6 /* headers.sh */ = {isa = PBXFileReference; lastKnownFileType = text.script.sh; path = headers.sh; sourceTree = ""; }; + C9A288A71ACDBA95004A33A7 /* Makefile.inc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.pascal; path = Makefile.inc; sourceTree = ""; }; C9AE91AE1517CDAC00A2626C /* eos.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = eos.xcconfig; sourceTree = ""; }; C9B535AE138D9E980028D27C /* APPLE_LICENSE */ = {isa = PBXFileReference; lastKnownFileType = text; path = APPLE_LICENSE; sourceTree = ""; }; C9B535B6138D9E980028D27C /* init_cpu_capabilities.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = init_cpu_capabilities.c; sourceTree = ""; }; @@ -5573,7 +5619,6 @@ C9B538B0138D9E990028D27C /* signal.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = signal.h; sourceTree = ""; }; C9B538B3138D9E990028D27C /* stab.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stab.h; sourceTree = ""; }; C9B538B4138D9E990028D27C /* standards.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = standards.h; sourceTree = ""; }; - C9B538B5138D9E990028D27C /* stdbool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdbool.h; sourceTree = ""; }; C9B538B6138D9E990028D27C /* stddef.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stddef.h; sourceTree = ""; }; C9B538B7138D9E990028D27C /* stdint.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdint.h; sourceTree = ""; }; C9B538B8138D9E990028D27C /* stdio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = stdio.h; sourceTree = ""; }; @@ -6283,6 +6328,7 @@ C9EB354F138F7EA50075BB52 /* getmntinfo64.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = getmntinfo64.c; sourceTree = ""; }; C9ECE2761950E384008E8672 /* atexit_receipt.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = atexit_receipt.c; sourceTree = ""; }; C9FA32F8138E4A5C0089A94B /* utf2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = utf2.c; sourceTree = ""; }; + C9FACC591ACDBA54009F33F1 /* Makefile.inc */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.pascal; name = Makefile.inc; path = Platforms/appletvos/Makefile.inc; sourceTree = SOURCE_ROOT; }; E41BEA97178E72E100E348BB /* Libc.order */ = {isa = PBXFileReference; lastKnownFileType = text; path = Libc.order; sourceTree = ""; }; E4A877A6174D82FB000DBB55 /* alias.list */ = {isa = PBXFileReference; lastKnownFileType = text; path = alias.list; sourceTree = ""; }; FC2ED60E157D4BE70098EC69 /* inet_ntop.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = inet_ntop.c; sourceTree = ""; }; @@ -6434,6 +6480,16 @@ name = os; sourceTree = ""; }; + 9268CA8A19E4D1350058F6A6 /* Products */ = { + isa = PBXGroup; + children = ( + 9268CAB319E4D1360058F6A6 /* nxheap */, + 9268CAB519E4D1360058F6A6 /* strlcat */, + 9268CAB919E4D1360058F6A6 /* psort */, + ); + name = Products; + sourceTree = ""; + }; B122F2AE1432B95B00AF95D0 /* TRE */ = { isa = PBXGroup; children = ( @@ -6471,6 +6527,24 @@ path = lib; sourceTree = ""; }; + C975E22B1A12ECA00093B345 /* appletv */ = { + isa = PBXGroup; + children = ( + C9FACC591ACDBA54009F33F1 /* Makefile.inc */, + ); + name = appletv; + path = watchos; + sourceTree = ""; + }; + C9A288A61ACDBA95004A33A7 /* watchos */ = { + isa = PBXGroup; + children = ( + C9A288A71ACDBA95004A33A7 /* Makefile.inc */, + ); + name = watchos; + path = Platforms/watchos; + sourceTree = SOURCE_ROOT; + }; C9B53595138D9A690028D27C = { isa = PBXGroup; children = ( @@ -6506,6 +6580,7 @@ C9B53DD3138D9E9A0028D27C /* uuid */, C9B53DEF138D9E9A0028D27C /* x86_64 */, C9C2A946138DF66900287F00 /* xcodescripts */, + 9268CA8919E4D1350058F6A6 /* libctest.xcodeproj */, C9B535A9138D9E890028D27C /* Products */, C965CBF1143BBEC7003912CE /* deps.c */, ); @@ -7200,7 +7275,6 @@ C9B538B0138D9E990028D27C /* signal.h */, C9B538B3138D9E990028D27C /* stab.h */, C9B538B4138D9E990028D27C /* standards.h */, - C9B538B5138D9E990028D27C /* stdbool.h */, C9B538B6138D9E990028D27C /* stddef.h */, C9B538B7138D9E990028D27C /* stdint.h */, C9B538B8138D9E990028D27C /* stdio.h */, @@ -7575,8 +7649,10 @@ C9B53A45138D9E990028D27C /* Platforms */ = { isa = PBXGroup; children = ( + C975E22B1A12ECA00093B345 /* appletv */, C9B53A46138D9E990028D27C /* iphoneos */, C9B53A48138D9E990028D27C /* macosx */, + C9A288A61ACDBA95004A33A7 /* watchos */, ); path = Platforms; sourceTree = ""; @@ -8275,6 +8351,7 @@ C9766153138ECF0000741512 /* variants.xcconfig */, C9AE91AE1517CDAC00A2626C /* eos.xcconfig */, E41BEA97178E72E100E348BB /* Libc.order */, + 3F45E3121A6DC12E00AFF01E /* abort_unsupported.sh */, C9194B4C140E3BC700BE0C3A /* build_linklists.sh */, C9766150138EC9D400741512 /* patch_headers_variants.pl */, C976616B138EF14100741512 /* generate_features.pl */, @@ -8283,6 +8360,7 @@ C9B53D92138D9E9A0028D27C /* strip-header.ed */, C965CBF4143BC1BF003912CE /* force_libc_to_build.sh */, C93D6150143D31E300EB9023 /* sanitise_headers.sh */, + 3FF283231A4764240098AD2C /* sim-compat-symlink.sh */, ); path = xcodescripts; sourceTree = ""; @@ -8508,6 +8586,7 @@ isa = PBXNativeTarget; buildConfigurationList = C9D94330138DB73300FB7ACC /* Build configuration list for PBXNativeTarget "libsystem_c.dylib" */; buildPhases = ( + 3F45E3181A6DC13C00AFF01E /* Enforce SUPPORTED_PLATFORMS */, C9950E6B1390D2DC009863B6 /* Install Headers */, C9194B4B140E3A7100BE0C3A /* Build Link Lists */, C9D9432B138DB73300FB7ACC /* Sources */, @@ -8515,6 +8594,7 @@ C942135B13905EB9004BA536 /* Install Manpages */, C965CBF3143BBFF7003912CE /* Remove deps.c */, C93D6152143D321000EB9023 /* Sanitise Headers (rdar://problem/10241868) */, + 3FF283291A4764370098AD2C /* Simulator Build Compat Symlink */, ); buildRules = ( ); @@ -8599,7 +8679,12 @@ C9B53597138D9A690028D27C /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0460; + LastUpgradeCheck = 0700; + TargetAttributes = { + 925E7FE619E8945900AC7889 = { + CreatedOnToolsVersion = 6.1; + }; + }; }; buildConfigurationList = C9B5359A138D9A690028D27C /* Build configuration list for PBXProject "Libc" */; compatibilityVersion = "Xcode 3.2"; @@ -8611,6 +8696,12 @@ mainGroup = C9B53595138D9A690028D27C; productRefGroup = C9B535A9138D9E890028D27C /* Products */; projectDirPath = ""; + projectReferences = ( + { + ProductGroup = 9268CA8A19E4D1350058F6A6 /* Products */; + ProjectRef = 9268CA8919E4D1350058F6A6 /* libctest.xcodeproj */; + }, + ); projectRoot = ""; targets = ( C9D9432E138DB73300FB7ACC /* libsystem_c.dylib */, @@ -8628,11 +8719,51 @@ C9EB2FC9138F6D880075BB52 /* Variant_Legacy */, C9EB326F138F75580075BB52 /* Variant_Inode32 */, 3F51206A16C3174300AFB431 /* FortifySource */, + 925E7FE619E8945900AC7889 /* Libc_tests */, ); }; /* End PBXProject section */ +/* Begin PBXReferenceProxy section */ + 9268CAB319E4D1360058F6A6 /* nxheap */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = nxheap; + remoteRef = 9268CAB219E4D1360058F6A6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 9268CAB519E4D1360058F6A6 /* strlcat */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = strlcat; + remoteRef = 9268CAB419E4D1360058F6A6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; + 9268CAB919E4D1360058F6A6 /* psort */ = { + isa = PBXReferenceProxy; + fileType = "compiled.mach-o.executable"; + path = psort; + remoteRef = 9268CAB819E4D1360058F6A6 /* PBXContainerItemProxy */; + sourceTree = BUILT_PRODUCTS_DIR; + }; +/* End PBXReferenceProxy section */ + /* Begin PBXShellScriptBuildPhase section */ + 3F45E3181A6DC13C00AFF01E /* Enforce SUPPORTED_PLATFORMS */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/xcodescripts/abort_unsupported.sh", + ); + name = "Enforce SUPPORTED_PLATFORMS"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = "/bin/bash -e -x"; + shellScript = ". \"${SCRIPT_INPUT_FILE_0}\"\n"; + }; 3F51206B16C3174300AFB431 /* Generate libc-features.h */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -8648,6 +8779,21 @@ shellScript = "perl $SRCROOT/xcodescripts/generate_features.pl"; showEnvVarsInLog = 0; }; + 3FF283291A4764370098AD2C /* Simulator Build Compat Symlink */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 8; + files = ( + ); + inputPaths = ( + "$(SRCROOT)/xcodescripts/sim-compat-symlink.sh", + ); + name = "Simulator Build Compat Symlink"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 1; + shellPath = /bin/bash; + shellScript = ". \"${SCRIPT_INPUT_FILE_0}\""; + }; B122F0E81432B8E600AF95D0 /* Generate libc-features.h */ = { isa = PBXShellScriptBuildPhase; buildActionMask = 2147483647; @@ -14105,6 +14251,11 @@ target = 3F51206A16C3174300AFB431 /* FortifySource */; targetProxy = 3F51211616C318EB00AFB431 /* PBXContainerItemProxy */; }; + 925E7FFB19E8946700AC7889 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = all; + targetProxy = 925E7FFA19E8946700AC7889 /* PBXContainerItemProxy */; + }; B122F2D91432BA8700AF95D0 /* PBXTargetDependency */ = { isa = PBXTargetDependency; target = B122F0E71432B8E600AF95D0 /* TRE */; @@ -14220,6 +14371,20 @@ }; name = Release; }; + 925E7FE719E8945A00AC7889 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + 925E7FE819E8945A00AC7889 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; B122F2AB1432B8E600AF95D0 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { @@ -14324,8 +14489,7 @@ EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)"; EXECUTABLE_PREFIX = lib; INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)"; - "INSTALL_PATH[sdk=macos*]" = "$(INSTALL_PATH_ACTUAL)"; - INSTALL_PATH_ACTUAL = /usr/local/lib/dyld; + INSTALL_PATH = /usr/local/lib/dyld; PRODUCT_NAME = c; SKIP_INSTALL = NO; STRIP_INSTALLED_PRODUCT = NO; @@ -14342,8 +14506,7 @@ EXCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_EXCLUDED_SOURCE_FILE_NAMES)"; EXECUTABLE_PREFIX = lib; INCLUDED_SOURCE_FILE_NAMES = "$(VARIANT_INCLUDED_SOURCE_FILE_NAMES)"; - "INSTALL_PATH[sdk=macos*]" = "$(INSTALL_PATH_ACTUAL)"; - INSTALL_PATH_ACTUAL = /usr/local/lib/dyld; + INSTALL_PATH = /usr/local/lib/dyld; PRODUCT_NAME = c; SKIP_INSTALL = NO; STRIP_INSTALLED_PRODUCT = NO; @@ -14630,6 +14793,15 @@ defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; + 925E7FF919E8945A00AC7889 /* Build configuration list for PBXAggregateTarget "Libc_tests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 925E7FE719E8945A00AC7889 /* Debug */, + 925E7FE819E8945A00AC7889 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; B122F2AA1432B8E600AF95D0 /* Build configuration list for PBXNativeTarget "TRE" */ = { isa = XCConfigurationList; buildConfigurations = ( diff --git a/Platforms/appletvos/Makefile.inc b/Platforms/appletvos/Makefile.inc new file mode 100644 index 0000000..7b485b2 --- /dev/null +++ b/Platforms/appletvos/Makefile.inc @@ -0,0 +1,56 @@ +# +# Selectable features for AppleTV +# + +# Legacy *64 APIs +#FEATURE_LEGACY_64_APIS = 1 + +# Legacy crt1.o environ support +#FEATURE_LEGACY_CRT1_ENVIRON = 1 + +# Legacy rune APIs +#FEATURE_LEGACY_RUNE_APIS = 1 + +# Legacy utmp APIs +#FEATURE_LEGACY_UTMP_APIS = 1 + +# OSThermalNotification APIs +FEATURE_THERM_NOTIFICATION_APIS = 1 + +# Move localtime to /var/db/timezone +FEATURE_MOVE_LOCALTIME = 1 + +# Use TZDIR symlink in /var/db +FEATURE_TZDIR_SYMLINK = 1 + +.if RC_ProjectName _Sim$ +FEATURE_MOVE_LOCALTIME = 0 +FEATURE_TZDIR_SYMLINK = 0 +.endif + +# No pre-1050 variants (should match sys/cdefs.h) +FEATURE_ONLY_1050_VARIANTS = 1 + +# No legacy variants (should match sys/cdefs.h) +FEATURE_ONLY_UNIX_CONFORMANCE = 1 + +# Only 64-bit ino_t (should match sys/cdefs.h) +FEATURE_ONLY_64_BIT_INO_T = 1 + +# Patch 3333969 +#FEATURE_PATCH_3333969 = 1 + +# Patch 3417676 +#FEATURE_PATCH_3417676 = 1 + +# plockstat dtrace support +#FEATURE_PLOCKSTAT = 1 + +# Timezone change notification +FEATURE_TIMEZONE_CHANGE_NOTIFICATION = 1 + +# Smaller stdio buffers +FEATURE_SMALL_STDIOBUF = 1 + +# Disable registration of specific signals () +FEATURE_SIGNAL_RESTRICTION = 1 diff --git a/Platforms/iphoneos/Makefile.inc b/Platforms/iphoneos/Makefile.inc index aaa1c87..df32671 100644 --- a/Platforms/iphoneos/Makefile.inc +++ b/Platforms/iphoneos/Makefile.inc @@ -51,3 +51,6 @@ FEATURE_TIMEZONE_CHANGE_NOTIFICATION = 1 # Smaller stdio buffers FEATURE_SMALL_STDIOBUF = 1 + +# Disable registration of specific signals () +# FEATURE_SIGNAL_RESTRICTION = 0 diff --git a/Platforms/macosx/Makefile.inc b/Platforms/macosx/Makefile.inc index c51ed0a..f48843d 100644 --- a/Platforms/macosx/Makefile.inc +++ b/Platforms/macosx/Makefile.inc @@ -48,3 +48,6 @@ FEATURE_TIMEZONE_CHANGE_NOTIFICATION = 1 # Extensible printf performance enhancement (uses more memory) FEATURE_XPRINTF_PERF = 1 + +# Disable registration of specific signals () +# FEATURE_SIGNAL_RESTRICTION = 0 diff --git a/Platforms/watchos/Makefile.inc b/Platforms/watchos/Makefile.inc new file mode 100644 index 0000000..2253e33 --- /dev/null +++ b/Platforms/watchos/Makefile.inc @@ -0,0 +1,56 @@ +# +# Selectable features for Apple Watch +# + +# Legacy *64 APIs +#FEATURE_LEGACY_64_APIS = 1 + +# Legacy crt1.o environ support +#FEATURE_LEGACY_CRT1_ENVIRON = 1 + +# Legacy rune APIs +#FEATURE_LEGACY_RUNE_APIS = 1 + +# Legacy utmp APIs +#FEATURE_LEGACY_UTMP_APIS = 1 + +# OSThermalNotification APIs +FEATURE_THERM_NOTIFICATION_APIS = 1 + +# Move localtime to /var/db/timezone +FEATURE_MOVE_LOCALTIME = 1 + +# Use TZDIR symlink in /var/db +FEATURE_TZDIR_SYMLINK = 1 + +.if RC_ProjectName _Sim$ +FEATURE_MOVE_LOCALTIME = 0 +FEATURE_TZDIR_SYMLINK = 0 +.endif + +# No pre-1050 variants (should match sys/cdefs.h) +FEATURE_ONLY_1050_VARIANTS = 1 + +# No legacy variants (should match sys/cdefs.h) +FEATURE_ONLY_UNIX_CONFORMANCE = 1 + +# Only 64-bit ino_t (should match sys/cdefs.h) +FEATURE_ONLY_64_BIT_INO_T = 1 + +# Patch 3333969 +#FEATURE_PATCH_3333969 = 1 + +# Patch 3417676 +#FEATURE_PATCH_3417676 = 1 + +# plockstat dtrace support +#FEATURE_PLOCKSTAT = 1 + +# Timezone change notification +FEATURE_TIMEZONE_CHANGE_NOTIFICATION = 1 + +# Smaller stdio buffers +FEATURE_SMALL_STDIOBUF = 1 + +# Disable registration of specific signals () +FEATURE_SIGNAL_RESTRICTION = 1 diff --git a/darwin/libc_private.h b/darwin/libc_private.h index baae033..3dc00ae 100644 --- a/darwin/libc_private.h +++ b/darwin/libc_private.h @@ -28,6 +28,8 @@ #include #include +__BEGIN_DECLS + struct _libc_functions { unsigned long version; void (*atfork_prepare)(void); // version 1 @@ -59,4 +61,10 @@ _libc_fork_child(void); extern int _atexit_receipt(void); +__IOS_AVAILABLE(9.0) __OSX_AVAILABLE(10.11) +extern void +abort_report_np(const char *, ...) __dead2 __printflike(1, 2); + +__END_DECLS + #endif // __LIBC_PRIVATE_H__ diff --git a/gen/FreeBSD/daemon.3 b/gen/FreeBSD/daemon.3 index a2d9f2b..0df7cd1 100644 --- a/gen/FreeBSD/daemon.3 +++ b/gen/FreeBSD/daemon.3 @@ -45,6 +45,11 @@ The .Fn daemon function is for programs wishing to detach themselves from the controlling terminal and run in the background as system daemons. +The +.Xr fork 2 +system call is used; see CAVEATS below about the environment after a +.Fn fork +(without a corresponding call to one of the exec routines). On Mac OS X, the use of this API is discouraged in favor of using .Xr launchd 8 . .Pp @@ -74,6 +79,7 @@ and .Xr setsid 2 . .Sh SEE ALSO .Xr fork 2 , +.Xr launchd 8 , .Xr setsid 2 , .Xr sigaction 2 .Sh HISTORY @@ -82,6 +88,20 @@ The function first appeared in .Bx 4.4 . .Sh CAVEATS +There are limits to what you can do in the child process. +To be totally safe you should restrict yourself to only +executing async-signal safe operations (see +.Xr sigaction 2 ) +until such time +as one of the exec functions is called. +All APIs, including global data symbols, in any framework or library +should be assumed to be unsafe after a +.Fn fork +unless explicitly documented to be safe or async-signal safe. +If you need to use these frameworks in the child +process, you must exec. +In this situation it is reasonable to exec yourself. +.Pp Unless the .Fa noclose argument is non-zero, diff --git a/gen/FreeBSD/sysconf.c b/gen/FreeBSD/sysconf.c index 2b9dc6c..ca90c7a 100644 --- a/gen/FreeBSD/sysconf.c +++ b/gen/FreeBSD/sysconf.c @@ -13,10 +13,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. @@ -38,7 +34,7 @@ static char sccsid[] = "@(#)sysconf.c 8.2 (Berkeley) 3/20/94"; #endif /* LIBC_SCCS and not lint */ #include -__FBSDID("$FreeBSD: src/lib/libc/gen/sysconf.c,v 1.20 2002/11/17 08:54:29 dougb Exp $"); +__FBSDID("$FreeBSD: lib/libc/gen/sysconf.c r168718 $"); #include #include @@ -80,10 +76,9 @@ sysconf(name) quad_t qdvalue; /* for kern.sysv.shmmin */ size_t len; int mib[3], sverrno, value; - long defaultresult; + long lvalue, defaultresult; const char *path; - len = sizeof(value); defaultresult = -1; switch (name) { @@ -173,11 +168,11 @@ sysconf(name) do_NAME_MAX: sverrno = errno; errno = 0; - value = pathconf(path, _PC_NAME_MAX); - if (value == -1 && errno != 0) + lvalue = pathconf(path, _PC_NAME_MAX); + if (lvalue == -1 && errno != 0) return (-1); errno = sverrno; - return (value); + return (lvalue); case _SC_ASYNCHRONOUS_IO: #if _POSIX_ASYNCHRONOUS_IO == 0 @@ -257,11 +252,23 @@ do_NAME_MAX: return (_POSIX_TIMERS); #endif case _SC_AIO_LISTIO_MAX: +#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_AIO_LISTIO_MAX) + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_AIO_LISTIO_MAX; +#else + mib[0] = CTL_KERN;; + mib[1] = KERN_AIOMAX; +#endif + break; case _SC_AIO_MAX: +#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_AIO_MAX) + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_AIO_MAX; +#else mib[0] = CTL_KERN;; mib[1] = KERN_AIOMAX; +#endif break; - case _SC_AIO_PRIO_DELTA_MAX: #if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_AIO_PRIO_DELTA_MAX) mib[0] = CTL_P1003_1B; @@ -304,7 +311,14 @@ do_NAME_MAX: return (-1); #endif case _SC_SEM_NSEMS_MAX: +#if defined(CTL_P1003_1B) && defined(CTL_P1003_1B_RTSIG_MAX) + mib[0] = CTL_P1003_1B; + mib[1] = CTL_P1003_1B_SEM_NSEMS_MAX; + goto yesno; +#else + len = sizeof(value); return (sysctlbyname("kern.sysv.semmns", &value, &len, NULL, 0) == -1 ? -1 : value); +#endif case _SC_SEM_VALUE_MAX: #if SEM_VALUE_MAX == 0 @@ -330,18 +344,34 @@ do_NAME_MAX: return (-1); #endif -yesno: if (sysctl(mib, 2, &value, &len, NULL, 0) == -1) +yesno: + len = sizeof(value); + if (sysctl(mib, 2, &value, &len, NULL, 0) == -1) return (-1); if (value == 0) return (defaultresult); - return (value); + return ((long)value); + case _SC_2_PBS: case _SC_2_PBS_ACCOUNTING: case _SC_2_PBS_CHECKPOINT: case _SC_2_PBS_LOCATE: case _SC_2_PBS_MESSAGE: case _SC_2_PBS_TRACK: - return -1; +#if _POSIX2_PBS == 0 +#error "don't know how to determine _SC_2_PBS" + /* + * This probably requires digging through the filesystem + * to see if the appropriate package has been installed. + * Since we don't currently support this option at all, + * it's not worth the effort to write the code now. + * Figuring out which of the sub-options are supported + * would be even more difficult, so it's probably easier + * to always say ``no''. + */ +#else + return (_POSIX2_PBS); +#endif case _SC_ADVISORY_INFO: #if _POSIX_ADVISORY_INFO == 0 #error "_POSIX_ADVISORY_INFO" @@ -619,9 +649,37 @@ yesno: if (sysctl(mib, 2, &value, &len, NULL, 0) == -1) case _SC_PASS_MAX: return (PASS_MAX); +#ifdef _SC_PHYS_PAGES + case _SC_PHYS_PAGES: +#ifdef __APPLE__ + { + long memsize; + long pagesize; + + len = sizeof(memsize); + if (sysctlbyname("hw.memsize", &memsize, &len, NULL, 0) == -1) + return (-1); + + len = sizeof(pagesize); + if (sysctlbyname("hw.pagesize", &pagesize, &len, NULL, 0) == -1) + return (-1); + + return (memsize / pagesize); + } +#else + len = sizeof(lvalue); + if (sysctlbyname("hw.availpages", &lvalue, &len, NULL, 0) == -1) + return (-1); + return (lvalue); +#endif +#endif + default: errno = EINVAL; return (-1); } - return (sysctl(mib, 2, &value, &len, NULL, 0) == -1 ? -1 : value); + len = sizeof(value); + if (sysctl(mib, 2, &value, &len, NULL, 0) == -1) + value = -1; + return ((long)value); } diff --git a/gen/NetBSD/rb.c b/gen/NetBSD/rb.c index 5fc6f56..5fa261a 100644 --- a/gen/NetBSD/rb.c +++ b/gen/NetBSD/rb.c @@ -241,7 +241,7 @@ rb_tree_find_node_geq(struct rb_tree *rbt, const void *key) parent = parent->rb_nodes[diff < 0]; } - return RB_NODETOITEM(rbto, last); + return last == NULL ? NULL : RB_NODETOITEM(rbto, last); } void * @@ -262,7 +262,7 @@ rb_tree_find_node_leq(struct rb_tree *rbt, const void *key) parent = parent->rb_nodes[diff < 0]; } - return RB_NODETOITEM(rbto, last); + return last == NULL ? NULL : RB_NODETOITEM(rbto, last); } void * diff --git a/gen/backtrace.c b/gen/backtrace.c index 4cac3c4..925dcb4 100644 --- a/gen/backtrace.c +++ b/gen/backtrace.c @@ -110,9 +110,9 @@ char** backtrace_symbols(void* const* buffer, int size) { if (info[i].dli_sname) { total_bytes += strlen(info[i].dli_sname); } else if(info[i].dli_fname) { - const char *tmp = strrchr(info->dli_fname, '/'); + const char *tmp = strrchr(info[i].dli_fname, '/'); if(tmp == NULL) - total_bytes += strlen(info->dli_fname); + total_bytes += strlen(info[i].dli_fname); else total_bytes += strlen(tmp + 1); } else { diff --git a/gen/strtofflags.c b/gen/strtofflags.c index b7a04d6..e6b98df 100644 --- a/gen/strtofflags.c +++ b/gen/strtofflags.c @@ -84,6 +84,8 @@ static struct { { "noschange", SF_IMMUTABLE, 0 }, { "nosimmutable", SF_IMMUTABLE, 0 }, { "norestricted", SF_RESTRICTED, 0 }, + { "nosunlnk", SF_NOUNLINK, 0 }, + { "nosunlink", SF_NOUNLINK, 0 }, { "nouappnd", UF_APPEND, 0 }, { "nouappend", UF_APPEND, 0 }, { "nouchg", UF_IMMUTABLE, 0 }, diff --git a/include/NetBSD/utmpx.h b/include/NetBSD/utmpx.h index 39437b5..d14f17c 100644 --- a/include/NetBSD/utmpx.h +++ b/include/NetBSD/utmpx.h @@ -146,8 +146,8 @@ struct lastlogx * getlastlogxbyname(const char*, struct lastlogx *)__OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0); #ifdef UNIFDEF_LEGACY_UTMP_APIS struct utmp; /* forward reference */ -void getutmp(const struct utmpx *, struct utmp *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_9, __IPHONE_2_0, __IPHONE_7_0); -void getutmpx(const struct utmp *, struct utmpx *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_9, __IPHONE_2_0, __IPHONE_7_0); +void getutmp(const struct utmpx *, struct utmp *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_9, __IPHONE_2_0, __IPHONE_7_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; +void getutmpx(const struct utmp *, struct utmpx *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_9, __IPHONE_2_0, __IPHONE_7_0) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; #endif /* UNIFDEF_LEGACY_UTMP_APIS */ #endif /* !_POSIX_C_SOURCE || _DARWIN_C_SOURCE */ diff --git a/include/assert.h b/include/assert.h index 84787ad..67ae0fd 100644 --- a/include/assert.h +++ b/include/assert.h @@ -98,3 +98,14 @@ __END_DECLS #endif /* __GNUC__ */ #endif /* NDEBUG */ + +#ifndef _ASSERT_H_ +#define _ASSERT_H_ + +#ifndef __cplusplus +#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 201112L +#define static_assert _Static_assert +#endif /* __STDC_VERSION__ */ +#endif /* !__cplusplus */ + +#endif /* _ASSERT_H_ */ diff --git a/include/fts.h b/include/fts.h index 4e77418..a3ee69f 100644 --- a/include/fts.h +++ b/include/fts.h @@ -63,6 +63,8 @@ #include #include +#include + typedef struct { struct _ftsent *fts_cur; /* current node */ struct _ftsent *fts_child; /* linked list of children */ @@ -90,11 +92,11 @@ typedef struct { #define FTS_XDEV 0x040 /* don't cross devices */ #define FTS_WHITEOUT 0x080 /* return whiteout information */ #define FTS_COMFOLLOWDIR 0x400 /* (non-std) follow command line symlinks for directories only */ -#if (defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1090) || (defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__ >= 70000) +#if (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED < 1090) || (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED < 70000) +#define FTS_OPTIONMASK 0x4ff /* valid user option mask */ +#else #define FTS_NOSTAT_TYPE 0x800 /* (non-std) no stat, but use d_type in struct dirent when available */ #define FTS_OPTIONMASK 0xcff /* valid user option mask */ -#else -#define FTS_OPTIONMASK 0x4ff /* valid user option mask */ #endif #define FTS_NAMEONLY 0x100 /* (private) child names only */ diff --git a/include/monitor.h b/include/monitor.h index 6903b14..c4d0a2d 100644 --- a/include/monitor.h +++ b/include/monitor.h @@ -31,19 +31,34 @@ #define __MONITOR_HEADER__ #include +#include __BEGIN_DECLS + +__OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0,__MAC_10_11,__IPHONE_2_0,__IPHONE_9_0, "Monitor is no longer supported.") +__WATCHOS_PROHIBITED extern void monstartup (char *lowpc, char *highpc); +__OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0,__MAC_10_11,__IPHONE_2_0,__IPHONE_9_0, "Monitor is no longer supported.") +__WATCHOS_PROHIBITED extern void monitor (char *lowpc, char *highpc, char *buf, int bufsiz, int cntsiz); +__OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0,__MAC_10_11,__IPHONE_2_0,__IPHONE_9_0, "Monitor is no longer supported.") +__WATCHOS_PROHIBITED extern void moncontrol (int mode); +__OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0,__MAC_10_11,__IPHONE_2_0,__IPHONE_9_0, "Monitor is no longer supported.") +__WATCHOS_PROHIBITED extern void monoutput (const char *filename); +__OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0,__MAC_10_11,__IPHONE_2_0,__IPHONE_9_0, "Monitor is no longer supported.") +__WATCHOS_PROHIBITED extern void moninit (void); +__OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0,__MAC_10_11,__IPHONE_2_0,__IPHONE_9_0, "Monitor is no longer supported.") +__WATCHOS_PROHIBITED extern void monreset (void); + __END_DECLS #endif /* __MONITOR_HEADER__ */ diff --git a/include/signal.h b/include/signal.h index 2316310..39dc6e0 100644 --- a/include/signal.h +++ b/include/signal.h @@ -111,10 +111,10 @@ int sigaddset(sigset_t *, int); //Begin-Libc #ifndef LIBC_ALIAS_SIGALTSTACK //End-Libc -int sigaltstack(const stack_t * __restrict, stack_t * __restrict) __DARWIN_ALIAS(sigaltstack); +int sigaltstack(const stack_t * __restrict, stack_t * __restrict) __DARWIN_ALIAS(sigaltstack) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; //Begin-Libc #else /* LIBC_ALIAS_SIGALTSTACK */ -int sigaltstack(const stack_t * __restrict, stack_t * __restrict) LIBC_ALIAS(sigaltstack); +int sigaltstack(const stack_t * __restrict, stack_t * __restrict) LIBC_ALIAS(sigaltstack) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; #endif /* !LIBC_ALIAS_SIGALTSTACK */ //End-Libc int sigdelset(sigset_t *, int); @@ -136,7 +136,7 @@ int sigpause(int) LIBC_ALIAS_C(sigpause); int sigpending(sigset_t *); int sigprocmask(int, const sigset_t * __restrict, sigset_t * __restrict); int sigrelse(int); -void (*sigset(int, void (*)(int)))(int); +void (*sigset(int, void (*)(int)))(int); //Begin-Libc #ifndef LIBC_ALIAS_SIGSUSPEND //End-Libc diff --git a/include/stdbool.h b/include/stdbool.h deleted file mode 100644 index 5f01433..0000000 --- a/include/stdbool.h +++ /dev/null @@ -1,46 +0,0 @@ -/* - * Copyright (c) 2000 Jeroen Ruigrok van der Werven - * All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - * - * $FreeBSD: src/include/stdbool.h,v 1.6 2002/08/16 07:33:14 alfred Exp $ - */ - -#ifndef _STDBOOL_H_ -#define _STDBOOL_H_ - -#define __bool_true_false_are_defined 1 - -#ifndef __cplusplus - -#define bool _Bool -#if __STDC_VERSION__ < 199901L && __GNUC__ < 3 -typedef int _Bool; -#endif - -#define false 0 -#define true 1 - -#endif /* !__cplusplus */ - -#endif /* !_STDBOOL_H_ */ diff --git a/include/stddef.h b/include/stddef.h index 40c736a..6832cf7 100644 --- a/include/stddef.h +++ b/include/stddef.h @@ -82,4 +82,9 @@ #include #endif /* !_ANSI_SOURCE && (!_POSIX_C_SOURCE || _DARWIN_C_SOURCE) */ +#if (defined (__STDC_VERSION__) && __STDC_VERSION__ >= 201112L) \ + || (defined(__cplusplus) && __cplusplus >= 201103L) +typedef long double max_align_t; +#endif + #endif /* __STDDEF_H__ */ diff --git a/include/stdlib.h b/include/stdlib.h index 8530607..c1a3f7c 100644 --- a/include/stdlib.h +++ b/include/stdlib.h @@ -124,16 +124,13 @@ extern int __mb_cur_max; #define MB_CUR_MAX_L(x) (___mb_cur_max_l(x)) #endif //Begin-Libc +#include "libc_private.h" /* f must be a literal string */ #define LIBC_ABORT(f,...) abort_report_np("%s:%s:%u: " f, __FILE__, __func__, __LINE__, ## __VA_ARGS__) //End-Libc __BEGIN_DECLS void abort(void) __dead2; -//Begin-Libc -__attribute__((visibility("hidden"))) -void abort_report_np(const char *, ...) __dead2 __printflike(1, 2); -//End-Libc int abs(int) __pure2; int atexit(void (*)(void)); double atof(const char *); @@ -185,7 +182,7 @@ unsigned long long //Begin-Libc #ifndef LIBC_ALIAS_SYSTEM //End-Libc -int system(const char *) __DARWIN_ALIAS_C(system) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0,__MAC_NA,__IPHONE_2_0,__IPHONE_8_0, "Use posix_spawn APIs instead."); +int system(const char *) __DARWIN_ALIAS_C(system) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0,__MAC_NA,__IPHONE_2_0,__IPHONE_8_0, "Use posix_spawn APIs instead.") __WATCHOS_PROHIBITED __TVOS_PROHIBITED; //Begin-Libc #else /* LIBC_ALIAS_SYSTEM */ int system(const char *) LIBC_ALIAS_C(system); @@ -328,7 +325,7 @@ int cgetset(const char *); int cgetstr(char *, const char *, char **); int cgetustr(char *, const char *, char **); -int daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0); +int daemon(int, int) __DARWIN_1050(daemon) __OSX_AVAILABLE_BUT_DEPRECATED_MSG(__MAC_10_0, __MAC_10_5, __IPHONE_2_0, __IPHONE_2_0, "Use posix_spawn APIs instead.") __WATCHOS_PROHIBITED __TVOS_PROHIBITED; char *devname(dev_t, mode_t); char *devname_r(dev_t, mode_t, char *buf, int len); char *getbsize(int *, long *); diff --git a/include/unistd.h b/include/unistd.h index 7bca7d5..6cfeedf 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -361,6 +361,11 @@ #define _SC_PASS_MAX 131 #endif +/* 132-199 available for future use */ +#if __DARWIN_C_LEVEL >= __DARWIN_C_FULL +#define _SC_PHYS_PAGES 200 +#endif /* __DARWIN_C_LEVEL >= __DARWIN_C_FULL */ + #if __DARWIN_C_LEVEL >= 199209L #ifndef _CS_PATH /* Defined in */ #define _CS_PATH 1 @@ -440,13 +445,13 @@ int close(int) LIBC_ALIAS_C(close); int dup(int); int dup2(int, int); -int execl(const char *, const char *, ...); -int execle(const char *, const char *, ...); -int execlp(const char *, const char *, ...); -int execv(const char *, char * const *); -int execve(const char *, char * const *, char * const *); -int execvp(const char *, char * const *); -pid_t fork(void); +int execl(const char *, const char *, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; +int execle(const char *, const char *, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; +int execlp(const char *, const char *, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; +int execv(const char *, char * const *) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; +int execve(const char *, char * const *, char * const *) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; +int execvp(const char *, char * const *) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; +pid_t fork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; long fpathconf(int, int); char *getcwd(char *, size_t); gid_t getegid(void); @@ -593,7 +598,7 @@ __END_DECLS /* Removed in Issue 6 */ #if !defined(_POSIX_C_SOURCE) || _POSIX_C_SOURCE < 200112L #if !defined(_POSIX_C_SOURCE) -__deprecated +__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED #endif void *brk(const void *); int chroot(const char *) __POSIX_C_DEPRECATED(199506L); @@ -690,7 +695,7 @@ ssize_t pwrite(int, const void *, size_t, off_t) LIBC_ALIAS_C(pwrite); /* Note that Issue 5 changed the argument as intprt_t, * but we keep it as int for binary compatability. */ #if !defined(_POSIX_C_SOURCE) -__deprecated +__deprecated __WATCHOS_PROHIBITED __TVOS_PROHIBITED #endif void *sbrk(int); #endif @@ -742,7 +747,7 @@ int usleep(useconds_t) __DARWIN_ALIAS_C(usleep); int usleep(useconds_t) LIBC_ALIAS_C(usleep); #endif /* !LIBC_ALIAS_USLEEP */ //End-Libc -pid_t vfork(void); +pid_t vfork(void) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; /* End XSI */ //Begin-Libc @@ -793,9 +798,9 @@ __BEGIN_DECLS void _Exit(int) __dead2; int accessx_np(const struct accessx_descriptor *, size_t, int *, uid_t); int acct(const char *); -int add_profil(char *, size_t, unsigned long, unsigned int); +int add_profil(char *, size_t, unsigned long, unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; void endusershell(void); -int execvP(const char *, const char *, char * const *); +int execvP(const char *, const char *, char * const *) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; char *fflagstostr(unsigned long); int getdomainname(char *, int); int getgrouplist(const char *, int, int *, int *); @@ -869,7 +874,7 @@ void setusershell(void); int setwgroups_np(int, const uuid_t); int strtofflags(char **, unsigned long *, unsigned long *); int swapon(const char *); -int syscall(int, ...); +int syscall(int, ...) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; int ttyslot(void); int undelete(const char *); int unwhiteout(const char *); @@ -900,8 +905,8 @@ int setattrlist(const char*,void*,void*,size_t,unsigned int) __DARWIN_ALIAS(s int setattrlist(const char*,void*,void*,size_t,unsigned int) LIBC_ALIAS(setattrlist); #endif /* !LIBC_ALIAS_SETATTRLIST */ //End-Libc -int exchangedata(const char*,const char*,unsigned int); -int getdirentriesattr(int,void*,void*,size_t,unsigned int*,unsigned int*,unsigned int*,unsigned int); +int exchangedata(const char*,const char*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; +int getdirentriesattr(int,void*,void*,size_t,unsigned int*,unsigned int*,unsigned int*,unsigned int) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; #else /* __LP64__ */ int fgetattrlist(int,void*,void*,size_t,unsigned long) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); @@ -924,15 +929,15 @@ int setattrlist(const char*,void*,void*,size_t,unsigned long) __DARWIN_ALIAS(set int setattrlist(const char*,void*,void*,size_t,unsigned long) LIBC_ALIAS(setattrlist); #endif /* !LIBC_ALIAS_SETATTRLIST */ //End-Libc -int exchangedata(const char*,const char*,unsigned long); -int getdirentriesattr(int,void*,void*,size_t,unsigned long*,unsigned long*,unsigned long*,unsigned long); +int exchangedata(const char*,const char*,unsigned long) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; +int getdirentriesattr(int,void*,void*,size_t,unsigned long*,unsigned long*,unsigned long*,unsigned long) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; #endif /* __LP64__ */ struct fssearchblock; struct searchstate; -int searchfs(const char *, struct fssearchblock *, unsigned long *, unsigned int, unsigned int, struct searchstate *); +int searchfs(const char *, struct fssearchblock *, unsigned long *, unsigned int, unsigned int, struct searchstate *) __WATCHOS_PROHIBITED __TVOS_PROHIBITED; int fsctl(const char *,unsigned long,void*,unsigned int); int ffsctl(int,unsigned long,void*,unsigned int) __OSX_AVAILABLE_STARTING(__MAC_10_6, __IPHONE_3_0); diff --git a/man/manpages.lst b/man/manpages.lst index 1a5c2d2..65a981c 100644 --- a/man/manpages.lst +++ b/man/manpages.lst @@ -205,7 +205,6 @@ memset_s.3 memset_s.3 memset_pattern.3 memset_pattern.3 memset_pattern4.3 memset_pattern8.3 memset_pattern16.3 mkpath_np.3 mkpath_np.3 mktemp.3 mktemp.3 mkdtemp.3 mkstemp.3 mkstemps.3 -moncontrol.3 moncontrol.3 monstartup.3 mpool.3 mpool.3 mpool_close.3 mpool_filter.3 mpool_get.3 mpool_new.3 mpool_open.3 mpool_put.3 mpool_sync.3 multibyte.3 multibyte.3 newlocale.3 newlocale.3 diff --git a/os/assumes.c b/os/assumes.c index b11a48c..da5ab00 100644 --- a/os/assumes.c +++ b/os/assumes.c @@ -225,14 +225,30 @@ _os_construct_message(uint64_t code, _SIMPLE_STRING asl_message, Dl_info *info, } #pragma mark Internal Implementations + +os_crash_callback_t _os_crash_callback = NULL; + +__attribute__((always_inline)) +static inline void +_os_crash_impl(const char *message) { + os_set_crash_message(message); + if (!_os_crash_callback) { + _os_crash_callback = dlsym(RTLD_MAIN_ONLY, "os_crash_function"); + } + if (_os_crash_callback) { + _os_crash_callback(message); + } +} + __attribute__((always_inline)) static inline void _os_assumes_log_impl(uint64_t code) { + char message[256] = ""; + _SIMPLE_STRING asl_message = _simple_asl_msg_new(); if (asl_message) { Dl_info info; - char message[256]; _os_construct_message(code, asl_message, &info, message, sizeof(message)); if (!_os_log_redirect(info.dli_fbase, message)) { _os_debug_log_error_str(message); @@ -245,7 +261,7 @@ _os_assumes_log_impl(uint64_t code) } if (_os_abort_on_assumes()) { - __builtin_trap(); + os_crash(message); } } @@ -297,10 +313,11 @@ __attribute__((always_inline)) static inline void _os_assumes_log_ctx_impl(os_log_callout_t callout, void *ctx, uint64_t code) { + char message[256] = ""; + _SIMPLE_STRING asl_message = _simple_asl_msg_new(); if (asl_message) { Dl_info info; - char message[256]; _os_construct_message(code, asl_message, &info, message, sizeof(message)); (void)callout(asl_message, ctx, message); @@ -308,7 +325,7 @@ _os_assumes_log_ctx_impl(os_log_callout_t callout, void *ctx, uint64_t code) } if (_os_abort_on_assumes()) { - __builtin_trap(); + os_crash(message); } } @@ -332,6 +349,11 @@ _os_assert_log_ctx_impl(os_log_callout_t callout, void *ctx, uint64_t code) } #pragma mark Public Interfaces +void _os_crash(const char *message) +{ + _os_crash_impl(message); +} + void _os_assumes_log(uint64_t code) { diff --git a/os/assumes.h b/os/assumes.h index 3808395..c9189fa 100644 --- a/os/assumes.h +++ b/os/assumes.h @@ -50,6 +50,16 @@ __BEGIN_DECLS #define __OS_COMPILETIME_ASSERT__(e) (e) #endif /* __GNUC__ */ + +/* os_crash() is like os_hardware_trap(), except you get to pass in a crash + * message, and it can be redirected to a callback function using + * os_set_crash_callback() */ +#define os_crash(msg) \ + ({ \ + _os_crash(msg); \ + os_hardware_trap(); \ + }) + /* This is useful for clients who wish for the messages generated by assumes() * failures to go somewhere other than (or in addition to) the system log. If * you don't wish for the message to be logged to the system log, then return @@ -71,6 +81,22 @@ struct _os_redirect_assumes_s { .redirect = &func, \ }; + +typedef void (*os_crash_callback_t) (const char *); + +/* private. use os_get_crash_callback and os_set_crash_callback */ +extern os_crash_callback_t _os_crash_callback; + +static inline os_crash_callback_t +os_get_crash_callback() { + return _os_crash_callback; +} + +static inline void +os_set_crash_callback(os_crash_callback_t callback) { + _os_crash_callback = callback; +} + /* The asl_message argument is a _SIMPLE_STRING that, when given to _simple_asl_send(), will * direct the message to the MessageTracer diagnostic messages store rather than * the default system log store. @@ -130,8 +156,7 @@ typedef bool (*os_log_callout_t)(_SIMPLE_STRING asl_message, void *ctx, const ch } \ \ char *_fail_message = _os_assert_log((uint64_t)(uintptr_t)_e); \ - os_set_crash_message(_fail_message); \ - os_hardware_trap(); \ + os_crash(_fail_message); \ free(_fail_message); \ } \ }) @@ -144,8 +169,7 @@ typedef bool (*os_log_callout_t)(_SIMPLE_STRING asl_message, void *ctx, const ch } \ \ char *_fail_message = _os_assert_log((uint64_t)(uintptr_t)_e); \ - os_set_crash_message(_fail_message); \ - os_hardware_trap(); \ + os_crash(_fail_message); \ free(_fail_message); \ } \ }) @@ -154,8 +178,7 @@ typedef bool (*os_log_callout_t)(_SIMPLE_STRING asl_message, void *ctx, const ch __typeof__(e) _e = os_slowpath(e); \ if (_e == (__typeof__(e))-1) { \ char *_fail_message = _os_assert_log((uint64_t)(uintptr_t)errno); \ - os_set_crash_message(_fail_message); \ - os_hardware_trap(); \ + os_crash(_fail_message); \ free(_fail_message); \ } \ }) @@ -203,10 +226,9 @@ typedef bool (*os_log_callout_t)(_SIMPLE_STRING asl_message, void *ctx, const ch if (os_constant(e)) { \ __OS_COMPILETIME_ASSERT__(e); \ } \ -\ + \ char *_fail_message = _os_assert_log_ctx((f), (ctx), (uint64_t)(uintptr_t)_e); \ - os_set_crash_message(_fail_message); \ - os_hardware_trap(); \ + os_crash(_fail_message); \ free(_fail_message); \ } \ }) @@ -219,8 +241,7 @@ typedef bool (*os_log_callout_t)(_SIMPLE_STRING asl_message, void *ctx, const ch } \ \ char *_fail_message = _os_assert_log_ctx((f), (ctx), (uint64_t)(uintptr_t)_e); \ - os_set_crash_message(_fail_message); \ - os_hardware_trap(); \ + os_crash(_fail_message); \ free(_fail_message); \ } \ }) @@ -229,12 +250,15 @@ typedef bool (*os_log_callout_t)(_SIMPLE_STRING asl_message, void *ctx, const ch __typeof__(e) _e = os_slowpath(e); \ if (_e == (__typeof__(e))-1) { \ char *_fail_message = _os_assert_log_ctx((f), (ctx), (uint64_t)(uintptr_t)errno); \ - os_set_crash_message(_fail_message); \ - os_hardware_trap(); \ + os_crash(_fail_message); \ free(_fail_message); \ } \ }) +__OSX_AVAILABLE_STARTING(__MAC_10_11, __IPHONE_9_0) +extern void +_os_crash(const char *); + __OSX_AVAILABLE_STARTING(__MAC_10_9, __IPHONE_6_0) extern void _os_assumes_log(uint64_t code); diff --git a/regex/TRE/lib/regexec.c b/regex/TRE/lib/regexec.c index 6823f72..174f6b6 100644 --- a/regex/TRE/lib/regexec.c +++ b/regex/TRE/lib/regexec.c @@ -205,7 +205,7 @@ tre_fill_pmatch(size_t nmatch, regmatch_t pmatch[], int cflags, i++; } #ifndef TRE_USE_ALLOCA - if (tags != intags) xfree(tags); + if (tags != intags) xfree((void*)tags); #endif /* !TRE_USE_ALLOCA */ } @@ -251,16 +251,6 @@ tre_match(const tre_tnfa_t *tnfa, const void *string, size_t len, tre_tag_t *tags = NULL; int eo; size_t offset = 0, count = 0; - if (tnfa->num_tags > 0 && nmatch > 0) - { -#ifdef TRE_USE_ALLOCA - tags = alloca(sizeof(*tags) * tnfa->num_tags); -#else /* !TRE_USE_ALLOCA */ - tags = xmalloc(sizeof(*tags) * tnfa->num_tags); -#endif /* !TRE_USE_ALLOCA */ - if (tags == NULL) - return REG_ESPACE; - } if ( #ifdef TRE_STR_USER @@ -280,6 +270,17 @@ tre_match(const tre_tnfa_t *tnfa, const void *string, size_t len, if (type == STR_WIDE) offset *= sizeof(wchar_t); } + if (tnfa->num_tags > 0 && nmatch > 0) + { +#ifdef TRE_USE_ALLOCA + tags = alloca(sizeof(*tags) * tnfa->num_tags); +#else /* !TRE_USE_ALLOCA */ + tags = xmalloc(sizeof(*tags) * tnfa->num_tags); +#endif /* !TRE_USE_ALLOCA */ + if (tags == NULL) + return REG_ESPACE; + } + /* Dispatch to the appropriate matcher. */ if (tnfa->have_backrefs || eflags & REG_BACKTRACKING_MATCHER) { @@ -291,8 +292,8 @@ tre_match(const tre_tnfa_t *tnfa, const void *string, size_t len, if (source->rewind == NULL || source->compare == NULL) /* The backtracking matcher requires rewind and compare capabilities from the input stream. */ - return REG_BADPAT; - } + status = REG_BADPAT; + } else #endif /* TRE_STR_USER */ status = tre_tnfa_run_backtrack(tnfa, string + offset, (int)len, type, tags, eflags, &eo); diff --git a/regex/TRE/lib/tre-compile.c b/regex/TRE/lib/tre-compile.c index 4662189..f8741a0 100644 --- a/regex/TRE/lib/tre-compile.c +++ b/regex/TRE/lib/tre-compile.c @@ -1379,7 +1379,7 @@ do_addtags_recurse: #endif /* TRE_DEBUG */ DPRINT(("Reordering submatch_data\n")); - for (i = 0; i < tnfa->num_submatches; i++) + for (i = 0; i < (int)tnfa->num_submatches; i++) { #if TRE_DEBUG int so = tnfa->submatch_data[i].so_tag; @@ -1810,7 +1810,7 @@ typedef enum { static reg_errcode_t tre_expand_ast(tre_mem_t mem, tre_stack_t *stack, tre_ast_node_t *ast, int *position, tre_tag_direction_t *tag_directions, - int *max_depth) + int __unused *max_depth) { reg_errcode_t status = REG_OK; int bottom = tre_stack_num_objects(stack); @@ -3050,7 +3050,7 @@ tre_compile(regex_t *preg, const tre_char_t *regex, size_t n, int cflags, sizeof(*tag_directions) * (tnfa->num_tags + 1)); } tnfa->minimal_tags = xcalloc((unsigned)tnfa->num_tags * 2 + 3, - sizeof(tnfa->minimal_tags)); + sizeof(*tnfa->minimal_tags)); if (tnfa->minimal_tags == NULL) ERROR_EXIT(REG_ESPACE); diff --git a/regex/TRE/lib/tre-mem.c b/regex/TRE/lib/tre-mem.c index b5fb276..21aa793 100644 --- a/regex/TRE/lib/tre-mem.c +++ b/regex/TRE/lib/tre-mem.c @@ -106,12 +106,12 @@ tre_mem_alloc_impl(tre_mem_t mem, int provided, void *provided_block, } else { - int block_size; + size_t block_size; if (size * 8 > TRE_MEM_BLOCK_SIZE) block_size = size * 8; else block_size = TRE_MEM_BLOCK_SIZE; - DPRINT(("tre_mem_alloc: allocating new %d byte block\n", + DPRINT(("tre_mem_alloc: allocating new %ld byte block\n", block_size)); l = xmalloc(sizeof(*l)); if (l == NULL) diff --git a/regex/TRE/lib/tre-parse.c b/regex/TRE/lib/tre-parse.c index 05193af..fa0b34a 100644 --- a/regex/TRE/lib/tre-parse.c +++ b/regex/TRE/lib/tre-parse.c @@ -107,7 +107,7 @@ tre_expand_macro(const tre_char_t *regex, const tre_char_t *regex_end, } static reg_errcode_t -tre_new_item(tre_mem_t mem, int type, int val, int *max_i, +tre_new_item(tre_mem_t __unused mem, int type, int val, int *max_i, tre_bracket_match_list_t **items) { reg_errcode_t status = REG_OK; diff --git a/stdio/FreeBSD/fflush.c b/stdio/FreeBSD/fflush.c index 5db1a1c..9866826 100644 --- a/stdio/FreeBSD/fflush.c +++ b/stdio/FreeBSD/fflush.c @@ -130,11 +130,13 @@ __sflush(FILE *fp) if (t <= 0) { /* 5340694: reset _p and _w on EAGAIN */ if (t < 0 && errno == EAGAIN) { - if (p > fp->_p) /* some was written */ + if (p > fp->_p) { + /* some was written */ memmove(fp->_p, p, n); - fp->_p += n; - if (!(fp->_flags & (__SLBF|__SNBF))) - fp->_w -= n; + fp->_p += n; + if (!(fp->_flags & (__SLBF|__SNBF))) + fp->_w -= n; + } } fp->_flags |= __SERR; return (EOF); diff --git a/stdio/FreeBSD/fopen.3 b/stdio/FreeBSD/fopen.3 index 3bb0c0f..ab304e9 100644 --- a/stdio/FreeBSD/fopen.3 +++ b/stdio/FreeBSD/fopen.3 @@ -140,15 +140,11 @@ Any created files will have mode as modified by the process' umask value (see .Xr umask 2 ) . +.\" C11 §7.21.5.3p7 .Pp -Reads and writes may be intermixed on read/write streams in any order, -and do not require an intermediate seek as in previous versions of -.Em stdio . -This is not portable to other systems, however; -.Tn ANSI C -requires that -a file positioning function intervene between output and input, unless -an input operation encounters end-of-file. +Reads and writes may be intermixed on read/write streams in any order; however, +a file positioning function must be called when switching between output and +input, unless an input operation encounters end-of-file. .Pp The .Fn fdopen diff --git a/stdio/FreeBSD/printf.3 b/stdio/FreeBSD/printf.3 index 031d7f7..850fa98 100644 --- a/stdio/FreeBSD/printf.3 +++ b/stdio/FreeBSD/printf.3 @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)printf.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD: src/lib/libc/stdio/printf.3,v 1.64 2009/12/02 07:51:25 brueffer Exp $ +.\" $FreeBSD$ .\" .Dd December 2, 2009 .Dt PRINTF 3 @@ -97,7 +97,7 @@ write output to the given file descriptor; and .Fn vsnprintf write to the character string -.Fa s ; +.Fa str ; and .Fn asprintf and @@ -118,20 +118,6 @@ string that specifies how subsequent arguments .Xr stdarg 3 ) are converted for output. .Pp -These functions return the number of characters printed -(not including the trailing -.Ql \e0 -used to end output to strings) or a negative value if an output error occurs, -except for -.Fn snprintf -and -.Fn vsnprintf , -which return the number of characters that would have been printed if the -.Fa n -were unlimited -(again, not including the final -.Ql \e0 ) . -.Pp The .Fn asprintf and @@ -159,25 +145,29 @@ and .Fn vsnprintf functions will write at most -.Fa n Ns \-1 +.Fa size Ns \-1 of the characters printed into the output string (the -.Fa n Ns \'th +.Fa size Ns 'th character then gets the terminating .Ql \e0 ) ; if the return value is greater than or equal to the -.Fa n +.Fa size argument, the string was too short and some of the printed characters were discarded. -The output is always null-terminated. +The output is always null-terminated, unless +.Fa size +is 0. .Pp The .Fn sprintf and .Fn vsprintf functions -effectively assume an infinite -.Fa n . +effectively assume a +.Fa size +of +.Dv INT_MAX + 1. .Pp For those routines that write to a user-provided character string, that string and the format strings should not overlap, as the @@ -286,7 +276,7 @@ number produced by a signed conversion. A .Cm + overrides a space if both are used. -.It Sq Cm ' +.It So "'" Sc (apostrophe) Decimal conversions .Cm ( d , u , or @@ -500,7 +490,7 @@ The .Vt double argument is rounded and converted in the style .Sm off -.Oo \- Oc Ar d Li \&. Ar ddd Li e \\*[Pm] Ar dd +.Oo \- Oc Ar d Li \&. Ar ddd Li e \(+- Ar dd .Sm on where there is one digit before the decimal-point character @@ -576,7 +566,7 @@ The .Vt double argument is rounded and converted to hexadecimal notation in the style .Sm off -.Oo \- Oc Li 0x Ar h Li \&. Ar hhhp Oo \\*[Pm] Oc Ar d , +.Oo \- Oc Li 0x Ar h Li \&. Ar hhhp Oo \(+- Oc Ar d , .Sm on where the number of digits after the hexadecimal-point character is equal to the precision specification. @@ -720,6 +710,21 @@ In no case does a non-existent or small field width cause truncation of a numeric field; if the result of a conversion is wider than the field width, the field is expanded to contain the conversion result. +.Sh RETURN VALUES +These functions return the number of characters printed +(not including the trailing +.Ql \e0 +used to end output to strings), +except for +.Fn snprintf +and +.Fn vsnprintf , +which return the number of characters that would have been printed if the +.Fa size +were unlimited +(again, not including the final +.Ql \e0 ) . +These functions return a negative value if an error occurs. .Sh EXAMPLES To print a date and time in the form .Dq Li "Sunday, July 3, 10:02" , @@ -759,82 +764,11 @@ char *newfmt(const char *fmt, ...) return (p); } .Ed -.Sh SECURITY CONSIDERATIONS -The -.Fn sprintf -and -.Fn vsprintf -functions are easily misused in a manner which enables malicious users -to arbitrarily change a running program's functionality through -a buffer overflow attack. -Because -.Fn sprintf -and -.Fn vsprintf -assume an infinitely long string, -callers must be careful not to overflow the actual space; -this is often hard to assure. -For safety, programmers should use the -.Fn snprintf -interface instead. -For example: -.Bd -literal -void -foo(const char *arbitrary_string, const char *and_another) -{ - char onstack[8]; - -#ifdef BAD - /* - * This first sprintf is bad behavior. Do not use sprintf! - */ - sprintf(onstack, "%s, %s", arbitrary_string, and_another); -#else - /* - * The following two lines demonstrate better use of - * snprintf(). - */ - snprintf(onstack, sizeof(onstack), "%s, %s", arbitrary_string, - and_another); -#endif -} -.Ed -.Pp -The -.Fn printf -and -.Fn sprintf -family of functions are also easily misused in a manner -allowing malicious users to arbitrarily change a running program's -functionality by either causing the program -to print potentially sensitive data -.Dq "left on the stack" , -or causing it to generate a memory fault or bus error -by dereferencing an invalid pointer. -.Pp -.Cm %n -can be used to write arbitrary data to potentially carefully-selected -addresses. -Programmers are therefore strongly advised to never pass untrusted strings -as the -.Fa format -argument, as an attacker can put format specifiers in the string -to mangle your stack, -leading to a possible security hole. -This holds true even if the string was built using a function like -.Fn snprintf , -as the resulting string may still contain user-supplied conversion specifiers -for later interpolation by -.Fn printf . -.Pp -Always use the proper secure idiom: -.Pp -.Dl "snprintf(buffer, sizeof(buffer), \*q%s\*q, string);" .Sh COMPATIBILITY The conversion formats .Cm \&%D , \&%O , and -.Cm %U +.Cm \&%U are not standard and are provided only for backward compatibility. The effect of padding the @@ -910,14 +844,14 @@ first appeared in the .Tn GNU C library. These were implemented by -.An Peter Wemm Aq peter@FreeBSD.org +.An Peter Wemm Aq Mt peter@FreeBSD.org in .Fx 2.2 , but were later replaced with a different implementation from -.An Todd C. Miller Aq Todd.Miller@courtesan.com -for -.Ox 2.3 . +.Ox 2.3 +by +.An Todd C. Miller Aq Mt Todd.Miller@courtesan.com . The .Fn dprintf and @@ -930,3 +864,74 @@ The family of functions do not correctly handle multibyte characters in the .Fa format argument. +.Sh SECURITY CONSIDERATIONS +The +.Fn sprintf +and +.Fn vsprintf +functions are easily misused in a manner which enables malicious users +to arbitrarily change a running program's functionality through +a buffer overflow attack. +Because +.Fn sprintf +and +.Fn vsprintf +assume an infinitely long string, +callers must be careful not to overflow the actual space; +this is often hard to assure. +For safety, programmers should use the +.Fn snprintf +interface instead. +For example: +.Bd -literal +void +foo(const char *arbitrary_string, const char *and_another) +{ + char onstack[8]; + +#ifdef BAD + /* + * This first sprintf is bad behavior. Do not use sprintf! + */ + sprintf(onstack, "%s, %s", arbitrary_string, and_another); +#else + /* + * The following two lines demonstrate better use of + * snprintf(). + */ + snprintf(onstack, sizeof(onstack), "%s, %s", arbitrary_string, + and_another); +#endif +} +.Ed +.Pp +The +.Fn printf +and +.Fn sprintf +family of functions are also easily misused in a manner +allowing malicious users to arbitrarily change a running program's +functionality by either causing the program +to print potentially sensitive data +.Dq "left on the stack" , +or causing it to generate a memory fault or bus error +by dereferencing an invalid pointer. +.Pp +.Cm %n +can be used to write arbitrary data to potentially carefully-selected +addresses. +Programmers are therefore strongly advised to never pass untrusted strings +as the +.Fa format +argument, as an attacker can put format specifiers in the string +to mangle your stack, +leading to a possible security hole. +This holds true even if the string was built using a function like +.Fn snprintf , +as the resulting string may still contain user-supplied conversion specifiers +for later interpolation by +.Fn printf . +.Pp +Always use the proper secure idiom: +.Pp +.Dl "snprintf(buffer, sizeof(buffer), \*q%s\*q, string);" diff --git a/stdlib/FreeBSD/abort.c b/stdlib/FreeBSD/abort.c index 37e576e..386572c 100644 --- a/stdlib/FreeBSD/abort.c +++ b/stdlib/FreeBSD/abort.c @@ -140,7 +140,7 @@ __abort() __builtin_trap(); } -__private_extern__ void +void abort_report_np(const char *fmt, ...) { _SIMPLE_STRING s; diff --git a/stdlib/FreeBSD/atof.3 b/stdlib/FreeBSD/atof.3 index 28f0870..5454422 100644 --- a/stdlib/FreeBSD/atof.3 +++ b/stdlib/FreeBSD/atof.3 @@ -83,14 +83,14 @@ and functions are thread-safe and async-cancel-safe. .Pp The +.Fn strtod +and +.Fn strtod_l +functions are recommended instead of .Fn atof and .Fn atof_l -functions have been deprecated by -.Fn strtod -and -.Fn strtod_l -and should not be used in new code. +functions, especially in new code. .Sh ERRORS The function .Fn atof diff --git a/stdlib/FreeBSD/atoi.3 b/stdlib/FreeBSD/atoi.3 index 3dc33e8..6e8a796 100644 --- a/stdlib/FreeBSD/atoi.3 +++ b/stdlib/FreeBSD/atoi.3 @@ -79,14 +79,14 @@ and functions are thread-safe and async-cancel-safe. .Pp The -.Fn atoi -and -.Fn atoi_l -functions have been deprecated by .Fn strtol and .Fn strtol_l -and should not be used in new code. +functions are recommended instead of +.Fn atoi +and +.Fn atoi_l +functions, especially in new code. .Sh ERRORS The function .Fn atoi diff --git a/stdlib/FreeBSD/system.c b/stdlib/FreeBSD/system.c index 3e99468..84b2224 100644 --- a/stdlib/FreeBSD/system.c +++ b/stdlib/FreeBSD/system.c @@ -49,6 +49,8 @@ __FBSDID("$FreeBSD: src/lib/libc/stdlib/system.c,v 1.11 2007/01/09 00:28:10 imp #include #define environ (*_NSGetEnviron()) +#include + #if __DARWIN_UNIX03 #include @@ -60,6 +62,10 @@ int __system(command) const char *command; { +#if TARGET_OS_IPHONE && (TARGET_OS_SIMULATOR || !TARGET_OS_IOS) + // Don't abort() on iOS for now + LIBC_ABORT("system() is not supported on this platform."); +#else pid_t pid, savedpid; int pstat, err; struct sigaction ign, intact, quitact; @@ -139,6 +145,7 @@ __system(command) pthread_mutex_unlock(&__systemfn_mutex); #endif /* __DARWIN_UNIX03 */ return(pstat); +#endif /* TARGET_OS_IPHONE && (TARGET_OS_SIMULATOR || !TARGET_OS_IOS) */ } __weak_reference(__system, system); diff --git a/string/FreeBSD/strcpy.3 b/string/FreeBSD/strcpy.3 index 11d6b4d..fda6eb4 100644 --- a/string/FreeBSD/strcpy.3 +++ b/string/FreeBSD/strcpy.3 @@ -13,7 +13,7 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 4. Neither the name of the University nor the names of its contributors +.\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" @@ -30,7 +30,7 @@ .\" SUCH DAMAGE. .\" .\" @(#)strcpy.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD: src/lib/libc/string/strcpy.3,v 1.28 2009/04/07 13:42:53 trasz Exp $ +.\" $FreeBSD$ .\" .Dd February 28, 2009 .Dt STRCPY 3 @@ -43,27 +43,13 @@ .Sh SYNOPSIS .In string.h .Ft char * -.Fo stpcpy -.Fa "char *dst" -.Fa "const char *src" -.Fc +.Fn stpcpy "char * dst" "const char * src" .Ft char * -.Fo stpncpy -.Fa "char *restrict dst" -.Fa "const char *restrict src" -.Fa "size_t n" -.Fc +.Fn stpncpy "char * dst" "const char * src" "size_t len" .Ft char * -.Fo strcpy -.Fa "char *restrict dst" -.Fa "const char *restrict src" -.Fc +.Fn strcpy "char * dst" "const char * src" .Ft char * -.Fo strncpy -.Fa "char *restrict dst" -.Fa "const char *restrict src" -.Fa "size_t n" -.Fc +.Fn strncpy "char * dst" "const char * src" "size_t len" .Sh DESCRIPTION The .Fn stpcpy @@ -76,14 +62,14 @@ to .Fa dst (including the terminating .Ql \e0 -character). +character.) .Pp The .Fn stpncpy and .Fn strncpy functions copy at most -.Fa n +.Fa len characters from .Fa src into @@ -91,7 +77,7 @@ into If .Fa src is less than -.Fa n +.Fa len characters long, the remainder of .Fa dst @@ -156,7 +142,7 @@ Note that it does .Em not .Tn NUL terminate -.Va chararray , +.Va chararray because the length of the source string is greater than or equal to the length argument. .Pp @@ -186,26 +172,11 @@ This could be better achieved using as shown in the following example: .Pp .Dl "(void)strlcpy(buf, input, sizeof(buf));" -.Sh SECURITY CONSIDERATIONS -The -.Fn strcpy , -.Fn strncpy , -.Fn stpcpy , -and -.Fn stpncpy -functions are easily misused in a manner which enables malicious users -to arbitrarily change a running program's functionality through a -buffer overflow attack. -(See -the FSA -and -.Sx EXAMPLES . ) .Pp -It is recommended that -.Xr strlcpy 3 -be used instead as a way to avoid such problems. +Note that because .Xr strlcpy 3 -is not defined in any standards, but it has been adopted by most major libc implementations. +is not defined in any standards, it should +only be used when portability is not a concern. .Sh SEE ALSO .Xr bcopy 3 , .Xr memccpy 3 , @@ -236,3 +207,9 @@ and .Fn stpncpy was added in .Fx 8.0 . +.Sh SECURITY CONSIDERATIONS +The +.Fn strcpy +function is easily misused in a manner which enables malicious users +to arbitrarily change a running program's functionality through a +buffer overflow attack. diff --git a/string/FreeBSD/strstr.3 b/string/FreeBSD/strstr.3 index 70fbda4..f02ab43 100644 --- a/string/FreeBSD/strstr.3 +++ b/string/FreeBSD/strstr.3 @@ -14,7 +14,7 @@ .\" 2. Redistributions in binary form must reproduce the above copyright .\" notice, this list of conditions and the following disclaimer in the .\" documentation and/or other materials provided with the distribution. -.\" 4. Neither the name of the University nor the names of its contributors +.\" 3. Neither the name of the University nor the names of its contributors .\" may be used to endorse or promote products derived from this software .\" without specific prior written permission. .\" @@ -31,53 +31,36 @@ .\" SUCH DAMAGE. .\" .\" @(#)strstr.3 8.1 (Berkeley) 6/4/93 -.\" $FreeBSD: src/lib/libc/string/strstr.3,v 1.15 2009/04/07 13:42:53 trasz Exp $ +.\" $FreeBSD$ .\" .Dd October 11, 2001 .Dt STRSTR 3 .Os .Sh NAME -.Nm strcasestr , -.Nm strcasestr_l , -.Nm strnstr , -.Nm strstr +.Nm strstr , strcasestr , strnstr .Nd locate a substring in a string .Sh LIBRARY .Lb libc .Sh SYNOPSIS .In string.h .Ft char * -.Fo strcasestr -.Fa "const char *s1" -.Fa "const char *s2" -.Fc +.Fn strstr "const char *big" "const char *little" .Ft char * -.Fo strnstr -.Fa "const char *s1" -.Fa "const char *s2" -.Fa "size_t n" -.Fc +.Fn strcasestr "const char *big" "const char *little" .Ft char * -.Fo strstr -.Fa "const char *s1" -.Fa "const char *s2" -.Fc +.Fn strnstr "const char *big" "const char *little" "size_t len" .In string.h .In xlocale.h .Ft char * -.Fo strcasestr_l -.Fa "const char *s1" -.Fa "const char *s2" -.Fa "locale_t loc" -.Fc +.Fn strcasestr_l "const char *big" "const char *little" "locale_t loc" .Sh DESCRIPTION The .Fn strstr function locates the first occurrence of the null-terminated string -.Fa s2 +.Fa little in the null-terminated string -.Fa s1 . +.Fa big . .Pp The .Fn strcasestr @@ -89,11 +72,11 @@ The .Fn strnstr function locates the first occurrence of the null-terminated string -.Fa s2 +.Fa little in the string -.Fa s1 , +.Fa big , where not more than -.Fa n +.Fa len characters are searched. Characters that appear after a .Ql \e0 @@ -113,18 +96,18 @@ function may be passed a locale directly. See for more information. .Sh RETURN VALUES If -.Fa s2 +.Fa little is an empty string, -.Fa s1 +.Fa big is returned; if -.Fa s2 +.Fa little occurs nowhere in -.Fa s1 , +.Fa big , .Dv NULL is returned; otherwise a pointer to the first character of the first occurrence of -.Fa s2 +.Fa little is returned. .Sh EXAMPLES The following sets the pointer @@ -157,6 +140,7 @@ ptr = strnstr(largestring, smallstring, 4); .Ed .Sh SEE ALSO .Xr memchr 3 , +.Xr memmem 3 , .Xr strchr 3 , .Xr strcspn 3 , .Xr strpbrk 3 , diff --git a/sys/sigaction.c b/sys/sigaction.c index 2e9652c..72d1811 100644 --- a/sys/sigaction.c +++ b/sys/sigaction.c @@ -26,6 +26,9 @@ * @(#)sigaction.c 1.0 */ +#include +#include +#include #include #include #include @@ -44,6 +47,7 @@ sigaction (int sig, const struct sigaction * __restrict nsv, struct sigaction * extern void _sigtramp(); struct __sigaction sa; struct __sigaction *sap; + int ret; if (sig <= 0 || sig >= NSIG || sig == SIGKILL || sig == SIGSTOP) { errno = EINVAL; @@ -57,7 +61,17 @@ sigaction (int sig, const struct sigaction * __restrict nsv, struct sigaction * sa.sa_flags = nsv->sa_flags; sap = &sa; } - return __sigaction(sig, sap, osv); + ret = __sigaction(sig, sap, osv); +#ifdef FEATURE_SIGNAL_RESTRICTION + // Note: The "sig != 0" here is to force the compiler to maintain that "sig" + // is live, and in a register, after __sigaction so it is visible in the + // crashing register state. + if (ret == -1 && errno == ENOTSUP && sig != 0) { + CRSetCrashLogMessage("sigaction on fatal signals is not supported"); + __builtin_trap(); + } +#endif + return ret; } // XXX diff --git a/tests/Libc.plist b/tests/Libc.plist new file mode 100644 index 0000000..8f724e5 --- /dev/null +++ b/tests/Libc.plist @@ -0,0 +1,28 @@ + + + + + BATSConfigVersion + 0.1.0 + Project + Libc + Tests + + + Arch + platform-native + AsRoot + + Command + + /usr/local/bin/bsdtesttool + Libc + + TestName + Libc + WorkingDirectory + /tmp + + + + diff --git a/tests/install.sh b/tests/install.sh new file mode 100644 index 0000000..fcdfec0 --- /dev/null +++ b/tests/install.sh @@ -0,0 +1,104 @@ +#!/bin/bash + +## Install results in / +noinstall=0 +train= + +while [ $# -gt 0 ]; do + if [ "${1/=*/}" = "--build" ]; then + build="${1/*=/}" + elif [ "${1/=*/}" = "--train" ]; then + train="${1/*=/}" + elif [ "${1/=*/}" = "--sdk" ]; then + sdk="${1/*=/}" + elif [ "$1" = "--noinstall" ]; then + noinstall=1 + elif [ "${1/=*/}" = "--arch" ]; then + arch="${1/*=/}" + elif [ "$1" = "--nightlies" ]; then + nightlies=1 + else + echo "install: [--sdk=macosx10.6] [--build=10A432] [--train=SnowLeopard] [--noinstall] [--arch=armv7s] [--nightlies]" 2>&1 + exit 1 + fi + shift +done + +if [ $EUID -ne 0 ]; then + echo "install: script must be run as root" 2>&1 + exit 1 +fi + +if [ -n "$sdk" ]; then + export SDKROOT="$(xcodebuild -version -sdk "$sdk" Path)" +fi + +if [ -n "$nightlies" ]; then + export BSDTESTS_NIGHTLIES=1 + export TMPDIR="/tmp" +fi + +if [ -z "$build" ]; then + if [ -n "$SDKROOT" ]; then + build="$(xcodebuild -version -sdk "$SDKROOT" ProductBuildVersion)" + else + build="$(sw_vers -buildVersion)" + fi +fi + +# if [ -z "$train" -a -n "$SDKROOT" -a -d /Volumes/Build/Views ]; then +# train="$(find /Volumes/Build/Views/*/Updates -maxdepth 1 -type d -name "*$build" | \ +# sed "s#.*/\\(.*\\)$build#\\1#")" +# fi +# if [ -z "$train" ]; then +# train="$(~rc/bin/getTrainForBuild --quiet "$build")" +# fi + +if [ -n "$BSDTESTS_NIGHTLIES" ]; then + ROOTS="$(mktemp -d -t "LibcTestsRoots.$train$build")" +else + ROOTS=/var/tmp/LibcTestsRoots."$train$build" +fi +: ${DSTROOT:="$ROOTS/LibcTests~dst"} + +if [ -z "$DSTROOT" -o "$DSTROOT" = "/" ]; then + echo "install: DSTROOT = \"$DSTROOT\"" 2>&1 + exit 1 +fi +TESTROOTS="$ROOTS/libctest.roots/bsdtests.libc" + +# Building for another version implies noinstall +if [ -n "$SDKROOT" -o "$build" != "$(sw_vers -buildVersion)" ]; then + noinstall=1 +fi + +if [ -n "$arch" ]; then + ARCHS="$arch" +else + ARCHS="$(xcrun lipo -detailed_info "$SDKROOT"/usr/lib/libSystem.dylib | \ + awk '/^architecture /'"$([ -z "$SDKROOT" ] && \ + echo ' && !/armv6$/')"' {sub("ppc7400", "ppc"); ORS=" "; print $2}')" +fi + +set -ex +mkdir -p "$ROOTS" +if [ -z "$BSDTESTS_NIGHTLIES" ]; then + rm -rf "$(dirname $TESTROOTS)" +fi + +xcodebuild install ARCHS="$ARCHS" \ + SYMROOT="$TESTROOTS~sym" OBJROOT="$TESTROOTS~obj" DSTROOT="$TESTROOTS~dst" \ + $([ -n "$SDKROOT" ] && echo "SDKROOT=$SDKROOT") + +if [ $noinstall -eq 0 ]; then + darwinup install "$TESTROOTS~dst" +else + mkdir -p "$DSTROOT" + ditto "$TESTROOTS~dst" "$DSTROOT" + set - + echo "TEST_ROOT: $DSTROOT" + # if [ -n "$SDKROOT" ]; then + # mkdir -p "$DSTROOT"/usr/share/dict + # ln -f {,"$DSTROOT"}/usr/share/dict/words + # fi +fi diff --git a/tests/libctest.xcconfig b/tests/libctest.xcconfig new file mode 100644 index 0000000..47a4b9a --- /dev/null +++ b/tests/libctest.xcconfig @@ -0,0 +1,18 @@ +#include "/Makefiles/CoreOS/Xcode/BSD.xcconfig" +ARCHS = $(ARCHS_STANDARD_32_64_BIT) +SUPPORTED_PLATFORMS = macosx iphoneos +DWARF_DSYM_FILE_SHOULD_ACCOMPANY_PRODUCT=YES +GCC_DYNAMIC_NO_PIC = NO +GCC_WARN_SHADOW = YES +GCC_TREAT_WARNINGS_AS_ERRORS = YES +WARNING_CFLAGS = -Wall -Wextra -Wno-shorten-64-to-32 +PREBINDING = NO +PREFIX = /usr/local +BINDIR = $PREFIX/bin +DATDIR = $PREFIX/share +TESTDIR = $DATDIR/bsdtests +INSTALL_PATH = $(TESTDIR)/Libc +SKIP_INSTALL = NO +HEADER_SEARCH_PATHS = $(PREFIX)/include +GCC_PREPROCESSOR_DEFINITIONS[sdk=macosx10.6] = $(value) __MAC_10_7=__MAC_10_6 __AVAILABILITY_INTERNAL__MAC_10_7=__AVAILABILITY_INTERNAL__MAC_10_6 +GCC_C_LANGUAGE_STANDARD = gnu99 diff --git a/tests/libctest.xcodeproj/project.pbxproj b/tests/libctest.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c2886ed --- /dev/null +++ b/tests/libctest.xcodeproj/project.pbxproj @@ -0,0 +1,582 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXAggregateTarget section */ + DFA94CCF109B8283001AC544 /* runtests */ = { + isa = PBXAggregateTarget; + buildConfigurationList = DFA94CD8109B82F2001AC544 /* Build configuration list for PBXAggregateTarget "runtests" */; + buildPhases = ( + DF9FEC6610B30F1000D2A9DC /* Replacements */, + E4F711E210C67E6400D6C029 /* CopyFiles */, + ); + dependencies = ( + ); + name = runtests; + productName = runtests; + }; + E4D01DC5108E708E00FAA873 /* all */ = { + isa = PBXAggregateTarget; + buildConfigurationList = E4D01E08108E70D400FAA873 /* Build configuration list for PBXAggregateTarget "all" */; + buildPhases = ( + 4D791FFD1A2D45AB002616F3 /* CopyFiles */, + ); + dependencies = ( + E423CC2D199C5B2F00A527F4 /* PBXTargetDependency */, + DFA94CD5109B82B9001AC544 /* PBXTargetDependency */, + FC2897D6127FCDB400B86C0C /* PBXTargetDependency */, + C99475E2159258E0009FC2A7 /* PBXTargetDependency */, + ); + name = all; + productName = all; + }; + E4D02077108EA00500FAA873 /* test */ = { + isa = PBXAggregateTarget; + buildConfigurationList = E4D0207E108EA04D00FAA873 /* Build configuration list for PBXAggregateTarget "test" */; + buildPhases = ( + E4D02076108EA00500FAA873 /* Run Tests */, + ); + dependencies = ( + E4D020C9108FA46C00FAA873 /* PBXTargetDependency */, + ); + name = test; + productName = test; + }; +/* End PBXAggregateTarget section */ + +/* Begin PBXBuildFile section */ + 4D791FFF1A2D4611002616F3 /* Libc.plist in CopyFiles */ = {isa = PBXBuildFile; fileRef = 4D791FFC1A2D3D5F002616F3 /* Libc.plist */; }; + 925E7FE419E8901800AC7889 /* runtests in CopyFiles */ = {isa = PBXBuildFile; fileRef = E4F712A310C67FD800D6C029 /* runtests */; }; + 9268CAC019E4D2E30058F6A6 /* libbsdtests.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9268CABD19E4D2AD0058F6A6 /* libbsdtests.dylib */; }; + 9268CAC719E4D30D0058F6A6 /* libbsdtests.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9268CABD19E4D2AD0058F6A6 /* libbsdtests.dylib */; }; + 9268CAC919E4D31D0058F6A6 /* libbsdtests.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 9268CABD19E4D2AD0058F6A6 /* libbsdtests.dylib */; }; + C99475C715924B07009FC2A7 /* strlcat.c in Sources */ = {isa = PBXBuildFile; fileRef = C99475C615924B07009FC2A7 /* strlcat.c */; }; + E423CC2B199C5B2100A527F4 /* psort.c in Sources */ = {isa = PBXBuildFile; fileRef = E423CC2A199C5B2100A527F4 /* psort.c */; }; + E423CC43199C67C800A527F4 /* test_list.txt in CopyFiles */ = {isa = PBXBuildFile; fileRef = E423CC42199C67C800A527F4 /* test_list.txt */; }; + FC2897D4127FCDA800B86C0C /* nxheap.c in Sources */ = {isa = PBXBuildFile; fileRef = FC2897D3127FCDA800B86C0C /* nxheap.c */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + C99475E1159258E0009FC2A7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = C99475A415924ADA009FC2A7; + remoteInfo = strlcat; + }; + DFA94CD4109B82B9001AC544 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = DFA94CCF109B8283001AC544; + remoteInfo = runtests; + }; + E423CC2C199C5B2F00A527F4 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = E423CC17199C5AC200A527F4; + remoteInfo = psort; + }; + E4D020C8108FA46C00FAA873 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = E4D01DC5108E708E00FAA873; + remoteInfo = all; + }; + FC2897D5127FCDB400B86C0C /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */; + proxyType = 1; + remoteGlobalIDString = FC2897C7127FCD4500B86C0C; + remoteInfo = nxheap; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXCopyFilesBuildPhase section */ + 4D791FFD1A2D45AB002616F3 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 8; + dstPath = /AppleInternal/CoreOS/BATS/unit_tests; + dstSubfolderSpec = 0; + files = ( + 4D791FFF1A2D4611002616F3 /* Libc.plist in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 1; + }; + E4F711E210C67E6400D6C029 /* CopyFiles */ = { + isa = PBXCopyFilesBuildPhase; + buildActionMask = 12; + dstPath = ""; + dstSubfolderSpec = 1; + files = ( + 925E7FE419E8901800AC7889 /* runtests in CopyFiles */, + E423CC43199C67C800A527F4 /* test_list.txt in CopyFiles */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXCopyFilesBuildPhase section */ + +/* Begin PBXFileReference section */ + 4D791FFC1A2D3D5F002616F3 /* Libc.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Libc.plist; sourceTree = ""; }; + 9268CABD19E4D2AD0058F6A6 /* libbsdtests.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libbsdtests.dylib; path = usr/local/lib/libbsdtests.dylib; sourceTree = SDKROOT; }; + C99475AF15924ADA009FC2A7 /* strlcat */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = strlcat; sourceTree = BUILT_PRODUCTS_DIR; }; + C99475C615924B07009FC2A7 /* strlcat.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = strlcat.c; sourceTree = ""; }; + DFA94CCD109B8209001AC544 /* runtests */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = runtests; sourceTree = ""; }; + E40F2D021098D9400010F089 /* libctest.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = libctest.xcconfig; sourceTree = ""; }; + E423CC22199C5AC200A527F4 /* psort */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = psort; sourceTree = BUILT_PRODUCTS_DIR; }; + E423CC2A199C5B2100A527F4 /* psort.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = psort.c; sourceTree = ""; }; + E423CC42199C67C800A527F4 /* test_list.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = test_list.txt; sourceTree = ""; }; + E4F712A310C67FD800D6C029 /* runtests */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = runtests; sourceTree = PROJECT_TEMP_DIR; }; + FC2897C8127FCD4500B86C0C /* nxheap */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = nxheap; sourceTree = BUILT_PRODUCTS_DIR; }; + FC2897D3127FCDA800B86C0C /* nxheap.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nxheap.c; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + C99475A915924ADA009FC2A7 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9268CAC919E4D31D0058F6A6 /* libbsdtests.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E423CC1C199C5AC200A527F4 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9268CAC019E4D2E30058F6A6 /* libbsdtests.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FC2897C6127FCD4500B86C0C /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 9268CAC719E4D30D0058F6A6 /* libbsdtests.dylib in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 08FB7794FE84155DC02AAC07 /* libdispatch */ = { + isa = PBXGroup; + children = ( + E40F2D021098D9400010F089 /* libctest.xcconfig */, + DFA94CCD109B8209001AC544 /* runtests */, + E423CC42199C67C800A527F4 /* test_list.txt */, + E4EB36E31088F0DD00C33AD4 /* Test Sources */, + E44A77051098E9F00024377F /* Other Sources */, + 4D791FFE1A2D45E0002616F3 /* BATS */, + 1AB674ADFE9D54B511CA2CBB /* Products */, + ); + indentWidth = 4; + name = libdispatch; + sourceTree = ""; + tabWidth = 4; + usesTabs = 1; + }; + 1AB674ADFE9D54B511CA2CBB /* Products */ = { + isa = PBXGroup; + children = ( + E4F712A310C67FD800D6C029 /* runtests */, + FC2897C8127FCD4500B86C0C /* nxheap */, + C99475AF15924ADA009FC2A7 /* strlcat */, + E423CC22199C5AC200A527F4 /* psort */, + ); + name = Products; + sourceTree = ""; + }; + 4D791FFE1A2D45E0002616F3 /* BATS */ = { + isa = PBXGroup; + children = ( + 4D791FFC1A2D3D5F002616F3 /* Libc.plist */, + ); + name = BATS; + sourceTree = ""; + }; + E44A77051098E9F00024377F /* Other Sources */ = { + isa = PBXGroup; + children = ( + 9268CABD19E4D2AD0058F6A6 /* libbsdtests.dylib */, + ); + name = "Other Sources"; + sourceTree = ""; + }; + E4EB36E31088F0DD00C33AD4 /* Test Sources */ = { + isa = PBXGroup; + children = ( + FC2897D3127FCDA800B86C0C /* nxheap.c */, + C99475C615924B07009FC2A7 /* strlcat.c */, + E423CC2A199C5B2100A527F4 /* psort.c */, + ); + name = "Test Sources"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXNativeTarget section */ + C99475A415924ADA009FC2A7 /* strlcat */ = { + isa = PBXNativeTarget; + buildConfigurationList = C99475AB15924ADA009FC2A7 /* Build configuration list for PBXNativeTarget "strlcat" */; + buildPhases = ( + C99475A715924ADA009FC2A7 /* Sources */, + C99475A915924ADA009FC2A7 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = strlcat; + productName = strlcat; + productReference = C99475AF15924ADA009FC2A7 /* strlcat */; + productType = "com.apple.product-type.tool"; + }; + E423CC17199C5AC200A527F4 /* psort */ = { + isa = PBXNativeTarget; + buildConfigurationList = E423CC1E199C5AC200A527F4 /* Build configuration list for PBXNativeTarget "psort" */; + buildPhases = ( + E423CC1A199C5AC200A527F4 /* Sources */, + E423CC1C199C5AC200A527F4 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = psort; + productName = psort; + productReference = E423CC22199C5AC200A527F4 /* psort */; + productType = "com.apple.product-type.tool"; + }; + FC2897C7127FCD4500B86C0C /* nxheap */ = { + isa = PBXNativeTarget; + buildConfigurationList = FC2897D2127FCD9B00B86C0C /* Build configuration list for PBXNativeTarget "nxheap" */; + buildPhases = ( + FC2897C5127FCD4500B86C0C /* Sources */, + FC2897C6127FCD4500B86C0C /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = nxheap; + productName = nxheap; + productReference = FC2897C8127FCD4500B86C0C /* nxheap */; + productType = "com.apple.product-type.tool"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + 08FB7793FE84155DC02AAC07 /* Project object */ = { + isa = PBXProject; + attributes = { + BuildIndependentTargetsInParallel = YES; + }; + buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "libctest" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + English, + Japanese, + French, + German, + ); + mainGroup = 08FB7794FE84155DC02AAC07 /* libdispatch */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + E4D01DC5108E708E00FAA873 /* all */, + E4D02077108EA00500FAA873 /* test */, + DFA94CCF109B8283001AC544 /* runtests */, + FC2897C7127FCD4500B86C0C /* nxheap */, + C99475A415924ADA009FC2A7 /* strlcat */, + E423CC17199C5AC200A527F4 /* psort */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXShellScriptBuildPhase section */ + DF9FEC6610B30F1000D2A9DC /* Replacements */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + "$(PROJECT_DIR)/runtests", + ); + name = Replacements; + outputPaths = ( + "$(PROJECT_TEMP_DIR)/runtests", + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = "/bin/bash -e"; + shellScript = "/usr/bin/sed -e \"s,%%BINDIR%%,$BINDIR,\" \"$SCRIPT_INPUT_FILE_0\" > \"$SCRIPT_OUTPUT_FILE_0\"\n/bin/chmod 755 \"$SCRIPT_OUTPUT_FILE_0\""; + showEnvVarsInLog = 0; + }; + E4D02076108EA00500FAA873 /* Run Tests */ = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + name = "Run Tests"; + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/bash; + shellScript = "\"${TARGET_BUILD_DIR}\"/runtests"; + showEnvVarsInLog = 0; + }; +/* End PBXShellScriptBuildPhase section */ + +/* Begin PBXSourcesBuildPhase section */ + C99475A715924ADA009FC2A7 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + C99475C715924B07009FC2A7 /* strlcat.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E423CC1A199C5AC200A527F4 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + E423CC2B199C5B2100A527F4 /* psort.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FC2897C5127FCD4500B86C0C /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + FC2897D4127FCDA800B86C0C /* nxheap.c in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + C99475E2159258E0009FC2A7 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = C99475A415924ADA009FC2A7 /* strlcat */; + targetProxy = C99475E1159258E0009FC2A7 /* PBXContainerItemProxy */; + }; + DFA94CD5109B82B9001AC544 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = DFA94CCF109B8283001AC544 /* runtests */; + targetProxy = DFA94CD4109B82B9001AC544 /* PBXContainerItemProxy */; + }; + E423CC2D199C5B2F00A527F4 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = E423CC17199C5AC200A527F4 /* psort */; + targetProxy = E423CC2C199C5B2F00A527F4 /* PBXContainerItemProxy */; + }; + E4D020C9108FA46C00FAA873 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = E4D01DC5108E708E00FAA873 /* all */; + targetProxy = E4D020C8108FA46C00FAA873 /* PBXContainerItemProxy */; + }; + FC2897D6127FCDB400B86C0C /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + target = FC2897C7127FCD4500B86C0C /* nxheap */; + targetProxy = FC2897D5127FCDB400B86C0C /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 1DEB91F108733DB70010E9CD /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + GCC_OPTIMIZATION_LEVEL = s; + }; + name = Release; + }; + C99475AC15924ADA009FC2A7 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + C99475AD15924ADA009FC2A7 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + DFA94CD0109B8283001AC544 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + PRODUCT_NAME = runtests; + }; + name = Release; + }; + DFA94CD1109B8283001AC544 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + PRODUCT_NAME = runtests; + }; + name = Debug; + }; + E423CC1F199C5AC200A527F4 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + E423CC20199C5AC200A527F4 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; + E4D01DC6108E708E00FAA873 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + PRODUCT_NAME = all; + }; + name = Release; + }; + E4D01DC7108E708E00FAA873 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + PRODUCT_NAME = all; + }; + name = Debug; + }; + E4D02078108EA00500FAA873 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + PRODUCT_NAME = test; + }; + name = Release; + }; + E4D02079108EA00500FAA873 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + PRODUCT_NAME = test; + }; + name = Debug; + }; + E4EB382D1089033000C33AD4 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + DEBUG_INFORMATION_FORMAT = dwarf; + GCC_OPTIMIZATION_LEVEL = 0; + ONLY_ACTIVE_ARCH = YES; + OTHER_LDFLAGS = "-lobjc"; + "OTHER_LDFLAGS[sdk=iphoneos*][arch=*]" = ""; + }; + name = Debug; + }; + FC2897CA127FCD4800B86C0C /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Release; + }; + FC2897CB127FCD4800B86C0C /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = E40F2D021098D9400010F089 /* libctest.xcconfig */; + buildSettings = { + PRODUCT_NAME = "$(TARGET_NAME)"; + }; + name = Debug; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "libctest" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB91F108733DB70010E9CD /* Release */, + E4EB382D1089033000C33AD4 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + C99475AB15924ADA009FC2A7 /* Build configuration list for PBXNativeTarget "strlcat" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C99475AC15924ADA009FC2A7 /* Release */, + C99475AD15924ADA009FC2A7 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + DFA94CD8109B82F2001AC544 /* Build configuration list for PBXAggregateTarget "runtests" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + DFA94CD0109B8283001AC544 /* Release */, + DFA94CD1109B8283001AC544 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E423CC1E199C5AC200A527F4 /* Build configuration list for PBXNativeTarget "psort" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E423CC1F199C5AC200A527F4 /* Release */, + E423CC20199C5AC200A527F4 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E4D01E08108E70D400FAA873 /* Build configuration list for PBXAggregateTarget "all" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E4D01DC6108E708E00FAA873 /* Release */, + E4D01DC7108E708E00FAA873 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + E4D0207E108EA04D00FAA873 /* Build configuration list for PBXAggregateTarget "test" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + E4D02078108EA00500FAA873 /* Release */, + E4D02079108EA00500FAA873 /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + FC2897D2127FCD9B00B86C0C /* Build configuration list for PBXNativeTarget "nxheap" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FC2897CA127FCD4800B86C0C /* Release */, + FC2897CB127FCD4800B86C0C /* Debug */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = 08FB7793FE84155DC02AAC07 /* Project object */; +} diff --git a/tests/nxheap.c b/tests/nxheap.c new file mode 100644 index 0000000..eb521e8 --- /dev/null +++ b/tests/nxheap.c @@ -0,0 +1,53 @@ +#include +#include +#include + +char *heap; +volatile int pass; +sigjmp_buf jbuf; + +void +action(int signo, struct __siginfo *info, void *uap __attribute__((unused))) +{ + if (info) { + pass = (signo == SIGBUS && info->si_addr == heap); + } + return siglongjmp(jbuf, 0); +} + +int +main(void) +{ + int ret; + + struct sigaction sa = { + .__sigaction_u.__sa_sigaction = action, + .sa_flags = SA_SIGINFO, + }; + + test_start("Non-executable heap"); + + ret = sigaction(SIGBUS, &sa, NULL); + assert(ret == 0); + test_long("sigaction", ret, 0); + + if (sigsetjmp(jbuf, 0)) { + // PASS + test_long("SIGBUS", 1, 1); + test_stop(); + return EXIT_FAILURE; + } + + heap = malloc(1); + test_ptr_notnull("malloc", heap); + + *heap = 0xc3; // retq + ((void (*)(void))heap)(); // call *%eax + + // FAIL + test_long("SIGBUS", 0, 1); + + test_stop(); + + return EXIT_SUCCESS; +} diff --git a/tests/psort.c b/tests/psort.c new file mode 100644 index 0000000..3dc421c --- /dev/null +++ b/tests/psort.c @@ -0,0 +1,73 @@ +#include +#include +#include + +#include + +typedef unsigned long T; + +static int +comparT(const void* a, const void* b) { + const T x = *(T*)a, y = *(T*)b; + return x < y ? -1 : x > y ? 1 : 0; +} + +static void +test_psort(void) +{ + struct timeval tv_start, tv_stop; + struct rusage ru_start, ru_stop; + unsigned long pwt, put, qwt, qut; + + T *buf, *sorted; + const size_t nel = 20480000; + const size_t width = sizeof(T), bufsiz = nel * width; + + buf = malloc(bufsiz); + arc4random_buf(buf, bufsiz); + sorted = malloc(bufsiz); + memcpy(sorted, buf, bufsiz); + + getrusage(RUSAGE_SELF, &ru_start); + gettimeofday(&tv_start, NULL); + psort(sorted, nel, width, comparT); + gettimeofday(&tv_stop, NULL); + getrusage(RUSAGE_SELF, &ru_stop); + + pwt = ((uint64_t)tv_stop.tv_sec * USEC_PER_SEC + tv_stop.tv_usec) - + ((uint64_t)tv_start.tv_sec * USEC_PER_SEC + tv_start.tv_usec); + put = ((uint64_t)ru_stop.ru_utime.tv_sec * USEC_PER_SEC + ru_stop.ru_utime.tv_usec) - + ((uint64_t)ru_start.ru_utime.tv_sec * USEC_PER_SEC + ru_start.ru_utime.tv_usec); + + getrusage(RUSAGE_SELF, &ru_start); + gettimeofday(&tv_start, NULL); + qsort(buf, nel, width, comparT); + gettimeofday(&tv_stop, NULL); + getrusage(RUSAGE_SELF, &ru_stop); + + qwt = ((uint64_t)tv_stop.tv_sec * USEC_PER_SEC + tv_stop.tv_usec) - + ((uint64_t)tv_start.tv_sec * USEC_PER_SEC + tv_start.tv_usec); + qut = ((uint64_t)ru_stop.ru_utime.tv_sec * USEC_PER_SEC + ru_stop.ru_utime.tv_usec) - + ((uint64_t)ru_start.ru_utime.tv_sec * USEC_PER_SEC + ru_start.ru_utime.tv_usec); + + bool match = true; + for (size_t i = 0; i < nel; i++) { + if (!(match = (buf[i] == sorted[i]))) break; + } + + free(sorted); + free(buf); + + test_double_less_than_or_equal("psort/qsort wall time", (double)pwt/qwt, 1.0); + test_double_less_than_or_equal("qsort/psort user time", (double)qut/put, 1.0); + test_long("psort matches qsort", match, true); +} + +int main(void) +{ + test_start("psort"); + test_psort(); + test_stop(); + + return 0; +} diff --git a/tests/regex/README b/tests/regex/README new file mode 100644 index 0000000..b8ce42b --- /dev/null +++ b/tests/regex/README @@ -0,0 +1,86 @@ +########################################################################### +# The testregex tests are not wired up yet +########################################################################### + +The AT&T testregex program is available from: + +http://www2.research.att.com/~astopen/testregex/ + +The so-called "testregex.c 2004-05-31" has a 2010 "what" string, so the +versioning is weird. + +The original source code downloaded from the above URL is testregex.c.orig. +testregex.c has a few modification, for example, to support our regex's +"enhanced" mode, as well as pausing if the MallocStackLogging environment +variable is set. + +The data files are in the datafiles subdirectory. Several are part of the +testregex distribution: + +basic.dat +categorize.dat +nullsubexpr.dat +leftassoc.dat (not included, since our implementation is right-associative) +rightassoc.dat +forcedassoc.dat +repetition.dat + +The rest are from radars, adapted from the conformance tests, collected from +internet sources or just created to test certain features. + +Easy to compile: + +% cc testregex.c -o testregex + +and easy to run: + +% testregex datafiles/union.dat +TEST testregex union (AT&T Research) 2010-06-10 +NOTE regex +NOTE unsupported: AUGMENTED,SHELL,CLASS_ESCAPE,COMMENT,DELIMITED,DISCIPLINE,ESCAPE,LEFT,LENIENT,MULTIPLE,MULTIREF,MUSTDELIM,NULL,RIGHT,SHELL_DOT,SHELL_ESCAPED,SHELL_GROUP,SHELL_PATH,SPAN,regnexec,regsubcomp,redecomp +TEST testregex union, 8 tests, 0 errors + +(Some of the locale tests print extra NOTE lines when it switches into a +different locale.) + +All datafile should run without error, except: + +regex-posix-unittest-1.1.dat +14189743.dat + +The first has 8 failures: + +% testregex datafiles/regex-posix-unittest-1.1.dat +TEST testregex regex-posix-unittest-1.1 (AT&T Research) 2010-06-10 +NOTE regex +NOTE unsupported: AUGMENTED,SHELL,CLASS_ESCAPE,COMMENT,DELIMITED,DISCIPLINE,ESCAPE,LEFT,LENIENT,MULTIPLE,MULTIREF,MUSTDELIM,NULL,RIGHT,SHELL_DOT,SHELL_ESCAPED,SHELL_GROUP,SHELL_PATH,SPAN,regnexec,regsubcomp,redecomp +datafiles/regex-posix-unittest-1.1.dat:52: (^){0,3} versus a ERE failed: match was: (0,0)(?,?) expected: (0,0)(0,0) +datafiles/regex-posix-unittest-1.1.dat:58: s(^|())e versus searchme ERE regexec failed: expected: (0,2)(1,1)(1,1) +datafiles/regex-posix-unittest-1.1.dat:59: s(^|())e versus searchme ERE regexec failed: expected: (0,2)(1,1)(1,1) +datafiles/regex-posix-unittest-1.1.dat:61: s(^)?e versus searchme ERE regexec failed: expected: (0,2)(?,?) +datafiles/regex-posix-unittest-1.1.dat:66: ($)|() versus xxx ERE failed: match was: (3,3)(3,3)(?,?) expected: (0,0)(?,?)(0,0) +datafiles/regex-posix-unittest-1.1.dat:67: $()|^() versus ac\n ERE failed: match was: (4,4)(4,4)(?,?) expected: (0,0)(?,?)(0,0) +datafiles/regex-posix-unittest-1.1.dat:69: ($)?(.) versus __ ERE regexec failed: expected: (0,1)(?,?)(0,1) +datafiles/regex-posix-unittest-1.1.dat:73: (.|$){2,} versus xx ERE failed: match was: (0,2)(2,2) expected: (0,2)(1,2) +TEST testregex regex-posix-unittest-1.1, 149 tests, 8 errors + +This seems to have something to do with repetitions or alterations of ^ and $. +Doesn't look like I ever filed a radar. + +The second failure is from the corresponding radar: + +% testregex datafiles/14189743.dat +TEST testregex 14189743 (AT&T Research) 2010-06-10 +NOTE regex +NOTE unsupported: AUGMENTED,SHELL,CLASS_ESCAPE,COMMENT,DELIMITED,DISCIPLINE,ESCAPE,LEFT,LENIENT,MULTIPLE,MULTIREF,MUSTDELIM,NULL,RIGHT,SHELL_DOT,SHELL_ESCAPED,SHELL_GROUP,SHELL_PATH,SPAN,regnexec,regsubcomp,redecomp +datafiles/14189743.dat:2: ^((([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]\.)*)([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]$ versus nssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu ERE failed: match was: (0,70)(0,67)(0,67)(0,59)(67,69) expected: (0,1) +datafiles/14189743.dat:3: ^((([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]\.)*)([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]$ versus ssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu ERE failed: match was: (0,69)(0,66)(0,66)(0,64)(66,68) expected: (0,1) +datafiles/14189743.dat:4: ^((([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]\.)*)([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]$ versus snssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu ERE failed: match was: (0,68)(0,65)(0,65)(0,59)(65,67) expected: (0,1) +datafiles/14189743.dat:5: ^((([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]\.)*)([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]$ versus nssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu ERE failed: match was: (0,67)(0,64)(0,64)(0,62)(64,66) expected: (0,1) +datafiles/14189743.dat:6: ^((([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]\.)*)([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]$ versus ssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu ERE failed: match was: (0,66)(0,63)(0,63)(0,59)(63,65) expected: (0,1) +datafiles/14189743.dat:7: ^((([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]\.)*)([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]$ versus snssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu ERE failed: match was: (0,65)(0,62)(0,62)(0,60)(62,64) expected: (0,1) +datafiles/14189743.dat:8: ^((([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]\.)*)([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]$ versus nssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu ERE failed: match was: (0,64)(0,61)(0,61)(0,59)(61,63) expected: (0,1) +datafiles/14189743.dat:9: ^((([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]\.)*)([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]$ versus ssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu ERE failed: match was: (0,63)(0,60)(0,60)(0,58)(60,62) expected: (0,1) +TEST testregex 14189743, 8 tests, 8 errors + +Never had a chance to investigate. diff --git a/tests/regex/datafiles/11991275.dat b/tests/regex/datafiles/11991275.dat new file mode 100644 index 0000000..427df91 --- /dev/null +++ b/tests/regex/datafiles/11991275.dat @@ -0,0 +1,2 @@ +E$ [^={} \t]+ ={}\nfred (3,8) +En$ [^={} \t]+ ={}\nfred (4,8) diff --git a/tests/regex/datafiles/12221092.dat b/tests/regex/datafiles/12221092.dat new file mode 100644 index 0000000..2160988 --- /dev/null +++ b/tests/regex/datafiles/12221092.dat @@ -0,0 +1,2 @@ +E ^([[:space:]]*((((((tmpl:[^[:space:]]+)|(prot:((!?(tcp|udp|gre|(0|[1-9][0-9]*)))|(!?(icmp|icmp:(echo-reply|echo-request)))))|(length:((6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(-(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4}))?))|(state:(RELATED|ESTABLISHED|NEW|INVALID)(,(RELATED|ESTABLISHED|NEW|INVALID))*)|(mac:!?([[:xdigit:]][[:xdigit:]](:[[:xdigit:]][[:xdigit:]]){5}))|(limit:([[:digit:]]+/(second|minute|hour|day)(:[[:digit:]]+)?))))|(if:any:!?(any|lo|(((IP_NET_[1-9]?[0-9])|(REMOTE-NET))_DEV))))[[:space:]]+)+)?(!?((((6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(-(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4}))?)|(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(,(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})){1,14})|(any|(((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]))(/(3[0-2]|[1-2]?[0-9]))?|((IP_NET_[1-9]?[0-9])|(REMOTE-NET))|(IP_ROUTE_[1-9]?[0-9])|((((IP_NET_[1-9]?[0-9])|(REMOTE-NET))_IPADDR)|(LOCAL-VPN-IP|REMOTE-VPN-IP))|(@((([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?))|(([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?)(\.([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?))+))))(:(((6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(-(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4}))?)|(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(,(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})){1,14}))?)[[:space:]]+){0,2}(((ACCEPT|(MASQUERADE(:((6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(-(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4}))?))?))([[:space:]]+BIDIRECTIONAL)?|(SNAT:(((((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]))(-(((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])))?|((((IP_NET_[1-9]?[0-9])|(REMOTE-NET))_IPADDR)|(LOCAL-VPN-IP|REMOTE-VPN-IP))|(@((([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?))|(([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?)(\.([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?))+))))(:((6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(-(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4}))?))?))|(NETMAP:((((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]))|((((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]))/(3[0-2]|[1-2]?[0-9])))))([[:space:]]+(LOG(:[-_0-9A-Za-z]+)?))?))$ xxx NOMATCH +E ^([[:space:]]*((((((tmpl:[^[:space:]]+)|(prot:((!?(tcp|udp|gre|(0|[1-9][0-9]*)))|(!?(icmp|icmp:(echo-reply|echo-request)))))|(length:((6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(-(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4}))?))|(state:(RELATED|ESTABLISHED|NEW|INVALID)(,(RELATED|ESTABLISHED|NEW|INVALID))*)|(mac:!?([[:xdigit:]][[:xdigit:]](:[[:xdigit:]][[:xdigit:]]){5}))|(limit:([[:digit:]]+/(second|minute|hour|day)(:[[:digit:]]+)?))))|(if:any:!?(any|lo|(((IP_NET_[1-9]?[0-9])|(REMOTE-NET))_DEV))))[[:space:]]+)+)?(!?((((6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(-(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4}))?)|(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(,(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})){1,14})|(any|(((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]))(/(3[0-2]|[1-2]?[0-9]))?|((IP_NET_[1-9]?[0-9])|(REMOTE-NET))|(IP_ROUTE_[1-9]?[0-9])|((((IP_NET_[1-9]?[0-9])|(REMOTE-NET))_IPADDR)|(LOCAL-VPN-IP|REMOTE-VPN-IP))|(@((([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?))|(([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?)(\.([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?))+))))(:(((6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(-(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4}))?)|(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(,(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})){1,14}))?)[[:space:]]+){0,2}(((ACCEPT|(MASQUERADE(:((6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(-(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4}))?))?))([[:space:]]+BIDIRECTIONAL)?|(SNAT:(((((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]))(-(((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])))?|((((IP_NET_[1-9]?[0-9])|(REMOTE-NET))_IPADDR)|(LOCAL-VPN-IP|REMOTE-VPN-IP))|(@((([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?))|(([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?)(\.([0-9A-Za-z]([-0-9A-Za-z]{0,61}[0-9A-Za-z])?))+))))(:((6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4})(-(6553[0-5]|655[0-2][0-9]|65[0-4][0-9]{2}|6[0-4][0-9]{3}|[0-5][0-9]{4}|[0-9]{1,4}))?))?))|(NETMAP:((((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]))|((((1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5])\.){3}(1?[0-9]?[0-9]|2[0-4][0-9]|25[0-5]))/(3[0-2]|[1-2]?[0-9])))))([[:space:]]+(LOG(:[-_0-9A-Za-z]+)?))?))$ xxx NOMATCH diff --git a/tests/regex/datafiles/14189743.dat b/tests/regex/datafiles/14189743.dat new file mode 100644 index 0000000..daf7008 --- /dev/null +++ b/tests/regex/datafiles/14189743.dat @@ -0,0 +1,9 @@ +#Ei ^((([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]\.)*)([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]$ nssnssnssnssnssnssnssnssnssnssnssnssnss.edu (0,1) +Ei ^((([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]\.)*)([[:alnum:]_][[:alnum:]-]{0,61})?[[:alnum:]]$ nssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu (0,1) +Ei SAME ssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu (0,1) +Ei SAME snssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu (0,1) +Ei SAME nssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu (0,1) +Ei SAME ssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu (0,1) +Ei SAME snssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu (0,1) +Ei SAME nssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu (0,1) +Ei SAME ssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnssnss.edu (0,1) diff --git a/tests/regex/datafiles/2692334.dat b/tests/regex/datafiles/2692334.dat new file mode 100644 index 0000000..78f7f52 --- /dev/null +++ b/tests/regex/datafiles/2692334.dat @@ -0,0 +1,3 @@ +E .[.]*\.net$ x.net (0,5) +E .+\.net$ x.net (0,5) +E xnet x.net NOMATCH diff --git a/tests/regex/datafiles/3734286.dat b/tests/regex/datafiles/3734286.dat new file mode 100644 index 0000000..f74348f --- /dev/null +++ b/tests/regex/datafiles/3734286.dat @@ -0,0 +1,4 @@ +BE [^---] - NOMATCH +BE []-a] _ (0,1) +BE [--\] A (0,1) +BE [[=*=]][[=\=]][[=]=]][[===]][[...]][[:punct:]] *\]=., (0,6) diff --git a/tests/regex/datafiles/3835390.dat b/tests/regex/datafiles/3835390.dat new file mode 100644 index 0000000..74a6478 --- /dev/null +++ b/tests/regex/datafiles/3835390.dat @@ -0,0 +1,3 @@ +B \(ab*\)\{1,9\}\1 abbbabbabbbbb (0,10)(4,7) +B \(ab\(xyz\)*\)\(c\(d\)*\)\{0,3\} abcdcdc (0,7)(0,2)(?,?)(6,7)(?,?) +B \(^a\)\1 aabc (0,2)(0,1) diff --git a/tests/regex/datafiles/3936073.dat b/tests/regex/datafiles/3936073.dat new file mode 100644 index 0000000..026e81b --- /dev/null +++ b/tests/regex/datafiles/3936073.dat @@ -0,0 +1,4 @@ +B \(a\)\1\{1,2\} abc NOMATCH +B \(a\)\1\{1,2\} aabc (0,2)(0,1) +B \(a\)\1\{1,2\} aaabc (0,3)(0,1) +B \(a\)\1\{1,2\} aaaabc (0,3)(0,1) diff --git a/tests/regex/datafiles/5518392.dat b/tests/regex/datafiles/5518392.dat new file mode 100644 index 0000000..194fb0d --- /dev/null +++ b/tests/regex/datafiles/5518392.dat @@ -0,0 +1,12 @@ +E ((a)|(b))* ab (0,2)(1,2)(?,?)(1,2) +E ((a)|(b))+ ab (0,2)(1,2)(?,?)(1,2) +E ((a)|(b)){0,} ab (0,2)(1,2)(?,?)(1,2) +E ((a)|(b)){1,} ab (0,2)(1,2)(?,?)(1,2) +E ((a)|(b)){2} ab (0,2)(1,2)(?,?)(1,2) +E ((a)|(b)){2,} ab (0,2)(1,2)(?,?)(1,2) +E ((a)|(b)){0,2} ab (0,2)(1,2)(?,?)(1,2) +E ((a)|(b)){1,2} ab (0,2)(1,2)(?,?)(1,2) +E ((a)|(b)){2,2} ab (0,2)(1,2)(?,?)(1,2) +E ((a)|(b)){0,10} ab (0,2)(1,2)(?,?)(1,2) +E ((a)|(b)){1,10} ab (0,2)(1,2)(?,?)(1,2) +E ((a)|(b)){2,10} ab (0,2)(1,2)(?,?)(1,2) diff --git a/tests/regex/datafiles/5549951.dat b/tests/regex/datafiles/5549951.dat new file mode 100644 index 0000000..f1b4e3f --- /dev/null +++ b/tests/regex/datafiles/5549951.dat @@ -0,0 +1,3 @@ +{C en_US.UTF-8 +B$ .*GUI \\([0-9.]\\{3,\\}\\).* GUI 1.21 (4835), \xc2\xa9 Foo (0,23)(4,8) +} diff --git a/tests/regex/datafiles/6440240.dat b/tests/regex/datafiles/6440240.dat new file mode 100644 index 0000000..5ca4c31 --- /dev/null +++ b/tests/regex/datafiles/6440240.dat @@ -0,0 +1,3 @@ +{C en_US.UTF-8 +B$ .*\\(.\\{2\\}\\) \xe9\x9b\xaa\xe8\xb1\xb9 (0,6)(0,6) +} diff --git a/tests/regex/datafiles/6481680.dat b/tests/regex/datafiles/6481680.dat new file mode 100644 index 0000000..e8912cd --- /dev/null +++ b/tests/regex/datafiles/6481680.dat @@ -0,0 +1,2 @@ +E (X)(aba|b|ab)(aba|b|ab)(Y)(aba|b|ab)*(Z) XababaYababaZ (0,13)(0,1)(1,3)(3,6)(6,7)(9,12)(12,13) +E (aba|ab|a)* ababa (0,5)(2,5) diff --git a/tests/regex/datafiles/6487297.dat b/tests/regex/datafiles/6487297.dat new file mode 100644 index 0000000..a44c99a --- /dev/null +++ b/tests/regex/datafiles/6487297.dat @@ -0,0 +1,3 @@ +E (a)?(ab)?(b)? ab (0,2)(0,1)(?,?)(1,2) +E (a)?((ab)?(b)?) ab (0,2)(0,1)(1,2)(?,?)(1,2) +E ((a)?(ab)?)(b)? ab (0,2)(0,2)(?,?)(0,2)(?,?) diff --git a/tests/regex/datafiles/6487583.dat b/tests/regex/datafiles/6487583.dat new file mode 100644 index 0000000..b94e3ae --- /dev/null +++ b/tests/regex/datafiles/6487583.dat @@ -0,0 +1,4 @@ +E (()|.)(b) ab (0,2)(0,1)(?,?)(1,2) +E (()|.)(.) ab (0,2)(0,1)(?,?)(1,2) +E (.|())(b) ab (0,2)(0,1)(?,?)(1,2) +E (.|())(.) ab (0,2)(0,1)(?,?)(1,2) diff --git a/tests/regex/datafiles/ISO8859-1.dat b/tests/regex/datafiles/ISO8859-1.dat new file mode 100644 index 0000000..02ea54c --- /dev/null +++ b/tests/regex/datafiles/ISO8859-1.dat @@ -0,0 +1,9 @@ +{C en_US.ISO8859-1 +E$ [\xc0-\xd6] abc NOMATCH +E$ [\xc0-\xd6] \xe1 NOMATCH +Ei$ [\xc0-\xd6] \xe1 (0,1) +E$ [[:lower:]] \xe1 (0,1) +Ei$ [[:lower:]] \xe1 (0,1) +E$ [[:upper:]] \xe1 NOMATCH +Ei$ [[:upper:]] \xe1 (0,1) +} diff --git a/tests/regex/datafiles/OpenBSD-enhanced.dat b/tests/regex/datafiles/OpenBSD-enhanced.dat new file mode 100644 index 0000000..3ff687a --- /dev/null +++ b/tests/regex/datafiles/OpenBSD-enhanced.dat @@ -0,0 +1,3 @@ +BEH a\bc abc NOMATCH +BEH \bab abc (0,2) +EH a{1}? abc (0,1) diff --git a/tests/regex/datafiles/OpenBSD.dat b/tests/regex/datafiles/OpenBSD.dat new file mode 100644 index 0000000..41c6d4e --- /dev/null +++ b/tests/regex/datafiles/OpenBSD.dat @@ -0,0 +1,74 @@ +E a( abd EPAREN +B a\( abd EPAREN +E | x EMPTY +B * x NOMATCH +E * x BADRPT +E + x BADRPT +E ? x BADRPT +E |a x EMPTY +E a(b+|((c)*))+d abd (0,3)(1,2)(?,?)(?,?) +E a(b+|((c)*))+d abcd (0,4)(2,3)(2,3)(2,3) +BE NULL NULL EMPTY +E ab| NULL EMPTY +E ab| NULL EMPTY +E (a|)b NULL EMPTY +E (?a) NULL BADRPT +B \(\{1\}a\) NULL BADRPT +E ^* NULL BADRPT +B ^* * (0,1) +E ^+ NULL BADRPT +E ^? NULL BADRPT +E ^{1} NULL BADRPT +B ^\{1\} NULL BADRPT +BE a\bc abc (0,3) +BE \bab abc NOMATCH +BE { { (0,1) +B \{ { EBRACE +B ^\{ abc EBRACE +B ^\{2\} abc BADRPT +BE ^{ { (0,1) +E ^{2} abc BADRPT +B {abc {abc (0,4) +B \{abc {abc BADBR +BE {abc {abc (0,4) +B {1 {1 (0,2) +B \{1 {1 EBRACE +E {1 {1 EBRACE +B a{b a{b (0,3) +B a\{b a{b BADBR +BE a{b a{b (0,3) +B a\{1 abc EBRACE +E a{1 abc EBRACE +B a\{1a abc BADBR +E a{1a abc BADBR +B a\{,\} abc BADBR +BE a{,} a{,} (0,4) +B a\{,2\} abc BADBR +BE a{,2} a{,2} (0,5) +B a\{1,x abc BADBR +E a{1,x abc BADBR +B a\{1\}\{1\} abc BADRPT +E a{1}{1} abc BADRPT +B a*\{1\} abc BADRPT +E a*{1} abc BADRPT +E a+{1} abc BADRPT +E a?{1} abc BADRPT +E a{1}? abc BADRPT +E a*{1} abc BADRPT +BE a*{b} a{b} (0,4) +BE a[1- abc EBRACK +BE a[[. abc ECOLLATE +BE a[[.x abc ECOLLATE +BE a[[.x. abc ECOLLATE +BE a[[.one.]]b a1b (0,3) +BE a[[: abc ECTYPE +BE a[[:alpha abc ECTYPE +BE a[[= abc ECOLLATE +BE a[[=b abc ECOLLATE +BE a[[=b= abc ECOLLATE +BE a[[=one=]]b a1b (0,3) +E a(b|c?)+d abcd (0,4)(2,3) +E a(b|c){0,0}d ad (0,2)(?,?) +E a(b+|((c)*))+d abd (0,3)(1,2)(?,?)(?,?) +E SAME abcd (0,4)(2,3)(2,3)(2,3) +EL NULL a EMPTY diff --git a/tests/regex/datafiles/UTF-8.dat b/tests/regex/datafiles/UTF-8.dat new file mode 100644 index 0000000..db1d069 --- /dev/null +++ b/tests/regex/datafiles/UTF-8.dat @@ -0,0 +1,16 @@ +{C en_US.UTF-8 +E$ \xce\x88 \xce\x88 (0,2) +E$ \xce\x88 \xce\x89 NOMATCH +E$ [[:upper:]] \xce\x89 (0,2) +Ei$ [[:upper:]] \xce\x89 (0,2) +E$ [[:lower:]] \xce\x89 NOMATCH +Ei$ [[:lower:]] \xce\x89 (0,2) +E$ [\xce\x88-\xce\x8a] \xce\x89 (0,2) +E$ \xe1\xbc\x88 \xe1\xbc\x88 (0,3) +E$ \xe1\xbc\x88 \xe1\xbc\x89 NOMATCH +E$ [[:upper:]] \xe1\xbc\x89 (0,3) +Ei$ [[:upper:]] \xe1\xbc\x89 (0,3) +E$ [[:lower:]] \xe1\xbc\x89 NOMATCH +Ei$ [[:lower:]] \xe1\xbc\x89 (0,3) +E$ [\xe1\xbc\x88-\xe1\xbc\x8f] \xe1\xbc\x89 (0,3) +} diff --git a/tests/regex/datafiles/basic.dat b/tests/regex/datafiles/basic.dat new file mode 100644 index 0000000..5c50f37 --- /dev/null +++ b/tests/regex/datafiles/basic.dat @@ -0,0 +1,216 @@ +NOTE all standard compliant implementations should pass these : 2002-05-31 + +BE abracadabra$ abracadabracadabra (7,18) +BE a...b abababbb (2,7) +BE XXXXXX ..XXXXXX (2,8) +E \) () (1,2) +BE a] a]a (0,2) +B } } (0,1) +E \} } (0,1) +BE \] ] (0,1) +B ] ] (0,1) +E ] ] (0,1) +B { { (0,1) +B } } (0,1) +BE ^a ax (0,1) +BE \^a a^a (1,3) +BE a\^ a^ (0,2) +BE a$ aa (1,2) +BE a\$ a$ (0,2) +BE ^$ NULL (0,0) +E $^ NULL (0,0) +E a($) aa (1,2)(2,2) +E a*(^a) aa (0,1)(0,1) +E (..)*(...)* a (0,0) +E (..)*(...)* abcd (0,4)(2,4) +E (ab|a)(bc|c) abc (0,3)(0,2)(2,3) +E (ab)c|abc abc (0,3)(0,2) +E a{0}b ab (1,2) +E (a*)(b?)(b+)b{3} aaabbbbbbb (0,10)(0,3)(3,4)(4,7) +E (a*)(b{0,1})(b{1,})b{3} aaabbbbbbb (0,10)(0,3)(3,4)(4,7) +E a{9876543210} NULL BADBR +E ((a|a)|a) a (0,1)(0,1)(0,1) +E (a*)(a|aa) aaaa (0,4)(0,3)(3,4) +E a*(a.|aa) aaaa (0,4)(2,4) +E a(b)|c(d)|a(e)f aef (0,3)(?,?)(?,?)(1,2) +E (a|b)?.* b (0,1)(0,1) +E (a|b)c|a(b|c) ac (0,2)(0,1) +E (a|b)c|a(b|c) ab (0,2)(?,?)(1,2) +E (a|b)*c|(a|ab)*c abc (0,3)(1,2) +E (a|b)*c|(a|ab)*c xc (1,2) +E (.a|.b).*|.*(.a|.b) xa (0,2)(0,2) +E a?(ab|ba)ab abab (0,4)(0,2) +E a?(ac{0}b|ba)ab abab (0,4)(0,2) +E ab|abab abbabab (0,2) +E aba|bab|bba baaabbbaba (5,8) +E aba|bab baaabbbaba (6,9) +E (aa|aaa)*|(a|aaaaa) aa (0,2)(0,2) +E (a.|.a.)*|(a|.a...) aa (0,2)(0,2) +E ab|a xabc (1,3) +E ab|a xxabc (2,4) +Ei (Ab|cD)* aBcD (0,4)(2,4) +BE [^-] --a (2,3) +BE [a-]* --a (0,3) +BE [a-m-]* --amoma-- (0,4) +E :::1:::0:|:::1:1:0: :::0:::1:::1:::0: (8,17) +E :::1:::0:|:::1:1:1: :::0:::1:::1:::0: (8,17) +{E [[:upper:]] A (0,1) [[]] not supported +E [[:lower:]]+ `az{ (1,3) +E [[:upper:]]+ @AZ[ (1,3) +BE [[-]] [[-]] (2,4) +BE [[.NIL.]] NULL ECOLLATE +BE [[=aleph=]] NULL ECOLLATE +} +BE$ \n \n (0,1) +BEn$ \n \n (0,1) +BE$ [^a] \n (0,1) +BE$ \na \na (0,2) +E (a)(b)(c) abc (0,3)(0,1)(1,2)(2,3) +BE xxx xxx (0,3) +E1 (^|[ (,;])((([Ff]eb[^ ]* *|0*2/|\* */?)0*[6-7]))([^0-9]|$) feb 6, (0,6) +E1 (^|[ (,;])((([Ff]eb[^ ]* *|0*2/|\* */?)0*[6-7]))([^0-9]|$) 2/7 (0,3) +E1 (^|[ (,;])((([Ff]eb[^ ]* *|0*2/|\* */?)0*[6-7]))([^0-9]|$) feb 1,Feb 6 (5,11) +E3 ((((((((((((((((((((((((((((((x)))))))))))))))))))))))))))))) x (0,1)(0,1)(0,1) +E3 ((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))* xx (0,2)(1,2)(1,2) +E a?(ab|ba)* ababababababababababababababababababababababababababababababababababababababababa (0,81)(79,81) +E abaa|abbaa|abbbaa|abbbbaa ababbabbbabbbabbbbabbbbaa (18,25) +E abaa|abbaa|abbbaa|abbbbaa ababbabbbabbbabbbbabaa (18,22) +E aaac|aabc|abac|abbc|baac|babc|bbac|bbbc baaabbbabac (7,11) +BE$ .* \x01\xff (0,2) +E aaaa|bbbb|cccc|ddddd|eeeeee|fffffff|gggg|hhhh|iiiii|jjjjj|kkkkk|llll XaaaXbbbXcccXdddXeeeXfffXgggXhhhXiiiXjjjXkkkXlllXcbaXaaaa (53,57) +L aaaa\nbbbb\ncccc\nddddd\neeeeee\nfffffff\ngggg\nhhhh\niiiii\njjjjj\nkkkkk\nllll XaaaXbbbXcccXdddXeeeXfffXgggXhhhXiiiXjjjXkkkXlllXcbaXaaaa NOMATCH +E a*a*a*a*a*b aaaaaaaaab (0,10) +BE ^ NULL (0,0) +BE $ NULL (0,0) +BE ^$ NULL (0,0) +BE ^a$ a (0,1) +BE abc abc (0,3) +BE abc xabcy (1,4) +BE abc ababc (2,5) +BE ab*c abc (0,3) +BE ab*bc abc (0,3) +BE ab*bc abbc (0,4) +BE ab*bc abbbbc (0,6) +E ab+bc abbc (0,4) +E ab+bc abbbbc (0,6) +E ab?bc abbc (0,4) +E ab?bc abc (0,3) +E ab?c abc (0,3) +BE ^abc$ abc (0,3) +BE ^abc abcc (0,3) +BE abc$ aabc (1,4) +BE ^ abc (0,0) +BE $ abc (3,3) +BE a.c abc (0,3) +BE a.c axc (0,3) +BE a.*c axyzc (0,5) +BE a[bc]d abd (0,3) +BE a[b-d]e ace (0,3) +BE a[b-d] aac (1,3) +BE a[-b] a- (0,2) +BE a[b-] a- (0,2) +BE a] a] (0,2) +BE a[]]b a]b (0,3) +BE a[^bc]d aed (0,3) +BE a[^-b]c adc (0,3) +BE a[^]b]c adc (0,3) +E ab|cd abc (0,2) +E ab|cd abcd (0,2) +E a\(b a(b (0,3) +E a\(*b ab (0,2) +E a\(*b a((b (0,4) +E ((a)) abc (0,1)(0,1)(0,1) +E (a)b(c) abc (0,3)(0,1)(2,3) +E a+b+c aabbabc (4,7) +E a* aaa (0,3) +E (a*)* - (0,0)(0,0) +E (a*)+ - (0,0)(0,0) +E (a*|b)* - (0,0)(0,0) +E (a+|b)* ab (0,2)(1,2) +E (a+|b)+ ab (0,2)(1,2) +E (a+|b)? ab (0,1)(0,1) +BE [^ab]* cde (0,3) +E (^)* - (0,0)(0,0) +BE a* NULL (0,0) +E ([abc])*d abbbcd (0,6)(4,5) +E ([abc])*bcd abcd (0,4)(0,1) +E a|b|c|d|e e (0,1) +E (a|b|c|d|e)f ef (0,2)(0,1) +E ((a*|b))* - (0,0)(0,0)(0,0) +BE abcd*efg abcdefg (0,7) +BE ab* xabyabbbz (1,3) +BE ab* xayabbbz (1,2) +E (ab|cd)e abcde (2,5)(2,4) +BE [abhgefdc]ij hij (0,3) +E (a|b)c*d abcd (1,4)(1,2) +E (ab|ab*)bc abc (0,3)(0,1) +E a([bc]*)c* abc (0,3)(1,3) +E a([bc]*)(c*d) abcd (0,4)(1,3)(3,4) +E a([bc]+)(c*d) abcd (0,4)(1,3)(3,4) +E a([bc]*)(c+d) abcd (0,4)(1,2)(2,4) +E a[bcd]*dcdcde adcdcde (0,7) +E (ab|a)b*c abc (0,3)(0,2) +E ((a)(b)c)(d) abcd (0,4)(0,3)(0,1)(1,2)(3,4) +BE [A-Za-z_][A-Za-z0-9_]* alpha (0,5) +E ^a(bc+|b[eh])g|.h$ abh (1,3) +E (bc+d$|ef*g.|h?i(j|k)) effgz (0,5)(0,5) +E (bc+d$|ef*g.|h?i(j|k)) ij (0,2)(0,2)(1,2) +E (bc+d$|ef*g.|h?i(j|k)) reffgz (1,6)(1,6) +E (((((((((a))))))))) a (0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1) +BE multiple words multiple words yeah (0,14) +E (.*)c(.*) abcde (0,5)(0,2)(3,5) +BE abcd abcd (0,4) +E a(bc)d abcd (0,4)(1,3) +E a[-]?c ac (0,3) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Muammar Qaddafi (0,15)(?,?)(10,12) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Mo'ammar Gadhafi (0,16)(?,?)(11,13) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Muammar Kaddafi (0,15)(?,?)(10,12) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Muammar Qadhafi (0,15)(?,?)(10,12) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Muammar Gadafi (0,14)(?,?)(10,11) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Mu'ammar Qadafi (0,15)(?,?)(11,12) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Moamar Gaddafi (0,14)(?,?)(9,11) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Mu'ammar Qadhdhafi (0,18)(?,?)(13,15) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Muammar Khaddafi (0,16)(?,?)(11,13) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Muammar Ghaddafy (0,16)(?,?)(11,13) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Muammar Ghadafi (0,15)(?,?)(11,12) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Muammar Ghaddafi (0,16)(?,?)(11,13) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Muamar Kaddafi (0,14)(?,?)(9,11) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Muammar Quathafi (0,16)(?,?)(11,13) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Muammar Gheddafi (0,16)(?,?)(11,13) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Moammar Khadafy (0,15)(?,?)(11,12) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Moammar Qudhafi (0,15)(?,?)(10,12) +E a+(b|c)*d+ aabcdd (0,6)(3,4) +E ^.+$ vivi (0,4) +E ^(.+)$ vivi (0,4)(0,4) +E ^([^!.]+).att.com!(.+)$ gryphon.att.com!eby (0,19)(0,7)(16,19) +E ^([^!]+!)?([^!]+)$ bas (0,3)(?,?)(0,3) +E ^([^!]+!)?([^!]+)$ bar!bas (0,7)(0,4)(4,7) +E ^([^!]+!)?([^!]+)$ foo!bas (0,7)(0,4)(4,7) +E ^.+!([^!]+!)([^!]+)$ foo!bar!bas (0,11)(4,8)(8,11) +E ((foo)|(bar))!bas bar!bas (0,7)(0,3)(?,?)(0,3) +E ((foo)|(bar))!bas foo!bar!bas (4,11)(4,7)(?,?)(4,7) +E ((foo)|(bar))!bas foo!bas (0,7)(0,3)(0,3) +E ((foo)|bar)!bas bar!bas (0,7)(0,3) +E ((foo)|bar)!bas foo!bar!bas (4,11)(4,7) +E ((foo)|bar)!bas foo!bas (0,7)(0,3)(0,3) +E (foo|(bar))!bas bar!bas (0,7)(0,3)(0,3) +E (foo|(bar))!bas foo!bar!bas (4,11)(4,7)(4,7) +E (foo|(bar))!bas foo!bas (0,7)(0,3) +E (foo|bar)!bas bar!bas (0,7)(0,3) +E (foo|bar)!bas foo!bar!bas (4,11)(4,7) +E (foo|bar)!bas foo!bas (0,7)(0,3) +E ^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$ foo!bar!bas (0,11)(0,11)(?,?)(?,?)(4,8)(8,11) +E ^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$ bas (0,3)(?,?)(0,3) +E ^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$ bar!bas (0,7)(0,4)(4,7) +E ^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$ foo!bar!bas (0,11)(?,?)(?,?)(4,8)(8,11) +E ^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$ foo!bas (0,7)(0,4)(4,7) +E ^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$ bas (0,3)(0,3)(?,?)(0,3) +E ^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$ bar!bas (0,7)(0,7)(0,4)(4,7) +E ^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$ foo!bar!bas (0,11)(0,11)(?,?)(?,?)(4,8)(8,11) +E ^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$ foo!bas (0,7)(0,7)(0,4)(4,7) +E .*(/XXX).* /XXX (0,4)(0,4) +E .*(\\XXX).* \XXX (0,4)(0,4) +E \\XXX \XXX (0,4) +E .*(/000).* /000 (0,4)(0,4) +E .*(\\000).* \000 (0,4)(0,4) +E \\000 \000 (0,4) diff --git a/tests/regex/datafiles/bracket.dat b/tests/regex/datafiles/bracket.dat new file mode 100644 index 0000000..082ddfb --- /dev/null +++ b/tests/regex/datafiles/bracket.dat @@ -0,0 +1,2351 @@ +# Simple characters +BE [a-][a-]* -a- (0,3) +BEi SAME -a- (0,3) +BE SAME -A- (0,1) +BEi SAME -A- (0,3) +BE [-a][-a]* -a- (0,3) +BEi SAME -a- (0,3) +BE SAME -A- (0,1) +BEi SAME -A- (0,3) +BE []a][]a]* [a] (1,3) +BEi SAME [a] (1,3) +BE SAME [A] (2,3) +BEi SAME [A] (1,3) +BE []a-][]a-]* [-a-] (1,5) +BEi SAME [-a-] (1,5) +BE SAME [-A-] (1,2) +BEi SAME [-A-] (1,5) +BE [ace][ace]* abc (0,1) +BEi SAME abc (0,1) +BE SAME ABC NOMATCH +BEi SAME ABC (0,1) +BE [ACE][ACE]* abc NOMATCH +BEi SAME abc (0,1) +BE SAME ABC (0,1) +BEi SAME ABC (0,1) +BE [^ace][^ace]* abc (1,2) +BEi SAME abc (1,2) +BE SAME ABC (0,3) +BEi SAME ABC (1,2) +BE [^ACE][^ACE]* abc (0,3) +BEi SAME abc (1,2) +BE SAME ABC (1,2) +BEi SAME ABC (1,2) +{C ca_ES.ISO8859-1 +BE [ace][ace]* abc (0,1) +BEi SAME abc (0,1) +BE SAME ABC NOMATCH +BEi SAME ABC (0,1) +BE$ SAME \x{e1}bc (2,3) +BEi$ SAME \x{e1}bc (2,3) +BE$ SAME \x{c1}BC NOMATCH +BEi$ SAME \x{c1}BC (2,3) +BE$ [\x{e1}ce][\x{e1}ce]* abc (2,3) +BEi SAME abc (2,3) +BE SAME ABC NOMATCH +BEi SAME ABC (2,3) +BE$ SAME \x{e1}bc (0,1) +BEi$ SAME \x{e1}bc (0,1) +BE$ SAME \x{c1}BC NOMATCH +BEi$ SAME \x{c1}BC (0,1) +BE [ACE][ACE]* abc NOMATCH +BEi SAME abc (0,1) +BE SAME ABC (0,1) +BEi SAME ABC (0,1) +BE$ SAME \x{e1}bc NOMATCH +BEi$ SAME \x{e1}bc (2,3) +BE$ SAME \x{c1}BC (2,3) +BEi$ SAME \x{c1}BC (2,3) +BE$ [\x{c1}CE][\x{c1}CE]* abc NOMATCH +BEi SAME abc (2,3) +BE SAME ABC (2,3) +BEi SAME ABC (2,3) +BE$ SAME \x{e1}bc NOMATCH +BEi$ SAME \x{e1}bc (0,1) +BE$ SAME \x{c1}BC (0,1) +BEi$ SAME \x{c1}BC (0,1) +BE [^ace][^ace]* abc (1,2) +BEi SAME abc (1,2) +BE SAME ABC (0,3) +BEi SAME ABC (1,2) +BE$ SAME \x{e1}bc (0,2) +BEi$ SAME \x{e1}bc (0,2) +BE$ SAME \x{c1}BC (0,3) +BEi$ SAME \x{c1}BC (0,2) +BE$ [^\x{e1}ce][^\x{e1}ce]* abc (0,2) +BEi SAME abc (0,2) +BE SAME ABC (0,3) +BEi SAME ABC (0,2) +BE$ SAME \x{e1}bc (1,2) +BEi$ SAME \x{e1}bc (1,2) +BE$ SAME \x{c1}BC (0,3) +BEi$ SAME \x{c1}BC (1,2) +BE [^ACE][^ACE]* abc (0,3) +BEi SAME abc (1,2) +BE SAME ABC (1,2) +BEi SAME ABC (1,2) +BE$ SAME \x{e1}bc (0,3) +BEi$ SAME \x{e1}bc (0,2) +BE$ SAME \x{c1}BC (0,2) +BEi$ SAME \x{c1}BC (0,2) +BE$ [^\x{c1}CE][^\x{c1}CE]* abc (0,3) +BEi SAME abc (0,2) +BE SAME ABC (0,2) +BEi SAME ABC (0,2) +BE$ SAME \x{e1}bc (0,3) +BEi$ SAME \x{e1}bc (1,2) +BE$ SAME \x{c1}BC (1,2) +BEi$ SAME \x{c1}BC (1,2) +} +# Character ranges +BE [a-b-c] x ERANGE +BE [z-a] x ERANGE +BE [Z-A] x ERANGE +BE [a-z][a-z]* abc (0,3) +BEi SAME abc (0,3) +BE SAME ABC NOMATCH +BEi SAME ABC (0,3) +BE SAME aBC (0,1) +BEi SAME aBC (0,3) +BE [A-Z][A-Z]* abc NOMATCH +BEi SAME abc (0,3) +BE SAME ABC (0,3) +BEi SAME ABC (0,3) +BE SAME aBC (1,3) +BEi SAME aBC (0,3) +BE ["--]["--]* !"#$%,-./ (2,8) +BEi SAME !"#$%,-./ (2,8) +BE ["--!]["--!]* !"#$%,-./ (1,8) +BEi SAME !"#$%,-./ (1,8) +BE [--0][--0]* ^-./012 (1,5) +BEi [--0][--0]* ^-./012 (1,5) +BE [ac-e][ac-e]* abc (0,1) +BEi SAME abc (0,1) +BE SAME ABC NOMATCH +BEi SAME ABC (0,1) +BE [AC-E][AC-E]* abc NOMATCH +BEi SAME abc (0,1) +BE SAME ABC (0,1) +BEi SAME ABC (0,1) +BE [^a-z][^a-z]* abc123 (3,6) +BEi SAME abc123 (3,6) +BE SAME ABC123 (0,6) +BEi SAME ABC123 (3,6) +BE SAME aBC123 (1,6) +BEi SAME aBC123 (3,6) +BE [^A-Z][^A-Z]* abc123 (0,6) +BEi SAME abc123 (3,6) +BE SAME ABC123 (3,6) +BEi SAME ABC123 (3,6) +BE SAME aBC123 (0,1) +BEi SAME aBC123 (3,6) +BE [^ac-e][^ac-e]* abc (1,2) +BEi SAME abc (1,2) +BE SAME ABC (0,3) +BEi SAME ABC (1,2) +BE [^AC-E][^AC-E]* abc (0,3) +BEi SAME abc (1,2) +BE SAME ABC (1,2) +BEi SAME ABC (1,2) +{C ca_ES.ISO8859-1 +BE$ [a-e][a-e]* abcde\x{e9}f (0,6) +BEi$ SAME abcde\x{e9}f (0,6) +BE$ SAME ABCDE\x{c9}F NOMATCH +BEi$ SAME ABCDE\x{c9}F (0,6) +BE$ [A-E][A-E]* abcde\x{e9}f NOMATCH +BEi$ SAME abcde\x{e9}f (0,6) +BE$ SAME ABCDE\x{c9}F (0,6) +BEi$ SAME ABCDE\x{c9}F (0,6) +BE$ [^a-d][^a-d]* a\x{e1}bcde\x{e9}f (5,8) +BEi$ SAME a\x{e1}bcde\x{e9}f (5,8) +BE$ SAME A\x{c1}BCDE\x{c9}F (0,8) +BEi$ SAME A\x{c1}BCDE\x{c9}F (5,8) +BE$ [^A-D][^A-D]* a\x{e1}bcde\x{e9}f (0,8) +BEi$ SAME a\x{e1}bcde\x{e9}f (5,8) +BE$ SAME A\x{c1}BCDE\x{c9}F (5,8) +BEi$ SAME A\x{c1}BCDE\x{c9}F (5,8) +BE$ [a-\xe8][a-\xe8]* abcde\x{e9}f (0,6) +BEi$ SAME abcde\x{e9}f (0,6) +BE$ SAME ABCDE\x{c9}F NOMATCH +BEi$ SAME ABCDE\x{c9}F (0,6) +BE$ [A-\xc8][A-\xc8]* abcde\x{e9}f NOMATCH +BEi$ SAME abcde\x{e9}f (0,6) +BE$ SAME ABCDE\x{c9}F (0,6) +BEi$ SAME ABCDE\x{c9}F (0,6) +BE$ [^\xe0-d][^\xe0-d]* a\x{e1}bcde\x{e9}f (5,8) +BEi$ SAME a\x{e1}bcde\x{e9}f (5,8) +BE$ SAME A\x{c1}BCDE\x{c9}F (0,8) +BEi$ SAME A\x{c1}BCDE\x{c9}F (5,8) +BE$ [^\xc0-D][^\xc0-D]* a\x{e1}bcde\x{e9}f (0,8) +BEi$ SAME a\x{e1}bcde\x{e9}f (5,8) +BE$ SAME A\x{c1}BCDE\x{c9}F (5,8) +BEi$ SAME A\x{c1}BCDE\x{c9}F (5,8) +} +# Single-Character collating symbols +BE [a[ x EBRACK +BE [a[. x ECOLLATE +BE [a[.c x ECOLLATE +BE [a[.c. x ECOLLATE +BE [a[.c.] x EBRACK +BE [a[.c.]e][a[.c.]e]* cde (0,1) +BEi SAME cde (0,1) +BE SAME CDE NOMATCH +BEi SAME CDE (0,1) +BE [A[.C.]E][A[.C.]E]* cde NOMATCH +BEi SAME cde (0,1) +BE SAME CDE (0,1) +BEi SAME CDE (0,1) +BE [^a[.c.]e][^a[.c.]e]* cde (1,2) +BEi SAME cde (1,2) +BE SAME CDE (0,3) +BEi SAME CDE (1,2) +BE [^A[.C.]E][^A[.C.]E]* cde (0,3) +BEi SAME cde (1,2) +BE SAME CDE (1,2) +BEi SAME CDE (1,2) +{C ca_ES.ISO8859-1 +BE [a[.c.]e][a[.c.]e]* cde (0,1) +BEi SAME cde (0,1) +BE SAME CDE NOMATCH +BEi SAME CDE (0,1) +BE$ SAME \x{e7}de (2,3) +BEi$ SAME \x{e7}de (2,3) +BE$ SAME \x{c7}DE NOMATCH +BEi$ SAME \x{c7}DE (2,3) +BE [A[.C.]E][A[.C.]E]* cde NOMATCH +BEi SAME cde (0,1) +BE SAME CDE (0,1) +BEi SAME CDE (0,1) +BE$ SAME \x{e7}de NOMATCH +BEi$ SAME \x{e7}de (2,3) +BE$ SAME \x{c7}DE (2,3) +BEi$ SAME \x{c7}DE (2,3) +BE [^a[.c.]e][^a[.c.]e]* cde (1,2) +BEi SAME cde (1,2) +BE SAME CDE (0,3) +BEi SAME CDE (1,2) +BE$ SAME \x{e7}de (0,2) +BEi$ SAME \x{e7}de (0,2) +BE$ SAME \x{c7}DE (0,3) +BEi$ SAME \x{c7}DE (0,2) +BE [^A[.C.]E][^A[.C.]E]* cde (0,3) +BEi SAME cde (1,2) +BE SAME CDE (1,2) +BEi SAME CDE (1,2) +BE$ SAME \x{e7}de (0,3) +BEi$ SAME \x{e7}de (0,2) +BE$ SAME \x{c7}DE (0,2) +BEi$ SAME \x{c7}DE (0,2) +BE$ [a[.\x{e7}.]e][a[.\x{e7}.]e]* cde (2,3) +BEi$ SAME cde (2,3) +BE$ SAME CDE NOMATCH +BEi$ SAME CDE (2,3) +BE$ SAME \x{e7}de (0,1) +BEi$ SAME \x{e7}de (0,1) +BE$ SAME \x{c7}DE NOMATCH +BEi$ SAME \x{c7}DE (0,1) +BE$ [A[.\x{c7}.]E][A[.\x{c7}.]E]* cde NOMATCH +BEi$ SAME cde (2,3) +BE$ SAME CDE (2,3) +BEi$ SAME CDE (2,3) +BE$ SAME \x{e7}de NOMATCH +BEi$ SAME \x{e7}de (0,1) +BE$ SAME \x{c7}DE (0,1) +BEi$ SAME \x{c7}DE (0,1) +BE$ [^a[.\x{e7}.]e][^a[.\x{e7}.]e]* cde (0,2) +BEi$ SAME cde (0,2) +BE$ SAME CDE (0,3) +BEi$ SAME CDE (0,2) +BE$ SAME \x{e7}de (1,2) +BEi$ SAME \x{e7}de (1,2) +BE$ SAME \x{c7}DE (0,3) +BEi$ SAME \x{c7}DE (1,2) +BE$ [^A[.\x{c7}.]E][^A[.\x{c7}.]E]* cde (0,3) +BEi$ SAME cde (0,2) +BE$ SAME CDE (0,2) +BEi$ SAME CDE (0,2) +BE$ SAME \x{e7}de (0,3) +BEi$ SAME \x{e7}de (1,2) +BE$ SAME \x{c7}DE (1,2) +BEi$ SAME \x{c7}DE (1,2) +} +# Collating symbol ranges +BE [[.a.]-e][[.a.]-e]* abc (0,3) +BEi SAME abc (0,3) +BE SAME aBC (0,1) +BEi SAME aBC (0,3) +BE SAME ABC NOMATCH +BEi SAME ABC (0,3) +BE [a-[.e.]][a-[.e.]]* abc (0,3) +BEi SAME abc (0,3) +BE SAME aBC (0,1) +BEi SAME aBC (0,3) +BE SAME ABC NOMATCH +BEi SAME ABC (0,3) +BE [[.a.]-[.e.]][[.a.]-[.e.]]* abc (0,3) +BEi SAME abc (0,3) +BE SAME aBC (0,1) +BEi SAME aBC (0,3) +BE SAME ABC NOMATCH +BEi SAME ABC (0,3) +BE [[.A.]-E][[.A.]-E]* abc NOMATCH +BEi SAME abc (0,3) +BE SAME aBC (1,3) +BEi SAME aBC (0,3) +BE SAME ABC (0,3) +BEi SAME ABC (0,3) +BE [A-[.E.]][A-[.E.]]* abc NOMATCH +BEi SAME abc (0,3) +BE SAME aBC (1,3) +BEi SAME aBC (0,3) +BE SAME ABC (0,3) +BEi SAME ABC (0,3) +BE [[.A.]-[.E.]][[.A.]-[.E.]]* abc NOMATCH +BEi SAME abc (0,3) +BE SAME aBC (1,3) +BEi SAME aBC (0,3) +BE SAME ABC (0,3) +BEi SAME ABC (0,3) +BE [^[.a.]-e][^[.a.]-e]* abc123 (3,6) +BEi SAME abc123 (3,6) +BE SAME aBC123 (1,6) +BEi SAME aBC123 (3,6) +BE SAME ABC123 (0,6) +BEi SAME ABC123 (3,6) +BE [^[.A.]-E][^[.A.]-E]* abc123 (0,6) +BEi SAME abc123 (3,6) +BE SAME aBC123 (0,1) +BEi SAME aBC123 (3,6) +BE SAME ABC123 (3,6) +BEi SAME ABC123 (3,6) +BE [^a-[.e.]][^a-[.e.]]* abc123 (3,6) +BEi SAME abc123 (3,6) +BE SAME aBC123 (1,6) +BEi SAME aBC123 (3,6) +BE SAME ABC123 (0,6) +BEi SAME ABC123 (3,6) +BE [^A-[.E.]][^A-[.E.]]* abc123 (0,6) +BEi SAME abc123 (3,6) +BE SAME aBC123 (0,1) +BEi SAME aBC123 (3,6) +BE SAME ABC123 (3,6) +BEi SAME ABC123 (3,6) +BE [^[.a.]-[.e.]][^[.a.]-[.e.]]* abc123 (3,6) +BEi SAME abc123 (3,6) +BE SAME aBC123 (1,6) +BEi SAME aBC123 (3,6) +BE SAME ABC123 (0,6) +BEi SAME ABC123 (3,6) +BE [^[.A.]-[.E.]][^[.A.]-[.E.]]* abc123 (0,6) +BEi SAME abc123 (3,6) +BE SAME aBC123 (0,1) +BEi SAME aBC123 (3,6) +BE SAME ABC123 (3,6) +BEi SAME ABC123 (3,6) +{C ca_ES.ISO8859-1 +BE [a-[.e.]][a-[.e.]]* abc (0,3) +BEi SAME abc (0,3) +BE SAME aBC (0,1) +BEi SAME aBC (0,3) +BE SAME ABC NOMATCH +BEi SAME ABC (0,3) +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE$ [a-[.\xea.]][a-[.\xea.]]* abc (0,3) +BEi$ SAME abc (0,3) +BE$ SAME aBC (0,1) +BEi$ SAME aBC (0,3) +BE$ SAME ABC NOMATCH +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE$ [\xe0-[.e.]][\xe0-[.e.]]* abc (0,3) +BEi$ SAME abc (0,3) +BE$ SAME aBC (0,1) +BEi$ SAME aBC (0,3) +BE$ SAME ABC NOMATCH +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE$ [\xe0-[.\xea.]][\xe0-[.\xea.]]* abc (0,3) +BEi$ SAME abc (0,3) +BE$ SAME aBC (0,1) +BEi$ SAME aBC (0,3) +BE$ SAME ABC NOMATCH +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE [[.a.]-e][[.a.]-e]* abc (0,3) +BEi SAME abc (0,3) +BE SAME aBC (0,1) +BEi SAME aBC (0,3) +BE SAME ABC NOMATCH +BEi SAME ABC (0,3) +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE$ [[.a.]-\xea][[.a.]-\xea]* abc (0,3) +BEi$ SAME abc (0,3) +BE$ SAME aBC (0,1) +BEi$ SAME aBC (0,3) +BE$ SAME ABC NOMATCH +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE$ [[.\xe0.]-e][[.\xe0.]-e]* abc (0,3) +BEi$ SAME abc (0,3) +BE$ SAME aBC (0,1) +BEi$ SAME aBC (0,3) +BE$ SAME ABC NOMATCH +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE$ [[.\xe0.]-\xea][[.\xe0.]-\xea]* abc (0,3) +BEi$ SAME abc (0,3) +BE$ SAME aBC (0,1) +BEi$ SAME aBC (0,3) +BE$ SAME ABC NOMATCH +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE [[.a.]-[.e.]][[.a.]-[.e.]]* abc (0,3) +BEi SAME abc (0,3) +BE$ SAME aBC (0,1) +BEi$ SAME aBC (0,3) +BE SAME ABC NOMATCH +BEi SAME ABC (0,3) +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE$ [[.a.]-[.\xea.]][[.a.]-[.\xea.]]* abc (0,3) +BEi$ SAME abc (0,3) +BE$ SAME aBC (0,1) +BEi$ SAME aBC (0,3) +BE$ SAME ABC NOMATCH +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE$ [[.\xe0.]-[.e.]][[.\xe0.]-[.e.]]* abc (0,3) +BEi$ SAME abc (0,3) +BE$ SAME aBC (0,1) +BEi$ SAME aBC (0,3) +BE$ SAME ABC NOMATCH +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE$ [[.\xe0.]-[.\xea.]][[.\xe0.]-[.\xea.]]* abc (0,3) +BEi$ SAME abc (0,3) +BE$ SAME aBC (0,1) +BEi$ SAME aBC (0,3) +BE$ SAME ABC NOMATCH +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE [A-[.E.]][A-[.E.]]* abc NOMATCH +BEi SAME abc (0,3) +BE SAME aBC (1,3) +BEi SAME aBC (0,3) +BE SAME ABC (0,3) +BEi SAME ABC (0,3) +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} (0,3) +BE$ [A-[.\xca.]][A-[.\xca.]]* abc NOMATCH +BEi$ SAME abc (0,3) +BE$ SAME aBC (1,3) +BEi$ SAME aBC (0,3) +BE$ SAME ABC (0,3) +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} (0,3) +BE$ [\xc0-[.E.]][\xc0-[.E.]]* abc NOMATCH +BEi$ SAME abc (0,3) +BE$ SAME aBC (1,3) +BEi$ SAME aBC (0,3) +BE$ SAME ABC (0,3) +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} (0,3) +BE$ [\xc0-[.\xca.]][\xc0-[.\xca.]]* abc NOMATCH +BEi$ SAME abc (0,3) +BE$ SAME aBC (1,3) +BEi$ SAME aBC (0,3) +BE$ SAME ABC (0,3) +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} (0,3) +BE [[.A.]-E][[.A.]-E]* abc NOMATCH +BEi SAME abc (0,3) +BE SAME aBC (1,3) +BEi SAME aBC (0,3) +BE SAME ABC (0,3) +BEi SAME ABC (0,3) +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} (0,3) +BE$ [[.A.]-\xca][[.A.]-\xca]* abc NOMATCH +BEi$ SAME abc (0,3) +BE$ SAME aBC (1,3) +BEi$ SAME aBC (0,3) +BE$ SAME ABC (0,3) +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} (0,3) +BE$ [[.\xc0.]-E][[.\xc0.]-E]* abc NOMATCH +BEi$ SAME abc (0,3) +BE$ SAME aBC (1,3) +BEi$ SAME aBC (0,3) +BE$ SAME ABC (0,3) +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} (0,3) +BE$ [[.\xc0.]-\xca][[.\xc0.]-\xca]* abc NOMATCH +BEi$ SAME abc (0,3) +BE$ SAME aBC (1,3) +BEi$ SAME aBC (0,3) +BE$ SAME ABC (0,3) +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} (0,3) +BE [[.A.]-[.E.]][[.A.]-[.E.]]* abc NOMATCH +BEi SAME abc (0,3) +BE SAME aBC (1,3) +BEi SAME aBC (0,3) +BE SAME ABC (0,3) +BEi SAME ABC (0,3) +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} (0,3) +BE$ [[.A.]-[.\xca.]][[.A.]-[.\xca.]]* abc NOMATCH +BEi$ SAME abc (0,3) +BE$ SAME aBC (1,3) +BEi$ SAME aBC (0,3) +BE$ SAME ABC (0,3) +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} (0,3) +BE$ [[.\xc0.]-[.E.]][[.\xc0.]-[.E.]]* abc NOMATCH +BEi$ SAME abc (0,3) +BE$ SAME aBC (1,3) +BEi$ SAME aBC (0,3) +BE$ SAME ABC (0,3) +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} (0,3) +BE$ [[.\xc0.]-[.\xca.]][[.\xc0.]-[.\xca.]]* abc NOMATCH +BEi$ SAME abc (0,3) +BE$ SAME aBC (1,3) +BEi$ SAME aBC (0,3) +BE$ SAME ABC (0,3) +BEi$ SAME ABC (0,3) +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} (0,3) +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} (0,3) +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} (0,3) +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} (0,3) +BE [^a-[.e.]][^a-[.e.]]* abc NOMATCH +BEi SAME abc NOMATCH +BE SAME aBC (1,3) +BEi SAME aBC NOMATCH +BE SAME ABC (0,3) +BEi SAME ABC NOMATCH +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^a-[.\xea.]][^a-[.\xea.]]* abc NOMATCH +BEi$ SAME abc NOMATCH +BE$ SAME aBC (1,3) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC (0,3) +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^\xe0-[.e.]][^\xe0-[.e.]]* abc NOMATCH +BEi$ SAME abc NOMATCH +BE$ SAME aBC (1,3) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC (0,3) +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^\xe0-[.\xea.]][^\xe0-[.\xea.]]* abc NOMATCH +BEi$ SAME abc NOMATCH +BE$ SAME aBC (1,3) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC (0,3) +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} NOMATCH +BE [^[.a.]-e][^[.a.]-e]* abc NOMATCH +BEi SAME abc NOMATCH +BE SAME aBC (1,3) +BEi SAME aBC NOMATCH +BE SAME ABC (0,3) +BEi SAME ABC NOMATCH +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^[.a.]-\xea][^[.a.]-\xea]* abc NOMATCH +BEi$ SAME abc NOMATCH +BE$ SAME aBC (1,3) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC (0,3) +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^[.\xe0.]-e][^[.\xe0.]-e]* abc NOMATCH +BEi$ SAME abc NOMATCH +BE$ SAME aBC (1,3) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC (0,3) +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^[.\xe0.]-\xea][^[.\xe0.]-\xea]* abc NOMATCH +BEi$ SAME abc NOMATCH +BE$ SAME aBC (1,3) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC (0,3) +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} NOMATCH +BE [^[.a.]-[.e.]][^[.a.]-[.e.]]* abc NOMATCH +BEi SAME abc NOMATCH +BE SAME aBC (1,3) +BEi SAME aBC NOMATCH +BE SAME ABC (0,3) +BEi SAME ABC NOMATCH +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^[.a.]-[.\xea.]][^[.a.]-[.\xea.]]* abc NOMATCH +BEi$ SAME abc NOMATCH +BE$ SAME aBC (1,3) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC (0,3) +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^[.\xe0.]-[.e.]][^[.\xe0.]-[.e.]]* abc NOMATCH +BEi$ SAME abc NOMATCH +BE$ SAME aBC (1,3) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC (0,3) +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^[.\xe0.]-[.\xea.]][^[.\xe0.]-[.\xea.]]* abc NOMATCH +BEi$ SAME abc NOMATCH +BE$ SAME aBC (1,3) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC (0,3) +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} NOMATCH +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (2,3) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (1,2) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (1,3) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} (0,3) +BEi$ SAME AB\x{c7} NOMATCH +BE [^A-[.E.]][^A-[.E.]]* abc (0,3) +BEi SAME abc NOMATCH +BE SAME aBC (0,1) +BEi SAME aBC NOMATCH +BE SAME ABC NOMATCH +BEi SAME ABC NOMATCH +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^A-[.\xca.]][^A-[.\xca.]]* abc (0,3) +BEi$ SAME abc NOMATCH +BE$ SAME aBC (0,1) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC NOMATCH +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^\xc0-[.E.]][^\xc0-[.E.]]* abc (0,3) +BEi$ SAME abc NOMATCH +BE$ SAME aBC (0,1) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC NOMATCH +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^\xc0-[.\xca.]][^\xc0-[.\xca.]]* abc (0,3) +BEi$ SAME abc NOMATCH +BE$ SAME aBC (0,1) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC NOMATCH +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} NOMATCH +BE [^[.A.]-E][^[.A.]-E]* abc (0,3) +BEi SAME abc NOMATCH +BE SAME aBC (0,1) +BEi SAME aBC NOMATCH +BE SAME ABC NOMATCH +BEi SAME ABC NOMATCH +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^[.A.]-\xca][^[.A.]-\xca]* abc (0,3) +BEi$ SAME abc NOMATCH +BE$ SAME aBC (0,1) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC NOMATCH +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^[.\xc0.]-E][^[.\xc0.]-E]* abc (0,3) +BEi$ SAME abc NOMATCH +BE$ SAME aBC (0,1) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC NOMATCH +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^[.\xc0.]-\xca][^[.\xc0.]-\xca]* abc (0,3) +BEi$ SAME abc NOMATCH +BE$ SAME aBC (0,1) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC NOMATCH +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} NOMATCH +BE [^[.A.]-[.E.]][^[.A.]-[.E.]]* abc (0,3) +BEi SAME abc NOMATCH +BE SAME aBC (0,1) +BEi SAME aBC NOMATCH +BE SAME ABC NOMATCH +BEi SAME ABC NOMATCH +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^[.A.]-[.\xca.]][^[.A.]-[.\xca.]]* abc (0,3) +BEi$ SAME abc NOMATCH +BE$ SAME aBC (0,1) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC NOMATCH +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^[.\xc0.]-[.E.]][^[.\xc0.]-[.E.]]* abc (0,3) +BEi$ SAME abc NOMATCH +BE$ SAME aBC (0,1) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC NOMATCH +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} NOMATCH +BE$ [^[.\xc0.]-[.\xca.]][^[.\xc0.]-[.\xca.]]* abc (0,3) +BEi$ SAME abc NOMATCH +BE$ SAME aBC (0,1) +BEi$ SAME aBC NOMATCH +BE$ SAME ABC NOMATCH +BEi$ SAME ABC NOMATCH +BE$ SAME ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} NOMATCH +BE$ SAME ab\x{c7} (0,2) +BEi$ SAME ab\x{c7} NOMATCH +BE$ SAME aB\x{e7} (0,1) +BEi$ SAME aB\x{e7} NOMATCH +BE$ SAME aB\x{c7} (0,1) +BEi$ SAME aB\x{c7} NOMATCH +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} NOMATCH +} +# Multi-Character collating symbols +BE [[.ch.]] ch ECOLLATE +{C ca_ES.ISO8859-1 +BE [a[.ch x ECOLLATE +BE [a[.ch. x ECOLLATE +BE [a[.ch] x ECOLLATE +BE [a[.ch.] x EBRACK +BE [a[.ch.][ x EBRACK +BE [^[.ch.]] x ECOLLATE +BE [[.ch.]] ch (0,2) +BEi SAME ch (0,2) +BE SAME Ch NOMATCH +BEi SAME Ch (0,2) +BE SAME CH NOMATCH +BEi SAME CH (0,2) +BE$ SAME \x{e7}h NOMATCH +BEi$ SAME \x{e7}h NOMATCH +BE$ SAME \x{c7}H NOMATCH +BEi$ SAME \x{c7}H NOMATCH +BE [[.Ch.]] ch NOMATCH +BEi SAME ch (0,2) +BE SAME Ch (0,2) +BEi SAME Ch (0,2) +BE SAME CH NOMATCH +BEi SAME CH (0,2) +BE$ SAME \x{e7}h NOMATCH +BEi$ SAME \x{e7}h NOMATCH +BE$ SAME \x{c7}H NOMATCH +BEi$ SAME \x{c7}H NOMATCH +BE [[.CH.]] ch NOMATCH +BEi SAME ch (0,2) +BE SAME Ch NOMATCH +BEi SAME Ch (0,2) +BE SAME CH (0,2) +BEi SAME CH (0,2) +BE$ SAME \x{e7}h NOMATCH +BEi$ SAME \x{e7}h NOMATCH +BE$ SAME \x{c7}H NOMATCH +BEi$ SAME \x{c7}H NOMATCH +BE [[[.ch.]][[[.ch.]]* ch[ (0,3) +BEi SAME ch[ (0,3) +BE SAME Ch[ (2,3) +BEi SAME Ch[ (0,3) +BE SAME CH[ (2,3) +BEi SAME CH[ (0,3) +BE SAME c[h (1,2) +BEi SAME c[h (1,2) +BE SAME C[h (1,2) +BEi SAME C[h (1,2) +BE SAME C[H (1,2) +BEi SAME C[H (1,2) +BE [[[.Ch.]][[[.Ch.]]* ch[ (2,3) +BEi SAME ch[ (0,3) +BE SAME Ch[ (0,3) +BEi SAME Ch[ (0,3) +BE SAME CH[ (2,3) +BEi SAME CH[ (0,3) +BE SAME c[h (1,2) +BEi SAME c[h (1,2) +BE SAME C[h (1,2) +BEi SAME C[h (1,2) +BE SAME C[H (1,2) +BEi SAME C[H (1,2) +BE [[[.CH.]][[[.CH.]]* ch[ (2,3) +BEi SAME ch[ (0,3) +BE SAME Ch[ (2,3) +BEi SAME Ch[ (0,3) +BE SAME CH[ (0,3) +BEi SAME CH[ (0,3) +BE SAME c[h (1,2) +BEi SAME c[h (1,2) +BE SAME C[h (1,2) +BEi SAME C[h (1,2) +BE SAME C[H (1,2) +BEi SAME C[H (1,2) +BE [][[.ch.]][][[.ch.]]* [ (0,1) +BEi SAME [ (0,1) +BE SAME ] (0,1) +BEi SAME ] (0,1) +BE [[.ch.]-][[.ch.]-]* -ch- (0,4) +BEi SAME -ch- (0,4) +BE SAME -Ch- (0,1) +BEi SAME -Ch- (0,4) +BE SAME -CH- (0,1) +BEi SAME -CH- (0,4) +BE [[.Ch.]-][[.Ch.]-]* -ch- (0,1) +BEi SAME -ch- (0,4) +BE SAME -Ch- (0,4) +BEi SAME -Ch- (0,4) +BE SAME -CH- (0,1) +BEi SAME -CH- (0,4) +BE [[.CH.]-][[.CH.]-]* -ch- (0,1) +BEi SAME -ch- (0,4) +BE SAME -Ch- (0,1) +BEi SAME -Ch- (0,4) +BE SAME -CH- (0,4) +BEi SAME -CH- (0,4) +BE [a[.ch.]z][a[.ch.]z]* achz (0,4) +BEi SAME achz (0,4) +BE SAME AChz (3,4) +BEi SAME AChz (0,4) +BE SAME ACHZ NOMATCH +BEi SAME ACHZ (0,4) +BE [A[.Ch.]z][A[.Ch.]z]* achz (3,4) +BEi SAME achz (0,4) +BE SAME AChz (0,4) +BEi SAME AChz (0,4) +BE SAME ACHZ (0,1) +BEi SAME ACHZ (0,4) +BE [A[.CH.]Z][A[.CH.]Z]* achz NOMATCH +BEi SAME achz (0,4) +BE SAME AChz (0,1) +BEi SAME AChz (0,4) +BE SAME ACHZ (0,4) +BEi SAME ACHZ (0,4) +BE [a[.ch.]z][a[.ch.]z]* cchz (1,4) +BEi SAME cchz (1,4) +BE SAME CChz (3,4) +BEi SAME CChz (1,4) +BE SAME CCHZ NOMATCH +BEi SAME CCHZ (1,4) +BE [A[.Ch.]z][A[.Ch.]z]* cchz (3,4) +BEi SAME cchz (1,4) +BE SAME CChz (1,4) +BEi SAME CChz (1,4) +BE SAME CCHZ NOMATCH +BEi SAME CCHZ (1,4) +BE [A[.CH.]Z][A[.CH.]Z]* cchz NOMATCH +BEi SAME cchz (1,4) +BE SAME CChz NOMATCH +BEi SAME CChz (1,4) +BE SAME CCHZ (1,4) +BEi SAME CCHZ (1,4) +BE [a[.ch.][.ll.][.rr.]z][a[.ch.][.ll.][.rr.]z]* acz (0,1) +BEi SAME acz (0,1) +BE SAME ACz (2,3) +BEi SAME ACz (0,1) +BE SAME ACZ NOMATCH +BEi SAME ACZ (0,1) +BE SAME achz (0,4) +BEi SAME achz (0,4) +BE SAME AChZ NOMATCH +BEi SAME AChZ (0,4) +BE SAME ACHZ NOMATCH +BEi SAME ACHZ (0,4) +BE SAME achllz (0,6) +BEi SAME achllz (0,6) +BE SAME AChLlZ NOMATCH +BEi SAME AChLlZ (0,6) +BE SAME ACHLLZ NOMATCH +BEi SAME ACHLLZ (0,6) +BE SAME achsz (0,3) +BEi SAME achsz (0,3) +BE SAME AChSZ NOMATCH +BEi SAME AChSZ (0,3) +BE SAME ACHSZ NOMATCH +BEi SAME ACHSZ (0,3) +BE SAME arrchz (0,6) +BEi SAME arrchz (0,6) +BE SAME ARrChZ NOMATCH +BEi SAME ARrChZ (0,6) +BE SAME ARRCHZ NOMATCH +BEi SAME ARRCHZ (0,6) +BE [A[.Ch.][.Ll.][.Rr.]z][A[.Ch.][.Ll.][.Rr.]z]* acz (2,3) +BEi SAME acz (0,1) +BE SAME ACz (0,1) +BEi SAME ACz (0,1) +BE SAME ACZ (0,1) +BEi SAME ACZ (0,1) +BE SAME achz (3,4) +BEi SAME achz (0,4) +BE SAME AChZ (0,3) +BEi SAME AChZ (0,4) +BE SAME ACHZ (0,1) +BEi SAME ACHZ (0,4) +BE SAME achllz (5,6) +BEi SAME achllz (0,6) +BE SAME AChLlZ (0,5) +BEi SAME AChLlZ (0,6) +BE SAME ACHLLZ (0,1) +BEi SAME ACHLLZ (0,6) +BE SAME achsz (4,5) +BEi SAME achsz (0,3) +BE SAME AChSZ (0,3) +BEi SAME AChSZ (0,3) +BE SAME ACHSZ (0,1) +BEi SAME ACHSZ (0,3) +BE SAME arrchz (5,6) +BEi SAME arrchz (0,6) +BE SAME ARrChZ (0,5) +BEi SAME ARrChZ (0,6) +BE SAME ARRCHZ (0,1) +BEi SAME ARRCHZ (0,6) +BE [A[.CH.][.LL.][.RR.]Z][A[.CH.][.LL.][.RR.]Z]* acz NOMATCH +BEi SAME acz (0,1) +BE SAME ACz (0,1) +BEi SAME ACz (0,1) +BE SAME ACZ (0,1) +BEi SAME ACZ (0,1) +BE SAME achz NOMATCH +BEi SAME achz (0,4) +BE SAME AChZ (0,1) +BEi SAME AChZ (0,4) +BE SAME ACHZ (0,4) +BEi SAME ACHZ (0,4) +BE SAME achllz NOMATCH +BEi SAME achllz (0,6) +BE SAME AChLlZ (0,1) +BEi SAME AChLlZ (0,6) +BE SAME ACHLLZ (0,6) +BEi SAME ACHLLZ (0,6) +BE SAME achsz NOMATCH +BEi SAME achsz (0,3) +BE SAME AChSZ (0,1) +BEi SAME AChSZ (0,3) +BE SAME ACHSZ (0,3) +BEi SAME ACHSZ (0,3) +BE SAME arrchz NOMATCH +BEi SAME arrchz (0,6) +BE SAME ARrChZ (0,1) +BEi SAME ARrChZ (0,6) +BE SAME ARRCHZ (0,6) +BEi SAME ARRCHZ (0,6) +BE [a[.ch.]c][a[.ch.]c]* ac (0,2) +BEi SAME ac (0,2) +BE SAME AC NOMATCH +BEi SAME AC (0,2) +BE SAME ach (0,3) +BEi SAME ach (0,3) +BE SAME ACh NOMATCH +BEi SAME ACh (0,3) +BE SAME ACH NOMATCH +BEi SAME ACH (0,3) +BE SAME acch (0,4) +BEi SAME acch (0,4) +BE SAME ACCh NOMATCH +BEi SAME ACCh (0,4) +BE SAME ACCH NOMATCH +BEi SAME ACCH (0,4) +BE SAME achc (0,4) +BEi SAME achc (0,4) +BE SAME AChC NOMATCH +BEi SAME AChC (0,4) +BE SAME ACHC NOMATCH +BEi SAME ACHC (0,4) +BE SAME cchh (0,3) +BEi SAME cchh (0,3) +BE SAME CChh NOMATCH +BEi SAME CChh (0,3) +BE SAME CCHH NOMATCH +BEi SAME CCHH (0,3) +BE SAME hchc (1,4) +BEi SAME hchc (1,4) +BE SAME HChc (3,4) +BEi SAME HChc (1,4) +BE SAME HCHC NOMATCH +BEi SAME HCHC (1,4) +BE [A[.Ch.]c][A[.Ch.]c]* ac (1,2) +BEi SAME ac (0,2) +BE SAME AC (0,1) +BEi SAME AC (0,2) +BE SAME ach (1,2) +BEi SAME ach (0,3) +BE SAME ACh (0,3) +BEi SAME ACh (0,3) +BE SAME ACH (0,1) +BEi SAME ACH (0,3) +BE SAME acch (1,3) +BEi SAME acch (0,4) +BE SAME ACCh (0,1) +BEi SAME ACCh (0,4) +BE SAME ACCH (0,1) +BEi SAME ACCH (0,4) +BE SAME achc (1,2) +BEi SAME achc (0,4) +BE SAME AChC (0,3) +BEi SAME AChC (0,4) +BE SAME ACHC (0,1) +BEi SAME ACHC (0,4) +BE SAME cchh (0,2) +BEi SAME cchh (0,3) +BE SAME CChh (1,3) +BEi SAME CChh (0,3) +BE SAME CCHH NOMATCH +BEi SAME CCHH (0,3) +BE SAME hchc (1,2) +BEi SAME hchc (1,4) +BE SAME HChc (1,4) +BEi SAME HChc (1,4) +BE SAME HCHC NOMATCH +BEi SAME HCHC (1,4) +BE [A[.CH.]C][A[.CH.]C]* ac NOMATCH +BEi SAME ac (0,2) +BE SAME AC (0,2) +BEi SAME AC (0,2) +BE SAME ach NOMATCH +BEi SAME ach (0,3) +BE SAME ACh (0,2) +BEi SAME ACh (0,3) +BE SAME ACH (0,3) +BEi SAME ACH (0,3) +BE SAME acch NOMATCH +BEi SAME acch (0,4) +BE SAME ACCh (0,3) +BEi SAME ACCh (0,4) +BE SAME ACCH (0,4) +BEi SAME ACCH (0,4) +BE SAME achc NOMATCH +BEi SAME achc (0,4) +BE SAME AChC (0,2) +BEi SAME AChC (0,4) +BE SAME ACHC (0,4) +BEi SAME ACHC (0,4) +BE SAME cchh NOMATCH +BEi SAME cchh (0,3) +BE SAME CChh (0,2) +BEi SAME CChh (0,3) +BE SAME CCHH (0,3) +BEi SAME CCHH (0,3) +BE SAME hchc NOMATCH +BEi SAME hchc (1,4) +BE SAME HChc (1,2) +BEi SAME HChc (1,4) +BE SAME HCHC (1,4) +BEi SAME HCHC (1,4) +BE [h[.ch.]c][h[.ch.]c]* ac (1,2) +BEi SAME ac (1,2) +BE SAME AC NOMATCH +BEi SAME AC (1,2) +BE SAME ach (1,3) +BEi SAME ach (1,3) +BE SAME ACh (2,3) +BEi SAME ACh (1,3) +BE SAME ACH NOMATCH +BEi SAME ACH (1,3) +BE SAME acch (1,4) +BEi SAME acch (1,4) +BE SAME ACCh (3,4) +BEi SAME ACCh (1,4) +BE SAME ACCH NOMATCH +BEi SAME ACCH (1,4) +BE SAME achc (1,4) +BEi SAME achc (1,4) +BE SAME AChC (2,3) +BEi SAME AChC (1,4) +BE SAME ACHC NOMATCH +BEi SAME ACHC (1,4) +BE SAME cchh (0,4) +BEi SAME cchh (0,4) +BE SAME CChh (2,4) +BEi SAME CChh (0,4) +BE SAME CCHH NOMATCH +BEi SAME CCHH (0,4) +BE SAME hchc (0,4) +BEi SAME hchc (0,4) +BE SAME HChc (2,4) +BEi SAME HChc (0,4) +BE SAME HCHC NOMATCH +BEi SAME HCHC (0,4) +BE [h[.Ch.]C][h[.Ch.]C]* ac NOMATCH +BEi SAME ac (1,2) +BE SAME AC (1,2) +BEi SAME AC (1,2) +BE SAME ach (2,3) +BEi SAME ach (1,3) +BE SAME ACh (1,3) +BEi SAME ACh (1,3) +BE SAME ACH (1,2) +BEi SAME ACH (1,3) +BE SAME acch (3,4) +BEi SAME acch (1,4) +BE SAME ACCh (1,4) +BEi SAME ACCh (1,4) +BE SAME ACCH (1,3) +BEi SAME ACCH (1,4) +BE SAME achc (2,3) +BEi SAME achc (1,4) +BE SAME AChC (1,4) +BEi SAME AChC (1,4) +BE SAME ACHC (1,2) +BEi SAME ACHC (1,4) +BE SAME cchh (2,4) +BEi SAME cchh (0,4) +BE SAME CChh (0,4) +BEi SAME CChh (0,4) +BE SAME CCHH (0,2) +BEi SAME CCHH (0,4) +BE SAME hchc (0,1) +BEi SAME hchc (0,4) +BE SAME HChc (1,3) +BEi SAME HChc (0,4) +BE SAME HCHC (1,2) +BEi SAME HCHC (0,4) +BE [H[.Ch.]c][H[.Ch.]c]* ac (1,2) +BEi SAME ac (1,2) +BE SAME AC NOMATCH +BEi SAME AC (1,2) +BE SAME ach (1,2) +BEi SAME ach (1,3) +BE SAME ACh (1,3) +BEi SAME ACh (1,3) +BE SAME ACH (2,3) +BEi SAME ACH (1,3) +BE SAME acch (1,3) +BEi SAME acch (1,4) +BE SAME ACCh (2,4) +BEi SAME ACCh (1,4) +BE SAME ACCH (3,4) +BEi SAME ACCH (1,4) +BE SAME achc (1,2) +BEi SAME achc (1,4) +BE SAME AChC (1,3) +BEi SAME AChC (1,4) +BE SAME ACHC (2,3) +BEi SAME ACHC (1,4) +BE SAME cchh (0,2) +BEi SAME cchh (0,4) +BE SAME CChh (1,3) +BEi SAME CChh (0,4) +BE SAME CCHH (2,4) +BEi SAME CCHH (0,4) +BE SAME hchc (1,2) +BEi SAME hchc (0,4) +BE SAME HChc (0,4) +BEi SAME HChc (0,4) +BE SAME HCHC (0,1) +BEi SAME HCHC (0,4) +BE [H[.CH.]C][H[.CH.]C]* ac NOMATCH +BEi SAME ac (1,2) +BE SAME AC (1,2) +BEi SAME AC (1,2) +BE SAME ach NOMATCH +BEi SAME ach (1,3) +BE SAME ACh (1,2) +BEi SAME ACh (1,3) +BE SAME ACH (1,3) +BEi SAME ACH (1,3) +BE SAME acch NOMATCH +BEi SAME acch (1,4) +BE SAME ACCh (1,3) +BEi SAME ACCh (1,4) +BE SAME ACCH (1,4) +BEi SAME ACCH (1,4) +BE SAME achc NOMATCH +BEi SAME achc (1,4) +BE SAME AChC (1,2) +BEi SAME AChC (1,4) +BE SAME ACHC (1,4) +BEi SAME ACHC (1,4) +BE SAME cchh NOMATCH +BEi SAME cchh (0,4) +BE SAME CChh (0,2) +BEi SAME CChh (0,4) +BE SAME CCHH (0,4) +BEi SAME CCHH (0,4) +BE SAME hchc NOMATCH +BEi SAME hchc (0,4) +BE SAME HChc (0,2) +BEi SAME HChc (0,4) +BE SAME HCHC (0,4) +BEi SAME HCHC (0,4) +BE [[.ch.]-z][[.ch.]-z]* x ERANGE +BEi SAME x ERANGE +BE [a-[.ch.]][a-[.ch.]]* x ERANGE +BEi SAME x ERANGE +B [a[.ch.]]\{2\} cha (0,3) +Bi SAME cha (0,3) +B SAME Cha NOMATCH +Bi SAME Cha (0,3) +B SAME CHA NOMATCH +Bi SAME CHA (0,3) +E [a[.ch.]]{2} cha (0,3) +Ei SAME cha (0,3) +E SAME Cha NOMATCH +Ei SAME Cha (0,3) +E SAME CHA NOMATCH +Ei SAME CHA (0,3) +B [A[.Ch.]]\{2\} cha NOMATCH +Bi SAME cha (0,3) +B SAME Cha NOMATCH +Bi SAME Cha (0,3) +B SAME CHA NOMATCH +Bi SAME CHA (0,3) +E [A[.Ch.]]{2} cha NOMATCH +Ei SAME cha (0,3) +E SAME Cha NOMATCH +Ei SAME Cha (0,3) +E SAME CHA NOMATCH +Ei SAME CHA (0,3) +B [A[.CH.]]\{2\} cha NOMATCH +Bi SAME cha (0,3) +B SAME Cha NOMATCH +Bi SAME Cha (0,3) +B SAME CHA (0,3) +Bi SAME CHA (0,3) +E [A[.CH.]]{2} cha NOMATCH +Ei SAME cha (0,3) +E SAME Cha NOMATCH +Ei SAME Cha (0,3) +E SAME CHA (0,3) +Ei SAME CHA (0,3) +B \([a[.ch.]]\)\1 chch (0,4)(0,2) +Bi SAME chch (0,4)(0,2) +B SAME chCh NOMATCH +Bi SAME chCh NOMATCH +B SAME Chch NOMATCH +Bi SAME Chch NOMATCH +B SAME ChCh NOMATCH +Bi SAME ChCh (0,4)(0,2) +B SAME ChCH NOMATCH +Bi SAME ChCH NOMATCH +B SAME CHCh NOMATCH +Bi SAME CHCh NOMATCH +B SAME CHCH NOMATCH +Bi SAME CHCH (0,4)(0,2) +B SAME aa (0,2)(0,1) +Bi SAME aa (0,2)(0,1) +B SAME AA NOMATCH +Bi SAME AA (0,2)(0,1) +B \([A[.Ch.]]\)\1 chch NOMATCH +Bi SAME chch (0,4)(0,2) +B SAME chCh NOMATCH +Bi SAME chCh NOMATCH +B SAME Chch NOMATCH +Bi SAME Chch NOMATCH +B SAME ChCh (0,4)(0,2) +Bi SAME ChCh (0,4)(0,2) +B SAME ChCH NOMATCH +Bi SAME ChCH NOMATCH +B SAME CHCh NOMATCH +Bi SAME CHCh NOMATCH +B SAME CHCH NOMATCH +Bi SAME CHCH (0,4)(0,2) +B \([A[.CH.]]\)\1 chch NOMATCH +Bi SAME chch (0,4)(0,2) +B SAME chCh NOMATCH +Bi SAME chCh NOMATCH +B SAME Chch NOMATCH +Bi SAME Chch NOMATCH +B SAME ChCh NOMATCH +Bi SAME ChCh (0,4)(0,2) +B SAME ChCH NOMATCH +Bi SAME ChCH NOMATCH +B SAME CHCh NOMATCH +Bi SAME CHCh NOMATCH +B SAME CHCH (0,4)(0,2) +Bi SAME CHCH (0,4)(0,2) +} +# Character classes +BE [a[:digit x ECTYPE +BE [a[:digit: x ECTYPE +BE [a[:digit:] x EBRACK +BE [[:lower:]-z][[:lower:]-z]* x ERANGE +BEi SAME x ERANGE +BE [a-[:lower:]][a-[:lower:]]* x ERANGE +BEi SAME x ERANGE +BE [[:lower:]][[:lower:]]* abc (0,3) +BEi SAME abc (0,3) +BE SAME ABC NOMATCH +BEi SAME ABC (0,3) +BE [[:lower:][:digit:]][[:lower:][:digit:]]* abc123 (0,6) +BEi SAME abc123 (0,6) +BE SAME ABC123 (3,6) +BEi SAME ABC123 (0,6) +BE [^[:lower:]][^[:lower:]]* abc123 (3,6) +BEi SAME abc123 (3,6) +BE SAME ABC123 (0,6) +BEi SAME ABC123 (3,6) +BE [^[:lower:][:digit:]][^[:lower:][:digit:]]* =>abc123 (0,2) +BEi SAME =>abc123 (0,2) +BE SAME =>ABC123 (0,5) +BEi SAME =>ABC123 (0,2) +BE SAME abc=>123 (3,5) +BEi SAME abc=>123 (3,5) +BE SAME ABC=>123 (0,5) +BEi SAME ABC=>123 (3,5) +BE SAME abc123=> (6,8) +BEi SAME abc123=> (6,8) +BE SAME ABC123=> (0,3) +BEi SAME ABC123=> (6,8) +{C ca_ES.ISO8859-1 +BE [[:lower:]-z][[:lower:]-z]* x ERANGE +BEi SAME x ERANGE +BE [a-[:lower:]][a-[:lower:]]* x ERANGE +BEi SAME x ERANGE +BE$ [[:lower:]][[:lower:]]* ab\x{e7} (0,3) +BEi$ SAME ab\x{e7} (0,3) +BE$ SAME AB\x{c7} NOMATCH +BEi$ SAME AB\x{c7} (0,3) +BE$ [[:lower:][:digit:]][[:lower:][:digit:]]* ab\x{e7}123 (0,6) +BEi$ SAME ab\x{e7}123 (0,6) +BE$ SAME AB\x{c7}123 (3,6) +BEi$ SAME AB\x{c7}123 (0,6) +BE$ [^[:lower:]][^[:lower:]]* ab\x{e7}123 (3,6) +BEi$ SAME ab\x{e7}123 (3,6) +BE$ SAME AB\x{c7}123 (0,6) +BEi$ SAME AB\x{c7}123 (3,6) +BE$ [^[:lower:][:digit:]][^[:lower:][:digit:]]* =>ab\x{e7}123 (0,2) +BEi$ SAME =>ab\x{e7}123 (0,2) +BE$ SAME =>AB\x{c7}123 (0,5) +BEi$ SAME =>AB\x{c7}123 (0,2) +BE$ SAME ab\x{e7}=>123 (3,5) +BEi$ SAME ab\x{e7}=>123 (3,5) +BE$ SAME AB\x{c7}=>123 (0,5) +BEi$ SAME AB\x{c7}=>123 (3,5) +BE$ SAME ab\x{e7}123=> (6,8) +BEi$ SAME ab\x{e7}123=> (6,8) +BE$ SAME AB\x{c7}123=> (0,3) +BEi$ SAME AB\x{c7}123=> (6,8) +} +# Equivalence classes +BE [a[= x ECOLLATE +BE [a[=e x ECOLLATE +BE [a[=e= x ECOLLATE +BE [a[=e=] x EBRACK +BE [[=e=]-z] x ERANGE +BEi [[=e=]-z] x ERANGE +BE [a-[=e=]] x ERANGE +BEi [a-[=e=]] x ERANGE +BE [[=e=]][[=e=]]* def (1,2) +BEi SAME def (1,2) +BE SAME DEF NOMATCH +BEi SAME DEF (1,2) +BE [[=E=]][[=E=]]* def NOMATCH +BEi SAME def (1,2) +BE SAME DEF (1,2) +BEi SAME DEF (1,2) +BE [^[=e=]][^[=e=]]* def (0,1) +BEi SAME def (0,1) +BE SAME DEF (0,3) +BEi SAME DEF (0,1) +BE [^[=E=]][^[=E=]]* def (0,3) +BEi SAME def (0,1) +BE SAME DEF (0,1) +BEi SAME DEF (0,1) +{C ca_ES.ISO8859-1 +BE [[=e=]-z] x ERANGE +BEi [[=e=]-z] x ERANGE +BE [a-[=e=]] x ERANGE +BEi [a-[=e=]] x ERANGE +BE [[=e=]-z] x ERANGE +BEi [[=e=]-z] x ERANGE +BE [a-[=e=]] x ERANGE +BEi [a-[=e=]] x ERANGE +BE$ [[=\xe9=]-z] x ERANGE +BEi$ [[=\xe9=]-z] x ERANGE +BE$ [a-[=\xe9=]] x ERANGE +BEi$ [a-[=\xe9=]] x ERANGE +BE [[=e=]][[=e=]]* def (1,2) +BEi SAME def (1,2) +BE SAME DEF NOMATCH +BEi SAME DEF (1,2) +BE$ SAME d\x{e9}f (1,2) +BEi$ SAME d\x{e9}f (1,2) +BE$ SAME D\x{c9}F NOMATCH +BEi$ SAME D\x{c9}F (1,2) +BE [[=E=]][[=E=]]* def NOMATCH +BEi SAME def (1,2) +BE SAME DEF (1,2) +BEi SAME DEF (1,2) +BE$ SAME d\x{e9}f NOMATCH +BEi$ SAME d\x{e9}f (1,2) +BE$ SAME D\x{c9}F (1,2) +BEi$ SAME D\x{c9}F (1,2) +BE$ [[=\xe9=]][[=\xe9=]]* def (1,2) +BEi$ SAME def (1,2) +BE$ SAME DEF NOMATCH +BEi$ SAME DEF (1,2) +BE$ SAME d\x{e9}f (1,2) +BEi$ SAME d\x{e9}f (1,2) +BE$ SAME D\x{c9}F NOMATCH +BEi$ SAME D\x{c9}F (1,2) +BE$ SAME d\x{ea}f (1,2) +BEi$ SAME d\x{ea}f (1,2) +BE$ SAME D\x{ca}F NOMATCH +BEi$ SAME D\x{ca}F (1,2) +BE$ [[=\xc9=]][[=\xc9=]]* def NOMATCH +BEi$ SAME def (1,2) +BE$ SAME DEF (1,2) +BEi$ SAME DEF (1,2) +BE$ SAME d\x{e9}f NOMATCH +BEi$ SAME d\x{e9}f (1,2) +BE$ SAME D\x{c9}F (1,2) +BEi$ SAME D\x{c9}F (1,2) +BE$ SAME d\x{ea}f NOMATCH +BEi$ SAME d\x{ea}f (1,2) +BE$ SAME D\x{ca}F (1,2) +BEi$ SAME D\x{ca}F (1,2) +BE [^[=e=]][^[=e=]]* def (0,1) +BEi SAME def (0,1) +BE SAME DEF (0,3) +BEi SAME DEF (0,1) +BE$ SAME d\x{e9}f (0,1) +BEi$ SAME d\x{e9}f (0,1) +BE$ SAME D\x{c9}F (0,3) +BEi$ SAME D\x{c9}F (0,1) +BE [^[=E=]][^[=E=]]* def (0,3) +BEi SAME def (0,1) +BE SAME DEF (0,1) +BEi SAME DEF (0,1) +BE$ SAME d\x{e9}f (0,3) +BEi$ SAME d\x{e9}f (0,1) +BE$ SAME D\x{c9}F (0,1) +BEi$ SAME D\x{c9}F (0,1) +BE$ [^[=\xe9=]][^[=\xe9=]]* def (0,1) +BEi$ SAME def (0,1) +BE$ SAME DEF (0,3) +BEi$ SAME DEF (0,1) +BE$ SAME d\x{e9}f (0,1) +BEi$ SAME d\x{e9}f (0,1) +BE$ SAME D\x{c9}F (0,3) +BEi$ SAME D\x{c9}F (0,1) +BE$ SAME d\x{ea}f (0,1) +BEi$ SAME d\x{ea}f (0,1) +BE$ SAME D\x{ca}F (0,3) +BEi$ SAME D\x{ca}F (0,1) +BE$ [^[=\xc9=]][^[=\xc9=]]* def (0,3) +BEi$ SAME def (0,1) +BE$ SAME DEF (0,1) +BEi$ SAME DEF (0,1) +BE$ SAME d\x{e9}f (0,3) +BEi$ SAME d\x{e9}f (0,1) +BE$ SAME D\x{c9}F (0,1) +BEi$ SAME D\x{c9}F (0,1) +BE$ SAME d\x{ea}f (0,3) +BEi$ SAME d\x{ea}f (0,1) +BE$ SAME D\x{ca}F (0,1) +BEi$ SAME D\x{ca}F (0,1) +} +# Combinations +{C ca_ES.ISO8859-1 +BE [a[.ch.][:digit:]z][a[.ch.][:digit:]z]* ach4z (0,5) +BEi SAME ach4z (0,5) +BE SAME ACh4z (3,5) +BEi SAME ACh4z (0,5) +BE SAME ACH4Z (3,4) +BEi SAME ACH4Z (0,5) +BE [A[.Ch.][:digit:]z][A[.Ch.][:digit:]z]* ach4z (3,5) +BEi SAME ach4z (0,5) +BE SAME ACh4z (0,5) +BEi SAME ACh4z (0,5) +BE SAME ACH4Z (0,1) +BEi SAME ACH4Z (0,5) +BE [A[.CH.][:digit:]Z][A[.CH.][:digit:]Z]* ach4z (3,4) +BEi SAME ach4z (0,5) +BE SAME ACh4z (0,1) +BEi SAME ACh4z (0,5) +BE SAME ACH4Z (0,5) +BEi SAME ACH4Z (0,5) +BE [[.ch.][=e=]][[.ch.][=e=]]* chech (0,5) +BEi SAME chech (0,5) +BE SAME CheCh (2,3) +BEi SAME CheCh (0,5) +BE SAME ChECh NOMATCH +BEi SAME ChECh (0,5) +BE SAME CHeCH (2,3) +BEi SAME CHeCH (0,5) +BE SAME CHECH NOMATCH +BEi SAME CHECH (0,5) +BE SAME chec (0,3) +BEi SAME chec (0,3) +BE SAME CheC (2,3) +BEi SAME CheC (0,3) +BE SAME ChEC NOMATCH +BEi SAME ChEC (0,3) +BE SAME CHeC (2,3) +BEi SAME CHeC (0,3) +BE SAME CHEC NOMATCH +BEi SAME CHEC (0,3) +BE$ SAME ch\x{e9}ch (0,5) +BEi$ SAME ch\x{e9}ch (0,5) +BE$ SAME Ch\x{e9}Ch (2,3) +BEi$ SAME Ch\x{e9}Ch (0,5) +BE$ SAME Ch\x{c9}Ch NOMATCH +BEi$ SAME Ch\x{c9}Ch (0,5) +BE$ SAME CH\x{e9}CH (2,3) +BEi$ SAME CH\x{e9}CH (0,5) +BE$ SAME CH\x{c9}CH NOMATCH +BEi$ SAME CH\x{c9}CH (0,5) +BE$ SAME ch\x{e9}c (0,3) +BEi$ SAME ch\x{e9}c (0,3) +BE$ SAME Ch\x{e9}C (2,3) +BEi$ SAME Ch\x{e9}C (0,3) +BE$ SAME Ch\x{c9}C NOMATCH +BEi$ SAME Ch\x{c9}C (0,3) +BE$ SAME CH\x{e9}C (2,3) +BEi$ SAME CH\x{e9}C (0,3) +BE$ SAME CH\x{c9}C NOMATCH +BEi$ SAME CH\x{c9}C (0,3) +BE [[.Ch.][=e=]][[.Ch.][=e=]]* chech (2,3) +BEi SAME chech (0,5) +BE SAME CheCh (0,5) +BEi SAME CheCh (0,5) +BE SAME ChECh (0,2) +BEi SAME ChECh (0,5) +BE SAME CHeCH (2,3) +BEi SAME CHeCH (0,5) +BE SAME CHECH NOMATCH +BEi SAME CHECH (0,5) +BE SAME chec (2,3) +BEi SAME chec (0,3) +BE SAME CheC (0,3) +BEi SAME CheC (0,3) +BE SAME ChEC (0,2) +BEi SAME ChEC (0,3) +BE SAME CHeC (2,3) +BEi SAME CHeC (0,3) +BE SAME CHEC NOMATCH +BEi SAME CHEC (0,3) +BE$ SAME ch\x{e9}ch (2,3) +BEi$ SAME ch\x{e9}ch (0,5) +BE$ SAME Ch\x{e9}Ch (0,5) +BEi$ SAME Ch\x{e9}Ch (0,5) +BE$ SAME Ch\x{c9}Ch (0,2) +BEi$ SAME Ch\x{c9}Ch (0,5) +BE$ SAME CH\x{e9}CH (2,3) +BEi$ SAME CH\x{e9}CH (0,5) +BE$ SAME CH\x{c9}CH NOMATCH +BEi$ SAME CH\x{c9}CH (0,5) +BE$ SAME ch\x{e9}c (2,3) +BEi$ SAME ch\x{e9}c (0,3) +BE$ SAME Ch\x{e9}C (0,3) +BEi$ SAME Ch\x{e9}C (0,3) +BE$ SAME Ch\x{c9}C (0,2) +BEi$ SAME Ch\x{c9}C (0,3) +BE$ SAME CH\x{e9}C (2,3) +BEi$ SAME CH\x{e9}C (0,3) +BE$ SAME CH\x{c9}C NOMATCH +BEi$ SAME CH\x{c9}C (0,3) +BE [[.ch.][=E=]][[.ch.][=E=]]* chech (0,2) +BEi SAME chech (0,5) +BE SAME CheCh NOMATCH +BEi SAME CheCh (0,5) +BE SAME ChECh (2,3) +BEi SAME ChECh (0,5) +BE SAME CHeCH NOMATCH +BEi SAME CHeCH (0,5) +BE SAME CHECH (2,3) +BEi SAME CHECH (0,5) +BE SAME chec (0,2) +BEi SAME chec (0,3) +BE SAME CheC NOMATCH +BEi SAME CheC (0,3) +BE SAME ChEC (2,3) +BEi SAME ChEC (0,3) +BE SAME CHeC NOMATCH +BEi SAME CHeC (0,3) +BE SAME CHEC (2,3) +BEi SAME CHEC (0,3) +BE$ SAME ch\x{e9}ch (0,2) +BEi$ SAME ch\x{e9}ch (0,5) +BE$ SAME Ch\x{e9}Ch NOMATCH +BEi$ SAME Ch\x{e9}Ch (0,5) +BE$ SAME Ch\x{c9}Ch (2,3) +BEi$ SAME Ch\x{c9}Ch (0,5) +BE$ SAME CH\x{e9}CH NOMATCH +BEi$ SAME CH\x{e9}CH (0,5) +BE$ SAME CH\x{c9}CH (2,3) +BEi$ SAME CH\x{c9}CH (0,5) +BE$ SAME ch\x{e9}c (0,2) +BEi$ SAME ch\x{e9}c (0,3) +BE$ SAME Ch\x{e9}C NOMATCH +BEi$ SAME Ch\x{e9}C (0,3) +BE$ SAME Ch\x{c9}C (2,3) +BEi$ SAME Ch\x{c9}C (0,3) +BE$ SAME CH\x{e9}C NOMATCH +BEi$ SAME CH\x{e9}C (0,3) +BE$ SAME CH\x{c9}C (2,3) +BEi$ SAME CH\x{c9}C (0,3) +BE [[.Ch.][=E=]][[.Ch.][=E=]]* chech NOMATCH +BEi SAME chech (0,5) +BE SAME CheCh (0,2) +BEi SAME CheCh (0,5) +BE SAME ChECh (0,5) +BEi SAME ChECh (0,5) +BE SAME CHeCH NOMATCH +BEi SAME CHeCH (0,5) +BE SAME CHECH (2,3) +BEi SAME CHECH (0,5) +BE SAME chec NOMATCH +BEi SAME chec (0,3) +BE SAME CheC (0,2) +BEi SAME CheC (0,3) +BE SAME ChEC (0,3) +BEi SAME ChEC (0,3) +BE SAME CHeC NOMATCH +BEi SAME CHeC (0,3) +BE SAME CHEC (2,3) +BEi SAME CHEC (0,3) +BE$ SAME ch\x{e9}ch NOMATCH +BEi$ SAME ch\x{e9}ch (0,5) +BE$ SAME Ch\x{e9}Ch (0,2) +BEi$ SAME Ch\x{e9}Ch (0,5) +BE$ SAME Ch\x{c9}Ch (0,5) +BEi$ SAME Ch\x{c9}Ch (0,5) +BE$ SAME CH\x{e9}CH NOMATCH +BEi$ SAME CH\x{e9}CH (0,5) +BE$ SAME CH\x{c9}CH (2,3) +BEi$ SAME CH\x{c9}CH (0,5) +BE$ SAME ch\x{e9}c NOMATCH +BEi$ SAME ch\x{e9}c (0,3) +BE$ SAME Ch\x{e9}C (0,2) +BEi$ SAME Ch\x{e9}C (0,3) +BE$ SAME Ch\x{c9}C (0,3) +BEi$ SAME Ch\x{c9}C (0,3) +BE$ SAME CH\x{e9}C NOMATCH +BEi$ SAME CH\x{e9}C (0,3) +BE$ SAME CH\x{c9}C (2,3) +BEi$ SAME CH\x{c9}C (0,3) +BE [[.CH.][=e=]][[.CH.][=e=]]* chech (2,3) +BEi SAME chech (0,5) +BE SAME CheCh (2,3) +BEi SAME CheCh (0,5) +BE SAME ChECh NOMATCH +BEi SAME ChECh (0,5) +BE SAME CHeCH (0,5) +BEi SAME CHeCH (0,5) +BE SAME CHECH (0,2) +BEi SAME CHECH (0,5) +BE SAME chec (2,3) +BEi SAME chec (0,3) +BE SAME CheC (2,3) +BEi SAME CheC (0,3) +BE SAME ChEC NOMATCH +BEi SAME ChEC (0,3) +BE SAME CHeC (0,3) +BEi SAME CHeC (0,3) +BE SAME CHEC (0,2) +BEi SAME CHEC (0,3) +BE$ SAME ch\x{e9}ch (2,3) +BEi$ SAME ch\x{e9}ch (0,5) +BE$ SAME Ch\x{e9}Ch (2,3) +BEi$ SAME Ch\x{e9}Ch (0,5) +BE$ SAME Ch\x{c9}Ch NOMATCH +BEi$ SAME Ch\x{c9}Ch (0,5) +BE$ SAME CH\x{e9}CH (0,5) +BEi$ SAME CH\x{e9}CH (0,5) +BE$ SAME CH\x{c9}CH (0,2) +BEi$ SAME CH\x{c9}CH (0,5) +BE$ SAME ch\x{e9}c (2,3) +BEi$ SAME ch\x{e9}c (0,3) +BE$ SAME Ch\x{e9}C (2,3) +BEi$ SAME Ch\x{e9}C (0,3) +BE$ SAME Ch\x{c9}C NOMATCH +BEi$ SAME Ch\x{c9}C (0,3) +BE$ SAME CH\x{e9}C (0,3) +BEi$ SAME CH\x{e9}C (0,3) +BE$ SAME CH\x{c9}C (0,2) +BEi$ SAME CH\x{c9}C (0,3) +BE [[.CH.][=E=]][[.CH.][=E=]]* chech NOMATCH +BEi SAME chech (0,5) +BE SAME CheCh NOMATCH +BEi SAME CheCh (0,5) +BE SAME ChECh (2,3) +BEi SAME ChECh (0,5) +BE SAME CHeCH (0,2) +BEi SAME CHeCH (0,5) +BE SAME CHECH (0,5) +BEi SAME CHECH (0,5) +BE SAME chec NOMATCH +BEi SAME chec (0,3) +BE SAME CheC NOMATCH +BEi SAME CheC (0,3) +BE SAME ChEC (2,3) +BEi SAME ChEC (0,3) +BE SAME CHeC (0,2) +BEi SAME CHeC (0,3) +BE SAME CHEC (0,3) +BEi SAME CHEC (0,3) +BE$ SAME ch\x{e9}ch NOMATCH +BEi$ SAME ch\x{e9}ch (0,5) +BE$ SAME Ch\x{e9}Ch NOMATCH +BEi$ SAME Ch\x{e9}Ch (0,5) +BE$ SAME Ch\x{c9}Ch (2,3) +BEi$ SAME Ch\x{c9}Ch (0,5) +BE$ SAME CH\x{e9}CH (0,2) +BEi$ SAME CH\x{e9}CH (0,5) +BE$ SAME CH\x{c9}CH (0,5) +BEi$ SAME CH\x{c9}CH (0,5) +BE$ SAME ch\x{e9}c NOMATCH +BEi$ SAME ch\x{e9}c (0,3) +BE$ SAME Ch\x{e9}C NOMATCH +BEi$ SAME Ch\x{e9}C (0,3) +BE$ SAME Ch\x{c9}C (2,3) +BEi$ SAME Ch\x{c9}C (0,3) +BE$ SAME CH\x{e9}C (0,2) +BEi$ SAME CH\x{e9}C (0,3) +BE$ SAME CH\x{c9}C (0,3) +BEi$ SAME CH\x{c9}C (0,3) +BE$ [[.ch.][=\xe9=]][[.ch.][=\xe9=]]* chech (0,5) +BEi$ SAME chech (0,5) +BE$ SAME CheCh (2,3) +BEi$ SAME CheCh (0,5) +BE$ SAME ChECh NOMATCH +BEi$ SAME ChECh (0,5) +BE$ SAME CHeCH (2,3) +BEi$ SAME CHeCH (0,5) +BE$ SAME CHECH NOMATCH +BEi$ SAME CHECH (0,5) +BE$ SAME chec (0,3) +BEi$ SAME chec (0,3) +BE$ SAME CheC (2,3) +BEi$ SAME CheC (0,3) +BE$ SAME ChEC NOMATCH +BEi$ SAME ChEC (0,3) +BE$ SAME CHeC (2,3) +BEi$ SAME CHeC (0,3) +BE$ SAME CHEC NOMATCH +BEi$ SAME CHEC (0,3) +BE$ SAME ch\x{e9}ch (0,5) +BEi$ SAME ch\x{e9}ch (0,5) +BE$ SAME Ch\x{e9}Ch (2,3) +BEi$ SAME Ch\x{e9}Ch (0,5) +BE$ SAME Ch\x{c9}Ch NOMATCH +BEi$ SAME Ch\x{c9}Ch (0,5) +BE$ SAME CH\x{e9}CH (2,3) +BEi$ SAME CH\x{e9}CH (0,5) +BE$ SAME CH\x{c9}CH NOMATCH +BEi$ SAME CH\x{c9}CH (0,5) +BE$ SAME ch\x{e9}c (0,3) +BEi$ SAME ch\x{e9}c (0,3) +BE$ SAME Ch\x{e9}C (2,3) +BEi$ SAME Ch\x{e9}C (0,3) +BE$ SAME Ch\x{c9}C NOMATCH +BEi$ SAME Ch\x{c9}C (0,3) +BE$ SAME CH\x{e9}C (2,3) +BEi$ SAME CH\x{e9}C (0,3) +BE$ SAME CH\x{c9}C NOMATCH +BEi$ SAME CH\x{c9}C (0,3) +BE$ [[.Ch.][=\xe9=]][[.Ch.][=\xe9=]]* chech (2,3) +BEi$ SAME chech (0,5) +BE$ SAME CheCh (0,5) +BEi$ SAME CheCh (0,5) +BE$ SAME ChECh (0,2) +BEi$ SAME ChECh (0,5) +BE$ SAME CHeCH (2,3) +BEi$ SAME CHeCH (0,5) +BE$ SAME CHECH NOMATCH +BEi$ SAME CHECH (0,5) +BE$ SAME chec (2,3) +BEi$ SAME chec (0,3) +BE$ SAME CheC (0,3) +BEi$ SAME CheC (0,3) +BE$ SAME ChEC (0,2) +BEi$ SAME ChEC (0,3) +BE$ SAME CHeC (2,3) +BEi$ SAME CHeC (0,3) +BE$ SAME CHEC NOMATCH +BEi$ SAME CHEC (0,3) +BE$ SAME ch\x{e9}ch (2,3) +BEi$ SAME ch\x{e9}ch (0,5) +BE$ SAME Ch\x{e9}Ch (0,5) +BEi$ SAME Ch\x{e9}Ch (0,5) +BE$ SAME Ch\x{c9}Ch (0,2) +BEi$ SAME Ch\x{c9}Ch (0,5) +BE$ SAME CH\x{e9}CH (2,3) +BEi$ SAME CH\x{e9}CH (0,5) +BE$ SAME CH\x{c9}CH NOMATCH +BEi$ SAME CH\x{c9}CH (0,5) +BE$ SAME ch\x{e9}c (2,3) +BEi$ SAME ch\x{e9}c (0,3) +BE$ SAME Ch\x{e9}C (0,3) +BEi$ SAME Ch\x{e9}C (0,3) +BE$ SAME Ch\x{c9}C (0,2) +BEi$ SAME Ch\x{c9}C (0,3) +BE$ SAME CH\x{e9}C (2,3) +BEi$ SAME CH\x{e9}C (0,3) +BE$ SAME CH\x{c9}C NOMATCH +BEi$ SAME CH\x{c9}C (0,3) +BE$ [[.ch.][=\xc9=]][[.ch.][=\xc9=]]* chech (0,2) +BEi$ SAME chech (0,5) +BE$ SAME CheCh NOMATCH +BEi$ SAME CheCh (0,5) +BE$ SAME ChECh (2,3) +BEi$ SAME ChECh (0,5) +BE$ SAME CHeCH NOMATCH +BEi$ SAME CHeCH (0,5) +BE$ SAME CHECH (2,3) +BEi$ SAME CHECH (0,5) +BE$ SAME chec (0,2) +BEi$ SAME chec (0,3) +BE$ SAME CheC NOMATCH +BEi$ SAME CheC (0,3) +BE$ SAME ChEC (2,3) +BEi$ SAME ChEC (0,3) +BE$ SAME CHeC NOMATCH +BEi$ SAME CHeC (0,3) +BE$ SAME CHEC (2,3) +BEi$ SAME CHEC (0,3) +BE$ SAME ch\x{e9}ch (0,2) +BEi$ SAME ch\x{e9}ch (0,5) +BE$ SAME Ch\x{e9}Ch NOMATCH +BEi$ SAME Ch\x{e9}Ch (0,5) +BE$ SAME Ch\x{c9}Ch (2,3) +BEi$ SAME Ch\x{c9}Ch (0,5) +BE$ SAME CH\x{e9}CH NOMATCH +BEi$ SAME CH\x{e9}CH (0,5) +BE$ SAME CH\x{c9}CH (2,3) +BEi$ SAME CH\x{c9}CH (0,5) +BE$ SAME ch\x{e9}c (0,2) +BEi$ SAME ch\x{e9}c (0,3) +BE$ SAME Ch\x{e9}C NOMATCH +BEi$ SAME Ch\x{e9}C (0,3) +BE$ SAME Ch\x{c9}C (2,3) +BEi$ SAME Ch\x{c9}C (0,3) +BE$ SAME CH\x{e9}C NOMATCH +BEi$ SAME CH\x{e9}C (0,3) +BE$ SAME CH\x{c9}C (2,3) +BEi$ SAME CH\x{c9}C (0,3) +BE$ [[.Ch.][=\xc9=]][[.Ch.][=\xc9=]]* chech NOMATCH +BEi$ SAME chech (0,5) +BE$ SAME CheCh (0,2) +BEi$ SAME CheCh (0,5) +BE$ SAME ChECh (0,5) +BEi$ SAME ChECh (0,5) +BE$ SAME CHeCH NOMATCH +BEi$ SAME CHeCH (0,5) +BE$ SAME CHECH (2,3) +BEi$ SAME CHECH (0,5) +BE$ SAME chec NOMATCH +BEi$ SAME chec (0,3) +BE$ SAME CheC (0,2) +BEi$ SAME CheC (0,3) +BE$ SAME ChEC (0,3) +BEi$ SAME ChEC (0,3) +BE$ SAME CHeC NOMATCH +BEi$ SAME CHeC (0,3) +BE$ SAME CHEC (2,3) +BEi$ SAME CHEC (0,3) +BE$ SAME ch\x{e9}ch NOMATCH +BEi$ SAME ch\x{e9}ch (0,5) +BE$ SAME Ch\x{e9}Ch (0,2) +BEi$ SAME Ch\x{e9}Ch (0,5) +BE$ SAME Ch\x{c9}Ch (0,5) +BEi$ SAME Ch\x{c9}Ch (0,5) +BE$ SAME CH\x{e9}CH NOMATCH +BEi$ SAME CH\x{e9}CH (0,5) +BE$ SAME CH\x{c9}CH (2,3) +BEi$ SAME CH\x{c9}CH (0,5) +BE$ SAME ch\x{e9}c NOMATCH +BEi$ SAME ch\x{e9}c (0,3) +BE$ SAME Ch\x{e9}C (0,2) +BEi$ SAME Ch\x{e9}C (0,3) +BE$ SAME Ch\x{c9}C (0,3) +BEi$ SAME Ch\x{c9}C (0,3) +BE$ SAME CH\x{e9}C NOMATCH +BEi$ SAME CH\x{e9}C (0,3) +BE$ SAME CH\x{c9}C (2,3) +BEi$ SAME CH\x{c9}C (0,3) +BE$ [[.CH.][=\xe9=]][[.CH.][=\xe9=]]* chech (2,3) +BEi$ SAME chech (0,5) +BE$ SAME CheCh (2,3) +BEi$ SAME CheCh (0,5) +BE$ SAME ChECh NOMATCH +BEi$ SAME ChECh (0,5) +BE$ SAME CHeCH (0,5) +BEi$ SAME CHeCH (0,5) +BE$ SAME CHECH (0,2) +BEi$ SAME CHECH (0,5) +BE$ SAME chec (2,3) +BEi$ SAME chec (0,3) +BE$ SAME CheC (2,3) +BEi$ SAME CheC (0,3) +BE$ SAME ChEC NOMATCH +BEi$ SAME ChEC (0,3) +BE$ SAME CHeC (0,3) +BEi$ SAME CHeC (0,3) +BE$ SAME CHEC (0,2) +BEi$ SAME CHEC (0,3) +BE$ SAME ch\x{e9}ch (2,3) +BEi$ SAME ch\x{e9}ch (0,5) +BE$ SAME Ch\x{e9}Ch (2,3) +BEi$ SAME Ch\x{e9}Ch (0,5) +BE$ SAME Ch\x{c9}Ch NOMATCH +BEi$ SAME Ch\x{c9}Ch (0,5) +BE$ SAME CH\x{e9}CH (0,5) +BEi$ SAME CH\x{e9}CH (0,5) +BE$ SAME CH\x{c9}CH (0,2) +BEi$ SAME CH\x{c9}CH (0,5) +BE$ SAME ch\x{e9}c (2,3) +BEi$ SAME ch\x{e9}c (0,3) +BE$ SAME Ch\x{e9}C (2,3) +BEi$ SAME Ch\x{e9}C (0,3) +BE$ SAME Ch\x{c9}C NOMATCH +BEi$ SAME Ch\x{c9}C (0,3) +BE$ SAME CH\x{e9}C (0,3) +BEi$ SAME CH\x{e9}C (0,3) +BE$ SAME CH\x{c9}C (0,2) +BEi$ SAME CH\x{c9}C (0,3) +BE$ [[.CH.][=\xc9=]][[.CH.][=\xc9=]]* chech NOMATCH +BEi$ SAME chech (0,5) +BE$ SAME CheCh NOMATCH +BEi$ SAME CheCh (0,5) +BE$ SAME ChECh (2,3) +BEi$ SAME ChECh (0,5) +BE$ SAME CHeCH (0,2) +BEi$ SAME CHeCH (0,5) +BE$ SAME CHECH (0,5) +BEi$ SAME CHECH (0,5) +BE$ SAME chec NOMATCH +BEi$ SAME chec (0,3) +BE$ SAME CheC NOMATCH +BEi$ SAME CheC (0,3) +BE$ SAME ChEC (2,3) +BEi$ SAME ChEC (0,3) +BE$ SAME CHeC (0,2) +BEi$ SAME CHeC (0,3) +BE$ SAME CHEC (0,3) +BEi$ SAME CHEC (0,3) +BE$ SAME ch\x{e9}ch NOMATCH +BEi$ SAME ch\x{e9}ch (0,5) +BE$ SAME Ch\x{e9}Ch NOMATCH +BEi$ SAME Ch\x{e9}Ch (0,5) +BE$ SAME Ch\x{c9}Ch (2,3) +BEi$ SAME Ch\x{c9}Ch (0,5) +BE$ SAME CH\x{e9}CH (0,2) +BEi$ SAME CH\x{e9}CH (0,5) +BE$ SAME CH\x{c9}CH (0,5) +BEi$ SAME CH\x{c9}CH (0,5) +BE$ SAME ch\x{e9}c NOMATCH +BEi$ SAME ch\x{e9}c (0,3) +BE$ SAME Ch\x{e9}C NOMATCH +BEi$ SAME Ch\x{e9}C (0,3) +BE$ SAME Ch\x{c9}C (2,3) +BEi$ SAME Ch\x{c9}C (0,3) +BE$ SAME CH\x{e9}C (0,2) +BEi$ SAME CH\x{e9}C (0,3) +BE$ SAME CH\x{c9}C (0,3) +BEi$ SAME CH\x{c9}C (0,3) +} +# Special case +BE [[:<:]] abc (0,0) +BE SAME === NOMATCH +BE SAME ===abc (3,3) +BE [[:>:]] abc (3,3) +BE SAME === NOMATCH +BE SAME ===abc (6,6) diff --git a/tests/regex/datafiles/categorize.dat b/tests/regex/datafiles/categorize.dat new file mode 100644 index 0000000..d348512 --- /dev/null +++ b/tests/regex/datafiles/categorize.dat @@ -0,0 +1,62 @@ +NOTE regex implementation categorization 2004-05-31 + +?E aa* xaxaax (1,2) POSITION=leftmost +; POSITION=bug + +?E (a*)(ab)*(b*) abc (0,2)(0,1)(?,?)(1,2) ASSOCIATIVITY=right +|E (a*)(ab)*(b*) abc (0,2)(0,0)(0,2)(2,2) ASSOCIATIVITY=left +; ASSOCIATIVITY=bug + +?E ((a*)(ab)*)((b*)(a*)) aba (0,3)(0,2)(0,0)(0,2)(2,3)(2,2)(2,3) SUBEXPRESSION=precedence +|E ((a*)(ab)*)((b*)(a*)) aba (0,3)(0,1)(0,1)(?,?)(1,3)(1,2)(2,3) SUBEXPRESSION=grouping +; SUBEXPRESSION=bug + +?E (...?.?)* xxxxxx (0,6)(4,6) REPEAT_LONGEST=first +|E (...?.?)* xxxxxx (0,6)(2,6) REPEAT_LONGEST=last +|E (...?.?)* xxxxxx OK REPEAT_LONGEST=unknown +; REPEAT_LONGEST=bug + +?E (a|ab)(bc|c) abcabc (0,3)(0,2)(2,3) EXPECTED +|E (a|ab)(bc|c) abcabc (0,3)(0,1)(1,3) BUG=alternation-order +; BUG=alternation-order-UNKNOWN + +?E (aba|a*b)(aba|a*b) ababa (0,5)(0,2)(2,5) EXPECTED +|E (aba|a*b)(aba|a*b) ababa (0,4)(0,3)(3,4) BUG=first-match +; BUG=unknown-match + +?B a\(b\)*\1 a NOMATCH EXPECTED +|B a\(b\)*\1 a (0,1) BUG=nomatch-match +|B a\(b\)*\1 abab (0,2)(1,2) # BUG=repeat-any +; BUG=nomatch-match-UNKNOWN + +?E (a*){2} xxxxx (0,0)(0,0) EXPECTED +|E (a*){2} xxxxx (5,5)(5,5) BUG=range-null +; BUG=range-null-UNKNOWN + +?B a\(b\)*\1 abab NOMATCH EXPECTED +|B a\(b\)*\1 abab (0,1) # BUG=nomatch-match +|B a\(b\)*\1 abab (0,2)(1,2) BUG=repeat-any +; BUG=repeat-any-UNKNOWN + +?E (a*)* a (0,1)(0,1) EXPECTED +|E (a*)* ax (0,1)(0,1) BUG=repeat-null-unknown +|E (a*)* a (0,1)(1,1) BUG=repeat-null +; BUG=repeat-null-UNKNOWN + +?E (aba|a*b)* ababa (0,5)(2,5) EXPECTED +|E (aba|a*b)* ababa (0,5)(3,4) BUG=repeat-short +|E (aba|a*b)* ababa (0,4)(3,4) # LENGTH=first +; BUG=repeat-short-UNKNOWN + +?E (a(b)?)+ aba (0,3)(2,3) EXPECTED +|E (a(b)?)+ aba (0,3)(2,3)(1,2) BUG=repeat-artifact +; BUG=repeat-artifact-UNKNOWN + +?B \(a\(b\)*\)*\2 abab NOMATCH EXPECTED +|B \(a\(b\)*\)*\2 abab (0,4)(2,3)(1,2) BUG=repeat-artifact-nomatch +; BUG=repeat-artifact-nomatch-UNKNOWN + +?E (a?)((ab)?)(b?)a?(ab)?b? abab (0,4)(0,1)(1,1)(?,?)(1,2)(2,4) BUG=subexpression-first +|E .*(.*) ab (0,2)(2,2) EXPECTED +|E .*(.*) ab (0,2)(0,2) BUG=subexpression-first +; BUG=subexpression-first-UNKNOWN diff --git a/tests/regex/datafiles/characterclass.dat b/tests/regex/datafiles/characterclass.dat new file mode 100644 index 0000000..2e85512 --- /dev/null +++ b/tests/regex/datafiles/characterclass.dat @@ -0,0 +1,2 @@ +B [[:digit:]]* 123abc (0,3) +E [[:digit:]]* 123abc (0,3) diff --git a/tests/regex/datafiles/conformance-vsc-ed.dat b/tests/regex/datafiles/conformance-vsc-ed.dat new file mode 100644 index 0000000..b086fd0 --- /dev/null +++ b/tests/regex/datafiles/conformance-vsc-ed.dat @@ -0,0 +1,17 @@ +# vsc/tset/POSIX.cmd/ed/ed_02.ex 77 2 +B ^* a*c NOMATCH +# vsc/tset/POSIX.cmd/ed/ed_02.ex 77 3 +B SAME ^*ab NOMATCH +# vsc/tset/POSIX.cmd/ed/ed_02.ex 77 2 +B \(^*ab\) ^*ab NOMATCH +# vsc/tset/POSIX.cmd/ed/ed_02.ex 77 3 +B \(^*b\) a*b NOMATCH +# vsc/tset/POSIX.cmd/ed/ed_02.ex 77 4 +B \(^*b\) ^*b NOMATCH +# vsc/tset/POSIX.cmd/ed/ed_06.ex 269 4 +B ^**9= ***9= (0,5) +# vsc/tset/POSIX.cmd/ed/ed_08.ex 374 1 +BE \the the (0,3) +BE$ \\the \the NOMATCH +# vsc/tset/POSIX.cmd/ed/ed_10.ex 498 1 +BE fu\rthe\r further (0,7) diff --git a/tests/regex/datafiles/conformance-vsx-regcomp.dat b/tests/regex/datafiles/conformance-vsx-regcomp.dat new file mode 100644 index 0000000..5dc6951 --- /dev/null +++ b/tests/regex/datafiles/conformance-vsx-regcomp.dat @@ -0,0 +1,130 @@ +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 1 +BE z4 123ABCz456DEF (6,8) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 2 +E C|k 123ABCz456DEFhij (5,6) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 3 +B$ \\(\\(ABC\\)z\\(456\\)D\\) 123ABCz456DEF (3,11)(3,11)(3,6)(7,10) +E$ (123)(ABC) 123ABCz456DEF (0,6)(0,3)(3,6) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 4 +BE$ weU hhehweU[^J]o/.aq (4,7) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 5 +BE$ [A-K] 7917263lus;/*shls NOMATCH +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 6 +BE$ DEF. abcxyz123DEFhij890 (9,13) +BE$ def. abcxyz123DEFhij890 NOMATCH +E$ (DEF)|(QRS) abcxyz123DEFhij890 (9,12)(9,12)(?,?) +E$ (def)|(qrs) abcxyz123DEFhij890 NOMATCH +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 7 +BEi$ def abcxyz123DEFhij890 (9,12) +BEi$ DEF abcxyz123DEFhij890 (9,12) +Ei$ (def)|(qrs) abcxyz123DEFhij890 (9,12)(9,12)(?,?) +Ei$ (DEF)|(QRS) abcxyz123DEFhij890 (9,12)(9,12)(?,?) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 8 +B$ \\(b\\)..\\(yz1\\).*\\(89\\) abcxyz123DEFhij890k%#57WQ (1,17)(1,2)(4,7)(15,17) +E$ (bc)+(x)? abcxyz123DEFhij890k%#57WQ (1,4)(1,3)(3,4) +B$ \\(bc\\).*\\(D\\)\\(E\\)\\(F\\)\\(h\\)\\(i\\)\\(j\\)\\(8\\)\\(90k\\) abcxyz123DEFhij890k%#57WQ (1,19)(1,3)(9,10)(10,11)(11,12)(12,13)(13,14)(14,15)(15,16)(16,19) +E$ (bc).*(D)(E)(F)(h)(i)(j)(8)(90k) abcxyz123DEFhij890k%#57WQ (1,19)(1,3)(9,10)(10,11)(11,12)(12,13)(13,14)(14,15)(15,16)(16,19) +B$ xyz abcxyz123DEFhij890k%#57WQ (3,6) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 9 +B$ \\(b\\)..\\(yz1\\).*\\(89\\) abcxyz123DEFhij890k%#57WQ (1,17)(1,2)(4,7)(15,17) +E$ (bc)+(x)? abcxyz123DEFhij890k%#57WQ (1,4)(1,3)(3,4) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 10 +Bw$ \\(ab\\)\\(ccc\\) abababccccccd NULL +B$ \\(abab\\)\\(cccc\\) abababccccccd (2,10)(2,6)(6,10) +Ew$ (ab)(ccc) abababccccccd NULL +E$ (abab)(cccc) abababccccccd (2,10)(2,6)(6,10) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 11 +B$ \\(ab\\)\\{1,\\}\\(ccc\\)* abababccccccd (0,12)(4,6)(9,12) +E$ (ab){1,}(ccc)* abababccccccd (0,12)(4,6)(9,12) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 12 +B$ \\(ab\\)\\(xyz\\)*\\(def\\)\\{0,3\\}\\(ccc\\) abcccd (0,5)(0,2)(?,?)(?,?)(2,5) +E$ (ab)(xy)?(z)*(A){0,}(ccc) abcccd (0,5)(0,2)(?,?)(?,?)(?,?)(2,5) +E$ (ab)|(yz) abcccd (0,2)(0,2)(?,?) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 13 +B$ \\(ab\\)\\(\\(c\\)yz\\)* abcccd (0,2)(0,2)(?,?)(?,?) +E$ (ab)|((c)xyz) abcccd (0,2)(0,2)(?,?)(?,?) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 14 +B$ \\(abcc\\)\\(x*\\) abcccd (0,4)(0,4)(4,4) +E$ (ab)(x*) abcccd (0,2)(0,2)(2,2) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 15 +BE$ llo\nthe hello\nthere (2,9) +# Test error: Use of REG_EXTENDED in eflags, which corresponds to REG_NOTBOL +Eb$ l+o\nthe?r hello\nthere (2,10) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 16 +BE$ xyz abcdefGHIJKL NOMATCH +B$ \\1 abcdefGHIJKL ESUBREG +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 17 +BE$ [XY][^GH] abcdefGHIJKL NOMATCH +B$ \\)\\) abcdefGHIJKL EPAREN +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 18 +BE$ ABC[DEF] 123456789hijkl%$# NOMATCH +B$ \\7 123456789hijkl%$# ESUBREG +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 19 +BE$ xyz abcdefGHIJKL NOMATCH +B$ \\1 abcdefGHIJKL ESUBREG +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 20 +BE$ [XY][^GH] abcdefGHIJKL NOMATCH +B$ \\)\\) abcdefGHIJKL EPAREN +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 21 +BE$ ABC[DEF] 123456789hijkl%$# NOMATCH +B$ \\7 123456789hijkl%$# ESUBREG +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 22 +BE$ xy[[.ab.]]z NULL ECOLLATE +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 23 +BE$ xy[[:non_existant_class:]]z NULL ECTYPE +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 24 +BE$ xyz\\ NULL EESCAPE +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 25 +B$ xy\\(ab\\)z\\3 NULL ESUBREG +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 26 +BE$ x[y[][z NULL EBRACK +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 27 +B$ xy\\(\\(ab\\)z NULL EPAREN +B$ xy\\(ab\\)\\)z NULL EPAREN +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 28 +E$ xy((ab)z NULL EPAREN +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 29 +B$ xyab\\{3,\\}jk\\{ NULL EBRACE +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 30 (not in use) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 31 +B$ 890magIFd\\{0,j\\} NULL BADBR +E$ 890magIFd{0,j} NULL BADBR +B$ 890magIFd\\{k,3\\} NULL BADBR +B$ 890magIFd\\{k,\\} NULL BADBR +B$ 890magIFd\\{k\\} NULL BADBR +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 32 (not in use) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 33 +# RE_DUP_MAX = 255 +B$ 890magIFd\\{0,256\\} NULL BADBR +E$ 890magIFd{0,256} NULL BADBR +B$ 890magIFd\\{256,3\\} NULL BADBR +E$ 890magIFd{256,3} NULL BADBR +B$ 890magIFd\\{256,\\} NULL BADBR +E$ 890magIFd{256,} NULL BADBR +B$ 890magIFd\\{256\\} NULL BADBR +E$ 890magIFd{256} NULL BADBR +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 34 (not in use) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 35 +B$ xy\\{4,5,7\\}zabc NULL BADBR +E$ xy{4,5,7}zabc NULL BADBR +# vsx6/tset/XPG4.os/genuts/regcomp/T.regcomp 36 (not in use) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 37 +B$ def\\{3,1\\}cba NULL BADBR +E$ def{3,1}cba NULL BADBR +# vsx6/tset/XPG8.os/genuts/regcomp/T.regcomp 38 (not in use) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 39 +BE$ xy[m-a]z NULL ERANGE +# vsx6/tset/XPG8.os/genuts/regcomp/T.regcomp 40 (not in use) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 41 +E$ *xyz NULL BADRPT +E$ a|*xyz NULL BADRPT +E$ ^?xyz NULL BADRPT +E$ (+xyz) NULL BADRPT +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 42 +B$ \\(\\(ab\\)\\{1,\\}ab\\)\\(\\(c\\)\\{2\\}\\)*c abababccccccd (0,11)(0,6)(2,4)(8,10)(9,10) +E$ ((ab){1,}ab)((c){2})*c abababccccccd (0,11)(0,6)(2,4)(8,10)(9,10) +# vsx4/tset/XPG4.os/genuts/regcomp/T.regcomp 43 +B$ \\(ab\\(xyz\\)*\\)\\(c\\(d\\)*\\)\\{0,3\\} abcdcdc (0,7)(0,2)(?,?)(6,7)(?,?) +E$ (ab(xyz)*)(c(d)*){0,3} abcdcdc (0,7)(0,2)(?,?)(6,7)(?,?) +E$ (ab(xy)?(z)*)(c(d){0,})+ abcdcdc (0,7)(0,2)(?,?)(?,?)(6,7)(?,?) +E$ ab((cd)|c)* abcdcdc (0,7)(6,7)(?,?) diff --git a/tests/regex/datafiles/conformance-vsx-regex.dat b/tests/regex/datafiles/conformance-vsx-regex.dat new file mode 100644 index 0000000..cd6e28e --- /dev/null +++ b/tests/regex/datafiles/conformance-vsx-regex.dat @@ -0,0 +1,1231 @@ +# vsx4/tset/XPG4.os/genuts/regex/T.regex 1 +B$ bb* abbbc (1,4) +B$ bb* ababbbc (1,2) +E$ b+ abbbc (1,4) +E$ b+ ababbbc (1,2) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 2 +Bi$ BB* abbbc (1,4) +Bi$ bb* aBBBc (1,4) +Ei$ B+ abbbc (1,4) +Ei$ b+ aBBBc (1,4) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 3 +BE$ abcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop Aabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnopabcdefghijklmnop (1,257) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 4 +B$ \x01 \x01 (0,1) +B$ \x02 \x02 (0,1) +B$ \x03 \x03 (0,1) +B$ \x04 \x04 (0,1) +B$ \x05 \x05 (0,1) +B$ \x06 \x06 (0,1) +B$ \x07 \x07 (0,1) +B$ \x08 \x08 (0,1) +B$ \x09 \x09 (0,1) +B$ \x0a \x0a (0,1) +B$ \x0b \x0b (0,1) +B$ \x0c \x0c (0,1) +B$ \x0d \x0d (0,1) +B$ \x0e \x0e (0,1) +B$ \x0f \x0f (0,1) +B$ \x10 \x10 (0,1) +B$ \x11 \x11 (0,1) +B$ \x12 \x12 (0,1) +B$ \x13 \x13 (0,1) +B$ \x14 \x14 (0,1) +B$ \x15 \x15 (0,1) +B$ \x16 \x16 (0,1) +B$ \x17 \x17 (0,1) +B$ \x18 \x18 (0,1) +B$ \x19 \x19 (0,1) +B$ \x1a \x1a (0,1) +B$ \x1b \x1b (0,1) +B$ \x1c \x1c (0,1) +B$ \x1d \x1d (0,1) +B$ \x1e \x1e (0,1) +B$ \x1f \x1f (0,1) +B$ \x20 \x20 (0,1) +B$ \x21 \x21 (0,1) +B$ \x22 \x22 (0,1) +B$ \x23 \x23 (0,1) +B$ \x25 \x25 (0,1) +B$ \x26 \x26 (0,1) +B$ \x27 \x27 (0,1) +B$ \x28 \x28 (0,1) +B$ \x29 \x29 (0,1) +B$ \x2b \x2b (0,1) +B$ \x2c \x2c (0,1) +B$ \x2d \x2d (0,1) +B$ \x2f \x2f (0,1) +B$ \x30 \x30 (0,1) +B$ \x31 \x31 (0,1) +B$ \x32 \x32 (0,1) +B$ \x33 \x33 (0,1) +B$ \x34 \x34 (0,1) +B$ \x35 \x35 (0,1) +B$ \x36 \x36 (0,1) +B$ \x37 \x37 (0,1) +B$ \x38 \x38 (0,1) +B$ \x39 \x39 (0,1) +B$ \x3a \x3a (0,1) +B$ \x3b \x3b (0,1) +B$ \x3c \x3c (0,1) +B$ \x3d \x3d (0,1) +B$ \x3e \x3e (0,1) +B$ \x3f \x3f (0,1) +B$ \x40 \x40 (0,1) +B$ \x41 \x41 (0,1) +B$ \x42 \x42 (0,1) +B$ \x43 \x43 (0,1) +B$ \x44 \x44 (0,1) +B$ \x45 \x45 (0,1) +B$ \x46 \x46 (0,1) +B$ \x47 \x47 (0,1) +B$ \x48 \x48 (0,1) +B$ \x49 \x49 (0,1) +B$ \x4a \x4a (0,1) +B$ \x4b \x4b (0,1) +B$ \x4c \x4c (0,1) +B$ \x4d \x4d (0,1) +B$ \x4e \x4e (0,1) +B$ \x4f \x4f (0,1) +B$ \x50 \x50 (0,1) +B$ \x51 \x51 (0,1) +B$ \x52 \x52 (0,1) +B$ \x53 \x53 (0,1) +B$ \x54 \x54 (0,1) +B$ \x55 \x55 (0,1) +B$ \x56 \x56 (0,1) +B$ \x57 \x57 (0,1) +B$ \x58 \x58 (0,1) +B$ \x59 \x59 (0,1) +B$ \x5a \x5a (0,1) +B$ \x5d \x5d (0,1) +B$ \x5f \x5f (0,1) +B$ \x60 \x60 (0,1) +B$ \x61 \x61 (0,1) +B$ \x62 \x62 (0,1) +B$ \x63 \x63 (0,1) +B$ \x64 \x64 (0,1) +B$ \x65 \x65 (0,1) +B$ \x66 \x66 (0,1) +B$ \x67 \x67 (0,1) +B$ \x68 \x68 (0,1) +B$ \x69 \x69 (0,1) +B$ \x6a \x6a (0,1) +B$ \x6b \x6b (0,1) +B$ \x6c \x6c (0,1) +B$ \x6d \x6d (0,1) +B$ \x6e \x6e (0,1) +B$ \x6f \x6f (0,1) +B$ \x70 \x70 (0,1) +B$ \x71 \x71 (0,1) +B$ \x72 \x72 (0,1) +B$ \x73 \x73 (0,1) +B$ \x74 \x74 (0,1) +B$ \x75 \x75 (0,1) +B$ \x76 \x76 (0,1) +B$ \x77 \x77 (0,1) +B$ \x78 \x78 (0,1) +B$ \x79 \x79 (0,1) +B$ \x7a \x7a (0,1) +B$ \x7b \x7b (0,1) +B$ \x7c \x7c (0,1) +B$ \x7d \x7d (0,1) +B$ \x7e \x7e (0,1) +B$ \x7f \x7f (0,1) +B$ \x80 \x80 (0,1) +B$ \x81 \x81 (0,1) +B$ \x82 \x82 (0,1) +B$ \x83 \x83 (0,1) +B$ \x84 \x84 (0,1) +B$ \x85 \x85 (0,1) +B$ \x86 \x86 (0,1) +B$ \x87 \x87 (0,1) +B$ \x88 \x88 (0,1) +B$ \x89 \x89 (0,1) +B$ \x8a \x8a (0,1) +B$ \x8b \x8b (0,1) +B$ \x8c \x8c (0,1) +B$ \x8d \x8d (0,1) +B$ \x8e \x8e (0,1) +B$ \x8f \x8f (0,1) +B$ \x90 \x90 (0,1) +B$ \x91 \x91 (0,1) +B$ \x92 \x92 (0,1) +B$ \x93 \x93 (0,1) +B$ \x94 \x94 (0,1) +B$ \x95 \x95 (0,1) +B$ \x96 \x96 (0,1) +B$ \x97 \x97 (0,1) +B$ \x98 \x98 (0,1) +B$ \x99 \x99 (0,1) +B$ \x9a \x9a (0,1) +B$ \x9b \x9b (0,1) +B$ \x9c \x9c (0,1) +B$ \x9d \x9d (0,1) +B$ \x9e \x9e (0,1) +B$ \x9f \x9f (0,1) +B$ \xa0 \xa0 (0,1) +B$ \xa1 \xa1 (0,1) +B$ \xa2 \xa2 (0,1) +B$ \xa3 \xa3 (0,1) +B$ \xa4 \xa4 (0,1) +B$ \xa5 \xa5 (0,1) +B$ \xa6 \xa6 (0,1) +B$ \xa7 \xa7 (0,1) +B$ \xa8 \xa8 (0,1) +B$ \xa9 \xa9 (0,1) +B$ \xaa \xaa (0,1) +B$ \xab \xab (0,1) +B$ \xac \xac (0,1) +B$ \xad \xad (0,1) +B$ \xae \xae (0,1) +B$ \xaf \xaf (0,1) +B$ \xb0 \xb0 (0,1) +B$ \xb1 \xb1 (0,1) +B$ \xb2 \xb2 (0,1) +B$ \xb3 \xb3 (0,1) +B$ \xb4 \xb4 (0,1) +B$ \xb5 \xb5 (0,1) +B$ \xb6 \xb6 (0,1) +B$ \xb7 \xb7 (0,1) +B$ \xb8 \xb8 (0,1) +B$ \xb9 \xb9 (0,1) +B$ \xba \xba (0,1) +B$ \xbb \xbb (0,1) +B$ \xbc \xbc (0,1) +B$ \xbd \xbd (0,1) +B$ \xbe \xbe (0,1) +B$ \xbf \xbf (0,1) +B$ \xc0 \xc0 (0,1) +B$ \xc1 \xc1 (0,1) +B$ \xc2 \xc2 (0,1) +B$ \xc3 \xc3 (0,1) +B$ \xc4 \xc4 (0,1) +B$ \xc5 \xc5 (0,1) +B$ \xc6 \xc6 (0,1) +B$ \xc7 \xc7 (0,1) +B$ \xc8 \xc8 (0,1) +B$ \xc9 \xc9 (0,1) +B$ \xca \xca (0,1) +B$ \xcb \xcb (0,1) +B$ \xcc \xcc (0,1) +B$ \xcd \xcd (0,1) +B$ \xce \xce (0,1) +B$ \xcf \xcf (0,1) +B$ \xd0 \xd0 (0,1) +B$ \xd1 \xd1 (0,1) +B$ \xd2 \xd2 (0,1) +B$ \xd3 \xd3 (0,1) +B$ \xd4 \xd4 (0,1) +B$ \xd5 \xd5 (0,1) +B$ \xd6 \xd6 (0,1) +B$ \xd7 \xd7 (0,1) +B$ \xd8 \xd8 (0,1) +B$ \xd9 \xd9 (0,1) +B$ \xda \xda (0,1) +B$ \xdb \xdb (0,1) +B$ \xdc \xdc (0,1) +B$ \xdd \xdd (0,1) +B$ \xde \xde (0,1) +B$ \xdf \xdf (0,1) +B$ \xe0 \xe0 (0,1) +B$ \xe1 \xe1 (0,1) +B$ \xe2 \xe2 (0,1) +B$ \xe3 \xe3 (0,1) +B$ \xe4 \xe4 (0,1) +B$ \xe5 \xe5 (0,1) +B$ \xe6 \xe6 (0,1) +B$ \xe7 \xe7 (0,1) +B$ \xe8 \xe8 (0,1) +B$ \xe9 \xe9 (0,1) +B$ \xea \xea (0,1) +B$ \xeb \xeb (0,1) +B$ \xec \xec (0,1) +B$ \xed \xed (0,1) +B$ \xee \xee (0,1) +B$ \xef \xef (0,1) +B$ \xf0 \xf0 (0,1) +B$ \xf1 \xf1 (0,1) +B$ \xf2 \xf2 (0,1) +B$ \xf3 \xf3 (0,1) +B$ \xf4 \xf4 (0,1) +B$ \xf5 \xf5 (0,1) +B$ \xf6 \xf6 (0,1) +B$ \xf7 \xf7 (0,1) +B$ \xf8 \xf8 (0,1) +B$ \xf9 \xf9 (0,1) +B$ \xfa \xfa (0,1) +B$ \xfb \xfb (0,1) +B$ \xfc \xfc (0,1) +B$ \xfd \xfd (0,1) +B$ \xfe \xfe (0,1) +B$ \xff \xff (0,1) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 5 +B$ abc\\.def aaaabc.deffff (3,10) +B$ abc\\.def aaaabcxdeffff NOMATCH +B$ abc\\*def aaaabc*deffff (3,10) +B$ abc\\*def aaaabcxdeffff NOMATCH +B$ abc\\[def aaaabc[deffff (3,10) +B$ abc\\[def aaaabcxdeffff NOMATCH +B$ abc\\\\def aaaabc\\deffff (3,10) +B$ abc\\\\def aaaabcxdeffff NOMATCH +B$ \\^def ^deffff (0,4) +B$ \\^def deffff NOMATCH +B$ abc\\$ aaaabc$ (3,7) +B$ abc\\$ aaaabc NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 6 +B$ abc[.]def aaaabc.deffff (3,10) +B$ abc[.]def aaaabcxdeffff NOMATCH +B$ abc[*]def aaaabc*deffff (3,10) +B$ abc[*]def aaaabcxdeffff NOMATCH +B$ abc[[]def aaaabc[deffff (3,10) +B$ abc[[]def aaaabcxdeffff NOMATCH +B$ abc[\\]def aaaabc\\deffff (3,10) +B$ abc[\\]def aaaabcxdeffff NOMATCH +B$ abc[$]def aaaabc$deffff (3,10) +B$ abc[$]def aaaabcxdeffff NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 7 +B$ *abcde *abcde (0,6) +B$ *abcde abcde NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 8 +B$ ^*abcde *abcde (0,6) +B$ ^*abcde abcde NOMATCH +B$ ^*abcde abcde NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 9 +B$ \\(*b\\) a*b (1,3)(1,3) +B$ \\(*b\\) ab NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 10 +B$ \\(^*ab\\) *ab (0,3)(0,3) +B$ \\(^*b\\) a*b NOMATCH +B$ \\(^*ab\\) ab NOMATCH +B$ \\(^*b\\) ab NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 11 +# VSX_BRE_SUBANCHOR=Y so skip this test (test10 is run) +#B$ \\(^*ab\\) *ab NOMATCH +#B$ \\(^*b\\) b (0,1) +#B$ \\(^*ab\\) ^*ab NOMATCH +#B$ \\(^*b\\) ^^b (0,3) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 12 +B$ a^b a^b (0,3) +B$ a\\^b a^b (0,3) +B$ ^^ ^bc (0,1) +B$ \\^ a^c (1,2) +B$ [c^b] ^abc (0,1) +B$ [\\^ab] ^ab (0,1) +B$ [\\a^b] c\\d (1,2) +B$ [^^] ^ NOMATCH +B$ \\(a^b\\) a^b (0,3)(0,3) +B$ \\(a\\^b\\) a^b (0,3)(0,3) +B$ \\(\\^\\) a^b (1,2)(1,2) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 13 +B$ $$ ab$ (2,3) +B$ \\($$\\) ab$ (2,3)(2,3) +#B$ \\($\\) ab$ (2,3) +B$ [$] a$b (1,2) +B$ \\$a $a (0,2) +B$ $c a$c (1,3) +B$ \\($c\\) a$c (1,3)(1,3) +B$ \\$$ ab$ (2,3) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 14 +BE$ . \x01 (0,1) +BE$ . \x02 (0,1) +BE$ . \x03 (0,1) +BE$ . \x04 (0,1) +BE$ . \x05 (0,1) +BE$ . \x06 (0,1) +BE$ . \x07 (0,1) +BE$ . \x08 (0,1) +BE$ . \x09 (0,1) +BE$ . \x0a (0,1) +BE$ . \x0b (0,1) +BE$ . \x0c (0,1) +BE$ . \x0d (0,1) +BE$ . \x0e (0,1) +BE$ . \x0f (0,1) +BE$ . \x10 (0,1) +BE$ . \x11 (0,1) +BE$ . \x12 (0,1) +BE$ . \x13 (0,1) +BE$ . \x14 (0,1) +BE$ . \x15 (0,1) +BE$ . \x16 (0,1) +BE$ . \x17 (0,1) +BE$ . \x18 (0,1) +BE$ . \x19 (0,1) +BE$ . \x1a (0,1) +BE$ . \x1b (0,1) +BE$ . \x1c (0,1) +BE$ . \x1d (0,1) +BE$ . \x1e (0,1) +BE$ . \x1f (0,1) +BE$ . \x20 (0,1) +BE$ . \x21 (0,1) +BE$ . \x22 (0,1) +BE$ . \x23 (0,1) +BE$ . \x24 (0,1) +BE$ . \x25 (0,1) +BE$ . \x26 (0,1) +BE$ . \x27 (0,1) +BE$ . \x28 (0,1) +BE$ . \x29 (0,1) +BE$ . \x2a (0,1) +BE$ . \x2b (0,1) +BE$ . \x2c (0,1) +BE$ . \x2d (0,1) +BE$ . \x2e (0,1) +BE$ . \x2f (0,1) +BE$ . \x30 (0,1) +BE$ . \x31 (0,1) +BE$ . \x32 (0,1) +BE$ . \x33 (0,1) +BE$ . \x34 (0,1) +BE$ . \x35 (0,1) +BE$ . \x36 (0,1) +BE$ . \x37 (0,1) +BE$ . \x38 (0,1) +BE$ . \x39 (0,1) +BE$ . \x3a (0,1) +BE$ . \x3b (0,1) +BE$ . \x3c (0,1) +BE$ . \x3d (0,1) +BE$ . \x3e (0,1) +BE$ . \x3f (0,1) +BE$ . \x40 (0,1) +BE$ . \x41 (0,1) +BE$ . \x42 (0,1) +BE$ . \x43 (0,1) +BE$ . \x44 (0,1) +BE$ . \x45 (0,1) +BE$ . \x46 (0,1) +BE$ . \x47 (0,1) +BE$ . \x48 (0,1) +BE$ . \x49 (0,1) +BE$ . \x4a (0,1) +BE$ . \x4b (0,1) +BE$ . \x4c (0,1) +BE$ . \x4d (0,1) +BE$ . \x4e (0,1) +BE$ . \x4f (0,1) +BE$ . \x50 (0,1) +BE$ . \x51 (0,1) +BE$ . \x52 (0,1) +BE$ . \x53 (0,1) +BE$ . \x54 (0,1) +BE$ . \x55 (0,1) +BE$ . \x56 (0,1) +BE$ . \x57 (0,1) +BE$ . \x58 (0,1) +BE$ . \x59 (0,1) +BE$ . \x5a (0,1) +BE$ . \x5b (0,1) +BE$ . \x5c (0,1) +BE$ . \x5d (0,1) +BE$ . \x5e (0,1) +BE$ . \x5f (0,1) +BE$ . \x60 (0,1) +BE$ . \x61 (0,1) +BE$ . \x62 (0,1) +BE$ . \x63 (0,1) +BE$ . \x64 (0,1) +BE$ . \x65 (0,1) +BE$ . \x66 (0,1) +BE$ . \x67 (0,1) +BE$ . \x68 (0,1) +BE$ . \x69 (0,1) +BE$ . \x6a (0,1) +BE$ . \x6b (0,1) +BE$ . \x6c (0,1) +BE$ . \x6d (0,1) +BE$ . \x6e (0,1) +BE$ . \x6f (0,1) +BE$ . \x70 (0,1) +BE$ . \x71 (0,1) +BE$ . \x72 (0,1) +BE$ . \x73 (0,1) +BE$ . \x74 (0,1) +BE$ . \x75 (0,1) +BE$ . \x76 (0,1) +BE$ . \x77 (0,1) +BE$ . \x78 (0,1) +BE$ . \x79 (0,1) +BE$ . \x7a (0,1) +BE$ . \x7b (0,1) +BE$ . \x7c (0,1) +BE$ . \x7d (0,1) +BE$ . \x7e (0,1) +BE$ . \x7f (0,1) +BE$ . \x80 (0,1) +BE$ . \x81 (0,1) +BE$ . \x82 (0,1) +BE$ . \x83 (0,1) +BE$ . \x84 (0,1) +BE$ . \x85 (0,1) +BE$ . \x86 (0,1) +BE$ . \x87 (0,1) +BE$ . \x88 (0,1) +BE$ . \x89 (0,1) +BE$ . \x8a (0,1) +BE$ . \x8b (0,1) +BE$ . \x8c (0,1) +BE$ . \x8d (0,1) +BE$ . \x8e (0,1) +BE$ . \x8f (0,1) +BE$ . \x90 (0,1) +BE$ . \x91 (0,1) +BE$ . \x92 (0,1) +BE$ . \x93 (0,1) +BE$ . \x94 (0,1) +BE$ . \x95 (0,1) +BE$ . \x96 (0,1) +BE$ . \x97 (0,1) +BE$ . \x98 (0,1) +BE$ . \x99 (0,1) +BE$ . \x9a (0,1) +BE$ . \x9b (0,1) +BE$ . \x9c (0,1) +BE$ . \x9d (0,1) +BE$ . \x9e (0,1) +BE$ . \x9f (0,1) +BE$ . \xa0 (0,1) +BE$ . \xa1 (0,1) +BE$ . \xa2 (0,1) +BE$ . \xa3 (0,1) +BE$ . \xa4 (0,1) +BE$ . \xa5 (0,1) +BE$ . \xa6 (0,1) +BE$ . \xa7 (0,1) +BE$ . \xa8 (0,1) +BE$ . \xa9 (0,1) +BE$ . \xaa (0,1) +BE$ . \xab (0,1) +BE$ . \xac (0,1) +BE$ . \xad (0,1) +BE$ . \xae (0,1) +BE$ . \xaf (0,1) +BE$ . \xb0 (0,1) +BE$ . \xb1 (0,1) +BE$ . \xb2 (0,1) +BE$ . \xb3 (0,1) +BE$ . \xb4 (0,1) +BE$ . \xb5 (0,1) +BE$ . \xb6 (0,1) +BE$ . \xb7 (0,1) +BE$ . \xb8 (0,1) +BE$ . \xb9 (0,1) +BE$ . \xba (0,1) +BE$ . \xbb (0,1) +BE$ . \xbc (0,1) +BE$ . \xbd (0,1) +BE$ . \xbe (0,1) +BE$ . \xbf (0,1) +BE$ . \xc0 (0,1) +BE$ . \xc1 (0,1) +BE$ . \xc2 (0,1) +BE$ . \xc3 (0,1) +BE$ . \xc4 (0,1) +BE$ . \xc5 (0,1) +BE$ . \xc6 (0,1) +BE$ . \xc7 (0,1) +BE$ . \xc8 (0,1) +BE$ . \xc9 (0,1) +BE$ . \xca (0,1) +BE$ . \xcb (0,1) +BE$ . \xcc (0,1) +BE$ . \xcd (0,1) +BE$ . \xce (0,1) +BE$ . \xcf (0,1) +BE$ . \xd0 (0,1) +BE$ . \xd1 (0,1) +BE$ . \xd2 (0,1) +BE$ . \xd3 (0,1) +BE$ . \xd4 (0,1) +BE$ . \xd5 (0,1) +BE$ . \xd6 (0,1) +BE$ . \xd7 (0,1) +BE$ . \xd8 (0,1) +BE$ . \xd9 (0,1) +BE$ . \xda (0,1) +BE$ . \xdb (0,1) +BE$ . \xdc (0,1) +BE$ . \xdd (0,1) +BE$ . \xde (0,1) +BE$ . \xdf (0,1) +BE$ . \xe0 (0,1) +BE$ . \xe1 (0,1) +BE$ . \xe2 (0,1) +BE$ . \xe3 (0,1) +BE$ . \xe4 (0,1) +BE$ . \xe5 (0,1) +BE$ . \xe6 (0,1) +BE$ . \xe7 (0,1) +BE$ . \xe8 (0,1) +BE$ . \xe9 (0,1) +BE$ . \xea (0,1) +BE$ . \xeb (0,1) +BE$ . \xec (0,1) +BE$ . \xed (0,1) +BE$ . \xee (0,1) +BE$ . \xef (0,1) +BE$ . \xf0 (0,1) +BE$ . \xf1 (0,1) +BE$ . \xf2 (0,1) +BE$ . \xf3 (0,1) +BE$ . \xf4 (0,1) +BE$ . \xf5 (0,1) +BE$ . \xf6 (0,1) +BE$ . \xf7 (0,1) +BE$ . \xf8 (0,1) +BE$ . \xf9 (0,1) +BE$ . \xfa (0,1) +BE$ . \xfb (0,1) +BE$ . \xfc (0,1) +BE$ . \xfd (0,1) +BE$ . \xfe (0,1) +BE$ . \xff (0,1) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 15 +B$ [abc] abc (0,1) +E$ [abc] abc (0,1) +B$ ab[abc] abc (0,3) +E$ ab[abc] abc (0,3) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 16 +B$ [abc] xbyz (1,2) +E$ [abc] xbyz (1,2) +B$ [abc] xyz NOMATCH +E$ [abc] xyz NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 17 +B$ [^a] abc (1,2) +E$ [^a] abc (1,2) +B$ [^abc] abc NOMATCH +E$ [^abc] abc NOMATCH +B$ [^ac] abcde- (1,2) +E$ [^ac] abcde- (1,2) +B$ [^a-bd-e] dec (2,3) +E$ [^a-bd-e] dec (2,3) +B$ [^]cd] cd]ef (3,4) +E$ [^]cd] cd]ef (3,4) +B$ [^[.a.]b] abc (2,3) +E$ [^[.a.]b] abc (2,3) +B$ [^ac-] abcde- (1,2) +E$ [^ac-] abcde- (1,2) +B$ [^---] -ab (1,2) +E$ [^---] -ab (1,2) +B$ [^abc] axyz (1,2) +E$ [^abc] axyz (1,2) +B$ [^[=a=]b] abc (2,3) +E$ [^[=a=]b] abc (2,3) +B$ [^a-b] abcde (2,3) +E$ [^a-b] abcde (2,3) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 18 +B$ []a] cd]ef (2,3) +E$ []a] cd]ef (2,3) +B$ []-a] a_b (0,1) +E$ []-a] a_b (0,1) +B$ [][.-.]-0] ab0- (2,3) +E$ [][.-.]-0] ab0- (2,3) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 19 +B$ [^]cd] cd]ef (3,4) +E$ [^]cd] cd]ef (3,4) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 20 +B$ [c[.].]d] ab]cd (2,3) +E$ [c[.].]d] ab]cd (2,3) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 21 +B$ [[.a.]b] Abc (1,2) +E$ [[.a.]b] Abc (1,2) +B$ [^[.a.]b] abc (2,3) +E$ [^[.a.]b] abc (2,3) +B$ [[.a.]b] aBc (0,1) +E$ [[.a.]b] aBc (0,1) +B$ [][.-.]-0] ab0-] (2,3) +E$ [][.-.]-0] ab0-] (2,3) +B$ [[.a.]b] ABc] NOMATCH +E$ [[.a.]b] ABc] NOMATCH +B$ [A-[.].]c] ab]! (2,3) +E$ [A-[.].]c] ab]! (2,3) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 22 +# Equivalence tests with special locale +#chk_expr(rebuf, string, 0 (0,1) +#chk_expr(rebuf, string, REG_EXTENDED (0,1) +#chk_expr(rebuf, string, 0 (0,1) +#chk_expr(rebuf, string, REG_EXTENDED (0,1) +#chk_expr(rebuf, string, 0 (1,2) +#chk_expr(rebuf, string, REG_EXTENDED (1,2) +#chk_expr(rebuf, string, 0 NOMATCH +#chk_expr(rebuf, string, REG_EXTENDED NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 23 +B$ [[=a=]b] Abc (1,2) +E$ [[=a=]b] Abc (1,2) +B$ [[=a=]b] aBc (0,1) +E$ [[=a=]b] aBc (0,1) +B$ [[=a=]b] ABc NOMATCH +E$ [[=a=]b] ABc NOMATCH +B$ [^[=a=]b] abc (2,3) +E$ [^[=a=]b] abc (2,3) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 24 +B$ [[:alnum:]]* aB18gH, (0,7) +E$ [[:alnum:]]* aB18gH, (0,7) +B$ 1[^[:alnum:]]* 1 \t,\ba (0,5) +E$ 1[^[:alnum:]]* 1 \t,\ba (0,5) +B$ [[:alpha:]]* aBgH1 (0,5) +E$ [[:alpha:]]* aBgH1 (0,5) +B$ [^[:alpha:]]* 1 \t8,\ba (0,6) +E$ [^[:alpha:]]* 1 \t8,\ba (0,6) +B$ [[:blank:]]* \t\b (0,2) +E$ [[:blank:]]* \t\b (0,2) +B$ [^[:blank:]]* aB18gH,\b (0,8) +E$ [^[:blank:]]* aB18gH,\b (0,8) +B$ [[:cntrl:]]* \t\b (0,2) +E$ [[:cntrl:]]* \t\b (0,2) +B$ [^[:cntrl:]]* aB1 8gH, (0,8) +E$ [^[:cntrl:]]* aB1 8gH, (0,8) +B$ a[[:digit:]]* a18 (0,3) +E$ a[[:digit:]]* a18 (0,3) +B$ [^[:digit:]]* aB \tgH,\b (0,8) +E$ [^[:digit:]]* aB \tgH,\b (0,8) +B$ [[:graph:]]* aB18gH, (0,7) +E$ [[:graph:]]* aB18gH, (0,7) +B$ [^[:graph:]]* \t\b (0,3) +E$ [^[:graph:]]* \t\b (0,3) +B$ [[:lower:]]* agB, (0,2) +E$ [[:lower:]]* agB, (0,2) +B$ [^[:lower:]]* B1 \t8H,\ba (0,8) +E$ [^[:lower:]]* B1 \t8H,\ba (0,8) +B$ [[:print:]]* aB1 8gH,\t (0,8) +E$ [[:print:]]* aB1 8gH,\t (0,8) +B$ [^[:print:]]* \t\b (0,2) +E$ [^[:print:]]* \t\b (0,2) +B$ a[[:punct:]]* a,1 (0,2) +E$ a[[:punct:]]* a,1 (0,2) +B$ [^[:punct:]]* aB1 \t8gH\b (0,9) +E$ [^[:punct:]]* aB1 \t8gH\b (0,9) +B$ [[:space:]]* \t\b (0,2) +E$ [[:space:]]* \t\b (0,2) +B$ [^[:space:]]* aB18gH,\b\t (0,9) +E$ [^[:space:]]* aB18gH,\b\t (0,9) +B$ a[[:upper:]]* aBH1 (0,3) +E$ a[[:upper:]]* aBH1 (0,3) +B$ [^[:upper:]]* a1 \t8g,\bB (0,8) +E$ [^[:upper:]]* a1 \t8g,\bB (0,8) +B$ g[[:xdigit:]]* gaB18h (0,5) +E$ g[[:xdigit:]]* gaB18h (0,5) +B$ a[^[:xdigit:]]* a \tgH,\b1 (0,7) +E$ a[^[:xdigit:]]* a \tgH,\b1 (0,7) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 25 +B$ [a-c] bbccde (0,1) +E$ [a-c] bbccde (0,1) +B$ [a-b] -bc (1,2) +E$ [a-b] -bc (1,2) +B$ [a-z0-9] AB0 (2,3) +E$ [a-z0-9] AB0 (2,3) +B$ [^a-b] abcde (2,3) +E$ [^a-b] abcde (2,3) +B$ [^a-bd-e] dec (2,3) +E$ [^a-bd-e] dec (2,3) +B$ [+--] a,b (1,2) +E$ [+--] a,b (1,2) +B$ [--/] a.b (1,2) +E$ [--/] a.b (1,2) +B$ [+--c] a,b (1,2) +E$ [+--c] a,b (1,2) +B$ [^---] -ab (1,2) +E$ [^---] -ab (1,2) +B$ [][.-.]-0] ab0-] (2,3) +E$ [][.-.]-0] ab0-] (2,3) +B$ [A-[.].]c] ab]! (2,3) +E$ [A-[.].]c] ab]! (2,3) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 26 +B$ [a-cd-f] dbccde (0,1) +E$ [a-cd-f] dbccde (0,1) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 27 +B$ [-xy] ac- (2,3) +E$ [-xy] ac- (2,3) +B$ [--/] a.b (1,2) +E$ [--/] a.b (1,2) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 28 +B$ [^-c]* ab-cde (0,2) +E$ [^-c]* ab-cde (0,2) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 29 +B$ [xy-] zc- (2,3) +E$ [xy-] zc- (2,3) +B$ [^ac-] abcde- (1,2) +E$ [^ac-] abcde- (1,2) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 30 +B$ [+--] a,b (1,2) +E$ [+--] a,b (1,2) +B$ [+--c] a,b (1,2) +E$ [+--c] a,b (1,2) +B$ [^---] -ab (1,2) +E$ [^---] -ab (1,2) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 31 +B$ [[.-.]ac] x-y (1,2) +E$ [[.-.]ac] x-y (1,2) +B$ [abc[.-.]] -xyz (0,1) +E$ [abc[.-.]] -xyz (0,1) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 32 +B$ cd abcdeabcde (2,4) +E$ cd abcdeabcde (2,4) +B$ ag*b abcde (0,2) +E$ ag*b abcde (0,2) +B$ [a-c][e-f] abcdef NOMATCH +E$ [a-c][e-f] abcdef NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 33 +B$ \\(*bc\\) a*bc (1,4)(1,4) +B$ \\(ab\\) abcde (0,2)(0,2) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 34 +B$ a\\(\\)b abc (0,2)(1,1) +B$ a\\(\\)c a()c NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 35 +B$ \\(a\\(b\\(c\\(d\\(e\\)\\)\\)\\)\\) abcde (0,5)(0,5)(1,5)(2,5)(3,5)(4,5) +B$ \\(a\\(b\\(c\\(d\\(e\\(f\\(g\\)h\\(i\\(j\\)\\)\\)\\)\\)\\)\\)\\) abcdefghijk (0,10)(0,10)(1,10)(2,10)(3,10)(4,10)(5,10)(6,7)(8,10)(9,10) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 36 +B$ \\(bb*\\) abbbc (1,4)(1,4) +B$ \\(bb*\\) ababbc (1,2)(1,2) +B$ a\\(.*b\\) ababbbc (0,6)(1,6) +B$ a\\(b*\\) ababbbc (0,2)(1,2) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 37 +B$ a\\(b*\\)\\(c*\\)d\\1\\2\\1 abbcccdbbcccbbbb (0,14)(1,3)(3,6) +B$ \\(a\\(b\\(c\\(d\\(e\\)\\)\\)\\)\\)\\4 abcdede (0,7)(0,5)(1,5)(2,5)(3,5)(4,5) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 38 +B$ a\\(\\)b\\1c abc (0,3)(1,1) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 39 +B$ ag*b abcde (0,2) +B$ a.*b abababcbabc (0,10) +B$ b*c abbbcdeabbbbbbcde (1,5) +B$ bbb*c abbbcdeabbbbbbcde (1,5) +B$ a\\(b\\)*c\\1 abbcbbb (0,5)(2,3) +B$ a\\(b\\)*c\\1 abbdbd NOMATCH +B$ \\([a-c]*\\)\\1* abcdef (0,3)(0,3) +B$ \\([a-c]*\\)d\\1* abcdabcabcd (0,10)(0,3) +B$ a^*b ab (0,2) +B$ a^*b a^^^b (0,5) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 40 +B$ c\\{3\\} abababccccccd (6,9) +B$ a\\{2\\} aaaa (0,2) +B$ a\\{2\\} abcd NOMATCH +B$ a\\{0\\} NULL (0,0) +B$ a\\{0\\} aaaa (0,0) +# RE_DUP_MAX = 255 +B$ a\\{255\\} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (0,255) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 41 +B$ \\([a-c]*\\)\\{0,\\} aabcaab (0,7)(0,7) +B$ \\([a-c]*\\)\\{2,\\} abcdefg (0,3)(3,3) +B$ \\(ab\\)\\{2,\\} abababccccccd (0,6)(4,6) +B$ \\(ab\\)\\{4,\\} abababccccccd NOMATCH +B$ a\\{255,\\} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (0,256) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 42 +B$ a\\{2,3\\} aaaa (0,3) +B$ a\\{2,3\\} abcd NOMATCH +B$ \\(ab\\)\\{2,3\\} abababccccccd (0,6)(4,6) +B$ \\(ab\\)\\{4,5\\} abababccccccd NOMATCH +B$ \\([a-c]*\\)\\{0,0\\} dabc (0,0) +B$ a\\{1,255\\} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (0,255) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 43 +B$ \\^\\[[[.].]]\\\\(\\\\1\\\\)\\\\\\*\\\\{1,2\\\\}\\$ a^[]\\(\\1\\)\\*\\{1,2\\}$b (1,20) +B$ [[=*=]][[=\\=]][[=]=]][[===]][[...]][[:punct:]] *\\]=.; (0,6) +B$ [\\(^*\\)$]* ^\\()*$ (0,6) +B$ [\\1] 1 (0,1) +B$ [\\{1,2\\}] { (0,1) +B$ \\(*\\)\\1* a**11 (1,3)(1,2) +B$ ^\\(^\\(^a$\\)$\\)$ a (0,1)(0,1)(0,1) +B$ \\(a\\)\\1$ aa (0,2)(0,1) +B$ ab* abb (0,3) +B$ ab\\{2,4\\} abbbc (0,4) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 44 +B$ ^a abc (0,1) +B$ ^a ^abc NOMATCH +B$ ^^a ^a (0,2) +B$ \\(^abc\\) abcdef (0,3)(0,3) +B$ \\(^def\\) abcdef NOMATCH +E$ ^a abc (0,1) +E$ ^a ^abc NOMATCH +E$ ^^a a (0,1) +E$ (^abc) abcdef (0,3)(0,3) +E$ (^def) abcdef NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 45 +Eb$ (^a) aabc NOMATCH +Bb$ \\(^a\\)\\1 aabc NOMATCH +Eb$ ^a aabc NOMATCH +Bb$ ^a aabc NOMATCH +Bb$ ^* ^ NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 46 +B$ a$ cba (2,3) +E$ a$ cba (2,3) +B$ \\(a$\\) bcaa (3,4)(3,4) +E$ (a$) bcaa (3,4)(3,4) +B$ \\(a$\\) ba$ NOMATCH +E$ (a$) ba$ NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 47 +Be$ ab$ cab NOMATCH +Ee$ ab$ cab NOMATCH +Be$ \\(a$\\) bcaa NOMATCH +Ee$ (a$) bcaa NOMATCH +Be$ \\(a$\\)\\{2\\} a$a$ NOMATCH +Ee$ (a$){2} a$a$ NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 48 +B$ ^$ NULL (0,0) +B$ ^abc$ abc (0,3) +E$ ^$ NULL (0,0) +E$ ^abc$ abc (0,3) +B$ \\(^$\\) NULL (0,0)(0,0) +B$ \\(^abc$\\) abc (0,3)(0,3) +E$ (^$) NULL (0,0)(0,0) +E$ (^abc$) abc (0,3)(0,3) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 49 +E$ (a) aaa (0,1)(0,1) +E$ ([a]) aaa (0,1)(0,1) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 50 +E$ \x01 \x01 (0,1) +E$ \x02 \x02 (0,1) +E$ \x03 \x03 (0,1) +E$ \x04 \x04 (0,1) +E$ \x05 \x05 (0,1) +E$ \x06 \x06 (0,1) +E$ \x07 \x07 (0,1) +E$ \x08 \x08 (0,1) +E$ \x09 \x09 (0,1) +E$ \x0a \x0a (0,1) +E$ \x0b \x0b (0,1) +E$ \x0c \x0c (0,1) +E$ \x0d \x0d (0,1) +E$ \x0e \x0e (0,1) +E$ \x0f \x0f (0,1) +E$ \x10 \x10 (0,1) +E$ \x11 \x11 (0,1) +E$ \x12 \x12 (0,1) +E$ \x13 \x13 (0,1) +E$ \x14 \x14 (0,1) +E$ \x15 \x15 (0,1) +E$ \x16 \x16 (0,1) +E$ \x17 \x17 (0,1) +E$ \x18 \x18 (0,1) +E$ \x19 \x19 (0,1) +E$ \x1a \x1a (0,1) +E$ \x1b \x1b (0,1) +E$ \x1c \x1c (0,1) +E$ \x1d \x1d (0,1) +E$ \x1e \x1e (0,1) +E$ \x1f \x1f (0,1) +E$ \x20 \x20 (0,1) +E$ \x21 \x21 (0,1) +E$ \x22 \x22 (0,1) +E$ \x23 \x23 (0,1) +E$ \x25 \x25 (0,1) +E$ \x26 \x26 (0,1) +E$ \x27 \x27 (0,1) +E$ \x29 \x29 (0,1) +E$ \x2c \x2c (0,1) +E$ \x2d \x2d (0,1) +E$ \x2f \x2f (0,1) +E$ \x30 \x30 (0,1) +E$ \x31 \x31 (0,1) +E$ \x32 \x32 (0,1) +E$ \x33 \x33 (0,1) +E$ \x34 \x34 (0,1) +E$ \x35 \x35 (0,1) +E$ \x36 \x36 (0,1) +E$ \x37 \x37 (0,1) +E$ \x38 \x38 (0,1) +E$ \x39 \x39 (0,1) +E$ \x3a \x3a (0,1) +E$ \x3b \x3b (0,1) +E$ \x3c \x3c (0,1) +E$ \x3d \x3d (0,1) +E$ \x3e \x3e (0,1) +E$ \x40 \x40 (0,1) +E$ \x41 \x41 (0,1) +E$ \x42 \x42 (0,1) +E$ \x43 \x43 (0,1) +E$ \x44 \x44 (0,1) +E$ \x45 \x45 (0,1) +E$ \x46 \x46 (0,1) +E$ \x47 \x47 (0,1) +E$ \x48 \x48 (0,1) +E$ \x49 \x49 (0,1) +E$ \x4a \x4a (0,1) +E$ \x4b \x4b (0,1) +E$ \x4c \x4c (0,1) +E$ \x4d \x4d (0,1) +E$ \x4e \x4e (0,1) +E$ \x4f \x4f (0,1) +E$ \x50 \x50 (0,1) +E$ \x51 \x51 (0,1) +E$ \x52 \x52 (0,1) +E$ \x53 \x53 (0,1) +E$ \x54 \x54 (0,1) +E$ \x55 \x55 (0,1) +E$ \x56 \x56 (0,1) +E$ \x57 \x57 (0,1) +E$ \x58 \x58 (0,1) +E$ \x59 \x59 (0,1) +E$ \x5a \x5a (0,1) +E$ \x5d \x5d (0,1) +E$ \x5f \x5f (0,1) +E$ \x60 \x60 (0,1) +E$ \x61 \x61 (0,1) +E$ \x62 \x62 (0,1) +E$ \x63 \x63 (0,1) +E$ \x64 \x64 (0,1) +E$ \x65 \x65 (0,1) +E$ \x66 \x66 (0,1) +E$ \x67 \x67 (0,1) +E$ \x68 \x68 (0,1) +E$ \x69 \x69 (0,1) +E$ \x6a \x6a (0,1) +E$ \x6b \x6b (0,1) +E$ \x6c \x6c (0,1) +E$ \x6d \x6d (0,1) +E$ \x6e \x6e (0,1) +E$ \x6f \x6f (0,1) +E$ \x70 \x70 (0,1) +E$ \x71 \x71 (0,1) +E$ \x72 \x72 (0,1) +E$ \x73 \x73 (0,1) +E$ \x74 \x74 (0,1) +E$ \x75 \x75 (0,1) +E$ \x76 \x76 (0,1) +E$ \x77 \x77 (0,1) +E$ \x78 \x78 (0,1) +E$ \x79 \x79 (0,1) +E$ \x7a \x7a (0,1) +E$ \x7d \x7d (0,1) +E$ \x7e \x7e (0,1) +E$ \x7f \x7f (0,1) +E$ \x80 \x80 (0,1) +E$ \x81 \x81 (0,1) +E$ \x82 \x82 (0,1) +E$ \x83 \x83 (0,1) +E$ \x84 \x84 (0,1) +E$ \x85 \x85 (0,1) +E$ \x86 \x86 (0,1) +E$ \x87 \x87 (0,1) +E$ \x88 \x88 (0,1) +E$ \x89 \x89 (0,1) +E$ \x8a \x8a (0,1) +E$ \x8b \x8b (0,1) +E$ \x8c \x8c (0,1) +E$ \x8d \x8d (0,1) +E$ \x8e \x8e (0,1) +E$ \x8f \x8f (0,1) +E$ \x90 \x90 (0,1) +E$ \x91 \x91 (0,1) +E$ \x92 \x92 (0,1) +E$ \x93 \x93 (0,1) +E$ \x94 \x94 (0,1) +E$ \x95 \x95 (0,1) +E$ \x96 \x96 (0,1) +E$ \x97 \x97 (0,1) +E$ \x98 \x98 (0,1) +E$ \x99 \x99 (0,1) +E$ \x9a \x9a (0,1) +E$ \x9b \x9b (0,1) +E$ \x9c \x9c (0,1) +E$ \x9d \x9d (0,1) +E$ \x9e \x9e (0,1) +E$ \x9f \x9f (0,1) +E$ \xa0 \xa0 (0,1) +E$ \xa1 \xa1 (0,1) +E$ \xa2 \xa2 (0,1) +E$ \xa3 \xa3 (0,1) +E$ \xa4 \xa4 (0,1) +E$ \xa5 \xa5 (0,1) +E$ \xa6 \xa6 (0,1) +E$ \xa7 \xa7 (0,1) +E$ \xa8 \xa8 (0,1) +E$ \xa9 \xa9 (0,1) +E$ \xaa \xaa (0,1) +E$ \xab \xab (0,1) +E$ \xac \xac (0,1) +E$ \xad \xad (0,1) +E$ \xae \xae (0,1) +E$ \xaf \xaf (0,1) +E$ \xb0 \xb0 (0,1) +E$ \xb1 \xb1 (0,1) +E$ \xb2 \xb2 (0,1) +E$ \xb3 \xb3 (0,1) +E$ \xb4 \xb4 (0,1) +E$ \xb5 \xb5 (0,1) +E$ \xb6 \xb6 (0,1) +E$ \xb7 \xb7 (0,1) +E$ \xb8 \xb8 (0,1) +E$ \xb9 \xb9 (0,1) +E$ \xba \xba (0,1) +E$ \xbb \xbb (0,1) +E$ \xbc \xbc (0,1) +E$ \xbd \xbd (0,1) +E$ \xbe \xbe (0,1) +E$ \xbf \xbf (0,1) +E$ \xc0 \xc0 (0,1) +E$ \xc1 \xc1 (0,1) +E$ \xc2 \xc2 (0,1) +E$ \xc3 \xc3 (0,1) +E$ \xc4 \xc4 (0,1) +E$ \xc5 \xc5 (0,1) +E$ \xc6 \xc6 (0,1) +E$ \xc7 \xc7 (0,1) +E$ \xc8 \xc8 (0,1) +E$ \xc9 \xc9 (0,1) +E$ \xca \xca (0,1) +E$ \xcb \xcb (0,1) +E$ \xcc \xcc (0,1) +E$ \xcd \xcd (0,1) +E$ \xce \xce (0,1) +E$ \xcf \xcf (0,1) +E$ \xd0 \xd0 (0,1) +E$ \xd1 \xd1 (0,1) +E$ \xd2 \xd2 (0,1) +E$ \xd3 \xd3 (0,1) +E$ \xd4 \xd4 (0,1) +E$ \xd5 \xd5 (0,1) +E$ \xd6 \xd6 (0,1) +E$ \xd7 \xd7 (0,1) +E$ \xd8 \xd8 (0,1) +E$ \xd9 \xd9 (0,1) +E$ \xda \xda (0,1) +E$ \xdb \xdb (0,1) +E$ \xdc \xdc (0,1) +E$ \xdd \xdd (0,1) +E$ \xde \xde (0,1) +E$ \xdf \xdf (0,1) +E$ \xe0 \xe0 (0,1) +E$ \xe1 \xe1 (0,1) +E$ \xe2 \xe2 (0,1) +E$ \xe3 \xe3 (0,1) +E$ \xe4 \xe4 (0,1) +E$ \xe5 \xe5 (0,1) +E$ \xe6 \xe6 (0,1) +E$ \xe7 \xe7 (0,1) +E$ \xe8 \xe8 (0,1) +E$ \xe9 \xe9 (0,1) +E$ \xea \xea (0,1) +E$ \xeb \xeb (0,1) +E$ \xec \xec (0,1) +E$ \xed \xed (0,1) +E$ \xee \xee (0,1) +E$ \xef \xef (0,1) +E$ \xf0 \xf0 (0,1) +E$ \xf1 \xf1 (0,1) +E$ \xf2 \xf2 (0,1) +E$ \xf3 \xf3 (0,1) +E$ \xf4 \xf4 (0,1) +E$ \xf5 \xf5 (0,1) +E$ \xf6 \xf6 (0,1) +E$ \xf7 \xf7 (0,1) +E$ \xf8 \xf8 (0,1) +E$ \xf9 \xf9 (0,1) +E$ \xfa \xfa (0,1) +E$ \xfb \xfb (0,1) +E$ \xfc \xfc (0,1) +E$ \xfd \xfd (0,1) +E$ \xfe \xfe (0,1) +E$ \xff \xff (0,1) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 51 +E$ \\. a.c (1,2) +E$ \\[ a[c (1,2) +E$ \\\\ a\\c (1,2) +E$ \\( a(c (1,2) +E$ \\* a*c (1,2) +E$ \\+ a+c (1,2) +E$ \\? a?c (1,2) +E$ \\{ a{c (1,2) +E$ \\| a|c (1,2) +E$ \\^c a^c (1,3) +E$ a\\$ a$c (0,2) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 52 +E$ [.] a.c (1,2) +E$ [[] a[c (1,2) +E$ [\\a] a\\c (0,1) +E$ [\\a] \\abc (0,1) +E$ [\\.] a\\.c (1,2) +E$ [\\.] a.\\c (1,2) +E$ [(] a(c (1,2) +E$ [*] a*c (1,2) +E$ [+] a+c (1,2) +E$ [?] a?c (1,2) +E$ [{] a{c (1,2) +E$ [|] a|c (1,2) +E$ [$] a$c (1,2) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 53 +E$ [\\^] a^c (1,2) +E$ [b^] a^c (1,2) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 54 +E$ (cd) abcdefabcdef (2,4)(2,4) +E$ (fg) abcdefabcdef NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 55 +# vsx4/tset/XPG4.os/genuts/regex/T.regex 56 +E$ (a(b(c(d(e))))) abcde (0,5)(0,5)(1,5)(2,5)(3,5)(4,5) +E$ (a(b(c(d(e(f(g)h(i(j)))))))) abcdefghijk (0,10)(0,10)(1,10)(2,10)(3,10)(4,10)(5,10)(6,7)(8,10)(9,10) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 57 +E$ (bb*) abbbc (1,4)(1,4) +E$ (bb*) ababbbc (1,2)(1,2) +E$ a(.*b) ababbbc (0,6)(1,6) +E$ a(b*) ababbbc (0,2)(1,2) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 58 +E$ b+(bc*) acabbbcde (3,7)(5,7) +E$ [ab]+ abcdef (0,2) +E$ [ab][ab]+ abcdef (0,2) +E$ (abc)+ acabcabcbbcde (2,8)(5,8) +E$ ab+c ac NOMATCH +# vsx4/tset/XPG4.os/genuts/regex/T.regex 59 +E$ b*c cabbbcde (0,1) +E$ b*cd cabbbcdebbbbbbcdbc (2,7) +E$ c(ab)*c dcabababcdeb (1,9)(6,8) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 60 +E$ b?c acabbbcde (1,2) +E$ b?c abcabbbcde (1,3) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 61 +E$ c{3} abababccccccd (6,9) +E$ a{2} aaaa (0,2) +E$ a{2} abcd NOMATCH +E$ a{0} NULL (0,0) +E$ a{0} aaaa (0,0) +E$ a{255} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (0,255) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 62 +E$ ([a-c]*){0,} aabcaab (0,7)(0,7) +E$ ([a-c]*){2,} abcdefg (0,3)(3,3) +E$ (ab){2,} abababccccccd (0,6)(4,6) +E$ (ab){4,} abababccccccd NOMATCH +E$ a{255,} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (0,256) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 63 +E$ a{2,3} aaaa (0,3) +E$ a{2,3} abcd NOMATCH +E$ (ab){2,3} abababccccccd (0,6)(4,6) +E$ (ab){4,5} abababccccccd NOMATCH +E$ ([a-c]*){0,0} dabc (0,0) +E$ a{1,255} aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa (0,255) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 64 +E$ a|b|c|d a (0,1) +E$ a|b|c|d b (0,1) +E$ a|b|c|d c (0,1) +E$ a|b|c|d d (0,1) +E$ a((bc)|d) abc (0,3)(1,3)(1,3) +E$ a((bc)|d) ad (0,2)(1,2)(?,?) +E$ a((bc)|d) abcd (0,3)(1,3)(1,3) +E$ (^|a)b(c|$) aabcc (1,4)(1,2)(3,4) +E$ (^|a)b(c|$) bcc (0,2)(0,0)(1,2) +E$ (^|a)b(c|$) aab (1,3)(1,2)(3,3) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 65 +E$ x(a|b|c|d)y xay (0,3)(1,2) +E$ x(a|b|c|d)y xby (0,3)(1,2) +E$ x(a|b|c|d)y xcy (0,3)(1,2) +E$ x(a|b|c|d)y xdy (0,3)(1,2) +E$ ([a-z]|z) zabc (0,1)(0,1) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 66 +E$ [[=*=]][[=\\=]][[=]=]][[===]][[...]][[:punct:]] *\\]=.; (0,6) +E$ [[=(=]][[=)=]][[=+=]][[=?=]][[={=]][[=}=]][[=|=]] ()+?{}| (0,7) +E$ [[.(.]][[.).]][[.+.]][[.?.]][[.{.]][[.}.]][[.|.]] ()+?{}| (0,7) +E$ \\^\\[[[.].]]\\(\\+\\|\\?\\)\\*\\{1,2\\}\\$ a^[](+|?)*{1,2}$b (1,16) +E$ [\\(^*+|?{1})$]* ^\\(*+|?{1})*$ (0,13) +E$ (a)*(b)+(c)?(d){2} aabbcdd (0,7)(1,2)(3,4)(4,5)(6,7) +E$ (a(b{1,2}){1,2}) abbab (0,3)(0,3)(1,3) +E$ ^(^(^a$)$)$ a (0,1)(0,1)(0,1) +E$ ((a|b)|(c|d))|e bde (0,1)(0,1)(0,1)(?,?) +E$ b?cd+e|f*gh{2} cdde (0,4) +E$ b?cd+e|f*gh{2} bbdeghh (4,7) +# vsx4/tset/XPG4.os/genuts/regex/T.regex 67 +BE$ [[.ch.]] NULL ECOLLATE +# vsx4/tset/XPG4.os/genuts/regex/T.regex 68 +BE$ [b-a] NULL ERANGE +# vsx4/tset/XPG4.os/genuts/regex/T.regex 69 +B$ \\(a\\)\\2 NULL ESUBREG +# vsx4/tset/XPG4.os/genuts/regex/T.regex 70 +B$ \\(ab*\\)*\\1 abbbabbabbbbb (0,10)(4,7) +B$ \\(ab*\\)\\{1,9\\}\\1 abbbabbabbbbb (0,10)(4,7) diff --git a/tests/regex/datafiles/empty.dat b/tests/regex/datafiles/empty.dat new file mode 100644 index 0000000..3c49940 --- /dev/null +++ b/tests/regex/datafiles/empty.dat @@ -0,0 +1,7 @@ +E (a*)x x (0,1)(0,0) +E (a)*x x (0,1)(?,?) +E (a*)*x x (0,1)(0,0) +E (a+)x x NOMATCH +E (a)+x x NOMATCH +E (a+)*x x (0,1)(?,?) +E (a*)+x x (0,1)(0,0) diff --git a/tests/regex/datafiles/eucJP.dat b/tests/regex/datafiles/eucJP.dat new file mode 100644 index 0000000..b0b577b --- /dev/null +++ b/tests/regex/datafiles/eucJP.dat @@ -0,0 +1,9 @@ +{C ja_JP.eucJP +E$ \xa3\xc1 \xa3\xc1 (0,2) +E$ \xa3\xc1 \xa3\xc2 NOMATCH +E$ [[:upper:]] \xa3\xc2 (0,2) +Ei$ [[:upper:]] \xa3\xc2 (0,2) +E$ [[:lower:]] \xa3\xc2 NOMATCH +Ei$ [[:lower:]] \xa3\xc2 (0,2) +E$ [\xa3\xc1-\xa3\xc3] \xa3\xc2 (0,2) +} diff --git a/tests/regex/datafiles/forcedassoc.dat b/tests/regex/datafiles/forcedassoc.dat new file mode 100644 index 0000000..39f3111 --- /dev/null +++ b/tests/regex/datafiles/forcedassoc.dat @@ -0,0 +1,30 @@ +NOTE left-assoc:pass-all right-assoc:pass-all : 2002-04-29 + +E (a|ab)(c|bcd) abcd (0,4)(0,1)(1,4) +E (a|ab)(bcd|c) abcd (0,4)(0,1)(1,4) +E (ab|a)(c|bcd) abcd (0,4)(0,1)(1,4) +E (ab|a)(bcd|c) abcd (0,4)(0,1)(1,4) +E ((a|ab)(c|bcd))(d*) abcd (0,4)(0,4)(0,1)(1,4)(4,4) +E ((a|ab)(bcd|c))(d*) abcd (0,4)(0,4)(0,1)(1,4)(4,4) +E ((ab|a)(c|bcd))(d*) abcd (0,4)(0,4)(0,1)(1,4)(4,4) +E ((ab|a)(bcd|c))(d*) abcd (0,4)(0,4)(0,1)(1,4)(4,4) +E (a|ab)((c|bcd)(d*)) abcd (0,4)(0,2)(2,4)(2,3)(3,4) +E (a|ab)((bcd|c)(d*)) abcd (0,4)(0,2)(2,4)(2,3)(3,4) +E (ab|a)((c|bcd)(d*)) abcd (0,4)(0,2)(2,4)(2,3)(3,4) +E (ab|a)((bcd|c)(d*)) abcd (0,4)(0,2)(2,4)(2,3)(3,4) +E (a*)(b|abc) abc (0,3)(0,0)(0,3) +E (a*)(abc|b) abc (0,3)(0,0)(0,3) +E ((a*)(b|abc))(c*) abc (0,3)(0,3)(0,0)(0,3)(3,3) +E ((a*)(abc|b))(c*) abc (0,3)(0,3)(0,0)(0,3)(3,3) +E (a*)((b|abc)(c*)) abc (0,3)(0,1)(1,3)(1,2)(2,3) +E (a*)((abc|b)(c*)) abc (0,3)(0,1)(1,3)(1,2)(2,3) +E (a*)(b|abc) abc (0,3)(0,0)(0,3) +E (a*)(abc|b) abc (0,3)(0,0)(0,3) +E ((a*)(b|abc))(c*) abc (0,3)(0,3)(0,0)(0,3)(3,3) +E ((a*)(abc|b))(c*) abc (0,3)(0,3)(0,0)(0,3)(3,3) +E (a*)((b|abc)(c*)) abc (0,3)(0,1)(1,3)(1,2)(2,3) +E (a*)((abc|b)(c*)) abc (0,3)(0,1)(1,3)(1,2)(2,3) +E (a|ab) ab (0,2)(0,2) +E (ab|a) ab (0,2)(0,2) +E (a|ab)(b*) ab (0,2)(0,2)(2,2) +E (ab|a)(b*) ab (0,2)(0,2)(2,2) diff --git a/tests/regex/datafiles/greediness-enhanced.dat b/tests/regex/datafiles/greediness-enhanced.dat new file mode 100644 index 0000000..a8e6029 --- /dev/null +++ b/tests/regex/datafiles/greediness-enhanced.dat @@ -0,0 +1,83 @@ +EH (aaa??a??)* aaaaaa (0,6)(4,6) +EH (aa(a??)(a??))* aaaaaa (0,6)(4,6)(6,6)(6,6) +EH (aaa??a??)* aaaaa (0,4)(2,4) +EH (aa(a??)(a??))* aaaaa (0,4)(2,4)(4,4)(4,4) +EH (aaa?a?)*? aaaaaa (0,0)(?,?) +EH (aa(a?)(a?))*? aaaaaa (0,0)(?,?)(?,?)(?,?) +EH (aaa*?a*?)*? aaaaaa (0,0)(?,?) +EH (aa(a*?)(a*?))*? aaaaaa (0,0)(?,?)(?,?)(?,?) +EH (aaa??a??)*b aaaaaab (0,7)(4,6) +EH (aa(a??)(a??))*b aaaaaab (0,7)(4,6)(6,6)(6,6) +EH (aaa?a?)*?b aaaaaab (0,7)(4,6) +EH (aa(a?)(a?))*?b aaaaaab (0,7)(4,6)(6,6)(6,6) +EH (aaa??a??)*?b aaaaaab (0,7)(4,6) +EH (aa(a??)(a??))*?b aaaaaab (0,7)(4,6)(6,6)(6,6) +EH a(.*?)b(.*?)ab abbbbbab (0,8)(1,1)(2,6) +EH a(.*?)b(.*)ab abbbbbab (0,8)(1,1)(2,6) +EH (a+?b*)((?:a|b)+) aaab (0,4)(0,1)(1,4) +EH (a+?b*)((?:a|b)+) abbb (0,4)(0,3)(3,4) +EH (aaa??a??)* aaaa (0,4)(2,4) +EH (aab??b??)* aabb (0,2)(0,2) +EH (aab??b??)* aabbaa (0,2)(0,2) +EH (aab??b??)*z aabbaaz (0,7)(4,6) +EH (aab??b??)*z aabbaabbz (0,9)(4,8) +EH (aaa??a??)*? aaaa (0,0)(?,?) +EH (aab??b??)*? aabb (0,0)(?,?) +EH (aab??b??)*? aabbaa (0,0)(?,?) +EH (aab??b??)*?z aabbaaz (0,7)(4,6) +EH (aab??b??)*?z aabbaabbz (0,9)(4,8) +EH (aaa??a??)*.* aaaa (0,4)(2,4) +EH (aab??b??)*.* aabb (0,4)(0,2) +EH (aab??b??)*.* aabbaa (0,6)(0,2) +EH (aab??b??)*z.* aabbaaz (0,7)(4,6) +EH (aab??b??)*z.* aabbaabbz (0,9)(4,8) +EH a+? aaaaaa (0,1) +EH (aa(a??))* aaaaa (0,4)(2,4)(4,4) +EH (aa(a??))*$ aaaaa (0,5)(3,5)(5,5) +# REG_UNGREEDY +# Only should work for enhanced extended +BHm a* aaa (0,3) +BHm a\? aaa (0,1) +BHm a\+ aaa (0,3) +BHm a\{1,2\} aaa (0,2) +EHm (aaa?a?)*? aaaaaa (0,6)(4,6) +EHm (aa(a?)(a?))*? aaaaaa (0,6)(4,6)(6,6)(6,6) +EHm (aaa?a?)*? aaaaa (0,4)(2,4) +EHm (aa(a?)(a?))*? aaaaa (0,4)(2,4)(4,4)(4,4) +EHm (aaa??a??)* aaaaaa (0,0)(?,?) +EHm (aa(a??)(a??))* aaaaaa (0,0)(?,?)(?,?)(?,?) +EHm (aaa*a*)* aaaaaa (0,0)(?,?) +EHm (aa(a*)(a*))* aaaaaa (0,0)(?,?)(?,?)(?,?) +EHm (aaa?a?)*?b aaaaaab (0,7)(4,6) +EHm (aa(a?)(a?))*?b aaaaaab (0,7)(4,6)(6,6)(6,6) +EHm (aaa??a??)*b aaaaaab (0,7)(4,6) +EHm (aa(a??)(a??))*b aaaaaab (0,7)(4,6)(6,6)(6,6) +EHm (aaa?a?)*b aaaaaab (0,7)(4,6) +EHm (aa(a?)(a?))*b aaaaaab (0,7)(4,6)(6,6)(6,6) +EHm a(.*)b(.*)ab abbbbbab (0,8)(1,1)(2,6) +EHm a(.*)b(.*?)ab abbbbbab (0,8)(1,1)(2,6) +EHm (a+b*?)((?:a|b)+?) aaab (0,4)(0,1)(1,4) +EHm (a+b*?)((?:a|b)+?) abbb (0,4)(0,3)(3,4) +EHm (aaa?a?)*? aaaa (0,4)(2,4) +EHm (aab?b?)*? aabb (0,2)(0,2) +EHm (aab?b?)*? aabbaa (0,2)(0,2) +EHm (aab?b?)*?z aabbaaz (0,7)(4,6) +EHm (aab?b?)*?z aabbaabbz (0,9)(4,8) +EHm (aaa?a?)* aaaa (0,0)(?,?) +EHm (aab?b?)* aabb (0,0)(?,?) +EHm (aab?b?)* aabbaa (0,0)(?,?) +EHm (aab?b?)*z aabbaaz (0,7)(4,6) +EHm (aab?b?)*z aabbaabbz (0,9)(4,8) +EHm (aaa?a?)*?.*? aaaa (0,4)(2,4) +EHm (aab?b?)*?.*? aabb (0,4)(0,2) +EHm (aab?b?)*?.*? aabbaa (0,6)(0,2) +EHm (aab?b?)*?z.*? aabbaaz (0,7)(4,6) +EHm (aab?b?)*?z.*? aabbaabbz (0,9)(4,8) +EHm a+ aaaaaa (0,1) +EHm (aa(a?))*? aaaaa (0,4)(2,4)(4,4) +EHm (aa(a?))*?$ aaaaa (0,5)(3,5)(5,5) +####### +EHm (aaa??a??)*? aaaaaa (0,6)(4,6) +EHm (aaa??a??)*? aaaaa (0,5)(3,5) +EHm (aa(a??)(a??))*? aaaaaa (0,6)(4,6)(6,6)(6,6) +EHm (aa(a??)(a??))*? aaaaa (0,5)(3,5)(5,5)(5,5) diff --git a/tests/regex/datafiles/greediness.dat b/tests/regex/datafiles/greediness.dat new file mode 100644 index 0000000..7702422 --- /dev/null +++ b/tests/regex/datafiles/greediness.dat @@ -0,0 +1,57 @@ +E (aaa?a?)* aaaaaa (0,6)(4,6) +E (aa(a?)(a?))* aaaaaa (0,6)(4,6)(6,6)(6,6) +E (aaa?a?)* aaaaa (0,5)(3,5) +E (aa(a?)(a?))* aaaaa (0,5)(3,5)(5,5)(5,5) +E (aaa??a??)* aaaaaa BADRPT +E (aa(a??)(a??))* aaaaaa BADRPT +E (aaa?a?)*? aaaaaa BADRPT +E (aa(a?)(a?))*? aaaaaa BADRPT +E (aaa*?a*?)*? aaaaaa BADRPT +E (aa(a*?)(a*?))*? aaaaaa BADRPT +E (aaa?a?)*b aaaaaab (0,7)(4,6) +E (aa(a?)(a?))*b aaaaaab (0,7)(4,6)(6,6)(6,6) +E (aaa??a??)*b aaaaaab BADRPT +E (aa(a??)(a??))*b aaaaaab BADRPT +E (aaa?a?)*?b aaaaaab BADRPT +E (aa(a?)(a?))*?b aaaaaab BADRPT +E (aaa??a??)*?b aaaaaab BADRPT +E (aa(a??)(a??))*?b aaaaaab BADRPT +E a(.*?)b(.*?)ab abbbbbab BADRPT +E a(.*?)b(.*)ab abbbbbab BADRPT +E (a+?b*)((?:a|b)+) aaab BADRPT +E (a+?b*)((?:a|b)+) abbb BADRPT +E (aaa??a??)* aaaa BADRPT +E (aab??b??)* aabb BADRPT +E (aab??b??)* aabbaa BADRPT +E (aab??b??)*z aabbaaz BADRPT +E (aab??b??)*z aabbaabbz BADRPT +E (aaa??a??)*? aaaa BADRPT +E (aab??b??)*? aabb BADRPT +E (aab??b??)*? aabbaa BADRPT +E (aab??b??)*?z aabbaaz BADRPT +E (aab??b??)*?z aabbaabbz BADRPT +E (aaa??a??)*.* aaaa BADRPT +E (aab??b??)*.* aabb BADRPT +E (aab??b??)*.* aabbaa BADRPT +E (aab??b??)*z.* aabbaaz BADRPT +E (aab??b??)*z.* aabbaabbz BADRPT +E a+? aaaaaa BADRPT +# REG_UNGREEDY +# Only should work for enhanced extended REs +Bm a* aaa (0,3) +Bm a\{1,2\} aaa (0,2) +Em a* aaa (0,3) +Em a+ aaa (0,3) +Em a{1,2} aaa (0,2) +Em (aaa?a?)* aaaaaa (0,6)(4,6) +Em (aa(a?)(a?))* aaaaaa (0,6)(4,6)(6,6)(6,6) +Em (aaa?a?)* aaaaa (0,5)(3,5) +Em (aa(a?)(a?))* aaaaa (0,5)(3,5)(5,5)(5,5) +Em (aaa?a?)*b aaaaaab (0,7)(4,6) +Em (aa(a?)(a?))*b aaaaaab (0,7)(4,6)(6,6)(6,6) +Em a(.*)b(.*)ab abbbbbab (0,8)(1,5)(6,6) +Em (aaa?a?)* aaaa (0,4)(0,4) +Em (aab?b?)* aabb (0,4)(0,4) +Em (aab?b?)* aabbaa (0,6)(4,6) +Em (aab?b?)*z aabbaaz (0,7)(4,6) +Em (aab?b?)*z aabbaabbz (0,9)(4,8) diff --git a/tests/regex/datafiles/implementation_choices.dat b/tests/regex/datafiles/implementation_choices.dat new file mode 100644 index 0000000..929268f --- /dev/null +++ b/tests/regex/datafiles/implementation_choices.dat @@ -0,0 +1,28 @@ +BE \n n (0,1) +BE [ [ EBRACK +BE [[=e=]-z] x ERANGE +BE a** a BADRPT +E a*+ a BADRPT +E a+* a BADRPT +E a*? a BADRPT +E a?* a BADRPT +B *a *a (0,2) +E *a a BADRPT +B \(*a\) *a (0,2)(0,2) +E (*a) a BADRPT +B ^* * (0,1) +E ^* a BADRPT +E a|* a BADRPT +E a| a EMPTY +E |a a EMPTY +E a||b a EMPTY +B a\{3\} aaa (0,3) +B a\{x a{x BADBR +B a\{x\} a{x BADBR +E a{x a{x (0,3) +B a\($\) a (0,1)(1,1) +B a\($\) a$ NOMATCH +B a\($b\) a$b (0,3)(1,3) +E a($) a (0,1)(1,1) +E a($) a$ NOMATCH +E a($b) a$b NOMATCH diff --git a/tests/regex/datafiles/interpretation.dat b/tests/regex/datafiles/interpretation.dat new file mode 100644 index 0000000..72e186e --- /dev/null +++ b/tests/regex/datafiles/interpretation.dat @@ -0,0 +1,93 @@ +:RE#01:E a+ xaax (1,3) +:RE#02:B .\(a*\). xaax (0,4)(1,3) +:RE#03:E (a?)((ab)?) ab (0,2)(0,0)(0,2)(0,2) +:RE#04:E (a?)((ab)?)(b?) ab (0,2)(0,1)(1,1)(?,?)(1,2) +:RE#05:E ((a?)((ab)?))(b?) ab (0,2)(0,2)(0,0)(0,2)(0,2)(2,2) +:RE#06:E (a?)(((ab)?)(b?)) ab (0,2)(0,1)(1,2)(1,1)(?,?)(1,2) +:RE#07:E (.?) x (0,1)(0,1) +:RE#08:E (.?){1} x (0,1)(0,1) +:RE#09:E (.?)(.?) x (0,1)(0,1)(1,1) +:RE#10:E (.?){2} x (0,1)(1,1) +:RE#11:E (.?)* x (0,1)(0,1) +:RE#12:E (.?.?) xxx (0,2)(0,2) +:RE#13:E (.?.?){1} xxx (0,2)(0,2) +:RE#14:E (.?.?)(.?.?) xxx (0,3)(0,2)(2,3) +:RE#15:E (.?.?){2} xxx (0,3)(2,3) +:RE#16:E (.?.?)(.?.?)(.?.?) xxx (0,3)(0,2)(2,3)(3,3) +:RE#17:E (.?.?){3} xxx (0,3)(3,3) +:RE#18:E (.?.?)* xxx (0,3)(2,3) +:RE#19:E a?((ab)?)(b?) ab (0,2)(1,1)(?,?)(1,2) +:RE#20:E (a?)((ab)?)b? ab (0,2)(0,1)(1,1)(?,?) +:RE#21:E a?((ab)?)b? ab (0,2)(1,1)(?,?) +:RE#22:E (a*){2} xxxxx (0,0)(0,0) +:RE#23:E (ab?)(b?a) aba (0,3)(0,2)(2,3) +:RE#24:E (a|ab)(ba|a) aba (0,3)(0,2)(2,3) +:RE#25:E (a|ab|ba) aba (0,2)(0,2) +:RE#26:E (a|ab|ba)(a|ab|ba) aba (0,3)(0,2)(2,3) +:RE#27:E (a|ab|ba)* aba (0,3)(2,3) +:RE#28:E (aba|a*b) ababa (0,3)(0,3) +:RE#29:E (aba|a*b)(aba|a*b) ababa (0,5)(0,2)(2,5) +:RE#30:E (aba|a*b)* ababa (0,5)(2,5) +:RE#31:E (aba|ab|a) ababa (0,3)(0,3) +:RE#32:E (aba|ab|a)(aba|ab|a) ababa (0,5)(0,2)(2,5) +:RE#33:E (aba|ab|a)* ababa (0,5)(2,5) +:RE#34:E (a(b)?) aba (0,2)(0,2)(1,2) +:RE#35:E (a(b)?)(a(b)?) aba (0,3)(0,2)(1,2)(2,3)(?,?) +:RE#36:E (a(b)?)+ aba (0,3)(2,3)(?,?) +:RE#37:E (.*)(.*) xx (0,2)(0,2)(2,2) +:RE#38:E .*(.*) xx (0,2)(2,2) +:RE#39:E (a.*z|b.*y) azbazby (0,5)(0,5) +:RE#40:E (a.*z|b.*y)(a.*z|b.*y) azbazby (0,7)(0,5)(5,7) +:RE#41:E (a.*z|b.*y)* azbazby (0,7)(5,7) +:RE#42:E (.|..)(.*) ab (0,2)(0,2)(2,2) +:RE#43:E ((..)*(...)*) xxx (0,3)(0,3)(?,?)(0,3) +:RE#44:E ((..)*(...)*)((..)*(...)*) xxx (0,3)(0,3)(?,?)(0,3)(3,3)(?,?) +:RE#45:E ((..)*(...)*)* xxx (0,3)(0,3)(?,?)(0,3) +:RE#46:B \(a\{0,1\}\)*b\1 ab (0,2)(1,1) +:RE#47:B \(a*\)*b\1 ab (0,2)(1,1) +:RE#48:B \(a*\)b\1* ab (0,2)(0,1) +:RE#49:B \(a*\)*b\1* ab (0,2)(1,1) +:RE#50:B \(a\{0,1\}\)*b\(\1\) ab (0,2)(1,1)(2,2) +:RE#51:B \(a*\)*b\(\1\) ab (0,2)(1,1)(2,2) +:RE#52:B \(a*\)b\(\1\)* ab (0,2)(0,1)(?,?) +:RE#53:B \(a*\)*b\(\1\)* ab (0,2)(1,1)(2,2) +:RE#54:B \(a\{0,1\}\)*b\1 aba (0,3)(0,1) +:RE#55:B \(a*\)*b\1 aba (0,3)(0,1) +:RE#56:B \(a*\)b\1* aba (0,3)(0,1) +:RE#57:B \(a*\)*b\1* aba (0,3)(0,1) +:RE#58:B \(a*\)*b\(\1\)* aba (0,3)(0,1)(2,3) +:RE#59:B \(a\{0,1\}\)*b\1 abaa (0,3)(0,1) +:RE#60:B \(a*\)*b\1 abaa (0,3)(0,1) +:RE#61:B \(a*\)b\1* abaa (0,4)(0,1) +:RE#62:B \(a*\)*b\1* abaa (0,4)(0,1) +:RE#63:B \(a*\)*b\(\1\)* abaa (0,4)(0,1)(3,4) +:RE#64:B \(a\{0,1\}\)*b\1 aab (0,3)(2,2) +:RE#65:B \(a*\)*b\1 aab (0,3)(2,2) +:RE#66:B \(a*\)b\1* aab (0,3)(0,2) +:RE#67:B \(a*\)*b\1* aab (0,3)(2,2) +:RE#68:B \(a*\)*b\(\1\)* aab (0,3)(2,2)(3,3) +:RE#69:B \(a\{0,1\}\)*b\1 aaba (0,4)(1,2) +:RE#70:B \(a*\)*b\1 aaba (0,4)(1,2) +:RE#71:B \(a*\)b\1* aaba (0,3)(0,2) +:RE#72:B \(a*\)*b\1* aaba (0,4)(1,2) +:RE#73:B \(a*\)*b\(\1\)* aaba (0,4)(1,2)(3,4) +:RE#74:B \(a\{0,1\}\)*b\1 aabaa (0,4)(1,2) +:RE#75:B \(a*\)*b\1 aabaa (0,5)(0,2) +:RE#76:B \(a*\)b\1* aabaa (0,5)(0,2) +:RE#77:B \(a*\)*b\1* aabaa (0,5)(0,2) +:RE#78:B \(a*\)*b\(\1\)* aabaa (0,5)(0,2)(3,5) +:RE#79:B \(x\)*a\1 a NOMATCH +:RE#80:B \(x\)*a\1* a (0,1)(?,?) +:RE#81:B \(x\)*a\(\1\) a NOMATCH +:RE#82:B \(x\)*a\(\1\)* a (0,1)(?,?)(?,?) +:RE#83:E (aa(b(b))?)+ aabbaa (0,6)(4,6)(?,?)(?,?) +:RE#84:E (a(b)?)+ aba (0,3)(2,3)(?,?) +:RE#85:E ([ab]+)([bc]+)([cd]*) abcd (0,4)(0,2)(2,3)(3,4) +:RE#86:B \([ab]*\)\([bc]*\)\([cd]*\)\1 abcdaa (0,5)(0,1)(1,3)(3,4) +:RE#87:B \([ab]*\)\([bc]*\)\([cd]*\)\1 abcdab (0,6)(0,2)(2,3)(3,4) +:RE#88:B \([ab]*\)\([bc]*\)\([cd]*\)\1* abcdaa (0,6)(0,1)(1,3)(3,4) +:RE#89:B \([ab]*\)\([bc]*\)\([cd]*\)\1* abcdab (0,6)(0,2)(2,3)(3,4) +:RE#90:E ^(A([^B]*))?(B(.*))? Aa (0,2)(0,2)(1,2) +:RE#91:E ^(A([^B]*))?(B(.*))? Bb (0,2)(?,?)(?,?)(0,2)(1,2) +:RE#92:B .*\([AB]\).*\1 ABA (0,3)(0,1) +:RE#93:B$ [^A]*A \nA (0,2) diff --git a/tests/regex/datafiles/iteration.dat b/tests/regex/datafiles/iteration.dat new file mode 100644 index 0000000..079710a --- /dev/null +++ b/tests/regex/datafiles/iteration.dat @@ -0,0 +1,5 @@ +:RE#36:E (a(b)?)+ aba (0,3)(2,3)(?,?) +E (a(b?))+ aba (0,3)(2,3)(3,3) +:RE#83:E (aa(b(b))?)+ aabbaa (0,6)(4,6)(?,?)(?,?) +E zz|(aa(b(b))?)+ aabbaa (0,6)(4,6)(?,?)(?,?) +E (zz|aa(b(b))?)+ aabbaa (0,6)(4,6)(?,?)(?,?) diff --git a/tests/regex/datafiles/misc-enhanced.dat b/tests/regex/datafiles/misc-enhanced.dat new file mode 100644 index 0000000..8877cf1 --- /dev/null +++ b/tests/regex/datafiles/misc-enhanced.dat @@ -0,0 +1 @@ +EH ^(?:(hello)|($)) hello asdf (0,5)(0,5)(?,?) diff --git a/tests/regex/datafiles/misc.dat b/tests/regex/datafiles/misc.dat new file mode 100644 index 0000000..3338d85 --- /dev/null +++ b/tests/regex/datafiles/misc.dat @@ -0,0 +1,20 @@ +B \(a\)*\1 a NOMATCH +#E (?l)(a*)(b|abc)(c*) abc (0,3)(0,0)(0,3)(3,3) +E (...?.?)* xxxx (0,4)(0,4) +E (...?.?)* xxxxx (0,5)(3,5) +E (...?.?)* xxxxxx (0,6)(4,6) +E (...?.?)* xxxxxxx (0,7)(4,7) +E (...?.?)* xxxxxxxx (0,8)(4,8) +E (...?.?)* xxxxxxxxx (0,9)(7,9) +E (...?.?)* xxxxxxxxxx (0,10)(8,10) +E (...?.?)* xxxxxxxxxxx (0,11)(8,11) +{C en_GB.UTF-8 +E ^([[:digit:]]){3}$ abc NOMATCH +} +B \(a\(b\)*\)*\2 abab NOMATCH +B a\(b\)*c\1 acb NOMATCH +B a\(b\)*c\1 abbcbbb (0,5)(2,3) +B a\(b\)*c\1 abbdbd NOMATCH +E (a|ab)(bc|c) abcabc (0,3)(0,2)(2,3) +:RE#33:E (aba|ab|a|z)* ababa (0,5)(2,5) +:RE#33:E (aba|ab|a|(z))* ababa (0,5)(2,5) diff --git a/tests/regex/datafiles/need-parenthesis-enhanced.dat b/tests/regex/datafiles/need-parenthesis-enhanced.dat new file mode 100644 index 0000000..89a6202 --- /dev/null +++ b/tests/regex/datafiles/need-parenthesis-enhanced.dat @@ -0,0 +1,3 @@ +EH (a+?b*)((?:a|b)+) aaab (0,4)(0,1)(1,4) +EH ((a+?)(b*))((a|b)+) aaab (0,4)(0,1)(0,1)(1,1)(1,4)(3,4) +EH ((a+?)b*)((?:a|b)+) aaab (0,4)(0,1)(0,1)(1,4) diff --git a/tests/regex/datafiles/need-parenthesis.dat b/tests/regex/datafiles/need-parenthesis.dat new file mode 100644 index 0000000..7c4bfb3 --- /dev/null +++ b/tests/regex/datafiles/need-parenthesis.dat @@ -0,0 +1,11 @@ +:RE#19:E a?((ab)?)(b?) ab (0,2)(1,1)(?,?)(1,2) +:RE#19a:E (a?)((ab)?)(b?) ab (0,2)(0,1)(1,1)(?,?)(1,2) +:RE#21:E a?((ab)?)b? ab (0,2)(1,1)(?,?) +:RE#21a:E (a?)((ab)?)b? ab (0,2)(0,1)(1,1)(?,?) +:RE#38:E .*(.*) xx (0,2)(2,2) +:RE#38a:E (.*)(.*) xx (0,2)(0,2)(2,2) +E (a?)((ab)?)(b?)a?(ab)?b? abab (0,4)(0,1)(1,1)(?,?)(1,2)(?,?) +E (a?)((ab)?)(b?)(a?)(ab)?b? abab (0,4)(0,1)(1,1)(?,?)(1,2)(2,3)(?,?) +E (a+?b*)((?:a|b)+) aaab BADRPT +E ((a+?)(b*))((a|b)+) aaab BADRPT +E ((a+?)b*)((?:a|b)+) aaab BADRPT diff --git a/tests/regex/datafiles/nullsubexpr.dat b/tests/regex/datafiles/nullsubexpr.dat new file mode 100644 index 0000000..c73d8f0 --- /dev/null +++ b/tests/regex/datafiles/nullsubexpr.dat @@ -0,0 +1,73 @@ +NOTE null subexpression matches : 2002-06-06 + +E (a*)* a (0,1)(0,1) +E SAME x (0,0)(0,0) +E SAME aaaaaa (0,6)(0,6) +E SAME aaaaaax (0,6)(0,6) +E (a*)+ a (0,1)(0,1) +E SAME x (0,0)(0,0) +E SAME aaaaaa (0,6)(0,6) +E SAME aaaaaax (0,6)(0,6) +E (a+)* a (0,1)(0,1) +E SAME x (0,0) +E SAME aaaaaa (0,6)(0,6) +E SAME aaaaaax (0,6)(0,6) +E (a+)+ a (0,1)(0,1) +E SAME x NOMATCH +E SAME aaaaaa (0,6)(0,6) +E SAME aaaaaax (0,6)(0,6) + +E ([a]*)* a (0,1)(0,1) +E SAME x (0,0)(0,0) +E SAME aaaaaa (0,6)(0,6) +E SAME aaaaaax (0,6)(0,6) +E ([a]*)+ a (0,1)(0,1) +E SAME x (0,0)(0,0) +E SAME aaaaaa (0,6)(0,6) +E SAME aaaaaax (0,6)(0,6) +E ([^b]*)* a (0,1)(0,1) +E SAME b (0,0)(0,0) +E SAME aaaaaa (0,6)(0,6) +E SAME aaaaaab (0,6)(0,6) +E ([ab]*)* a (0,1)(0,1) +E SAME aaaaaa (0,6)(0,6) +E SAME ababab (0,6)(0,6) +E SAME bababa (0,6)(0,6) +E SAME b (0,1)(0,1) +E SAME bbbbbb (0,6)(0,6) +E SAME aaaabcde (0,5)(0,5) +E ([^a]*)* b (0,1)(0,1) +E SAME bbbbbb (0,6)(0,6) +E SAME aaaaaa (0,0)(0,0) +E ([^ab]*)* ccccxx (0,6)(0,6) +E SAME ababab (0,0)(0,0) + +E ((z)+|a)* zabcde (0,2)(1,2) + +{E a+? aaaaaa (0,1) no *? +? mimimal match ops +E (a) aaa (0,1)(0,1) +E (a*?) aaa (0,0)(0,0) +E (a)*? aaa (0,0) +E (a*?)*? aaa (0,0) +} + +B \(a*\)*\(x\) x (0,1)(0,0)(0,1) +B \(a*\)*\(x\) ax (0,2)(0,1)(1,2) +B \(a*\)*\(x\) axa (0,2)(0,1)(1,2) +B \(a*\)*\(x\)\(\1\) x (0,1)(0,0)(0,1)(1,1) +B \(a*\)*\(x\)\(\1\) ax (0,2)(1,1)(1,2)(2,2) +B \(a*\)*\(x\)\(\1\) axa (0,3)(0,1)(1,2)(2,3) +B \(a*\)*\(x\)\(\1\)\(x\) axax (0,4)(0,1)(1,2)(2,3)(3,4) +B \(a*\)*\(x\)\(\1\)\(x\) axxa (0,3)(1,1)(1,2)(2,2)(2,3) + +E (a*)*(x) x (0,1)(0,0)(0,1) +E (a*)*(x) ax (0,2)(0,1)(1,2) +E (a*)*(x) axa (0,2)(0,1)(1,2) + +E (a*)+(x) x (0,1)(0,0)(0,1) +E (a*)+(x) ax (0,2)(0,1)(1,2) +E (a*)+(x) axa (0,2)(0,1)(1,2) + +E (a*){2}(x) x (0,1)(0,0)(0,1) +E (a*){2}(x) ax (0,2)(1,1)(1,2) +E (a*){2}(x) axa (0,2)(1,1)(1,2) diff --git a/tests/regex/datafiles/regex-posix-unittest-1.1.dat b/tests/regex/datafiles/regex-posix-unittest-1.1.dat new file mode 100644 index 0000000..a270bff --- /dev/null +++ b/tests/regex/datafiles/regex-posix-unittest-1.1.dat @@ -0,0 +1,79 @@ +E a+ xaax (1,3) +E (a?)((ab)?) ab (0,2)(0,0)(0,2)(0,2) +E (a?)((ab)?)(b?) ab (0,2)(0,1)(1,1)(?,?)(1,2) +E ((a?)((ab)?))(b?) ab (0,2)(0,2)(0,0)(0,2)(0,2)(2,2) +E (a?)(((ab)?)(b?)) ab (0,2)(0,1)(1,2)(1,1)(?,?)(1,2) +E (.?) x (0,1)(0,1) +E (.?){1} x (0,1)(0,1) +E (.?)(.?) x (0,1)(0,1)(1,1) +E (.?){2} x (0,1)(1,1) +E (.?)* x (0,1)(0,1) +E (.?.?) xxx (0,2)(0,2) +E (.?.?){1} xxx (0,2)(0,2) +E (.?.?)(.?.?) xxx (0,3)(0,2)(2,3) +E (.?.?){2} xxx (0,3)(2,3) +E (.?.?)(.?.?)(.?.?) xxx (0,3)(0,2)(2,3)(3,3) +E (.?.?){3} xxx (0,3)(3,3) +E (.?.?)* xxx (0,3)(2,3) +E a?((ab)?)(b?) ab (0,2)(1,1)(?,?)(1,2) +E (a?)((ab)?)b? ab (0,2)(0,1)(1,1)(?,?) +E a?((ab)?)b? ab (0,2)(1,1)(?,?) +E (a*){2} xxxxx (0,0)(0,0) +E (ab?)(b?a) aba (0,3)(0,2)(2,3) +E (a|ab)(ba|a) aba (0,3)(0,2)(2,3) +E (a|ab|ba) aba (0,2)(0,2) +E (a|ab|ba)(a|ab|ba) aba (0,3)(0,2)(2,3) +E (a|ab|ba)* aba (0,3)(2,3) +E (aba|a*b) ababa (0,3)(0,3) +E (aba|a*b)(aba|a*b) ababa (0,5)(0,2)(2,5) +E (aba|a*b)(aba|a*b)(aba|a*b) ababa NOMATCH +E (aba|a*b)* ababa (0,5)(2,5) +E (aba|ab|a) ababa (0,3)(0,3) +E (aba|ab|a)(aba|ab|a) ababa (0,5)(0,2)(2,5) +E (aba|ab|a)(aba|ab|a)(aba|ab|a) ababa (0,5)(0,2)(2,4)(4,5) +E (aba|ab|a)* ababa (0,5)(2,5) +E (a(b)?) aba (0,2)(0,2)(1,2) +E (a(b)?)(a(b)?) aba (0,3)(0,2)(1,2)(2,3)(?,?) +E (a(b)?)+ aba (0,3)(2,3)(?,?) +E (.*)(.*) xx (0,2)(0,2)(2,2) +E .*(.*) xx (0,2)(2,2) +E (a.*z|b.*y) azbazby (0,5)(0,5) +E (a.*z|b.*y)(a.*z|b.*y) azbazby (0,7)(0,5)(5,7) +E (a.*z|b.*y)* azbazby (0,7)(5,7) +E (.|..)(.*) ab (0,2)(0,2)(2,2) +E ((..)*(...)*) xxx (0,3)(0,3)(?,?)(0,3) +E ((..)*(...)*)((..)*(...)*) xxx (0,3)(0,3)(?,?)(0,3)(3,3)(?,?)(?,?) +E ((..)*(...)*)* xxx (0,3)(0,3)(?,?)(0,3) +E (aa(b(b))?)+ aabbaa (0,6)(4,6)(?,?)(?,?) +E (a(b)?)+ aba (0,3)(2,3)(?,?) +E ([ab]+)([bc]+)([cd]*) abcd (0,4)(0,2)(2,3)(3,4) +E ^(A([^B]*))?(B(.*))? Aa (0,2)(0,2)(1,2)(?,?)(?,?) +E ^(A([^B]*))?(B(.*))? Bb (0,2)(?,?)(?,?)(0,2)(1,2) +E (^){0,3} a (0,0)(0,0) +E ($){0,3} a (0,0)(?,?) +E (^){1,3} a (0,0)(0,0) +E ($){1,3} a (1,1)(1,1) +E ((s^)|(s)|(^)|($)|(^.))* searchme (0,1)(0,1)(?,?)(0,1)(?,?)(?,?)(?,?) +E s(()|^)e searchme (0,2)(1,1)(1,1) +E s(^|())e searchme (0,2)(1,1)(1,1) +E s(^|())e searchme (0,2)(1,1)(1,1) +E s()?e searchme (0,2)(1,1) +E s(^)?e searchme (0,2)(?,?) +E ((s)|(e)|(a))* searchme (0,3)(2,3)(?,?)(?,?)(2,3) +E ((s)|(e)|())* searchme (0,2)(1,2)(?,?)(1,2)(?,?) +E ((b*)|c(c*))* cbb (0,3)(1,3)(1,3)(?,?) +E (yyy|(x?)){2,4} yyyyyy (0,6)(3,6)(?,?) +E ($)|() xxx (0,0)(?,?)(0,0) +E $()|^() ac\n (0,0)(?,?)(0,0) +E ^()|$() ac\n (0,0)(0,0)(?,?) +E ($)?(.) __ (0,1)(?,?)(0,1) +E (.|()|())* c (0,1)(0,1)(?,?)(?,?) +E ((a)|(b)){2,} ab (0,2)(1,2)(?,?)(1,2) +E .()|((.)?) NULL (0,0)(?,?)(0,0)(?,?) +E (.|$){2,} xx (0,2)(1,2) +E (.|$){2,2} xx (0,2)(1,2) +E (.){2,} xx (0,2)(1,2) +E (a|())(b|())(c|()) abc (0,3)(0,1)(?,?)(1,2)(?,?)(2,3)(?,?) +E ab()c|ab()c() abc (0,3)(2,2)(-1,-1)(-1,-1) +E (b(c)|d(e))* bcde (0,4)(2,4)(-1,-1)(3,4) +E (a(b)*)* aba (0,3)(2,3)(-1,-1) diff --git a/tests/regex/datafiles/repetition.dat b/tests/regex/datafiles/repetition.dat new file mode 100644 index 0000000..c24749c --- /dev/null +++ b/tests/regex/datafiles/repetition.dat @@ -0,0 +1,140 @@ +NOTE implicit vs. explicit repetitions : 2009-02-02 + +# Glenn Fowler +# conforming matches (column 4) must match one of the following BREs +# NOMATCH +# (0,.)\((\(.\),\(.\))(?,?)(\2,\3)\)* +# (0,.)\((\(.\),\(.\))(\2,\3)(?,?)\)* +# i.e., each 3-tuple has two identical elements and one (?,?) + +E ((..)|(.)) NULL NOMATCH +E ((..)|(.))((..)|(.)) NULL NOMATCH +E ((..)|(.))((..)|(.))((..)|(.)) NULL NOMATCH + +E ((..)|(.)){1} NULL NOMATCH +E ((..)|(.)){2} NULL NOMATCH +E ((..)|(.)){3} NULL NOMATCH + +E ((..)|(.))* NULL (0,0) + +E ((..)|(.)) a (0,1)(0,1)(?,?)(0,1) +E ((..)|(.))((..)|(.)) a NOMATCH +E ((..)|(.))((..)|(.))((..)|(.)) a NOMATCH + +E ((..)|(.)){1} a (0,1)(0,1)(?,?)(0,1) +E ((..)|(.)){2} a NOMATCH +E ((..)|(.)){3} a NOMATCH + +E ((..)|(.))* a (0,1)(0,1)(?,?)(0,1) + +E ((..)|(.)) aa (0,2)(0,2)(0,2)(?,?) +E ((..)|(.))((..)|(.)) aa (0,2)(0,1)(?,?)(0,1)(1,2)(?,?)(1,2) +E ((..)|(.))((..)|(.))((..)|(.)) aa NOMATCH + +E ((..)|(.)){1} aa (0,2)(0,2)(0,2)(?,?) +E ((..)|(.)){2} aa (0,2)(1,2)(?,?)(1,2) +E ((..)|(.)){3} aa NOMATCH + +E ((..)|(.))* aa (0,2)(0,2)(0,2)(?,?) + +E ((..)|(.)) aaa (0,2)(0,2)(0,2)(?,?) +E ((..)|(.))((..)|(.)) aaa (0,3)(0,2)(0,2)(?,?)(2,3)(?,?)(2,3) +E ((..)|(.))((..)|(.))((..)|(.)) aaa (0,3)(0,1)(?,?)(0,1)(1,2)(?,?)(1,2)(2,3)(?,?)(2,3) + +E ((..)|(.)){1} aaa (0,2)(0,2)(0,2)(?,?) +E ((..)|(.)){2} aaa (0,3)(2,3)(?,?)(2,3) +E ((..)|(.)){3} aaa (0,3)(2,3)(?,?)(2,3) + +E ((..)|(.))* aaa (0,3)(2,3)(?,?)(2,3) + +E ((..)|(.)) aaaa (0,2)(0,2)(0,2)(?,?) +E ((..)|(.))((..)|(.)) aaaa (0,4)(0,2)(0,2)(?,?)(2,4)(2,4)(?,?) +E ((..)|(.))((..)|(.))((..)|(.)) aaaa (0,4)(0,2)(0,2)(?,?)(2,3)(?,?)(2,3)(3,4)(?,?)(3,4) + +E ((..)|(.)){1} aaaa (0,2)(0,2)(0,2)(?,?) +E ((..)|(.)){2} aaaa (0,4)(2,4)(2,4)(?,?) +E ((..)|(.)){3} aaaa (0,4)(3,4)(?,?)(3,4) + +E ((..)|(.))* aaaa (0,4)(2,4)(2,4)(?,?) + +E ((..)|(.)) aaaaa (0,2)(0,2)(0,2)(?,?) +E ((..)|(.))((..)|(.)) aaaaa (0,4)(0,2)(0,2)(?,?)(2,4)(2,4)(?,?) +E ((..)|(.))((..)|(.))((..)|(.)) aaaaa (0,5)(0,2)(0,2)(?,?)(2,4)(2,4)(?,?)(4,5)(?,?)(4,5) + +E ((..)|(.)){1} aaaaa (0,2)(0,2)(0,2)(?,?) +E ((..)|(.)){2} aaaaa (0,4)(2,4)(2,4)(?,?) +E ((..)|(.)){3} aaaaa (0,5)(4,5)(?,?)(4,5) + +E ((..)|(.))* aaaaa (0,5)(4,5)(?,?)(4,5) + +E ((..)|(.)) aaaaaa (0,2)(0,2)(0,2)(?,?) +E ((..)|(.))((..)|(.)) aaaaaa (0,4)(0,2)(0,2)(?,?)(2,4)(2,4)(?,?) +E ((..)|(.))((..)|(.))((..)|(.)) aaaaaa (0,6)(0,2)(0,2)(?,?)(2,4)(2,4)(?,?)(4,6)(4,6)(?,?) + +E ((..)|(.)){1} aaaaaa (0,2)(0,2)(0,2)(?,?) +E ((..)|(.)){2} aaaaaa (0,4)(2,4)(2,4)(?,?) +E ((..)|(.)){3} aaaaaa (0,6)(4,6)(4,6)(?,?) + +E ((..)|(.))* aaaaaa (0,6)(4,6)(4,6)(?,?) + +NOTE additional repetition tests graciously provided by Chris Kuklewicz www.haskell.org 2009-02-02 + +# These test a bug in OS X / FreeBSD / NetBSD, and libtree. +# Linux/GLIBC gets the {8,} and {8,8} wrong. + +:HA#100:E X(.?){0,}Y X1234567Y (0,9)(7,8) +:HA#101:E X(.?){1,}Y X1234567Y (0,9)(7,8) +:HA#102:E X(.?){2,}Y X1234567Y (0,9)(7,8) +:HA#103:E X(.?){3,}Y X1234567Y (0,9)(7,8) +:HA#104:E X(.?){4,}Y X1234567Y (0,9)(7,8) +:HA#105:E X(.?){5,}Y X1234567Y (0,9)(7,8) +:HA#106:E X(.?){6,}Y X1234567Y (0,9)(7,8) +:HA#107:E X(.?){7,}Y X1234567Y (0,9)(7,8) +:HA#108:E X(.?){8,}Y X1234567Y (0,9)(8,8) +:HA#110:E X(.?){0,8}Y X1234567Y (0,9)(7,8) +:HA#111:E X(.?){1,8}Y X1234567Y (0,9)(7,8) +:HA#112:E X(.?){2,8}Y X1234567Y (0,9)(7,8) +:HA#113:E X(.?){3,8}Y X1234567Y (0,9)(7,8) +:HA#114:E X(.?){4,8}Y X1234567Y (0,9)(7,8) +:HA#115:E X(.?){5,8}Y X1234567Y (0,9)(7,8) +:HA#116:E X(.?){6,8}Y X1234567Y (0,9)(7,8) +:HA#117:E X(.?){7,8}Y X1234567Y (0,9)(7,8) +:HA#118:E X(.?){8,8}Y X1234567Y (0,9)(8,8) + +# These test a fixed bug in my regex-tdfa that did not keep the expanded +# form properly grouped, so right association did the wrong thing with +# these ambiguous patterns (crafted just to test my code when I became +# suspicious of my implementation). The first subexpression should use +# "ab" then "a" then "bcd". + +# OS X / FreeBSD / NetBSD badly fail many of these, with impossible +# results like (0,6)(4,5)(6,6). + +:HA#260:E (a|ab|c|bcd){0,}(d*) ababcd (0,6)(3,6)(6,6) +:HA#261:E (a|ab|c|bcd){1,}(d*) ababcd (0,6)(3,6)(6,6) +:HA#262:E (a|ab|c|bcd){2,}(d*) ababcd (0,6)(3,6)(6,6) +:HA#263:E (a|ab|c|bcd){3,}(d*) ababcd (0,6)(3,6)(6,6) +:HA#264:E (a|ab|c|bcd){4,}(d*) ababcd NOMATCH +:HA#265:E (a|ab|c|bcd){0,10}(d*) ababcd (0,6)(3,6)(6,6) +:HA#266:E (a|ab|c|bcd){1,10}(d*) ababcd (0,6)(3,6)(6,6) +:HA#267:E (a|ab|c|bcd){2,10}(d*) ababcd (0,6)(3,6)(6,6) +:HA#268:E (a|ab|c|bcd){3,10}(d*) ababcd (0,6)(3,6)(6,6) +:HA#269:E (a|ab|c|bcd){4,10}(d*) ababcd NOMATCH +:HA#270:E (a|ab|c|bcd)*(d*) ababcd (0,6)(3,6)(6,6) +:HA#271:E (a|ab|c|bcd)+(d*) ababcd (0,6)(3,6)(6,6) + +# The above worked on Linux/GLIBC but the following often fail. +# They also trip up OS X / FreeBSD / NetBSD: + +:HA#280:E (ab|a|c|bcd){0,}(d*) ababcd (0,6)(3,6)(6,6) +:HA#281:E (ab|a|c|bcd){1,}(d*) ababcd (0,6)(3,6)(6,6) +:HA#282:E (ab|a|c|bcd){2,}(d*) ababcd (0,6)(3,6)(6,6) +:HA#283:E (ab|a|c|bcd){3,}(d*) ababcd (0,6)(3,6)(6,6) +:HA#284:E (ab|a|c|bcd){4,}(d*) ababcd NOMATCH +:HA#285:E (ab|a|c|bcd){0,10}(d*) ababcd (0,6)(3,6)(6,6) +:HA#286:E (ab|a|c|bcd){1,10}(d*) ababcd (0,6)(3,6)(6,6) +:HA#287:E (ab|a|c|bcd){2,10}(d*) ababcd (0,6)(3,6)(6,6) +:HA#288:E (ab|a|c|bcd){3,10}(d*) ababcd (0,6)(3,6)(6,6) +:HA#289:E (ab|a|c|bcd){4,10}(d*) ababcd NOMATCH +:HA#290:E (ab|a|c|bcd)*(d*) ababcd (0,6)(3,6)(6,6) +:HA#291:E (ab|a|c|bcd)+(d*) ababcd (0,6)(3,6)(6,6) diff --git a/tests/regex/datafiles/rightassoc.dat b/tests/regex/datafiles/rightassoc.dat new file mode 100644 index 0000000..ed7f28e --- /dev/null +++ b/tests/regex/datafiles/rightassoc.dat @@ -0,0 +1,16 @@ +NOTE left-assoc:pass-none right-assoc:pass-all : 2002-04-29 + +E (a|ab)(c|bcd)(d*) abcd (0,4)(0,2)(2,3)(3,4) +E (a|ab)(bcd|c)(d*) abcd (0,4)(0,2)(2,3)(3,4) +E (ab|a)(c|bcd)(d*) abcd (0,4)(0,2)(2,3)(3,4) +E (ab|a)(bcd|c)(d*) abcd (0,4)(0,2)(2,3)(3,4) + +E (a*)(b|abc)(c*) abc (0,3)(0,1)(1,2)(2,3) +E (a*)(abc|b)(c*) abc (0,3)(0,1)(1,2)(2,3) +E (a*)(b|abc)(c*) abc (0,3)(0,1)(1,2)(2,3) +E (a*)(abc|b)(c*) abc (0,3)(0,1)(1,2)(2,3) + +E (a|ab)(c|bcd)(d|.*) abcd (0,4)(0,2)(2,3)(3,4) +E (a|ab)(bcd|c)(d|.*) abcd (0,4)(0,2)(2,3)(3,4) +E (ab|a)(c|bcd)(d|.*) abcd (0,4)(0,2)(2,3)(3,4) +E (ab|a)(bcd|c)(d|.*) abcd (0,4)(0,2)(2,3)(3,4) diff --git a/tests/regex/datafiles/rightbracket.dat b/tests/regex/datafiles/rightbracket.dat new file mode 100644 index 0000000..a8e966d --- /dev/null +++ b/tests/regex/datafiles/rightbracket.dat @@ -0,0 +1,3 @@ +E ] [abc][def] (4,5) +E []-] [abc][def] (4,5) +E []-] [a-c][def] (2,3) diff --git a/tests/regex/datafiles/rightparen.dat b/tests/regex/datafiles/rightparen.dat new file mode 100644 index 0000000..f8a5650 --- /dev/null +++ b/tests/regex/datafiles/rightparen.dat @@ -0,0 +1,7 @@ +B \) x EPAREN +B \(\)\) x EPAREN +E ) x NOMATCH +E ) ) (0,1) +E ()) ) (0,1)(0,0) +E (()|a)) a) (0,2)(0,1)(?,?) +E \\) \) (0,2) diff --git a/tests/regex/datafiles/tre-bugs.dat b/tests/regex/datafiles/tre-bugs.dat new file mode 100644 index 0000000..808b27f --- /dev/null +++ b/tests/regex/datafiles/tre-bugs.dat @@ -0,0 +1,6 @@ +E (a|b|\|) | (0,1)(0,1) +B \\(^ \(^ (0,3) +B a*+ aa+ (0,3) +B a\{2\}+ aa+ (0,3) +EH \Q\t*\E \t* (0,3) +EH \Q\\t*\E \\t* (0,4) diff --git a/tests/regex/datafiles/tre-enhanced.dat b/tests/regex/datafiles/tre-enhanced.dat new file mode 100644 index 0000000..a424437 --- /dev/null +++ b/tests/regex/datafiles/tre-enhanced.dat @@ -0,0 +1,17 @@ +## Test \x in wide character under UTF-8 +{C en_US.UTF-8 +B$ \\x{263a} \xe2\x98\xba NOMATCH +B$ SAME x{263a} (0,7) +E$ \\x{263a} \xe2\x98\xba BADBR +BE$ \\x81 \xc2\x81 NOMATCH +BE$ SAME x81 (0,3) +BE$H \\x{263a} \xe2\x98\xba (0,3) +BE$H \\x81 \xc2\x81 (0,2) +} +## Test non-self-contained options only apply to current subexpression +E ((?i)fu)bar Fubar BADRPT +E ((?i)fu)bar FuBar BADRPT +EH ((?i)fu)bar Fubar (0,5)(0,2) +EH ((?i)fu)bar FuBar NOMATCH +EH (?:(?i)fu)bar Fubar (0,5) +EH (?:(?i)fu)bar FuBar NOMATCH diff --git a/tests/regex/datafiles/tre-tests-enhanced.dat b/tests/regex/datafiles/tre-tests-enhanced.dat new file mode 100644 index 0000000..eb4e56c --- /dev/null +++ b/tests/regex/datafiles/tre-tests-enhanced.dat @@ -0,0 +1,544 @@ +# Large number of macros in one regexp (Enhanced BRE) +B$H [A-Z]\\d\\s\\?\\d[A-Z]\\{2\\}\\|[A-Z]\\d\\{2\\}\\s\\?\\d[A-Z]\\{2\\}\\|[A-Z]\\{2\\}\\d\\s\\?\\d[A-Z]\\{2\\}\\|[A-Z]\\{2\\}\\d\\{2\\}\\s\\?\\d[A-Z]\\{2\\}\\|[A-Z]\\d[A-Z]\\s\\?\\d[A-Z]\\{2\\}\\|[A-Z]\\{2\\}\\d[A-Z]\\s\\?\\d[A-Z]\\{2\\}\\|[A-Z]\\{3\\}\\s\\?\\d[A-Z]\\{2\\} A12BC (0,5) +BH a\{11\}\(b\{2\}c\)\{2\} aaaaaaaaaaabbcbbc (0,17)(14,17) +B$H ^!packet [0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\}\\.[0-9]\\{1,3\\} [0-9]\\+ !packet 127.0.0.1 999 (0,21) +B$H ^!pfast [0-9]\\{1,15\\} \\([0-9]\\{1,3\\}\\.\\)\\{3\\}[0-9]\\{1,3\\}\\.[0-9]\\{1,5\\}$ !pfast 1234567890 127.0.0.1.1234 (0,32)(24,26) +# Should these match or not? +BH \(a\)*-\1b aaa-b NOMATCH +BH \(\(.*\)\1\)\{1,\} xxxxxx ESUBREG +# Basic string matching +BH foobar foobar (0,6) +BH SAME xxxfoobarzapzot (3,9) +BH aaaa xxaaaaaaaaaaaaaaaaa (2,6) +# Test zero length matches +BH \(a*\) NULL (0,0)(0,0) +BH \(a*\)* NULL (0,0)(0,0) +BH \(\(a*\)*\)* NULL (0,0)(0,0)(0,0) +BH \(a*bcd\)* aaaaaaaaaaaabcxbcxbcxaabcxaabcx (0,0)(?,?) +BH SAME aaaaaaaaaaaabcxbcxbcxaabcxaabc (0,0)(?,?) +BH SAME aaaaaaaaaaaabcxbcdbcxaabcxaabc (0,0)(?,?) +BH SAME aaaaaaaaaaaabcdbcdbcxaabcxaabc (0,18)(15,18) +BH \(a*\)\+ - (0,0)(0,0) +#E NULL NULL (0,0) +#E SAME foo (0,0) +# Test for submatch addressing which requires arbitrary lookahead +BH \(a*\)aaaaaa aaaaaaaaaaaaaaax (0,15)(0,9) +# Test leftmost and longest matching and some tricky submatches +BH \(a*\)\(a*\) aaaa (0,4)(0,4)(4,4) +BH \(abcd\|abc\)\(d\?\) abcd (0,4)(0,4)(4,4) +BH \(abc\|abcd\)\(d\?\) abcd (0,4)(0,4)(4,4) +BH \(abc\|abcd\)\(d\?\)e abcde (0,5)(0,4)(4,4) +BH \(abcd\|abc\)\(d\?\)e abcde (0,5)(0,4)(4,4) +BH a\(bc\|bcd\)\(d\?\) abcd (0,4)(1,4)(4,4) +BH a\(bcd\|bc\)\(d\?\) abcd (0,4)(1,4)(4,4) +BH a*\(a\?bc\|bcd\)\(d\?\) aaabcd (0,6)(3,6)(6,6) +BH a*\(bcd\|a\?bc\)\(d\?\) aaabcd (0,6)(3,6)(6,6) +BH \(a\|\(a*b*\)\)* NULL (0,0)(0,0)(0,0) +BH SAME a (0,1)(0,1)(?,?) +BH SAME aa (0,2)(0,2)(0,2) +BH SAME aaa (0,3)(0,3)(0,3) +BH SAME bbb (0,3)(0,3)(0,3) +BH SAME aaabbb (0,6)(0,6)(0,6) +BH SAME bbbaaa (0,6)(3,6)(3,6) +BH \(\(a*b*\)\|a\)* NULL (0,0)(0,0)(0,0) +BH SAME a (0,1)(0,1)(0,1) +BH SAME aa (0,2)(0,2)(0,2) +BH SAME aaa (0,3)(0,3)(0,3) +BH SAME bbb (0,3)(0,3)(0,3) +BH SAME aaabbb (0,6)(0,6)(0,6) +BH SAME bbbaaa (0,6)(3,6)(3,6) +BH a.*\(.*b.*\(.*c.*\).*d.*\).*e.*\(.*f.*\).*g aabbccddeeffgg (0,14)(3,9)(5,7)(11,13) +BH \(wee\|week\)\(night\|knights\)s* weeknights (0,10)(0,4)(4,9) +BH SAME weeknightss (0,11)(0,4)(4,9) +BH a* aaaaaaaaaa (0,10) +BH aa* aaaaaaaaaa (0,10) +BH aaa* aaaaaaaaaa (0,10) +BH aaaa* aaaaaaaaaa (0,10) +# Test clearing old submatch data with nesting parentheses and iteration +BH \(\(a\)\|\(b\)\)*c aaabc (0,5)(3,4)(?,?)(3,4) +BH SAME aaaac (0,5)(3,4)(3,4)(?,?) +BH foo\(\(bar\)*\)*zot foozot (0,6)(3,3)(?,?) +BH SAME foobarzot (0,9)(3,6)(3,6) +BH SAME foobarbarzot (0,12)(3,9)(6,9) +BH foo\(\(zup\)*\|\(bar\)*\|\(zap\)*\)*zot foobarzapzot (0,12)(6,9)(?,?)(?,?)(6,9) +BH SAME foobarbarzapzot (0,15)(9,12)(?,?)(?,?)(9,12) +BH SAME foozupzot (0,9)(3,6)(3,6)(?,?)(?,?) +BH SAME foobarzot (0,9)(3,6)(?,?)(3,6)(?,?) +BH SAME foozapzot (0,9)(3,6)(?,?)(?,?)(3,6) +BH SAME foozot (0,6)(3,3)(?,?)(?,?)(?,?) +# Test case where, e.g., Perl and Python regexp functions, and many +# other backtracking matchers, fail to produce the longest match. +# It is not exactly a bug since Perl does not claim to find the +# longest match, but a confusing feature and, in my opinion, a bad +# design choice because the union operator is traditionally defined +# to be commutative (with respect to the language denoted by the RE). */ +BH \(a\|ab\)\(blip\)\? ablip (0,5)(0,1)(1,5) +BH SAME ab (0,2)(0,2)(?,?) +BH \(ab\|a\)\(blip\)\? ablip (0,5)(0,1)(1,5) +BH SAME ab (0,2)(0,2)(?,?) +BH \(\(a\|b\)*\)a\(a\|b\)* aaaaabaaaba (0,11)(0,10)(9,10)(?,?) +BH SAME aaaaabaaab (0,10)(0,8)(7,8)(9,10) +BH SAME caa (1,3)(1,2)(1,2)(?,?) +BH \(\(a\|aba\)*\)\(ababbaba\)\(\(a\|b\)*\) aabaababbabaaababbab (0,20)(0,4)(1,4)(4,12)(12,20)(19,20) +BH SAME aaaaababbaba (0,12)(0,4)(3,4)(4,12)(12,12)(?,?) +BH \(\(a\|aba\|abb\|bba\|bab\)*\)\(ababbababbabbbabbbbbbabbaba\)\(\(a\|b\)*\) aabaabbbbabababaababbababbabbbabbbbbbabbabababbababababbabababa (0,63)(0,16)(13,16)(16,43)(43,63)(62,63) +# Test for empty subexpressions +#E (a|) a (0,1)(0,1) +#E SAME b (0,0)(0,0) +#E SAME NULL (0,0)(0,0) +#E (|a) a (0,1)(0,1) +#E SAME b (0,0)(0,0) +#E SAME NULL (0,0)(0,0) +#E a| a (0,1) +#E SAME b (0,0) +#E SAME NULL (0,0) +#E |a a (0,1) +#E SAME b (0,0) +#E SAME NULL (0,0) +# Miscellaneous tests +BH \(a*\)b\(c*\) abc (0,3)(0,1)(2,3) +BH SAME ***abc*** (3,6)(3,4)(5,6) +BH \(a\) a (0,1)(0,1) +BH \(\(a\)\) a (0,1)(0,1)(0,1) +BH \(\(\(\(\(\(\(\(\(\(\(\(\(\(\(\(\(\(\(\(a\)\)\)\)\)\)\)\)\)\)\)\)\)\)\)\)\)\)\)\) a (0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1) +BH ksntoeaiksntoeaikstneoaiksnteoaiksntoeaiskntoeaiskntoekainstoeiaskntoeakisntoeksaitnokesantiksoentaikosentaiksoentaiksnoeaisknteoaksintoekasitnoeksaitkosetniaksoetnaisknoetakistoeksintokesanitksoentaisknoetaisknoetiaksotneaikstoekasitoeskatioksentaiksoenatiksoetnaiksonateiksoteaeskanotisknetaiskntoeasknitoskenatiskonetaisknoteai x NOMATCH +BH \(\(aab\)\|\(aac\)\|\(aa*\)\)c aabc (0,4)(0,3)(0,3)(?,?)(?,?) +BH SAME aacc (0,4)(0,3)(?,?)(0,3)(?,?) +BH SAME aaac (0,4)(0,3)(?,?)(?,?)(0,3) +BH ^\(\([^!]\+!\)\?\([^!]\+\)\|.\+!\([^!]\+!\)\([^!]\+\)\)$ foo!bar!bas (0,11)(0,11)(?,?)(?,?)(4,8)(8,11) +# For BRE, the first $ is not magic +#E ^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$ foo!bar!bas (0,11)(?,?)(?,?)(4,8)(8,11) +BH ^\(\([^!]\+!\)\?\([^!]\+\)\|.\+!\([^!]\+!\)\([^!]\+\)\)$ foo!bar!bas (0,11)(0,11)(?,?)(?,?)(4,8)(8,11) +BH M[ou]'\?am\+[ae]r .*\([AEae]l[- ]\)\?[GKQ]h\?[aeu]\+\([dtz][dhz]\?\)\+af[iy] Muammar Quathafi (0,16)(?,?)(11,13) +BHi \(Ab\|cD\)* aBcD (0,4)(2,4) +BH a** NULL BADRPT +BH a*\+ NULL BADRPT +BH a\+* NULL BADRPT +BH a\+\+ NULL BADRPT +BH a\?\+ NULL BADRPT +BH a\?* NULL BADRPT +BH a\{1,2\}* NULL BADRPT +BH a\{1,2\}\+ a+ (0,2) +# Many of the following tests were mostly inspired by (or copied from) the +# libhackerlab posix test suite by Tom Lord +BH a a (0,1) +BH \. . (0,1) +BH \[ [ (0,1) +BH \\ \ (0,1) +BH \* * (0,1) +BH \^ ^ (0,1) +BH \$ $ (0,1) +BH \ NULL EESCAPE +BH x\. x. (0,2) +BH x\[ x[ (0,2) +BH x\\ x\ (0,2) +BH x\* x* (0,2) +BH x\^ x^ (0,2) +BH x\$ x$ (0,2) +BH x\ NULL EESCAPE +BH . a (0,1) +BH$ SAME \n (0,1) +#B (+|?) (+|?) (0,5) +#B SAME +|? NOMATCH +#B SAME (+) NOMATCH +#B SAME + NOMATCH +# Test bracket expressions +BH [ NULL EBRACK +BH [] NULL EBRACK +BH [^] NULL EBRACK +BH []x] ] (0,1) +BH []x] x (0,1) +BH [.] . (0,1) +BH SAME a NOMATCH +BH [*] * (0,1) +BH [[] [ (0,1) +BH [\] \ (0,1) +BH [-x] - (0,1) +BH SAME x (0,1) +BH [x-] - (0,1) +BH SAME x (0,1) +BH [-] - (0,1) +BH [abc] a (0,1) +BH SAME b (0,1) +BH SAME c (0,1) +BH SAME d NOMATCH +BH SAME xa (1,2) +BH SAME xb (1,2) +BH SAME xc (1,2) +BH SAME xd NOMATCH +BH x[abc] xa (0,2) +BH SAME xb (0,2) +BH SAME xc (0,2) +BH SAME xd NOMATCH +BH [^abc] a NOMATCH +BH SAME b NOMATCH +BH SAME c NOMATCH +BH SAME d (0,1) +BH SAME xa (0,1) +BH SAME xb (0,1) +BH SAME xc (0,1) +BH SAME xd (0,1) +BH x[^abc] xa NOMATCH +BH x[^abc] xb NOMATCH +BH x[^abc] xc NOMATCH +BH x[^abc] xd (0,2) +BH [()+?*\]\+ x\*?+()x (1,7) +# Standard character classes +BH [[:alnum:]]\+ %abc123890XYZ= (1,13) +BH$ [[:cntrl:]]\\+ %\n\t\015\f (1,5) +BH [[:lower:]]\+ AbcdE (1,4) +BHi [[:lower:]]\+ AbcdE (0,5) +BH$ [[:space:]]\\+ x \t\f\nx (1,5) +BH [[:alpha:]]\+ %abC123890xyz= (1,4) +BH [[:digit:]]\+ %abC123890xyz= (4,10) +BH [^[:digit:]]\+ %abC123890xyz= (0,4) +BH$ [[:print:]]\\+ \n %abC12\f (1,8) +BH$ [[:upper:]]\\+ \n aBCDEFGHIJKLMNOPQRSTUVWXYz (3,27) +BHi$ [[:upper:]]\\+ \n aBCDEFGHIJKLMNOPQRSTUVWXYz (2,28) +BH$ [[:blank:]]\\+ \na \t b (2,5) +BH$ [[:graph:]]\\+ \n %abC12\f (2,8) +BH [[:punct:]]\+ a~!@#$%^&*()_+=-`[]{};':"|\,./?>< (1,33) +BH [[:xdigit:]]\+ -0123456789ABCDEFabcdef (1,23) +BH [[:bogus-character-class-name:] NULL ECTYPE +# Range expressions (assuming that the C locale is being used) +BH [a-z]\+ ABCabcxyzABC (3,9) +BH [z-a]\+ NULL ERANGE +BH [a-b-c] NULL ERANGE +BH [a-a]\+ zaaaaab (1,6) +BH [--Z]\+ !ABC-./XYZ~ (1,10) +BH [*--] - (0,1) +BH SAME * (0,1) +BH [*--Z]\+ !+*,---ABC (1,7) +BH [a-]\+ xa-a--a-ay (1,9) +# REG_ICASE and character sets +BHi [a-c]* cABbage (0,5) +BHi [^a-c]* tObAcCo (0,2) +BHi [A-C]* cABbage (0,5) +BHi [^A-C]* tObAcCo (0,2) +# Complex character sets +BH [[:digit:]a-z#$%]\+ __abc#lmn012$x%yz789* (2,20) +BHi [[:digit:]a-z#$%]\+ __abcLMN012x%#$yz789* (2,20) +BH [^[:digit:]a-z#$%]\+ abc#lmn012$x%yz789--@*,abc (18,23) +BHi [^[:digit:]a-z#$%]\+ abc#lmn012$x%yz789--@*,abc (18,23) +BHi [^[:digit:]#$%[:xdigit:]]\+ abc#lmn012$x%yz789--@*,abc (4,7) +BH [^-]\+ ---afd*(&,ml--- (3,12) +BH [^--Z]\+ ---AFD*(&,ml--- (6,12) +BHi [^--Z]\+ ---AFD*(&,ml--- (6,10) +# Miscellaneous tests +BH abc\(\(de\)\(fg\)\)hi xabcdefghiy (1,10)(4,8)(4,6)(6,8) +BH abc*def xabdefy (1,6) +BH SAME xabcdefy (1,7) +BH SAME xabcccccccdefy (1,13) +BH abc\(def\)*ghi xabcghiy (1,7)(?,?) +BH SAME xabcdefghi (1,10)(4,7) +BH SAME xabcdefdefdefghi (1,16)(10,13) +BH a\? aaaaa (0,1) +BH SAME xaaaaa (0,0) +BH a\+ aaaaa (0,5) +BH SAME xaaaaa (1,6) +# Test anchors and their behaviour with the REG_NEWLINE compilation +# flag and the REG_NOTBOL, REG_NOTEOL execution flags. +# +# Normally, `^' matches the empty string at beginning of input. +# If REG_NOTBOL is used, `^' won't match the zero length string. +BH ^abc abcdef (0,3) +BHb SAME abcdef NOMATCH +BH SAME xyzabcdef NOMATCH +BHb SAME xyzabcdef NOMATCH +BH$ SAME \nabcdef NOMATCH +BHb$ SAME \nabcdef NOMATCH +# Normally, `$' matches the empty string at end of input. +# If REG_NOTEOL is used, `$' won't match the zero length string. +BH abc$ defabc (3,6) +BHe SAME defabc NOMATCH +BH SAME defabcxyz NOMATCH +BHe SAME defabcxyz NOMATCH +BH$ SAME defabc\n NOMATCH +BHe$ SAME defabc\n NOMATCH +BH ^abc$ abc (0,3) +BHb SAME abc NOMATCH +BHe SAME abc NOMATCH +BHbe SAME abc NOMATCH +BH$ SAME \nabc\n NOMATCH +BH$ SAME defabc\n NOMATCH +BH$ SAME \nabcdef NOMATCH +BH SAME abcdef NOMATCH +BH SAME defabc NOMATCH +BH$ SAME abc\ndef NOMATCH +BH$ SAME def\nabc NOMATCH +# If REG_NEWLINE is used, `^' matches the empty string immediately after +# a newline, regardless of whether execution flags contain REG_NOTBOL. +# Similarly, if REG_NEWLINE is used, `$' matches the empty string +# immediately before a newline, regardless of execution flags. +BHn ^abc abcdef (0,3) +BHbn SAME abcdef NOMATCH +BHn SAME xyzabcdef NOMATCH +BHbn SAME xyzabcdef NOMATCH +BHn$ SAME \nabcdef (1,4) +BHbn$ SAME \nabcdef (1,4) +BHn abc$ defabc (3,6) +BHen SAME defabc NOMATCH +BHn SAME defabcxyz NOMATCH +BHen SAME defabcxyz NOMATCH +BHn$ SAME defabc\n (3,6) +BHen$ SAME defabc\n (3,6) +BHn ^abc$ abc (0,3) +BHbn SAME abc NOMATCH +BHen SAME abc NOMATCH +BHben SAME abc NOMATCH +BHn$ SAME \nabc\n (1,4) +BHn$ SAME defabc\n NOMATCH +BHn$ SAME \nabcdef NOMATCH +BHn SAME abcdef NOMATCH +BHbn SAME abcdef NOMATCH +BHn SAME defabc NOMATCH +BHen SAME defabc NOMATCH +BHn$ SAME abc\ndef (0,3) +BHbn$ SAME abc\ndef NOMATCH +BHen$ SAME abc\ndef (0,3) +BHbn$ SAME abc\ndef NOMATCH +BHn$ SAME def\nabc (4,7) +BHbn$ SAME def\nabc (4,7) +BHen$ SAME def\nabc NOMATCH +BHben$ SAME def\nabc NOMATCH +# With BRE syntax, `^' has a special meaning only at the beginning of the +# RE or the beginning of a parenthesized subexpression. +BH a\{0,1\}^bc bc NOMATCH +BH SAME ^bc (0,3) +BH SAME abc NOMATCH +BH SAME a^bc (0,4) +BH a\{0,1\}\(^bc\) bc (0,2)(0,2) +BH SAME ^bc NOMATCH +BH SAME abc NOMATCH +BH SAME a^bc NOMATCH +BH (^a (^a (0,3) +# With BRE syntax, `$' has a special meaning only at the end of the +# RE or the end of a parenthesized subexpression. +BH ab$c\{0,1\} ab NOMATCH +BH SAME ab$ (0,3) +BH SAME abc NOMATCH +BH SAME ab$c (0,4) +BH \(ab$\)c\{0,1\} ab (0,2)(0,2) +BH SAME ab$ NOMATCH +BH SAME abc NOMATCH +BH SAME ab$c NOMATCH +BH a$) a$) (0,3) +# Miscellaneous tests for `^' and `$' +BH foo^$ foo NOMATCH +# For BRE, $ and ^ not magic +#En$ x$\n^y foo\nybarx\nyes\n (8,11) +BH ^$ x NOMATCH +BH SAME NULL (0,0) +BH$ SAME \n NOMATCH +BHn ^$ x NOMATCH +BHn SAME NULL (0,0) +BHn$ SAME \n (0,0) +# REG_NEWLINE causes `.' not to match newlines +BH$ .* ab\ncd (0,5) +BHn$ .* ab\ncd (0,2) +# Tests for nonstandard syntax extensions (Enhanced mode off) +# +# Zero width assertions +BH \ axx xaa (2,3) +BH SAME aax (2,3) +BH \bx axx xaa (4,5) +BH SAME aax NOMATCH +BH SAME xax (0,1) +BH x\b axx xaa (2,3) +BH SAME aax (2,3) +BH SAME xaa NOMATCH +BH \Bx aax xxa (2,3) +BH \Bx\b aax xxx (2,3) +BH \<. ;xaa (1,2) +# Shorthands for character classes +BH \w\{1,\} ,.(a23_Nt-öo) (3,9) +BH \d\{1,\} uR120_4=v4 (2,5) +BH \D\{1,\} 120d_=vA4s (3,8) +BH \w\+ ,.(a23_Nt-öo) (3,9) +BH \d\+ uR120_4=v4 (2,5) +BH \D\+ 120d_=vA4s (3,8) +# Quoted special characters +B$H \\t \t (0,1) +B$H \\e \033 (0,1) +# Test the \x1B and \x{263a} extensions for specifying 8 bit and wide +# characters in hexadecimal. +BH \x41 ABC (0,1) +B$H \\x5 \005 (0,1) +B$H \\x5r \005r (0,2) +# test_comp("\\x",REG_EXTENDED,0) +# test_nexec("\000",1,0,REG_OK,0,1) +# test_comp("\\xr",REG_EXTENDED,0) +# test_nexec("\000r",2,0,REG_OK,0,2) +BH \x{41} ABC (0,1) +B$H \\x{5} \005 (0,1) +B$H \\x{5}r \005r (0,2) +# test_comp("\\x{}",REG_EXTENDED,0) +# test_nexec("\000",1,0,REG_OK,0,1) +# test_comp("\\x{}r",REG_EXTENDED,0) +# test_nexec("\000r",2,0,REG_OK,0,2) +# Tests for (?inrU-inrU) and (?inrU-inrU:) (Enhanced mode off) +#E foo(?i)bar fooBaR BADRPT +#E foo(?i)bar|zap fooBaR BADRPT +#E SAME foozap BADRPT +#E SAME foozAp BADRPT +#E SAME bar BADRPT +#E SAME zap BADRPT +#Ei foo(?-i:zap)zot FoOzapZOt BADRPT +#Ei SAME FoOzApZOt BADRPT +#E foo(?i:bar|zap) foozap BADRPT +#E SAME foobar BADRPT +#E SAME foobAr BADRPT +#E SAME fooZaP BADRPT +#E foo(?U:o*)(o*) foooo BADRPT +# Test comment syntax (Enhanced mode off) +#E foo(?# This here is a comment. )bar foobar BADRPT +# Tests for \Q and \E (Enhanced mode off) +#E \((\Q)?:\<[^$\E) ()?:\<[^$ EBRACK +#E \Qabc\E.* abcdef NOMATCH +#E SAME QabcEdef (0,8) +#E \Qabc\E.*|foo parabc123wxyz NOMATCH +#E SAME fooabc123wxyz (0,3) +#E SAME QabcEdef (0,8) +# Test bounded repetitions +BH a\{0,0\} aaa (0,0) +BH a\{0,1\} aaa (0,1) +BH a\{1,1\} aaa (0,1) +BH a\{1,3\} xaaaaa (1,4) +BH a\{0,3\} aaaaa (0,3) +BH a\{0,\} NULL (0,0) +BH SAME a (0,1) +BH SAME aa (0,2) +BH SAME aaa (0,3) +BH a\{1,\} NULL NOMATCH +BH SAME a (0,1) +BH SAME aa (0,2) +BH SAME aaa (0,3) +BH a\{2,\} NULL NOMATCH +BH SAME a NOMATCH +BH SAME aa (0,2) +BH SAME aaa (0,3) +BH a\{3,\} NULL NOMATCH +BH SAME a NOMATCH +BH SAME aa NOMATCH +BH SAME aaa (0,3) +BH SAME aaaa (0,4) +BH SAME aaaaa (0,5) +BH SAME aaaaaa (0,6) +BH SAME aaaaaaa (0,7) +BH a\{5,10\} aaaaaaa (0,7) +BH a\{6,6\} aaaaaaaaaaaa (0,6) +BH SAME xxaaaaaaaaaaaa (2,8) +BH SAME xxaaaaa NOMATCH +BH a\{5,6\} aaaaaaaaaaaa (0,6) +BH SAME xxaaaaaaaaaaaa (2,8) +BH SAME xxaaaaa (2,7) +BH SAME xxaaaa NOMATCH +# Trickier ones... +BH \([ab]\{5,10\}\)*b bbbbbabaaaaab (0,13)(7,12) +BH SAME bbbbbbaaaaab (0,12)(6,11) +BH SAME bbbbbbaaaab (0,11)(0,10) +BH SAME bbbbbbaaab (0,10)(0,9) +BH SAME bbbbbbaab (0,9)(0,8) +BH SAME bbbbbbab (0,8)(0,7) +BH \([ab]*\)\(ab[ab]\{5,10\}\)ba abbabbbabaabbbbbbbbbbbbbabaaaabab (0,10)(0,0)(0,8) +BH SAME abbabbbabaabbbbbbbbbbbbabaaaaabab (0,32)(0,23)(23,30) +BH SAME abbabbbabaabbbbbbbbbbbbabaaaabab (0,24)(0,10)(10,22) +BH SAME abbabbbabaabbbbbbbbbbbba (0,24)(0,10)(10,22) +# Test repeating something that has submatches inside +BH \(a\)\{0,5\} NULL (0,0)(?,?) +BH SAME a (0,1)(0,1) +BH SAME aa (0,2)(1,2) +BH SAME aaa (0,3)(2,3) +BH SAME aaaa (0,4)(3,4) +BH SAME aaaaa (0,5)(4,5) +BH SAME aaaaaa (0,5)(4,5) +BH \(a\)\{2,3\} NULL NOMATCH +BH SAME a NOMATCH +BH SAME aa (0,2)(1,2) +BH SAME aaa (0,3)(2,3) +BH SAME aaaa (0,3)(2,3) +BH \(a\)\{4\} aaaa (0,4)(3,4) +BH \(a*\)\{2\} a (0,1)(1,1) +BH \(\(..\)\|\(.\)\)\{2\} aa (0,2)(1,2)(?,?)(1,2) +# Nested repeats +#E (.){2}{3} xxxxx NOMATCH +#E SAME xxxxxx (0,6)(5,6) +#E (..){2}{3} xxxxxxxxxxx NOMATCH +#E SAME xxxxxxxxxxxx (0,12)(10,12) +BH \(\(..\)\{2\}.\)\{3\} xxxxxxxxxxxxxx NOMATCH +BH SAME xxxxxxxxxxxxxxx (0,15)(10,15)(12,14) +BH \(\(..\)\{1,2\}.\)\{3\} xxxxxxxx NOMATCH +BH SAME xxxxxxxxx (0,9)(6,9)(6,8) +BH SAME xxxxxxxxxx (0,9)(6,9)(6,8) +BH SAME xxxxxxxxxxx (0,11)(8,11)(8,10) +#E a{2}{2}x NULL NOMATCH +#E SAME x NOMATCH +#E SAME ax NOMATCH +#E SAME aax NOMATCH +#E SAME aaax NOMATCH +#E SAME aaaax (0,5) +#E SAME aaaaax (1,6) +#E SAME aaaaaax (2,7) +#E SAME aaaaaaax (3,8) +#E SAME aaaaaaaax (4,9) +# Repeats with iterations inside +BH$ \\([a-z]\\+\\)\\{2,5\\} a\n NOMATCH +BH$ SAME aa\n (0,2)(1,2) +# Multiple repeats in one regexp +BH a\{3\}b\{3\} aaabbb (0,6) +BH SAME aaabbbb (0,6) +BH SAME aaaabbb (1,7) +BH SAME aabbb NOMATCH +BH SAME aaabb NOMATCH +# Test that different types of repetitions work correctly when used +# in the same regexp. +#E a{2}{2}xb+xc*xd?x aaaaxbxcxdx (0,11) +#E SAME aaaxbxcxdx NOMATCH +#E SAME aabxcxdx NOMATCH +#E SAME aaaacxdx NOMATCH +#E SAME aaaaxbdx NOMATCH +BH ^!packet [0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\} [0-9]\+ !packet 10.0.2.4 12765 ei voittoa (0,22) +# Back referencing tests +BH \([a-z]*\) \1 foobar foobar (0,13)(0,6) +# Searching for a leftmost longest square (repeated string) +BH \(.*\)\1 foobarfoobar (0,12)(0,6) +BH a\(b\)*c\1 acb NOMATCH +BH SAME abbcbbb (0,5)(2,3) +BH SAME abbdbd NOMATCH +BH \([a-c]*\)\1 abcacdef (0,0)(0,0) +BH SAME abcabcabcd (0,6)(0,3) +BH \(a*\)*\(x\)\(\1\) x (0,1)(0,0)(0,1)(1,1) +BH SAME ax (0,2)(1,1)(1,2)(2,2) +BH \(a\)\1\{1,2\} aabc (0,2)(0,1) +BH \(\)\(\1\1\)* NULL (0,0)(0,0)(0,0) +# Check that back references work with REG_NOSUB +BHw \(o\)\1 foobar NULL +BH \(o\)\1 foobar (1,3)(1,2) +BH SAME fobar NOMATCH +BH \1foo NULL ESUBREG +BH \1foo\(bar\) x ESUBREG +# Back reference with zero-width assertion +BH \(.\)\1$ foox NOMATCH +BH SAME foo (1,3)(1,2) +# Back references together with {} +BH \([0-9]\{5\}\)\1 12345 NOMATCH +BH SAME 1234512345 (0,10)(0,5) +BH \([0-9]\{4\}\)\1 1234 NOMATCH +BH SAME 12341234 (0,8)(0,4) +# Test lack of minimal repetitions (non-greedy repetitions) +# +# Basic +BH .*\? ab?d (0,3) +BH .\+\? ab?d (0,3) +BH .\?\? a?cd (0,2) +BH .\{2,5\}\? ab?d (0,3) +# More complicated +#E (.*?) text1text2 BADRPT +#E a(.*?)(foo|bar|zap) hubba wooga-booga zabar gafoo wazap BADRPT +##### Extras +# ^ magic after \| +BH \(a\|^b\) bas (0,1)(0,1) +# Lack of minimal repetition +BH a*? a? (0,2) diff --git a/tests/regex/datafiles/tre-tests-extended-enhanced.dat b/tests/regex/datafiles/tre-tests-extended-enhanced.dat new file mode 100644 index 0000000..a90d0f2 --- /dev/null +++ b/tests/regex/datafiles/tre-tests-extended-enhanced.dat @@ -0,0 +1,119 @@ +# Large number of macros in one regexp. +E$H [A-Z]\\d\\s?\\d[A-Z]{2}|[A-Z]\\d{2}\\s?\\d[A-Z]{2}|[A-Z]{2}\\d\\s?\\d[A-Z]{2}|[A-Z]{2}\\d{2}\\s?\\d[A-Z]{2}|[A-Z]\\d[A-Z]\\s?\\d[A-Z]{2}|[A-Z]{2}\\d[A-Z]\\s?\\d[A-Z]{2}|[A-Z]{3}\\s?\\d[A-Z]{2} A12BC (0,5) +E$H SAME A1 2BC (0,6) +E$H SAME A123BC (0,6) +E$H SAME AB1 2BC (0,7) +E$H SAME AB12 3CD (0,8) +E$H SAME A1B 2CD (0,7) +E$H SAME AB1C 2DE (0,8) +E$H SAME ABC 1DE (0,7) +# Test leftmost and longest matching and some tricky submatches +#E (?l)(wee|week)(night|knights)s* weeknights (0,10)(0,3)(3,10) +#E SAME weeknightss (0,11)(0,3)(3,10) +# Tests for nonstandard syntax extensions. +# +# Zero width assertions +EH \ axx xaa (2,3) +EH SAME aax (2,3) +EH \bx axx xaa (4,5) +EH SAME aax NOMATCH +EH SAME xax (0,1) +EH x\b axx xaa (2,3) +EH SAME aax (2,3) +EH SAME xaa NOMATCH +EH \Bx aax xxa (2,3) +EH \Bx\b aax xxx (2,3) +EH \<. ;xaa (1,2) +# Shorthands for character classes +EH \w{1,} ,.(a23_Nt-öo) (3,9) +EH \d{1,} uR120_4=v4 (2,5) +EH \D{1,} 120d_=vA4s (3,8) +EH \w+ ,.(a23_Nt-öo) (3,9) +EH \d+ uR120_4=v4 (2,5) +EH \D+ 120d_=vA4s (3,8) +# Quoted special characters +E$H \\t \t (0,1) +E$H \\e \033 (0,1) +# Test the \x1B and \x{263a} extensions for specifying 8 bit and wide +# characters in hexadecimal. +EH \x41 ABC (0,1) +E$H \\x5 \005 (0,1) +E$H \\x5r \005r (0,2) +# test_comp("\\x",REG_EXTENDED,0) +# test_nexec("\000",1,0,REG_OK,0,1) +# test_comp("\\xr",REG_EXTENDED,0) +# test_nexec("\000r",2,0,REG_OK,0,2) +EH \x{41} ABC (0,1) +E$H \\x{5} \005 (0,1) +E$H \\x{5}r \005r (0,2) +# test_comp("\\x{}",REG_EXTENDED,0) +# test_nexec("\000",1,0,REG_OK,0,1) +# test_comp("\\x{}r",REG_EXTENDED,0) +# test_nexec("\000r",2,0,REG_OK,0,2) +# Tests for (?inrU-inrU) and (?inrU-inrU:) +EH foo(?i)bar fooBaR (0,6) +EH foo(?i)bar|zap fooBaR (0,6) +EH SAME foozap (3,6) +EH SAME foozAp (3,6) +EH SAME bar NOMATCH +EH SAME zap (0,3) +EiH foo(?-i:zap)zot FoOzapZOt (0,9) +EiH SAME FoOzApZOt NOMATCH +EH foo(?i:bar|zap) foozap (0,6) +EH SAME foobar (0,6) +EH SAME foobAr (0,6) +EH SAME fooZaP (0,6) +EH foo(?U:o*)(o*) foooo (0,5)(3,5) +# Test comment syntax +EH foo(?# This here is a comment. )bar foobar (0,6) +# Tests for \Q and \E +EH \((\Q)?:\<[^$\E) ()?:\<[^$ (0,9)(1,9) +EH \Qabc\E.* abcdef (0,6) +EH \Qabc\E.*|foo parabc123wxyz (3,13) +EH SAME fooabc123wxyz (0,3) +# Back referencing tests +EH ([a-z]*) \1 foobar foobar (0,13)(0,6) +# Searching for a leftmost longest square (repeated string) +EH (.*)\1 foobarfoobar (0,12)(0,6) +EH a(b)*c\1 acb NOMATCH +EH SAME abbcbbb (0,5)(2,3) +EH SAME abbdbd NOMATCH +EH ([a-c]*)\1 abcacdef (0,0)(0,0) +EH SAME abcabcabcd (0,6)(0,3) +EH (a*)*(x)(\1) x (0,1)(0,0)(0,1)(1,1) +EH SAME ax (0,2)(1,1)(1,2)(2,2) +EH (a)\1{1,2} aabc (0,2)(0,1) +EH ((.*)\1)+ aa ESUBREG +EH ()(\1\1)* NULL (0,0)(0,0)(0,0) +# Check that back references work with REG_NOSUB +EHw (o)\1 foobar NULL +EH (o)\1 foobar (1,3)(1,2) +EH SAME fobar NOMATCH +EH \1foo NULL ESUBREG +EH \1foo(bar) x ESUBREG +# Back reference with zero-width assertion +EH (.)\1$ foox NOMATCH +EH SAME foo (1,3)(1,2) +# Back references together with {} +EH ([0-9]{5})\1 12345 NOMATCH +EH SAME 1234512345 (0,10)(0,5) +EH ([0-9]{4})\1 1234 NOMATCH +EH SAME 12341234 (0,8)(0,4) +# Test minimal repetitions (non-greedy repetitions) +# +# Basic +EH .*? abcd (0,0) +EH .+? abcd (0,1) +EH .?? abcd (0,0) +EH .{2,5}? abcd (0,2) +# More complicated +EH (.*?) text1text2 (0,12)(3,8) +EH a(.*?)(foo|bar|zap) hubba wooga-booga zabar gafoo wazap (4,23)(5,20)(20,23) +# Test REG_UNGREEDY +EHm .* abcd (0,0) +EHm .*? abcd (0,4) +##### Extras +# ^ magic after | +EH (a|^b) bas (0,1)(0,1) diff --git a/tests/regex/datafiles/tre-tests.dat b/tests/regex/datafiles/tre-tests.dat new file mode 100644 index 0000000..736b8c6 --- /dev/null +++ b/tests/regex/datafiles/tre-tests.dat @@ -0,0 +1,577 @@ +# Large number of macros in one regexp (Enhanced mode off) +E$ [A-Z]\\d\\s?\\d[A-Z]{2}|[A-Z]\\d{2}\\s?\\d[A-Z]{2}|[A-Z]{2}\\d\\s?\\d[A-Z]{2}|[A-Z]{2}\\d{2}\\s?\\d[A-Z]{2}|[A-Z]\\d[A-Z]\\s?\\d[A-Z]{2}|[A-Z]{2}\\d[A-Z]\\s?\\d[A-Z]{2}|[A-Z]{3}\\s?\\d[A-Z]{2} AdsdBC (0,6) +E a{11}(b{2}c){2} aaaaaaaaaaabbcbbc (0,17)(14,17) +E$ ^!packet [0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3} [0-9]+ !packet 127.0.0.1 999 (0,21) +E$ ^!pfast [0-9]{1,15} ([0-9]{1,3}\\.){3}[0-9]{1,3}\\.[0-9]{1,5}$ !pfast 1234567890 127.0.0.1.1234 (0,32)(24,26) +# Should these match or not? +B \(a\)*-\1b aaa-b NOMATCH +B \(\(.*\)\1\)\{1,\} xxxxxx ESUBREG +# Basic string matching +E foobar foobar (0,6) +E SAME xxxfoobarzapzot (3,9) +E aaaa xxaaaaaaaaaaaaaaaaa (2,6) +# Test zero length matches +E (a*) NULL (0,0)(0,0) +E (a*)* NULL (0,0)(0,0) +E ((a*)*)* NULL (0,0)(0,0)(0,0) +E (a*bcd)* aaaaaaaaaaaabcxbcxbcxaabcxaabcx (0,0)(?,?) +E SAME aaaaaaaaaaaabcxbcxbcxaabcxaabc (0,0)(?,?) +E SAME aaaaaaaaaaaabcxbcdbcxaabcxaabc (0,0)(?,?) +E SAME aaaaaaaaaaaabcdbcdbcxaabcxaabc (0,18)(15,18) +E (a*)+ - (0,0)(0,0) +#E NULL NULL (0,0) +#E SAME foo (0,0) +# Test for submatch addressing which requires arbitrary lookahead +E (a*)aaaaaa aaaaaaaaaaaaaaax (0,15)(0,9) +# Test leftmost and longest matching and some tricky submatches +E (a*)(a*) aaaa (0,4)(0,4)(4,4) +E (abcd|abc)(d?) abcd (0,4)(0,4)(4,4) +E (abc|abcd)(d?) abcd (0,4)(0,4)(4,4) +E (abc|abcd)(d?)e abcde (0,5)(0,4)(4,4) +E (abcd|abc)(d?)e abcde (0,5)(0,4)(4,4) +E a(bc|bcd)(d?) abcd (0,4)(1,4)(4,4) +E a(bcd|bc)(d?) abcd (0,4)(1,4)(4,4) +E a*(a?bc|bcd)(d?) aaabcd (0,6)(3,6)(6,6) +E a*(bcd|a?bc)(d?) aaabcd (0,6)(3,6)(6,6) +E (a|(a*b*))* NULL (0,0)(0,0)(0,0) +E SAME a (0,1)(0,1)(?,?) +E SAME aa (0,2)(0,2)(0,2) +E SAME aaa (0,3)(0,3)(0,3) +E SAME bbb (0,3)(0,3)(0,3) +E SAME aaabbb (0,6)(0,6)(0,6) +E SAME bbbaaa (0,6)(3,6)(3,6) +E ((a*b*)|a)* NULL (0,0)(0,0)(0,0) +E SAME a (0,1)(0,1)(0,1) +E SAME aa (0,2)(0,2)(0,2) +E SAME aaa (0,3)(0,3)(0,3) +E SAME bbb (0,3)(0,3)(0,3) +E SAME aaabbb (0,6)(0,6)(0,6) +E SAME bbbaaa (0,6)(3,6)(3,6) +E a.*(.*b.*(.*c.*).*d.*).*e.*(.*f.*).*g aabbccddeeffgg (0,14)(3,9)(5,7)(11,13) +E (wee|week)(night|knights)s* weeknights (0,10)(0,4)(4,9) +E SAME weeknightss (0,11)(0,4)(4,9) +E a* aaaaaaaaaa (0,10) +E aa* aaaaaaaaaa (0,10) +E aaa* aaaaaaaaaa (0,10) +E aaaa* aaaaaaaaaa (0,10) +# Test clearing old submatch data with nesting parentheses and iteration +E ((a)|(b))*c aaabc (0,5)(3,4)(?,?)(3,4) +E SAME aaaac (0,5)(3,4)(3,4)(?,?) +E foo((bar)*)*zot foozot (0,6)(3,3)(?,?) +E SAME foobarzot (0,9)(3,6)(3,6) +E SAME foobarbarzot (0,12)(3,9)(6,9) +E foo((zup)*|(bar)*|(zap)*)*zot foobarzapzot (0,12)(6,9)(?,?)(?,?)(6,9) +E SAME foobarbarzapzot (0,15)(9,12)(?,?)(?,?)(9,12) +E SAME foozupzot (0,9)(3,6)(3,6)(?,?)(?,?) +E SAME foobarzot (0,9)(3,6)(?,?)(3,6)(?,?) +E SAME foozapzot (0,9)(3,6)(?,?)(?,?)(3,6) +E SAME foozot (0,6)(3,3)(?,?)(?,?)(?,?) +# Test case where, e.g., Perl and Python regexp functions, and many +# other backtracking matchers, fail to produce the longest match. +# It is not exactly a bug since Perl does not claim to find the +# longest match, but a confusing feature and, in my opinion, a bad +# design choice because the union operator is traditionally defined +# to be commutative (with respect to the language denoted by the RE). */ +E (a|ab)(blip)? ablip (0,5)(0,1)(1,5) +E SAME ab (0,2)(0,2)(?,?) +E (ab|a)(blip)? ablip (0,5)(0,1)(1,5) +E SAME ab (0,2)(0,2)(?,?) +E ((a|b)*)a(a|b)* aaaaabaaaba (0,11)(0,10)(9,10)(?,?) +E SAME aaaaabaaab (0,10)(0,8)(7,8)(9,10) +E SAME caa (1,3)(1,2)(1,2)(?,?) +E ((a|aba)*)(ababbaba)((a|b)*) aabaababbabaaababbab (0,20)(0,4)(1,4)(4,12)(12,20)(19,20) +E SAME aaaaababbaba (0,12)(0,4)(3,4)(4,12)(12,12)(?,?) +E ((a|aba|abb|bba|bab)*)(ababbababbabbbabbbbbbabbaba)((a|b)*) aabaabbbbabababaababbababbabbbabbbbbbabbabababbababababbabababa (0,63)(0,16)(13,16)(16,43)(43,63)(62,63) +# Test for empty subexpressions +#E (a|) a (0,1)(0,1) +#E SAME b (0,0)(0,0) +#E SAME NULL (0,0)(0,0) +#E (|a) a (0,1)(0,1) +#E SAME b (0,0)(0,0) +#E SAME NULL (0,0)(0,0) +#E a| a (0,1) +#E SAME b (0,0) +#E SAME NULL (0,0) +#E |a a (0,1) +#E SAME b (0,0) +#E SAME NULL (0,0) +# Miscellaneous tests +E (a*)b(c*) abc (0,3)(0,1)(2,3) +E SAME ***abc*** (3,6)(3,4)(5,6) +E (a) a (0,1)(0,1) +E ((a)) a (0,1)(0,1)(0,1) +E ((((((((((((((((((((a)))))))))))))))))))) a (0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1)(0,1) +E ksntoeaiksntoeaikstneoaiksnteoaiksntoeaiskntoeaiskntoekainstoeiaskntoeakisntoeksaitnokesantiksoentaikosentaiksoentaiksnoeaisknteoaksintoekasitnoeksaitkosetniaksoetnaisknoetakistoeksintokesanitksoentaisknoetaisknoetiaksotneaikstoekasitoeskatioksentaiksoenatiksoetnaiksonateiksoteaeskanotisknetaiskntoeasknitoskenatiskonetaisknoteai x NOMATCH +E ((aab)|(aac)|(aa*))c aabc (0,4)(0,3)(0,3)(?,?)(?,?) +E SAME aacc (0,4)(0,3)(?,?)(0,3)(?,?) +E SAME aaac (0,4)(0,3)(?,?)(?,?)(0,3) +E ^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$ foo!bar!bas (0,11)(0,11)(?,?)(?,?)(4,8)(8,11) +E ^([^!]+!)?([^!]+)$|^.+!([^!]+!)([^!]+)$ foo!bar!bas (0,11)(?,?)(?,?)(4,8)(8,11) +E ^(([^!]+!)?([^!]+)|.+!([^!]+!)([^!]+))$ foo!bar!bas (0,11)(0,11)(?,?)(?,?)(4,8)(8,11) +E M[ou]'?am+[ae]r .*([AEae]l[- ])?[GKQ]h?[aeu]+([dtz][dhz]?)+af[iy] Muammar Quathafi (0,16)(?,?)(11,13) +Ei (Ab|cD)* aBcD (0,4)(2,4) +E a** NULL BADRPT +E a*+ NULL BADRPT +E a+* NULL BADRPT +E a++ NULL BADRPT +E a?+ NULL BADRPT +E a?* NULL BADRPT +E a{1,2}* NULL BADRPT +E a{1,2}+ NULL BADRPT +# Many of the following tests were mostly inspired by (or copied from) the +# libhackerlab posix test suite by Tom Lord +B a a (0,1) +B \. . (0,1) +B \[ [ (0,1) +B \\ \ (0,1) +B \* * (0,1) +B \^ ^ (0,1) +B \$ $ (0,1) +B \ NULL EESCAPE +B x\. x. (0,2) +B x\[ x[ (0,2) +B x\\ x\ (0,2) +B x\* x* (0,2) +B x\^ x^ (0,2) +B x\$ x$ (0,2) +B x\ NULL EESCAPE +B . a (0,1) +B$ SAME \n (0,1) +B (+|?) (+|?) (0,5) +B SAME +|? NOMATCH +B SAME (+) NOMATCH +B SAME + NOMATCH +# Test bracket expressions +B [ NULL EBRACK +B [] NULL EBRACK +B [^] NULL EBRACK +B []x] ] (0,1) +B []x] x (0,1) +B [.] . (0,1) +B SAME a NOMATCH +B [*] * (0,1) +B [[] [ (0,1) +B [\] \ (0,1) +B [-x] - (0,1) +B SAME x (0,1) +B [x-] - (0,1) +B SAME x (0,1) +B [-] - (0,1) +B [abc] a (0,1) +B SAME b (0,1) +B SAME c (0,1) +B SAME d NOMATCH +B SAME xa (1,2) +B SAME xb (1,2) +B SAME xc (1,2) +B SAME xd NOMATCH +B x[abc] xa (0,2) +B SAME xb (0,2) +B SAME xc (0,2) +B SAME xd NOMATCH +B [^abc] a NOMATCH +B SAME b NOMATCH +B SAME c NOMATCH +B SAME d (0,1) +B SAME xa (0,1) +B SAME xb (0,1) +B SAME xc (0,1) +B SAME xd (0,1) +B x[^abc] xa NOMATCH +B x[^abc] xb NOMATCH +B x[^abc] xc NOMATCH +B x[^abc] xd (0,2) +E [()+?*\]+ x\*?+()x (1,7) +# Standard character classes +E [[:alnum:]]+ %abc123890XYZ= (1,13) +E$ [[:cntrl:]]+ %\n\t\015\f (1,5) +E [[:lower:]]+ AbcdE (1,4) +Ei [[:lower:]]+ AbcdE (0,5) +E$ [[:space:]]+ x \t\f\nx (1,5) +E [[:alpha:]]+ %abC123890xyz= (1,4) +E [[:digit:]]+ %abC123890xyz= (4,10) +E [^[:digit:]]+ %abC123890xyz= (0,4) +E$ [[:print:]]+ \n %abC12\f (1,8) +E$ [[:upper:]]+ \n aBCDEFGHIJKLMNOPQRSTUVWXYz (3,27) +Ei$ [[:upper:]]+ \n aBCDEFGHIJKLMNOPQRSTUVWXYz (2,28) +E$ [[:blank:]]+ \na \t b (2,5) +E$ [[:graph:]]+ \n %abC12\f (2,8) +E [[:punct:]]+ a~!@#$%^&*()_+=-`[]{};':"|\,./?>< (1,33) +E [[:xdigit:]]+ -0123456789ABCDEFabcdef (1,23) +E [[:bogus-character-class-name:] NULL ECTYPE +# Range expressions (assuming that the C locale is being used) +E [a-z]+ ABCabcxyzABC (3,9) +E [z-a]+ NULL ERANGE +B [a-b-c] NULL ERANGE +E [a-a]+ zaaaaab (1,6) +E [--Z]+ !ABC-./XYZ~ (1,10) +B [*--] - (0,1) +B SAME * (0,1) +E [*--Z]+ !+*,---ABC (1,7) +E [a-]+ xa-a--a-ay (1,9) +# REG_ICASE and character sets +Ei [a-c]* cABbage (0,5) +Ei [^a-c]* tObAcCo (0,2) +Ei [A-C]* cABbage (0,5) +Ei [^A-C]* tObAcCo (0,2) +# Complex character sets +E [[:digit:]a-z#$%]+ __abc#lmn012$x%yz789* (2,20) +Ei [[:digit:]a-z#$%]+ __abcLMN012x%#$yz789* (2,20) +E [^[:digit:]a-z#$%]+ abc#lmn012$x%yz789--@*,abc (18,23) +Ei [^[:digit:]a-z#$%]+ abc#lmn012$x%yz789--@*,abc (18,23) +Ei [^[:digit:]#$%[:xdigit:]]+ abc#lmn012$x%yz789--@*,abc (4,7) +E [^-]+ ---afd*(&,ml--- (3,12) +E [^--Z]+ ---AFD*(&,ml--- (6,12) +Ei [^--Z]+ ---AFD*(&,ml--- (6,10) +# Miscellaneous tests +B abc\(\(de\)\(fg\)\)hi xabcdefghiy (1,10)(4,8)(4,6)(6,8) +B abc*def xabdefy (1,6) +B SAME xabcdefy (1,7) +B SAME xabcccccccdefy (1,13) +B abc\(def\)*ghi xabcghiy (1,7)(?,?) +B SAME xabcdefghi (1,10)(4,7) +B SAME xabcdefdefdefghi (1,16)(10,13) +E a? aaaaa (0,1) +E SAME xaaaaa (0,0) +E a+ aaaaa (0,5) +E SAME xaaaaa (1,6) +# Test anchors and their behaviour with the REG_NEWLINE compilation +# flag and the REG_NOTBOL, REG_NOTEOL execution flags. +# +# Normally, `^' matches the empty string at beginning of input. +# If REG_NOTBOL is used, `^' won't match the zero length string. +B ^abc abcdef (0,3) +Bb SAME abcdef NOMATCH +B SAME xyzabcdef NOMATCH +Bb SAME xyzabcdef NOMATCH +B$ SAME \nabcdef NOMATCH +Bb$ SAME \nabcdef NOMATCH +# Normally, `$' matches the empty string at end of input. +# If REG_NOTEOL is used, `$' won't match the zero length string. +B abc$ defabc (3,6) +Be SAME defabc NOMATCH +B SAME defabcxyz NOMATCH +Be SAME defabcxyz NOMATCH +B$ SAME defabc\n NOMATCH +Be$ SAME defabc\n NOMATCH +B ^abc$ abc (0,3) +Bb SAME abc NOMATCH +Be SAME abc NOMATCH +Bbe SAME abc NOMATCH +B$ SAME \nabc\n NOMATCH +B$ SAME defabc\n NOMATCH +B$ SAME \nabcdef NOMATCH +B SAME abcdef NOMATCH +B SAME defabc NOMATCH +B$ SAME abc\ndef NOMATCH +B$ SAME def\nabc NOMATCH +# If REG_NEWLINE is used, `^' matches the empty string immediately after +# a newline, regardless of whether execution flags contain REG_NOTBOL. +# Similarly, if REG_NEWLINE is used, `$' matches the empty string +# immediately before a newline, regardless of execution flags. +Bn ^abc abcdef (0,3) +Bbn SAME abcdef NOMATCH +Bn SAME xyzabcdef NOMATCH +Bbn SAME xyzabcdef NOMATCH +Bn$ SAME \nabcdef (1,4) +Bbn$ SAME \nabcdef (1,4) +Bn abc$ defabc (3,6) +Ben SAME defabc NOMATCH +Bn SAME defabcxyz NOMATCH +Ben SAME defabcxyz NOMATCH +Bn$ SAME defabc\n (3,6) +Ben$ SAME defabc\n (3,6) +Bn ^abc$ abc (0,3) +Bbn SAME abc NOMATCH +Ben SAME abc NOMATCH +Bben SAME abc NOMATCH +Bn$ SAME \nabc\n (1,4) +Bn$ SAME defabc\n NOMATCH +Bn$ SAME \nabcdef NOMATCH +Bn SAME abcdef NOMATCH +Bbn SAME abcdef NOMATCH +Bn SAME defabc NOMATCH +Ben SAME defabc NOMATCH +Bn$ SAME abc\ndef (0,3) +Bbn$ SAME abc\ndef NOMATCH +Ben$ SAME abc\ndef (0,3) +Bbn$ SAME abc\ndef NOMATCH +Bn$ SAME def\nabc (4,7) +Bbn$ SAME def\nabc (4,7) +Ben$ SAME def\nabc NOMATCH +Bben$ SAME def\nabc NOMATCH +# With BRE syntax, `^' has a special meaning only at the beginning of the +# RE or the beginning of a parenthesized subexpression. +B a\{0,1\}^bc bc NOMATCH +B SAME ^bc (0,3) +B SAME abc NOMATCH +B SAME a^bc (0,4) +B a\{0,1\}\(^bc\) bc (0,2)(0,2) +B SAME ^bc NOMATCH +B SAME abc NOMATCH +B SAME a^bc NOMATCH +B (^a (^a (0,3) +# With BRE syntax, `$' has a special meaning only at the end of the +# RE or the end of a parenthesized subexpression. +B ab$c\{0,1\} ab NOMATCH +B SAME ab$ (0,3) +B SAME abc NOMATCH +B SAME ab$c (0,4) +B \(ab$\)c\{0,1\} ab (0,2)(0,2) +B SAME ab$ NOMATCH +B SAME abc NOMATCH +B SAME ab$c NOMATCH +B a$) a$) (0,3) +# Miscellaneous tests for `^' and `$' +E foo^$ foo NOMATCH +En$ x$\n^y foo\nybarx\nyes\n (8,11) +B ^$ x NOMATCH +B SAME NULL (0,0) +B$ SAME \n NOMATCH +Bn ^$ x NOMATCH +Bn SAME NULL (0,0) +Bn$ SAME \n (0,0) +# REG_NEWLINE causes `.' not to match newlines +B$ .* ab\ncd (0,5) +Bn$ .* ab\ncd (0,2) +# Tests for nonstandard syntax extensions (Enhanced mode off) +# +# Zero width assertions (Enhanced mode off) +BE \ axx xaa NOMATCH +BE SAME x> (0,2) +BE \bx axx xaa NOMATCH +BE SAME bx (0,2) +BE x\b axx xaa NOMATCH +BE SAME xb (0,2) +BE \Bx aax xxa NOMATCH +BE SAME Bx (0,2) +BE \Bx\b aax xxx NOMATCH +BE \Bx\b Bxb (0,3) +BE \<. ;xaa NOMATCH +BE SAME (.*?) text1text2 BADRPT +E a(.*?)(foo|bar|zap) hubba wooga-booga zabar gafoo wazap BADRPT +##### Extras +# ^ magic after | +E (a|^b) bas (0,1)(0,1) +# Lack of +, ? and | +B a+ a+ (0,2) +B a\+ a+ (0,2) +B a? a? (0,2) +B a\? a? (0,2) +B a|b a|b (0,3) +B a\|b a|b (0,3) +# Lack of backref +E (a)\1 a1 (0,2)(0,1) +# Lack of minimal repetition +B a*? a? (0,2) +E a*? a? BADRPT +BE a*\? a? (0,2) diff --git a/tests/regex/datafiles/union-enhanced.dat b/tests/regex/datafiles/union-enhanced.dat new file mode 100644 index 0000000..0efca84 --- /dev/null +++ b/tests/regex/datafiles/union-enhanced.dat @@ -0,0 +1 @@ +EH (?:(a)|(b)|c|d)* ab (0,2)(?,?)(1,2) diff --git a/tests/regex/datafiles/union.dat b/tests/regex/datafiles/union.dat new file mode 100644 index 0000000..18cc0fa --- /dev/null +++ b/tests/regex/datafiles/union.dat @@ -0,0 +1,4 @@ +E ((b*)|c(c*))* cbb (0,3)(1,3)(1,3)(?,?) +E ((a)|x($))* ax (0,2)(1,2)(?,?)(2,2) +E ((a)|b|c|x(dd|(e)(e)|ff))* abxee (0,5)(2,5)(?,?)(3,5)(3,4)(4,5) +E a|b|c|ee|ff abee (0,1) diff --git a/tests/regex/testregex.c b/tests/regex/testregex.c new file mode 100644 index 0000000..9e73a0d --- /dev/null +++ b/tests/regex/testregex.c @@ -0,0 +1,2329 @@ +#pragma prototyped noticed + +/* + * regex(3) test harness + * + * build: cc -o testregex testregex.c + * help: testregex --man + * note: REG_* features are detected by #ifdef; if REG_* are enums + * then supply #define REG_foo REG_foo for each enum REG_foo + * + * Glenn Fowler + * AT&T Research + * + * PLEASE: publish your tests so everyone can benefit + * + * The following license covers testregex.c and all associated test data. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of THIS SOFTWARE FILE (the "Software"), to deal in the Software + * without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following disclaimer: + * + * THIS SOFTWARE IS PROVIDED BY AT&T ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL AT&T BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +static const char id[] = "\n@(#)$Id: testregex (AT&T Research) 2010-06-10 $\0\n"; + +#if _PACKAGE_ast +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __STDC__ +#include +#include +#endif + +#ifndef RE_DUP_MAX +#define RE_DUP_MAX 32767 +#endif + +#if !_PACKAGE_ast +#undef REG_DISCIPLINE +#endif + +#ifndef REG_DELIMITED +#undef _REG_subcomp +#endif + +#define TEST_ARE 0x00000001 +#define TEST_BRE 0x00000002 +#define TEST_ERE 0x00000004 +#define TEST_KRE 0x00000008 +#define TEST_LRE 0x00000010 +#define TEST_SRE 0x00000020 + +#define TEST_EXPAND 0x00000100 +#define TEST_LENIENT 0x00000200 + +#define TEST_QUERY 0x00000400 +#define TEST_SUB 0x00000800 +#define TEST_UNSPECIFIED 0x00001000 +#define TEST_VERIFY 0x00002000 +#define TEST_AND 0x00004000 +#define TEST_OR 0x00008000 + +#define TEST_DELIMIT 0x00010000 +#define TEST_OK 0x00020000 +#define TEST_SAME 0x00040000 + +#define TEST_ACTUAL 0x00100000 +#define TEST_BASELINE 0x00200000 +#define TEST_FAIL 0x00400000 +#define TEST_PASS 0x00800000 +#define TEST_SUMMARY 0x01000000 + +#define TEST_IGNORE_ERROR 0x02000000 +#define TEST_IGNORE_OVER 0x04000000 +#define TEST_IGNORE_POSITION 0x08000000 + +#define TEST_CATCH 0x10000000 +#define TEST_VERBOSE 0x20000000 + +#define TEST_DECOMP 0x40000000 + +#define TEST_GLOBAL (TEST_ACTUAL|TEST_AND|TEST_BASELINE|TEST_CATCH|TEST_FAIL|TEST_IGNORE_ERROR|TEST_IGNORE_OVER|TEST_IGNORE_POSITION|TEST_OR|TEST_PASS|TEST_SUMMARY|TEST_VERBOSE) + +#ifdef REG_DISCIPLINE + + +#include + +typedef struct Disc_s +{ + regdisc_t disc; + int ordinal; + Sfio_t* sp; +} Disc_t; + +static void* +compf(const regex_t* re, const char* xstr, size_t xlen, regdisc_t* disc) +{ + Disc_t* dp = (Disc_t*)disc; + + return (void*)((char*)0 + ++dp->ordinal); +} + +static int +execf(const regex_t* re, void* data, const char* xstr, size_t xlen, const char* sstr, size_t slen, char** snxt, regdisc_t* disc) +{ + Disc_t* dp = (Disc_t*)disc; + + sfprintf(dp->sp, "{%-.*s}(%lu:%d)", xlen, xstr, (char*)data - (char*)0, slen); + return atoi(xstr); +} + +static void* +resizef(void* handle, void* data, size_t size) +{ + if (!size) + return 0; + return stkalloc((Sfio_t*)handle, size); +} + +#endif + +#ifndef NiL +#ifdef __STDC__ +#define NiL 0 +#else +#define NiL (char*)0 +#endif +#endif + +#define H(x) do{if(html)fprintf(stderr,x);}while(0) +#define T(x) fprintf(stderr,x) + +static void +help(int html) +{ +H("\n"); +H("\n"); +H("\n"); +H("testregex man document\n"); +H("\n"); +H("\n"); +H("
\n");
+T("NAME\n");
+T("  testregex - regex(3) test harness\n");
+T("\n");
+T("SYNOPSIS\n");
+T("  testregex [ options ]\n");
+T("\n");
+T("DESCRIPTION\n");
+T("  testregex reads regex(3) test specifications, one per line, from the\n");
+T("  standard input and writes one output line for each failed test. A\n");
+T("  summary line is written after all tests are done. Each successful\n");
+T("  test is run again with REG_NOSUB. Unsupported features are noted\n");
+T("  before the first test, and tests requiring these features are\n");
+T("  silently ignored.\n");
+T("\n");
+T("OPTIONS\n");
+T("  -c	catch signals and non-terminating calls\n");
+T("  -e	ignore error return mismatches\n");
+T("  -h	list help on standard error\n");
+T("  -n	do not repeat successful tests with regnexec()\n");
+T("  -o	ignore match[] overrun errors\n");
+T("  -p	ignore negative position mismatches\n");
+T("  -s	use stack instead of malloc\n");
+T("  -x	do not repeat successful tests with REG_NOSUB\n");
+T("  -v	list each test line\n");
+T("  -A	list failed test lines with actual answers\n");
+T("  -B	list all test lines with actual answers\n");
+T("  -F	list failed test lines\n");
+T("  -P	list passed test lines\n");
+T("  -S	output one summary line\n");
+T("\n");
+T("INPUT FORMAT\n");
+T("  Input lines may be blank, a comment beginning with #, or a test\n");
+T("  specification. A specification is five fields separated by one\n");
+T("  or more tabs. NULL denotes the empty string and NIL denotes the\n");
+T("  0 pointer.\n");
+T("\n");
+T("  Field 1: the regex(3) flags to apply, one character per REG_feature\n");
+T("  flag. The test is skipped if REG_feature is not supported by the\n");
+T("  implementation. If the first character is not [BEASKLP] then the\n");
+T("  specification is a global control line. One or more of [BEASKLP] may be\n");
+T("  specified; the test will be repeated for each mode.\n");
+T("\n");
+T("    B 	basic			BRE	(grep, ed, sed)\n");
+T("    E 	REG_EXTENDED		ERE	(egrep)\n");
+T("    A	REG_AUGMENTED		ARE	(egrep with negation)\n");
+T("    S	REG_SHELL		SRE	(sh glob)\n");
+T("    K	REG_SHELL|REG_AUGMENTED	KRE	(ksh glob)\n");
+T("    L	REG_LITERAL		LRE	(fgrep)\n");
+T("\n");
+T("    a	REG_LEFT|REG_RIGHT	implicit ^...$\n");
+T("    b	REG_NOTBOL		lhs does not match ^\n");
+T("    c	REG_COMMENT		ignore space and #...\\n\n");
+T("    d	REG_SHELL_DOT		explicit leading . match\n");
+T("    e	REG_NOTEOL		rhs does not match $\n");
+T("    f	REG_MULTIPLE		multiple \\n separated patterns\n");
+T("    g	FNM_LEADING_DIR		testfnmatch only -- match until /\n");
+T("    H	REG_ENHANCED		tre enhancements (ignored otherwise)\n");
+T("    h	REG_MULTIREF		multiple digit backref\n");
+T("    i	REG_ICASE		ignore case\n");
+T("    j	REG_SPAN		. matches \\n\n");
+T("    k	REG_ESCAPE		\\ to ecape [...] delimiter\n");
+T("    l	REG_LEFT		implicit ^...\n");
+T("    m	REG_MINIMAL		minimal match\n");
+T("    n	REG_NEWLINE		explicit \\n match\n");
+T("    o	REG_ENCLOSED		(|&) magic inside [@|&](...)\n");
+T("    p	REG_SHELL_PATH		explicit / match\n");
+T("    q	REG_DELIMITED		delimited pattern\n");
+T("    r	REG_RIGHT		implicit ...$\n");
+T("    s	REG_SHELL_ESCAPED	\\ not special\n");
+T("    t	REG_MUSTDELIM		all delimiters must be specified\n");
+T("    u	standard unspecified behavior -- errors not counted\n");
+T("    v	REG_CLASS_ESCAPE	\\ special inside [...]\n");
+T("    w	REG_NOSUB		no subexpression match array\n");
+T("    x	REG_LENIENT		let some errors slide\n");
+T("    y	REG_LEFT		regexec() implicit ^...\n");
+T("    z	REG_NULL		NULL subexpressions ok\n");
+T("    $	                        expand C \\c escapes in fields 2 and 3\n");
+T("    /	                        field 2 is a regsubcomp() expression\n");
+T("    =	                        field 3 is a regdecomp() expression\n");
+T("\n");
+T("  Field 1 control lines:\n");
+T("\n");
+T("    C		set LC_COLLATE and LC_CTYPE to locale in field 2\n");
+T("\n");
+T("    ?test ...	output field 5 if passed and != EXPECTED, silent otherwise\n");
+T("    &test ...	output field 5 if current and previous passed\n");
+T("    |test ...	output field 5 if current passed and previous failed\n");
+T("    ; ...	output field 2 if previous failed\n");
+T("    {test ...	skip if failed until }\n");
+T("    }		end of skip\n");
+T("\n");
+T("    : comment		comment copied as output NOTE\n");
+T("    :comment:test	:comment: ignored\n");
+T("    N[OTE] comment	comment copied as output NOTE\n");
+T("    T[EST] comment	comment\n");
+T("\n");
+T("    number		use number for nmatch (20 by default)\n");
+T("\n");
+T("  Field 2: the regular expression pattern; SAME uses the pattern from\n");
+T("    the previous specification. RE_DUP_MAX inside {...} expands to the\n");
+T("    value from .\n");
+T("\n");
+T("  Field 3: the string to match. X...{RE_DUP_MAX} expands to RE_DUP_MAX\n");
+T("    copies of X.\n");
+T("\n");
+T("  Field 4: the test outcome. This is either one of the posix error\n");
+T("    codes (with REG_ omitted) or the match array, a list of (m,n)\n");
+T("    entries with m and n being first and last+1 positions in the\n");
+T("    field 3 string, or NULL if REG_NOSUB is in effect and success\n");
+T("    is expected. BADPAT is acceptable in place of any regcomp(3)\n");
+T("    error code. The match[] array is initialized to (-2,-2) before\n");
+T("    each test. All array elements from 0 to nmatch-1 must be specified\n");
+T("    in the outcome. Unspecified endpoints (offset -1) are denoted by ?.\n");
+T("    Unset endpoints (offset -2) are denoted by X. {x}(o:n) denotes a\n");
+T("    matched (?{...}) expression, where x is the text enclosed by {...},\n");
+T("    o is the expression ordinal counting from 1, and n is the length of\n");
+T("    the unmatched portion of the subject string. If x starts with a\n");
+T("    number then that is the return value of re_execf(), otherwise 0 is\n");
+T("    returned. RE_DUP_MAX[-+]N expands to the  value -+N.\n");
+T("\n");
+T("  Field 5: optional comment appended to the report.\n");
+T("\n");
+T("CAVEAT\n");
+T("    If a regex implementation misbehaves with memory then all bets are off.\n");
+T("\n");
+T("CONTRIBUTORS\n");
+T("  Glenn Fowler    gsf@research.att.com        (ksh strmatch, regex extensions)\n");
+T("  David Korn      dgk@research.att.com        (ksh glob matcher)\n");
+T("  Doug McIlroy    mcilroy@dartmouth.edu       (ast regex/testre in C++)\n");
+T("  Tom Lord        lord@regexps.com            (rx tests)\n");
+T("  Henry Spencer   henry@zoo.toronto.edu       (original public regex)\n");
+T("  Andrew Hume     andrew@research.att.com     (gre tests)\n");
+T("  John Maddock    John_Maddock@compuserve.com (regex++ tests)\n");
+T("  Philip Hazel    ph10@cam.ac.uk              (pcre tests)\n");
+T("  Ville Laurikari vl@iki.fi                   (libtre tests)\n");
+H("
\n"); +H("\n"); +H("\n"); +} + +#ifndef elementsof +#define elementsof(x) (sizeof(x)/sizeof(x[0])) +#endif + +#ifndef streq +#define streq(a,b) (*(a)==*(b)&&!strcmp(a,b)) +#endif + +#define HUNG 2 +#define NOTEST (~0) + +#ifndef REG_TEST_DEFAULT +#define REG_TEST_DEFAULT 0 +#endif + +#ifndef REG_EXEC_DEFAULT +#define REG_EXEC_DEFAULT 0 +#endif + +static const char* unsupported[] = +{ + "BASIC", +#ifndef REG_EXTENDED + "EXTENDED", +#endif +#ifndef REG_AUGMENTED + "AUGMENTED", +#endif +#ifndef REG_ENHANCED + "ENHANCED", +#endif +#ifndef REG_SHELL + "SHELL", +#endif + +#ifndef REG_CLASS_ESCAPE + "CLASS_ESCAPE", +#endif +#ifndef REG_COMMENT + "COMMENT", +#endif +#ifndef REG_DELIMITED + "DELIMITED", +#endif +#ifndef REG_DISCIPLINE + "DISCIPLINE", +#endif +#ifndef REG_ESCAPE + "ESCAPE", +#endif +#ifndef REG_ICASE + "ICASE", +#endif +#ifndef REG_LEFT + "LEFT", +#endif +#ifndef REG_LENIENT + "LENIENT", +#endif +#ifndef REG_LITERAL + "LITERAL", +#endif +#ifndef REG_MINIMAL + "MINIMAL", +#endif +#ifndef REG_MULTIPLE + "MULTIPLE", +#endif +#ifndef REG_MULTIREF + "MULTIREF", +#endif +#ifndef REG_MUSTDELIM + "MUSTDELIM", +#endif +#ifndef REG_NEWLINE + "NEWLINE", +#endif +#ifndef REG_NOTBOL + "NOTBOL", +#endif +#ifndef REG_NOTEOL + "NOTEOL", +#endif +#ifndef REG_NULL + "NULL", +#endif +#ifndef REG_RIGHT + "RIGHT", +#endif +#ifndef REG_SHELL_DOT + "SHELL_DOT", +#endif +#ifndef REG_SHELL_ESCAPED + "SHELL_ESCAPED", +#endif +#ifndef REG_SHELL_GROUP + "SHELL_GROUP", +#endif +#ifndef REG_SHELL_PATH + "SHELL_PATH", +#endif +#ifndef REG_SPAN + "SPAN", +#endif +#if REG_NOSUB & REG_TEST_DEFAULT + "SUBMATCH", +#endif +#if !_REG_nexec + "regnexec", +#endif +#if !_REG_subcomp + "regsubcomp", +#endif +#if !_REG_decomp + "redecomp", +#endif + 0 +}; + +#ifndef REG_CLASS_ESCAPE +#define REG_CLASS_ESCAPE NOTEST +#endif +#ifndef REG_COMMENT +#define REG_COMMENT NOTEST +#endif +#ifndef REG_DELIMITED +#define REG_DELIMITED NOTEST +#endif +#ifndef REG_ESCAPE +#define REG_ESCAPE NOTEST +#endif +#ifndef REG_ICASE +#define REG_ICASE NOTEST +#endif +#ifndef REG_LEFT +#define REG_LEFT NOTEST +#endif +#ifndef REG_LENIENT +#define REG_LENIENT 0 +#endif +#ifndef REG_MINIMAL +#define REG_MINIMAL NOTEST +#endif +#ifndef REG_MULTIPLE +#define REG_MULTIPLE NOTEST +#endif +#ifndef REG_MULTIREF +#define REG_MULTIREF NOTEST +#endif +#ifndef REG_MUSTDELIM +#define REG_MUSTDELIM NOTEST +#endif +#ifndef REG_NEWLINE +#define REG_NEWLINE NOTEST +#endif +#ifndef REG_NOTBOL +#define REG_NOTBOL NOTEST +#endif +#ifndef REG_NOTEOL +#define REG_NOTEOL NOTEST +#endif +#ifndef REG_NULL +#define REG_NULL NOTEST +#endif +#ifndef REG_RIGHT +#define REG_RIGHT NOTEST +#endif +#ifndef REG_SHELL_DOT +#define REG_SHELL_DOT NOTEST +#endif +#ifndef REG_SHELL_ESCAPED +#define REG_SHELL_ESCAPED NOTEST +#endif +#ifndef REG_SHELL_GROUP +#define REG_SHELL_GROUP NOTEST +#endif +#ifndef REG_SHELL_PATH +#define REG_SHELL_PATH NOTEST +#endif +#ifndef REG_SPAN +#define REG_SPAN NOTEST +#endif + +#define REG_UNKNOWN (-1) + +#ifndef REG_ENEWLINE +#define REG_ENEWLINE (REG_UNKNOWN-1) +#endif +#ifndef REG_EMPTY +#ifndef REG_ENULL +#define REG_ENULL (REG_UNKNOWN-2) +#endif +#endif +#ifndef REG_ECOUNT +#define REG_ECOUNT (REG_UNKNOWN-3) +#endif +#ifndef REG_BADESC +#define REG_BADESC (REG_UNKNOWN-4) +#endif +#ifndef REG_EMEM +#define REG_EMEM (REG_UNKNOWN-5) +#endif +#ifndef REG_EHUNG +#define REG_EHUNG (REG_UNKNOWN-6) +#endif +#ifndef REG_EBUS +#define REG_EBUS (REG_UNKNOWN-7) +#endif +#ifndef REG_EFAULT +#define REG_EFAULT (REG_UNKNOWN-8) +#endif +#ifndef REG_EFLAGS +#define REG_EFLAGS (REG_UNKNOWN-9) +#endif +#ifndef REG_EDELIM +#define REG_EDELIM (REG_UNKNOWN-9) +#endif + +static const struct { int code; char* name; } codes[] = +{ + REG_UNKNOWN, "UNKNOWN", + REG_NOMATCH, "NOMATCH", + REG_BADPAT, "BADPAT", + REG_ECOLLATE, "ECOLLATE", + REG_ECTYPE, "ECTYPE", + REG_EESCAPE, "EESCAPE", + REG_ESUBREG, "ESUBREG", + REG_EBRACK, "EBRACK", + REG_EPAREN, "EPAREN", + REG_EBRACE, "EBRACE", + REG_BADBR, "BADBR", + REG_ERANGE, "ERANGE", + REG_ESPACE, "ESPACE", + REG_BADRPT, "BADRPT", + REG_ENEWLINE, "ENEWLINE", +#ifdef REG_EMPTY + REG_EMPTY, "EMPTY", +#else + REG_ENULL, "ENULL", +#endif + REG_ECOUNT, "ECOUNT", + REG_BADESC, "BADESC", + REG_EMEM, "EMEM", + REG_EHUNG, "EHUNG", + REG_EBUS, "EBUS", + REG_EFAULT, "EFAULT", + REG_EFLAGS, "EFLAGS", + REG_EDELIM, "EDELIM", +}; + +static struct +{ + regmatch_t NOMATCH; + int errors; + int extracted; + int ignored; + int lineno; + int passed; + int signals; + int unspecified; + int verify; + int warnings; + char* file; + char* stack; + char* which; + jmp_buf gotcha; +#ifdef REG_DISCIPLINE + Disc_t disc; +#endif +} state; + +static void +quote(char* s, int len, unsigned long test) +{ + unsigned char* u = (unsigned char*)s; + unsigned char* e; + int c; +#ifdef MB_CUR_MAX + int w; +#endif + + if (!u) + printf("NIL"); + else if (!*u && len <= 1) + printf("NULL"); + else if (test & TEST_EXPAND) + { + if (len < 0) + len = strlen((char*)u); + e = u + len; + if (test & TEST_DELIMIT) + printf("\""); + while (u < e) + switch (c = *u++) + { + case '\\': + printf("\\\\"); + break; + case '"': + if (test & TEST_DELIMIT) + printf("\\\""); + else + printf("\""); + break; + case '\a': + printf("\\a"); + break; + case '\b': + printf("\\b"); + break; + case 033: + printf("\\e"); + break; + case '\f': + printf("\\f"); + break; + case '\n': + printf("\\n"); + break; + case '\r': + printf("\\r"); + break; + case '\t': + printf("\\t"); + break; + case '\v': + printf("\\v"); + break; + default: +#ifdef MB_CUR_MAX + s = (char*)u - 1; + if ((w = mblen(s, (char*)e - s)) > 1) + { + u += w - 1; + fwrite(s, 1, w, stdout); + } + else +#endif + if (!iscntrl(c) && isprint(c)) + putchar(c); + else + printf("\\x%02x", c); + break; + } + if (test & TEST_DELIMIT) + printf("\""); + } + else + printf("%s", s); +} + +static void +report(char* comment, char* fun, char* re, char* s, int len, char* msg, int flags, unsigned long test) +{ + if (state.file) + printf("%s:", state.file); + printf("%d:", state.lineno); + if (re) + { + printf(" "); + quote(re, -1, test|TEST_DELIMIT); + if (s) + { + printf(" versus "); + quote(s, len, test|TEST_DELIMIT); + } + } + if (test & TEST_UNSPECIFIED) + { + state.unspecified++; + printf(" unspecified behavior"); + } + else + state.errors++; + if (state.which) + printf(" %s", state.which); + if (flags & REG_NOSUB) + printf(" NOSUB"); + if (fun) + printf(" %s", fun); + if (comment[strlen(comment)-1] == '\n') + printf(" %s", comment); + else + { + printf(" %s: ", comment); + if (msg) + printf("%s: ", msg); + } +} + +static void +error(regex_t* preg, int code) +{ + char* msg; + char buf[256]; + + switch (code) + { + case REG_EBUS: + msg = "bus error"; + break; + case REG_EFAULT: + msg = "memory fault"; + break; + case REG_EHUNG: + msg = "did not terminate"; + break; + default: + regerror(code, preg, msg = buf, sizeof buf); + break; + } + printf("%s\n", msg); +} + +static void +bad(char* comment, char* re, char* s, int len, unsigned long test) +{ + printf("bad test case "); + report(comment, NiL, re, s, len, NiL, 0, test); + exit(1); +} + +static int +escape(char* s) +{ + char* b; + char* t; + char* q; + char* e; + int c; + + for (b = t = s; (*t = *s); s++, t++) + if (*s == '\\') + switch (*++s) + { + case '\\': + break; + case 'a': + *t = '\a'; + break; + case 'b': + *t = '\b'; + break; + case 'c': + if ((*t = *++s)) + *t &= 037; + else + s--; + break; + case 'e': + case 'E': + *t = 033; + break; + case 'f': + *t = '\f'; + break; + case 'n': + *t = '\n'; + break; + case 'r': + *t = '\r'; + break; + case 's': + *t = ' '; + break; + case 't': + *t = '\t'; + break; + case 'v': + *t = '\v'; + break; + case 'u': + case 'x': + c = 0; + q = c == 'u' ? (s + 5) : (char*)0; + e = s + 1; + while (!e || !q || s < q) + { + switch (*++s) + { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + c = (c << 4) + *s - 'a' + 10; + continue; + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + c = (c << 4) + *s - 'A' + 10; + continue; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + c = (c << 4) + *s - '0'; + continue; + case '{': + case '[': + if (s != e) + { + s--; + break; + } + e = 0; + continue; + case '}': + case ']': + if (e) + s--; + break; + default: + s--; + break; + } + break; + } + *t = c; + break; + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + c = *s - '0'; + q = s + 2; + while (s < q) + { + switch (*++s) + { + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + c = (c << 3) + *s - '0'; + break; + default: + q = --s; + break; + } + } + *t = c; + break; + default: + *(s + 1) = 0; + bad("invalid C \\ escape\n", s - 1, NiL, 0, 0); + } + return t - b; +} + +static void +matchoffprint(int off) +{ + switch (off) + { + case -2: + printf("X"); + break; + case -1: + printf("?"); + break; + default: + printf("%d", off); + break; + } +} + +static void +matchprint(regmatch_t* match, int nmatch, int nsub, char* ans, unsigned long test) +{ + int i; + + for (; nmatch > nsub + 1; nmatch--) + if ((match[nmatch-1].rm_so != -1 || match[nmatch-1].rm_eo != -1) && (!(test & TEST_IGNORE_POSITION) || (match[nmatch-1].rm_so >= 0 && match[nmatch-1].rm_eo >= 0))) + break; + for (i = 0; i < nmatch; i++) + { + printf("("); + matchoffprint(match[i].rm_so); + printf(","); + matchoffprint(match[i].rm_eo); + printf(")"); + } + if (!(test & (TEST_ACTUAL|TEST_BASELINE))) + { + if (ans) + printf(" expected: %s", ans); + printf("\n"); + } +} + +static int +matchcheck(regmatch_t* match, int nmatch, int nsub, char* ans, char* re, char* s, int len, int flags, unsigned long test) +{ + char* p; + int i; + int m; + int n; + + if (streq(ans, "OK")) + return test & (TEST_BASELINE|TEST_PASS|TEST_VERIFY); + for (i = 0, p = ans; i < nmatch && *p; i++) + { + if (*p == '{') + { +#ifdef REG_DISCIPLINE + char* x; + + if (!(x = sfstruse(state.disc.sp))) + bad("out of space [discipline string]\n", NiL, NiL, 0, 0); + if (strcmp(p, x)) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + return 0; + report("callout failed", NiL, re, s, len, NiL, flags, test); + quote(p, -1, test); + printf(" expected, "); + quote(x, -1, test); + printf(" returned\n"); + } +#endif + break; + } + if (*p++ != '(') + bad("improper answer\n", re, s, -1, test); + if (*p == '?') + { + m = -1; + p++; + } + else if (*p == 'R' && !memcmp(p, "RE_DUP_MAX", 10)) + { + m = RE_DUP_MAX; + p += 10; + if (*p == '+' || *p == '-') + m += strtol(p, &p, 10); + } + else + m = strtol(p, &p, 10); + if (*p++ != ',') + bad("improper answer\n", re, s, -1, test); + if (*p == '?') + { + n = -1; + p++; + } + else if (*p == 'R' && !memcmp(p, "RE_DUP_MAX", 10)) + { + n = RE_DUP_MAX; + p += 10; + if (*p == '+' || *p == '-') + n += strtol(p, &p, 10); + } + else + n = strtol(p, &p, 10); + if (*p++ != ')') + bad("improper answer\n", re, s, -1, test); + if (m!=match[i].rm_so || n!=match[i].rm_eo) + { + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))) + { + report("failed: match was", NiL, re, s, len, NiL, flags, test); + matchprint(match, nmatch, nsub, ans, test); + } + return 0; + } + } + for (; i < nmatch; i++) + { + if (match[i].rm_so!=-1 || match[i].rm_eo!=-1) + { + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_VERIFY))) + { + if ((test & TEST_IGNORE_POSITION) && (match[i].rm_so<0 || match[i].rm_eo<0)) + { + state.ignored++; + return 0; + } + if (!(test & TEST_SUMMARY)) + { + report("failed: match was", NiL, re, s, len, NiL, flags, test); + matchprint(match, nmatch, nsub, ans, test); + } + } + return 0; + } + } + if (!(test & TEST_IGNORE_OVER) && match[nmatch].rm_so != state.NOMATCH.rm_so) + { + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))) + { + report("failed: overran match array", NiL, re, s, len, NiL, flags, test); + matchprint(match, nmatch + 1, nsub, NiL, test); + } + return 0; + } + return 1; +} + +static void +sigunblock(int s) +{ +#ifdef SIG_SETMASK + int op; + sigset_t mask; + + sigemptyset(&mask); + if (s) + { + sigaddset(&mask, s); + op = SIG_UNBLOCK; + } + else op = SIG_SETMASK; + sigprocmask(op, &mask, NiL); +#else +#ifdef sigmask + sigsetmask(s ? (sigsetmask(0L) & ~sigmask(s)) : 0L); +#endif +#endif +} + +static void +gotcha(int sig) +{ + int ret; + + signal(sig, gotcha); + alarm(0); + state.signals++; + switch (sig) + { + case SIGALRM: + ret = REG_EHUNG; + break; + case SIGBUS: + ret = REG_EBUS; + break; + default: + ret = REG_EFAULT; + break; + } + sigunblock(sig); + longjmp(state.gotcha, ret); +} + +static char* +mygetline(FILE* fp) +{ + static char buf[32 * 1024]; + + register char* s = buf; + register char* e = &buf[sizeof(buf)]; + register char* b; + + for (;;) + { + if (!(b = fgets(s, e - s, fp))) + return 0; + state.lineno++; + s += strlen(s); + if (s == b || *--s != '\n' || s == b || *(s - 1) != '\\') + { + *s = 0; + break; + } + s--; + } + return buf; +} + +static unsigned long +note(unsigned long level, char* msg, unsigned long skip, unsigned long test) +{ + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY)) && !skip) + { + printf("NOTE\t"); + if (msg) + printf("%s: ", msg); + printf("skipping lines %d", state.lineno); + } + return skip | level; +} + +#define TABS(n) &ts[7-((n)&7)] + +static char ts[] = "\t\t\t\t\t\t\t"; + +static unsigned long +extract(int* tabs, char* spec, char* re, char* s, char* ans, char* msg, char* accept, regmatch_t* match, int nmatch, int nsub, unsigned long skip, unsigned long level, unsigned long test) +{ + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_OK|TEST_PASS|TEST_SUMMARY)) + { + state.extracted = 1; + if (test & TEST_OK) + { + state.passed++; + if ((test & TEST_VERIFY) && !(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY))) + { + if (msg && strcmp(msg, "EXPECTED")) + printf("NOTE\t%s\n", msg); + return skip; + } + test &= ~(TEST_PASS|TEST_QUERY); + } + if (test & (TEST_QUERY|TEST_VERIFY)) + { + if (test & TEST_BASELINE) + test &= ~(TEST_BASELINE|TEST_PASS); + else + test |= TEST_PASS; + skip |= level; + } + if (!(test & TEST_OK)) + { + if (test & TEST_UNSPECIFIED) + state.unspecified++; + else + state.errors++; + } + if (test & (TEST_PASS|TEST_SUMMARY)) + return skip; + test &= ~TEST_DELIMIT; + printf("%s%s", spec, TABS(*tabs++)); + if ((test & (TEST_BASELINE|TEST_SAME)) == (TEST_BASELINE|TEST_SAME)) + printf("SAME"); + else + quote(re, -1, test); + printf("%s", TABS(*tabs++)); + quote(s, -1, test); + printf("%s", TABS(*tabs++)); + if (!(test & (TEST_ACTUAL|TEST_BASELINE)) || (!accept && !match)) + printf("%s", ans); + else if (accept) + printf("%s", accept); + else + matchprint(match, nmatch, nsub, NiL, test); + if (msg) + printf("%s%s", TABS(*tabs++), msg); + putchar('\n'); + } + else if (test & TEST_QUERY) + skip = note(level, msg, skip, test); + else if (test & TEST_VERIFY) + state.extracted = 1; + return skip; +} + +static int +catchfree(regex_t* preg, int flags, int* tabs, char* spec, char* re, char* s, char* ans, char* msg, char* accept, regmatch_t* match, int nmatch, int nsub, unsigned long skip, unsigned long level, unsigned long test) +{ + int eret; + + if (!(test & TEST_CATCH)) + { + regfree(preg); + eret = 0; + } + else if (!(eret = setjmp(state.gotcha))) + { + alarm(HUNG); + regfree(preg); + alarm(0); + } + else if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + extract(tabs, spec, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test); + else + { + report("failed", "regfree", re, NiL, -1, msg, flags, test); + error(preg, eret); + } + return eret; +} + +static char* +expand(char* os, char* ot) +{ + char* s = os; + char* t; + int n = 0; + int r; + long m; + + for (;;) + { + switch (*s++) + { + case 0: + break; + case '{': + n++; + continue; + case '}': + n--; + continue; + case 'R': + if (n == 1 && !memcmp(s, "E_DUP_MAX", 9)) + { + s--; + for (t = ot; os < s; *t++ = *os++); + r = ((t - ot) >= 5 && t[-1] == '{' && t[-2] == '.' && t[-3] == '.' && t[-4] == '.') ? t[-5] : 0; + os = ot; + m = RE_DUP_MAX; + if (*(s += 10) == '+' || *s == '-') + m += strtol(s, &s, 10); + if (r) + { + t -= 5; + while (m-- > 0) + *t++ = r; + while (*s && *s++ != '}'); + } + else + t += snprintf(t, 32, "%ld", m); + while ((*t = *s++)) + t++; + break; + } + continue; + default: + continue; + } + break; + } + return os; +} + +int +main(int argc, char** argv) +{ + int flags; + int cflags; + int eflags; + int nmatch; + int nexec; + int nstr; + int cret; + int eret; + int nsub; + int i; + int j; + int expected; + int got; + int locale; + int subunitlen; + int testno; + unsigned long level; + unsigned long skip; + char* p; + char* line; + char* spec; + char* re; + char* s; + char* ans; + char* msg; + char* fun; + char* ppat; + char* subunit; + char* version; + char* field[6]; + char* delim[6]; + FILE* fp; + int tabs[6]; + char unit[64]; + regmatch_t match[100]; + regex_t preg; + + static char pat[32 * 1024]; + static char patbuf[32 * 1024]; + static char strbuf[32 * 1024]; + + int nonosub = REG_NOSUB == 0; + int nonexec = 0; + + unsigned long test = 0; + + static char* filter[] = { "-", 0 }; + + if ((p = getenv("TestRegexLocale")) != NULL) + { + if (!setlocale(LC_ALL, p)) + { + fprintf(stderr, "Can't initialize locale to %s\n", p); + exit(1); + } + else + printf("Initial locale: %s\n", p); + } + + state.NOMATCH.rm_so = state.NOMATCH.rm_eo = -2; + p = unit; + version = (char*)id + 10; + while (p < &unit[sizeof(unit)-1] && (*p = *version++) && !isspace(*p)) + p++; + *p = 0; + while ((p = *++argv) && *p == '-') + for (;;) + { + switch (*++p) + { + case 0: + break; + case 'c': + test |= TEST_CATCH; + continue; + case 'e': + test |= TEST_IGNORE_ERROR; + continue; + case 'h': + case '?': + help(0); + return 2; + case '-': + help(p[1] == 'h'); + return 2; + case 'n': + nonexec = 1; + continue; + case 'o': + test |= TEST_IGNORE_OVER; + continue; + case 'p': + test |= TEST_IGNORE_POSITION; + continue; + case 's': +#ifdef REG_DISCIPLINE + if (!(state.stack = stkalloc(stkstd, 0))) + fprintf(stderr, "%s: out of space [stack]", unit); + state.disc.disc.re_resizef = resizef; + state.disc.disc.re_resizehandle = (void*)stkstd; +#endif + continue; + case 'x': + nonosub = 1; + continue; + case 'v': + test |= TEST_VERBOSE; + continue; + case 'A': + test |= TEST_ACTUAL; + continue; + case 'B': + test |= TEST_BASELINE; + continue; + case 'F': + test |= TEST_FAIL; + continue; + case 'P': + test |= TEST_PASS; + continue; + case 'S': + test |= TEST_SUMMARY; + continue; + default: + fprintf(stderr, "%s: %c: invalid option\n", unit, *p); + return 2; + } + break; + } + if (!*argv) + argv = filter; + locale = 0; + while ((state.file = *argv++)) + { + if (streq(state.file, "-") || streq(state.file, "/dev/stdin") || streq(state.file, "/dev/fd/0")) + { + state.file = 0; + fp = stdin; + } + else if (!(fp = fopen(state.file, "r"))) + { + fprintf(stderr, "%s: %s: cannot read\n", unit, state.file); + return 2; + } + testno = state.errors = state.ignored = state.lineno = state.passed = + state.signals = state.unspecified = state.warnings = 0; + skip = 0; + level = 1; + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY))) + { + printf("TEST\t%s ", unit); + if ((s = state.file)) + { + subunit = p = 0; + for (;;) + { + switch (*s++) + { + case 0: + break; + case '/': + subunit = s; + continue; + case '.': + p = s - 1; + continue; + default: + continue; + } + break; + } + if (!subunit) + subunit = state.file; + if (p < subunit) + p = s - 1; + subunitlen = p - subunit; + printf("%-.*s ", subunitlen, subunit); + } + else + subunit = 0; + for (s = version; *s && (*s != ' ' || *(s + 1) != '$'); s++) + putchar(*s); + if (test & TEST_CATCH) + printf(", catch"); + if (test & TEST_IGNORE_ERROR) + printf(", ignore error code mismatches"); + if (test & TEST_IGNORE_POSITION) + printf(", ignore negative position mismatches"); +#ifdef REG_DISCIPLINE + if (state.stack) + printf(", stack"); +#endif + if (test & TEST_VERBOSE) + printf(", verbose"); + printf("\n"); +#ifdef REG_VERSIONID + if (regerror(REG_VERSIONID, NiL, pat, sizeof(pat)) > 0) + s = pat; + else +#endif +#ifdef REG_TEST_VERSION + s = REG_TEST_VERSION; +#else + s = "regex"; +#endif + printf("NOTE\t%s\n", s); + if (elementsof(unsupported) > 1) + { +#if (REG_TEST_DEFAULT & (REG_AUGMENTED|REG_EXTENDED|REG_SHELL)) || !defined(REG_EXTENDED) + i = 0; +#else + i = REG_EXTENDED != 0; +#endif + for (got = 0; i < elementsof(unsupported) - 1; i++) + { + if (!got) + { + got = 1; + printf("NOTE\tunsupported: %s", unsupported[i]); + } + else + printf(",%s", unsupported[i]); + } + if (got) + printf("\n"); + } + } +#ifdef REG_DISCIPLINE + state.disc.disc.re_version = REG_VERSION; + state.disc.disc.re_compf = compf; + state.disc.disc.re_execf = execf; + if (!(state.disc.sp = sfstropen())) + bad("out of space [discipline string stream]\n", NiL, NiL, 0, 0); + preg.re_disc = &state.disc.disc; +#endif + if (test & TEST_CATCH) + { + signal(SIGALRM, gotcha); + signal(SIGBUS, gotcha); + signal(SIGSEGV, gotcha); + } + while ((p = mygetline(fp))) + { + + /* parse: */ + + line = p; + if (*p == ':' && !isspace(*(p + 1))) + { + while (*++p && *p != ':'); + if (!*p++) + { + if (test & TEST_BASELINE) + printf("%s\n", line); + continue; + } + } + while (isspace(*p)) + p++; + if (*p == 0 || *p == '#' || *p == 'T') + { + if (test & TEST_BASELINE) + printf("%s\n", line); + continue; + } + if (*p == ':' || *p == 'N') + { + if (test & TEST_BASELINE) + printf("%s\n", line); + else if (!(test & (TEST_ACTUAL|TEST_FAIL|TEST_PASS|TEST_SUMMARY))) + { + while (*++p && !isspace(*p)); + while (isspace(*p)) + p++; + printf("NOTE %s\n", p); + } + continue; + } + j = 0; + i = 0; + field[i++] = p; + for (;;) + { + switch (*p++) + { + case 0: + p--; + j = 0; + goto checkfield; + case '\t': + *(delim[i] = p - 1) = 0; + j = 1; + checkfield: + s = field[i - 1]; + if (streq(s, "NIL")) + field[i - 1] = 0; + else if (streq(s, "NULL")) + *s = 0; + while (*p == '\t') + { + p++; + j++; + } + tabs[i - 1] = j; + if (!*p) + break; + if (i >= elementsof(field)) + bad("too many fields\n", NiL, NiL, 0, 0); + field[i++] = p; + /*FALLTHROUGH*/ + default: + continue; + } + break; + } + if (!(spec = field[0])) + bad("NIL spec\n", NiL, NiL, 0, 0); + + /* interpret: */ + + cflags = REG_TEST_DEFAULT; + eflags = REG_EXEC_DEFAULT; +#ifdef REG_BACKTRACKING_MATCHER + if (getenv("REG_BACKTRACKING_MATCHER")) + eflags |= REG_BACKTRACKING_MATCHER; +#endif + test &= TEST_GLOBAL; + state.extracted = 0; + nmatch = 20; + nsub = -1; + for (p = spec; *p; p++) + { + if (isdigit(*p)) + { + nmatch = strtol(p, &p, 10); + if (nmatch >= elementsof(match)) + bad("nmatch must be < 100\n", NiL, NiL, 0, 0); + p--; + continue; + } + switch (*p) + { + case 'A': + test |= TEST_ARE; + continue; + case 'B': + test |= TEST_BRE; + continue; + case 'C': + if (!(test & TEST_QUERY) && !(skip & level)) + bad("locale must be nested\n", NiL, NiL, 0, 0); + test &= ~TEST_QUERY; + if (locale) + bad("locale nesting not supported\n", NiL, NiL, 0, 0); + if (i != 2) + bad("locale field expected\n", NiL, NiL, 0, 0); + if (!(skip & level)) + { +#if defined(LC_COLLATE) && defined(LC_CTYPE) + s = field[1]; + if (!s || streq(s, "POSIX")) + s = "C"; + if ((ans = setlocale(LC_COLLATE, s)) && streq(ans, "POSIX")) + ans = "C"; + if (!ans || (!streq(ans, s) && streq(s, "C"))) + ans = 0; + else if ((ans = setlocale(LC_CTYPE, s)) && streq(ans, "POSIX")) + ans = "C"; + if (!ans || (!streq(ans, s) && streq(s, "C"))) + skip = note(level, s, skip, test); + else + { + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY))) + printf("NOTE \"%s\" locale\n", s); + locale = level; + } +#else + skip = note(level, skip, test, "locales not supported"); +#endif + } + cflags = NOTEST; + continue; + case 'E': + test |= TEST_ERE; + continue; + case 'K': + test |= TEST_KRE; + continue; + case 'L': + test |= TEST_LRE; + continue; + case 'S': + test |= TEST_SRE; + continue; + + case 'a': + cflags |= REG_LEFT|REG_RIGHT; + continue; + case 'b': + eflags |= REG_NOTBOL; + continue; + case 'c': + cflags |= REG_COMMENT; + continue; + case 'd': + cflags |= REG_SHELL_DOT; + continue; + case 'e': + eflags |= REG_NOTEOL; + continue; + case 'f': + cflags |= REG_MULTIPLE; + continue; + case 'g': + cflags |= NOTEST; + continue; + case 'H': +#ifdef REG_ENHANCED + cflags |= REG_ENHANCED; +#endif + continue; + case 'h': + cflags |= REG_MULTIREF; + continue; + case 'i': + cflags |= REG_ICASE; + continue; + case 'j': + cflags |= REG_SPAN; + continue; + case 'k': + cflags |= REG_ESCAPE; + continue; + case 'l': + cflags |= REG_LEFT; + continue; + case 'm': + cflags |= REG_MINIMAL; + continue; + case 'n': + cflags |= REG_NEWLINE; + continue; + case 'o': + cflags |= REG_SHELL_GROUP; + continue; + case 'p': + cflags |= REG_SHELL_PATH; + continue; + case 'q': + cflags |= REG_DELIMITED; + continue; + case 'r': + cflags |= REG_RIGHT; + continue; + case 's': + cflags |= REG_SHELL_ESCAPED; + continue; + case 't': + cflags |= REG_MUSTDELIM; + continue; + case 'u': + test |= TEST_UNSPECIFIED; + continue; + case 'v': + cflags |= REG_CLASS_ESCAPE; + continue; + case 'w': + cflags |= REG_NOSUB; + continue; + case 'x': + if (REG_LENIENT) + cflags |= REG_LENIENT; + else + test |= TEST_LENIENT; + continue; + case 'y': + eflags |= REG_LEFT; + continue; + case 'z': + cflags |= REG_NULL; + continue; + + case '$': + test |= TEST_EXPAND; + continue; + + case '/': + test |= TEST_SUB; + continue; + + case '=': + test |= TEST_DECOMP; + continue; + + case '?': + test |= TEST_VERIFY; + test &= ~(TEST_AND|TEST_OR); + state.verify = state.passed; + continue; + case '&': + test |= TEST_VERIFY|TEST_AND; + test &= ~TEST_OR; + continue; + case '|': + test |= TEST_VERIFY|TEST_OR; + test &= ~TEST_AND; + continue; + case ';': + test |= TEST_OR; + test &= ~TEST_AND; + continue; + + case '{': + level <<= 1; + if (skip & (level >> 1)) + { + skip |= level; + cflags = NOTEST; + } + else + { + skip &= ~level; + test |= TEST_QUERY; + } + continue; + case '}': + if (level == 1) + bad("invalid {...} nesting\n", NiL, NiL, 0, 0); + if ((skip & level) && !(skip & (level>>1))) + { + if (!(test & (TEST_BASELINE|TEST_SUMMARY))) + { + if (test & (TEST_ACTUAL|TEST_FAIL)) + printf("}\n"); + else if (!(test & TEST_PASS)) + printf("-%d\n", state.lineno); + } + } +#if defined(LC_COLLATE) && defined(LC_CTYPE) + else if (locale & level) + { + locale = 0; + if (!(skip & level)) + { + s = "C"; + setlocale(LC_COLLATE, s); + setlocale(LC_CTYPE, s); + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY))) + printf("NOTE \"%s\" locale\n", s); + else if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_PASS)) + printf("}\n"); + } + else if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL)) + printf("}\n"); + } +#endif + level >>= 1; + cflags = NOTEST; + continue; + + default: + bad("bad spec\n", spec, NiL, 0, test); + break; + + } + break; + } + if ((cflags|eflags) == NOTEST || ((skip & level) && (test & TEST_BASELINE))) + { + if (test & TEST_BASELINE) + { + while (i > 1) + *delim[--i] = '\t'; + printf("%s\n", line); + } + continue; + } + if (test & TEST_OR) + { + if (!(test & TEST_VERIFY)) + { + test &= ~TEST_OR; + if (state.passed == state.verify && i > 1) + printf("NOTE\t%s\n", field[1]); + continue; + } + else if (state.passed > state.verify) + continue; + } + else if (test & TEST_AND) + { + if (state.passed == state.verify) + continue; + state.passed = state.verify; + } + if (i < ((test & TEST_DECOMP) ? 3 : 4)) + bad("too few fields\n", NiL, NiL, 0, test); + while (i < elementsof(field)) + field[i++] = 0; + if ((re = field[1])) + { + if (streq(re, "SAME")) + { + re = ppat; + test |= TEST_SAME; + } + else + { + if (test & TEST_EXPAND) + escape(re); + re = expand(re, patbuf); + strcpy(ppat = pat, re); + } + } + else + ppat = 0; + nstr = -1; + if ((s = field[2])) + { + s = expand(s, strbuf); + if (test & TEST_EXPAND) + { + nstr = escape(s); +#if _REG_nexec + if (nstr != strlen(s)) + nexec = nstr; +#endif + } + } + if (!(ans = field[(test & TEST_DECOMP) ? 2 : 3])) + bad("NIL answer\n", NiL, NiL, 0, test); + msg = field[4]; + fflush(stdout); + if (test & TEST_SUB) +#if _REG_subcomp + cflags |= REG_DELIMITED; +#else + continue; +#endif +#if !_REG_decomp + if (test & TEST_DECOMP) + continue; +#endif + + compile: + + if (state.extracted || (skip & level)) + continue; +#if !(REG_TEST_DEFAULT & (REG_AUGMENTED|REG_EXTENDED|REG_SHELL)) +#ifdef REG_EXTENDED + if (REG_EXTENDED != 0 && (test & TEST_BRE)) +#else + if (test & TEST_BRE) +#endif + { + test &= ~TEST_BRE; + flags = cflags; + state.which = "BRE"; + } + else +#endif +#ifdef REG_EXTENDED + if (test & TEST_ERE) + { + test &= ~TEST_ERE; + flags = cflags | REG_EXTENDED; + state.which = "ERE"; + } + else +#endif +#ifdef REG_AUGMENTED + if (test & TEST_ARE) + { + test &= ~TEST_ARE; + flags = cflags | REG_AUGMENTED; + state.which = "ARE"; + } + else +#endif +#ifdef REG_LITERAL + if (test & TEST_LRE) + { + test &= ~TEST_LRE; + flags = cflags | REG_LITERAL; + state.which = "LRE"; + } + else +#endif +#ifdef REG_SHELL + if (test & TEST_SRE) + { + test &= ~TEST_SRE; + flags = cflags | REG_SHELL; + state.which = "SRE"; + } + else +#ifdef REG_AUGMENTED + if (test & TEST_KRE) + { + test &= ~TEST_KRE; + flags = cflags | REG_SHELL | REG_AUGMENTED; + state.which = "KRE"; + } + else +#endif +#endif + { + if (test & (TEST_BASELINE|TEST_PASS|TEST_VERIFY)) + extract(tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test|TEST_OK); + continue; + } + if ((test & (TEST_QUERY|TEST_VERBOSE|TEST_VERIFY)) == TEST_VERBOSE) + { + printf("test %-3d %s ", state.lineno, state.which); + quote(re, -1, test|TEST_DELIMIT); + printf(" "); + quote(s, nstr, test|TEST_DELIMIT); + printf("\n"); + } + + nosub: + fun = "regcomp"; +#if _REG_nexec + if (nstr >= 0 && nstr != strlen(s)) + nexec = nstr; + + else +#endif + nexec = -1; + if (state.extracted || (skip & level)) + continue; + if (!(test & TEST_QUERY)) + testno++; +#ifdef REG_DISCIPLINE + if (state.stack) + stkset(stkstd, state.stack, 0); + flags |= REG_DISCIPLINE; + state.disc.ordinal = 0; + sfstrseek(state.disc.sp, 0, SEEK_SET); +#endif + if (!(test & TEST_CATCH)) + cret = regcomp(&preg, re, flags); + else if (!(cret = setjmp(state.gotcha))) + { + alarm(HUNG); + cret = regcomp(&preg, re, flags); + alarm(0); + } +#if _REG_subcomp + if (!cret && (test & TEST_SUB)) + { + fun = "regsubcomp"; + p = re + preg.re_npat; + if (!(test & TEST_CATCH)) + cret = regsubcomp(&preg, p, NiL, 0, 0); + else if (!(cret = setjmp(state.gotcha))) + { + alarm(HUNG); + cret = regsubcomp(&preg, p, NiL, 0, 0); + alarm(0); + } + if (!cret && *(p += preg.re_npat) && !(preg.re_sub->re_flags & REG_SUB_LAST)) + { + if (catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test)) + continue; + cret = REG_EFLAGS; + } + } +#endif +#if _REG_decomp + if (!cret && (test & TEST_DECOMP)) + { + char buf[128]; + + if ((j = nmatch) > sizeof(buf)) + j = sizeof(buf); + fun = "regdecomp"; + p = re + preg.re_npat; + if (!(test & TEST_CATCH)) + i = regdecomp(&preg, -1, buf, j); + else if (!(cret = setjmp(state.gotcha))) + { + alarm(HUNG); + i = regdecomp(&preg, -1, buf, j); + alarm(0); + } + if (!cret) + { + catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test); + if (i > j) + { + if (i != (strlen(ans) + 1)) + { + report("failed", fun, re, s, nstr, msg, flags, test); + printf(" %d byte buffer supplied, %d byte buffer required\n", j, i); + } + } + else if (strcmp(buf, ans)) + { + report("failed", fun, re, s, nstr, msg, flags, test); + quote(ans, -1, test|TEST_DELIMIT); + printf(" expected, "); + quote(buf, -1, test|TEST_DELIMIT); + printf(" returned\n"); + } + continue; + } + } +#endif + if (!cret) + { + if (!(flags & REG_NOSUB) && nsub < 0 && *ans == '(') + { + for (p = ans; *p; p++) + if (*p == '(') + nsub++; + else if (*p == '{') + nsub--; + if (nsub >= 0) + { + if (test & TEST_IGNORE_OVER) + { + if (nmatch > nsub) + nmatch = nsub + 1; + } + else if (nsub != preg.re_nsub) + { + if (nsub > preg.re_nsub) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, "OK", NiL, 0, 0, skip, level, test|TEST_DELIMIT); + else + { + report("re_nsub incorrect", fun, re, NiL, -1, msg, flags, test); + printf("at least %d expected, %lu returned\n", nsub, preg.re_nsub); + state.errors++; + } + } + else + nsub = preg.re_nsub; + } + } + } + if (!(test & (TEST_DECOMP|TEST_SUB)) && *ans && *ans != '(' && !streq(ans, "OK") && !streq(ans, "NOMATCH")) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, "OK", NiL, 0, 0, skip, level, test|TEST_DELIMIT); + else if (!(test & TEST_LENIENT)) + { + report("failed", fun, re, NiL, -1, msg, flags, test); + printf("%s expected, OK returned\n", ans); + } + catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test); + continue; + } + } + else + { + if (test & TEST_LENIENT) + /* we'll let it go this time */; + else if (!*ans || ans[0]=='(' || (cret == REG_BADPAT && streq(ans, "NOMATCH"))) + { + got = 0; + for (i = 1; i < elementsof(codes); i++) + if (cret==codes[i].code) + got = i; + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, codes[got].name, NiL, 0, 0, skip, level, test|TEST_DELIMIT); + else + { + report("failed", fun, re, NiL, -1, msg, flags, test); + printf("%s returned: ", codes[got].name); + error(&preg, cret); + } + } + else + { + expected = got = 0; + for (i = 1; i < elementsof(codes); i++) + { + if (streq(ans, codes[i].name)) + expected = i; + if (cret==codes[i].code) + got = i; + } + if (!expected) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, codes[got].name, NiL, 0, 0, skip, level, test|TEST_DELIMIT); + else + { + report("failed: invalid error code", NiL, re, NiL, -1, msg, flags, test); + printf("%s expected, %s returned\n", ans, codes[got].name); + } + } + else if (cret != codes[expected].code && cret != REG_BADPAT) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, codes[got].name, NiL, 0, 0, skip, level, test|TEST_DELIMIT); + else if (test & TEST_IGNORE_ERROR) + state.ignored++; + else + { + report("should fail and did", fun, re, NiL, -1, msg, flags, test); + printf("%s expected, %s returned: ", ans, codes[got].name); + state.errors--; + state.warnings++; + error(&preg, cret); + } + } + } + goto compile; + } + +#if _REG_nexec + execute: + if (nexec >= 0) + fun = "regnexec"; + else +#endif + fun = "regexec"; + + for (i = 0; i < elementsof(match); i++) + match[i] = state.NOMATCH; + +#if _REG_nexec + if (nexec >= 0) + { + eret = regnexec(&preg, s, nexec, nmatch, match, eflags); + s[nexec] = 0; + } + else +#endif + { + if (!(test & TEST_CATCH)) + eret = regexec(&preg, s, nmatch, match, eflags); + else if (!(eret = setjmp(state.gotcha))) + { + alarm(HUNG); + eret = regexec(&preg, s, nmatch, match, eflags); + alarm(0); + } + } +#if _REG_subcomp + if ((test & TEST_SUB) && !eret) + { + fun = "regsubexec"; + if (!(test & TEST_CATCH)) + eret = regsubexec(&preg, s, nmatch, match); + else if (!(eret = setjmp(state.gotcha))) + { + alarm(HUNG); + eret = regsubexec(&preg, s, nmatch, match); + alarm(0); + } + } +#endif + if (flags & REG_NOSUB) + { + if (eret) + { + if (eret != REG_NOMATCH || !streq(ans, "NOMATCH")) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, "NOMATCH", NiL, 0, 0, skip, level, test|TEST_DELIMIT); + else + { + report("REG_NOSUB failed", fun, re, s, nstr, msg, flags, test); + error(&preg, eret); + } + } + } + else if (streq(ans, "NOMATCH")) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, NiL, match, nmatch, nsub, skip, level, test|TEST_DELIMIT); + else + { + report("should fail and didn't", fun, re, s, nstr, msg, flags, test); + error(&preg, eret); + } + } +#if 1 + else if (match[0].rm_so != state.NOMATCH.rm_so) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test); + else + { + report("failed: REG_NOSUB set but match array assigned", NiL, re, s, nstr, msg, flags, test); + matchprint(match, nmatch, nsub, NiL, test); + } + } +#endif + } + else if (eret) + { + if (eret != REG_NOMATCH || !streq(ans, "NOMATCH")) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, "NOMATCH", NiL, 0, nsub, skip, level, test|TEST_DELIMIT); + else + { + report("failed", fun, re, s, nstr, msg, flags, test); + if (eret != REG_NOMATCH) + error(&preg, eret); + else if (*ans) + printf("expected: %s\n", ans); + else + printf("\n"); + } + } + } + else if (streq(ans, "NOMATCH")) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, NiL, match, nmatch, nsub, skip, level, test|TEST_DELIMIT); + else + { + report("should fail and didn't", fun, re, s, nstr, msg, flags, test); + matchprint(match, nmatch, nsub, NiL, test); + } + } +#if _REG_subcomp + else if (test & TEST_SUB) + { + p = preg.re_sub->re_buf; + if (strcmp(p, ans)) + { + report("failed", fun, re, s, nstr, msg, flags, test); + quote(ans, -1, test|TEST_DELIMIT); + printf(" expected, "); + quote(p, -1, test|TEST_DELIMIT); + printf(" returned\n"); + } + } +#endif + else if (!*ans) + { + if (match[0].rm_so != state.NOMATCH.rm_so) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test); + else + { + report("failed: no match but match array assigned", NiL, re, s, nstr, msg, flags, test); + matchprint(match, nmatch, nsub, NiL, test); + } + } + } + else if (matchcheck(match, nmatch, nsub, ans, re, s, nstr, flags, test)) + { +#if _REG_nexec + if (nexec < 0 && !nonexec) + { + nexec = nstr >= 0 ? nstr : strlen(s); + s[nexec] = '\n'; + testno++; + goto execute; + } +#endif + if (!(test & (TEST_DECOMP|TEST_SUB|TEST_VERIFY)) && !nonosub) + { + if (catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test)) + continue; + flags |= REG_NOSUB; + goto nosub; + } + if (test & (TEST_BASELINE|TEST_PASS|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, NiL, match, nmatch, nsub, skip, level, test|TEST_OK); + } + else if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, NiL, match, nmatch, nsub, skip, level, test|TEST_DELIMIT); + if (catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test)) + continue; + goto compile; + } + if (test & TEST_SUMMARY) + printf("tests=%-4d errors=%-4d warnings=%-2d ignored=%-2d unspecified=%-2d signals=%d\n", testno, state.errors, state.warnings, state.ignored, state.unspecified, state.signals); + else if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS))) + { + printf("TEST\t%s", unit); + if (subunit) + printf(" %-.*s", subunitlen, subunit); + printf(", %d test%s", testno, testno == 1 ? "" : "s"); + if (state.ignored) + printf(", %d ignored mismatche%s", state.ignored, state.ignored == 1 ? "" : "s"); + if (state.warnings) + printf(", %d warning%s", state.warnings, state.warnings == 1 ? "" : "s"); + if (state.unspecified) + printf(", %d unspecified difference%s", state.unspecified, state.unspecified == 1 ? "" : "s"); + if (state.signals) + printf(", %d signal%s", state.signals, state.signals == 1 ? "" : "s"); + printf(", %d error%s\n", state.errors, state.errors == 1 ? "" : "s"); + } + if (fp != stdin) + fclose(fp); + } + if (getenv("MallocStackLogging") != NULL) + { + printf("pid=%d\n", (int)getpid()); + pause(); + } + return 0; +} diff --git a/tests/regex/testregex.c.orig b/tests/regex/testregex.c.orig new file mode 100644 index 0000000..37545d0 --- /dev/null +++ b/tests/regex/testregex.c.orig @@ -0,0 +1,2286 @@ +#pragma prototyped noticed + +/* + * regex(3) test harness + * + * build: cc -o testregex testregex.c + * help: testregex --man + * note: REG_* features are detected by #ifdef; if REG_* are enums + * then supply #define REG_foo REG_foo for each enum REG_foo + * + * Glenn Fowler + * AT&T Research + * + * PLEASE: publish your tests so everyone can benefit + * + * The following license covers testregex.c and all associated test data. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of THIS SOFTWARE FILE (the "Software"), to deal in the Software + * without restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, and/or sell copies of the + * Software, and to permit persons to whom the Software is furnished to do + * so, subject to the following disclaimer: + * + * THIS SOFTWARE IS PROVIDED BY AT&T ``AS IS'' AND ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL AT&T BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT + * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +static const char id[] = "\n@(#)$Id: testregex (AT&T Research) 2010-06-10 $\0\n"; + +#if _PACKAGE_ast +#include +#else +#include +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef __STDC__ +#include +#include +#endif + +#ifndef RE_DUP_MAX +#define RE_DUP_MAX 32767 +#endif + +#if !_PACKAGE_ast +#undef REG_DISCIPLINE +#endif + +#ifndef REG_DELIMITED +#undef _REG_subcomp +#endif + +#define TEST_ARE 0x00000001 +#define TEST_BRE 0x00000002 +#define TEST_ERE 0x00000004 +#define TEST_KRE 0x00000008 +#define TEST_LRE 0x00000010 +#define TEST_SRE 0x00000020 + +#define TEST_EXPAND 0x00000100 +#define TEST_LENIENT 0x00000200 + +#define TEST_QUERY 0x00000400 +#define TEST_SUB 0x00000800 +#define TEST_UNSPECIFIED 0x00001000 +#define TEST_VERIFY 0x00002000 +#define TEST_AND 0x00004000 +#define TEST_OR 0x00008000 + +#define TEST_DELIMIT 0x00010000 +#define TEST_OK 0x00020000 +#define TEST_SAME 0x00040000 + +#define TEST_ACTUAL 0x00100000 +#define TEST_BASELINE 0x00200000 +#define TEST_FAIL 0x00400000 +#define TEST_PASS 0x00800000 +#define TEST_SUMMARY 0x01000000 + +#define TEST_IGNORE_ERROR 0x02000000 +#define TEST_IGNORE_OVER 0x04000000 +#define TEST_IGNORE_POSITION 0x08000000 + +#define TEST_CATCH 0x10000000 +#define TEST_VERBOSE 0x20000000 + +#define TEST_DECOMP 0x40000000 + +#define TEST_GLOBAL (TEST_ACTUAL|TEST_AND|TEST_BASELINE|TEST_CATCH|TEST_FAIL|TEST_IGNORE_ERROR|TEST_IGNORE_OVER|TEST_IGNORE_POSITION|TEST_OR|TEST_PASS|TEST_SUMMARY|TEST_VERBOSE) + +#ifdef REG_DISCIPLINE + + +#include + +typedef struct Disc_s +{ + regdisc_t disc; + int ordinal; + Sfio_t* sp; +} Disc_t; + +static void* +compf(const regex_t* re, const char* xstr, size_t xlen, regdisc_t* disc) +{ + Disc_t* dp = (Disc_t*)disc; + + return (void*)((char*)0 + ++dp->ordinal); +} + +static int +execf(const regex_t* re, void* data, const char* xstr, size_t xlen, const char* sstr, size_t slen, char** snxt, regdisc_t* disc) +{ + Disc_t* dp = (Disc_t*)disc; + + sfprintf(dp->sp, "{%-.*s}(%lu:%d)", xlen, xstr, (char*)data - (char*)0, slen); + return atoi(xstr); +} + +static void* +resizef(void* handle, void* data, size_t size) +{ + if (!size) + return 0; + return stkalloc((Sfio_t*)handle, size); +} + +#endif + +#ifndef NiL +#ifdef __STDC__ +#define NiL 0 +#else +#define NiL (char*)0 +#endif +#endif + +#define H(x) do{if(html)fprintf(stderr,x);}while(0) +#define T(x) fprintf(stderr,x) + +static void +help(int html) +{ +H("\n"); +H("\n"); +H("\n"); +H("testregex man document\n"); +H("\n"); +H("\n"); +H("
\n");
+T("NAME\n");
+T("  testregex - regex(3) test harness\n");
+T("\n");
+T("SYNOPSIS\n");
+T("  testregex [ options ]\n");
+T("\n");
+T("DESCRIPTION\n");
+T("  testregex reads regex(3) test specifications, one per line, from the\n");
+T("  standard input and writes one output line for each failed test. A\n");
+T("  summary line is written after all tests are done. Each successful\n");
+T("  test is run again with REG_NOSUB. Unsupported features are noted\n");
+T("  before the first test, and tests requiring these features are\n");
+T("  silently ignored.\n");
+T("\n");
+T("OPTIONS\n");
+T("  -c	catch signals and non-terminating calls\n");
+T("  -e	ignore error return mismatches\n");
+T("  -h	list help on standard error\n");
+T("  -n	do not repeat successful tests with regnexec()\n");
+T("  -o	ignore match[] overrun errors\n");
+T("  -p	ignore negative position mismatches\n");
+T("  -s	use stack instead of malloc\n");
+T("  -x	do not repeat successful tests with REG_NOSUB\n");
+T("  -v	list each test line\n");
+T("  -A	list failed test lines with actual answers\n");
+T("  -B	list all test lines with actual answers\n");
+T("  -F	list failed test lines\n");
+T("  -P	list passed test lines\n");
+T("  -S	output one summary line\n");
+T("\n");
+T("INPUT FORMAT\n");
+T("  Input lines may be blank, a comment beginning with #, or a test\n");
+T("  specification. A specification is five fields separated by one\n");
+T("  or more tabs. NULL denotes the empty string and NIL denotes the\n");
+T("  0 pointer.\n");
+T("\n");
+T("  Field 1: the regex(3) flags to apply, one character per REG_feature\n");
+T("  flag. The test is skipped if REG_feature is not supported by the\n");
+T("  implementation. If the first character is not [BEASKLP] then the\n");
+T("  specification is a global control line. One or more of [BEASKLP] may be\n");
+T("  specified; the test will be repeated for each mode.\n");
+T("\n");
+T("    B 	basic			BRE	(grep, ed, sed)\n");
+T("    E 	REG_EXTENDED		ERE	(egrep)\n");
+T("    A	REG_AUGMENTED		ARE	(egrep with negation)\n");
+T("    S	REG_SHELL		SRE	(sh glob)\n");
+T("    K	REG_SHELL|REG_AUGMENTED	KRE	(ksh glob)\n");
+T("    L	REG_LITERAL		LRE	(fgrep)\n");
+T("\n");
+T("    a	REG_LEFT|REG_RIGHT	implicit ^...$\n");
+T("    b	REG_NOTBOL		lhs does not match ^\n");
+T("    c	REG_COMMENT		ignore space and #...\\n\n");
+T("    d	REG_SHELL_DOT		explicit leading . match\n");
+T("    e	REG_NOTEOL		rhs does not match $\n");
+T("    f	REG_MULTIPLE		multiple \\n separated patterns\n");
+T("    g	FNM_LEADING_DIR		testfnmatch only -- match until /\n");
+T("    h	REG_MULTIREF		multiple digit backref\n");
+T("    i	REG_ICASE		ignore case\n");
+T("    j	REG_SPAN		. matches \\n\n");
+T("    k	REG_ESCAPE		\\ to ecape [...] delimiter\n");
+T("    l	REG_LEFT		implicit ^...\n");
+T("    m	REG_MINIMAL		minimal match\n");
+T("    n	REG_NEWLINE		explicit \\n match\n");
+T("    o	REG_ENCLOSED		(|&) magic inside [@|&](...)\n");
+T("    p	REG_SHELL_PATH		explicit / match\n");
+T("    q	REG_DELIMITED		delimited pattern\n");
+T("    r	REG_RIGHT		implicit ...$\n");
+T("    s	REG_SHELL_ESCAPED	\\ not special\n");
+T("    t	REG_MUSTDELIM		all delimiters must be specified\n");
+T("    u	standard unspecified behavior -- errors not counted\n");
+T("    v	REG_CLASS_ESCAPE	\\ special inside [...]\n");
+T("    w	REG_NOSUB		no subexpression match array\n");
+T("    x	REG_LENIENT		let some errors slide\n");
+T("    y	REG_LEFT		regexec() implicit ^...\n");
+T("    z	REG_NULL		NULL subexpressions ok\n");
+T("    $	                        expand C \\c escapes in fields 2 and 3\n");
+T("    /	                        field 2 is a regsubcomp() expression\n");
+T("    =	                        field 3 is a regdecomp() expression\n");
+T("\n");
+T("  Field 1 control lines:\n");
+T("\n");
+T("    C		set LC_COLLATE and LC_CTYPE to locale in field 2\n");
+T("\n");
+T("    ?test ...	output field 5 if passed and != EXPECTED, silent otherwise\n");
+T("    &test ...	output field 5 if current and previous passed\n");
+T("    |test ...	output field 5 if current passed and previous failed\n");
+T("    ; ...	output field 2 if previous failed\n");
+T("    {test ...	skip if failed until }\n");
+T("    }		end of skip\n");
+T("\n");
+T("    : comment		comment copied as output NOTE\n");
+T("    :comment:test	:comment: ignored\n");
+T("    N[OTE] comment	comment copied as output NOTE\n");
+T("    T[EST] comment	comment\n");
+T("\n");
+T("    number		use number for nmatch (20 by default)\n");
+T("\n");
+T("  Field 2: the regular expression pattern; SAME uses the pattern from\n");
+T("    the previous specification. RE_DUP_MAX inside {...} expands to the\n");
+T("    value from .\n");
+T("\n");
+T("  Field 3: the string to match. X...{RE_DUP_MAX} expands to RE_DUP_MAX\n");
+T("    copies of X.\n");
+T("\n");
+T("  Field 4: the test outcome. This is either one of the posix error\n");
+T("    codes (with REG_ omitted) or the match array, a list of (m,n)\n");
+T("    entries with m and n being first and last+1 positions in the\n");
+T("    field 3 string, or NULL if REG_NOSUB is in effect and success\n");
+T("    is expected. BADPAT is acceptable in place of any regcomp(3)\n");
+T("    error code. The match[] array is initialized to (-2,-2) before\n");
+T("    each test. All array elements from 0 to nmatch-1 must be specified\n");
+T("    in the outcome. Unspecified endpoints (offset -1) are denoted by ?.\n");
+T("    Unset endpoints (offset -2) are denoted by X. {x}(o:n) denotes a\n");
+T("    matched (?{...}) expression, where x is the text enclosed by {...},\n");
+T("    o is the expression ordinal counting from 1, and n is the length of\n");
+T("    the unmatched portion of the subject string. If x starts with a\n");
+T("    number then that is the return value of re_execf(), otherwise 0 is\n");
+T("    returned. RE_DUP_MAX[-+]N expands to the  value -+N.\n");
+T("\n");
+T("  Field 5: optional comment appended to the report.\n");
+T("\n");
+T("CAVEAT\n");
+T("    If a regex implementation misbehaves with memory then all bets are off.\n");
+T("\n");
+T("CONTRIBUTORS\n");
+T("  Glenn Fowler    gsf@research.att.com        (ksh strmatch, regex extensions)\n");
+T("  David Korn      dgk@research.att.com        (ksh glob matcher)\n");
+T("  Doug McIlroy    mcilroy@dartmouth.edu       (ast regex/testre in C++)\n");
+T("  Tom Lord        lord@regexps.com            (rx tests)\n");
+T("  Henry Spencer   henry@zoo.toronto.edu       (original public regex)\n");
+T("  Andrew Hume     andrew@research.att.com     (gre tests)\n");
+T("  John Maddock    John_Maddock@compuserve.com (regex++ tests)\n");
+T("  Philip Hazel    ph10@cam.ac.uk              (pcre tests)\n");
+T("  Ville Laurikari vl@iki.fi                   (libtre tests)\n");
+H("
\n"); +H("\n"); +H("\n"); +} + +#ifndef elementsof +#define elementsof(x) (sizeof(x)/sizeof(x[0])) +#endif + +#ifndef streq +#define streq(a,b) (*(a)==*(b)&&!strcmp(a,b)) +#endif + +#define HUNG 2 +#define NOTEST (~0) + +#ifndef REG_TEST_DEFAULT +#define REG_TEST_DEFAULT 0 +#endif + +#ifndef REG_EXEC_DEFAULT +#define REG_EXEC_DEFAULT 0 +#endif + +static const char* unsupported[] = +{ + "BASIC", +#ifndef REG_EXTENDED + "EXTENDED", +#endif +#ifndef REG_AUGMENTED + "AUGMENTED", +#endif +#ifndef REG_SHELL + "SHELL", +#endif + +#ifndef REG_CLASS_ESCAPE + "CLASS_ESCAPE", +#endif +#ifndef REG_COMMENT + "COMMENT", +#endif +#ifndef REG_DELIMITED + "DELIMITED", +#endif +#ifndef REG_DISCIPLINE + "DISCIPLINE", +#endif +#ifndef REG_ESCAPE + "ESCAPE", +#endif +#ifndef REG_ICASE + "ICASE", +#endif +#ifndef REG_LEFT + "LEFT", +#endif +#ifndef REG_LENIENT + "LENIENT", +#endif +#ifndef REG_LITERAL + "LITERAL", +#endif +#ifndef REG_MINIMAL + "MINIMAL", +#endif +#ifndef REG_MULTIPLE + "MULTIPLE", +#endif +#ifndef REG_MULTIREF + "MULTIREF", +#endif +#ifndef REG_MUSTDELIM + "MUSTDELIM", +#endif +#ifndef REG_NEWLINE + "NEWLINE", +#endif +#ifndef REG_NOTBOL + "NOTBOL", +#endif +#ifndef REG_NOTEOL + "NOTEOL", +#endif +#ifndef REG_NULL + "NULL", +#endif +#ifndef REG_RIGHT + "RIGHT", +#endif +#ifndef REG_SHELL_DOT + "SHELL_DOT", +#endif +#ifndef REG_SHELL_ESCAPED + "SHELL_ESCAPED", +#endif +#ifndef REG_SHELL_GROUP + "SHELL_GROUP", +#endif +#ifndef REG_SHELL_PATH + "SHELL_PATH", +#endif +#ifndef REG_SPAN + "SPAN", +#endif +#if REG_NOSUB & REG_TEST_DEFAULT + "SUBMATCH", +#endif +#if !_REG_nexec + "regnexec", +#endif +#if !_REG_subcomp + "regsubcomp", +#endif +#if !_REG_decomp + "redecomp", +#endif + 0 +}; + +#ifndef REG_CLASS_ESCAPE +#define REG_CLASS_ESCAPE NOTEST +#endif +#ifndef REG_COMMENT +#define REG_COMMENT NOTEST +#endif +#ifndef REG_DELIMITED +#define REG_DELIMITED NOTEST +#endif +#ifndef REG_ESCAPE +#define REG_ESCAPE NOTEST +#endif +#ifndef REG_ICASE +#define REG_ICASE NOTEST +#endif +#ifndef REG_LEFT +#define REG_LEFT NOTEST +#endif +#ifndef REG_LENIENT +#define REG_LENIENT 0 +#endif +#ifndef REG_MINIMAL +#define REG_MINIMAL NOTEST +#endif +#ifndef REG_MULTIPLE +#define REG_MULTIPLE NOTEST +#endif +#ifndef REG_MULTIREF +#define REG_MULTIREF NOTEST +#endif +#ifndef REG_MUSTDELIM +#define REG_MUSTDELIM NOTEST +#endif +#ifndef REG_NEWLINE +#define REG_NEWLINE NOTEST +#endif +#ifndef REG_NOTBOL +#define REG_NOTBOL NOTEST +#endif +#ifndef REG_NOTEOL +#define REG_NOTEOL NOTEST +#endif +#ifndef REG_NULL +#define REG_NULL NOTEST +#endif +#ifndef REG_RIGHT +#define REG_RIGHT NOTEST +#endif +#ifndef REG_SHELL_DOT +#define REG_SHELL_DOT NOTEST +#endif +#ifndef REG_SHELL_ESCAPED +#define REG_SHELL_ESCAPED NOTEST +#endif +#ifndef REG_SHELL_GROUP +#define REG_SHELL_GROUP NOTEST +#endif +#ifndef REG_SHELL_PATH +#define REG_SHELL_PATH NOTEST +#endif +#ifndef REG_SPAN +#define REG_SPAN NOTEST +#endif + +#define REG_UNKNOWN (-1) + +#ifndef REG_ENEWLINE +#define REG_ENEWLINE (REG_UNKNOWN-1) +#endif +#ifndef REG_ENULL +#ifndef REG_EMPTY +#define REG_ENULL (REG_UNKNOWN-2) +#else +#define REG_ENULL REG_EMPTY +#endif +#endif +#ifndef REG_ECOUNT +#define REG_ECOUNT (REG_UNKNOWN-3) +#endif +#ifndef REG_BADESC +#define REG_BADESC (REG_UNKNOWN-4) +#endif +#ifndef REG_EMEM +#define REG_EMEM (REG_UNKNOWN-5) +#endif +#ifndef REG_EHUNG +#define REG_EHUNG (REG_UNKNOWN-6) +#endif +#ifndef REG_EBUS +#define REG_EBUS (REG_UNKNOWN-7) +#endif +#ifndef REG_EFAULT +#define REG_EFAULT (REG_UNKNOWN-8) +#endif +#ifndef REG_EFLAGS +#define REG_EFLAGS (REG_UNKNOWN-9) +#endif +#ifndef REG_EDELIM +#define REG_EDELIM (REG_UNKNOWN-9) +#endif + +static const struct { int code; char* name; } codes[] = +{ + REG_UNKNOWN, "UNKNOWN", + REG_NOMATCH, "NOMATCH", + REG_BADPAT, "BADPAT", + REG_ECOLLATE, "ECOLLATE", + REG_ECTYPE, "ECTYPE", + REG_EESCAPE, "EESCAPE", + REG_ESUBREG, "ESUBREG", + REG_EBRACK, "EBRACK", + REG_EPAREN, "EPAREN", + REG_EBRACE, "EBRACE", + REG_BADBR, "BADBR", + REG_ERANGE, "ERANGE", + REG_ESPACE, "ESPACE", + REG_BADRPT, "BADRPT", + REG_ENEWLINE, "ENEWLINE", + REG_ENULL, "ENULL", + REG_ECOUNT, "ECOUNT", + REG_BADESC, "BADESC", + REG_EMEM, "EMEM", + REG_EHUNG, "EHUNG", + REG_EBUS, "EBUS", + REG_EFAULT, "EFAULT", + REG_EFLAGS, "EFLAGS", + REG_EDELIM, "EDELIM", +}; + +static struct +{ + regmatch_t NOMATCH; + int errors; + int extracted; + int ignored; + int lineno; + int passed; + int signals; + int unspecified; + int verify; + int warnings; + char* file; + char* stack; + char* which; + jmp_buf gotcha; +#ifdef REG_DISCIPLINE + Disc_t disc; +#endif +} state; + +static void +quote(char* s, int len, unsigned long test) +{ + unsigned char* u = (unsigned char*)s; + unsigned char* e; + int c; +#ifdef MB_CUR_MAX + int w; +#endif + + if (!u) + printf("NIL"); + else if (!*u && len <= 1) + printf("NULL"); + else if (test & TEST_EXPAND) + { + if (len < 0) + len = strlen((char*)u); + e = u + len; + if (test & TEST_DELIMIT) + printf("\""); + while (u < e) + switch (c = *u++) + { + case '\\': + printf("\\\\"); + break; + case '"': + if (test & TEST_DELIMIT) + printf("\\\""); + else + printf("\""); + break; + case '\a': + printf("\\a"); + break; + case '\b': + printf("\\b"); + break; + case 033: + printf("\\e"); + break; + case '\f': + printf("\\f"); + break; + case '\n': + printf("\\n"); + break; + case '\r': + printf("\\r"); + break; + case '\t': + printf("\\t"); + break; + case '\v': + printf("\\v"); + break; + default: +#ifdef MB_CUR_MAX + s = (char*)u - 1; + if ((w = mblen(s, (char*)e - s)) > 1) + { + u += w - 1; + fwrite(s, 1, w, stdout); + } + else +#endif + if (!iscntrl(c) && isprint(c)) + putchar(c); + else + printf("\\x%02x", c); + break; + } + if (test & TEST_DELIMIT) + printf("\""); + } + else + printf("%s", s); +} + +static void +report(char* comment, char* fun, char* re, char* s, int len, char* msg, int flags, unsigned long test) +{ + if (state.file) + printf("%s:", state.file); + printf("%d:", state.lineno); + if (re) + { + printf(" "); + quote(re, -1, test|TEST_DELIMIT); + if (s) + { + printf(" versus "); + quote(s, len, test|TEST_DELIMIT); + } + } + if (test & TEST_UNSPECIFIED) + { + state.unspecified++; + printf(" unspecified behavior"); + } + else + state.errors++; + if (state.which) + printf(" %s", state.which); + if (flags & REG_NOSUB) + printf(" NOSUB"); + if (fun) + printf(" %s", fun); + if (comment[strlen(comment)-1] == '\n') + printf(" %s", comment); + else + { + printf(" %s: ", comment); + if (msg) + printf("%s: ", msg); + } +} + +static void +error(regex_t* preg, int code) +{ + char* msg; + char buf[256]; + + switch (code) + { + case REG_EBUS: + msg = "bus error"; + break; + case REG_EFAULT: + msg = "memory fault"; + break; + case REG_EHUNG: + msg = "did not terminate"; + break; + default: + regerror(code, preg, msg = buf, sizeof buf); + break; + } + printf("%s\n", msg); +} + +static void +bad(char* comment, char* re, char* s, int len, unsigned long test) +{ + printf("bad test case "); + report(comment, NiL, re, s, len, NiL, 0, test); + exit(1); +} + +static int +escape(char* s) +{ + char* b; + char* t; + char* q; + char* e; + int c; + + for (b = t = s; *t = *s; s++, t++) + if (*s == '\\') + switch (*++s) + { + case '\\': + break; + case 'a': + *t = '\a'; + break; + case 'b': + *t = '\b'; + break; + case 'c': + if (*t = *++s) + *t &= 037; + else + s--; + break; + case 'e': + case 'E': + *t = 033; + break; + case 'f': + *t = '\f'; + break; + case 'n': + *t = '\n'; + break; + case 'r': + *t = '\r'; + break; + case 's': + *t = ' '; + break; + case 't': + *t = '\t'; + break; + case 'v': + *t = '\v'; + break; + case 'u': + case 'x': + c = 0; + q = c == 'u' ? (s + 5) : (char*)0; + e = s + 1; + while (!e || !q || s < q) + { + switch (*++s) + { + case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': + c = (c << 4) + *s - 'a' + 10; + continue; + case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': + c = (c << 4) + *s - 'A' + 10; + continue; + case '0': case '1': case '2': case '3': case '4': + case '5': case '6': case '7': case '8': case '9': + c = (c << 4) + *s - '0'; + continue; + case '{': + case '[': + if (s != e) + { + s--; + break; + } + e = 0; + continue; + case '}': + case ']': + if (e) + s--; + break; + default: + s--; + break; + } + break; + } + *t = c; + break; + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + c = *s - '0'; + q = s + 2; + while (s < q) + { + switch (*++s) + { + case '0': case '1': case '2': case '3': + case '4': case '5': case '6': case '7': + c = (c << 3) + *s - '0'; + break; + default: + q = --s; + break; + } + } + *t = c; + break; + default: + *(s + 1) = 0; + bad("invalid C \\ escape\n", s - 1, NiL, 0, 0); + } + return t - b; +} + +static void +matchoffprint(int off) +{ + switch (off) + { + case -2: + printf("X"); + break; + case -1: + printf("?"); + break; + default: + printf("%d", off); + break; + } +} + +static void +matchprint(regmatch_t* match, int nmatch, int nsub, char* ans, unsigned long test) +{ + int i; + + for (; nmatch > nsub + 1; nmatch--) + if ((match[nmatch-1].rm_so != -1 || match[nmatch-1].rm_eo != -1) && (!(test & TEST_IGNORE_POSITION) || match[nmatch-1].rm_so >= 0 && match[nmatch-1].rm_eo >= 0)) + break; + for (i = 0; i < nmatch; i++) + { + printf("("); + matchoffprint(match[i].rm_so); + printf(","); + matchoffprint(match[i].rm_eo); + printf(")"); + } + if (!(test & (TEST_ACTUAL|TEST_BASELINE))) + { + if (ans) + printf(" expected: %s", ans); + printf("\n"); + } +} + +static int +matchcheck(regmatch_t* match, int nmatch, int nsub, char* ans, char* re, char* s, int len, int flags, unsigned long test) +{ + char* p; + int i; + int m; + int n; + + if (streq(ans, "OK")) + return test & (TEST_BASELINE|TEST_PASS|TEST_VERIFY); + for (i = 0, p = ans; i < nmatch && *p; i++) + { + if (*p == '{') + { +#ifdef REG_DISCIPLINE + char* x; + + if (!(x = sfstruse(state.disc.sp))) + bad("out of space [discipline string]\n", NiL, NiL, 0, 0); + if (strcmp(p, x)) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + return 0; + report("callout failed", NiL, re, s, len, NiL, flags, test); + quote(p, -1, test); + printf(" expected, "); + quote(x, -1, test); + printf(" returned\n"); + } +#endif + break; + } + if (*p++ != '(') + bad("improper answer\n", re, s, -1, test); + if (*p == '?') + { + m = -1; + p++; + } + else if (*p == 'R' && !memcmp(p, "RE_DUP_MAX", 10)) + { + m = RE_DUP_MAX; + p += 10; + if (*p == '+' || *p == '-') + m += strtol(p, &p, 10); + } + else + m = strtol(p, &p, 10); + if (*p++ != ',') + bad("improper answer\n", re, s, -1, test); + if (*p == '?') + { + n = -1; + p++; + } + else if (*p == 'R' && !memcmp(p, "RE_DUP_MAX", 10)) + { + n = RE_DUP_MAX; + p += 10; + if (*p == '+' || *p == '-') + n += strtol(p, &p, 10); + } + else + n = strtol(p, &p, 10); + if (*p++ != ')') + bad("improper answer\n", re, s, -1, test); + if (m!=match[i].rm_so || n!=match[i].rm_eo) + { + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))) + { + report("failed: match was", NiL, re, s, len, NiL, flags, test); + matchprint(match, nmatch, nsub, ans, test); + } + return 0; + } + } + for (; i < nmatch; i++) + { + if (match[i].rm_so!=-1 || match[i].rm_eo!=-1) + { + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_VERIFY))) + { + if ((test & TEST_IGNORE_POSITION) && (match[i].rm_so<0 || match[i].rm_eo<0)) + { + state.ignored++; + return 0; + } + if (!(test & TEST_SUMMARY)) + { + report("failed: match was", NiL, re, s, len, NiL, flags, test); + matchprint(match, nmatch, nsub, ans, test); + } + } + return 0; + } + } + if (!(test & TEST_IGNORE_OVER) && match[nmatch].rm_so != state.NOMATCH.rm_so) + { + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY))) + { + report("failed: overran match array", NiL, re, s, len, NiL, flags, test); + matchprint(match, nmatch + 1, nsub, NiL, test); + } + return 0; + } + return 1; +} + +static void +sigunblock(int s) +{ +#ifdef SIG_SETMASK + int op; + sigset_t mask; + + sigemptyset(&mask); + if (s) + { + sigaddset(&mask, s); + op = SIG_UNBLOCK; + } + else op = SIG_SETMASK; + sigprocmask(op, &mask, NiL); +#else +#ifdef sigmask + sigsetmask(s ? (sigsetmask(0L) & ~sigmask(s)) : 0L); +#endif +#endif +} + +static void +gotcha(int sig) +{ + int ret; + + signal(sig, gotcha); + alarm(0); + state.signals++; + switch (sig) + { + case SIGALRM: + ret = REG_EHUNG; + break; + case SIGBUS: + ret = REG_EBUS; + break; + default: + ret = REG_EFAULT; + break; + } + sigunblock(sig); + longjmp(state.gotcha, ret); +} + +static char* +getline(FILE* fp) +{ + static char buf[32 * 1024]; + + register char* s = buf; + register char* e = &buf[sizeof(buf)]; + register char* b; + + for (;;) + { + if (!(b = fgets(s, e - s, fp))) + return 0; + state.lineno++; + s += strlen(s); + if (s == b || *--s != '\n' || s == b || *(s - 1) != '\\') + { + *s = 0; + break; + } + s--; + } + return buf; +} + +static unsigned long +note(unsigned long level, char* msg, unsigned long skip, unsigned long test) +{ + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY)) && !skip) + { + printf("NOTE\t"); + if (msg) + printf("%s: ", msg); + printf("skipping lines %d", state.lineno); + } + return skip | level; +} + +#define TABS(n) &ts[7-((n)&7)] + +static char ts[] = "\t\t\t\t\t\t\t"; + +static unsigned long +extract(int* tabs, char* spec, char* re, char* s, char* ans, char* msg, char* accept, regmatch_t* match, int nmatch, int nsub, unsigned long skip, unsigned long level, unsigned long test) +{ + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_OK|TEST_PASS|TEST_SUMMARY)) + { + state.extracted = 1; + if (test & TEST_OK) + { + state.passed++; + if ((test & TEST_VERIFY) && !(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY))) + { + if (msg && strcmp(msg, "EXPECTED")) + printf("NOTE\t%s\n", msg); + return skip; + } + test &= ~(TEST_PASS|TEST_QUERY); + } + if (test & (TEST_QUERY|TEST_VERIFY)) + { + if (test & TEST_BASELINE) + test &= ~(TEST_BASELINE|TEST_PASS); + else + test |= TEST_PASS; + skip |= level; + } + if (!(test & TEST_OK)) + { + if (test & TEST_UNSPECIFIED) + state.unspecified++; + else + state.errors++; + } + if (test & (TEST_PASS|TEST_SUMMARY)) + return skip; + test &= ~TEST_DELIMIT; + printf("%s%s", spec, TABS(*tabs++)); + if ((test & (TEST_BASELINE|TEST_SAME)) == (TEST_BASELINE|TEST_SAME)) + printf("SAME"); + else + quote(re, -1, test); + printf("%s", TABS(*tabs++)); + quote(s, -1, test); + printf("%s", TABS(*tabs++)); + if (!(test & (TEST_ACTUAL|TEST_BASELINE)) || !accept && !match) + printf("%s", ans); + else if (accept) + printf("%s", accept); + else + matchprint(match, nmatch, nsub, NiL, test); + if (msg) + printf("%s%s", TABS(*tabs++), msg); + putchar('\n'); + } + else if (test & TEST_QUERY) + skip = note(level, msg, skip, test); + else if (test & TEST_VERIFY) + state.extracted = 1; + return skip; +} + +static int +catchfree(regex_t* preg, int flags, int* tabs, char* spec, char* re, char* s, char* ans, char* msg, char* accept, regmatch_t* match, int nmatch, int nsub, unsigned long skip, unsigned long level, unsigned long test) +{ + int eret; + + if (!(test & TEST_CATCH)) + { + regfree(preg); + eret = 0; + } + else if (!(eret = setjmp(state.gotcha))) + { + alarm(HUNG); + regfree(preg); + alarm(0); + } + else if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + extract(tabs, spec, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test); + else + { + report("failed", "regfree", re, NiL, -1, msg, flags, test); + error(preg, eret); + } + return eret; +} + +static char* +expand(char* os, char* ot) +{ + char* s = os; + char* t; + int n = 0; + int r; + long m; + + for (;;) + { + switch (*s++) + { + case 0: + break; + case '{': + n++; + continue; + case '}': + n--; + continue; + case 'R': + if (n == 1 && !memcmp(s, "E_DUP_MAX", 9)) + { + s--; + for (t = ot; os < s; *t++ = *os++); + r = ((t - ot) >= 5 && t[-1] == '{' && t[-2] == '.' && t[-3] == '.' && t[-4] == '.') ? t[-5] : 0; + os = ot; + m = RE_DUP_MAX; + if (*(s += 10) == '+' || *s == '-') + m += strtol(s, &s, 10); + if (r) + { + t -= 5; + while (m-- > 0) + *t++ = r; + while (*s && *s++ != '}'); + } + else + t += snprintf(t, 32, "%ld", m); + while (*t = *s++) + t++; + break; + } + continue; + default: + continue; + } + break; + } + return os; +} + +int +main(int argc, char** argv) +{ + int flags; + int cflags; + int eflags; + int nmatch; + int nexec; + int nstr; + int cret; + int eret; + int nsub; + int i; + int j; + int expected; + int got; + int locale; + int subunitlen; + int testno; + unsigned long level; + unsigned long skip; + char* p; + char* line; + char* spec; + char* re; + char* s; + char* ans; + char* msg; + char* fun; + char* ppat; + char* subunit; + char* version; + char* field[6]; + char* delim[6]; + FILE* fp; + int tabs[6]; + char unit[64]; + regmatch_t match[100]; + regex_t preg; + + static char pat[32 * 1024]; + static char patbuf[32 * 1024]; + static char strbuf[32 * 1024]; + + int nonosub = REG_NOSUB == 0; + int nonexec = 0; + + unsigned long test = 0; + + static char* filter[] = { "-", 0 }; + + state.NOMATCH.rm_so = state.NOMATCH.rm_eo = -2; + p = unit; + version = (char*)id + 10; + while (p < &unit[sizeof(unit)-1] && (*p = *version++) && !isspace(*p)) + p++; + *p = 0; + while ((p = *++argv) && *p == '-') + for (;;) + { + switch (*++p) + { + case 0: + break; + case 'c': + test |= TEST_CATCH; + continue; + case 'e': + test |= TEST_IGNORE_ERROR; + continue; + case 'h': + case '?': + help(0); + return 2; + case '-': + help(p[1] == 'h'); + return 2; + case 'n': + nonexec = 1; + continue; + case 'o': + test |= TEST_IGNORE_OVER; + continue; + case 'p': + test |= TEST_IGNORE_POSITION; + continue; + case 's': +#ifdef REG_DISCIPLINE + if (!(state.stack = stkalloc(stkstd, 0))) + fprintf(stderr, "%s: out of space [stack]", unit); + state.disc.disc.re_resizef = resizef; + state.disc.disc.re_resizehandle = (void*)stkstd; +#endif + continue; + case 'x': + nonosub = 1; + continue; + case 'v': + test |= TEST_VERBOSE; + continue; + case 'A': + test |= TEST_ACTUAL; + continue; + case 'B': + test |= TEST_BASELINE; + continue; + case 'F': + test |= TEST_FAIL; + continue; + case 'P': + test |= TEST_PASS; + continue; + case 'S': + test |= TEST_SUMMARY; + continue; + default: + fprintf(stderr, "%s: %c: invalid option\n", unit, *p); + return 2; + } + break; + } + if (!*argv) + argv = filter; + locale = 0; + while (state.file = *argv++) + { + if (streq(state.file, "-") || streq(state.file, "/dev/stdin") || streq(state.file, "/dev/fd/0")) + { + state.file = 0; + fp = stdin; + } + else if (!(fp = fopen(state.file, "r"))) + { + fprintf(stderr, "%s: %s: cannot read\n", unit, state.file); + return 2; + } + testno = state.errors = state.ignored = state.lineno = state.passed = + state.signals = state.unspecified = state.warnings = 0; + skip = 0; + level = 1; + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY))) + { + printf("TEST\t%s ", unit); + if (s = state.file) + { + subunit = p = 0; + for (;;) + { + switch (*s++) + { + case 0: + break; + case '/': + subunit = s; + continue; + case '.': + p = s - 1; + continue; + default: + continue; + } + break; + } + if (!subunit) + subunit = state.file; + if (p < subunit) + p = s - 1; + subunitlen = p - subunit; + printf("%-.*s ", subunitlen, subunit); + } + else + subunit = 0; + for (s = version; *s && (*s != ' ' || *(s + 1) != '$'); s++) + putchar(*s); + if (test & TEST_CATCH) + printf(", catch"); + if (test & TEST_IGNORE_ERROR) + printf(", ignore error code mismatches"); + if (test & TEST_IGNORE_POSITION) + printf(", ignore negative position mismatches"); +#ifdef REG_DISCIPLINE + if (state.stack) + printf(", stack"); +#endif + if (test & TEST_VERBOSE) + printf(", verbose"); + printf("\n"); +#ifdef REG_VERSIONID + if (regerror(REG_VERSIONID, NiL, pat, sizeof(pat)) > 0) + s = pat; + else +#endif +#ifdef REG_TEST_VERSION + s = REG_TEST_VERSION; +#else + s = "regex"; +#endif + printf("NOTE\t%s\n", s); + if (elementsof(unsupported) > 1) + { +#if (REG_TEST_DEFAULT & (REG_AUGMENTED|REG_EXTENDED|REG_SHELL)) || !defined(REG_EXTENDED) + i = 0; +#else + i = REG_EXTENDED != 0; +#endif + for (got = 0; i < elementsof(unsupported) - 1; i++) + { + if (!got) + { + got = 1; + printf("NOTE\tunsupported: %s", unsupported[i]); + } + else + printf(",%s", unsupported[i]); + } + if (got) + printf("\n"); + } + } +#ifdef REG_DISCIPLINE + state.disc.disc.re_version = REG_VERSION; + state.disc.disc.re_compf = compf; + state.disc.disc.re_execf = execf; + if (!(state.disc.sp = sfstropen())) + bad("out of space [discipline string stream]\n", NiL, NiL, 0, 0); + preg.re_disc = &state.disc.disc; +#endif + if (test & TEST_CATCH) + { + signal(SIGALRM, gotcha); + signal(SIGBUS, gotcha); + signal(SIGSEGV, gotcha); + } + while (p = getline(fp)) + { + + /* parse: */ + + line = p; + if (*p == ':' && !isspace(*(p + 1))) + { + while (*++p && *p != ':'); + if (!*p++) + { + if (test & TEST_BASELINE) + printf("%s\n", line); + continue; + } + } + while (isspace(*p)) + p++; + if (*p == 0 || *p == '#' || *p == 'T') + { + if (test & TEST_BASELINE) + printf("%s\n", line); + continue; + } + if (*p == ':' || *p == 'N') + { + if (test & TEST_BASELINE) + printf("%s\n", line); + else if (!(test & (TEST_ACTUAL|TEST_FAIL|TEST_PASS|TEST_SUMMARY))) + { + while (*++p && !isspace(*p)); + while (isspace(*p)) + p++; + printf("NOTE %s\n", p); + } + continue; + } + j = 0; + i = 0; + field[i++] = p; + for (;;) + { + switch (*p++) + { + case 0: + p--; + j = 0; + goto checkfield; + case '\t': + *(delim[i] = p - 1) = 0; + j = 1; + checkfield: + s = field[i - 1]; + if (streq(s, "NIL")) + field[i - 1] = 0; + else if (streq(s, "NULL")) + *s = 0; + while (*p == '\t') + { + p++; + j++; + } + tabs[i - 1] = j; + if (!*p) + break; + if (i >= elementsof(field)) + bad("too many fields\n", NiL, NiL, 0, 0); + field[i++] = p; + /*FALLTHROUGH*/ + default: + continue; + } + break; + } + if (!(spec = field[0])) + bad("NIL spec\n", NiL, NiL, 0, 0); + + /* interpret: */ + + cflags = REG_TEST_DEFAULT; + eflags = REG_EXEC_DEFAULT; + test &= TEST_GLOBAL; + state.extracted = 0; + nmatch = 20; + nsub = -1; + for (p = spec; *p; p++) + { + if (isdigit(*p)) + { + nmatch = strtol(p, &p, 10); + if (nmatch >= elementsof(match)) + bad("nmatch must be < 100\n", NiL, NiL, 0, 0); + p--; + continue; + } + switch (*p) + { + case 'A': + test |= TEST_ARE; + continue; + case 'B': + test |= TEST_BRE; + continue; + case 'C': + if (!(test & TEST_QUERY) && !(skip & level)) + bad("locale must be nested\n", NiL, NiL, 0, 0); + test &= ~TEST_QUERY; + if (locale) + bad("locale nesting not supported\n", NiL, NiL, 0, 0); + if (i != 2) + bad("locale field expected\n", NiL, NiL, 0, 0); + if (!(skip & level)) + { +#if defined(LC_COLLATE) && defined(LC_CTYPE) + s = field[1]; + if (!s || streq(s, "POSIX")) + s = "C"; + if ((ans = setlocale(LC_COLLATE, s)) && streq(ans, "POSIX")) + ans = "C"; + if (!ans || !streq(ans, s) && streq(s, "C")) + ans = 0; + else if ((ans = setlocale(LC_CTYPE, s)) && streq(ans, "POSIX")) + ans = "C"; + if (!ans || !streq(ans, s) && streq(s, "C")) + skip = note(level, s, skip, test); + else + { + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY))) + printf("NOTE \"%s\" locale\n", s); + locale = level; + } +#else + skip = note(level, skip, test, "locales not supported"); +#endif + } + cflags = NOTEST; + continue; + case 'E': + test |= TEST_ERE; + continue; + case 'K': + test |= TEST_KRE; + continue; + case 'L': + test |= TEST_LRE; + continue; + case 'S': + test |= TEST_SRE; + continue; + + case 'a': + cflags |= REG_LEFT|REG_RIGHT; + continue; + case 'b': + eflags |= REG_NOTBOL; + continue; + case 'c': + cflags |= REG_COMMENT; + continue; + case 'd': + cflags |= REG_SHELL_DOT; + continue; + case 'e': + eflags |= REG_NOTEOL; + continue; + case 'f': + cflags |= REG_MULTIPLE; + continue; + case 'g': + cflags |= NOTEST; + continue; + case 'h': + cflags |= REG_MULTIREF; + continue; + case 'i': + cflags |= REG_ICASE; + continue; + case 'j': + cflags |= REG_SPAN; + continue; + case 'k': + cflags |= REG_ESCAPE; + continue; + case 'l': + cflags |= REG_LEFT; + continue; + case 'm': + cflags |= REG_MINIMAL; + continue; + case 'n': + cflags |= REG_NEWLINE; + continue; + case 'o': + cflags |= REG_SHELL_GROUP; + continue; + case 'p': + cflags |= REG_SHELL_PATH; + continue; + case 'q': + cflags |= REG_DELIMITED; + continue; + case 'r': + cflags |= REG_RIGHT; + continue; + case 's': + cflags |= REG_SHELL_ESCAPED; + continue; + case 't': + cflags |= REG_MUSTDELIM; + continue; + case 'u': + test |= TEST_UNSPECIFIED; + continue; + case 'v': + cflags |= REG_CLASS_ESCAPE; + continue; + case 'w': + cflags |= REG_NOSUB; + continue; + case 'x': + if (REG_LENIENT) + cflags |= REG_LENIENT; + else + test |= TEST_LENIENT; + continue; + case 'y': + eflags |= REG_LEFT; + continue; + case 'z': + cflags |= REG_NULL; + continue; + + case '$': + test |= TEST_EXPAND; + continue; + + case '/': + test |= TEST_SUB; + continue; + + case '=': + test |= TEST_DECOMP; + continue; + + case '?': + test |= TEST_VERIFY; + test &= ~(TEST_AND|TEST_OR); + state.verify = state.passed; + continue; + case '&': + test |= TEST_VERIFY|TEST_AND; + test &= ~TEST_OR; + continue; + case '|': + test |= TEST_VERIFY|TEST_OR; + test &= ~TEST_AND; + continue; + case ';': + test |= TEST_OR; + test &= ~TEST_AND; + continue; + + case '{': + level <<= 1; + if (skip & (level >> 1)) + { + skip |= level; + cflags = NOTEST; + } + else + { + skip &= ~level; + test |= TEST_QUERY; + } + continue; + case '}': + if (level == 1) + bad("invalid {...} nesting\n", NiL, NiL, 0, 0); + if ((skip & level) && !(skip & (level>>1))) + { + if (!(test & (TEST_BASELINE|TEST_SUMMARY))) + { + if (test & (TEST_ACTUAL|TEST_FAIL)) + printf("}\n"); + else if (!(test & TEST_PASS)) + printf("-%d\n", state.lineno); + } + } +#if defined(LC_COLLATE) && defined(LC_CTYPE) + else if (locale & level) + { + locale = 0; + if (!(skip & level)) + { + s = "C"; + setlocale(LC_COLLATE, s); + setlocale(LC_CTYPE, s); + if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_SUMMARY))) + printf("NOTE \"%s\" locale\n", s); + else if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_PASS)) + printf("}\n"); + } + else if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL)) + printf("}\n"); + } +#endif + level >>= 1; + cflags = NOTEST; + continue; + + default: + bad("bad spec\n", spec, NiL, 0, test); + break; + + } + break; + } + if ((cflags|eflags) == NOTEST || (skip & level) && (test & TEST_BASELINE)) + { + if (test & TEST_BASELINE) + { + while (i > 1) + *delim[--i] = '\t'; + printf("%s\n", line); + } + continue; + } + if (test & TEST_OR) + { + if (!(test & TEST_VERIFY)) + { + test &= ~TEST_OR; + if (state.passed == state.verify && i > 1) + printf("NOTE\t%s\n", field[1]); + continue; + } + else if (state.passed > state.verify) + continue; + } + else if (test & TEST_AND) + { + if (state.passed == state.verify) + continue; + state.passed = state.verify; + } + if (i < ((test & TEST_DECOMP) ? 3 : 4)) + bad("too few fields\n", NiL, NiL, 0, test); + while (i < elementsof(field)) + field[i++] = 0; + if (re = field[1]) + { + if (streq(re, "SAME")) + { + re = ppat; + test |= TEST_SAME; + } + else + { + if (test & TEST_EXPAND) + escape(re); + re = expand(re, patbuf); + strcpy(ppat = pat, re); + } + } + else + ppat = 0; + nstr = -1; + if (s = field[2]) + { + s = expand(s, strbuf); + if (test & TEST_EXPAND) + { + nstr = escape(s); +#if _REG_nexec + if (nstr != strlen(s)) + nexec = nstr; +#endif + } + } + if (!(ans = field[(test & TEST_DECOMP) ? 2 : 3])) + bad("NIL answer\n", NiL, NiL, 0, test); + msg = field[4]; + fflush(stdout); + if (test & TEST_SUB) +#if _REG_subcomp + cflags |= REG_DELIMITED; +#else + continue; +#endif +#if !_REG_decomp + if (test & TEST_DECOMP) + continue; +#endif + + compile: + + if (state.extracted || (skip & level)) + continue; +#if !(REG_TEST_DEFAULT & (REG_AUGMENTED|REG_EXTENDED|REG_SHELL)) +#ifdef REG_EXTENDED + if (REG_EXTENDED != 0 && (test & TEST_BRE)) +#else + if (test & TEST_BRE) +#endif + { + test &= ~TEST_BRE; + flags = cflags; + state.which = "BRE"; + } + else +#endif +#ifdef REG_EXTENDED + if (test & TEST_ERE) + { + test &= ~TEST_ERE; + flags = cflags | REG_EXTENDED; + state.which = "ERE"; + } + else +#endif +#ifdef REG_AUGMENTED + if (test & TEST_ARE) + { + test &= ~TEST_ARE; + flags = cflags | REG_AUGMENTED; + state.which = "ARE"; + } + else +#endif +#ifdef REG_LITERAL + if (test & TEST_LRE) + { + test &= ~TEST_LRE; + flags = cflags | REG_LITERAL; + state.which = "LRE"; + } + else +#endif +#ifdef REG_SHELL + if (test & TEST_SRE) + { + test &= ~TEST_SRE; + flags = cflags | REG_SHELL; + state.which = "SRE"; + } + else +#ifdef REG_AUGMENTED + if (test & TEST_KRE) + { + test &= ~TEST_KRE; + flags = cflags | REG_SHELL | REG_AUGMENTED; + state.which = "KRE"; + } + else +#endif +#endif + { + if (test & (TEST_BASELINE|TEST_PASS|TEST_VERIFY)) + extract(tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test|TEST_OK); + continue; + } + if ((test & (TEST_QUERY|TEST_VERBOSE|TEST_VERIFY)) == TEST_VERBOSE) + { + printf("test %-3d %s ", state.lineno, state.which); + quote(re, -1, test|TEST_DELIMIT); + printf(" "); + quote(s, nstr, test|TEST_DELIMIT); + printf("\n"); + } + + nosub: + fun = "regcomp"; +#if _REG_nexec + if (nstr >= 0 && nstr != strlen(s)) + nexec = nstr; + + else +#endif + nexec = -1; + if (state.extracted || (skip & level)) + continue; + if (!(test & TEST_QUERY)) + testno++; +#ifdef REG_DISCIPLINE + if (state.stack) + stkset(stkstd, state.stack, 0); + flags |= REG_DISCIPLINE; + state.disc.ordinal = 0; + sfstrseek(state.disc.sp, 0, SEEK_SET); +#endif + if (!(test & TEST_CATCH)) + cret = regcomp(&preg, re, flags); + else if (!(cret = setjmp(state.gotcha))) + { + alarm(HUNG); + cret = regcomp(&preg, re, flags); + alarm(0); + } +#if _REG_subcomp + if (!cret && (test & TEST_SUB)) + { + fun = "regsubcomp"; + p = re + preg.re_npat; + if (!(test & TEST_CATCH)) + cret = regsubcomp(&preg, p, NiL, 0, 0); + else if (!(cret = setjmp(state.gotcha))) + { + alarm(HUNG); + cret = regsubcomp(&preg, p, NiL, 0, 0); + alarm(0); + } + if (!cret && *(p += preg.re_npat) && !(preg.re_sub->re_flags & REG_SUB_LAST)) + { + if (catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test)) + continue; + cret = REG_EFLAGS; + } + } +#endif +#if _REG_decomp + if (!cret && (test & TEST_DECOMP)) + { + char buf[128]; + + if ((j = nmatch) > sizeof(buf)) + j = sizeof(buf); + fun = "regdecomp"; + p = re + preg.re_npat; + if (!(test & TEST_CATCH)) + i = regdecomp(&preg, -1, buf, j); + else if (!(cret = setjmp(state.gotcha))) + { + alarm(HUNG); + i = regdecomp(&preg, -1, buf, j); + alarm(0); + } + if (!cret) + { + catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test); + if (i > j) + { + if (i != (strlen(ans) + 1)) + { + report("failed", fun, re, s, nstr, msg, flags, test); + printf(" %d byte buffer supplied, %d byte buffer required\n", j, i); + } + } + else if (strcmp(buf, ans)) + { + report("failed", fun, re, s, nstr, msg, flags, test); + quote(ans, -1, test|TEST_DELIMIT); + printf(" expected, "); + quote(buf, -1, test|TEST_DELIMIT); + printf(" returned\n"); + } + continue; + } + } +#endif + if (!cret) + { + if (!(flags & REG_NOSUB) && nsub < 0 && *ans == '(') + { + for (p = ans; *p; p++) + if (*p == '(') + nsub++; + else if (*p == '{') + nsub--; + if (nsub >= 0) + { + if (test & TEST_IGNORE_OVER) + { + if (nmatch > nsub) + nmatch = nsub + 1; + } + else if (nsub != preg.re_nsub) + { + if (nsub > preg.re_nsub) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, "OK", NiL, 0, 0, skip, level, test|TEST_DELIMIT); + else + { + report("re_nsub incorrect", fun, re, NiL, -1, msg, flags, test); + printf("at least %d expected, %d returned\n", nsub, preg.re_nsub); + state.errors++; + } + } + else + nsub = preg.re_nsub; + } + } + } + if (!(test & (TEST_DECOMP|TEST_SUB)) && *ans && *ans != '(' && !streq(ans, "OK") && !streq(ans, "NOMATCH")) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, "OK", NiL, 0, 0, skip, level, test|TEST_DELIMIT); + else if (!(test & TEST_LENIENT)) + { + report("failed", fun, re, NiL, -1, msg, flags, test); + printf("%s expected, OK returned\n", ans); + } + catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test); + continue; + } + } + else + { + if (test & TEST_LENIENT) + /* we'll let it go this time */; + else if (!*ans || ans[0]=='(' || cret == REG_BADPAT && streq(ans, "NOMATCH")) + { + got = 0; + for (i = 1; i < elementsof(codes); i++) + if (cret==codes[i].code) + got = i; + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, codes[got].name, NiL, 0, 0, skip, level, test|TEST_DELIMIT); + else + { + report("failed", fun, re, NiL, -1, msg, flags, test); + printf("%s returned: ", codes[got].name); + error(&preg, cret); + } + } + else + { + expected = got = 0; + for (i = 1; i < elementsof(codes); i++) + { + if (streq(ans, codes[i].name)) + expected = i; + if (cret==codes[i].code) + got = i; + } + if (!expected) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, codes[got].name, NiL, 0, 0, skip, level, test|TEST_DELIMIT); + else + { + report("failed: invalid error code", NiL, re, NiL, -1, msg, flags, test); + printf("%s expected, %s returned\n", ans, codes[got].name); + } + } + else if (cret != codes[expected].code && cret != REG_BADPAT) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, codes[got].name, NiL, 0, 0, skip, level, test|TEST_DELIMIT); + else if (test & TEST_IGNORE_ERROR) + state.ignored++; + else + { + report("should fail and did", fun, re, NiL, -1, msg, flags, test); + printf("%s expected, %s returned: ", ans, codes[got].name); + state.errors--; + state.warnings++; + error(&preg, cret); + } + } + } + goto compile; + } + +#if _REG_nexec + execute: + if (nexec >= 0) + fun = "regnexec"; + else +#endif + fun = "regexec"; + + for (i = 0; i < elementsof(match); i++) + match[i] = state.NOMATCH; + +#if _REG_nexec + if (nexec >= 0) + { + eret = regnexec(&preg, s, nexec, nmatch, match, eflags); + s[nexec] = 0; + } + else +#endif + { + if (!(test & TEST_CATCH)) + eret = regexec(&preg, s, nmatch, match, eflags); + else if (!(eret = setjmp(state.gotcha))) + { + alarm(HUNG); + eret = regexec(&preg, s, nmatch, match, eflags); + alarm(0); + } + } +#if _REG_subcomp + if ((test & TEST_SUB) && !eret) + { + fun = "regsubexec"; + if (!(test & TEST_CATCH)) + eret = regsubexec(&preg, s, nmatch, match); + else if (!(eret = setjmp(state.gotcha))) + { + alarm(HUNG); + eret = regsubexec(&preg, s, nmatch, match); + alarm(0); + } + } +#endif + if (flags & REG_NOSUB) + { + if (eret) + { + if (eret != REG_NOMATCH || !streq(ans, "NOMATCH")) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, "NOMATCH", NiL, 0, 0, skip, level, test|TEST_DELIMIT); + else + { + report("REG_NOSUB failed", fun, re, s, nstr, msg, flags, test); + error(&preg, eret); + } + } + } + else if (streq(ans, "NOMATCH")) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, NiL, match, nmatch, nsub, skip, level, test|TEST_DELIMIT); + else + { + report("should fail and didn't", fun, re, s, nstr, msg, flags, test); + error(&preg, eret); + } + } + } + else if (eret) + { + if (eret != REG_NOMATCH || !streq(ans, "NOMATCH")) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, "NOMATCH", NiL, 0, nsub, skip, level, test|TEST_DELIMIT); + else + { + report("failed", fun, re, s, nstr, msg, flags, test); + if (eret != REG_NOMATCH) + error(&preg, eret); + else if (*ans) + printf("expected: %s\n", ans); + else + printf("\n"); + } + } + } + else if (streq(ans, "NOMATCH")) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, NiL, match, nmatch, nsub, skip, level, test|TEST_DELIMIT); + else + { + report("should fail and didn't", fun, re, s, nstr, msg, flags, test); + matchprint(match, nmatch, nsub, NiL, test); + } + } +#if _REG_subcomp + else if (test & TEST_SUB) + { + p = preg.re_sub->re_buf; + if (strcmp(p, ans)) + { + report("failed", fun, re, s, nstr, msg, flags, test); + quote(ans, -1, test|TEST_DELIMIT); + printf(" expected, "); + quote(p, -1, test|TEST_DELIMIT); + printf(" returned\n"); + } + } +#endif + else if (!*ans) + { + if (match[0].rm_so != state.NOMATCH.rm_so) + { + if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test); + else + { + report("failed: no match but match array assigned", NiL, re, s, nstr, msg, flags, test); + matchprint(match, nmatch, nsub, NiL, test); + } + } + } + else if (matchcheck(match, nmatch, nsub, ans, re, s, nstr, flags, test)) + { +#if _REG_nexec + if (nexec < 0 && !nonexec) + { + nexec = nstr >= 0 ? nstr : strlen(s); + s[nexec] = '\n'; + testno++; + goto execute; + } +#endif + if (!(test & (TEST_DECOMP|TEST_SUB|TEST_VERIFY)) && !nonosub) + { + if (catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test)) + continue; + flags |= REG_NOSUB; + goto nosub; + } + if (test & (TEST_BASELINE|TEST_PASS|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, NiL, match, nmatch, nsub, skip, level, test|TEST_OK); + } + else if (test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS|TEST_QUERY|TEST_SUMMARY|TEST_VERIFY)) + skip = extract(tabs, line, re, s, ans, msg, NiL, match, nmatch, nsub, skip, level, test|TEST_DELIMIT); + if (catchfree(&preg, flags, tabs, line, re, s, ans, msg, NiL, NiL, 0, 0, skip, level, test)) + continue; + goto compile; + } + if (test & TEST_SUMMARY) + printf("tests=%-4d errors=%-4d warnings=%-2d ignored=%-2d unspecified=%-2d signals=%d\n", testno, state.errors, state.warnings, state.ignored, state.unspecified, state.signals); + else if (!(test & (TEST_ACTUAL|TEST_BASELINE|TEST_FAIL|TEST_PASS))) + { + printf("TEST\t%s", unit); + if (subunit) + printf(" %-.*s", subunitlen, subunit); + printf(", %d test%s", testno, testno == 1 ? "" : "s"); + if (state.ignored) + printf(", %d ignored mismatche%s", state.ignored, state.ignored == 1 ? "" : "s"); + if (state.warnings) + printf(", %d warning%s", state.warnings, state.warnings == 1 ? "" : "s"); + if (state.unspecified) + printf(", %d unspecified difference%s", state.unspecified, state.unspecified == 1 ? "" : "s"); + if (state.signals) + printf(", %d signal%s", state.signals, state.signals == 1 ? "" : "s"); + printf(", %d error%s\n", state.errors, state.errors == 1 ? "" : "s"); + } + if (fp != stdin) + fclose(fp); + } + return 0; +} diff --git a/tests/runtests b/tests/runtests new file mode 100644 index 0000000..abf8ea7 --- /dev/null +++ b/tests/runtests @@ -0,0 +1,69 @@ +#!/bin/bash -e +# Copyright 2009-2014 Apple Inc. All rights reserved. + +BINDIR="%%BINDIR%%" +BINDIR="${BINDIR/%%*%%/.}" + +# If not already set by bsdtesttool +if [ -z "$BSDTESTS_TMPDIR" ]; then + BSDTESTS_TMPDIR="$(mktemp -d -t bsdtests)/" + export BSDTESTS_TMPDIR + echo "Using temp dir $BSDTESTS_TMPDIR" +fi + +function dotest { + T="\"$BINDIR\"/bsdtestharness ./$1" + LOG="${BSDTESTS_TMPDIR}$1${2:+.$2}" + SEP="\n**** %-40s ****\n" + + if [ -n "$BSDTESTS_STRESS" ]; then + x=0 + while (( x < BSDTESTS_STRESS )); do + printf "$SEP" "$1 $2 stress $x" + eval $ENVIRON $T 2>&1 | tee -a "$LOG.$x.testlog" + let x+=1 + done + else + printf "$SEP" "$1 $2" + eval $ENVIRON $T 2>&1 | tee -a "$LOG.testlog" + if [ -z "$BSDTESTS_PREBUILD" ]; then + printf "$SEP" "$1 debug $2" + eval $ENVIRON DYLD_IMAGE_SUFFIX=_debug $T 2>&1 | tee -a "$LOG.debuglog" + fi + fi +} + +function runtest { + echo; echo " Libc test: $1 ..." + ENVIRON="LIBDISPATCH_LOG=NO" + dotest "$1" + if [ -n "$(lipo -info /usr/lib/libSystem.dylib 2>&- | grep i386)" \ + -a "$(sysctl -n hw.optional.x86_64 2>&-)" = "1" ]; then + ENVIRON="$ENVIRON BSDTEST_ARCH=i386" + dotest "$1" "i386" + fi +} + +cd $(dirname $0) +rm -f "${BSDTESTS_TMPDIR}"*.{test,debug,gctest,gcdebug,leaks}log + +if [ "$1" == "--nosummary" ]; then + NOSUMMARY=1; shift +fi + +if [ "$#" -gt 0 ]; then + if [ "$1" == "--help" ]; then + echo "Usage: $0 [--nosummary] [||...]"; + echo " --nosummary run all tests but do not summarize results at the end" + exit 0; + fi + for T in "$@"; do runtest $T; done +else + for T in $(cat test_list.txt); do runtest $T; done +fi + +if [ -z "$NOSUMMARY" -a -x "$BINDIR"/bsdtestsummarize ]; then + shopt -s nullglob + cat "${BSDTESTS_TMPDIR}"*.{test,debug,gctest,gcdebug}log | "$BINDIR"/bsdtestsummarize +fi + diff --git a/tests/strlcat.c b/tests/strlcat.c new file mode 100644 index 0000000..6e649d1 --- /dev/null +++ b/tests/strlcat.c @@ -0,0 +1,56 @@ +#include +#include +#include +#include + +static const char* qbf = "The quick brown fox jumps over the lazy dog"; +static const char* lynx = "Lynx c.q. vos prikt bh: dag zwemjuf!"; + +int +main(void) +{ + test_start("strlcat"); + + void *ptr = mmap(NULL, PAGE_SIZE*2, PROT_READ|PROT_WRITE, MAP_ANON|MAP_PRIVATE, -1, 0); + test_ptr_not("mmap", ptr, MAP_FAILED); + + test_errno("mprotect", mprotect(ptr+PAGE_SIZE, PAGE_SIZE, PROT_READ), 0); + + off_t offset = strlen(qbf)+strlen(lynx)+1; + char *dst = (ptr+PAGE_SIZE)-offset; + strcpy(dst, qbf); + + size_t res = strlcat(dst, lynx, offset); + test_long("strlcat", res, offset-1); + test_long("memcmp", memcmp(dst, qbf, strlen(qbf)), 0); + test_long("memcmp", memcmp(dst+strlen(qbf), lynx, strlen(lynx)), 0); + test_long("null-term", dst[offset], 0); + + memset(ptr, '\0', PAGE_SIZE); + + offset = strlen(qbf)+(strlen(lynx)/2)+1; + dst = (ptr+PAGE_SIZE)-offset; + strcpy(dst, qbf); + + res = strlcat(dst, lynx, offset); + test_long("strlcat", res, strlen(qbf)+strlen(lynx)); + test_long("memcmp", memcmp(dst, qbf, strlen(qbf)), 0); + test_long("memcmp", memcmp(dst+strlen(qbf), lynx, offset-strlen(qbf)-1), 0); + test_long("overrun", *(char*)(ptr+PAGE_SIZE), 0); + test_long("null-term", dst[offset], 0); + + memset(ptr, '\0', PAGE_SIZE); + + offset = strlen(qbf)-4; + dst = (ptr+PAGE_SIZE)-offset; + strncpy(dst, qbf, offset); + + res = strlcat(dst, lynx, offset); + test_long("strlcat", res, offset+strlen(lynx)); + test_long("memcmp", memcmp(dst, qbf, offset), 0); + test_long("overrun", *(char*)(ptr+PAGE_SIZE), 0); + test_long("null-term", dst[offset], 0); + + test_stop(); + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/tests/test_list.txt b/tests/test_list.txt new file mode 100644 index 0000000..0a17ea1 --- /dev/null +++ b/tests/test_list.txt @@ -0,0 +1,3 @@ +nxheap +strlcat +psort diff --git a/xcodescripts/abort_unsupported.sh b/xcodescripts/abort_unsupported.sh new file mode 100755 index 0000000..b817d28 --- /dev/null +++ b/xcodescripts/abort_unsupported.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +for platform in ${SUPPORTED_PLATFORMS} ; do + [[ "${platform}" == "${PLATFORM_NAME}" ]] && exit 0 +done + +echo "Unsupported platform encountered:" >&2 +echo " PLATFORM_NAME: ${PLATFORM_NAME}" >&2 +echo " SUPPORTED_PLATFORMS: ${SUPPORTED_PLATFORMS}" >&2 +echo "Please contact the Darwin Runtime Team for help with your new platform bringup needs" >&2 +exit 1 diff --git a/xcodescripts/eos.xcconfig b/xcodescripts/eos.xcconfig index 4cb19c9..d0b87e7 100644 --- a/xcodescripts/eos.xcconfig +++ b/xcodescripts/eos.xcconfig @@ -15,8 +15,12 @@ VERSIONING_SYSTEM = apple-generic // Variants. All variants contain all source files but all excluded. Specific variants then include the files they need. EXCLUDED_SOURCE_FILE_NAMES = * EXCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*] = $(VARIANT_EOS_EXCLUDED_FILES) +EXCLUDED_SOURCE_FILE_NAMES[sdk=watchos*] = $(VARIANT_EOS_EXCLUDED_FILES) +EXCLUDED_SOURCE_FILE_NAMES[sdk=appletvos*] = $(VARIANT_EOS_EXCLUDED_FILES) INCLUDED_SOURCE_FILE_NAMES = INCLUDED_SOURCE_FILE_NAMES[sdk=iphoneos*] = $(VARIANT_EOS_INCLUDED_FILES) +INCLUDED_SOURCE_FILE_NAMES[sdk=watchos*] = $(VARIANT_EOS_INCLUDED_FILES) +INCLUDED_SOURCE_FILE_NAMES[sdk=appletvos*] = $(VARIANT_EOS_INCLUDED_FILES) VARIANT_PREPROCESSOR_MACROS = -UBUILDING_VARIANT -DVARIANT_DYLD -DVARIANT_EOS -DVARIANT_CANCELABLE -DVARIANT_DARWINEXTSN -U__DARWIN_NON_CANCELABLE -D__DARWIN_NON_CANCELABLE=0 SYSTEM_FRAMEWORK_HEADERS = $(DERIVED_FILES_DIR)/System.framework/Versions/B/PrivateHeaders diff --git a/xcodescripts/generate_features.pl b/xcodescripts/generate_features.pl index 2d1ee9e..df3dd2d 100755 --- a/xcodescripts/generate_features.pl +++ b/xcodescripts/generate_features.pl @@ -227,6 +227,12 @@ for my $arch (split(/ /, $ENV{"ARCHS"})) printf HEADER "/* #undef XPRINTF_PERF */\n"; } + if (defined($features{"FEATURE_SIGNAL_RESTRICTION"})) { + printf HEADER "#define FEATURE_SIGNAL_RESTRICTION 1\n"; + } else { + printf HEADER "/* #undef FEATURE_SIGNAL_RESTRICTION */\n"; + } + printf HEADER "#endif // _LIBC_FEATURES_H_\n"; close HEADER; } diff --git a/xcodescripts/headers.sh b/xcodescripts/headers.sh index 9b02baa..b8c99c9 100755 --- a/xcodescripts/headers.sh +++ b/xcodescripts/headers.sh @@ -25,8 +25,8 @@ UNIFDEFARGS=$(${SRCROOT}/xcodescripts/generate_features.pl --unifdef) INCDIR=${DSTROOT}/${PUBLIC_HEADERS_FOLDER_PATH} LOCINCDIR=${DSTROOT}/${PRIVATE_HEADERS_FOLDER_PATH} -SYSTEMFRAMEWORK=${DSTROOT}/${INSTALL_PATH_PREFIX}/System/Library/Frameworks/System.framework -KERNELFRAMEWORK=${DSTROOT}/${INSTALL_PATH_PREFIX}/System/Library/Frameworks/Kernel.framework +SYSTEMFRAMEWORK=${DSTROOT}/System/Library/Frameworks/System.framework +KERNELFRAMEWORK=${DSTROOT}/System/Library/Frameworks/Kernel.framework PRIVHDRS=${SYSTEMFRAMEWORK}/Versions/B/PrivateHeaders PRIVKERNELHDRS=${KERNELFRAMEWORK}/Versions/A/PrivateHeaders @@ -91,7 +91,6 @@ INC_INSTHDRS=( signal.h stab.h standards.h - stdbool.h stddef.h stdio.h stdint.h diff --git a/xcodescripts/libc.xcconfig b/xcodescripts/libc.xcconfig index 803d013..125f0c8 100644 --- a/xcodescripts/libc.xcconfig +++ b/xcodescripts/libc.xcconfig @@ -1,8 +1,7 @@ #include "/Makefiles/CoreOS/Xcode/BSD.xcconfig" -#include "/AppleInternal/XcodeConfig/SimulatorSupport.xcconfig" // Standard settings -SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator iphoneosnano iphonesimulatornano +SUPPORTED_PLATFORMS = macosx iphoneos iphonesimulator appletvos appletvsimulator watchos watchsimulator iphoneosnano iphonesimulatornano SRCROOT_SEARCH_PATHS = $(SRCROOT) $(SRCROOT)/include $(SRCROOT)/gen $(SRCROOT)/locale $(SRCROOT)/locale/FreeBSD $(SRCROOT)/stdtime/FreeBSD $(SRCROOT)/darwin SYSTEM_FRAMEWORK_HEADERS = $(SDKROOT)/System/Library/Frameworks/System.framework/PrivateHeaders HEADER_SEARCH_PATHS = $($(TARGET_NAME)_SEARCH_PATHS) $(DERIVED_FILES_DIR)/dtrace $(SRCROOT_SEARCH_PATHS) $(SYSTEM_FRAMEWORK_HEADERS) $(SDKROOT)/usr/local/include $(inherited) @@ -16,10 +15,16 @@ GCC_SYMBOLS_PRIVATE_EXTERN = NO GCC_DYNAMIC_NO_PIC = NO GCC_THUMB_SUPPORT = YES GCC_TREAT_IMPLICIT_FUNCTION_DECLARATIONS_AS_ERRORS = YES; + +//CLANG_WARN_INT_CONVERSION = YES +//CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES +//GCC_WARN_64_TO_32_BIT_CONVERSION = YES +//GCC_WARN_SHADOW = YES GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNUSED_VARIABLE = YES; GCC_WARN_ABOUT_RETURN_TYPE = YES; -WARNING_CFLAGS = "-Wall"; +//WARNING_CFLAGS = -Wall -Wextra +WARNING_CFLAGS = -Wall COPY_PHASE_STRIP = NO SKIP_INSTALL = YES @@ -37,17 +42,15 @@ GCC_VERSION = com.apple.compilers.llvm.clang.1_0 GCC_VERSION[arch=armv6] = com.apple.compilers.llvmgcc42 EXECUTABLE_PREFIX = libsystem_ -INSTALL_PATH_ACTUAL = /usr/lib/system -INSTALL_PATH[sdk=macos*]=$(INSTALL_PATH_ACTUAL) -PUBLIC_HEADERS_FOLDER_PATH = $(INSTALL_PATH_PREFIX)/usr/include -PRIVATE_HEADERS_FOLDER_PATH = $(INSTALL_PATH_PREFIX)/usr/local/include +INSTALL_PATH = /usr/lib/system +PUBLIC_HEADERS_FOLDER_PATH = /usr/include +PRIVATE_HEADERS_FOLDER_PATH = /usr/local/include // Simulator -EXECUTABLE_PREFIX[sdk=*simulator*] = libsystem_sim_ - BASE_PREPROCESSOR_MACROS = __LIBC__ __DARWIN_UNIX03=1 __DARWIN_64_BIT_INO_T=1 __DARWIN_NON_CANCELABLE=1 __DARWIN_VERS_1050=1 _FORTIFY_SOURCE=0 OTHER_CFLAGS = -fdollars-in-identifiers -fno-common -fverbose-asm $($(TARGET_NAME)_CFLAGS) $(VARIANT_PREPROCESSOR_MACROS) OTHER_CFLAGS_debug = -fstack-protector -fno-inline -O0 -DDEBUG=1 +SIM_SUFFIX[sdk=*simulator*] = _sim GCC_PREPROCESSOR_DEFINITIONS = $(BASE_PREPROCESSOR_MACROS) GCC_PREPROCESSOR_DEFINITIONS[sdk=iphone*] = $(BASE_PREPROCESSOR_MACROS) LIBC_NO_LIBCRASHREPORTERCLIENT=1 @@ -56,20 +59,16 @@ GCC_PREPROCESSOR_DEFINITIONS[sdk=iphone*] = $(BASE_PREPROCESSOR_MACROS) LIBC_NO_ CR_LDFLAGS = -lCrashReporterClient LIBCOMPILER_RT_LDFLAGS = -lcompiler_rt LIBMALLOC_LDFLAGS = -lsystem_malloc -LIBPLATFORM_LDFLAGS = -lsystem_platform -LIBPLATFORM_LDFLAGS[sdk=*simulator*] = -lsystem_sim_platform -LIBPTHREAD_LDFLAGS = -lsystem_pthread -LIBPTHREAD_LDFLAGS[sdk=*simulator*] = -lsystem_sim_pthread -LIBSYSCALL_LDFLAGS = -lsystem_kernel -LIBSYSCALL_LDFLAGS[sdk=*simulator*] = -lsystem_sim_kernel -LIBM_LDFLAGS = -lsystem_m -LIBM_LDFLAGS[sdk=*simulator*] = -lsystem_sim_m +LIBPLATFORM_LDFLAGS = -lsystem$(SIM_SUFFIX)_platform +LIBPTHREAD_LDFLAGS = -lsystem$(SIM_SUFFIX)_pthread +LIBSYSCALL_LDFLAGS = -lsystem$(SIM_SUFFIX)_kernel +LIBM_LDFLAGS = -lsystem$(SIM_SUFFIX)_m LIBDYLD_LDFLAGS = -ldyld LIBSYSTEM_C_LDFLAGS = -all_load -nostdlib -L/usr/lib/system -umbrella System $(CR_LDFLAGS) $(LIBCOMPILER_RT_LDFLAGS) $(LIBDYLD_LDFLAGS) $(LIBSYSCALL_LDFLAGS) $(LIBM_LDFLAGS) $(LIBMALLOC_LDFLAGS) $(LIBPLATFORM_LDFLAGS) $(LIBPTHREAD_LDFLAGS) $(UPWARD_LDFLAGS) -Wl,-interposable_list,$(DERIVED_FILES_DIR)/interposable.list -Wl,-unexported_symbols_list,$(DERIVED_FILES_DIR)/unexport.list -Wl,-alias_list,$(SRCROOT)/string/alias.list -Wl,-order_file,$(SRCROOT)/xcodescripts/Libc.order -Wl,-sectalign,__DATA,__data,1000 @$(BUILT_PRODUCTS_DIR)/$(CURRENT_VARIANT).linklist // TODO: Remove upward links - mostly , macho is for assumes.c UPWARD_LDFLAGS = -Wl,-upward-ldispatch -Wl,-upward-llaunch -Wl,-upward-lmacho -Wl,-upward-lsystem_asl -Wl,-upward-lsystem_blocks -Wl,-upward-lsystem_info -Wl,-upward-lsystem_notify -Wl,-upward-lxpc -UPWARD_LDFLAGS[sdk=*simulator*] = -Wl,-upward-ldispatch -Wl,-upward-lmacho_sim -Wl,-upward-lsystem_sim_asl -Wl,-upward-lsystem_sim_blocks -Wl,-upward-lsystem_sim_info -Wl,-upward-lnotify_sim -Wl,-upward-lxpc +UPWARD_LDFLAGS[sdk=*simulator*] = -Wl,-upward-ldispatch -Wl,-upward-lmacho_sim -Wl,-upward-lsystem_asl -Wl,-upward-lsystem_sim_blocks -Wl,-upward-lsystem_sim_info -Wl,-upward-lsystem_notify -Wl,-upward-lxpc // libPlatform.a architectures ARCH_FAMILY = $(ARCH_FAMILY_$(CURRENT_ARCH)) @@ -82,17 +81,10 @@ ARCH_FAMILY_armv7f = arm ARCH_FAMILY_armv7k = arm // Platform target -Platform_INCLUDED_SOURCE_FILE_NAMES = $(Platform_INCLUDED_SOURCE_FILE_NAMES_$(PLATFORM_NAME)) -Platform_INCLUDED_SOURCE_FILE_NAMES_macosx = $(Platform_INCLUDED_SOURCE_FILE_NAMES_gen) $(Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib) $(Platform_INCLUDED_SOURCE_FILE_NAMES_string) $(Platform_INCLUDED_SOURCE_FILE_NAMES_sys) -Platform_INCLUDED_SOURCE_FILE_NAMES_iphoneos = $(Platform_INCLUDED_SOURCE_FILE_NAMES_gen) $(Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib) $(Platform_INCLUDED_SOURCE_FILE_NAMES_string) $(Platform_INCLUDED_SOURCE_FILE_NAMES_sys) -Platform_INCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(Platform_INCLUDED_SOURCE_FILE_NAMES_gen) $(Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib) $(Platform_INCLUDED_SOURCE_FILE_NAMES_string) -Platform_INCLUDED_SOURCE_FILE_NAMES_iphoneosnano = $(Platform_INCLUDED_SOURCE_FILE_NAMES_iphoneos) -Platform_INCLUDED_SOURCE_FILE_NAMES_iphonesimulatornano = $(Platform_INCLUDED_SOURCE_FILE_NAMES_iphonesimulatornano) - +Platform_INCLUDED_SOURCE_FILE_NAMES = $(Platform_INCLUDED_SOURCE_FILE_NAMES_gen) $(Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib) $(Platform_INCLUDED_SOURCE_FILE_NAMES_string) Platform_INCLUDED_SOURCE_FILE_NAMES_gen = $(ARCH_FAMILY)/gen/*.c $(ARCH_FAMILY)/gen/*.s $(ARCH_FAMILY)/gen/*.S Platform_INCLUDED_SOURCE_FILE_NAMES_stdlib = $(ARCH_FAMILY)/stdlib/*.c $(ARCH_FAMILY)/stdlib/*.s $(ARCH_FAMILY)/stdlib/*.S Platform_INCLUDED_SOURCE_FILE_NAMES_string = $(ARCH_FAMILY)/string/*.c $(ARCH_FAMILY)/string/*.s $(ARCH_FAMILY)/string/*.S -Platform_INCLUDED_SOURCE_FILE_NAMES_sys = $(ARCH_FAMILY)/sys/*.c $(ARCH_FAMILY)/sys/*.s $(ARCH_FAMILY)/sys/*.S // FreeBSD target FreeBSD_CFLAGS = -include $(SRCROOT)/fbsdcompat/_fbsd_compat_.h @@ -129,8 +121,14 @@ BASE_EXCLUDED_SOURCE_FILE_NAMES_armv6 = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_armv7) BASE_EXCLUDED_SOURCE_FILE_NAMES_macosx = OSMemoryNotification.c BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos = frune.c login.c logout.c mbrune.c runedepreciated.c setinvalidrune.c getmntinfo64.c BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos) -BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneosnano = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos) -BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulatornano = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator) +BASE_EXCLUDED_SOURCE_FILE_NAMES_appletvos = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos) +BASE_EXCLUDED_SOURCE_FILE_NAMES_appletvsimulator = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator) +BASE_EXCLUDED_SOURCE_FILE_NAMES_watchos = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneos) +BASE_EXCLUDED_SOURCE_FILE_NAMES_watchsimulator = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulator) + +// TODO: Remove these legacy platform names: +BASE_EXCLUDED_SOURCE_FILE_NAMES_iphoneosnano = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_watchos) +BASE_EXCLUDED_SOURCE_FILE_NAMES_iphonesimulatornano = $(BASE_EXCLUDED_SOURCE_FILE_NAMES_watchsimulator) // - collate.c crashes llvm-gcc on armv6 with -Os + -gdwarf-2 COLLATE_C_CFLAGS_macosx_armv6 = -O1 diff --git a/xcodescripts/manpages.sh b/xcodescripts/manpages.sh index a27c10a..317cf2e 100644 --- a/xcodescripts/manpages.sh +++ b/xcodescripts/manpages.sh @@ -1,7 +1,7 @@ #!/bin/bash -e if [ "$ACTION" = installhdrs ]; then exit 0; fi -if [ "${PLATFORM_NAME/iphone/}" != "${PLATFORM_NAME}" ]; then exit 0; fi +if [ "${PLATFORM_NAME}" != "macosx" ]; then exit 0; fi UNIFDEF_FLAGS=`${SRCROOT}/xcodescripts/generate_features.pl --unifdef` MANPAGES_LIST="${SRCROOT}/man/manpages.lst" diff --git a/xcodescripts/patch_headers_variants.pl b/xcodescripts/patch_headers_variants.pl index b404cbc..24da935 100644 --- a/xcodescripts/patch_headers_variants.pl +++ b/xcodescripts/patch_headers_variants.pl @@ -55,6 +55,11 @@ sub process { } } + my($fname, $dirs, $suffix) = File::Basename::fileparse($file, ".h"); + if ($suffix ne ".h") { + return; + } + my $p = IO::File->new($path, 'r'); die "$MyName: Can't open $path: $!\n" unless defined($p); my $f = IO::File->new($file, 'w'); diff --git a/xcodescripts/sim-compat-symlink.sh b/xcodescripts/sim-compat-symlink.sh new file mode 100755 index 0000000..7c1826a --- /dev/null +++ b/xcodescripts/sim-compat-symlink.sh @@ -0,0 +1,9 @@ +#!/bin/bash -ex + +if [[ "${ACTION}" == "installhdrs" ]]; then + exit 0 +fi + +if [[ "${PLATFORM_NAME}" =~ "simulator" ]]; then + ln -s libsystem_c.dylib ${DSTROOT}${INSTALL_PATH}/libsystem_sim_c.dylib +fi diff --git a/xcodescripts/variants.xcconfig b/xcodescripts/variants.xcconfig index a2ce9a9..e578d01 100644 --- a/xcodescripts/variants.xcconfig +++ b/xcodescripts/variants.xcconfig @@ -10,12 +10,7 @@ HEADER_SEARCH_PATHS = $(FreeBSD_SEARCH_PATHS) $(inherited) VARIANT_CANCELABLE_MACROS = -DVARIANT_CANCELABLE -VARIANT_CANCELABLE_INCLUDE = $(VARIANT_CANCELABLE_INCLUDE_$(PLATFORM_NAME)) -VARIANT_CANCELABLE_INCLUDE_macosx = $(VARIANT_CANCELABLE_INCLUDE_compat) $(VARIANT_CANCELABLE_INCLUDE_gen) $(VARIANT_CANCELABLE_INCLUDE_net) $(VARIANT_CANCELABLE_INCLUDE_sys) -VARIANT_CANCELABLE_INCLUDE_iphoneos = $(VARIANT_CANCELABLE_INCLUDE_compat) $(VARIANT_CANCELABLE_INCLUDE_gen) $(VARIANT_CANCELABLE_INCLUDE_net) $(VARIANT_CANCELABLE_INCLUDE_sys) -VARIANT_CANCELABLE_INCLUDE_iphonesimulator = $(VARIANT_CANCELABLE_INCLUDE_compat) $(VARIANT_CANCELABLE_INCLUDE_gen) $(VARIANT_CANCELABLE_INCLUDE_net) $(VARIANT_CANCELABLE_INCLUDE_sys) -VARIANT_CANCELABLE_INCLUDE_iphoneosnano = $(VARIANT_CANCELABLE_INCLUDE_iphoneos) -VARIANT_CANCELABLE_INCLUDE_iphonesimulatornano = $(VARIANT_CANCELABLE_INCLUDE_iphonesimulator) +VARIANT_CANCELABLE_INCLUDE = $(VARIANT_CANCELABLE_INCLUDE_compat) $(VARIANT_CANCELABLE_INCLUDE_gen) $(VARIANT_CANCELABLE_INCLUDE_net) $(VARIANT_CANCELABLE_INCLUDE_sys) VARIANT_CANCELABLE_INCLUDE_compat = creat.c sigcompat.c VARIANT_CANCELABLE_INCLUDE_gen = lockf.c nanosleep.c pause.c pselect.c sleep.c termios.c usleep.c wait.c waitpid.c -- 2.45.2