diff --git a/qse/cmd/awk/awk.c b/qse/cmd/awk/awk.c index c4f8c640..9242ff9c 100644 --- a/qse/cmd/awk/awk.c +++ b/qse/cmd/awk/awk.c @@ -383,7 +383,7 @@ struct opttab_t { QSE_T("stripstrspc"), QSE_AWK_STRIPSTRSPC, QSE_T("strip spaces in string-to-number conversion") }, { QSE_T("blankconcat"), QSE_AWK_BLANKCONCAT, QSE_T("enable concatenation by blanks") }, { QSE_T("crlf"), QSE_AWK_CRLF, QSE_T("use CRLF for a newline") }, - { QSE_T("maptovar"), QSE_AWK_MAPTOVAR, QSE_T("allow a map to be assigned or returned") }, + { QSE_T("flexmap"), QSE_AWK_FLEXMAP, QSE_T("allow a map to be assigned or returned") }, { QSE_T("pablock"), QSE_AWK_PABLOCK, QSE_T("enable pattern-action loop") }, { QSE_T("rexbound"), QSE_AWK_REXBOUND, QSE_T("enable {n,m} in a regular expression") }, { QSE_T("ncmponstr"), QSE_AWK_NCMPONSTR, QSE_T("perform numeric comparsion on numeric strings") }, @@ -526,7 +526,7 @@ static int comparg (int argc, qse_char_t* argv[], struct arg_t* arg) { QSE_T(":stripstrspc"), QSE_T('\0') }, { QSE_T(":blankconcat"), QSE_T('\0') }, { QSE_T(":crlf"), QSE_T('\0') }, - { QSE_T(":maptovar"), QSE_T('\0') }, + { QSE_T(":flexmap"), QSE_T('\0') }, { QSE_T(":pablock"), QSE_T('\0') }, { QSE_T(":rexbound"), QSE_T('\0') }, { QSE_T(":ncmponstr"), QSE_T('\0') }, @@ -819,6 +819,10 @@ static int comparg (int argc, qse_char_t* argv[], struct arg_t* arg) { for (i = 0; i < isfl; i++) { + /* TOOD: use an absolute path for this conversion + * to avoid any conflicts with the search path + * for the included file. you can combine the + * file name with the current working directory. */ if (qse_str_cat (&script, QSE_T("@include \"")) == (qse_size_t)-1 || qse_str_cat (&script, isf[i].u.file.path) == (qse_size_t)-1 || qse_str_cat (&script, QSE_T("\";")) == (qse_size_t)-1) @@ -826,6 +830,9 @@ static int comparg (int argc, qse_char_t* argv[], struct arg_t* arg) goto incl_conv_oops; } } + + /* after successful conversion, only 1 string stream + * should take place */ qse_str_yield (&script, &isf[0].u.str, 0); isf[0].type = QSE_AWK_PARSESTD_STR; isfl = 1; diff --git a/qse/include/qse/awk/awk.h b/qse/include/qse/awk/awk.h index 5b6417c3..6d543cf6 100644 --- a/qse/include/qse/awk/awk.h +++ b/qse/include/qse/awk/awk.h @@ -1031,8 +1031,11 @@ enum qse_awk_trait_t /** CR + LF by default */ QSE_AWK_CRLF = (1 << 10), - /** allows the assignment of a map value to a variable */ - QSE_AWK_MAPTOVAR = (1 << 11), + /** treats a map value more flexibly. a function can return + * a map. you can override a map with a scalar value without + * 'delete' or '@reset'. + */ + QSE_AWK_FLEXMAP = (1 << 11), /** allows @b BEGIN, @b END, pattern-action blocks */ QSE_AWK_PABLOCK = (1 << 12), @@ -1081,7 +1084,7 @@ enum qse_awk_trait_t QSE_AWK_STRIPSTRSPC | QSE_AWK_STRICTNAMING, QSE_AWK_MODERN = - QSE_AWK_CLASSIC | QSE_AWK_EXTRAKWS | QSE_AWK_MAPTOVAR | + QSE_AWK_CLASSIC | QSE_AWK_EXTRAKWS | QSE_AWK_FLEXMAP | QSE_AWK_RWPIPE | QSE_AWK_TOLERANT }; typedef enum qse_awk_trait_t qse_awk_trait_t; @@ -1188,10 +1191,11 @@ enum qse_awk_errnum_t QSE_AWK_ENOTMAPIN, /**< right-hand side of 'in' not a map */ QSE_AWK_ENOTMAPNILIN, /**< right-hand side of 'in' not a map nor nil */ QSE_AWK_ENOTREF, /**< value not referenceable */ - QSE_AWK_ENOTASS, /**< value not assignable */ - QSE_AWK_EIDXVALASSMAP, /**< indexed value cannot be assigned a map */ - QSE_AWK_EPOSVALASSMAP, /**< positional cannot be assigned a map */ - QSE_AWK_EMAPNA, /**< map '${0}' not assignable */ + QSE_AWK_EIDXVALMAP, /**< indexed value cannot be a map */ + QSE_AWK_EPOSVALMAP, /**< positional cannot be a map */ + QSE_AWK_EMAPNA, /**< map cannot be assigned to variable */ + QSE_AWK_EMAPNRA, /**< map '${0}' cannot be reassigned */ + QSE_AWK_EMAPUR, /**< map unreturnable */ QSE_AWK_EMAPPH, /**< map prohibited */ QSE_AWK_ESCALARTOMAP, /**< cannot change a scalar value to a map */ QSE_AWK_EVALTYPE, /**< invalid value type */ diff --git a/qse/lib/awk/err.c b/qse/lib/awk/err.c index 7e68ed98..4a0701b3 100644 --- a/qse/lib/awk/err.c +++ b/qse/lib/awk/err.c @@ -116,10 +116,11 @@ const qse_char_t* qse_awk_dflerrstr (const qse_awk_t* awk, qse_awk_errnum_t errn QSE_T("right-hand side of the 'in' operator not a map"), QSE_T("right-hand side of the 'in' operator not a map nor nil"), QSE_T("value not referenceable"), - QSE_T("value not assignable"), - QSE_T("indexed value cannot be assigned a map"), - QSE_T("positional value cannot be assigned a map"), - QSE_T("map '${0}' not assignable"), + QSE_T("indexed value cannot be a map"), + QSE_T("positional value cannot be a map"), + QSE_T("map cannot be assigned to variable"), + QSE_T("map '${0}' cannot be reassigned"), + QSE_T("map cannot be returned"), QSE_T("map prohibited"), QSE_T("cannot change a scalar value to a map"), QSE_T("invalid value type"), diff --git a/qse/lib/awk/fnc.c b/qse/lib/awk/fnc.c index e9bc401e..6e5aa3c6 100644 --- a/qse/lib/awk/fnc.c +++ b/qse/lib/awk/fnc.c @@ -620,14 +620,14 @@ static int fnc_split (qse_awk_rtx_t* run, const qse_awk_fnc_info_t* fi) ((qse_awk_val_ref_t*)a1)->id <= QSE_AWK_VAL_REF_ARGIDX) { /* an indexed value should not be assigned another map */ - qse_awk_rtx_seterrnum (run, QSE_AWK_EIDXVALASSMAP, QSE_NULL); + qse_awk_rtx_seterrnum (run, QSE_AWK_EIDXVALMAP, QSE_NULL); return -1; } if (((qse_awk_val_ref_t*)a1)->id == QSE_AWK_VAL_REF_POS) { /* a positional should not be assigned a map */ - qse_awk_rtx_seterrnum (run, QSE_AWK_EPOSVALASSMAP, QSE_NULL); + qse_awk_rtx_seterrnum (run, QSE_AWK_EPOSVALMAP, QSE_NULL); return -1; } @@ -635,7 +635,7 @@ static int fnc_split (qse_awk_rtx_t* run, const qse_awk_fnc_info_t* fi) if ((*a1_ref)->type != QSE_AWK_VAL_NIL && (*a1_ref)->type != QSE_AWK_VAL_MAP) { - if (!(run->awk->opt.trait & QSE_AWK_MAPTOVAR)) + if (!(run->awk->opt.trait & QSE_AWK_FLEXMAP)) { /* cannot change a scalar value to a map */ qse_awk_rtx_seterrnum (run, QSE_AWK_ESCALARTOMAP, QSE_NULL); @@ -961,7 +961,12 @@ static int __substitute (qse_awk_rtx_t* run, qse_long_t max_count) if ((*a2_ref)->type == QSE_AWK_VAL_MAP) { - /* a map is not allowed as the third parameter */ + /* a map is not allowed as the third parameter. + * this is a prohibited condition regardless of QSE_AWK_FLEXMAP. + * i don't accept this. + * + * TODO: can i extend to replace something in a map??? + */ qse_awk_rtx_seterrnum (run, QSE_AWK_EMAPPH, QSE_NULL); goto oops; } diff --git a/qse/lib/awk/run.c b/qse/lib/awk/run.c index 59e5b6ef..6adc4d18 100644 --- a/qse/lib/awk/run.c +++ b/qse/lib/awk/run.c @@ -314,17 +314,17 @@ static int set_global ( qse_awk_val_t* old; old = STACK_GBL (rtx, idx); - if (old->type == QSE_AWK_VAL_MAP) + if (!(rtx->awk->opt.trait & QSE_AWK_FLEXMAP) && old->type == QSE_AWK_VAL_MAP) { /* once a variable becomes a map, - * it cannot be changed to a scalar variable */ - + * it cannot be assigned with another value. + * you can only add a member using indexing. */ if (var) { /* global variable */ SETERR_ARGX_LOC ( rtx, - QSE_AWK_EMAPNA, + QSE_AWK_EMAPNRA, xstr_to_cstr(&var->id.name), &var->loc ); @@ -334,7 +334,7 @@ static int set_global ( /* qse_awk_rtx_setgbl has been called */ qse_cstr_t ea; ea.ptr = qse_awk_getgblname (rtx->awk, idx, &ea.len); - SETERR_ARGX (rtx, QSE_AWK_EMAPNA, &ea); + SETERR_ARGX (rtx, QSE_AWK_EMAPNRA, &ea); } return -1; @@ -2318,14 +2318,14 @@ static int run_return (qse_awk_rtx_t* run, qse_awk_nde_return_t* nde) val = eval_expression (run, nde->val); if (val == QSE_NULL) return -1; - if ((run->awk->opt.trait & QSE_AWK_MAPTOVAR) == 0) + if (!(run->awk->opt.trait & QSE_AWK_FLEXMAP)) { if (val->type == QSE_AWK_VAL_MAP) { /* cannot return a map */ qse_awk_rtx_refupval (run, val); qse_awk_rtx_refdownval (run, val); - SETERR_LOC (run, QSE_AWK_EMAPPH, &nde->loc); + SETERR_LOC (run, QSE_AWK_EMAPUR, &nde->loc); return -1; } } @@ -3389,11 +3389,12 @@ static qse_awk_val_t* do_assignment ( var->type == QSE_AWK_NDE_LCL || var->type == QSE_AWK_NDE_ARG) { - if ((run->awk->opt.trait & QSE_AWK_MAPTOVAR) == 0) + if (!(run->awk->opt.trait & QSE_AWK_FLEXMAP)) { + /* a map value cannot be assigned to another variable */ if (val->type == QSE_AWK_VAL_MAP) { - errnum = QSE_AWK_ENOTASS; + errnum = QSE_AWK_EMAPNA; goto exit_on_error; } } @@ -3407,7 +3408,7 @@ static qse_awk_val_t* do_assignment ( { if (val->type == QSE_AWK_VAL_MAP) { - errnum = QSE_AWK_ENOTASS; + errnum = QSE_AWK_EMAPNA; goto exit_on_error; } @@ -3417,7 +3418,7 @@ static qse_awk_val_t* do_assignment ( { if (val->type == QSE_AWK_VAL_MAP) { - errnum = QSE_AWK_ENOTASS; + errnum = QSE_AWK_EMAPNA; goto exit_on_error; } @@ -3450,7 +3451,7 @@ static qse_awk_val_t* do_assignment_scalar ( QSE_ASSERT (var->idx == QSE_NULL); QSE_ASSERT ( - (run->awk->opt.trait & QSE_AWK_MAPTOVAR) || + (run->awk->opt.trait & QSE_AWK_FLEXMAP) || val->type != QSE_AWK_VAL_MAP); switch (var->type) @@ -3461,12 +3462,13 @@ static qse_awk_val_t* do_assignment_scalar ( pair = qse_htb_search ( run->named, var->id.name.ptr, var->id.name.len); - if (pair && ((qse_awk_val_t*)QSE_HTB_VPTR(pair))->type == QSE_AWK_VAL_MAP) + if (!(run->awk->opt.trait & QSE_AWK_FLEXMAP) && + pair && ((qse_awk_val_t*)QSE_HTB_VPTR(pair))->type == QSE_AWK_VAL_MAP) { /* once a variable becomes a map, * it cannot be changed to a scalar variable */ SETERR_ARGX_LOC ( - run, QSE_AWK_EMAPNA, + run, QSE_AWK_EMAPNRA, xstr_to_cstr(&var->id.name), &var->loc); return QSE_NULL; } @@ -3495,12 +3497,12 @@ static qse_awk_val_t* do_assignment_scalar ( case QSE_AWK_NDE_LCL: { qse_awk_val_t* old = STACK_LCL(run,var->id.idxa); - if (old->type == QSE_AWK_VAL_MAP) + if (!(run->awk->opt.trait & QSE_AWK_FLEXMAP) && old->type == QSE_AWK_VAL_MAP) { /* once the variable becomes a map, * it cannot be changed to a scalar variable */ SETERR_ARGX_LOC ( - run, QSE_AWK_EMAPNA, + run, QSE_AWK_EMAPNRA, xstr_to_cstr(&var->id.name), &var->loc); return QSE_NULL; } @@ -3514,12 +3516,12 @@ static qse_awk_val_t* do_assignment_scalar ( case QSE_AWK_NDE_ARG: { qse_awk_val_t* old = STACK_ARG(run,var->id.idxa); - if (old->type == QSE_AWK_VAL_MAP) + if (!(run->awk->opt.trait & QSE_AWK_FLEXMAP) && old->type == QSE_AWK_VAL_MAP) { /* once the variable becomes a map, * it cannot be changed to a scalar variable */ SETERR_ARGX_LOC ( - run, QSE_AWK_EMAPNA, + run, QSE_AWK_EMAPNRA, xstr_to_cstr(&var->id.name), &var->loc); return QSE_NULL; } diff --git a/qse/lib/awk/val.c b/qse/lib/awk/val.c index a5788213..ce9bb14b 100644 --- a/qse/lib/awk/val.c +++ b/qse/lib/awk/val.c @@ -1273,6 +1273,13 @@ int qse_awk_rtx_valtostr ( qse_awk_val_str_t* vs = (qse_awk_val_str_t*)v; return str_to_str (rtx, vs->val.ptr, vs->val.len, out); } + + case QSE_AWK_VAL_MAP: + { + if (rtx->awk->opt.trait & QSE_AWK_FLEXMAP) + return str_to_str (rtx, QSE_T("#MAP"), 4, out); + break; + } } #ifdef DEBUG_VAL diff --git a/qse/regress/awk/regress.out b/qse/regress/awk/regress.out index 0f129e98..47c1627b 100644 --- a/qse/regress/awk/regress.out +++ b/qse/regress/awk/regress.out @@ -144,19 +144,19 @@ USA 3615 237 North America -------------------------------------------------------------------------------- [CMD] qseawk -f cou-019.awk cou.dat &1 -------------------------------------------------------------------------------- -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: USSR 8649 275 Asia -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: Canada 3852 25 North America -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: China 3705 1032 Asia -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: USA 3615 237 North America -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: Brazil 3286 134 South America +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: USSR 8649 275 Asia +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: Canada 3852 25 North America +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: China 3705 1032 Asia +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: USA 3615 237 North America +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: Brazil 3286 134 South America -------------------------------------------------------------------------------- [CMD] qseawk -f cou-020.awk cou.dat &1 -------------------------------------------------------------------------------- -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: USSR 8649 275 Asia -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: Canada 3852 25 North America -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: China 3705 1032 Asia -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: USA 3615 237 North America -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: Brazil 3286 134 South America +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: USSR 8649 275 Asia +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: Canada 3852 25 North America +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: China 3705 1032 Asia +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: USA 3615 237 North America +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: Brazil 3286 134 South America -------------------------------------------------------------------------------- [CMD] qseawk -f cou-021.awk cou.dat &1 -------------------------------------------------------------------------------- @@ -958,7 +958,7 @@ BEGIN { -------------------------------------------------------------------------------- ERROR: CODE 43 LINE 3 COLUMN 9 - function 'a' redefined -------------------------------------------------------------------------------- -[CMD] qseawk --implicit=off --explicit=on --newline=on -d- -f lang-005.awk &1 +[CMD] qseawk --implicit=off --newline=on -d- -f lang-005.awk &1 -------------------------------------------------------------------------------- function a (__p0) { @@ -966,7 +966,7 @@ function a (__p0) } BEGIN { - local __l0, __l1; + @local __l0, __l1; { __l0 = 50; { @@ -982,13 +982,13 @@ BEGIN { 50 100 -------------------------------------------------------------------------------- -[CMD] qseawk --implicit=off --explicit=on --newline=on -d- -f lang-006.awk &1 +[CMD] qseawk --implicit=off --newline=on -d- -f lang-006.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 44 LINE 5 COLUMN 10 - global variable 'a' redefined -------------------------------------------------------------------------------- -[CMD] qseawk --implicit=on --explicit=on --newline=on -d- -f lang-007.awk &1 +[CMD] qseawk --implicit=on --newline=on -d- -f lang-007.awk &1 -------------------------------------------------------------------------------- -global __g19; +@global __g18; function fn () { @@ -997,20 +997,20 @@ function fn () } BEGIN { - __g19 = 30; + __g18 = 30; print fn(); - print __g19; + print __g18; } 20 30 -------------------------------------------------------------------------------- -[CMD] qseawk --implicit=off --explicit=on --newline=on -d- -f lang-008.awk &1 +[CMD] qseawk --implicit=off --newline=on -d- -f lang-008.awk &1 -------------------------------------------------------------------------------- -global x; +@global x; BEGIN { - local __l0, __l1; + @local __l0, __l1; x = 1; { __l0 = 2; @@ -1027,7 +1027,7 @@ BEGIN { 2 1 -------------------------------------------------------------------------------- -[CMD] qseawk --implicit=off --explicit=on --newline=on --strictnaming=off -d- -f lang-009.awk lang-009.awk &1 +[CMD] qseawk --implicit=off --newline=on --strictnaming=off -d- -f lang-009.awk lang-009.awk &1 -------------------------------------------------------------------------------- function a (__p0) { @@ -1035,7 +1035,7 @@ function a (__p0) } BEGIN { - local __l0; + @local __l0; __l0 = 20; } @@ -1352,7 +1352,7 @@ BEGIN { printf ("%s\n",10.34); } -ERROR: CODE 102 LINE 3 COLUMN 2 - recursion detected in format conversion +ERROR: CODE 104 LINE 3 COLUMN 2 - recursion detected in format conversion -------------------------------------------------------------------------------- [CMD] qseawk --newline=on -d- -f lang-014.awk &1 -------------------------------------------------------------------------------- @@ -1479,34 +1479,34 @@ END { 0 2 -------------------------------------------------------------------------------- -[CMD] qseawk --explicit=on --newline=on -d- -f lang-018.awk &1 +[CMD] qseawk --newline=on -d- -f lang-018.awk &1 -------------------------------------------------------------------------------- -ERROR: CODE 48 LINE 1 COLUMN 8 - duplicate global variable 'ARGV' +ERROR: CODE 48 LINE 1 COLUMN 9 - duplicate global variable 'ARGV' -------------------------------------------------------------------------------- -[CMD] qseawk --explicit=on --newline=on -d- -f lang-019.awk &1 +[CMD] qseawk --newline=on -d- -f lang-019.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 50 LINE 1 COLUMN 15 - '+' not a valid parameter name -------------------------------------------------------------------------------- -[CMD] qseawk --explicit=on --newline=on -d- -f lang-020.awk &1 +[CMD] qseawk --newline=on -d- -f lang-020.awk &1 -------------------------------------------------------------------------------- -ERROR: CODE 51 LINE 1 COLUMN 8 - '+' not a valid variable name +ERROR: CODE 51 LINE 1 COLUMN 9 - '+' not a valid variable name -------------------------------------------------------------------------------- -[CMD] qseawk --explicit=on --newline=on -d- -f lang-021.awk &1 +[CMD] qseawk --newline=on -d- -f lang-021.awk &1 -------------------------------------------------------------------------------- -ERROR: CODE 51 LINE 3 COLUMN 8 - '+' not a valid variable name +ERROR: CODE 51 LINE 3 COLUMN 9 - '+' not a valid variable name -------------------------------------------------------------------------------- [CMD] qseawk --newline=on -d- -f lang-022.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 24 LINE 2 COLUMN 9 - left parenthesis expected in place of '=' -------------------------------------------------------------------------------- -[CMD] qseawk --explicit=on --newline=on -d- -f lang-023.awk &1 +[CMD] qseawk --newline=on -d- -f lang-023.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 29 LINE 5 COLUMN 20 - colon expected in place of ';' -------------------------------------------------------------------------------- -[CMD] qseawk --explicit=on --newline=on -d- -f lang-024.awk &1 +[CMD] qseawk --newline=on -d- -f lang-024.awk &1 -------------------------------------------------------------------------------- BEGIN { - local __l0; + @local __l0; __l0 = 21; print ((__l0 > 20))?1:2; c = ((__l0)++ ++(b)); @@ -1515,7 +1515,7 @@ BEGIN { print c; print (99 ++(c)); x = (("he" "ll") "o"); - x >>= " world"; + x %%= " world"; print x; } @@ -1533,7 +1533,7 @@ BEGIN { delete iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix; } -ERROR: CODE 79 LINE 3 COLUMN 9 - variable 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix' not deletable +ERROR: CODE 80 LINE 3 COLUMN 9 - 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix' not deletable -------------------------------------------------------------------------------- [CMD] qseawk --newline=on -d- -f lang-026.awk &1 -------------------------------------------------------------------------------- @@ -1545,7 +1545,7 @@ BEGIN { } abc -ERROR: CODE 87 LINE 4 COLUMN 2 - map 'abc' not assignable with a scalar +10 -------------------------------------------------------------------------------- [CMD] qseawk --newline=on -d- -f lang-027.awk &1 -------------------------------------------------------------------------------- @@ -1555,9 +1555,9 @@ ERROR: CODE 18 LINE 2 COLUMN 1 - invalid character '' -------------------------------------------------------------------------------- ERROR: CODE 42 LINE 2 COLUMN 10 - intrinsic function 'substr' redefined -------------------------------------------------------------------------------- -[CMD] qseawk --explicit=on --newline=on -d- -f lang-029.awk &1 +[CMD] qseawk --newline=on -d- -f lang-029.awk &1 -------------------------------------------------------------------------------- -ERROR: CODE 43 LINE 9 COLUMN 9 - function 'abc' redefined +ERROR: CODE 43 LINE 9 COLUMN 10 - function 'abc' redefined -------------------------------------------------------------------------------- [CMD] qseawk --newline=on -d- -f lang-030.awk &1 -------------------------------------------------------------------------------- @@ -1667,7 +1667,7 @@ BEGIN { --------------------- 9210 -------------------------------------------------------------------------------- -[CMD] qseawk --newline=on -d- -vdatadir=/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk -vdatafile=passwd.dat -f lang-033.awk &1 +[CMD] qseawk --newline=on -d- -vdatadir=/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk -vdatafile=passwd.dat -f lang-033.awk &1 -------------------------------------------------------------------------------- BEGIN { while (((((("cat " datadir) "/") datafile) | getline x) > 0)) @@ -1734,7 +1734,7 @@ xx: 13 xx: 14 xx: 15 -------------------------------------------------------------------------------- -[CMD] qseawk --newline=on -d- -vdatadir=/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk -vdatafile=lang-035.dat1 -vgroupname=lang-035 -f lang-035.awk lang-035.dat2 &1 +[CMD] qseawk --newline=on -d- -vdatadir=/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk -vdatafile=lang-035.dat1 -vgroupname=lang-035 -f lang-035.awk lang-035.dat2 &1 -------------------------------------------------------------------------------- BEGIN { max_cid_vars = 100; @@ -2344,7 +2344,7 @@ nan 8103.08 3 -------------------------------------------------------------------------------- -[CMD] qseawk --newline=on -d- -vdatadir=/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk -vdatafile=lang-046.dat1 -f lang-046.awk lang-046.dat2 &1 +[CMD] qseawk --newline=on -d- -vdatadir=/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk -vdatafile=lang-046.dat1 -f lang-046.awk lang-046.dat2 &1 -------------------------------------------------------------------------------- 1 @@ -2419,7 +2419,7 @@ that is wonderful hello world 45 1 -------------------------------------------------------------------------------- -[CMD] qseawk --newline=on --extraops=on -d- -f lang-048.awk &1 +[CMD] qseawk --newline=on -d- -f lang-048.awk &1 -------------------------------------------------------------------------------- function int2ip (__p0, __p1, __p2) { @@ -2499,7 +2499,7 @@ mysql x 117 124 MySQL Server,,, /var/lib openldap x 118 125 OpenLDAP Server Account,,, /nonexistent /bin/false postfix x 119 126 /var/spool/postfix /bin/false -------------------------------------------------------------------------------- -[CMD] qseawk --newline=on --include=on -f levenshtein-utests.awk &1 +[CMD] qseawk --newline=on --extrakws=on -f levenshtein-utests.awk &1 -------------------------------------------------------------------------------- 3: Correct distance between 'kitten' and 'sitting' 3: Correct distance between 'Saturday' and 'Sunday' @@ -2544,7 +2544,7 @@ Result Ra Rb Connect Error 1.E12 99X -------------------------------------------------------------------------------- -[CMD] qseawk -vQSEAWK="/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/cmd/awk/qseawk" -vSCRIPT_PATH="/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk" -f quicksort2.awk quicksort2.dat &1 +[CMD] qseawk -vQSEAWK="/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/cmd/awk/.libs/qseawk" -vSCRIPT_PATH="/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk" -f quicksort2.awk quicksort2.dat &1 -------------------------------------------------------------------------------- 0.0000000000 0.11111111111111111111111111111 diff --git a/qse/regress/awk/regress.out.xma b/qse/regress/awk/regress.out.xma index fb069136..f3a2653e 100644 --- a/qse/regress/awk/regress.out.xma +++ b/qse/regress/awk/regress.out.xma @@ -144,19 +144,19 @@ USA 3615 237 North America -------------------------------------------------------------------------------- [CMD] qseawk -m 500000 -f cou-019.awk cou.dat &1 -------------------------------------------------------------------------------- -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: USSR 8649 275 Asia -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: Canada 3852 25 North America -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: China 3705 1032 Asia -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: USA 3615 237 North America -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: Brazil 3286 134 South America +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: USSR 8649 275 Asia +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: Canada 3852 25 North America +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: China 3705 1032 Asia +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: USA 3615 237 North America +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: Brazil 3286 134 South America -------------------------------------------------------------------------------- [CMD] qseawk -m 500000 -f cou-020.awk cou.dat &1 -------------------------------------------------------------------------------- -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: USSR 8649 275 Asia -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: Canada 3852 25 North America -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: China 3705 1032 Asia -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: USA 3615 237 North America -/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk/cou.dat: Brazil 3286 134 South America +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: USSR 8649 275 Asia +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: Canada 3852 25 North America +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: China 3705 1032 Asia +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: USA 3615 237 North America +/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk/cou.dat: Brazil 3286 134 South America -------------------------------------------------------------------------------- [CMD] qseawk -m 500000 -f cou-021.awk cou.dat &1 -------------------------------------------------------------------------------- @@ -958,7 +958,7 @@ BEGIN { -------------------------------------------------------------------------------- ERROR: CODE 43 LINE 3 COLUMN 9 - function 'a' redefined -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --implicit=off --explicit=on --newline=on -d- -f lang-005.awk &1 +[CMD] qseawk -m 500000 --implicit=off --newline=on -d- -f lang-005.awk &1 -------------------------------------------------------------------------------- function a (__p0) { @@ -966,7 +966,7 @@ function a (__p0) } BEGIN { - local __l0, __l1; + @local __l0, __l1; { __l0 = 50; { @@ -982,13 +982,13 @@ BEGIN { 50 100 -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --implicit=off --explicit=on --newline=on -d- -f lang-006.awk &1 +[CMD] qseawk -m 500000 --implicit=off --newline=on -d- -f lang-006.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 44 LINE 5 COLUMN 10 - global variable 'a' redefined -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --implicit=on --explicit=on --newline=on -d- -f lang-007.awk &1 +[CMD] qseawk -m 500000 --implicit=on --newline=on -d- -f lang-007.awk &1 -------------------------------------------------------------------------------- -global __g19; +@global __g18; function fn () { @@ -997,20 +997,20 @@ function fn () } BEGIN { - __g19 = 30; + __g18 = 30; print fn(); - print __g19; + print __g18; } 20 30 -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --implicit=off --explicit=on --newline=on -d- -f lang-008.awk &1 +[CMD] qseawk -m 500000 --implicit=off --newline=on -d- -f lang-008.awk &1 -------------------------------------------------------------------------------- -global x; +@global x; BEGIN { - local __l0, __l1; + @local __l0, __l1; x = 1; { __l0 = 2; @@ -1027,7 +1027,7 @@ BEGIN { 2 1 -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --implicit=off --explicit=on --newline=on --strictnaming=off -d- -f lang-009.awk lang-009.awk &1 +[CMD] qseawk -m 500000 --implicit=off --newline=on --strictnaming=off -d- -f lang-009.awk lang-009.awk &1 -------------------------------------------------------------------------------- function a (__p0) { @@ -1035,7 +1035,7 @@ function a (__p0) } BEGIN { - local __l0; + @local __l0; __l0 = 20; } @@ -1352,7 +1352,7 @@ BEGIN { printf ("%s\n",10.34); } -ERROR: CODE 102 LINE 3 COLUMN 2 - recursion detected in format conversion +ERROR: CODE 104 LINE 3 COLUMN 2 - recursion detected in format conversion -------------------------------------------------------------------------------- [CMD] qseawk -m 500000 --newline=on -d- -f lang-014.awk &1 -------------------------------------------------------------------------------- @@ -1479,34 +1479,34 @@ END { 0 2 -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --explicit=on --newline=on -d- -f lang-018.awk &1 +[CMD] qseawk -m 500000 --newline=on -d- -f lang-018.awk &1 -------------------------------------------------------------------------------- -ERROR: CODE 48 LINE 1 COLUMN 8 - duplicate global variable 'ARGV' +ERROR: CODE 48 LINE 1 COLUMN 9 - duplicate global variable 'ARGV' -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --explicit=on --newline=on -d- -f lang-019.awk &1 +[CMD] qseawk -m 500000 --newline=on -d- -f lang-019.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 50 LINE 1 COLUMN 15 - '+' not a valid parameter name -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --explicit=on --newline=on -d- -f lang-020.awk &1 +[CMD] qseawk -m 500000 --newline=on -d- -f lang-020.awk &1 -------------------------------------------------------------------------------- -ERROR: CODE 51 LINE 1 COLUMN 8 - '+' not a valid variable name +ERROR: CODE 51 LINE 1 COLUMN 9 - '+' not a valid variable name -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --explicit=on --newline=on -d- -f lang-021.awk &1 +[CMD] qseawk -m 500000 --newline=on -d- -f lang-021.awk &1 -------------------------------------------------------------------------------- -ERROR: CODE 51 LINE 3 COLUMN 8 - '+' not a valid variable name +ERROR: CODE 51 LINE 3 COLUMN 9 - '+' not a valid variable name -------------------------------------------------------------------------------- [CMD] qseawk -m 500000 --newline=on -d- -f lang-022.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 24 LINE 2 COLUMN 9 - left parenthesis expected in place of '=' -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --explicit=on --newline=on -d- -f lang-023.awk &1 +[CMD] qseawk -m 500000 --newline=on -d- -f lang-023.awk &1 -------------------------------------------------------------------------------- ERROR: CODE 29 LINE 5 COLUMN 20 - colon expected in place of ';' -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --explicit=on --newline=on -d- -f lang-024.awk &1 +[CMD] qseawk -m 500000 --newline=on -d- -f lang-024.awk &1 -------------------------------------------------------------------------------- BEGIN { - local __l0; + @local __l0; __l0 = 21; print ((__l0 > 20))?1:2; c = ((__l0)++ ++(b)); @@ -1515,7 +1515,7 @@ BEGIN { print c; print (99 ++(c)); x = (("he" "ll") "o"); - x >>= " world"; + x %%= " world"; print x; } @@ -1533,7 +1533,7 @@ BEGIN { delete iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix; } -ERROR: CODE 79 LINE 3 COLUMN 9 - variable 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix' not deletable +ERROR: CODE 80 LINE 3 COLUMN 9 - 'iiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiix' not deletable -------------------------------------------------------------------------------- [CMD] qseawk -m 500000 --newline=on -d- -f lang-026.awk &1 -------------------------------------------------------------------------------- @@ -1545,7 +1545,7 @@ BEGIN { } abc -ERROR: CODE 87 LINE 4 COLUMN 2 - map 'abc' not assignable with a scalar +10 -------------------------------------------------------------------------------- [CMD] qseawk -m 500000 --newline=on -d- -f lang-027.awk &1 -------------------------------------------------------------------------------- @@ -1555,9 +1555,9 @@ ERROR: CODE 18 LINE 2 COLUMN 1 - invalid character '' -------------------------------------------------------------------------------- ERROR: CODE 42 LINE 2 COLUMN 10 - intrinsic function 'substr' redefined -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --explicit=on --newline=on -d- -f lang-029.awk &1 +[CMD] qseawk -m 500000 --newline=on -d- -f lang-029.awk &1 -------------------------------------------------------------------------------- -ERROR: CODE 43 LINE 9 COLUMN 9 - function 'abc' redefined +ERROR: CODE 43 LINE 9 COLUMN 10 - function 'abc' redefined -------------------------------------------------------------------------------- [CMD] qseawk -m 500000 --newline=on -d- -f lang-030.awk &1 -------------------------------------------------------------------------------- @@ -1667,7 +1667,7 @@ BEGIN { --------------------- 9210 -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --newline=on -d- -vdatadir=/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk -vdatafile=passwd.dat -f lang-033.awk &1 +[CMD] qseawk -m 500000 --newline=on -d- -vdatadir=/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk -vdatafile=passwd.dat -f lang-033.awk &1 -------------------------------------------------------------------------------- BEGIN { while (((((("cat " datadir) "/") datafile) | getline x) > 0)) @@ -1734,7 +1734,7 @@ xx: 13 xx: 14 xx: 15 -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --newline=on -d- -vdatadir=/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk -vdatafile=lang-035.dat1 -vgroupname=lang-035 -f lang-035.awk lang-035.dat2 &1 +[CMD] qseawk -m 500000 --newline=on -d- -vdatadir=/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk -vdatafile=lang-035.dat1 -vgroupname=lang-035 -f lang-035.awk lang-035.dat2 &1 -------------------------------------------------------------------------------- BEGIN { max_cid_vars = 100; @@ -2344,7 +2344,7 @@ nan 8103.08 3 -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --newline=on -d- -vdatadir=/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk -vdatafile=lang-046.dat1 -f lang-046.awk lang-046.dat2 &1 +[CMD] qseawk -m 500000 --newline=on -d- -vdatadir=/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk -vdatafile=lang-046.dat1 -f lang-046.awk lang-046.dat2 &1 -------------------------------------------------------------------------------- 1 @@ -2419,7 +2419,7 @@ that is wonderful hello world 45 1 -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --newline=on --extraops=on -d- -f lang-048.awk &1 +[CMD] qseawk -m 500000 --newline=on -d- -f lang-048.awk &1 -------------------------------------------------------------------------------- function int2ip (__p0, __p1, __p2) { @@ -2499,7 +2499,7 @@ mysql x 117 124 MySQL Server,,, /var/lib openldap x 118 125 OpenLDAP Server Account,,, /nonexistent /bin/false postfix x 119 126 /var/spool/postfix /bin/false -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 --newline=on --include=on -f levenshtein-utests.awk &1 +[CMD] qseawk -m 500000 --newline=on --extrakws=on -f levenshtein-utests.awk &1 -------------------------------------------------------------------------------- 3: Correct distance between 'kitten' and 'sitting' 3: Correct distance between 'Saturday' and 'Sunday' @@ -2544,7 +2544,7 @@ Result Ra Rb Connect Error 1.E12 99X -------------------------------------------------------------------------------- -[CMD] qseawk -m 500000 -vQSEAWK="/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/cmd/awk/qseawk" -vSCRIPT_PATH="/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug/../../src/regress/awk" -f quicksort2.awk quicksort2.dat &1 +[CMD] qseawk -m 500000 -vQSEAWK="/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/cmd/awk/.libs/qseawk" -vSCRIPT_PATH="/home/hyung-hwan/nfs.exports/workspace/qse/x86_64/linux-wchar-debug-shared/../../src/regress/awk" -f quicksort2.awk quicksort2.dat &1 -------------------------------------------------------------------------------- 0.0000000000 0.11111111111111111111111111111