diff --git a/qse/cmd/utl/tgp.c b/qse/cmd/utl/tgp.c index fa519107..955275da 100644 --- a/qse/cmd/utl/tgp.c +++ b/qse/cmd/utl/tgp.c @@ -171,7 +171,7 @@ int tgp_main (int argc, qse_char_t* argv[]) 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) { qse_fprintf (QSE_STDERR, diff --git a/qse/include/qse/utl/sed.h b/qse/include/qse/utl/sed.h index ec47cb86..b46324ff 100644 --- a/qse/include/qse/utl/sed.h +++ b/qse/include/qse/utl/sed.h @@ -22,6 +22,7 @@ #include #include #include +#include enum qse_sed_errnum_t { @@ -45,6 +46,9 @@ struct qse_sed_t void* lastrex; qse_str_t rexbuf; /* temporary regular expression buffer */ + + /* command array */ + qse_lda_t cmds; }; diff --git a/qse/lib/utl/sed.c b/qse/lib/utl/sed.c index 465ad7b2..30ab6b64 100644 --- a/qse/lib/utl/sed.c +++ b/qse/lib/utl/sed.c @@ -198,7 +198,12 @@ static const qse_char_t* command ( #if 0 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; case QSE_T('}'): diff --git a/qse/lib/utl/sed.h b/qse/lib/utl/sed.h index e0dd310a..f0936989 100644 --- a/qse/lib/utl/sed.h +++ b/qse/lib/utl/sed.h @@ -51,8 +51,8 @@ struct qse_sed_c_t union { - void* rex; /* regular expression */ - qse_char_t* text; /* added text or file name */ + void* rex; /* regular expression */ + qse_char_t* text; /* added text or file name */ qse_sed_c_t* lbl; /* destination command of branch */ } u; @@ -88,7 +88,10 @@ struct qse_sed_c_t QSE_SED_C_CW, QSE_SED_C_Y, 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