added qse_awk_setopt()/qse_awk_getopt().

deleted qse_awk_getoption()/qse_awk_setoption()/qse_awk_setmaxdepth()/qse_awk_getmaxdepth().
redefined enumeration types related to the functions added or deleted above.
moved fnc_sleep from cmd/awk/awk.c to mod/awk/sys.c
managed to get external module call working in the primitive level
This commit is contained in:
2012-10-21 16:19:03 +00:00
parent 11b9829c9b
commit ff13bf4668
37 changed files with 1758 additions and 414 deletions

View File

@ -45,7 +45,7 @@ int main ()
qse_awk_parsestd_t psin;
int ret, i;
int ret, i, opt;
/* create a main processor */
awk = qse_awk_openstd (0);
@ -55,8 +55,10 @@ int main ()
ret = -1; goto oops;
}
qse_awk_getopt (awk, QSE_AWK_TRAIT, &opt);
/* don't allow BEGIN, END, pattern-action blocks */
qse_awk_setoption (awk, qse_awk_getoption(awk) & ~QSE_AWK_PABLOCK);
opt &= ~QSE_AWK_PABLOCK;
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
psin.type = QSE_AWK_PARSESTD_STR;
psin.u.str.ptr = src;

View File

@ -49,14 +49,13 @@ int main ()
ret = -1; goto oops;
}
opt = qse_awk_getoption(awk);
qse_awk_getopt (awk, QSE_AWK_TRAIT, &opt);
/* don't allow BEGIN, END, pattern-action blocks */
opt &= ~QSE_AWK_PABLOCK;
/* enable ** */
opt |= QSE_AWK_EXTRAOPS;
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
qse_awk_setoption (awk, opt);
psin.type = QSE_AWK_PARSESTD_STR;
psin.u.str.ptr = src;

View File

@ -136,8 +136,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.setOption (
awk.getOption() |
awk.setTrait (
awk.getTrait() |
QSE_AWK_MAPTOVAR |
QSE_AWK_RESET);

View File

@ -356,7 +356,7 @@ static int awk_main_2 (MyAwk& awk, int argc, qse_char_t* argv[])
cmdline_t cmdline;
int n;
awk.setOption (awk.getOption() | QSE_AWK_INCLUDE |
awk.setTrait (awk.getTrait() | QSE_AWK_INCLUDE |
QSE_AWK_MAPTOVAR | QSE_AWK_RWPIPE | QSE_AWK_EXTRAOPS);
// ARGV[0]

View File

@ -41,7 +41,7 @@ int main ()
qse_awk_rtx_t* rtx = QSE_NULL;
qse_awk_val_t* retv;
qse_awk_parsestd_t psin;
int ret = -1;
int ret = -1, opt;
const qse_char_t* output_files[] =
{
@ -63,7 +63,9 @@ int main ()
goto oops;
}
qse_awk_setoption (awk, qse_awk_getoption(awk) | QSE_AWK_NEXTOFILE);
qse_awk_getopt (awk, QSE_AWK_TRAIT, &opt);
opt |= QSE_AWK_NEXTOFILE;
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
psin.type = QSE_AWK_PARSESTD_STR;
psin.u.str.ptr = src;

View File

@ -54,16 +54,14 @@ int main ()
ret = -1; goto oops;
}
opt = qse_awk_getoption(awk);
qse_awk_getopt (awk, QSE_AWK_TRAIT, &opt);
/* don't allow BEGIN, END, pattern-action blocks */
opt &= ~QSE_AWK_PABLOCK;
/* can assign a map to a variable */
opt |= QSE_AWK_MAPTOVAR;
/* enable ** */
opt |= QSE_AWK_EXTRAOPS;
qse_awk_setoption (awk, opt);
qse_awk_setopt (awk, QSE_AWK_TRAIT, &opt);
psin.type = QSE_AWK_PARSESTD_STR;
psin.u.str.ptr = src;

View File

@ -79,8 +79,6 @@ int main ()
goto oops;
}
//qse_awk_setoption (awk, qse_awk_getoption(awk) | QSE_AWK_RWPIPE);
psin.type = QSE_AWK_PARSESTD_STR;
psin.u.str.ptr = src;
psin.u.str.len = qse_strlen(src);