added a bit of code into sed

This commit is contained in:
hyung-hwan 2009-02-10 08:14:00 +00:00
parent b1211d6e58
commit 79c1d6b861
4 changed files with 17 additions and 5 deletions

View File

@ -171,7 +171,7 @@ int tgp_main (int argc, qse_char_t* argv[])
if (handle_args (argc, argv) == -1) return -1; if (handle_args (argc, argv) == -1) return -1;
tgp = qse_tgp_open (QSE_MMGR_GETDFL()); tgp = qse_tgp_open (QSE_NULL, 0);
if (tgp == QSE_NULL) if (tgp == QSE_NULL)
{ {
qse_fprintf (QSE_STDERR, qse_fprintf (QSE_STDERR,

View File

@ -22,6 +22,7 @@
#include <qse/types.h> #include <qse/types.h>
#include <qse/macros.h> #include <qse/macros.h>
#include <qse/cmn/str.h> #include <qse/cmn/str.h>
#include <qse/cmn/lda.h>
enum qse_sed_errnum_t enum qse_sed_errnum_t
{ {
@ -45,6 +46,9 @@ struct qse_sed_t
void* lastrex; void* lastrex;
qse_str_t rexbuf; /* temporary regular expression buffer */ qse_str_t rexbuf; /* temporary regular expression buffer */
/* command array */
qse_lda_t cmds;
}; };

View File

@ -198,7 +198,12 @@ static const qse_char_t* command (
#if 0 #if 0
case QSE_T('{'): case QSE_T('{'):
cmd = QSE_SED_C_B; /* insert a negaited branch command at the beginning
* of a group. this way, all the commands in a group
* can be skipped. the branch target is set once a
* corresponding } is met. */
cmd.type = QSE_SED_C_BRANCH;
cmd.negfl = !cmd.negfl;
break; break;
case QSE_T('}'): case QSE_T('}'):

View File

@ -51,8 +51,8 @@ struct qse_sed_c_t
union union
{ {
void* rex; /* regular expression */ void* rex; /* regular expression */
qse_char_t* text; /* added text or file name */ qse_char_t* text; /* added text or file name */
qse_sed_c_t* lbl; /* destination command of branch */ qse_sed_c_t* lbl; /* destination command of branch */
} u; } u;
@ -88,7 +88,10 @@ struct qse_sed_c_t
QSE_SED_C_CW, QSE_SED_C_CW,
QSE_SED_C_Y, QSE_SED_C_Y,
QSE_SED_C_X QSE_SED_C_X
} cmd; } type;
/* TODO: change the data type to a shorter one to save space */
int negfl;
}; };
struct qse_sed_l_t struct qse_sed_l_t