* fixed a rounding bug of reallocation size in _realloc_merge of qse_xma_t.

* replaced rex with tre in qse_sed_t
* added submatch reference for the 's' command into qse_sed_t
* changed some options and functions for tre integration in qse_sed_t
This commit is contained in:
2011-09-03 09:27:44 +00:00
parent 1efa41052e
commit 3fe32033cb
9 changed files with 265 additions and 113 deletions

View File

@ -143,7 +143,7 @@ int qse_tre_execx (
const qse_char_t* str,
qse_size_t len,
qse_tre_match_t* pmatch,
qse_size_t nmatch,
qse_size_t nmatch,
int eflags
);
@ -151,7 +151,7 @@ int qse_tre_exec (
qse_tre_t* tre,
const qse_char_t* str,
qse_tre_match_t* pmatch,
qse_size_t nmatch,
qse_size_t nmatch,
int eflags
);

View File

@ -1,5 +1,5 @@
/*
* $Id: Sed.hpp 507 2011-07-15 15:53:49Z hyunghwan.chung $
* $Id: Sed.hpp 558 2011-09-02 15:27:44Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -54,8 +54,10 @@ public:
typedef qse_sed_io_arg_t io_arg_t;
/// The option_t type redefines an option type
typedef qse_sed_option_t option_t;
#if 0
/// The depth_t type redefines an depth IDs
typedef qse_sed_depth_t depth_t;
#endif
///
/// The Stream class is a base class for I/O operation during
@ -214,6 +216,7 @@ public:
int opt ///< option code
);
#if 0
///
/// The getMaxDepth() function gets the maximum processing depth for
/// an operation type identified by @a id.
@ -229,6 +232,7 @@ public:
int ids, ///< 0 or a number OR'ed of depth_t values
size_t depth ///< 0 maximum depth
);
#endif
///
/// The getErrorMessage() function gets the description of the last

View File

@ -1,5 +1,5 @@
/*
* $Id: sed.h 507 2011-07-15 15:53:49Z hyunghwan.chung $
* $Id: sed.h 558 2011-09-02 15:27:44Z hyunghwan.chung $
*
Copyright 2006-2011 Chung, Hyung-Hwan.
This file is part of QSE.
@ -131,29 +131,17 @@ typedef const qse_char_t* (*qse_sed_errstr_t) (
*/
enum qse_sed_option_t
{
QSE_SED_STRIPLS = (1 << 0), /**< strip leading spaces from text */
QSE_SED_KEEPTBS = (1 << 1), /**< keep an trailing backslash */
QSE_SED_ENSURENL = (1 << 2), /**< ensure NL at the text end */
QSE_SED_QUIET = (1 << 3), /**< do not print pattern space */
QSE_SED_STRICT = (1 << 4), /**< do strict address check */
QSE_SED_STARTSTEP = (1 << 5), /**< allow start~step */
QSE_SED_REXBOUND = (1 << 6), /**< allow {n,m} in regular expression */
QSE_SED_SAMELINE = (1 << 7), /**< allow text on the same line as c, a, i */
QSE_SED_STRIPLS = (1 << 0), /**< strip leading spaces from text */
QSE_SED_KEEPTBS = (1 << 1), /**< keep an trailing backslash */
QSE_SED_ENSURENL = (1 << 2), /**< ensure NL at the text end */
QSE_SED_QUIET = (1 << 3), /**< do not print pattern space */
QSE_SED_STRICT = (1 << 4), /**< do strict address check */
QSE_SED_STARTSTEP = (1 << 5), /**< allow start~step */
QSE_SED_EXTENDEDREX = (1 << 6), /**< allow {n,m} in regular expression */
QSE_SED_SAMELINE = (1 << 7), /**< allow text on the same line as c, a, i */
};
typedef enum qse_sed_option_t qse_sed_option_t;
/**
* The qse_sed_depth_t type defines IDs for qse_sed_getmaxdepth() and
* qse_sed_setmaxdepth().
*/
enum qse_sed_depth_t
{
QSE_SED_DEPTH_REX_BUILD = (1 << 0),
QSE_SED_DEPTH_REX_MATCH = (1 << 1)
};
typedef enum qse_sed_depth_t qse_sed_depth_t;
/**
* The qse_sed_io_cmd_t type defines I/O command codes. The code indicates
* the action to take in an I/O handler.
@ -246,23 +234,6 @@ void qse_sed_setoption (
int opt /**< 0 or a number OR'ed of #qse_sed_option_t values */
);
/**
* The qse_sed_getmaxdepth() gets the maximum processing depth.
*/
qse_size_t qse_sed_getmaxdepth (
qse_sed_t* sed, /**< stream editor */
qse_sed_depth_t id /**< one of qse_sed_depth_t values */
);
/**
* The qse_sed_setmaxdepth() sets the maximum processing depth.
*/
void qse_sed_setmaxdepth (
qse_sed_t* sed, /**< stream editor */
int ids, /**< 0 or a number OR'ed of #qse_sed_depth_t values */
qse_size_t depth /**< maximum depth level */
);
/**
* The qse_sed_geterrstr() gets an error string getter.
*/