fixed a few bugs in awk

- improved input console file and ARGV handling.
- fixed bugs in the builtin rand() function.
- added a new option to rex.
- fixed a control flow handling bug in for(x in y) of awk.
This commit is contained in:
hyung-hwan 2009-06-11 07:18:25 +00:00
parent a326e5f17f
commit fd1c529c46
20 changed files with 295 additions and 284 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.c 194 2009-06-09 13:07:42Z hyunghwan.chung $
* $Id: awk.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -37,10 +37,6 @@
# include <windows.h>
# include <tchar.h>
# include <process.h>
# if defined(_MSC_VER) && defined(_DEBUG)
# define _CRTDBG_MAP_ALLOC
# include <crtdbg.h>
# endif
#else
# include <unistd.h>
# include <errno.h>
@ -81,7 +77,6 @@ static void dprint (const qse_char_t* fmt, ...)
}
}
#ifdef _WIN32
static BOOL WINAPI stop_run (DWORD ctrl_type)
{
@ -509,26 +504,30 @@ static int handle_args (int argc, qse_char_t* argv[], struct argout_t* ao)
ao->isp.files = isf;
}
/* the remaining arguments are input console file names */
icfc = (opt.ind >= argc)? 2: (argc - opt.ind + 1);
icf = (qse_char_t**) malloc (QSE_SIZEOF(qse_char_t*)*icfc);
if (icf == QSE_NULL)
if (opt.ind < argc)
{
out_of_memory ();
ABORT (oops);
}
/* the remaining arguments are input console file names */
if (opt.ind >= argc)
{
/* no input(console) file names are specified.
* the standard input becomes the input console */
icf[icfl++] = QSE_T("");
icfc = argc - opt.ind + 1;
icf = (qse_char_t**) malloc (QSE_SIZEOF(qse_char_t*)*icfc);
if (icf == QSE_NULL)
{
out_of_memory ();
ABORT (oops);
}
if (opt.ind >= argc)
{
/* no input(console) file names are specified.
* the standard input becomes the input console */
icf[icfl++] = QSE_T("");
}
else
{
do { icf[icfl++] = argv[opt.ind++]; } while (opt.ind < argc);
}
icf[icfl] = QSE_NULL;
}
else
{
do { icf[icfl++] = argv[opt.ind++]; } while (opt.ind < argc);
}
icf[icfl] = QSE_NULL;
ao->ost = QSE_AWK_PARSESTD_FILE;
ao->osf = osf;
@ -564,14 +563,6 @@ static qse_awk_t* open_awk (void)
qse_awk_setmaxdepth (
awk, QSE_AWK_DEPTH_BLOCK_RUN | QSE_AWK_DEPTH_EXPR_RUN, 500);
/*
qse_awk_seterrstr (awk, QSE_AWK_EGBLRED,
QSE_T("\uC804\uC5ED\uBCC0\uC218 \'%.*s\'\uAC00 \uC7AC\uC815\uC758 \uB418\uC5C8\uC2B5\uB2C8\uB2E4"));
qse_awk_seterrstr (awk, QSE_AWK_EFUNRED,
QSE_T("\uD568\uC218 \'%.*s\'\uAC00 \uC7AC\uC815\uC758 \uB418\uC5C8\uC2B5\uB2C8\uB2E4"));
*/
/*qse_awk_setkeyword (awk, QSE_T("func"), 4, QSE_T("FX"), 2);*/
if (qse_awk_addfnc (awk,
QSE_T("sleep"), 5, 0,
1, 1, QSE_NULL, fnc_sleep) == QSE_NULL)
@ -645,8 +636,7 @@ static int awk_main (int argc, qse_char_t* argv[])
rcb.on_exit = on_run_exit;
rcb.data = &ao;
rtx = qse_awk_rtx_openstd (
awk, 0, QSE_T("qseawk"), ao.icf, QSE_AWK_RTX_OPENSTD_STDIO);
rtx = qse_awk_rtx_openstd (awk, 0, QSE_T("qseawk"), ao.icf, QSE_NULL);
if (rtx == QSE_NULL)
{
qse_printf (
@ -694,19 +684,5 @@ oops:
int qse_main (int argc, qse_achar_t* argv[])
{
int n;
#if defined(_WIN32) && defined(_DEBUG) && defined(_MSC_VER)
_CrtSetDbgFlag (_CRTDBG_LEAK_CHECK_DF | _CRTDBG_ALLOC_MEM_DF);
#endif
n = qse_runmain (argc, argv, awk_main);
#if defined(_WIN32) && defined(_DEBUG)
/*#if defined(_MSC_VER)
_CrtDumpMemoryLeaks ();
#endif*/
#endif
return n;
return qse_runmain (argc, argv, awk_main);
}

View File

@ -1,5 +1,5 @@
/*
* $Id: Awk.hpp 185 2009-06-05 12:48:15Z hyunghwan.chung $
* $Id: Awk.hpp 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -518,7 +518,8 @@ public:
ERR_REXRPAREN = QSE_AWK_EREXRPAREN,
ERR_REXRBRACKET = QSE_AWK_EREXRBRACKET,
ERR_REXRBRACE = QSE_AWK_EREXRBRACE,
ERR_REXUNBALPAR = QSE_AWK_EREXUNBALPAR,
ERR_REXUNBALPAREN = QSE_AWK_EREXUNBALPAREN,
ERR_REXINVALBRACE = QSE_AWK_EREXINVALBRACE,
ERR_REXCOLON = QSE_AWK_EREXCOLON,
ERR_REXCRANGE = QSE_AWK_EREXCRANGE,
ERR_REXCCLASS = QSE_AWK_EREXCCLASS,
@ -555,7 +556,9 @@ public:
/** Allows the assignment of a map value to a variable */
OPT_MAPTOVAR = QSE_AWK_MAPTOVAR,
/** Allows BEGIN, END, pattern-action blocks */
OPT_PABLOCK = QSE_AWK_PABLOCK
OPT_PABLOCK = QSE_AWK_PABLOCK,
/** Allows {n,m} in a regular expression */
OPT_REXBOUND = QSE_AWK_REXBOUND
};
// end of enum Option

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h 194 2009-06-09 13:07:42Z hyunghwan.chung $
* $Id: awk.h 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -411,6 +411,9 @@ enum qse_awk_option_t
/* allows BEGIN, END, pattern-action blocks */
QSE_AWK_PABLOCK = (1 << 16),
/* allow {n,m} in a regular expression */
QSE_AWK_REXBOUND = (1 << 17),
/* option aggregtes */
QSE_AWK_CLASSIC = QSE_AWK_IMPLICIT | QSE_AWK_RIO |
QSE_AWK_NEWLINE | QSE_AWK_PABLOCK |
@ -560,7 +563,8 @@ enum qse_awk_errnum_t
QSE_AWK_EREXRPAREN, /* a right parenthesis is expected */
QSE_AWK_EREXRBRACKET, /* a right bracket is expected */
QSE_AWK_EREXRBRACE, /* a right brace is expected */
QSE_AWK_EREXUNBALPAR, /* unbalanced parenthesis */
QSE_AWK_EREXUNBALPAREN, /* unbalanced parenthesis */
QSE_AWK_EREXINVALBRACE, /* invalid brace */
QSE_AWK_EREXCOLON, /* a colon is expected */
QSE_AWK_EREXCRANGE, /* invalid character range */
QSE_AWK_EREXCCLASS, /* invalid character class */

View File

@ -1,5 +1,5 @@
/*
* $Id: std.h 194 2009-06-09 13:07:42Z hyunghwan.chung $
* $Id: std.h 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -79,10 +79,6 @@ struct qse_awk_parsestd_out_t
typedef struct qse_awk_parsestd_out_t qse_awk_parsestd_out_t;
/******/
#define QSE_AWK_RTX_OPENSTD_STDIO (qse_awk_rtx_openstd_stdio)
extern const qse_char_t*const qse_awk_rtx_openstd_stdio[];
#ifdef __cplusplus
extern "C" {
#endif

View File

@ -1,5 +1,5 @@
/*
* $Id: rex.h 135 2009-05-15 13:31:43Z hyunghwan.chung $
* $Id: rex.h 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -57,18 +57,20 @@
enum qse_rex_option_t
{
QSE_REX_IGNORECASE = (1 << 0)
QSE_REX_BUILD_NOBOUND = (1 << 0),
QSE_REX_MATCH_IGNORECASE = (1 << 8)
};
enum qse_rex_errnum_t
{
QSE_REX_ENOERR = 0,
QSE_REX_ENOMEM,
QSE_REX_ENOMEM, /* no sufficient memory available */
QSE_REX_ERECUR, /* recursion too deep */
QSE_REX_ERPAREN, /* a right parenthesis is expected */
QSE_REX_ERBRACKET, /* a right bracket is expected */
QSE_REX_ERBRACE, /* a right brace is expected */
QSE_REX_EUNBALPAR, /* unbalanced parenthesis */
QSE_REX_EUNBALPAREN, /* unbalanced parenthesis */
QSE_REX_EINVALBRACE, /* invalid brace */
QSE_REX_ECOLON, /* a colon is expected */
QSE_REX_ECRANGE, /* invalid character range */
QSE_REX_ECCLASS, /* invalid character class */
@ -128,6 +130,7 @@ int qse_rex_match (
void* qse_buildrex (
qse_mmgr_t* mmgr,
qse_size_t depth,
int option,
const qse_char_t* ptn,
qse_size_t len,
qse_rex_errnum_t* errnum

View File

@ -1,5 +1,5 @@
/*
* $Id: sed.h 193 2009-06-08 13:09:01Z hyunghwan.chung $
* $Id: sed.h 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -113,11 +113,13 @@ typedef const qse_char_t* (*qse_sed_errstr_t) (
*/
enum qse_sed_option_t
{
QSE_SED_STRIPLS = (1 << 0), /**< strip leading spaces from text */
QSE_SED_KEEPTBS = (1 << 1), /**< keep an trailing backslash */
QSE_SED_ENSURENL = (1 << 2), /**< ensure NL at the text end */
QSE_SED_QUIET = (1 << 3), /**< do not print pattern space */
QSE_SED_CLASSIC = (1 << 4) /**< disable extended features */
QSE_SED_STRIPLS = (1 << 0), /**< strip leading spaces from text */
QSE_SED_KEEPTBS = (1 << 1), /**< keep an trailing backslash */
QSE_SED_ENSURENL = (1 << 2), /**< ensure NL at the text end */
QSE_SED_QUIET = (1 << 3), /**< do not print pattern space */
QSE_SED_STRICT = (1 << 4), /**< do strict address check */
QSE_SED_STARTSTEP = (1 << 5), /**< allow start~step */
QSE_SED_REXBOUND = (1 << 6) /**< allow {n,m} in regular expression */
};
typedef enum qse_sed_option_t qse_sed_option_t;

View File

@ -1,5 +1,5 @@
/*
* $Id: StdAwk.cpp 182 2009-06-03 21:50:32Z hyunghwan.chung $
* $Id: StdAwk.cpp 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -217,7 +217,7 @@ int StdAwk::fnint (Run& run, Return& ret, const Argument* args, size_t nargs,
int StdAwk::rand (Run& run, Return& ret, const Argument* args, size_t nargs,
const char_t* name, size_t len)
{
return ret.set ((long_t)::rand());
return ret.set ((real_t)(::rand() % RAND_MAX) / RAND_MAX);
}
int StdAwk::srand (Run& run, Return& ret, const Argument* args, size_t nargs,

View File

@ -1,5 +1,5 @@
/*
* $Id: err.c 171 2009-06-01 09:34:34Z hyunghwan.chung $
* $Id: err.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -156,6 +156,7 @@ const qse_char_t* qse_awk_dflerrstr (qse_awk_t* awk, qse_awk_errnum_t errnum)
QSE_T("a right bracket expected in the regular expression"),
QSE_T("a right brace expected in the regular expression"),
QSE_T("unbalanced parenthesis in the regular expression"),
QSE_T("invalid brace in the regular expression"),
QSE_T("a colon expected in the regular expression"),
QSE_T("invalid character range in the regular expression"),
QSE_T("invalid character class in the regular expression"),

View File

@ -1,5 +1,5 @@
/*
* $Id: fnc.c 194 2009-06-09 13:07:42Z hyunghwan.chung $
* $Id: fnc.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -1054,7 +1054,7 @@ static int __substitute (qse_awk_rtx_t* run, qse_long_t max_count)
}
}
opt = (run->gbl.ignorecase)? QSE_REX_IGNORECASE: 0;
opt = (run->gbl.ignorecase)? QSE_REX_MATCH_IGNORECASE: 0;
cur_ptr = a2_ptr;
cur_len = a2_len;
sub_count = 0;
@ -1272,7 +1272,7 @@ static int fnc_match (
if (a1->type != QSE_AWK_VAL_STR) QSE_AWK_FREE (run->awk, str1);
}
opt = (run->gbl.ignorecase)? QSE_REX_IGNORECASE: 0;
opt = (run->gbl.ignorecase)? QSE_REX_MATCH_IGNORECASE: 0;
n = QSE_AWK_MATCHREX (
run->awk, rex, opt,
str0, len0, str0, len0,

View File

@ -1,5 +1,5 @@
/*
* $Id: misc.c 171 2009-06-01 09:34:34Z hyunghwan.chung $
* $Id: misc.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -848,7 +848,7 @@ qse_char_t* qse_awk_rtx_strxntokbyrex (
{
n = QSE_AWK_MATCHREX (
rtx->awk, rex,
((rtx->gbl.ignorecase)? QSE_REX_IGNORECASE: 0),
((rtx->gbl.ignorecase)? QSE_REX_MATCH_IGNORECASE: 0),
str, len, ptr, left, &match, errnum);
if (n == -1) return QSE_NULL;
if (n == 0)
@ -927,20 +927,21 @@ exit_loop:
}
#define QSE_AWK_REXERRTOERR(err) \
((err == QSE_REX_ENOERR)? QSE_AWK_ENOERR: \
(err == QSE_REX_ENOMEM)? QSE_AWK_ENOMEM: \
(err == QSE_REX_ERECUR)? QSE_AWK_EREXRECUR: \
(err == QSE_REX_ERPAREN)? QSE_AWK_EREXRPAREN: \
(err == QSE_REX_ERBRACKET)? QSE_AWK_EREXRBRACKET: \
(err == QSE_REX_ERBRACE)? QSE_AWK_EREXRBRACE: \
(err == QSE_REX_EUNBALPAR)? QSE_AWK_EREXUNBALPAR: \
(err == QSE_REX_ECOLON)? QSE_AWK_EREXCOLON: \
(err == QSE_REX_ECRANGE)? QSE_AWK_EREXCRANGE: \
(err == QSE_REX_ECCLASS)? QSE_AWK_EREXCCLASS: \
(err == QSE_REX_EBRANGE)? QSE_AWK_EREXBRANGE: \
(err == QSE_REX_EEND)? QSE_AWK_EREXEND: \
(err == QSE_REX_EGARBAGE)? QSE_AWK_EREXGARBAGE: \
QSE_AWK_EINTERN)
((err == QSE_REX_ENOERR)? QSE_AWK_ENOERR: \
(err == QSE_REX_ENOMEM)? QSE_AWK_ENOMEM: \
(err == QSE_REX_ERECUR)? QSE_AWK_EREXRECUR: \
(err == QSE_REX_ERPAREN)? QSE_AWK_EREXRPAREN: \
(err == QSE_REX_ERBRACKET)? QSE_AWK_EREXRBRACKET: \
(err == QSE_REX_ERBRACE)? QSE_AWK_EREXRBRACE: \
(err == QSE_REX_EUNBALPAREN)? QSE_AWK_EREXUNBALPAREN: \
(err == QSE_REX_EINVALBRACE)? QSE_AWK_EREXINVALBRACE: \
(err == QSE_REX_ECOLON)? QSE_AWK_EREXCOLON: \
(err == QSE_REX_ECRANGE)? QSE_AWK_EREXCRANGE: \
(err == QSE_REX_ECCLASS)? QSE_AWK_EREXCCLASS: \
(err == QSE_REX_EBRANGE)? QSE_AWK_EREXBRANGE: \
(err == QSE_REX_EEND)? QSE_AWK_EREXEND: \
(err == QSE_REX_EGARBAGE)? QSE_AWK_EREXGARBAGE: \
QSE_AWK_EINTERN)
void* qse_awk_buildrex (
qse_awk_t* awk, const qse_char_t* ptn,
@ -950,7 +951,10 @@ void* qse_awk_buildrex (
void* p;
p = qse_buildrex (
awk->mmgr, awk->rex.depth.max.build, ptn, len, &err);
awk->mmgr, awk->rex.depth.max.build,
((awk->option&QSE_AWK_REXBOUND)? 0:QSE_REX_BUILD_NOBOUND),
ptn, len, &err
);
if (p == QSE_NULL) *errnum = QSE_AWK_REXERRTOERR(err);
return p;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: rio.c 135 2009-05-15 13:31:43Z hyunghwan.chung $
* $Id: rio.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -275,7 +275,7 @@ int qse_awk_rtx_readio (
n = QSE_AWK_MATCHREX (
run->awk, run->gbl.rs,
((run->gbl.ignorecase)? QSE_REX_IGNORECASE: 0),
((run->gbl.ignorecase)? QSE_REX_MATCH_IGNORECASE: 0),
QSE_STR_PTR(buf), QSE_STR_LEN(buf),
QSE_STR_PTR(buf), QSE_STR_LEN(buf),
&match, &run->errnum);
@ -363,7 +363,7 @@ int qse_awk_rtx_readio (
n = QSE_AWK_MATCHREX (
run->awk, run->gbl.rs,
((run->gbl.ignorecase)? QSE_REX_IGNORECASE: 0),
((run->gbl.ignorecase)? QSE_REX_MATCH_IGNORECASE: 0),
QSE_STR_PTR(buf), QSE_STR_LEN(buf),
QSE_STR_PTR(buf), QSE_STR_LEN(buf),
&match, &run->errnum);

View File

@ -1,5 +1,5 @@
/*
* $Id: run.c 194 2009-06-09 13:07:42Z hyunghwan.chung $
* $Id: run.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -2101,7 +2101,7 @@ static int run_while (qse_awk_rtx_t* run, qse_awk_nde_while_t* nde)
return 0;
}
static int run_for (qse_awk_rtx_t* run, qse_awk_nde_for_t* nde)
static int run_for (qse_awk_rtx_t* rtx, qse_awk_nde_for_t* nde)
{
qse_awk_val_t* val;
@ -2109,12 +2109,12 @@ static int run_for (qse_awk_rtx_t* run, qse_awk_nde_for_t* nde)
{
QSE_ASSERT (nde->init->next == QSE_NULL);
ON_STATEMENT (run, nde->init);
val = eval_expression(run,nde->init);
ON_STATEMENT (rtx, nde->init);
val = eval_expression(rtx,nde->init);
if (val == QSE_NULL) return -1;
qse_awk_rtx_refupval (run, val);
qse_awk_rtx_refdownval (run, val);
qse_awk_rtx_refupval (rtx, val);
qse_awk_rtx_refdownval (rtx, val);
}
while (1)
@ -2127,53 +2127,53 @@ static int run_for (qse_awk_rtx_t* run, qse_awk_nde_for_t* nde)
* the for statement are allowed */
QSE_ASSERT (nde->test->next == QSE_NULL);
ON_STATEMENT (run, nde->test);
test = eval_expression (run, nde->test);
ON_STATEMENT (rtx, nde->test);
test = eval_expression (rtx, nde->test);
if (test == QSE_NULL) return -1;
qse_awk_rtx_refupval (run, test);
if (qse_awk_rtx_valtobool (run, test))
qse_awk_rtx_refupval (rtx, test);
if (qse_awk_rtx_valtobool (rtx, test))
{
if (run_statement(run,nde->body) == -1)
if (run_statement(rtx,nde->body) == -1)
{
qse_awk_rtx_refdownval (run, test);
qse_awk_rtx_refdownval (rtx, test);
return -1;
}
}
else
{
qse_awk_rtx_refdownval (run, test);
qse_awk_rtx_refdownval (rtx, test);
break;
}
qse_awk_rtx_refdownval (run, test);
qse_awk_rtx_refdownval (rtx, test);
}
else
{
if (run_statement(run,nde->body) == -1) return -1;
if (run_statement(rtx,nde->body) == -1) return -1;
}
if (run->exit_level == EXIT_BREAK)
if (rtx->exit_level == EXIT_BREAK)
{
run->exit_level = EXIT_NONE;
rtx->exit_level = EXIT_NONE;
break;
}
else if (run->exit_level == EXIT_CONTINUE)
else if (rtx->exit_level == EXIT_CONTINUE)
{
run->exit_level = EXIT_NONE;
rtx->exit_level = EXIT_NONE;
}
else if (run->exit_level != EXIT_NONE) break;
else if (rtx->exit_level != EXIT_NONE) break;
if (nde->incr != QSE_NULL)
{
QSE_ASSERT (nde->incr->next == QSE_NULL);
ON_STATEMENT (run, nde->incr);
val = eval_expression (run, nde->incr);
ON_STATEMENT (rtx, nde->incr);
val = eval_expression (rtx, nde->incr);
if (val == QSE_NULL) return -1;
qse_awk_rtx_refupval (run, val);
qse_awk_rtx_refdownval (run, val);
qse_awk_rtx_refupval (rtx, val);
qse_awk_rtx_refdownval (rtx, val);
}
}
@ -2182,7 +2182,7 @@ static int run_for (qse_awk_rtx_t* run, qse_awk_nde_for_t* nde)
struct foreach_walker_t
{
qse_awk_rtx_t* run;
qse_awk_rtx_t* rtx;
qse_awk_nde_t* var;
qse_awk_nde_t* body;
int ret;
@ -2195,35 +2195,50 @@ static qse_map_walk_t walk_foreach (
qse_awk_val_t* str;
str = (qse_awk_val_t*) qse_awk_rtx_makestrval (
w->run, QSE_MAP_KPTR(pair), QSE_MAP_KLEN(pair));
w->rtx, QSE_MAP_KPTR(pair), QSE_MAP_KLEN(pair));
if (str == QSE_NULL)
{
/* adjust the error line */
w->run->errlin = w->var->line;
w->rtx->errlin = w->var->line;
w->ret = -1;
return QSE_MAP_WALK_STOP;
}
qse_awk_rtx_refupval (w->run, str);
if (do_assignment (w->run, w->var, str) == QSE_NULL)
qse_awk_rtx_refupval (w->rtx, str);
if (do_assignment (w->rtx, w->var, str) == QSE_NULL)
{
qse_awk_rtx_refdownval (w->run, str);
qse_awk_rtx_refdownval (w->rtx, str);
w->ret = -1;
return QSE_MAP_WALK_STOP;
}
if (run_statement (w->run, w->body) == -1)
if (run_statement (w->rtx, w->body) == -1)
{
qse_awk_rtx_refdownval (w->run, str);
qse_awk_rtx_refdownval (w->rtx, str);
w->ret = -1;
return QSE_MAP_WALK_STOP;
}
qse_awk_rtx_refdownval (w->run, str);
qse_awk_rtx_refdownval (w->rtx, str);
if (w->rtx->exit_level == EXIT_BREAK)
{
w->rtx->exit_level = EXIT_NONE;
return QSE_MAP_WALK_STOP;
}
else if (w->rtx->exit_level == EXIT_CONTINUE)
{
w->rtx->exit_level = EXIT_NONE;
}
else if (w->rtx->exit_level != EXIT_NONE)
{
return QSE_MAP_WALK_STOP;
}
return QSE_MAP_WALK_FORWARD;
}
static int run_foreach (qse_awk_rtx_t* run, qse_awk_nde_foreach_t* nde)
static int run_foreach (qse_awk_rtx_t* rtx, qse_awk_nde_foreach_t* nde)
{
qse_awk_nde_exp_t* test;
qse_awk_val_t* rv;
@ -2239,27 +2254,27 @@ static int run_foreach (qse_awk_rtx_t* run, qse_awk_nde_foreach_t* nde)
* by the parser first of all */
QSE_ASSERT (test->right->next == QSE_NULL);
rv = eval_expression (run, test->right);
rv = eval_expression (rtx, test->right);
if (rv == QSE_NULL) return -1;
qse_awk_rtx_refupval (run, rv);
qse_awk_rtx_refupval (rtx, rv);
if (rv->type != QSE_AWK_VAL_MAP)
{
qse_awk_rtx_refdownval (run, rv);
qse_awk_rtx_refdownval (rtx, rv);
qse_awk_rtx_seterror (
run, QSE_AWK_ENOTMAPIN, test->right->line, QSE_NULL);
rtx, QSE_AWK_ENOTMAPIN, test->right->line, QSE_NULL);
return -1;
}
map = ((qse_awk_val_map_t*)rv)->map;
walker.run = run;
walker.rtx = rtx;
walker.var = test->left;
walker.body = nde->body;
walker.ret = 0;
qse_map_walk (map, walk_foreach, &walker);
qse_awk_rtx_refdownval (run, rv);
qse_awk_rtx_refdownval (rtx, rv);
return walker.ret;
}
@ -3098,7 +3113,7 @@ static qse_awk_val_t* eval_expression (qse_awk_rtx_t* run, qse_awk_nde_t* nde)
n = QSE_AWK_MATCHREX (
((qse_awk_rtx_t*)run)->awk,
((qse_awk_val_rex_t*)v)->code,
((((qse_awk_rtx_t*)run)->gbl.ignorecase)? QSE_REX_IGNORECASE: 0),
((((qse_awk_rtx_t*)run)->gbl.ignorecase)? QSE_REX_MATCH_IGNORECASE: 0),
((qse_awk_val_str_t*)run->inrec.d0)->ptr,
((qse_awk_val_str_t*)run->inrec.d0)->len,
((qse_awk_val_str_t*)run->inrec.d0)->ptr,
@ -4775,7 +4790,7 @@ static qse_awk_val_t* eval_binop_match0 (
{
n = QSE_AWK_MATCHREX (
run->awk, rex_code,
((run->gbl.ignorecase)? QSE_REX_IGNORECASE: 0),
((run->gbl.ignorecase)? QSE_REX_MATCH_IGNORECASE: 0),
((qse_awk_val_str_t*)left)->ptr,
((qse_awk_val_str_t*)left)->len,
((qse_awk_val_str_t*)left)->ptr,
@ -4815,7 +4830,7 @@ static qse_awk_val_t* eval_binop_match0 (
n = QSE_AWK_MATCHREX (
run->awk, rex_code,
((run->gbl.ignorecase)? QSE_REX_IGNORECASE: 0),
((run->gbl.ignorecase)? QSE_REX_MATCH_IGNORECASE: 0),
out.u.cpldup.ptr, out.u.cpldup.len,
out.u.cpldup.ptr, out.u.cpldup.len,
QSE_NULL, &errnum);

View File

@ -1,5 +1,5 @@
/*
* $Id: std.c 194 2009-06-09 13:07:42Z hyunghwan.chung $
* $Id: std.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -89,12 +89,6 @@ typedef struct rxtn_t
} rxtn_t;
const qse_char_t*const qse_awk_rtx_openstd_stdio[] =
{
QSE_T(""),
QSE_NULL
};
static qse_real_t custom_awk_pow (qse_awk_t* awk, qse_real_t x, qse_real_t y)
{
#if defined(HAVE_POWL)
@ -593,18 +587,9 @@ static int open_rio_console (qse_awk_rtx_t* rtx, qse_awk_riod_t* riod)
{
if (rxtn->c.in.files == QSE_NULL)
{
/* no input console file given */
return -1;
}
if (rxtn->c.in.files[rxtn->c.in.index] == QSE_NULL)
{
/* no more input file */
return 0;
}
if (rxtn->c.in.files[rxtn->c.in.index][0] == QSE_T('\0'))
{
/* if no input files is specified,
* open the standard input */
QSE_ASSERT (rxtn->c.in.index == 0);
riod->handle = qse_sio_in;
}
else
@ -612,29 +597,42 @@ static int open_rio_console (qse_awk_rtx_t* rtx, qse_awk_riod_t* riod)
/* a temporary variable sio is used here not to change
* any fields of riod when the open operation fails */
qse_sio_t* sio;
const qse_char_t* file;
sio = qse_sio_open (
rtx->awk->mmgr,
0,
rxtn->c.in.files[rxtn->c.in.index],
QSE_SIO_READ
);
if (sio == QSE_NULL)
file = rxtn->c.in.files[rxtn->c.in.index];
if (file == QSE_NULL)
{
qse_cstr_t errarg;
/* no more input file */
return 0;
}
errarg.ptr = rxtn->c.in.files[rxtn->c.in.index];
errarg.len = qse_strlen(rxtn->c.in.files[rxtn->c.in.index]);
if (file[0] == QSE_T('-') && file[1] == QSE_T('\0'))
{
/* special file name '-' */
sio = qse_sio_in;
}
else
{
sio = qse_sio_open (
rtx->awk->mmgr, 0, file, QSE_SIO_READ);
if (sio == QSE_NULL)
{
qse_cstr_t errarg;
qse_awk_rtx_seterror (rtx, QSE_AWK_EOPEN, 0, &errarg);
return -1;
errarg.ptr = file;
errarg.len = qse_strlen(file);
qse_awk_rtx_seterror (
rtx, QSE_AWK_EOPEN, 0, &errarg);
return -1;
}
}
if (qse_awk_rtx_setfilename (
rtx, rxtn->c.in.files[rxtn->c.in.index],
qse_strlen(rxtn->c.in.files[rxtn->c.in.index])) == -1)
rtx, file, qse_strlen(file)) == -1)
{
qse_sio_close (sio);
if (sio != qse_sio_in) qse_sio_close (sio);
return -1;
}
@ -648,18 +646,7 @@ static int open_rio_console (qse_awk_rtx_t* rtx, qse_awk_riod_t* riod)
{
if (rxtn->c.out.files == QSE_NULL)
{
/* no output console file given */
return -1;
}
if (rxtn->c.out.files[rxtn->c.out.index] == QSE_NULL)
{
/* no more input file */
return 0;
}
if (rxtn->c.out.files[rxtn->c.out.index][0] == QSE_T('\0'))
{
QSE_ASSERT (rxtn->c.out.index == 0);
riod->handle = qse_sio_out;
}
else
@ -667,27 +654,32 @@ static int open_rio_console (qse_awk_rtx_t* rtx, qse_awk_riod_t* riod)
/* a temporary variable sio is used here not to change
* any fields of riod when the open operation fails */
qse_sio_t* sio;
const qse_char_t* file;
file = rxtn->c.out.files[rxtn->c.out.index];
if (file == QSE_NULL)
{
/* no more input file */
return 0;
}
sio = qse_sio_open (
rtx->awk->mmgr,
0,
rxtn->c.out.files[rxtn->c.out.index],
QSE_SIO_READ
);
rtx->awk->mmgr, 0, file, QSE_SIO_READ);
if (sio == QSE_NULL)
{
qse_cstr_t errarg;
errarg.ptr = rxtn->c.out.files[rxtn->c.out.index];
errarg.len = qse_strlen(rxtn->c.out.files[rxtn->c.out.index]);
errarg.ptr = file;
errarg.len = qse_strlen(file);
qse_awk_rtx_seterror (rtx, QSE_AWK_EOPEN, 0, &errarg);
qse_awk_rtx_seterror (
rtx, QSE_AWK_EOPEN, 0, &errarg);
return -1;
}
if (qse_awk_rtx_setofilename (
rtx, rxtn->c.out.files[rxtn->c.out.index],
qse_strlen(rxtn->c.out.files[rxtn->c.out.index])) == -1)
rtx, file, qse_strlen(file)) == -1)
{
qse_sio_close (sio);
return -1;
@ -731,75 +723,65 @@ static qse_ssize_t awk_rio_console (
while ((n = qse_sio_getsn((qse_sio_t*)riod->handle,data,size)) == 0)
{
qse_sio_t* sio;
const qse_char_t* file;
/* it has reached the end of the current file.
* open the next file if available */
if (rxtn->c.in.files[rxtn->c.in.index] == QSE_NULL)
if (rxtn->c.in.files == QSE_NULL ||
rxtn->c.in.files[rxtn->c.in.index] == QSE_NULL)
{
/* no more input console */
return 0;
}
if (rxtn->c.in.files[rxtn->c.in.index][0] == QSE_T('\0'))
{
if (riod->handle != QSE_NULL &&
riod->handle != qse_sio_in &&
riod->handle != qse_sio_out &&
riod->handle != qse_sio_err)
{
qse_sio_close ((qse_sio_t*)riod->handle);
}
file = rxtn->c.in.files[rxtn->c.in.index];
riod->handle = qse_sio_in;
if (file[0] == QSE_T('-') && file[1] == QSE_T('\0'))
{
sio = qse_sio_in;
}
else
{
qse_sio_t* sio;
sio = qse_sio_open (
rtx->awk->mmgr,
0,
rxtn->c.in.files[rxtn->c.in.index],
QSE_SIO_READ
);
rtx->awk->mmgr, 0, file, QSE_SIO_READ);
if (sio == QSE_NULL)
{
qse_cstr_t errarg;
errarg.ptr = rxtn->c.in.files[rxtn->c.in.index];
errarg.len = qse_strlen(rxtn->c.in.files[rxtn->c.in.index]);
qse_awk_rtx_seterror (rtx, QSE_AWK_EOPEN, 0, &errarg);
errarg.ptr = file;
errarg.len = qse_strlen(file);
qse_awk_rtx_seterror (
rtx, QSE_AWK_EOPEN, 0, &errarg);
return -1;
}
if (qse_awk_rtx_setfilename (
rtx, rxtn->c.in.files[rxtn->c.in.index],
qse_strlen(rxtn->c.in.files[rxtn->c.in.index])) == -1)
{
qse_sio_close (sio);
return -1;
}
if (qse_awk_rtx_setgbl (
rtx, QSE_AWK_GBL_FNR, qse_awk_val_zero) == -1)
{
/* need to reset FNR */
qse_sio_close (sio);
return -1;
}
if (riod->handle != QSE_NULL &&
riod->handle != qse_sio_in &&
riod->handle != qse_sio_out &&
riod->handle != qse_sio_err)
{
qse_sio_close ((qse_sio_t*)riod->handle);
}
riod->handle = sio;
}
if (qse_awk_rtx_setfilename (
rtx, file, qse_strlen(file)) == -1)
{
if (sio != qse_sio_in) qse_sio_close (sio);
return -1;
}
if (qse_awk_rtx_setgbl (
rtx, QSE_AWK_GBL_FNR, qse_awk_val_zero) == -1)
{
/* need to reset FNR */
if (sio != qse_sio_in) qse_sio_close (sio);
return -1;
}
if (riod->handle != QSE_NULL &&
riod->handle != qse_sio_in &&
riod->handle != qse_sio_out &&
riod->handle != qse_sio_err)
{
qse_sio_close ((qse_sio_t*)riod->handle);
}
riod->handle = sio;
rxtn->c.in.index++;
}
@ -1202,7 +1184,14 @@ static int fnc_rand (qse_awk_rtx_t* run, const qse_char_t* fnm, qse_size_t fnl)
{
qse_awk_val_t* r;
r = qse_awk_rtx_makeintval (run, rand());
/*
rxtn_t* rxtn;
rxtn = (rxtn_t*) QSE_XTN (run);
r = qse_awk_rtx_makerealval (
run, (qse_real_t)(rand_r(rxtn->seed) % RAND_MAX) / RAND_MAX );
*/
r = qse_awk_rtx_makerealval (
run, (qse_real_t)(rand() % RAND_MAX) / RAND_MAX);
if (r == QSE_NULL)
{
qse_awk_rtx_seterrnum (run, QSE_AWK_ENOMEM);

View File

@ -1,5 +1,5 @@
/*
* $Id: rex.c 186 2009-06-06 13:42:57Z hyunghwan.chung $
* $Id: rex.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -107,6 +107,7 @@ struct builder_t
qse_size_t cur;
} depth;
int option;
qse_rex_errnum_t errnum;
};
@ -135,7 +136,7 @@ struct matcher_t
qse_size_t cur;
} depth;
int ignorecase;
int option;
qse_rex_errnum_t errnum;
};
@ -371,7 +372,7 @@ int qse_rex_build (qse_rex_t* rex, const qse_char_t* ptn, qse_size_t len)
void* code;
code = qse_buildrex (
rex->mmgr, rex->depth.build,
rex->mmgr, rex->depth.build, 0,
ptn, len, &rex->errnum);
if (code == QSE_NULL) return -1;
@ -392,7 +393,7 @@ int qse_rex_match (
}
void* qse_buildrex (
qse_mmgr_t* mmgr, qse_size_t depth,
qse_mmgr_t* mmgr, qse_size_t depth, int option,
const qse_char_t* ptn, qse_size_t len, qse_rex_errnum_t* errnum)
{
builder_t builder;
@ -418,6 +419,7 @@ void* qse_buildrex (
builder.depth.max = depth;
builder.depth.cur = 0;
builder.option = option;
if (next_char (&builder, LEVEL_TOP) == -1)
{
@ -440,7 +442,12 @@ void* qse_buildrex (
if (builder.ptn.curc.type == CT_SPECIAL &&
builder.ptn.curc.value == QSE_T(')'))
{
*errnum = QSE_REX_EUNBALPAR;
*errnum = QSE_REX_EUNBALPAREN;
}
else if (builder.ptn.curc.type == CT_SPECIAL &&
builder.ptn.curc.value == QSE_T('{'))
{
*errnum = QSE_REX_EINVALBRACE;
}
else
{
@ -478,7 +485,7 @@ int qse_matchrex (
matcher.depth.max = depth;
matcher.depth.cur = 0;
matcher.ignorecase = (option & QSE_REX_IGNORECASE)? 1: 0;
matcher.option = option;
mat.matched = QSE_FALSE;
/* TODO: should it allow an offset here??? */
@ -1175,7 +1182,8 @@ static int next_char (builder_t* builder, int level)
builder->ptn.curc.value == QSE_T('|') ||
builder->ptn.curc.value == QSE_T('^') ||
builder->ptn.curc.value == QSE_T('$') ||
builder->ptn.curc.value == QSE_T('{') ||
(!(builder->option & QSE_REX_BUILD_NOBOUND) &&
builder->ptn.curc.value == QSE_T('{')) ||
builder->ptn.curc.value == QSE_T('+') ||
builder->ptn.curc.value == QSE_T('?') ||
builder->ptn.curc.value == QSE_T('*') ||
@ -1513,11 +1521,11 @@ static const qse_byte_t* match_ord_char (
ubound = cp->ubound;
cc = *(qse_char_t*)p; p += QSE_SIZEOF(cc);
if (matcher->ignorecase) cc = QSE_TOUPPER(cc);
if (matcher->option & QSE_REX_MATCH_IGNORECASE) cc = QSE_TOUPPER(cc);
/* merge the same consecutive codes
* for example, a{1,10}a{0,10} is shortened to a{1,20} */
if (matcher->ignorecase)
if (matcher->option & QSE_REX_MATCH_IGNORECASE)
{
while (p < mat->branch_end &&
cp->cmd == ((const code_t*)p)->cmd)
@ -1554,7 +1562,7 @@ static const qse_byte_t* match_ord_char (
mat->match_len = 0;
/* find the longest match */
if (matcher->ignorecase)
if (matcher->option & QSE_REX_MATCH_IGNORECASE)
{
while (si < ubound)
{
@ -1627,7 +1635,7 @@ static const qse_byte_t* match_charset (
if (&mat->match_ptr[si] >= matcher->match.str.end) break;
c = mat->match_ptr[si];
if (matcher->ignorecase) c = QSE_TOUPPER(c);
if (matcher->option & QSE_REX_MATCH_IGNORECASE) c = QSE_TOUPPER(c);
n = __test_charset (matcher, p, cshdr->csc, c);
if (cp->negate) n = !n;
@ -1891,7 +1899,7 @@ static qse_bool_t __test_charset (
if (c0 == CHARSET_ONE)
{
c1 = *(const qse_char_t*)p;
if (matcher->ignorecase)
if (matcher->option & QSE_REX_MATCH_IGNORECASE)
c1 = QSE_TOUPPER(c1);
#ifdef DEBUG_REX
qse_dprintf (
@ -1905,7 +1913,7 @@ static qse_bool_t __test_charset (
p += QSE_SIZEOF(c1);
c2 = *(const qse_char_t*)p;
if (matcher->ignorecase)
if (matcher->option & QSE_REX_MATCH_IGNORECASE)
{
c1 = QSE_TOUPPER(c1);
c2 = QSE_TOUPPER(c2);

View File

@ -1,5 +1,5 @@
/*
* $Id: sed.c 191 2009-06-07 13:09:14Z hyunghwan.chung $
* $Id: sed.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -409,6 +409,7 @@ static void* compile_rex (qse_sed_t* sed, qse_char_t rxend)
code = qse_buildrex (
sed->mmgr,
sed->depth.rex.build,
((sed->option&QSE_SED_REXBOUND)? 0:QSE_REX_BUILD_NOBOUND),
QSE_STR_PTR(&sed->tmp.rex),
QSE_STR_LEN(&sed->tmp.rex),
QSE_NULL
@ -927,6 +928,7 @@ static int get_subst (qse_sed_t* sed, qse_sed_cmd_t* cmd)
cmd->u.subst.rex = qse_buildrex (
sed->mmgr,
sed->depth.rex.build,
((sed->option&QSE_SED_REXBOUND)? 0:QSE_REX_BUILD_NOBOUND),
QSE_STR_PTR(t[0]),
QSE_STR_LEN(t[0]),
QSE_NULL
@ -1136,7 +1138,7 @@ static int get_command (qse_sed_t* sed, qse_sed_cmd_t* cmd)
case QSE_T('q'):
case QSE_T('Q'):
cmd->type = c;
if (sed->option & QSE_SED_CLASSIC &&
if (sed->option & QSE_SED_STRICT &&
cmd->a2.type != QSE_SED_ADR_NONE)
{
SETERR1 (
@ -1152,7 +1154,7 @@ static int get_command (qse_sed_t* sed, qse_sed_cmd_t* cmd)
case QSE_T('a'):
case QSE_T('i'):
if (sed->option & QSE_SED_CLASSIC &&
if (sed->option & QSE_SED_STRICT &&
cmd->a2.type != QSE_SED_ADR_NONE)
{
qse_char_t tmpc = c;
@ -1196,7 +1198,7 @@ static int get_command (qse_sed_t* sed, qse_sed_cmd_t* cmd)
}
case QSE_T('='):
if (sed->option & QSE_SED_CLASSIC &&
if (sed->option & QSE_SED_STRICT &&
cmd->a2.type != QSE_SED_ADR_NONE)
{
qse_char_t tmpc = c;
@ -1321,7 +1323,7 @@ int qse_sed_comp (qse_sed_t* sed, const qse_char_t* sptr, qse_size_t slen)
while (IS_SPACE(c)) c = NXTSC (sed);
if (c == QSE_T(',') ||
(!(sed->option&QSE_SED_CLASSIC) && c == QSE_T('~')))
((sed->option&QSE_SED_STARTSTEP) && c==QSE_T('~')))
{
qse_char_t delim = c;
@ -1344,7 +1346,7 @@ int qse_sed_comp (qse_sed_t* sed, const qse_char_t* sptr, qse_size_t slen)
return -1;
}
}
else if (!(sed->option & QSE_SED_CLASSIC) &&
else if ((sed->option&QSE_SED_STARTSTEP) &&
(delim == QSE_T('~')))
{
if (cmd->a1.type != QSE_SED_ADR_LINE ||
@ -1858,7 +1860,7 @@ static int do_subst (qse_sed_t* sed, qse_sed_cmd_t* cmd)
QSE_ASSERT (cmd->type == QSE_SED_CMD_SUBSTITUTE);
qse_str_clear (&sed->e.txt.subst);
if (cmd->u.subst.i) opt = QSE_REX_IGNORECASE;
if (cmd->u.subst.i) opt = QSE_REX_MATCH_IGNORECASE;
str_ptr = QSE_STR_PTR(&sed->e.in.line);
str_len = QSE_STR_LEN(&sed->e.in.line);

View File

@ -1,5 +1,5 @@
/*
* $Id: awk01.c 182 2009-06-03 21:50:32Z hyunghwan.chung $
* $Id: awk01.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -57,9 +57,11 @@ int main ()
}
rtx = qse_awk_rtx_openstd (
awk, 0,
QSE_NULL, /* no console input */
QSE_AWK_RTX_OPENSTD_STDIO /* stdout for console output */
awk,
0,
QSE_T("awk01"),
QSE_NULL, /* stdin */
QSE_NULL /* stdout */
);
if (rtx == QSE_NULL)
{

View File

@ -1,5 +1,5 @@
/*
* $Id: awk02.c 182 2009-06-03 21:50:32Z hyunghwan.chung $
* $Id: awk02.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -72,9 +72,11 @@ int main ()
qse_fflush (QSE_STDOUT);
rtx = qse_awk_rtx_openstd (
awk, 0,
QSE_NULL, /* no console input */
QSE_AWK_RTX_OPENSTD_STDIO /* stdout for console output */
awk,
0,
QSE_T("awk02"),
QSE_NULL, /* stdin */
QSE_NULL /* stdout */
);
if (rtx == QSE_NULL)
{

View File

@ -1,5 +1,5 @@
/*
* $Id: awk03.c 182 2009-06-03 21:50:32Z hyunghwan.chung $
* $Id: awk03.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -69,9 +69,11 @@ int main ()
/* create a runtime context */
rtx = qse_awk_rtx_openstd (
awk, 0,
QSE_NULL, /* no console input */
QSE_AWK_RTX_OPENSTD_STDIO /* stdout for console output */
awk,
0,
QSE_T("awk03"),
QSE_NULL, /* stdin */
QSE_NULL /* stdout */
);
if (rtx == QSE_NULL)
{

View File

@ -1,5 +1,5 @@
/*
* $Id: awk04.c 182 2009-06-03 21:50:32Z hyunghwan.chung $
* $Id: awk04.c 195 2009-06-10 13:18:25Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -67,9 +67,11 @@ int main ()
/* create a runtime context */
rtx = qse_awk_rtx_openstd (
awk, 0,
QSE_NULL, /* no console input */
QSE_AWK_RTX_OPENSTD_STDIO /* stdout for console output */
awk,
0,
QSE_T("awk04"),
QSE_NULL, /* stdin */
QSE_NULL /* stdout */
);
if (rtx == QSE_NULL)
{

View File

@ -118,14 +118,14 @@ static void print_usage (QSE_FILE* out, int argc, qse_char_t* argv[])
qse_fprintf (out, QSE_T("options as follows:\n"));
qse_fprintf (out, QSE_T(" -h show this message\n"));
qse_fprintf (out, QSE_T(" -n disable auto-print\n"));
qse_fprintf (out, QSE_T(" -c enable the classic mode\n"));
qse_fprintf (out, QSE_T(" -a perform strict address check\n"));
}
static int handle_args (int argc, qse_char_t* argv[])
{
static qse_opt_t opt =
{
QSE_T("hnc"),
QSE_T("hna"),
QSE_NULL
};
qse_cint_t c;
@ -162,8 +162,8 @@ static int handle_args (int argc, qse_char_t* argv[])
g_option |= QSE_SED_QUIET;
break;
case QSE_T('c'):
g_option |= QSE_SED_CLASSIC;
case QSE_T('a'):
g_option |= QSE_SED_STRICT;
break;
}
}