diff --git a/qse/cmd/awk/adr-001.out b/qse/cmd/awk/adr-001.out deleted file mode 100644 index 90718fb0..00000000 --- a/qse/cmd/awk/adr-001.out +++ /dev/null @@ -1,12 +0,0 @@ -BEGIN { - RS = "\n\n"; - FS = "\n"; -} - -{ - print $1,$NF; -} - -James Brown 012-345-678 -Richie Ren 02-3473-9192 -Toh WeeKung 9102-1203 diff --git a/qse/cmd/awk/arr.awk b/qse/cmd/awk/arr.awk deleted file mode 100644 index f3b58e93..00000000 --- a/qse/cmd/awk/arr.awk +++ /dev/null @@ -1,18 +0,0 @@ -BEGIN { - a[1,2,3] = 20; - a[4,5,6] = 30; - - for (i in a) - { - n = split (i, k, SUBSEP); - for (j = 1; j < n; j++) - { - print k[j] - } - } - - if ((1,2,3) in a) - { - print a[1,2,3]; - } -} diff --git a/qse/cmd/awk/crash01.awk b/qse/cmd/awk/crash01.awk deleted file mode 100644 index 8906db6f..00000000 --- a/qse/cmd/awk/crash01.awk +++ /dev/null @@ -1 +0,0 @@ -BEGIN { CONVFMT="%s"; printf ("%s\n", 10.34); } diff --git a/qse/cmd/awk/crash08.awk b/qse/cmd/awk/crash08.awk deleted file mode 100644 index 130cf3c8..00000000 --- a/qse/cmd/awk/crash08.awk +++ /dev/null @@ -1,23 +0,0 @@ -function a() -{ - print "aaaa"; - a(); -} - -BEGIN { - a = (b = 20); - print a; print b; for(i=j=1; i< 10; i++) print i, j; - - a += b += 20; - print a; print b; for(i=j=1; i< 10; i++) print i, j; - - j = (a < 20)? k = 20: c = 30; - print (a < 20)? k = 20: c = 30; - print "j=" j; - print "k=" k; - print "c=" c; - - a(); -} - - diff --git a/qse/cmd/awk/err-001.out b/qse/cmd/awk/err-001.out deleted file mode 100644 index ce6a2e05..00000000 --- a/qse/cmd/awk/err-001.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [31] LINE [2] invalid character '' diff --git a/qse/cmd/awk/err-002.awk b/qse/cmd/awk/err-002.awk deleted file mode 100644 index 0518ca92..00000000 --- a/qse/cmd/awk/err-002.awk +++ /dev/null @@ -1,3 +0,0 @@ -BEGIN { - ARGC = 39; -} diff --git a/qse/cmd/awk/err-002.out b/qse/cmd/awk/err-002.out deleted file mode 100644 index eadc4818..00000000 --- a/qse/cmd/awk/err-002.out +++ /dev/null @@ -1,4 +0,0 @@ -BEGIN { - ARGC = 39; -} - diff --git a/qse/cmd/awk/err-003.out b/qse/cmd/awk/err-003.out deleted file mode 100644 index 2998420a..00000000 --- a/qse/cmd/awk/err-003.out +++ /dev/null @@ -1,6 +0,0 @@ -BEGIN { - abc[20] = "abc"; - abc = 10; -} - -RUN ERROR: CODE [99] LINE [3] map 'abc' not assignable with a scalar diff --git a/qse/cmd/awk/err-004.awk b/qse/cmd/awk/err-004.awk deleted file mode 100644 index 78a27344..00000000 --- a/qse/cmd/awk/err-004.awk +++ /dev/null @@ -1,3 +0,0 @@ -BEGIN { - delete ARGC; -} diff --git a/qse/cmd/awk/err-004.out b/qse/cmd/awk/err-004.out deleted file mode 100644 index 7ecedb49..00000000 --- a/qse/cmd/awk/err-004.out +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN { - delete ARGC; -} - -RUN ERROR: CODE [91] LINE [2] variable 'ARGC' not deletable diff --git a/qse/cmd/awk/err-005.out b/qse/cmd/awk/err-005.out deleted file mode 100644 index 88bff8b6..00000000 --- a/qse/cmd/awk/err-005.out +++ /dev/null @@ -1,6 +0,0 @@ -BEGIN { - iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix = 20; - delete iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix; -} - -RUN ERROR: CODE [91] LINE [3] variable 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii...' not deletable diff --git a/qse/cmd/awk/err-006.awk b/qse/cmd/awk/err-006.awk deleted file mode 100644 index e184c15c..00000000 --- a/qse/cmd/awk/err-006.awk +++ /dev/null @@ -1,3 +0,0 @@ -BEGIN { - helpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhelphelp (); -} diff --git a/qse/cmd/awk/err-006.out b/qse/cmd/awk/err-006.out deleted file mode 100644 index eb08ba09..00000000 --- a/qse/cmd/awk/err-006.out +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN { - helpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhelphelp (); -} - -RUN ERROR: CODE [89] LINE [2] function 'helpxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxhel...' not found diff --git a/qse/cmd/awk/err-007.out b/qse/cmd/awk/err-007.out deleted file mode 100644 index 25455efb..00000000 --- a/qse/cmd/awk/err-007.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [58] LINE [2] intrinsic function 'substr' redefined diff --git a/qse/cmd/awk/err-008.awk b/qse/cmd/awk/err-008.awk deleted file mode 100644 index 36d700f5..00000000 --- a/qse/cmd/awk/err-008.awk +++ /dev/null @@ -1,6 +0,0 @@ - -BEGIN { - local substr; - substr = 20; -} - diff --git a/qse/cmd/awk/err-008.out b/qse/cmd/awk/err-008.out deleted file mode 100644 index dd1f0b33..00000000 --- a/qse/cmd/awk/err-008.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [58] LINE [3] intrinsic function 'substr' redefined diff --git a/qse/cmd/awk/err-009.out b/qse/cmd/awk/err-009.out deleted file mode 100644 index 96f694b7..00000000 --- a/qse/cmd/awk/err-009.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [53] LINE [13] 'abc' not a valid function name diff --git a/qse/cmd/awk/err-010.awk b/qse/cmd/awk/err-010.awk deleted file mode 100644 index fd67e865..00000000 --- a/qse/cmd/awk/err-010.awk +++ /dev/null @@ -1,15 +0,0 @@ - -global abc; - -function abc () -{ - local abc; - - abc = 20; - print abc; - abc (); -} - -BEGIN { - abc (); -} diff --git a/qse/cmd/awk/err-010.out b/qse/cmd/awk/err-010.out deleted file mode 100644 index 1ae81ea0..00000000 --- a/qse/cmd/awk/err-010.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [60] LINE [4] global variable 'abc' redefined diff --git a/qse/cmd/awk/err-011.awk b/qse/cmd/awk/err-011.awk deleted file mode 100644 index d39708d8..00000000 --- a/qse/cmd/awk/err-011.awk +++ /dev/null @@ -1,13 +0,0 @@ - -function abc (x) -{ - local x; - - x = 20; - print x; - abc (); -} - -BEGIN { - abc (); -} diff --git a/qse/cmd/awk/err-011.out b/qse/cmd/awk/err-011.out deleted file mode 100644 index e8cc4df4..00000000 --- a/qse/cmd/awk/err-011.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [61] LINE [4] parameter 'x' redefined diff --git a/qse/cmd/awk/err-012.awk b/qse/cmd/awk/err-012.awk deleted file mode 100644 index 059c8d55..00000000 --- a/qse/cmd/awk/err-012.awk +++ /dev/null @@ -1,14 +0,0 @@ - -function abc () -{ - local j ; - - j = 20; - print j; - abc (); -} - -global abc; -BEGIN { - abc (); -} diff --git a/qse/cmd/awk/err-012.out b/qse/cmd/awk/err-012.out deleted file mode 100644 index bbb3ffc8..00000000 --- a/qse/cmd/awk/err-012.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [59] LINE [11] function 'abc' redefined diff --git a/qse/cmd/awk/err-013.awk b/qse/cmd/awk/err-013.awk deleted file mode 100644 index f0422a70..00000000 --- a/qse/cmd/awk/err-013.awk +++ /dev/null @@ -1,4 +0,0 @@ -function abc (abc) -{ - abc (); # invalid as abc is the parameter in this context -} diff --git a/qse/cmd/awk/err-013.out b/qse/cmd/awk/err-013.out deleted file mode 100644 index 30b648de..00000000 --- a/qse/cmd/awk/err-013.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [53] LINE [3] 'abc' not a valid function name diff --git a/qse/cmd/awk/err-014.out b/qse/cmd/awk/err-014.out deleted file mode 100644 index 81213803..00000000 --- a/qse/cmd/awk/err-014.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [44] LINE [5] a colon expected in place of ';' diff --git a/qse/cmd/awk/err-015.out b/qse/cmd/awk/err-015.out deleted file mode 100644 index 5ed31c22..00000000 --- a/qse/cmd/awk/err-015.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [39] LINE [2] a left parenthesis expected in place of '=' diff --git a/qse/cmd/awk/err-016.awk b/qse/cmd/awk/err-016.awk deleted file mode 100644 index 28a3e1a8..00000000 --- a/qse/cmd/awk/err-016.awk +++ /dev/null @@ -1,5 +0,0 @@ - -BEGIN -{ - print "hello world"; -} diff --git a/qse/cmd/awk/err-016.out b/qse/cmd/awk/err-016.out deleted file mode 100644 index c1b682a6..00000000 --- a/qse/cmd/awk/err-016.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [54] LINE [2] BEGIN not followed by a left bracket on the same line diff --git a/qse/cmd/awk/err-017.out b/qse/cmd/awk/err-017.out deleted file mode 100644 index 82efcf63..00000000 --- a/qse/cmd/awk/err-017.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [66] LINE [1] '+' not a valid parameter name diff --git a/qse/cmd/awk/err-018.out b/qse/cmd/awk/err-018.out deleted file mode 100644 index fe048c82..00000000 --- a/qse/cmd/awk/err-018.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [67] LINE [1] '+' not a valid variable name diff --git a/qse/cmd/awk/err-019.out b/qse/cmd/awk/err-019.out deleted file mode 100644 index ef881643..00000000 --- a/qse/cmd/awk/err-019.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [67] LINE [3] '+' not a valid variable name diff --git a/qse/cmd/awk/err-020.awk b/qse/cmd/awk/err-020.awk deleted file mode 100644 index a0ababa4..00000000 --- a/qse/cmd/awk/err-020.awk +++ /dev/null @@ -1,4 +0,0 @@ -BEGIN { - print abc > "123\0abc"; -} - diff --git a/qse/cmd/awk/err-020.out b/qse/cmd/awk/err-020.out deleted file mode 100644 index fc6aab28..00000000 --- a/qse/cmd/awk/err-020.out +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN { - print abc > "123\0abc"; -} - -RUN ERROR: CODE [115] LINE [2] i/o name containing a null character diff --git a/qse/cmd/awk/err-021.awk b/qse/cmd/awk/err-021.awk deleted file mode 100644 index 5f3e5b13..00000000 --- a/qse/cmd/awk/err-021.awk +++ /dev/null @@ -1,4 +0,0 @@ -BEGIN { - xx = 20; - split ("a b c", xx); -} diff --git a/qse/cmd/awk/err-021.out b/qse/cmd/awk/err-021.out deleted file mode 100644 index 2de186f8..00000000 --- a/qse/cmd/awk/err-021.out +++ /dev/null @@ -1,6 +0,0 @@ -BEGIN { - xx = 20; - split ("a b c",xx); -} - -RUN ERROR: CODE [100] LINE [3] cannot change a scalar value to a map diff --git a/qse/cmd/awk/err-022.out b/qse/cmd/awk/err-022.out deleted file mode 100644 index 288bc184..00000000 --- a/qse/cmd/awk/err-022.out +++ /dev/null @@ -1 +0,0 @@ -PARSE ERROR: CODE [64] LINE [1] duplicate global variable 'ARGV' diff --git a/qse/cmd/awk/err-en.data b/qse/cmd/awk/err-en.data deleted file mode 100644 index 43684d80..00000000 --- a/qse/cmd/awk/err-en.data +++ /dev/null @@ -1,2 +0,0 @@ -data 1 -data 2 diff --git a/qse/cmd/awk/histsort.awk b/qse/cmd/awk/histsort.awk deleted file mode 100644 index 2ab2ba7f..00000000 --- a/qse/cmd/awk/histsort.awk +++ /dev/null @@ -1,8 +0,0 @@ -{ - if (data[$0]++ == 0) lines[++count] = $0; -} - -END { - for (i = 1; i <= count; i++) print lines[i]; -} - diff --git a/qse/cmd/awk/ite-001.awk b/qse/cmd/awk/ite-001.awk deleted file mode 100644 index 02f1e014..00000000 --- a/qse/cmd/awk/ite-001.awk +++ /dev/null @@ -1,7 +0,0 @@ -{ - i = 1; - while (i <= $3) { - printf ("\t%.2f\n", $1*(1+$2)**i); - i = i + 1; - } -} diff --git a/qse/cmd/awk/ite-002.awk b/qse/cmd/awk/ite-002.awk deleted file mode 100644 index 17147dff..00000000 --- a/qse/cmd/awk/ite-002.awk +++ /dev/null @@ -1,4 +0,0 @@ -{ - for (i = 1; i <= $3; i=i+1) - printf ("\t%.2f\n", $1*(1+$2)**i); -} diff --git a/qse/cmd/awk/main-001.awk b/qse/cmd/awk/main-001.awk deleted file mode 100644 index 6e486411..00000000 --- a/qse/cmd/awk/main-001.awk +++ /dev/null @@ -1,5 +0,0 @@ -function main() { - x = 0; - y = 0; - return 999; -} diff --git a/qse/cmd/awk/main-001.out b/qse/cmd/awk/main-001.out deleted file mode 100644 index d8006685..00000000 --- a/qse/cmd/awk/main-001.out +++ /dev/null @@ -1,7 +0,0 @@ -function main () -{ - x = 0; - y = 0; - return 999; -} - diff --git a/qse/cmd/awk/main-002.out b/qse/cmd/awk/main-002.out deleted file mode 100644 index cb5fb5b1..00000000 --- a/qse/cmd/awk/main-002.out +++ /dev/null @@ -1,42 +0,0 @@ -function error () -{ - exit 200; -} - -function getx () -{ - if ((x == 2)) - error (); - return (x)++; -} - -function gety () -{ - return (y)++; -} - -function main () -{ - x = 0; - y = 0; - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); - return 999; -} - -END { - print "END OF PROGRAM"; - return 10; -} -END { - print "END OF PROGRAM 2"; - exit 100; -} -END { - print "END OF PROGRAM 3"; - exit 900; -} -0 -2 diff --git a/qse/cmd/awk/pow.awk b/qse/cmd/awk/pow.awk deleted file mode 100644 index 9778fe0b..00000000 --- a/qse/cmd/awk/pow.awk +++ /dev/null @@ -1,43 +0,0 @@ -BEGIN { - print 3**2; - print -3**2; - print (-3)**2; - print 3**2**3**2; - print -3**2**-3**2; - print (-3)**2**(-3)**2; - print 3**-2**3**-2;; - print -2 ** 3; - print -2 ** -3; - - print 0 ** 0; - print 0 ** 1; - #print 0 ** -1; - print -1 ** 4; - print -1 ** 5; - - print "-------------------"; - - print 3.0 ** 2; - print 3.0 ** -2; - print -2.0 ** 3; - print -2.0 ** -3; - - print 0.0 ** 0; - print 0.0 ** 1; - #print 0.0 ** -1; - print -1.0 ** 4; - print -1.0 ** 5; - - print -2.12 ** 3; - print 2.12 ** -3; - print -12.12 ** 3; - print 12.12 ** -3; - - print 0.000000001 ** 30; - print 0.000000002 ** 30; - print 0.000000000000000000000000000000000000000000000000000000001 ** 30; - print 0.000000000000000000000000000000000000000000000000000000002 ** 30; - - print "-------------------"; -} - diff --git a/qse/cmd/awk/regress.sh b/qse/cmd/awk/regress.sh deleted file mode 100755 index 064ac86c..00000000 --- a/qse/cmd/awk/regress.sh +++ /dev/null @@ -1,244 +0,0 @@ -#!/bin/sh - -OPTION="-explicit -implicit" - -run_script_for_init() -{ - script="$1" - data="$2" - output=`echo $script | sed 's/\.awk$/.out/g'` - - "$ASEAWK" $OPTION -d -f "$script" "$data" > "$output" -} - -run_script_for_init_nodata() -{ - script="$1" - output=`echo $script | sed 's/\.awk$/.out/g'` - - "$ASEAWK" $OPTION -d -f "$script" > "$output" -} - -run_script_for_init_main() -{ - script="$1" - output=`echo $script | sed 's/\.awk$/.out/g'` - - "$ASEAWK" $OPTION -m main -d -f "$script" > "$output" -} - -run_init() -{ - for script in simple-???.awk - do - run_script_for_init_nodata "$script" - done - - for script in main-???.awk - do - run_script_for_init_main "$script" - done - - for script in cou-???.awk - do - run_script_for_init "$script" "cou-en.data" - done - - for script in adr-???.awk - do - run_script_for_init "$script" "adr-en.data" - done - - for script in err-???.awk - do - run_script_for_init "$script" "err-en.data" - done -} - -run_script_for_test() -{ - script="$1" - data="$2" - output=`echo $script | sed 's/\.awk$/.out/g'` - - echo ">> RUNNING $script" - "$ASEAWK" $OPTION -d -f "$script" "$data" > "$output.$pid" - - #diff -y "$output" "$output.$pid" - diff "$output" "$output.$pid" - if [ $? -ne 0 ] - then - rm -f "$output.$pid" - return 1 - fi - - rm -f "$output.$pid" - return 0 -} - -run_script_for_test_nodata() -{ - script="$1" - output=`echo $script | sed 's/\.awk$/.out/g'` - - echo ">> RUNNING $script" - "$ASEAWK" $OPTION -d -f "$script" > "$output.$pid" - - #diff -y "$output" "$output.$pid" - diff "$output" "$output.$pid" - if [ $? -ne 0 ] - then - rm -f "$output.$pid" - return 1 - fi - - rm -f "$output.$pid" - return 0 -} - -run_script_for_test_main() -{ - script="$1" - output=`echo $script | sed 's/\.awk$/.out/g'` - - echo ">> RUNNING $script" - "$ASEAWK" $OPTION -m main -d -f "$script" > "$output.$pid" - - #diff -y "$output" "$output.$pid" - diff "$output" "$output.$pid" - if [ $? -ne 0 ] - then - rm -f "$output.$pid" - return 1 - fi - - rm -f "$output.$pid" - return 0 -} - -run_test() -{ - pid=$$ - - for script in simple-???.awk - do - run_script_for_test_nodata "$script" - [ $? -ne 0 ] && { - echo "###################################" - echo "PROBLEM(S) DETECTED IN $script.". - echo "###################################" - - echo "Do you want to abort? [y/n]" - read ans - [ "$ans" = "y" -o "$ans" = "Y" ] && return 1 - } - done - - for script in main-???.awk - do - run_script_for_test_main "$script" - [ $? -ne 0 ] && { - echo "###################################" - echo "PROBLEM(S) DETECTED IN $script.". - echo "###################################" - - echo "Do you want to abort? [y/n]" - read ans - [ "$ans" = "y" -o "$ans" = "Y" ] && return 1 - } - done - - for script in cou-???.awk - do - run_script_for_test "$script" "cou-en.data" - [ $? -ne 0 ] && { - echo "###################################" - echo "PROBLEM(S) DETECTED IN $script.". - echo "###################################" - - echo "Do you want to abort? [y/n]" - read ans - [ "$ans" = "y" -o "$ans" = "Y" ] && return 1 - } - done - - for script in adr-???.awk - do - run_script_for_test "$script" "adr-en.data" - if [ $? -ne 0 ] - then - echo "###################################" - echo "PROBLEM(S) DETECTED IN $script.". - echo "###################################" - - echo "Do you want to abort? [y/n]" - read ans - if [ "$ans" = "y" -o "$ans" = "Y" ] - then - return 1 - fi - fi - done - - for script in err-???.awk - do - run_script_for_test "$script" "err-en.data" - if [ $? -ne 0 ] - then - echo "###################################" - echo "PROBLEM(S) DETECTED IN $script.". - echo "###################################" - - echo "Do you want to abort? [y/n]" - read ans - if [ "$ans" = "y" -o "$ans" = "Y" ] - then - return 1 - fi - fi - done - - return 0 -} - -print_usage() -{ - echo "Usage: $0 init" - echo " $0 test" -} - -#--------# -# main # -#--------# - -if [ -x ./aseawk ] -then - ASEAWK="./aseawk" -elif [ -x ../../release/bin/aseawk ] -then - ASEAWK="../../release/bin/aseawk" -elif [ -x ../../debug/bin/aseawk ] -then - ASEAWK="../../debug/bin/aseawk" -else - echo "Error: cannot locate a relevant awk interpreter" - exit 1; -fi - -[ $# -ne 1 ] && { - print_usage "$0" - exit 1 -} - -if [ "$1" = "init" ] -then - run_init -elif [ "$1" = "test" ] -then - run_test -else - print_usage "$0" - exit 1 -fi - -exit 0 diff --git a/qse/cmd/awk/simple-001.awk b/qse/cmd/awk/simple-001.awk deleted file mode 100644 index 87e95027..00000000 --- a/qse/cmd/awk/simple-001.awk +++ /dev/null @@ -1,18 +0,0 @@ - - function error() { exit (200); } - function getx() - { - if (x == 2) error(); - return x++; - } - - function gety() { return y++; } - - BEGIN { - x = 0; - y = 0; - print getx() + gety(); - print getx() + gety(); - print getx() + gety(); - print getx() + gety(); - } diff --git a/qse/cmd/awk/simple-001.out b/qse/cmd/awk/simple-001.out deleted file mode 100644 index 98adc277..00000000 --- a/qse/cmd/awk/simple-001.out +++ /dev/null @@ -1,28 +0,0 @@ -function error () -{ - exit 200; -} - -function getx () -{ - if ((x == 2)) - error (); - return (x)++; -} - -function gety () -{ - return (y)++; -} - -BEGIN { - x = 0; - y = 0; - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); -} - -0 -2 diff --git a/qse/cmd/awk/simple-002.awk b/qse/cmd/awk/simple-002.awk deleted file mode 100644 index 4d3ae5b5..00000000 --- a/qse/cmd/awk/simple-002.awk +++ /dev/null @@ -1,24 +0,0 @@ - - function error() { exit (200); } - function getx() - { - if (x == 2) error(); - return x++; - } - - function gety() { return y++; } - - BEGIN { - x = 0; - y = 0; - print getx() + gety(); - print getx() + gety(); - print getx() + gety(); - print getx() + gety(); - } - - - END { - print "END OF PROGRAM"; - } - diff --git a/qse/cmd/awk/simple-002.out b/qse/cmd/awk/simple-002.out deleted file mode 100644 index 07fbf211..00000000 --- a/qse/cmd/awk/simple-002.out +++ /dev/null @@ -1,32 +0,0 @@ -function error () -{ - exit 200; -} - -function getx () -{ - if ((x == 2)) - error (); - return (x)++; -} - -function gety () -{ - return (y)++; -} - -BEGIN { - x = 0; - y = 0; - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); -} - -END { - print "END OF PROGRAM"; -} -0 -2 -END OF PROGRAM diff --git a/qse/cmd/awk/simple-003.awk b/qse/cmd/awk/simple-003.awk deleted file mode 100644 index 26bdb0fe..00000000 --- a/qse/cmd/awk/simple-003.awk +++ /dev/null @@ -1,25 +0,0 @@ - - function error() { exit (200); } - function getx() - { - if (x == 2) error(); - return x++; - } - - function gety() { return y++; } - - BEGIN { - x = 0; - y = 0; - print getx() + gety(); - print getx() + gety(); - print getx() + gety(); - print getx() + gety(); - } - - - END { - print "END OF PROGRAM"; - exit (20); - } - diff --git a/qse/cmd/awk/simple-003.out b/qse/cmd/awk/simple-003.out deleted file mode 100644 index 2f95cb41..00000000 --- a/qse/cmd/awk/simple-003.out +++ /dev/null @@ -1,33 +0,0 @@ -function error () -{ - exit 200; -} - -function getx () -{ - if ((x == 2)) - error (); - return (x)++; -} - -function gety () -{ - return (y)++; -} - -BEGIN { - x = 0; - y = 0; - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); -} - -END { - print "END OF PROGRAM"; - exit 20; -} -0 -2 -END OF PROGRAM diff --git a/qse/cmd/awk/simple-004.awk b/qse/cmd/awk/simple-004.awk deleted file mode 100644 index 01785f00..00000000 --- a/qse/cmd/awk/simple-004.awk +++ /dev/null @@ -1,28 +0,0 @@ - - function error() { exit (200); } - function getx() - { - if (x == 2) error(); - return x++; - } - - function gety() { return y++; } - - BEGIN { - x = 0; - y = 0; - print getx() + gety(); - print getx() + gety(); - print getx() + gety(); - print getx() + gety(); - } - - - END { - print "END OF PROGRAM"; - exit (20); - } - - END { - print "END OF PROGRAM 2"; - } diff --git a/qse/cmd/awk/simple-004.out b/qse/cmd/awk/simple-004.out deleted file mode 100644 index 747dd794..00000000 --- a/qse/cmd/awk/simple-004.out +++ /dev/null @@ -1,36 +0,0 @@ -function error () -{ - exit 200; -} - -function getx () -{ - if ((x == 2)) - error (); - return (x)++; -} - -function gety () -{ - return (y)++; -} - -BEGIN { - x = 0; - y = 0; - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); -} - -END { - print "END OF PROGRAM"; - exit 20; -} -END { - print "END OF PROGRAM 2"; -} -0 -2 -END OF PROGRAM diff --git a/qse/cmd/awk/simple-005.awk b/qse/cmd/awk/simple-005.awk deleted file mode 100644 index cfda77dd..00000000 --- a/qse/cmd/awk/simple-005.awk +++ /dev/null @@ -1,29 +0,0 @@ - - function error() { exit (200); } - function getx() - { - if (x == 2) error(); - return x++; - } - - function gety() { return y++; } - - BEGIN { - x = 0; - y = 0; - print getx() + gety(); - print getx() + gety(); - print getx() + gety(); - print getx() + gety(); - } - - - END { - print "END OF PROGRAM"; - return 10; - } - - END { - print "END OF PROGRAM 2"; - return 20; - } diff --git a/qse/cmd/awk/simple-005.out b/qse/cmd/awk/simple-005.out deleted file mode 100644 index 2161f0bd..00000000 --- a/qse/cmd/awk/simple-005.out +++ /dev/null @@ -1,38 +0,0 @@ -function error () -{ - exit 200; -} - -function getx () -{ - if ((x == 2)) - error (); - return (x)++; -} - -function gety () -{ - return (y)++; -} - -BEGIN { - x = 0; - y = 0; - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); -} - -END { - print "END OF PROGRAM"; - return 10; -} -END { - print "END OF PROGRAM 2"; - return 20; -} -0 -2 -END OF PROGRAM -END OF PROGRAM 2 diff --git a/qse/cmd/awk/simple-006.awk b/qse/cmd/awk/simple-006.awk deleted file mode 100644 index 432070b8..00000000 --- a/qse/cmd/awk/simple-006.awk +++ /dev/null @@ -1,34 +0,0 @@ - - function error() { exit (200); } - function getx() - { - if (x == 2) error(); - return x++; - } - - function gety() { return y++; } - - BEGIN { - x = 0; - y = 0; - print getx() + gety(); - print getx() + gety(); - print getx() + gety(); - print getx() + gety(); - } - - - END { - print "END OF PROGRAM"; - return 10; - } - - END { - print "END OF PROGRAM 2"; - exit (100); - } - - END { - print "END OF PROGRAM 3"; - exit (900); - } diff --git a/qse/cmd/awk/simple-006.out b/qse/cmd/awk/simple-006.out deleted file mode 100644 index 2639d36a..00000000 --- a/qse/cmd/awk/simple-006.out +++ /dev/null @@ -1,42 +0,0 @@ -function error () -{ - exit 200; -} - -function getx () -{ - if ((x == 2)) - error (); - return (x)++; -} - -function gety () -{ - return (y)++; -} - -BEGIN { - x = 0; - y = 0; - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); - print (getx () + gety ()); -} - -END { - print "END OF PROGRAM"; - return 10; -} -END { - print "END OF PROGRAM 2"; - exit 100; -} -END { - print "END OF PROGRAM 3"; - exit 900; -} -0 -2 -END OF PROGRAM -END OF PROGRAM 2 diff --git a/qse/cmd/awk/t1.awk b/qse/cmd/awk/t1.awk deleted file mode 100644 index 9cffc875..00000000 --- a/qse/cmd/awk/t1.awk +++ /dev/null @@ -1,21 +0,0 @@ -function sum(i, k, y) -{ - y = 0; - for (k = i; k; k = k - 1) - { - y = y + k; - } - - return y; - y = 10; - return y; -} - -BEGIN { - /*s = sum(10000000);*/ - s = sum (100); - print s; - return s; -} - - diff --git a/qse/cmd/awk/t10.awk b/qse/cmd/awk/t10.awk deleted file mode 100644 index b2d59ffe..00000000 --- a/qse/cmd/awk/t10.awk +++ /dev/null @@ -1,25 +0,0 @@ -BEGIN { - print "more"; - #print | "more"; - #print > "echo"; - #print >> "echo"; - - getline x < "abc"; /* open("abc", O_RDONLY|O_LARGEFILE) = 3 */ - #print 10 >> "abc"; /* open("abc", O_WRONLY|O_APPEND|O_CREAT|O_LARGEFILE, 0666) = 4 */ - getline x < "abc"; - #print x; - a = close ("abc"); /* close(4) */ - print "a=" a; - #print "hey" - b = close ("abc"); /* close(3) */ - print "b=" b; - - getline x < "Makefile.cl"; - getline y < "awk.c"; - - print x; - print y; - c = close ("Makefile.cl"); - d = close ("awk.c"); - -} diff --git a/qse/cmd/awk/t11.awk b/qse/cmd/awk/t11.awk deleted file mode 100644 index b78f07e4..00000000 --- a/qse/cmd/awk/t11.awk +++ /dev/null @@ -1,17 +0,0 @@ -BEGIN { - print "this is only a test"; - print; - print 1, 2, (3 >> 10); - print 1, 2, 3 >> 10; - print 3, 4, 5 >> 10; - close (10); - print "-------------" >> 10; - - delete abc; - delete abc["aaaa"] ; - - /* - print 1 > 2 + 3; - print 1 < 2 + 3; - */ -} diff --git a/qse/cmd/awk/t12.awk b/qse/cmd/awk/t12.awk deleted file mode 100644 index 53c5a63e..00000000 --- a/qse/cmd/awk/t12.awk +++ /dev/null @@ -1,38 +0,0 @@ -BEGIN { - /* - print "line 1" >> "1"; - print "line 2" > "1"; - print "line 3" >> "1"; - - print "line 4" >> "2"; - print "line 4" >> "3"; - print "line 4" >> "4"; - - while ((getline x < "abc") > 0) print x; - close ("abc"); - - - print "~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"; - - getline x < "abc"; - if (x == "a") print "xxxxxxxxxxxxxxxx"; else print x; - */ - - /* - print getline x; - print "[", x, "]"; - print "--------------"; - */ - - if (getline x < "abc" == -1) - { - print "ERRNO = ", ERRNO; - } - - print x > "def"; - #print "fflush(def) = ", fflush ("def"); - print "fflush() = ", fflush (""); - -# print (1 (2 getline j) j); -# print "abc" 1 + 2 3 + 49 2 / 3; -} diff --git a/qse/cmd/awk/t13.awk b/qse/cmd/awk/t13.awk deleted file mode 100644 index 45cb240d..00000000 --- a/qse/cmd/awk/t13.awk +++ /dev/null @@ -1,22 +0,0 @@ -global a; -BEGIN { - local b; - - #a = 20; - #a[1] = 20; - #a[2] = 30; - - /* - b["xxx"] = 20; - b["yyy"] = 30; - b[1] = 30; - b["2"] = 30; - - delete a; - delete b["1"]; - */ - c[1] = 20; - c[1] = "aaa"; - c = 30; -} - diff --git a/qse/cmd/awk/t14.awk b/qse/cmd/awk/t14.awk deleted file mode 100644 index b0f3aad9..00000000 --- a/qse/cmd/awk/t14.awk +++ /dev/null @@ -1,28 +0,0 @@ -global x, y; - -BEGIN { FS="A"; } - -{ - print "NF = " NF; - for (i = 0; i < 10; i++) - { - print $i; - if (i == 3) a = $i; - } - - $1 = 100; - - /*$1 = $2; - $3 = $2; - $2 = $2;*/ - - /*OFS["1234"]=":";*/ - - $20 = 10; - print $0; - print "--------------------"; - print "NF ===>>> " NF; - print "===================="; -} - -END { fflush (); system ("dir /w/p"); print sin(270); } diff --git a/qse/cmd/awk/t15.awk b/qse/cmd/awk/t15.awk deleted file mode 100644 index 6765587d..00000000 --- a/qse/cmd/awk/t15.awk +++ /dev/null @@ -1,16 +0,0 @@ -BEGIN { - local a, b; - - a = 12; - b = "<" a ">"; - - print b; - - print ("\x5C"); - print ("\x5C6_ABCDEGH"); - print ("\xZZ5C6_ABCDEGH"); - print ("\xZZ5C6_AB\u7658&&"); - print "\uC720\uB2C8\uCF54\uB4DC \uD14C\uC2A4\uD2B8"; - print "\UC720\UB2C8\UCF54\UB4DC \UD14C\UC2A4\UD2B8"; -} - diff --git a/qse/cmd/awk/t16.awk b/qse/cmd/awk/t16.awk deleted file mode 100644 index d383b877..00000000 --- a/qse/cmd/awk/t16.awk +++ /dev/null @@ -1 +0,0 @@ -{ /*$0=" "; */ print NF; print "a" $0 "b"; x = $1; } diff --git a/qse/cmd/awk/t17.awk b/qse/cmd/awk/t17.awk deleted file mode 100644 index 92fc9831..00000000 --- a/qse/cmd/awk/t17.awk +++ /dev/null @@ -1,18 +0,0 @@ -/hello[[:space:]]/ { - print $0; - print "INTERNAL LOOP NF=" NF; - for (i = 0; i < NF; i++) - { - print "[" $(i+1) "]"; - } - #getline a; - #print a; - - if (getline > 0) print $0; - print "GETLINE NF=" NF; - for (i = 0; i < NF; i++) - { - print "[" $(i+1) "]"; - } - print "----------------"; -} diff --git a/qse/cmd/awk/t18.awk b/qse/cmd/awk/t18.awk deleted file mode 100644 index 1e012fff..00000000 --- a/qse/cmd/awk/t18.awk +++ /dev/null @@ -1,21 +0,0 @@ -BEGIN { - print "0. FILENAME=", FILENAME, "FNR=", FNR; -} - -/hello/ { - print "1. FILENAME=", FILENAME, "FNR=", FNR; - print "[" $0 "]"; - #nextfile; - print "----------------"; -} - -/hello/ { - print "2. FILENAME=", FILENAME, "FNR=", FNR; - print "[" $0 "]"; - nextfile; - print "----------------"; -} - -END { - print "== END OF PROGRAM =="; -} diff --git a/qse/cmd/awk/t19.awk b/qse/cmd/awk/t19.awk deleted file mode 100644 index 836544c1..00000000 --- a/qse/cmd/awk/t19.awk +++ /dev/null @@ -1,4 +0,0 @@ -//BEGIN { nlines="-0.345"; } - { nlines++; } -END { print nlines; } - diff --git a/qse/cmd/awk/t2.awk b/qse/cmd/awk/t2.awk deleted file mode 100644 index 9a74d34c..00000000 --- a/qse/cmd/awk/t2.awk +++ /dev/null @@ -1,24 +0,0 @@ -global z, x; - -function sum (i) -{ - local k, y; - - y = 0; - for (k = i; k; k = k - 1) - { - y = y + k; - } - - return y; - y = 10; - return y; -} - -END { - /*x = sum (10000000); - */ - x = sum (100); - s = x; - ss = z; -} diff --git a/qse/cmd/awk/t20.awk b/qse/cmd/awk/t20.awk deleted file mode 100644 index 41df5047..00000000 --- a/qse/cmd/awk/t20.awk +++ /dev/null @@ -1,8 +0,0 @@ -//"abc" != "def" { -/a\/b/ { - print $0 ~ /abc/; - print $0 !~ /abc/; - print $0 ~ "abc[[:space:]]"; - print $0 !~ "abc"; - print /abc/; -} diff --git a/qse/cmd/awk/t21.awk b/qse/cmd/awk/t21.awk deleted file mode 100644 index 33fe1fd5..00000000 --- a/qse/cmd/awk/t21.awk +++ /dev/null @@ -1,8 +0,0 @@ -BEGIN { exit 10; } - -{ - print $0; - #print close (""); -} - -END { print "== END OF PROGRAM =="; } diff --git a/qse/cmd/awk/t22.awk b/qse/cmd/awk/t22.awk deleted file mode 100644 index defc73ec..00000000 --- a/qse/cmd/awk/t22.awk +++ /dev/null @@ -1,15 +0,0 @@ -//BEGIN { exit 10; } - -//{ while (1) {if (x == 20) continue; if (a) break; while (10) break; }} -//END { while (1) {if (x == 20) continue; if (a) break; while (10) break; }} - -{ - //return 20; - - print getline abc < ""; - print "[[" abc "]]"; - print close(""); - //exit 20; -} - -END { print "end"; } diff --git a/qse/cmd/awk/t23.awk b/qse/cmd/awk/t23.awk deleted file mode 100644 index d3a3c414..00000000 --- a/qse/cmd/awk/t23.awk +++ /dev/null @@ -1,19 +0,0 @@ -/* -{ - print "ALL ==> " $0; -} - -/1/,/5/ -{ - - print "/1/,/5/ ==> " $0; -} -*/ - - -BEGIN { c["Europe"] = "XXX"; } - -/Europe/, /Africa/ { print $0; } - -//(a = "20") { } -/*"Europe" in c { print $0; }*/ diff --git a/qse/cmd/awk/t24.awk b/qse/cmd/awk/t24.awk deleted file mode 100644 index ece42637..00000000 --- a/qse/cmd/awk/t24.awk +++ /dev/null @@ -1,6 +0,0 @@ -BEGIN { - - a["abc\0\0xxx"] = "abcdefg"; - print a["abc"]; - print a["abc\0\0xxx"]; -} diff --git a/qse/cmd/awk/t25.awk b/qse/cmd/awk/t25.awk deleted file mode 100644 index c14c928d..00000000 --- a/qse/cmd/awk/t25.awk +++ /dev/null @@ -1,13 +0,0 @@ -/Europe/, /Africa/ - - 1 - 2 - 3 % 23 - -/zab/ { print "XXXX"; } - -{ - print /ABC/ ~ /DEF/; -} - -/zzz/ diff --git a/qse/cmd/awk/t26.awk b/qse/cmd/awk/t26.awk deleted file mode 100644 index 442d5770..00000000 --- a/qse/cmd/awk/t26.awk +++ /dev/null @@ -1,13 +0,0 @@ -function call_next () -{ - next; -} - -BEGIN { - #call_next (); -} - -END { - call_next (); -} - diff --git a/qse/cmd/awk/t27.awk b/qse/cmd/awk/t27.awk deleted file mode 100644 index f963d63a..00000000 --- a/qse/cmd/awk/t27.awk +++ /dev/null @@ -1,6 +0,0 @@ -global a, b, c; - -BEGIN { while (1) while(1) while (1) a = 20; } - -END { while (1) while(1) while (1) ; } - diff --git a/qse/cmd/awk/t28.awk b/qse/cmd/awk/t28.awk deleted file mode 100644 index 73599250..00000000 --- a/qse/cmd/awk/t28.awk +++ /dev/null @@ -1,41 +0,0 @@ -#global xyz; - -END { - #local xyz; - - print index ("abc", "abc"); - print index ("abc", "b"); - print index ("abc", "kabc"); - - print "----------------------------"; - print substr ("abc", "abcdefg", 5); - print substr ("abc", -1, 5); - print substr ("abc", 0, 5); - print substr ("abc", 1, 5); - print substr ("abc", 2.829, 5); - print substr ("abc", "3", 5); - print substr ("abc", 4, 5); - - /* - a[1] = 20; - substr (a, 3, 4); - */ - - print tolower ("AbcDEF"); - print toupper ("AbcDEF"); - - arr[0] = "xxx"; - #print split ("abc def abc", arr); - print split ("abc def kkk", j); - print split ("abc def kkk", $0); # error - - #xyz = 20; - #print xyz; - print split ("abc def kkk", ((xyz))); - #for (i in arr) - - for (i in xyz) - { - print i, " ", xyz[i]; - } -} diff --git a/qse/cmd/awk/t29.awk b/qse/cmd/awk/t29.awk deleted file mode 100644 index 0e852b8b..00000000 --- a/qse/cmd/awk/t29.awk +++ /dev/null @@ -1,3 +0,0 @@ -{ print $0; } -//{ gsub ("abc", "&&&&"); print $0; } - diff --git a/qse/cmd/awk/t3.awk b/qse/cmd/awk/t3.awk deleted file mode 100644 index 13453cb2..00000000 --- a/qse/cmd/awk/t3.awk +++ /dev/null @@ -1,25 +0,0 @@ -#global x, j; - -function func1 (x) -{ - c = x["abc"]; - x["abc"] = 123; -} - -BEGIN { - idx="abc"; - x[idx] = 12345; - i = x[idx]; - x["1"] = 1; - x["2"] = 2; - - func1 (x); - k = x[idx]; - return j; - - /* - x["abc"] = 12345; - i = x["abc"]; - return j; - */ -} diff --git a/qse/cmd/awk/t30.awk b/qse/cmd/awk/t30.awk deleted file mode 100644 index 4ee22397..00000000 --- a/qse/cmd/awk/t30.awk +++ /dev/null @@ -1,3 +0,0 @@ -#{ "dir/w/p" | getline; print $0; print "flush(dir/w/p)=", fflush("dir/w/p"); } -#{ print | "grep Asia"; fflush("grep Asia"); } -{ print | "grep Asia"; print "flush(grep Asia)=", fflush("grep Asia"); } diff --git a/qse/cmd/awk/t31.awk b/qse/cmd/awk/t31.awk deleted file mode 100644 index a98a5db1..00000000 --- a/qse/cmd/awk/t31.awk +++ /dev/null @@ -1,2 +0,0 @@ -BEGIN { RS=""; } -{ print $0; } diff --git a/qse/cmd/awk/t32.awk b/qse/cmd/awk/t32.awk deleted file mode 100644 index 928de97f..00000000 --- a/qse/cmd/awk/t32.awk +++ /dev/null @@ -1,2 +0,0 @@ -BEGIN { /*RS = "Asia";*/ /*RS=746;*/ /*RS="";*/ RS=/USA/; } -{ print NR, " ", $0; } diff --git a/qse/cmd/awk/t33.awk b/qse/cmd/awk/t33.awk deleted file mode 100644 index 8d711674..00000000 --- a/qse/cmd/awk/t33.awk +++ /dev/null @@ -1,15 +0,0 @@ -BEGIN { - ARGV[1] = 20; - print "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"; - - delete NF; - print "NF[1]=", NF[1]; - - NF[1] = 20; # this line should not be allowed - print "AWK IMPLEMENTATION ERROR: hey... NF[1] = 20 has succeeded in the BEGIN block. your interpreter must be wrong"; - print "NF[1]=", NF[1]; -} - -{ - NF = 30; -} diff --git a/qse/cmd/awk/t34.awk b/qse/cmd/awk/t34.awk deleted file mode 100644 index 7e5e5b5c..00000000 --- a/qse/cmd/awk/t34.awk +++ /dev/null @@ -1 +0,0 @@ -/* unterminated comment diff --git a/qse/cmd/awk/t35.awk b/qse/cmd/awk/t35.awk deleted file mode 100644 index b7958ea9..00000000 --- a/qse/cmd/awk/t35.awk +++ /dev/null @@ -1,4 +0,0 @@ -BEGIN { - print //; - print / /; -} diff --git a/qse/cmd/awk/t36.awk b/qse/cmd/awk/t36.awk deleted file mode 100644 index bacdcd8d..00000000 --- a/qse/cmd/awk/t36.awk +++ /dev/null @@ -1,47 +0,0 @@ -# test cases -# -# input data [] -# result: -# NF=0 -# -# input data [abcdefg] -# NF=2 -# 0 [] -# 1 [bcdefg] -# -# input data [abdefg abcdefg] -# NF=3 -# 0 [] -# 1 [bdefg ] -# 2 [bcdefg] -# -# input data [ abcdefg hij a a] -# NF=4 -# 0 [ ] -# 1 [bcdefg hij ] -# 2 [ ] -# 3 [] -# -# input data [ abcdefg hij a a ] -# NF=4 -# 0 [ ] -# 1 [bcdefg hij ] -# 2 [ ] -# 3 [ ] -# -# input data [aaaaa] -# NF=6 -# 0 [] -# 1 [] -# 2 [] -# 3 [] -# 4 [] -# 5 [] -# - -BEGIN { FS="a"; } -{ - print "NF=" NF; - for (i = 0; i < NF; i++) print i " [" $(i+1) "]"; -} - diff --git a/qse/cmd/awk/t37.awk b/qse/cmd/awk/t37.awk deleted file mode 100644 index fb022a8d..00000000 --- a/qse/cmd/awk/t37.awk +++ /dev/null @@ -1,6 +0,0 @@ -BEGIN { FS=" "; } -{ - print "NF=" NF; - for (i = 0; i < NF; i++) print i " [" $(i+1) "]"; -} - diff --git a/qse/cmd/awk/t38.awk b/qse/cmd/awk/t38.awk deleted file mode 100644 index 78ea5c19..00000000 --- a/qse/cmd/awk/t38.awk +++ /dev/null @@ -1,9 +0,0 @@ - -BEGIN { - split (" a b c d e ", x, ""); - for (j in x) print j "->" x[j]; - print "-------------------"; - split ("a b c d e", x, "b c"); - for (j in x) print j "->" x[j]; - print "-------------------"; -} diff --git a/qse/cmd/awk/t39.awk b/qse/cmd/awk/t39.awk deleted file mode 100644 index 805f828f..00000000 --- a/qse/cmd/awk/t39.awk +++ /dev/null @@ -1,9 +0,0 @@ -BEGIN { - FS="[:[:space:]]+"; - #FS=":+"; -} -{ - print "NF=" NF; - for (i = 0; i < NF; i++) print i " [" $(i+1) "]"; -} - diff --git a/qse/cmd/awk/t4.awk b/qse/cmd/awk/t4.awk deleted file mode 100644 index 707c75f7..00000000 --- a/qse/cmd/awk/t4.awk +++ /dev/null @@ -1,21 +0,0 @@ -function main (arg1, arg2, arg3) -{ - local i, k, c; - - for (i = 0; i < 10; i++) - { - abc[i*2] = i; - } - - k = 20; - - for (i = 0; i < 100; i++) - { - if (i in abc) j[i] = i; - } - - print arg1; - print arg2; - print arg3; - print "end of program"; -} diff --git a/qse/cmd/awk/t40.awk b/qse/cmd/awk/t40.awk deleted file mode 100644 index d0fdfddc..00000000 --- a/qse/cmd/awk/t40.awk +++ /dev/null @@ -1,8 +0,0 @@ -BEGIN { - FS="[a-c]+"; - IGNORECASE=0.1; -} -{ - print "NF=" NF; - for (i = 0; i < NF; i++) print i " [" $(i+1) "]"; -} diff --git a/qse/cmd/awk/t41.awk b/qse/cmd/awk/t41.awk deleted file mode 100644 index 6a82e3d1..00000000 --- a/qse/cmd/awk/t41.awk +++ /dev/null @@ -1,4 +0,0 @@ -BEGIN { IGNORECASE=1; } -$0 == "abc" { - print "[" $0 "]"; -} diff --git a/qse/cmd/awk/t42.awk b/qse/cmd/awk/t42.awk deleted file mode 100644 index 259c7bd2..00000000 --- a/qse/cmd/awk/t42.awk +++ /dev/null @@ -1,13 +0,0 @@ - -BEGIN { - FS=":"; - OFS="::"; -} - -{ - $2=1.23; - NF=4; - print "NF=" NF; - print "[" $10 "]"; - print "$0=[" $0 "]"; -} diff --git a/qse/cmd/awk/t43.awk b/qse/cmd/awk/t43.awk deleted file mode 100644 index 6b168030..00000000 --- a/qse/cmd/awk/t43.awk +++ /dev/null @@ -1,3 +0,0 @@ -#BEGIN { t = "abc"; gsub ("abc", "[&]", t); print t; } -{ gsub ("abc", "ABC"); print $0; } -{ gsub (/ABC/, "XYZ"); print $0; } diff --git a/qse/cmd/awk/t44.awk b/qse/cmd/awk/t44.awk deleted file mode 100644 index f5dcb17c..00000000 --- a/qse/cmd/awk/t44.awk +++ /dev/null @@ -1,3 +0,0 @@ -#BEGIN { t = "abc"; gsub ("abc", "[&]", t); print t; } -{ c=$0; print sub ("abc", "ABC", c); print c; } -{ sub (/ABC/, "XYZ", c); print c; } diff --git a/qse/cmd/awk/t45.awk b/qse/cmd/awk/t45.awk deleted file mode 100644 index 17fd5dbc..00000000 --- a/qse/cmd/awk/t45.awk +++ /dev/null @@ -1 +0,0 @@ -BEGIN { t[1] = "abc"; gsub ("abc", "[&]", t); print t[1]; } diff --git a/qse/cmd/awk/t46.awk b/qse/cmd/awk/t46.awk deleted file mode 100644 index 2f4ee02c..00000000 --- a/qse/cmd/awk/t46.awk +++ /dev/null @@ -1 +0,0 @@ -BEGIN { t = "whoabcabcabcwho"; gsub ("abc", "[\\&][&][\\&]", t); print t; } diff --git a/qse/cmd/awk/t47.awk b/qse/cmd/awk/t47.awk deleted file mode 100644 index 15831ab4..00000000 --- a/qse/cmd/awk/t47.awk +++ /dev/null @@ -1,19 +0,0 @@ -BEGIN { - - a[1] = 20; - a[2] = 40; - a[3,5,6] = 40; - a["abc"] = 20; - - for (i in a) print "a[" i "]=" a[i]; - #SUBSEP=",,,"; - SUBSEP=4.5; - #SUBSEP=555; - - print "------------------------"; - - a[9,x,3] = 40; - for (i in a) print "a[" i "]=" a[i]; -} - - diff --git a/qse/cmd/awk/t48.awk b/qse/cmd/awk/t48.awk deleted file mode 100644 index 7ac01c7a..00000000 --- a/qse/cmd/awk/t48.awk +++ /dev/null @@ -1,3 +0,0 @@ -BEGIN { - print ("xx" in j); -} diff --git a/qse/cmd/awk/t49.awk b/qse/cmd/awk/t49.awk deleted file mode 100644 index 6b907471..00000000 --- a/qse/cmd/awk/t49.awk +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN { OFS=":"; } -{ - print $5 = "abc"; - print $0; -} diff --git a/qse/cmd/awk/t5.awk b/qse/cmd/awk/t5.awk deleted file mode 100644 index 120ca533..00000000 --- a/qse/cmd/awk/t5.awk +++ /dev/null @@ -1,10 +0,0 @@ -BEGIN { - x[1] = 20; - x[2] = 40; - x[3] = 50; - - for (i in x) - { - j[i] = i; - } -} diff --git a/qse/cmd/awk/t50.awk b/qse/cmd/awk/t50.awk deleted file mode 100644 index b6258c84..00000000 --- a/qse/cmd/awk/t50.awk +++ /dev/null @@ -1,6 +0,0 @@ -BEGIN { - two = 2; three = 3; - print (two three) + 4; -} - - diff --git a/qse/cmd/awk/t6.awk b/qse/cmd/awk/t6.awk deleted file mode 100644 index 281567d5..00000000 --- a/qse/cmd/awk/t6.awk +++ /dev/null @@ -1,21 +0,0 @@ -BEGIN { - j = -20; - - for (i = -10; i < 10; i++) - { - if (i == 5) exit; - #if (i == 5) break; - } - - - while (j < 10) - { - if (j == 5) break; - j++; - } -} - -END { - print "i = ", i; - print "j = ", j; -} diff --git a/qse/cmd/awk/t7.awk b/qse/cmd/awk/t7.awk deleted file mode 100644 index 8a431564..00000000 --- a/qse/cmd/awk/t7.awk +++ /dev/null @@ -1,5 +0,0 @@ -BEGIN { i = 20; j = 0; } -{ i++; /*i = i + 1;*/ } -i % 2 { /*j ++;*/ j = j + 1; } -/*"1","2" || "Yes" {}*/ -/*END { i = i + 1234; j = j + 1234; }*/ diff --git a/qse/cmd/awk/t8.awk b/qse/cmd/awk/t8.awk deleted file mode 100644 index fd0cbe73..00000000 --- a/qse/cmd/awk/t8.awk +++ /dev/null @@ -1,2 +0,0 @@ -BEGIN { 10; 20; 30; i = 40; i++; } - diff --git a/qse/cmd/awk/t9.awk b/qse/cmd/awk/t9.awk deleted file mode 100644 index bf5b5414..00000000 --- a/qse/cmd/awk/t9.awk +++ /dev/null @@ -1,25 +0,0 @@ -BEGIN { - while (("xxx /p" | getline var) > 0) ; - while (("dir /w" | getline var) > 0) ; - while ((getline var < "t9.awk") > 0) ; - - zzz = close ("xxx /p"); - /* - while ("ls -l" | getline var) - { - "ls -l" | getline x; - print var; print x; - } - - while (getline < "/etc/passwd") - { - print $0; - } - - while (getline x < "/etc/shadow") - { - print x; - } - */ -} - diff --git a/qse/cmd/awk/x.awk b/qse/cmd/awk/x.awk deleted file mode 100644 index 2e606fef..00000000 --- a/qse/cmd/awk/x.awk +++ /dev/null @@ -1,32 +0,0 @@ -#main () -{ - #print (("%f", 1.0)); # syntax error - print ((10) + 20 * 4); - print ((10) + 20 * 4, (20), (30)); - print (10) + 20 * 4, (20), (30); - print (("%f", 1.0) in x); - - print ("%f", 1.0); - #print ("%f", 1.0), 1; # syntax error - print ("%f", 1.0) in x, 1; - print ((((10) + 20))); - print ((10) + 20, 50); -} - -BEGIN { - #print 1 - #| - #"test"; -# */ - - #print 1 | - # 1; - - print 0.0; - print 10; - print "wide characteter 넓은 문자"; - - print fflush ("abc"); - #return "x.awk"; -} - diff --git a/qse/lib/awk/parse.c b/qse/lib/awk/parse.c index 76e7b9ba..8d8036f7 100644 --- a/qse/lib/awk/parse.c +++ b/qse/lib/awk/parse.c @@ -1,5 +1,5 @@ /* - * $Id: parse.c 217 2009-06-28 13:41:47Z hyunghwan.chung $ + * $Id: parse.c 218 2009-06-29 10:17:39Z hyunghwan.chung $ * Copyright 2006-2009 Chung, Hyung-Hwan. @@ -5079,7 +5079,6 @@ static int get_token (qse_awk_t* awk) else { int i; - qse_char_t cc; static struct { qse_char_t c; @@ -5112,8 +5111,15 @@ static int get_token (qse_awk_t* awk) } } - cc = (qse_char_t)c; - SETERRARG (awk, QSE_AWK_ELXCHR, awk->token.line, &cc, 1); + if (c == QSE_T('\0')) + { + SETERRARG (awk, QSE_AWK_ELXCHR, awk->token.line, QSE_T(""), 5); + } + else + { + qse_char_t cc = (qse_char_t)c; + SETERRARG (awk, QSE_AWK_ELXCHR, awk->token.line, &cc, 1); + } return -1; } diff --git a/qse/cmd/awk/adr-001.awk b/qse/regress/awk/adr-001.awk similarity index 100% rename from qse/cmd/awk/adr-001.awk rename to qse/regress/awk/adr-001.awk diff --git a/qse/regress/awk/adr-002.awk b/qse/regress/awk/adr-002.awk new file mode 100644 index 00000000..55e592c7 --- /dev/null +++ b/qse/regress/awk/adr-002.awk @@ -0,0 +1,10 @@ +#!/bin/awk + +BEGIN { + RS = "\n\n"; + FS = "\n"; +} + +$3 ~ /^S/ { + print $1, $3, $NF; +} diff --git a/qse/cmd/awk/adr-en.data b/qse/regress/awk/adr.dat similarity index 100% rename from qse/cmd/awk/adr-en.data rename to qse/regress/awk/adr.dat diff --git a/qse/regress/awk/indent.dat b/qse/regress/awk/indent.dat new file mode 100644 index 00000000..8c72fc99 --- /dev/null +++ b/qse/regress/awk/indent.dat @@ -0,0 +1,12 @@ +#!/bin/sh + +if [ $# -ne 0 ] +then +echo "not the right usage" +exit 1 +fi + +while true +do +sleep 20 +done diff --git a/qse/regress/awk/lang-001.awk b/qse/regress/awk/lang-001.awk index 5b8bb6eb..a3eca3cd 100644 --- a/qse/regress/awk/lang-001.awk +++ b/qse/regress/awk/lang-001.awk @@ -1,3 +1,4 @@ -# cannot use function name as a parameter name +# cannot use function name as a parameter name +# unless QSE_AWK_STRICTNAMING is off function f(f) { print f; } BEGIN { f("hello"); } diff --git a/qse/regress/awk/lang-002.awk b/qse/regress/awk/lang-002.awk index c548b89e..38ddc06b 100644 --- a/qse/regress/awk/lang-002.awk +++ b/qse/regress/awk/lang-002.awk @@ -1,3 +1,7 @@ +# +# deep recursion must be detected if it goes too deep. +# + function f(x) { print x; diff --git a/qse/regress/awk/lang-003.awk b/qse/regress/awk/lang-003.awk index f536bc7e..9551247d 100644 --- a/qse/regress/awk/lang-003.awk +++ b/qse/regress/awk/lang-003.awk @@ -1,3 +1,5 @@ -# should print 50 -function fn(f) { f = 20; } +# a parameter can shade a named variable. +# it should print 50 + BEGIN { f = 50; fn(100); print f; } +function fn(f) { f = 20; } diff --git a/qse/regress/awk/lang-004.awk b/qse/regress/awk/lang-004.awk index e5031a8c..8afc9fae 100644 --- a/qse/regress/awk/lang-004.awk +++ b/qse/regress/awk/lang-004.awk @@ -1,3 +1,3 @@ -# A function and a named variable cannot have the same name. +# A function and a named variable cannot have the same name. function a () { } BEGIN { a = 20; } diff --git a/qse/regress/awk/lang-005.awk b/qse/regress/awk/lang-005.awk index 36a2a721..15c8a121 100644 --- a/qse/regress/awk/lang-005.awk +++ b/qse/regress/awk/lang-005.awk @@ -1,12 +1,21 @@ -function x (y) { print y; } +# +# a local variable can shade a function name and other local variables. +# + function a (x) { print x; } BEGIN { - local a; - a = 20; - a (1000); + { local a; + a = 50; + { + local a; + a = 30; + print a; + } print a; } + + a (100); } diff --git a/qse/regress/awk/lang-006.awk b/qse/regress/awk/lang-006.awk index ff102b0c..ce05538d 100644 --- a/qse/regress/awk/lang-006.awk +++ b/qse/regress/awk/lang-006.awk @@ -1,2 +1,5 @@ -global a; -function a () { } +# +# a global variable can not have the same name as a function name +# +global a; +function a () { } diff --git a/qse/regress/awk/lang-007.awk b/qse/regress/awk/lang-007.awk index 3cbc4953..82a67f1a 100644 --- a/qse/regress/awk/lang-007.awk +++ b/qse/regress/awk/lang-007.awk @@ -1,4 +1,19 @@ -function fn () { a = 20; return a;} -global a; -BEGIN { a = 30; print fn (); print a; } - +# +# depending on where a variable name appeared, a variable name can be +# a global variable or a named variable. +# + +function fn () +{ + a = 20; + return a; +} + +global a; + +BEGIN { + a = 30 + print fn () + print a +} + diff --git a/qse/regress/awk/lang-008.awk b/qse/regress/awk/lang-008.awk index efbff863..8b4a0e15 100644 --- a/qse/regress/awk/lang-008.awk +++ b/qse/regress/awk/lang-008.awk @@ -1,16 +1,21 @@ -global x; -BEGIN { - x = 1; - { - local x; - x = 2; - { - local x; - x = 3; - print x; - } - print x; - } - print x; -} - +# +# a local variable can shade a global variable +# + +global x; + +BEGIN { + x = 1; + { + local x; + x = 2; + { + local x; + x = 3; + print x; + } + print x; + } + print x; +} + diff --git a/qse/regress/awk/lang-009.awk b/qse/regress/awk/lang-009.awk index 992fdbc2..8fac466e 100644 --- a/qse/regress/awk/lang-009.awk +++ b/qse/regress/awk/lang-009.awk @@ -1,4 +1,6 @@ -function a (a) { print a; } +function a (a) { + print a; +} BEGIN { local a; diff --git a/qse/cmd/awk/arg.awk b/qse/regress/awk/lang-010.awk similarity index 100% rename from qse/cmd/awk/arg.awk rename to qse/regress/awk/lang-010.awk diff --git a/qse/regress/awk/lang-011.awk b/qse/regress/awk/lang-011.awk new file mode 100644 index 00000000..d9a3445d --- /dev/null +++ b/qse/regress/awk/lang-011.awk @@ -0,0 +1,32 @@ +BEGIN { + a[1,2,3] = 20; + a[4,5,6] = 30; + + for (i in a) + { + n = split (i, k, SUBSEP); + for (j = 1; j <= n; j++) + { + print k[j] + } + print "-------------------" + } + + if ((1,2,3) in a) + { + print "(1,2,3) in a ==> " a[1,2,3]; + } + else + { + print "(1,2,3) not in a" + } + + if ((4,5) in a) + { + print "(4,5) in a ==> " a[4,5] + } + else + { + print "(4,5) not in a" + } +} diff --git a/qse/cmd/awk/comp.awk b/qse/regress/awk/lang-012.awk similarity index 99% rename from qse/cmd/awk/comp.awk rename to qse/regress/awk/lang-012.awk index 4c6220e9..9c40fa41 100644 --- a/qse/cmd/awk/comp.awk +++ b/qse/regress/awk/lang-012.awk @@ -65,6 +65,7 @@ BEGIN { print "11 > \"10\"", (11 > "10"); print "11 < \"10\"", (11 < "10"); + # octal number print "--------------------------"; print "010 == \"8\"", (010 == "8"); print "010 != \"8\"", (010 != "8"); diff --git a/qse/regress/awk/lang-013.awk b/qse/regress/awk/lang-013.awk new file mode 100644 index 00000000..e3cc1963 --- /dev/null +++ b/qse/regress/awk/lang-013.awk @@ -0,0 +1,4 @@ +BEGIN { + CONVFMT="%s"; + printf ("%s\n", 10.34); +} diff --git a/qse/cmd/awk/crash05.awk b/qse/regress/awk/lang-014.awk similarity index 89% rename from qse/cmd/awk/crash05.awk rename to qse/regress/awk/lang-014.awk index f663bc56..ea4d65ea 100644 --- a/qse/cmd/awk/crash05.awk +++ b/qse/regress/awk/lang-014.awk @@ -2,4 +2,6 @@ BEGIN { a = (((((10+20))))); b = (((((((((((((((((((10+20))))))))))))))))))); c = ((((((((((((((((((((((((((((10 + 20)))))))))))))))))))))))))))); + + print a, b, c; } diff --git a/qse/cmd/awk/crash04.awk b/qse/regress/awk/lang-015.awk similarity index 100% rename from qse/cmd/awk/crash04.awk rename to qse/regress/awk/lang-015.awk diff --git a/qse/cmd/awk/crash02.awk b/qse/regress/awk/lang-016.awk similarity index 100% rename from qse/cmd/awk/crash02.awk rename to qse/regress/awk/lang-016.awk diff --git a/qse/cmd/awk/main-002.awk b/qse/regress/awk/lang-017.awk similarity index 94% rename from qse/cmd/awk/main-002.awk rename to qse/regress/awk/lang-017.awk index e9cea6b3..f1fc47f8 100644 --- a/qse/cmd/awk/main-002.awk +++ b/qse/regress/awk/lang-017.awk @@ -1,5 +1,6 @@ function error() { exit (200); } + function getx() { if (x == 2) error(); @@ -11,6 +12,7 @@ function gety() { return y++; } function main() { x = 0; y = 0; + print getx() + gety(); print getx() + gety(); print getx() + gety(); @@ -19,6 +21,9 @@ function main() { return 999; } +BEGIN { + main (); +} END { print "END OF PROGRAM"; diff --git a/qse/cmd/awk/err-022.awk b/qse/regress/awk/lang-018.awk similarity index 100% rename from qse/cmd/awk/err-022.awk rename to qse/regress/awk/lang-018.awk diff --git a/qse/cmd/awk/err-017.awk b/qse/regress/awk/lang-019.awk similarity index 100% rename from qse/cmd/awk/err-017.awk rename to qse/regress/awk/lang-019.awk diff --git a/qse/cmd/awk/err-018.awk b/qse/regress/awk/lang-020.awk similarity index 100% rename from qse/cmd/awk/err-018.awk rename to qse/regress/awk/lang-020.awk diff --git a/qse/cmd/awk/err-019.awk b/qse/regress/awk/lang-021.awk similarity index 100% rename from qse/cmd/awk/err-019.awk rename to qse/regress/awk/lang-021.awk diff --git a/qse/cmd/awk/err-015.awk b/qse/regress/awk/lang-022.awk similarity index 100% rename from qse/cmd/awk/err-015.awk rename to qse/regress/awk/lang-022.awk diff --git a/qse/cmd/awk/err-014.awk b/qse/regress/awk/lang-023.awk similarity index 100% rename from qse/cmd/awk/err-014.awk rename to qse/regress/awk/lang-023.awk diff --git a/qse/regress/awk/lang-024.awk b/qse/regress/awk/lang-024.awk new file mode 100644 index 00000000..b349d75b --- /dev/null +++ b/qse/regress/awk/lang-024.awk @@ -0,0 +1,7 @@ +BEGIN { + local a; + + a = 21; + print a > 20? 1 : 2; +} + diff --git a/qse/cmd/awk/err-005.awk b/qse/regress/awk/lang-025.awk similarity index 60% rename from qse/cmd/awk/err-005.awk rename to qse/regress/awk/lang-025.awk index b6a2ccb9..52ca5399 100644 --- a/qse/cmd/awk/err-005.awk +++ b/qse/regress/awk/lang-025.awk @@ -1,4 +1,4 @@ BEGIN { - iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix = 20; - delete iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix ; + iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix = 20; + delete iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix ; } diff --git a/qse/cmd/awk/err-003.awk b/qse/regress/awk/lang-026.awk similarity index 58% rename from qse/cmd/awk/err-003.awk rename to qse/regress/awk/lang-026.awk index 954b1c4d..0bff3579 100644 --- a/qse/cmd/awk/err-003.awk +++ b/qse/regress/awk/lang-026.awk @@ -1,4 +1,6 @@ BEGIN { abc[20] = "abc"; + print abc[20]; abc = 10; + print abc; } diff --git a/qse/cmd/awk/err-001.awk b/qse/regress/awk/lang-027.awk similarity index 100% rename from qse/cmd/awk/err-001.awk rename to qse/regress/awk/lang-027.awk diff --git a/qse/cmd/awk/err-007.awk b/qse/regress/awk/lang-028.awk similarity index 100% rename from qse/cmd/awk/err-007.awk rename to qse/regress/awk/lang-028.awk diff --git a/qse/cmd/awk/err-009.awk b/qse/regress/awk/lang-029.awk similarity index 100% rename from qse/cmd/awk/err-009.awk rename to qse/regress/awk/lang-029.awk diff --git a/qse/cmd/awk/num.awk b/qse/regress/awk/lang-030.awk similarity index 100% rename from qse/cmd/awk/num.awk rename to qse/regress/awk/lang-030.awk diff --git a/qse/cmd/awk/match.awk b/qse/regress/awk/lang-031.awk similarity index 100% rename from qse/cmd/awk/match.awk rename to qse/regress/awk/lang-031.awk diff --git a/qse/cmd/awk/lisp/Impl-notes b/qse/regress/awk/lisp/Impl-notes similarity index 100% rename from qse/cmd/awk/lisp/Impl-notes rename to qse/regress/awk/lisp/Impl-notes diff --git a/qse/cmd/awk/lisp/Manual b/qse/regress/awk/lisp/Manual similarity index 100% rename from qse/cmd/awk/lisp/Manual rename to qse/regress/awk/lisp/Manual diff --git a/qse/cmd/awk/lisp/README b/qse/regress/awk/lisp/README similarity index 100% rename from qse/cmd/awk/lisp/README rename to qse/regress/awk/lisp/README diff --git a/qse/cmd/awk/lisp/awklisp b/qse/regress/awk/lisp/awklisp similarity index 100% rename from qse/cmd/awk/lisp/awklisp rename to qse/regress/awk/lisp/awklisp diff --git a/qse/cmd/awk/lisp/awklisp.org b/qse/regress/awk/lisp/awklisp.org similarity index 100% rename from qse/cmd/awk/lisp/awklisp.org rename to qse/regress/awk/lisp/awklisp.org diff --git a/qse/cmd/awk/lisp/eliza.lsp b/qse/regress/awk/lisp/eliza.lsp similarity index 100% rename from qse/cmd/awk/lisp/eliza.lsp rename to qse/regress/awk/lisp/eliza.lsp diff --git a/qse/cmd/awk/lisp/fib.lsp b/qse/regress/awk/lisp/fib.lsp similarity index 100% rename from qse/cmd/awk/lisp/fib.lsp rename to qse/regress/awk/lisp/fib.lsp diff --git a/qse/cmd/awk/lisp/lists b/qse/regress/awk/lisp/lists similarity index 100% rename from qse/cmd/awk/lisp/lists rename to qse/regress/awk/lisp/lists diff --git a/qse/cmd/awk/lisp/numbers b/qse/regress/awk/lisp/numbers similarity index 100% rename from qse/cmd/awk/lisp/numbers rename to qse/regress/awk/lisp/numbers diff --git a/qse/cmd/awk/lisp/old-awklisp b/qse/regress/awk/lisp/old-awklisp similarity index 100% rename from qse/cmd/awk/lisp/old-awklisp rename to qse/regress/awk/lisp/old-awklisp diff --git a/qse/cmd/awk/lisp/perlisp b/qse/regress/awk/lisp/perlisp similarity index 100% rename from qse/cmd/awk/lisp/perlisp rename to qse/regress/awk/lisp/perlisp diff --git a/qse/cmd/awk/lisp/scheme.lsp b/qse/regress/awk/lisp/scheme.lsp similarity index 100% rename from qse/cmd/awk/lisp/scheme.lsp rename to qse/regress/awk/lisp/scheme.lsp diff --git a/qse/cmd/awk/lisp/scmhelp.lsp b/qse/regress/awk/lisp/scmhelp.lsp similarity index 100% rename from qse/cmd/awk/lisp/scmhelp.lsp rename to qse/regress/awk/lisp/scmhelp.lsp diff --git a/qse/cmd/awk/lisp/startup b/qse/regress/awk/lisp/startup similarity index 100% rename from qse/cmd/awk/lisp/startup rename to qse/regress/awk/lisp/startup diff --git a/qse/cmd/awk/lisp/tail.lsp b/qse/regress/awk/lisp/tail.lsp similarity index 100% rename from qse/cmd/awk/lisp/tail.lsp rename to qse/regress/awk/lisp/tail.lsp diff --git a/qse/cmd/awk/lisp/test.scm b/qse/regress/awk/lisp/test.scm similarity index 100% rename from qse/cmd/awk/lisp/test.scm rename to qse/regress/awk/lisp/test.scm diff --git a/qse/cmd/awk/lisp/trace b/qse/regress/awk/lisp/trace similarity index 100% rename from qse/cmd/awk/lisp/trace rename to qse/regress/awk/lisp/trace diff --git a/qse/regress/awk/regress.sh b/qse/regress/awk/regress.sh index ed4e4dc3..33bb32fe 100755 --- a/qse/regress/awk/regress.sh +++ b/qse/regress/awk/regress.sh @@ -2,14 +2,16 @@ echo_so() { - tput smso + echo "--------------------------------------------------------------------------------" + #tput smso while [ $# -gt 0 ] do echo -n "$1 " shift done echo - tput rmso + #tput rmso + echo "--------------------------------------------------------------------------------" } print_usage() @@ -82,23 +84,51 @@ PROGS=" emp-026.awk/emp.dat// emp-027.awk/emp.dat// - lang-001.awk///--implicit=off --explicit=on --newline=on -o- - lang-002.awk///--implicit=off --explicit=on --newline=on -o- - lang-003.awk///--implicit=off --explicit=on --newline=on -o- - lang-004.awk///--implicit=off --explicit=on --newline=on -o- + adr-001.awk/adr.dat// + adr-002.awk/adr.dat// + + unr-001.awk/unr.dat// + + lang-001.awk///--strictnaming=off --newline=on -o- + lang-002.awk///--newline=on -o- + lang-003.awk///--newline=on -o- + lang-004.awk///--newline=on -o- lang-005.awk///--implicit=off --explicit=on --newline=on -o- lang-006.awk///--implicit=off --explicit=on --newline=on -o- - lang-007.awk///--implicit=off --explicit=on --newline=on -o- + lang-007.awk///--implicit=on --explicit=on --newline=on -o- lang-008.awk///--implicit=off --explicit=on --newline=on -o- - lang-009.awk/lang-009.awk//--implicit=off --explicit=on --newline=on -o- + lang-009.awk/lang-009.awk//--implicit=off --explicit=on --newline=on --strictnaming=off -o- + lang-010.awk/this is just a test//--newline=on -o- + lang-011.awk///--newline=on -o- + lang-012.awk///--newline=on -o- + lang-013.awk///--newline=on -o- + lang-014.awk///--newline=on -o- + lang-015.awk///--newline=on -o- + lang-016.awk///--newline=on -o- + lang-017.awk///--newline=on -o- + lang-017.awk///--call main --newline=on -o- + lang-018.awk///--explicit=on --newline=on -o- + lang-019.awk///--explicit=on --newline=on -o- + lang-020.awk///--explicit=on --newline=on -o- + lang-021.awk///--explicit=on --newline=on -o- + lang-022.awk///--newline=on -o- + lang-023.awk///--explicit=on --newline=on -o- + lang-024.awk///--explicit=on --newline=on -o- + lang-025.awk///--newline=on -o- + lang-026.awk///--newline=on -o- + lang-027.awk///--newline=on -o- + lang-028.awk///--newline=on -o- + lang-029.awk///--explicit=on --newline=on -o- + lang-030.awk///--newline=on -o- + lang-031.awk///--newline=on -o- quicksort.awk/quicksort.dat// quicksort2.awk/quicksort2.dat// asm.awk/asm.s/asm.dat/ stripcomment.awk/stripcomment.dat// wordfreq.awk/wordfreq.awk// - hanoi.awk// - indent.awk/regress.sh/ + hanoi.awk/// + indent.awk/indent.dat// " [ -x "${QSEAWK}" ] || @@ -125,14 +155,10 @@ do continue } - if [ -n "${redinfile}" ] - then - echo_so "${QSEAWK} ${awkopts} -f ${script} ${datafile} < ${redinfile}" - ${QSEAWK} ${awkopts} -f ${script} ${datafile} < ${redinfile} - else - echo_so "${QSEAWK} ${awkopts} -f ${script} ${datafile}" - ${QSEAWK} ${awkopts} -f ${script} ${datafile} - fi + [ -z "${redinfile}" ] && redinfile="/dev/stdin" + + echo_so "${QSEAWK} ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1" + ${QSEAWK} ${awkopts} -f ${script} ${datafile} <${redinfile} 2>&1 done < "${TMPFILE}" diff --git a/qse/cmd/awk/unr-001.awk b/qse/regress/awk/unr-001.awk similarity index 83% rename from qse/cmd/awk/unr-001.awk rename to qse/regress/awk/unr-001.awk index 6eb3de07..0f9c025f 100644 --- a/qse/cmd/awk/unr-001.awk +++ b/qse/regress/awk/unr-001.awk @@ -1,4 +1,3 @@ -# use negnum.data BEGIN { OFS="\t"; } { for (i = 1; i <= NF; i = i + 1) if ($i < 0) $i = -$i; diff --git a/qse/cmd/awk/negnum.data b/qse/regress/awk/unr.dat similarity index 100% rename from qse/cmd/awk/negnum.data rename to qse/regress/awk/unr.dat