* added QSE_SIO_NOCLOSE.

* enhanced qse_sed_comp() to accept an array of qse_sed_iostd_t
This commit is contained in:
2011-10-03 01:25:23 +00:00
parent 8f3563b73e
commit 7505e0723f
28 changed files with 1065 additions and 285 deletions

View File

@ -177,23 +177,11 @@ public:
void close ();
///
/// The compile() function compiles a null-terminated string pointed
/// to by @a sptr.
/// The compile() function compiles a script from a stream
/// @a iostream.
/// @return 0 on success, -1 on failure
///
int compile (
const char_t* sptr ///< a pointer to a null-terminated string
);
///
/// The compile() function compiles a string pointed to by @a sptr
/// and of the length @a slen.
/// @return 0 on success, -1 on failure
///
int compile (
const char_t* sptr, ///< a pointer to a string
size_t slen ///< the number of characters in the string
);
int compile (Stream& sstream);
///
/// The execute() function executes compiled commands over the I/O
@ -202,7 +190,6 @@ public:
///
int execute (Stream& iostream);
///
/// The stop() function makes a request to break a running loop
/// inside execute(). Note that this does not affect blocking
@ -310,11 +297,15 @@ protected:
sed_t* sed;
/// default error formatting string getter
errstr_t dflerrstr;
/// Stream to read script from
Stream* sstream;
/// I/O stream to read data from and write output to.
Stream* iostream;
private:
static ssize_t sin (
sed_t* s, io_cmd_t cmd, io_arg_t* arg, char_t* buf, size_t len);
static ssize_t xin (
sed_t* s, io_cmd_t cmd, io_arg_t* arg, char_t* buf, size_t len);
static ssize_t xout (

View File

@ -369,8 +369,7 @@ void qse_sed_seterror (
*/
int qse_sed_comp (
qse_sed_t* sed, /**< stream editor */
const qse_char_t* ptr, /**< pointer to a string containing commands */
qse_size_t len /**< the number of characters in the string */
qse_sed_io_fun_t inf /**< script stream reader */
);
/**

View File

@ -95,13 +95,13 @@ void* qse_sed_getxtnstd (
);
/**
* The qse_sed_compstd() function compiles a null-terminated sed script.
* Call qse_sed_comp() for a length delimited script.
* The qse_sed_compstd() function compiles sed scripts specified in
* a null-terminated array of stream resources.
* @return 0 on success, -1 on failure
*/
int qse_sed_compstd (
qse_sed_t* sed, /**< stream editor */
const qse_char_t* str /**< null-terminated script */
qse_sed_iostd_t in[] /**< input scripts */
);
/**
@ -109,7 +109,7 @@ int qse_sed_compstd (
* over input streams @a in and an output stream @a out.
*
* If @a in is not #QSE_NULL, it must point to a null-terminated array
* of standard I/O resources. if in[0].type is QSE_SED_IOSTD_NULL, this
* of stream resources. if in[0].type is QSE_SED_IOSTD_NULL, this
* function returns failure, requiring at least 1 valid resource to be
* included in the array.
*