added qse_awk_rtx_isnilval().
enhanced the qse_awk_sio_t core functions so that the implementaion can set the stream name added export specifiers to some functions
This commit is contained in:
@ -45,12 +45,12 @@ static int run_awk (QSE::StdAwk& awk)
|
||||
|
||||
QSE::StdAwk::SourceString in (QSE_T(
|
||||
"function pa (x) {\n"
|
||||
" reset ret;\n"
|
||||
" @reset ret;\n"
|
||||
" for (i in x) { print i, \"=>\", x[i]; ret += x[i]; }\n"
|
||||
" return ret + FOO++;\n"
|
||||
"}\n"
|
||||
"function pb (x) {\n"
|
||||
" reset ret;\n"
|
||||
" @reset ret;\n"
|
||||
" for (i in x) { ret[-i] = -x[i]; }\n"
|
||||
" return ret;\n"
|
||||
"}"
|
||||
@ -135,11 +135,8 @@ static int awk_main (int argc, qse_char_t* argv[])
|
||||
|
||||
int ret = awk.open();
|
||||
|
||||
// allow returning a map from a function and enable 'reset'
|
||||
awk.setTrait (
|
||||
awk.getTrait() |
|
||||
QSE_AWK_MAPTOVAR |
|
||||
QSE_AWK_EXTRAKWS);
|
||||
// allow returning a map from a function
|
||||
awk.setTrait (awk.getTrait() | QSE_AWK_FLEXMAP);
|
||||
|
||||
if (ret >= 0) ret = run_awk (awk);
|
||||
if (ret <= -1)
|
||||
|
@ -188,11 +188,14 @@ static void print_error (MyAwk& awk)
|
||||
{
|
||||
MyAwk::loc_t loc = awk.getErrorLocation();
|
||||
|
||||
print_error (
|
||||
QSE_T("LINE [%u] %s\n"),
|
||||
(unsigned)loc.line,
|
||||
awk.getErrorMessage()
|
||||
);
|
||||
if (loc.file)
|
||||
{
|
||||
print_error (QSE_T("line %u at %s - %s\n"), (unsigned)loc.line, loc.file, awk.getErrorMessage());
|
||||
}
|
||||
else
|
||||
{
|
||||
print_error (QSE_T("line %u - %s\n"), (unsigned)loc.line, awk.getErrorMessage());
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
@ -358,7 +361,7 @@ static int awk_main_2 (MyAwk& awk, int argc, qse_char_t* argv[])
|
||||
cmdline_t cmdline;
|
||||
int n;
|
||||
|
||||
awk.setTrait (awk.getTrait() | QSE_AWK_EXTRAKWS | QSE_AWK_MAPTOVAR | QSE_AWK_RWPIPE);
|
||||
awk.setTrait (awk.getTrait() | QSE_AWK_EXTRAKWS | QSE_AWK_FLEXMAP | QSE_AWK_RWPIPE);
|
||||
|
||||
// ARGV[0]
|
||||
if (awk.addArgument (QSE_T("awk08")) <= -1)
|
||||
|
@ -58,7 +58,7 @@ int main ()
|
||||
/* don't allow BEGIN, END, pattern-action blocks */
|
||||
opt &= ~QSE_AWK_PABLOCK;
|
||||
/* can assign a map to a variable */
|
||||
opt |= QSE_AWK_MAPTOVAR;
|
||||
opt |= QSE_AWK_FLEXMAP;
|
||||
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
|
||||
|
||||
psin.type = QSE_AWK_PARSESTD_STR;
|
||||
|
Reference in New Issue
Block a user