Added a cmgr parameter to qse_awk_rtx_open()

This commit is contained in:
hyung-hwan 2012-01-14 01:45:48 +00:00
parent d48f69568c
commit 52710a87c9
3 changed files with 15 additions and 11 deletions

View File

@ -953,7 +953,7 @@ static int awk_main (int argc, qse_char_t* argv[])
rtx = qse_awk_rtx_openstd ( rtx = qse_awk_rtx_openstd (
awk, 0, QSE_T("qseawk"), awk, 0, QSE_T("qseawk"),
(const qse_char_t*const*)arg.icf, QSE_NULL); (const qse_char_t*const*)arg.icf, QSE_NULL, QSE_NULL);
if (rtx == QSE_NULL) if (rtx == QSE_NULL)
{ {
print_awkerr (awk); print_awkerr (awk);

View File

@ -137,7 +137,8 @@ qse_awk_rtx_t* qse_awk_rtx_openstd (
qse_size_t xtn, qse_size_t xtn,
const qse_char_t* id, const qse_char_t* id,
const qse_char_t*const icf[], const qse_char_t*const icf[],
const qse_char_t*const ocf[] const qse_char_t*const ocf[],
qse_cmgr_t* cmgr
); );
/** /**

View File

@ -86,10 +86,6 @@ typedef struct xtn_t
struct struct
{ {
qse_str_t* buf; qse_str_t* buf;
#if 0
qse_char_t* ptr;
qse_char_t* end;
#endif
} str; } str;
} u; } u;
} out; } out;
@ -116,6 +112,8 @@ typedef struct rxtn_t
qse_size_t index; qse_size_t index;
qse_size_t count; qse_size_t count;
} out; } out;
qse_cmgr_t* cmgr;
} c; /* console */ } c; /* console */
} rxtn_t; } rxtn_t;
@ -976,6 +974,7 @@ static int open_rio_console (qse_awk_rtx_t* rtx, qse_awk_rio_arg_t* riod)
); );
if (sio == QSE_NULL) return -1; if (sio == QSE_NULL) return -1;
if (rxtn->c.cmgr) qse_sio_setcmgr (sio, rxtn->c.cmgr);
riod->handle = sio; riod->handle = sio;
rxtn->c.in.count++; rxtn->c.in.count++;
return 1; return 1;
@ -1018,6 +1017,8 @@ static int open_rio_console (qse_awk_rtx_t* rtx, qse_awk_rio_arg_t* riod)
); );
if (sio == QSE_NULL) return -1; if (sio == QSE_NULL) return -1;
if (rxtn->c.cmgr) qse_sio_setcmgr (sio, rxtn->c.cmgr);
riod->handle = sio; riod->handle = sio;
rxtn->c.in.count++; rxtn->c.in.count++;
return 1; return 1;
@ -1256,7 +1257,8 @@ qse_awk_rtx_t* qse_awk_rtx_openstd (
qse_size_t xtnsize, qse_size_t xtnsize,
const qse_char_t* id, const qse_char_t* id,
const qse_char_t*const icf[], const qse_char_t*const icf[],
const qse_char_t*const ocf[]) const qse_char_t*const ocf[],
qse_cmgr_t* cmgr)
{ {
qse_awk_rtx_t* rtx; qse_awk_rtx_t* rtx;
qse_awk_rio_t rio; qse_awk_rio_t rio;
@ -1272,7 +1274,7 @@ qse_awk_rtx_t* qse_awk_rtx_openstd (
rio.file = awk_rio_file; rio.file = awk_rio_file;
rio.console = awk_rio_console; rio.console = awk_rio_console;
if (icf != QSE_NULL) if (icf)
{ {
for (p = icf; *p != QSE_NULL; p++); for (p = icf; *p != QSE_NULL; p++);
argc = p - icf; argc = p - icf;
@ -1298,9 +1300,9 @@ qse_awk_rtx_t* qse_awk_rtx_openstd (
p2->len = qse_strlen(id); p2->len = qse_strlen(id);
p2++; p2++;
if (icf != QSE_NULL) if (icf)
{ {
for (p = icf; *p != QSE_NULL; p++, p2++) for (p = icf; *p; p++, p2++)
{ {
p2->ptr = *p; p2->ptr = *p;
p2->len = qse_strlen(*p); p2->len = qse_strlen(*p);
@ -1317,7 +1319,7 @@ qse_awk_rtx_t* qse_awk_rtx_openstd (
argvp argvp
); );
if (argvp != QSE_NULL && argvp != argv) QSE_AWK_FREE (awk, argvp); if (argvp && argvp != argv) QSE_AWK_FREE (awk, argvp);
if (rtx == QSE_NULL) return QSE_NULL; if (rtx == QSE_NULL) return QSE_NULL;
rxtn = (rxtn_t*) QSE_XTN (rtx); rxtn = (rxtn_t*) QSE_XTN (rtx);
@ -1333,6 +1335,7 @@ qse_awk_rtx_t* qse_awk_rtx_openstd (
rxtn->c.out.files = ocf; rxtn->c.out.files = ocf;
rxtn->c.out.index = 0; rxtn->c.out.index = 0;
rxtn->c.out.count = 0; rxtn->c.out.count = 0;
rxtn->c.cmgr = cmgr;
/* FILENAME can be set when the input console is opened. /* FILENAME can be set when the input console is opened.