added qse_awk_rtx_getvalstr() and qse_awk_rtx_freevalstr().

changed some code to use the 2 new functions.
added the sed module to awk. incomplete yet
This commit is contained in:
2014-02-19 15:24:33 +00:00
parent b5de91921c
commit 2e9bb90c39
20 changed files with 629 additions and 344 deletions

View File

@ -2648,6 +2648,33 @@ QSE_EXPORT qse_wchar_t* qse_awk_rtx_valtowcsdup (
qse_size_t* len /**< result length */
);
/**
* The qse_awk_rtx_getvalstr() function returns a string
* pointer converted from a value \a val. If the value
* type is #QSE_AWK_VAL_STR, it simply returns the internal
* pointer without duplication. Otherwise, it calls
* qse_awk_rtx_valtostrdup(). The length of the returned
* string is stored into the location pointed to by \a len.
*/
QSE_EXPORT qse_char_t* qse_awk_rtx_getvalstr (
qse_awk_rtx_t* rtx, /**< runtime context */
const qse_awk_val_t* val, /**< value to convert */
qse_size_t* len /**< result length */
);
/**
* The qse_awk_rtx_freevalstr() function frees the memory pointed
* to by \a str if \a val is not of the #QSE_AWK_VAL_STR type.
* This function expects a value pointer and a string pointer
* passed to and returned by qse_awk_rtx_getvalstr() respectively.
*/
QSE_EXPORT void qse_awk_rtx_freevalstr (
qse_awk_rtx_t* rtx, /**< runtime context */
const qse_awk_val_t* val, /**< value to convert */
qse_char_t* str /**< string pointer */
);
/**
* The qse_awk_rtx_valtonum() function converts a value to a number.
* If the value is converted to an integer, it is stored in the memory

View File

@ -169,6 +169,17 @@ QSE_EXPORT int qse_sed_compstdstr (
const qse_char_t* script
);
/**
* The qse_sed_compstd() function compiles a sed script of the
* length @a script_len pointed to by @a script.
* @return 0 on success, -1 on failure
*/
QSE_EXPORT int qse_sed_compstdstrx (
qse_sed_t* sed,
const qse_char_t* script,
qse_size_t script_len
);
/**
* The qse_sed_execstd() function executes a compiled script
* over input streams @a in and an output stream @a out.