added qse_awk_rtx_getxtnstd() and enhanced qse_awk_rtx_openstd()

This commit is contained in:
hyung-hwan 2009-02-27 06:55:05 +00:00
parent 651f6d2dfa
commit 3ca13066a9
7 changed files with 30 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk.c 85 2009-02-26 10:56:12Z hyunghwan.chung $ * $Id: awk.c 86 2009-02-26 12:55:05Z hyunghwan.chung $
* *
Copyright 2006-2009 Chung, Hyung-Hwan. Copyright 2006-2009 Chung, Hyung-Hwan.
@ -644,7 +644,7 @@ static int awk_main (int argc, qse_char_t* argv[])
rcb.data = &ao; rcb.data = &ao;
rtx = qse_awk_rtx_openstd ( rtx = qse_awk_rtx_openstd (
awk, ao.icf, QSE_AWK_RTX_OPENSTD_STDIO); awk, 0, ao.icf, QSE_AWK_RTX_OPENSTD_STDIO);
if (rtx == QSE_NULL) if (rtx == QSE_NULL)
{ {
qse_printf ( qse_printf (

View File

@ -1,5 +1,5 @@
/* /*
* $Id: std.h 85 2009-02-26 10:56:12Z hyunghwan.chung $ * $Id: std.h 86 2009-02-26 12:55:05Z hyunghwan.chung $
* *
Copyright 2006-2009 Chung, Hyung-Hwan. Copyright 2006-2009 Chung, Hyung-Hwan.
@ -138,16 +138,26 @@ int qse_awk_parsestd (
* The caller should keep the contents of icf and ocf valid throughout * The caller should keep the contents of icf and ocf valid throughout
* the lifetime of the runtime context created. The runtime context * the lifetime of the runtime context created. The runtime context
* remembers the pointers without copying in the contents. * remembers the pointers without copying in the contents.
*
* SYNOPSIS * SYNOPSIS
*/ */
qse_awk_rtx_t* qse_awk_rtx_openstd ( qse_awk_rtx_t* qse_awk_rtx_openstd (
qse_awk_t* awk, qse_awk_t* awk,
qse_size_t xtnsize,
const qse_char_t*const icf[], const qse_char_t*const icf[],
const qse_char_t*const ocf[] const qse_char_t*const ocf[]
); );
/******/ /******/
/****f* AWK/qse_awk_rtx_getxtnstd
* NAME
* qse_awk_rtx_getxtnstd - get the pointer to extension space
* SYNOPSIS
*/
void* qse_awk_rtx_getxtnstd (
qse_awk_rtx_t* rtx
);
/******/
#ifdef __cplusplus #ifdef __cplusplus
} }
#endif #endif

View File

@ -1,5 +1,5 @@
/* /*
* $Id: std.c 85 2009-02-26 10:56:12Z hyunghwan.chung $ * $Id: std.c 86 2009-02-26 12:55:05Z hyunghwan.chung $
* *
Copyright 2006-2009 Chung, Hyung-Hwan. Copyright 2006-2009 Chung, Hyung-Hwan.
@ -881,6 +881,7 @@ static qse_ssize_t awk_rio_console (
qse_awk_rtx_t* qse_awk_rtx_openstd ( qse_awk_rtx_t* qse_awk_rtx_openstd (
qse_awk_t* awk, qse_awk_t* awk,
qse_size_t xtnsize,
const qse_char_t*const icf[], const qse_char_t*const icf[],
const qse_char_t*const ocf[]) const qse_char_t*const ocf[])
{ {
@ -895,7 +896,7 @@ qse_awk_rtx_t* qse_awk_rtx_openstd (
rtx = qse_awk_rtx_open ( rtx = qse_awk_rtx_open (
awk, awk,
QSE_SIZEOF(rxtn_t), QSE_SIZEOF(rxtn_t) + xtnsize,
&rio, &rio,
QSE_NULL/*runarg*/ QSE_NULL/*runarg*/
); );
@ -916,6 +917,11 @@ qse_awk_rtx_t* qse_awk_rtx_openstd (
return rtx; return rtx;
} }
void* qse_awk_rtx_getxtnstd (qse_awk_rtx_t* rtx)
{
return (void*)((rxtn_t*)QSE_XTN(rtx) + 1);
}
/*** EXTRA BUILTIN FUNCTIONS ***/ /*** EXTRA BUILTIN FUNCTIONS ***/
enum enum
{ {

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk01.c 85 2009-02-26 10:56:12Z hyunghwan.chung $ * $Id: awk01.c 86 2009-02-26 12:55:05Z hyunghwan.chung $
* *
Copyright 2006-2009 Chung, Hyung-Hwan. Copyright 2006-2009 Chung, Hyung-Hwan.
@ -63,7 +63,7 @@ int main ()
} }
rtx = qse_awk_rtx_openstd ( rtx = qse_awk_rtx_openstd (
awk, awk, 0,
QSE_NULL, /* no console input */ QSE_NULL, /* no console input */
QSE_AWK_RTX_OPENSTD_STDIO /* stdout for console output */ QSE_AWK_RTX_OPENSTD_STDIO /* stdout for console output */
); );

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk02.c 85 2009-02-26 10:56:12Z hyunghwan.chung $ * $Id: awk02.c 86 2009-02-26 12:55:05Z hyunghwan.chung $
* *
Copyright 2006-2009 Chung, Hyung-Hwan. Copyright 2006-2009 Chung, Hyung-Hwan.
@ -78,7 +78,7 @@ int main ()
qse_fflush (QSE_STDOUT); qse_fflush (QSE_STDOUT);
rtx = qse_awk_rtx_openstd ( rtx = qse_awk_rtx_openstd (
awk, awk, 0,
QSE_NULL, /* no console input */ QSE_NULL, /* no console input */
QSE_AWK_RTX_OPENSTD_STDIO /* stdout for console output */ QSE_AWK_RTX_OPENSTD_STDIO /* stdout for console output */
); );

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk03.c 85 2009-02-26 10:56:12Z hyunghwan.chung $ * $Id: awk03.c 86 2009-02-26 12:55:05Z hyunghwan.chung $
* *
Copyright 2006-2009 Chung, Hyung-Hwan. Copyright 2006-2009 Chung, Hyung-Hwan.
@ -77,7 +77,7 @@ int main ()
/* create a runtime context */ /* create a runtime context */
rtx = qse_awk_rtx_openstd ( rtx = qse_awk_rtx_openstd (
awk, awk, 0,
QSE_NULL, /* no console input */ QSE_NULL, /* no console input */
QSE_AWK_RTX_OPENSTD_STDIO /* stdout for console output */ QSE_AWK_RTX_OPENSTD_STDIO /* stdout for console output */
); );

View File

@ -1,5 +1,5 @@
/* /*
* $Id: awk04.c 85 2009-02-26 10:56:12Z hyunghwan.chung $ * $Id: awk04.c 86 2009-02-26 12:55:05Z hyunghwan.chung $
* *
Copyright 2006-2009 Chung, Hyung-Hwan. Copyright 2006-2009 Chung, Hyung-Hwan.
@ -67,7 +67,7 @@ int main ()
/* create a runtime context */ /* create a runtime context */
rtx = qse_awk_rtx_openstd ( rtx = qse_awk_rtx_openstd (
awk, awk, 0,
QSE_NULL, /* no console input */ QSE_NULL, /* no console input */
QSE_AWK_RTX_OPENSTD_STDIO /* stdout for console output */ QSE_AWK_RTX_OPENSTD_STDIO /* stdout for console output */
); );