improved line number handling

This commit is contained in:
2009-08-20 08:04:15 +00:00
parent 0f9d553ff8
commit b6ca96214a
12 changed files with 278 additions and 254 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: StdAwk.cpp 257 2009-08-17 12:10:30Z hyunghwan.chung $
* $Id: StdAwk.cpp 258 2009-08-19 14:04:15Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -821,7 +821,7 @@ int StdAwk::SourceFile::open (Data& io)
char_t fbuf[64];
char_t* dbuf = QSE_NULL;
if (dir.len > 0)
if (dir.len > 0 && ioname[0] != QSE_T('/'))
{
size_t tmplen, totlen;

View File

@ -1,5 +1,5 @@
/*
* $Id: err.c 257 2009-08-17 12:10:30Z hyunghwan.chung $
* $Id: err.c 258 2009-08-19 14:04:15Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -46,10 +46,9 @@ const qse_char_t* qse_awk_dflerrstr (qse_awk_t* awk, qse_awk_errnum_t errnum)
QSE_T("invalid character '${0}'"),
QSE_T("invalid digit '${0}'"),
QSE_T("unexpected end of source"),
QSE_T("unexpected end of input"),
QSE_T("comment not closed properly"),
QSE_T("string or regular expression not closed"),
QSE_T("unexpected end of regular expression"),
QSE_T("left brace expected in place of '${0}'"),
QSE_T("left parenthesis expected in place of '${0}'"),
QSE_T("right parenthesis expected in place of '${0}'"),

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
/*
* $Id: run.c 257 2009-08-17 12:10:30Z hyunghwan.chung $
* $Id: run.c 258 2009-08-19 14:04:15Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -435,7 +435,8 @@ static int set_global (
if (shorten_record (run, (qse_size_t)lv) == -1)
{
/* adjust the error line */
if (var != QSE_NULL) run->errinf.lin = var->line;
if (var != QSE_NULL)
run->errinf.lin = var->line;
return -1;
}
}
@ -1543,7 +1544,7 @@ static int run_pattern_blocks (qse_awk_rtx_t* run)
{
int n;
#define ADJUST_ERROR_LINE(run) \
#define ADJUST_ERROR(run) \
if (run->awk->tree.chain != QSE_NULL) \
{ \
if (run->awk->tree.chain->pattern != QSE_NULL) \
@ -1568,14 +1569,14 @@ static int run_pattern_blocks (qse_awk_rtx_t* run)
n = read_record (run);
if (n == -1)
{
ADJUST_ERROR_LINE (run);
ADJUST_ERROR (run);
return -1; /* error */
}
if (n == 0) break; /* end of input */
if (update_fnr (run, run->gbl.fnr+1, run->gbl.nr+1) == -1)
{
ADJUST_ERROR_LINE (run);
ADJUST_ERROR (run);
return -1;
}
@ -1586,7 +1587,7 @@ static int run_pattern_blocks (qse_awk_rtx_t* run)
}
}
#undef ADJUST_ERROR_LINE
#undef ADJUST_ERROR
return 0;
}

View File

@ -1,5 +1,5 @@
/*
* $Id: std.c 256 2009-08-16 13:44:20Z hyunghwan.chung $
* $Id: std.c 258 2009-08-19 14:04:15Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
@ -219,7 +219,7 @@ static qse_ssize_t sf_in_open (
qse_char_t fbuf[64];
qse_char_t* dbuf = QSE_NULL;
if (xtn->s.in.dir.len > 0)
if (xtn->s.in.dir.len > 0 && arg->name[0] != QSE_T('/'))
{
qse_size_t tmplen, totlen;
@ -1066,11 +1066,11 @@ static qse_ssize_t awk_rio_console (
}
qse_awk_rtx_t* qse_awk_rtx_openstd (
qse_awk_t* awk,
qse_size_t xtnsize,
const qse_char_t* id,
const qse_char_t*const* icf,
const qse_char_t*const* ocf)
qse_awk_t* awk,
qse_size_t xtnsize,
const qse_char_t* id,
const qse_char_t** icf,
const qse_char_t** ocf)
{
qse_awk_rtx_t* rtx;
qse_awk_rio_t rio;