diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/ChangeLog | 28 | ||||
-rw-r--r-- | test/Makefile.am | 9 | ||||
-rw-r--r-- | test/Makefile.in | 14 | ||||
-rw-r--r-- | test/Maketests | 5 | ||||
-rw-r--r-- | test/profile0.ok | 2 | ||||
-rw-r--r-- | test/profile10.ok | 12 | ||||
-rw-r--r-- | test/profile11.awk | 321 | ||||
-rw-r--r-- | test/profile11.ok | 371 | ||||
-rw-r--r-- | test/profile5.ok | 222 | ||||
-rw-r--r-- | test/symtab6.ok | 30 | ||||
-rw-r--r-- | test/symtab7.ok | 4 |
11 files changed, 877 insertions, 141 deletions
diff --git a/test/ChangeLog b/test/ChangeLog index 69cedf65..b1d2e340 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -12,12 +12,32 @@ * Makefile.am (EXTRA_DIST): New test: dfacheck1. * dfacheck1.awk, dfacheck1.in, dfacheck1.ok: New files. +2018-11-28 Arnold D. Robbins <arnold@skeeve.com> + + * profile11.ok: Updated after code change. + +2018-11-27 Arnold D. Robbins <arnold@skeeve.com> + + * profile11.awk: Disambiguate some comments. + * profile5.ok, profile11.ok: Updated after code change. + +2018-11-26 Arnold D. Robbins <arnold@skeeve.com> + + * profile5.ok: Updated after code change. + * Makefile.am (GAWK_EXT_TESTS): New test, profile11.ok. Add + to the other relevant macros. + * profile11.awk, profile11.ok: New files. + 2018-11-25 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (GAWK_EXT_TESTS): Fix layout of the list. 2018-11-24 Arnold D. Robbins <arnold@skeeve.com> + * profile5.ok: Updated after code change. + +2018-11-24 Arnold D. Robbins <arnold@skeeve.com> + * spacere.awk: Move setting of LC_ALL=C out to ... * Makefile.am (spacere): ... here. Added test. Per request from Eli Zaretskii to help porting to MinGW. @@ -27,6 +47,14 @@ * Makefile.am (EXTRA_DIST): New test: typedregex4. * typedregex4.awk, typedregex4.ok: New files. +2018-11-11 Arnold D. Robbins <arnold@skeeve.com> + + * profile10.ok: Updated after code change. + +2018-10-14 Arnold D. Robbins <arnold@skeeve.com> + + * profile0.ok: Updated after code change. + 2018-10-10 Arnold D. Robbins <arnold@skeeve.com> * Makefile.am (profile1): Add minus to ignore errors on final diff --git a/test/Makefile.am b/test/Makefile.am index c6b8caeb..7b42f8db 100644 --- a/test/Makefile.am +++ b/test/Makefile.am @@ -902,6 +902,8 @@ EXTRA_DIST = \ profile9.ok \ profile10.awk \ profile10.ok \ + profile11.awk \ + profile11.ok \ prt1eval.awk \ prt1eval.ok \ prtoeval.awk \ @@ -1310,7 +1312,7 @@ GAWK_EXT_TESTS = \ nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \ procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 \ - profile7 profile8 profile9 profile10 pty1 pty2 \ + profile7 profile8 profile9 profile10 profile11 pty1 pty2 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \ rsstart1 rsstart2 rsstart3 rstest6 \ shadow shadowbuiltin sortfor sortfor2 sortu sourcesplit split_after_fpat \ @@ -1367,7 +1369,7 @@ NEED_NONDEC = mpfrbigint2 nondec2 intarray forcenum NEED_POSIX = printf0 posix2008sub paramasfunc1 paramasfunc2 muldimposix # List of tests that need --pretty-print -NEED_PRETTY = profile4 profile5 profile8 profile9 profile10 +NEED_PRETTY = profile4 profile5 profile8 profile9 profile10 profile11 # List of tests that need --re-interval NEED_RE_INTERVAL = gsubtst3 reint reint2 @@ -2104,8 +2106,7 @@ charasbytes: symtab6: @echo $@ - @$(AWK) -d__$@ -f "$(srcdir)"/$@.awk - @grep -v '^ENVIRON' __$@ | grep -v '^PROCINFO' > _$@ ; rm __$@ + @$(AWK) -f "$(srcdir)"/$@.awk > _$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ symtab8: diff --git a/test/Makefile.in b/test/Makefile.in index c95a1dc8..f2fa6c8e 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1160,6 +1160,8 @@ EXTRA_DIST = \ profile9.ok \ profile10.awk \ profile10.ok \ + profile11.awk \ + profile11.ok \ prt1eval.awk \ prt1eval.ok \ prtoeval.awk \ @@ -1568,7 +1570,7 @@ GAWK_EXT_TESTS = \ nastyparm negtime next nondec nondec2 nonfatal1 nonfatal2 nonfatal3 \ patsplit posix printfbad1 printfbad2 printfbad3 printfbad4 printhuge \ procinfs profile0 profile1 profile2 profile3 profile4 profile5 profile6 \ - profile7 profile8 profile9 profile10 pty1 pty2 \ + profile7 profile8 profile9 profile10 profile11 pty1 pty2 \ rebuf regnul1 regnul2 regx8bit reginttrad reint reint2 rsgetline rsglstdin \ rsstart1 rsstart2 rsstart3 rstest6 \ shadow shadowbuiltin sortfor sortfor2 sortu sourcesplit split_after_fpat \ @@ -1624,7 +1626,7 @@ NEED_NONDEC = mpfrbigint2 nondec2 intarray forcenum NEED_POSIX = printf0 posix2008sub paramasfunc1 paramasfunc2 muldimposix # List of tests that need --pretty-print -NEED_PRETTY = profile4 profile5 profile8 profile9 profile10 +NEED_PRETTY = profile4 profile5 profile8 profile9 profile10 profile11 # List of tests that need --re-interval NEED_RE_INTERVAL = gsubtst3 reint reint2 @@ -2552,8 +2554,7 @@ charasbytes: symtab6: @echo $@ - @$(AWK) -d__$@ -f "$(srcdir)"/$@.awk - @grep -v '^ENVIRON' __$@ | grep -v '^PROCINFO' > _$@ ; rm __$@ + @$(AWK) -f "$(srcdir)"/$@.awk > _$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ symtab8: @@ -4404,6 +4405,11 @@ profile10: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +profile11: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + regnul1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/Maketests b/test/Maketests index 05804988..08d92ba3 100644 --- a/test/Maketests +++ b/test/Maketests @@ -1729,6 +1729,11 @@ profile10: @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ +profile11: + @echo $@ + @AWKPATH="$(srcdir)" $(AWK) -f $@.awk --pretty-print=_$@ >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ + @-$(CMP) "$(srcdir)"/$@.ok _$@ && rm -f _$@ + regnul1: @echo $@ @AWKPATH="$(srcdir)" $(AWK) -f $@.awk >_$@ 2>&1 || echo EXIT CODE: $$? >>_$@ diff --git a/test/profile0.ok b/test/profile0.ok index 2e3c5728..42c464ba 100644 --- a/test/profile0.ok +++ b/test/profile0.ok @@ -1,6 +1,6 @@ # Rule(s) 2 NR == 1 { # 1 - 1 print $0 + 1 print } diff --git a/test/profile10.ok b/test/profile10.ok index 13f0b67b..0f77bd38 100644 --- a/test/profile10.ok +++ b/test/profile10.ok @@ -17,14 +17,12 @@ BEGIN { # Comment 0 print "MNO" # Comment 16 } # Comment 17 switch (q) { - case "a": - # Comment 18 + # Comment 18 + case "a": # Comment 19 case "b": - # Comment 19 - break # Comment 20 - # Comment 21 - default: - # Comment 22 + # Comment 20 + break # Comment 21 + default: # Comment 22 break # Comment 23 } # Comment 24 diff --git a/test/profile11.awk b/test/profile11.awk new file mode 100644 index 00000000..06ede8ac --- /dev/null +++ b/test/profile11.awk @@ -0,0 +1,321 @@ + +# comments/for.awk +BEGIN { + for (i = 1; i <= 10; i++) print i + + for (i = 1; i <= 10; i++) # comment 0 + print i + + for (i = 1; # comment 1a + i <= 10; i++) print i + + for (i = 1; i <= 10; # comment 2a + i++) print i + + for (i = 1; # comment 1b + i <= 10; # comment 2b + i++) print i + + for (i = 1; # comment 1c + i <= 10; # comment 2c + i++) # comment 3c + print i +} + +# comments/for0.awk +BEGIN { + for (iggy in foo) # comment 5 + # comment 6 + ; +} + +# comments/for1.awk +BEGIN { + for (iggy in foo) # comment 1 + # comment 2 + { + print iggy + } + + for (iggy in foo) # comment 3 + # comment 4 + print iggy + + for (iggy in foo) # comment 5 + # comment 6 + ; +} + +# comments/for2.awk +BEGIN { + for (;;) print i + + for (;;) # comment 0 + print i + + for (; # comment 1a + ;) print i + + for (; ; # comment 2a + ) print i + + for (; # comment 1b + ; # comment 2b + ) print i + + for (; # comment 1c + ; # comment 2c + ) # comment 3c + print i +} + +# comments/for_del.awk +BEGIN { for (iggy in foo) delete foo[iggy] } + +# comments/do.awk +BEGIN { + do # DO comment + { # LBRACE comment + # block comment + print 42 + } # rbrace comment + while (0) # WHILE comment +} + +# comments/do2.awk +BEGIN { + do # DO comment + { # LBRACE comment + # block comment + print 42 + } # rbrace comment + while (0) +} + +# comments2/do.awk +BEGIN { + do # do comment + { # lbrace comment + # block comment + print 42 + } # rbace EOL comment + # rbrace block comment + while (1) # while comment +} + +# comments2/if.awk +BEGIN { + if (a) # IF comment + print "foo" # print comment + + if (a) # IF comment 2 + { # lbrace comment + print "bar" + } + else # ELSE comment + print "baz" +} + +# comments/if0.awk +BEGIN { + if (a) + ; # nothing + else + print "b" +} + +# comments/switch.awk +BEGIN { + a = 5 + switch (a) # switch EOL comment + # switch block comment + { # lbrace EOL comment + # lbrace block comment + case 5: # comment after case + print "five!" + break + # block comment after case + default: # comment after default + print "default" # print comment + break + } # rbrace EOL comment + # rbrace block comment +} + +# comments2/switch.awk +BEGIN { + a = 5 + switch (a) # switch EOL comment + # switch block comment + { # lbrace EOL comment + # lbrace block comment + case 5: + print "five!" + break; + # block comment after case + } # rbrace EOL comment + # rbrace block comment +} + +# comments2/switch0.awk +BEGIN { + a = 5 + switch (a) + { + case 5: # case comment + print "five!" + break + default: # default comment + print "default" + break + } +} + +# comments2/switch1.awk +BEGIN { + a = 5 + switch (a) + { + case 5: + # case comment + print "five!" + break + default: # default comment + print "default" + break + } +} + +# comments2/while.awk +BEGIN { + while (1) # while comment + { # lbrace comment + # block comment + print 42 + } +} + +# comments2/while2.awk +BEGIN { + while (1) # while comment + { # lbrace comment + # block comment + } +} + +# comments2/f.awk +function bar(p1, + p2) +{ + print "foo" +} # rbrace eol bar + # rbrace block bar + +# comments2/function.awk +function baz(p1, # comment + p2) + # comment before braces +{ # lbrace eol + # lbrace block + print "foo" +} # rbrace eol baz + # rbrace block baz + +# comments/function.awk +function funny(param1, # param comment 1 + param2, param3, # param comment 2 + param4) + # Comment between header and body +{ # lbrace EOL comment + # lbrace block comment + print "funny" +} # rbrace EOL comment funny + # rbrace block comment funny + +# comments/function2.awk +function funnyhaha(param1, + param2, param3, + param4) +{ # lbrace EOL comment + # lbrace block comment + print "funny" +} # rbrace EOL comment funnyhaha + # rbrace block comment funnyhaha + +# comments/callcoma.awk +function callme(a, b, c) +{ + printf("a = %s, b = %s, c = %s\n", # format comment + a, # a2 comment + b, # b2 comment + c) +} + +BEGIN { + callme(1, # 1 comment + 2, # 2 comment + 3) +} + +# comments/exp.awk +/foo/, # range comment + # range comment 2 + +# range comment b + +# range comment c +/bar/ { print } + +# comments/load.awk +@load "filefuncs" # get file functions + +BEGIN { + stat("/etc/passwd", data) + for (i in data) + print i, data[i] +} + +# comments/andor.awk +BEGIN { + if (a && # and comment + b || # or comment + c) + print "foo" +} + +# comments/qmcol-qm.awk +BEGIN { + a = 1 ? # qm comment + 2 : + 3 + print a +} + +# comments/qmcol-colon.awk +BEGIN { + a = 1 ? + 2 : # colon comment + 3 + print a +} + +# comments/qmcolboth.awk +BEGIN { + a = 1 ? # qm comment + 2 : # colon comment + 3 + print a +} + +# test beginning of line block comments (com2.awk) +BEGIN { + print "hi" # comment 1 +# comment 2 + print "there" + + if (foo) { + print "hello" # comment 3 +# comment 4 + print "world" + } +} diff --git a/test/profile11.ok b/test/profile11.ok new file mode 100644 index 00000000..77f4dd7f --- /dev/null +++ b/test/profile11.ok @@ -0,0 +1,371 @@ +@load "filefuncs" # get file functions + +# comments/for.awk +BEGIN { + for (i = 1; i <= 10; i++) { + print i + } + for (i = 1; i <= 10; i++) { # comment 0 + print i + } + for (i = 1; # comment 1a + i <= 10; i++) { + print i + } + for (i = 1; i <= 10; # comment 2a + i++) { + print i + } + for (i = 1; # comment 1b + i <= 10; # comment 2b + i++) { + print i + } + for (i = 1; # comment 1c + i <= 10; # comment 2c + i++) { # comment 3c + print i + } +} + +# comments/for0.awk +BEGIN { + for (iggy in foo) { + # comment 5 + + # comment 6 + } +} + +# comments/for1.awk +BEGIN { + for (iggy in foo) { + # comment 1 + + # comment 2 + print iggy + } + for (iggy in foo) { + # comment 3 + + # comment 4 + print iggy + } + for (iggy in foo) { + # comment 5 + + # comment 6 + } +} + +# comments/for2.awk +BEGIN { + for (;;) { + print i + } + for (;;) { # comment 0 + print i + } + for (; # comment 1a + ; ) { + print i + } + for (; ; # comment 2a + ) { + print i + } + for (; # comment 1b + ; # comment 2b + ) { + print i + } + for (; # comment 1c + ; # comment 2c + ) { # comment 3c + print i + } +} + +# comments/for_del.awk +BEGIN { + for (iggy in foo) { + delete foo[iggy] + } +} + +# comments/do.awk +BEGIN { + do { # DO comment + # LBRACE comment + # block comment + print 42 + } while (0) # WHILE comment + # rbrace comment +} + +# comments/do2.awk +BEGIN { + do { # DO comment + # LBRACE comment + # block comment + print 42 + } while (0) # rbrace comment +} + +# comments2/do.awk +BEGIN { + do { # do comment + # lbrace comment + # block comment + print 42 + } while (1) # while comment + # rbace EOL comment + # rbrace block comment +} + +# comments2/if.awk +BEGIN { + if (a) { + # IF comment + print "foo" # print comment + } + if (a) { # lbrace comment + # IF comment 2 + print "bar" + } else { + # ELSE comment + print "baz" + } +} + +# comments/if0.awk +BEGIN { + if (a) { + # nothing + } else { + print "b" + } +} + +# comments/switch.awk +BEGIN { + a = 5 + switch (a) { + # switch EOL comment + + # switch block comment + + # lbrace EOL comment + + # lbrace block comment + case 5: # comment after case + print "five!" + break + # block comment after case + default: # comment after default + print "default" # print comment + break + } + # rbrace EOL comment + # rbrace block comment +} + +# comments2/switch.awk +BEGIN { + a = 5 + switch (a) { + # switch EOL comment + + # switch block comment + + # lbrace EOL comment + + # lbrace block comment + case 5: + print "five!" + break + # block comment after case + } + # rbrace EOL comment + # rbrace block comment +} + +# comments2/switch0.awk +BEGIN { + a = 5 + switch (a) { + case 5: # case comment + print "five!" + break + default: # default comment + print "default" + break + } +} + +# comments2/switch1.awk +BEGIN { + a = 5 + switch (a) { + case 5: + # case comment + print "five!" + break + default: # default comment + print "default" + break + } +} + +# comments2/while.awk +BEGIN { + while (1) { + # while comment + # lbrace comment + # block comment + print 42 + } +} + +# comments2/while2.awk +BEGIN { + while (1) { + # while comment + # lbrace comment + # block comment + } +} + +BEGIN { + callme(1, # 1 comment + 2, # 2 comment + 3) +} + +# comments/load.awk +BEGIN { + stat("/etc/passwd", data) + for (i in data) { + print i, data[i] + } +} + +# comments/andor.awk +BEGIN { + if (a && # and comment + b || # or comment + c) { + print "foo" + } +} + +# comments/qmcol-qm.awk +BEGIN { + a = 1 ? # qm comment + 2 : 3 + print a +} + +# comments/qmcol-colon.awk +BEGIN { + a = 1 ? 2 : # colon comment + 3 + print a +} + +# comments/qmcolboth.awk +BEGIN { + a = 1 ? # qm comment + 2 : # colon comment + 3 + print a +} + +# test beginning of line block comments (com2.awk) +BEGIN { + print "hi" # comment 1 + # comment 2 + print "there" + if (foo) { + print "hello" # comment 3 + # comment 4 + print "world" + } +} + +# comments/exp.awk +# range comment +# range comment 2 + +# range comment b + +# range comment c +/foo/, /bar/ { + print +} + + +# comments2/f.awk +function bar(p1, p2) +{ + print "foo" +} + +# rbrace eol bar + +# rbrace block bar + +# comments2/function.awk + +# comment + +# comment before braces +function baz(p1, p2) +{ + # lbrace eol + # lbrace block + print "foo" +} + +# rbrace EOL comment funnyhaha + +# rbrace block comment funnyhaha + +# comments/callcoma.awk +function callme(a, b, c) +{ + printf "a = %s, b = %s, c = %s\n", # format comment + a, # a2 comment + b, # b2 comment + c +} + +# rbrace eol baz + +# rbrace block baz + +# comments/function.awk + +# param comment 1 + +# param comment 2 + +# Comment between header and body +function funny(param1, param2, param3, param4) +{ + # lbrace EOL comment + # lbrace block comment + print "funny" +} + +# rbrace EOL comment funny + +# rbrace block comment funny + +# comments/function2.awk +function funnyhaha(param1, param2, param3, param4) +{ + # lbrace EOL comment + # lbrace block comment + print "funny" +} diff --git a/test/profile5.ok b/test/profile5.ok index c8abf1fb..e15e96a2 100644 --- a/test/profile5.ok +++ b/test/profile5.ok @@ -3,7 +3,7 @@ BEGIN { } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################ BINMODE = "rw" SUBSEP = "\000" _NULARR[""] @@ -24,7 +24,7 @@ BEGIN { } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################# _delay_perfmsdelay = 11500 } @@ -36,12 +36,13 @@ BEGIN { BEGIN { } -BEGIN { ########################################################################### +########################################################################### +BEGIN { _addlib("_EXTFN") } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################# delete _XCHR delete _ASC delete _CHR @@ -101,7 +102,7 @@ BEGIN { } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################# _SYS_STDCON = "CON" _CON_WIDTH = match(_cmd("MODE " _SYS_STDCON " 2>NUL"), /Columns:[ \t]*([0-9]+)/, A) ? strtonum(A[1]) : 80 } @@ -111,7 +112,7 @@ BEGIN { } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################# if (_SYS_STDOUT == "") { _SYS_STDOUT = "/dev/stdout" } @@ -133,7 +134,7 @@ BEGIN { } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################# _tInBy = "\212._tInBy" _tgenuid_init() _UIDS[""] @@ -165,7 +166,7 @@ BEGIN { } #___________________________________________________________________________________ -BEGIN { +BEGIN { ############################################################################# if (_gawk_scriptlevel < 1) { _ERRLOG_TF = 1 _ERRLOG_VF = 1 @@ -186,7 +187,8 @@ BEGIN { _shortcut_init() } -BEGIN { ######################################################### +######################################################### +BEGIN { _addlib("_eXTFN") } @@ -195,7 +197,8 @@ BEGIN { _extfn_init() } -BEGIN { ############################################################ +############################################################ +BEGIN { _addlib("_sHARE") } @@ -282,7 +285,7 @@ BEGIN { #BootDevice BuildNumber BuildType Caption CodeSet CountryCode CreationClassName CSCreationClassName CSDVersion CSName CurrentTimeZone DataExecutionPrevention_32BitApplications DataExecutionPrevention_Available DataExecutionPrevention_Drivers DataExecutionPrevention_SupportPolicy Debug Description Distributed EncryptionLevel ForegroundApplicationBoost FreePhysicalMemory FreeSpaceInPagingFiles FreeVirtualMemory InstallDate LargeSystemCache LastBootUpTime LocalDateTime Locale Manufacturer MaxNumberOfProcesses MaxProcessMemorySize MUILanguages Name NumberOfLicensedUsers NumberOfProcesses NumberOfUsers OperatingSystemSKU Organization OSArchitecture OSLanguage OSProductSuite OSType OtherTypeDescription PAEEnabled PlusProductID PlusVersionNumber Primary ProductType RegisteredUser SerialNumber ServicePackMajorVersion ServicePackMinorVersion SizeStoredInPagingFiles Status SuiteMask SystemDevice SystemDirectory SystemDrive TotalSwapSpaceSize TotalVirtualMemorySize TotalVisibleMemorySize Version WindowsDirectory #\Device\HarddiskVolume1 7601 Multiprocessor Free Microsoft Windows Server 2008 R2 Enterprise 1252 1 Win32_OperatingSystem Win32_ComputerSystem Service Pack 1 CPU 180 TRUE TRUE TRUE 3 FALSE FALSE 256 0 6925316 33518716 41134632 20110502192745.000000+180 20130426120425.497469+180 20130510134606.932000+180 0409 Microsoft Corporation -1 8589934464 {"en-US"} Microsoft Windows Server 2008 R2 Enterprise |C:\Windows|\Device\Harddisk0\Partition2 0 116 2 10 64-bit 1033 274 18 TRUE 3 Windows User 55041-507-2389175-84833 1 0 33554432 OK 274 \Device\HarddiskVolume2 C:\Windows\system32 C: 50311020 16758448 6.1.7601 C:\Windows -BEGIN { +BEGIN { ############################################################################ a = ENVIRON["EGAWK_CMDLINE"] gsub(/^[ \t]*/, "", a) a = _lib_CMDLN(a) @@ -302,13 +305,13 @@ BEGIN { } #_____________________________________________________________________________ -END { +END { ######################################################################## _EXIT() } #_______________________________________________________________________ ######################################################################## -END { +END { ############################################################################### if (_gawk_scriptlevel < 1) { close(_errlog_file) p = _Zimport(_rdfile(_errlog_file), _N()) @@ -329,7 +332,7 @@ END { #_____________________________________________________________________________ # _rQBRO(ptr) - Returns brothers total quantity. [TESTED] # If !ptr then returns "". -END { +END { ############################################################################### if (_gawk_scriptlevel < 1) { if (! _fileio_notdeltmpflag) { _FILEIO_TMPATHS[_FILEIO_TMPRD] @@ -629,7 +632,7 @@ END { # var _gawk_scriptlevel #___________________________________________________________________________________ #################################################################################### -END { +END { ############################################################################### if (_constatstrln > 0) { _constat() } @@ -757,8 +760,8 @@ function _DS(c, t, P, a, A) { ###################################################### switch (c) { + #___________________________________________________________ case "_lib_CMDLN": - #___________________________________________________________ return t #_____________________________________________________ case "_lib_APPLY": @@ -922,14 +925,15 @@ function _FILEIO(c, t, P, A) } ############################################################ + +#_____________________________________________________________________________ function _FILEVER(c, t, P, a, A) { - #_____________________________________________________________________________ + ################################################# switch (c) { + #___________________________________________________________ case "_lib_CMDLN": - ################################################# return t - #___________________________________________________________ #_____________________________________________________ case "_lib_APPLY": return @@ -1494,11 +1498,13 @@ function _addlist(A, v) } ############################################ + +#_______________________________________________________________________ function _bearray(A) { - #_______________________________________________________________________ + #################################################### if (isarray(A) || (A == 0 && A == "")) { - return 1 #################################################### + return 1 } } @@ -2534,10 +2540,12 @@ function _ffaccr(A, t, p, P) } ################## + +#_______________________________________________________________________ function _fframe(A, t, p) { - #_______________________________________________________________________ - return _fframe_i0(A, t, p, A[""]) ################################################# + ################################################# + return _fframe_i0(A, t, p, A[""]) } #___________________________________________________________ @@ -2874,14 +2882,15 @@ function _formatstrd_init() } #__________________________________________________________________________________ + +#################################################################################### + + + + +#___________________________________________________________________________________ function _formatstrs(t) { - #################################################################################### - - - - - #___________________________________________________________________________________ _formatstrq0 = split(t, _FORMATSTRA, /['\x00-\x1F\x80-\xFF]/, _FORMATSTRB) _formatstrs0 = "" for (t = 1; t < _formatstrq0; t++) { @@ -3026,8 +3035,8 @@ function _getchrln(s, w) ################################################# if (s == "") { return + #if ( w!=w+0 || w<0 ) w=_CON_WIDTH } - #if ( w!=w+0 || w<0 ) w=_CON_WIDTH if (length(s) < w) { if (s in _GETCHRLN) { if (length(_getchrlnt0 = _GETCHRLN[s]) >= w) { @@ -3453,9 +3462,10 @@ function _insframe(A, f) } ######################## + +#_________________________________________________________________ function _inspass(A, f) { - #_________________________________________________________________ A[f] = A[""] A[""] = f } @@ -3782,9 +3792,10 @@ function _newdir(f) } ############################## + +#_______________________________________________________________________ function _nop(p0, p1, p2, p3) { - #_______________________________________________________________________ } #_____________________________________________________ @@ -4202,14 +4213,15 @@ function _qstrq(t) } ################################################################ + +#_____________________________________________________________________________ function _rEG(c, t, P, a, A) { - #_____________________________________________________________________________ + ##################################################### switch (c) { + #___________________________________________________________ case "_lib_CMDLN": - ##################################################### return t - #___________________________________________________________ #_____________________________________________________ case "_lib_APPLY": return @@ -4255,10 +4267,12 @@ function _rFCHLD(p) } ######################## p="", !v + +#_______________________________________________________________________ function _rLBRO(p) { - #_______________________________________________________________________ - if (p) { ###################################################### + ###################################################### + if (p) { if (p in _tPARENT) { return _tLCHLD[_tPARENT[p]] } @@ -4271,10 +4285,12 @@ function _rLBRO(p) } ######################## p="" + +#_______________________________________________________________________ function _rLCHLD(p) { - #_______________________________________________________________________ - if ((p) && (p in _tLCHLD)) { ##################################################### + ##################################################### + if ((p) && (p in _tLCHLD)) { return _tLCHLD[p] } return "" @@ -4288,40 +4304,48 @@ function _rLINK(p) } ######################## p="" + +#_______________________________________________________________________ function _rNEXT(p) { - #_______________________________________________________________________ - if ((p) && (p in _tNEXT)) { ###################################################### + ###################################################### + if ((p) && (p in _tNEXT)) { return _tNEXT[p] } return "" } ######################## p="" + +#_______________________________________________________________________ function _rPARENT(p) { - #_______________________________________________________________________ - if ((p) && (p in _tPARENT)) { #################################################### + #################################################### + if ((p) && (p in _tPARENT)) { return _tPARENT[p] } return "" } ######################## p="" + +#_______________________________________________________________________ function _rPREV(p) { - #_______________________________________________________________________ - if ((p) && (p in _tPREV)) { ###################################################### + ###################################################### + if ((p) && (p in _tPREV)) { return _tPREV[p] } return "" } ######################## p="" + +#_______________________________________________________________________ function _rQBRO(p, c, p1) { - #_______________________________________________________________________ - if (p) { ################################################ + ################################################ + if (p) { if (p in _tPARENT) { return _tQCHLD[_tPARENT[p]] } @@ -4341,10 +4365,12 @@ function _rQBRO(p, c, p1) } ######################## p="" + +#_______________________________________________________________________ function _rQCHLD(p) { - #_______________________________________________________________________ - if ((p) && (p in _tQCHLD)) { ##################################################### + ##################################################### + if ((p) && (p in _tQCHLD)) { return _tQCHLD[p] } return "" @@ -4909,14 +4935,15 @@ function _rxpfn(R, t, p, i, f, A) } ############################################################## + +#_____________________________________________________________________________ function _sHARE(c, t, P, a, A) { - #_____________________________________________________________________________ + ################################################### switch (c) { + #___________________________________________________________ case "_lib_CMDLN": - ################################################### return t - #___________________________________________________________ #_____________________________________________________ case "_lib_APPLY": return @@ -4936,14 +4963,15 @@ function _sHARE(c, t, P, a, A) } ################################################################ + +#_____________________________________________________________________________ function _sYS(c, t, P, a, A) { - #_____________________________________________________________________________ + ##################################################### switch (c) { + #___________________________________________________________ case "_lib_CMDLN": - ##################################################### return t - #___________________________________________________________ #_____________________________________________________ case "_lib_APPLY": return @@ -5004,9 +5032,9 @@ function _setmpath(p, a) if ((p) && (a = _filerd(p))) { if (_FILEIO_TMPRD) { _FILEIO_TMPATHS[_FILEIO_TMPRD] + #if ( _filexist(a) ) _del(a) + #_cmd("rd " a " /S /Q 2>NUL"); _cmd("del " a " /Q 2>NUL") } - #if ( _filexist(a) ) _del(a) - #_cmd("rd " a " /S /Q 2>NUL"); _cmd("del " a " /Q 2>NUL") return (_FILEIO_TMPRD = a) } else { return _warning("`" p "': cannot set temporary folder" (ERRNO ? (": " ERRNO) : "")) @@ -5051,27 +5079,26 @@ function _shortcut(D, S) if (isarray(D)) { if (isarray(S)) { _addarrmask(D, S, _SHORTCUTWSTRUC) - } else if (S == 0 && S == "") { # array,array2* - copy from array2 to array shorcut-specific elements - _addarrmask(D, _SHORTCUTDEFAULT, _SHORTCUTWSTRUC) - } else if (_isnotfileptr(S)) { # array* - define shortcut-specific elements in array by default values - _addarrmask(D, _[S], _SHORTCUTWSTRUC) + } else if (S == 0 && S == "") { + _addarrmask(D, _SHORTCUTDEFAULT, _SHORTCUTWSTRUC) # array,array2* - copy from array2 to array shorcut-specific elements + } else if (_isnotfileptr(S)) { + _addarrmask(D, _[S], _SHORTCUTWSTRUC) # array* - define shortcut-specific elements in array by default values } else if (_rd_shortcut(D, S)) { - return # array,ptr* - copy from array _[ptr] to array shorcut-specific elements - } + return + } # array,ptr* - copy from array _[ptr] to array shorcut-specific elements } else if (D == 0 && D == "") { - return _NOP # array,filepath* - define in array shortcut-specific elements by reading its from shortcut file filepath(load shortcut) - # -* - no action(return -) + return _NOP # -* - no action(return -) } else if (_isnotfileptr(D)) { if (isarray(S)) { - _addarrmask(_[D], S, _SHORTCUTWSTRUC) - } else if (S == 0 && S == "") { # ptr,array* - copy from array to array _[ptr] shorcut-specific elements - _addarrmask(_[D], _SHORTCUTDEFAULT, _SHORTCUTWSTRUC) - } else if (_isnotfileptr(S)) { # ptr* - define shortcut-specifc elements in array _[ptr] by default values - _addarrmask(_[D], _[S], _SHORTCUTWSTRUC) + _addarrmask(_[D], S, _SHORTCUTWSTRUC) # array,filepath* - define in array shortcut-specific elements by reading its from shortcut file filepath(load shortcut) + } else if (S == 0 && S == "") { + _addarrmask(_[D], _SHORTCUTDEFAULT, _SHORTCUTWSTRUC) # ptr,array* - copy from array to array _[ptr] shorcut-specific elements + } else if (_isnotfileptr(S)) { + _addarrmask(_[D], _[S], _SHORTCUTWSTRUC) # ptr* - define shortcut-specifc elements in array _[ptr] by default values } else if (_rd_shortcut(_[D], S)) { - return # ptr,ptr2* - copy from array _[ptr2] to array _[ptr] shorcut-specific elements - } - } else { # ptr,filepath* - define in array _[ptr] shortcut-specific elements by reading its from shortcut file filepath(load shortcut) + return + } # ptr,ptr2* - copy from array _[ptr2] to array _[ptr] shorcut-specific elements + } else { if (isarray(S) && _wr_shortcut(D, S)) { return # filepath,array* - [over]write shorcut file filepath; shortcut parameters will be defined by shortcut-specific elements in array(save shortcut) } else if (S == 0 && S == "" && _wr_shortcut(D, _SHORTCUTDEFAULT)) { @@ -5080,7 +5107,8 @@ function _shortcut(D, S) return # filepath,ptr* - [over]write shorcut file filepath; shortcut parameters will be defined by shortcut-specific elements in array _[ptr](save shortcut) } else if (_rd_shortcut(_SHRTCUTA1, S) || _wr_shortcut(D, _SHRTCUTA1)) { return - } } # filepath,filepath2* - [over]write shorcut file filepath; shortcut parameters will be defined from shortcut file filepath2(copy shortcut) + } # ptr,filepath* - define in array _[ptr] shortcut-specific elements by reading its from shortcut file filepath(load shortcut) + } # filepath,filepath2* - [over]write shorcut file filepath; shortcut parameters will be defined from shortcut file filepath2(copy shortcut) return 1 } @@ -5433,8 +5461,8 @@ function _sysinfo(D, h) function _tOBJ(c, t, P) { switch (c) { + #___________________________________________________________ case "_lib_CMDLN": - #___________________________________________________________ return t #___________________________________________________________ case "_lib_APPLY": @@ -6291,30 +6319,34 @@ function _th0(p, p1, p2, p3) } ########################################## + +#_________________________________________________________________ function _th1(p0, p, p2, p3) { - #_________________________________________________________________ return p } ############################## + +#_________________________________________________________________ function _th10(p0, p1) { - #_________________________________________________________________ return (p1 p0) } ############################## + +#_________________________________________________________________ function _th2(p0, p1, r, p3) { - #_________________________________________________________________ return p } ############################## + +#_________________________________________________________________ function _th3(p0, p1, p2, r) { - #_________________________________________________________________ return p } @@ -7234,10 +7266,10 @@ function _wFBRO(p, v, a) } ######################## p=ptr, v=0 return v } - } else { ######################## p=ptr, v="" + } else { if (p == 0) { return v ######################## p=0 - } + } ######################## p=ptr, v="" if (v) { return _texclude(v) ######################## p="", v=ptr - exclude v } @@ -7325,10 +7357,10 @@ function _wFCHLD(p, v, a) } return v } - } else { ######################## p=ptr, v="" > ignore action + } else { if (p == 0) { return v ######################## p=0 - } + } ######################## p=ptr, v="" > ignore action return v } } @@ -7436,10 +7468,10 @@ function _wLBRO(p, v, a) } ######################## p=ptr, v=0 return v } - } else { ######################## p=ptr, v="" + } else { if (p == 0) { return v ######################## p=0 - } + } ######################## p=ptr, v="" if (v) { return _texclude(v) ######################## p="", v=ptr - exclude v } @@ -7527,10 +7559,10 @@ function _wLCHLD(p, v, a) } return v } - } else { ######################## p=ptr, v="" > ignore action + } else { if (p == 0) { return v ######################## p=0 - } + } ######################## p=ptr, v="" > ignore action return v } } @@ -7606,10 +7638,10 @@ function _wNEXT(p, v, a, b) } ######################## p=ptr, v=0 return v } - } else { ######################## p=ptr, v="" + } else { if (p == 0) { return v ######################## p=0 - } + } ######################## p=ptr, v="" if (v) { return _texclude(v) ######################## p="", v=ptr - exclude v } @@ -7688,10 +7720,10 @@ function _wPREV(p, v, a, b) } ######################## p=ptr, v=0 return v } - } else { ######################## p=ptr, v="" + } else { if (p == 0) { return v ######################## p=0 - } + } ######################## p=ptr, v="" if (v) { return _texclude(v) ######################## p="", v=ptr - exclude v } @@ -7712,10 +7744,10 @@ function _wQCHLD(p, v) ############################################# if (p) { if (v) { - } else { ######################## p=ptr, v=ptr + } else { if (v == 0) { if (p in _tFCHLD) { ######################## p=ptr, v=0 > delete all chld - v = _tFCHLD[p] + v = _tFCHLD[p] ######################## p=ptr, v=ptr delete _tFCHLD[p] delete _tLCHLD[p] delete _tQCHLD[p] @@ -7726,9 +7758,9 @@ function _wQCHLD(p, v) } return v } - } else { ######################## p=ptr, v="" > ignore action + } else { if (p == 0) { - return v + return v ######################## p=ptr, v="" > ignore action } ######################## p=0 return v } diff --git a/test/symtab6.ok b/test/symtab6.ok index 7de717a0..23a1633d 100644 --- a/test/symtab6.ok +++ b/test/symtab6.ok @@ -1,28 +1,2 @@ -ARGC: 1 -ARGIND: 0 -ARGV: array, 1 elements -BINMODE: 0 -CONVFMT: "%.6g" -ERRNO: "" -FIELDWIDTHS: "" -FILENAME: "" -FNR: 0 -FPAT: "[^[:space:]]+" -FS: " " -FUNCTAB: array, 41 elements -IGNORECASE: 0 -LINT: 0 -NF: 0 -NR: 0 -OFMT: "%.6g" -OFS: " " -ORS: "\n" -PREC: 53 -RLENGTH: 0 -ROUNDMODE: "N" -RS: "\n" -RSTART: 0 -RT: "" -SUBSEP: "\034" -SYMTAB: array, 29 elements -TEXTDOMAIN: "messages" +gawk: ./symtab6.awk:1: fatal: cannot assign to arbitrary elements of SYMTAB +EXIT CODE: 2 diff --git a/test/symtab7.ok b/test/symtab7.ok index 28328831..37de1a49 100644 --- a/test/symtab7.ok +++ b/test/symtab7.ok @@ -1,2 +1,2 @@ -30 -40 +gawk: symtab7.awk:4: (FILENAME=- FNR=1) fatal: cannot assign to arbitrary elements of SYMTAB +EXIT CODE: 2 |