interim commit while implementing qse_rex_t

This commit is contained in:
hyung-hwan 2009-11-26 07:32:20 +00:00
parent 782fa151de
commit 09720f3460
10 changed files with 692 additions and 302 deletions

View File

@ -1,5 +1,5 @@
/*
* $Id: awk.h 306 2009-11-22 13:58:53Z hyunghwan.chung $
* $Id: awk.h 307 2009-11-25 13:32:20Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -786,18 +786,19 @@ enum qse_awk_errnum_t
QSE_AWK_EOFMTCHR, /**< invalid character in OFMT */
/* regular expression error */
QSE_AWK_EREXNOCOMP, /**< no regular expression compiled */
QSE_AWK_EREXRECUR, /**< recursion too deep */
QSE_AWK_EREXRPAREN, /**< a right parenthesis is expected */
QSE_AWK_EREXRBRACKET, /**< a right bracket is expected */
QSE_AWK_EREXRBRACK, /**< a right bracket is expected */
QSE_AWK_EREXRBRACE, /**< a right brace is expected */
QSE_AWK_EREXUNBALPAREN,/**< unbalanced parenthesis */
QSE_AWK_EREXINVALBRACE,/**< invalid brace */
QSE_AWK_EREXCOLON, /**< a colon is expected */
QSE_AWK_EREXCRANGE, /**< invalid character range */
QSE_AWK_EREXCCLASS, /**< invalid character class */
QSE_AWK_EREXBOUND, /**< invalid boundary range */
QSE_AWK_EREXEND, /**< unexpected end of the pattern */
QSE_AWK_EREXGARBAGE, /**< garbage after the pattern */
QSE_AWK_EREXBOUND, /**< invalid occurrence bound */
QSE_AWK_EREXPREEND, /**< premature end of regular expression */
QSE_AWK_EREXGARBAGE, /**< garbage after pattern */
/* the number of error numbers, internal use only */
QSE_AWK_NUMERRNUM

View File

@ -1,5 +1,5 @@
/*
* $Id: rex.h 306 2009-11-22 13:58:53Z hyunghwan.chung $
* $Id: rex.h 307 2009-11-25 13:32:20Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -23,6 +23,7 @@
#include <qse/types.h>
#include <qse/macros.h>
#include <qse/cmn/str.h>
/** @file
*
@ -72,9 +73,11 @@ enum qse_rex_option_t
/**< do not support the {n,m} style occurrence specifier */
QSE_REX_NOBOUND = (1 << 0),
#if 0
QSE_REX_ESQ_HEX = (1 << 1), /* \xhh and \uhhhh */
QSE_REX_ESQ_OCTAL = (1 << 2), /* \000 */
QSE_REX_ESQ_CNTRL = (1 << 3), /* \cX where X is A to Z */
#endif
/**< perform case-insensitive match */
QSE_REX_IGNORECASE = (1 << 8)
@ -83,19 +86,20 @@ enum qse_rex_option_t
enum qse_rex_errnum_t
{
QSE_REX_ENOERR = 0,
QSE_REX_ENOMEM, /* no sufficient memory available */
QSE_REX_ERECUR, /* recursion too deep */
QSE_REX_ERPAREN, /* a right parenthesis is expected */
QSE_REX_ERBRACKET, /* a right bracket is expected */
QSE_REX_ERBRACE, /* a right brace is expected */
QSE_REX_EUNBALPAREN, /* unbalanced parenthesis */
QSE_REX_EINVALBRACE, /* invalid brace */
QSE_REX_ECOLON, /* a colon is expected */
QSE_REX_ECRANGE, /* invalid character range */
QSE_REX_ECCLASS, /* invalid character class */
QSE_REX_EBOUND, /* invalid boundary range */
QSE_REX_EEND, /* unexpected end of the pattern */
QSE_REX_EGARBAGE /* garbage after the pattern */
QSE_REX_ENOMEM, /**< no sufficient memory available */
QSE_REX_ENOCOMP, /**< no expression compiled */
QSE_REX_ERECUR, /**< recursion too deep */
QSE_REX_ERPAREN, /**< right parenthesis expected */
QSE_REX_ERBRACK, /**< right bracket expected */
QSE_REX_ERBRACE, /**< right brace expected */
QSE_REX_EUNBALPAREN, /**< unbalanced parenthesis */
QSE_REX_EINVALBRACE, /**< invalid brace */
QSE_REX_ECOLON, /**< colon expected */
QSE_REX_ECRANGE, /**< invalid character range */
QSE_REX_ECCLASS, /**< invalid character class */
QSE_REX_EBOUND, /**< invalid occurrence bound */
QSE_REX_EPREEND, /**< premature expression end */
QSE_REX_EGARBAGE /**< garbage after expression */
};
typedef enum qse_rex_errnum_t qse_rex_errnum_t;
@ -104,11 +108,11 @@ enum qse_rex_node_id_t
QSE_REX_NODE_START,
QSE_REX_NODE_END,
QSE_REX_NODE_NOP,
QSE_REX_NODE_BOL, /* beginning of line */
QSE_REX_NODE_EOL, /* end of line */
QSE_REX_NODE_ANYCHAR, /* dot */
QSE_REX_NODE_CHAR, /* single character */
QSE_REX_NODE_CHARSET, /* character set */
QSE_REX_NODE_BOL, /* beginning of line */
QSE_REX_NODE_EOL, /* end of line */
QSE_REX_NODE_ANY, /* dot */
QSE_REX_NODE_CHAR, /* single character */
QSE_REX_NODE_CSET, /* character set */
QSE_REX_NODE_BRANCH,
QSE_REX_NODE_GROUP,
QSE_REX_NODE_GROUPEND
@ -134,7 +138,12 @@ struct qse_rex_node_t
} s;
qse_char_t c;
qse_char_t* cs; /* charset */
struct
{
int negated;
qse_str_t* member;
} cset;
struct
{
@ -160,6 +169,13 @@ struct qse_rex_node_t
} occ;
};
enum qse_rex_cset_code_t
{
QSE_REX_CSET_CHAR,
QSE_REX_CSET_RANGE,
QSE_REX_CSET_CLASS
};
/**
* The qse_rex_t type defines a regular expression processor.
* You can compile a regular expression and match it againt a string.
@ -170,7 +186,7 @@ struct qse_rex_t
QSE_DEFINE_COMMON_FIELDS (rex)
qse_rex_errnum_t errnum;
int option;
qse_rex_node_t* code;
qse_rex_node_t* code;
};
#ifdef __cplusplus
@ -205,6 +221,14 @@ void qse_rex_setoption (
int opts /**< 0 or number XORed of ::qse_rex_option_t enumerators */
);
qse_rex_errnum_t qse_rex_geterrnum (
qse_rex_t* rex
);
const qse_char_t* qse_rex_geterrmsg (
qse_rex_t* rex
);
qse_rex_node_t* qse_rex_comp (
qse_rex_t* rex,
const qse_char_t* ptn,

View File

@ -1,5 +1,5 @@
/*
* $Id: err.c 287 2009-09-15 10:01:02Z hyunghwan.chung $
* $Id: err.c 307 2009-11-25 13:32:20Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -138,18 +138,19 @@ const qse_char_t* qse_awk_dflerrstr (qse_awk_t* awk, qse_awk_errnum_t errnum)
QSE_T("invalid character in CONVFMT"),
QSE_T("invalid character in OFMT"),
QSE_T("recursion too deep in the regular expression"),
QSE_T("a right parenthesis expected in the regular expression"),
QSE_T("a right bracket expected in the regular expression"),
QSE_T("a right brace expected in the regular expression"),
QSE_T("unbalanced parenthesis in the regular expression"),
QSE_T("invalid brace in the regular expression"),
QSE_T("a colon expected in the regular expression"),
QSE_T("invalid character range in the regular expression"),
QSE_T("invalid character class in the regular expression"),
QSE_T("invalid boundary range in the regular expression"),
QSE_T("unexpected end of the regular expression"),
QSE_T("garbage after the regular expression")
QSE_T("no regular expression compiled"),
QSE_T("recursion too deep in regular expression"),
QSE_T("right parenthesis expected in regular expression"),
QSE_T("right bracket expected in regular expression"),
QSE_T("right brace expected in regular expression"),
QSE_T("unbalanced parenthesis in regular expression"),
QSE_T("invalid brace in regular expression"),
QSE_T("colon expected in regular expression"),
QSE_T("invalid character range in regular expression"),
QSE_T("invalid character class in regular expression"),
QSE_T("invalid occurrence bound in regular expression"),
QSE_T("premature end of regular expression"),
QSE_T("garbage after regular expression")
};
return (errnum >= 0 && errnum < QSE_COUNTOF(errstr))?

View File

@ -1,5 +1,5 @@
/*
* $Id: misc.c 306 2009-11-22 13:58:53Z hyunghwan.chung $
* $Id: misc.c 307 2009-11-25 13:32:20Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -1030,9 +1030,10 @@ qse_char_t* qse_awk_rtx_strxnfld (
#define QSE_AWK_REXERRTOERR(err) \
((err == QSE_REX_ENOERR)? QSE_AWK_ENOERR: \
(err == QSE_REX_ENOMEM)? QSE_AWK_ENOMEM: \
(err == QSE_REX_ENOCOMP)? QSE_AWK_EREXNOCOMP: \
(err == QSE_REX_ERECUR)? QSE_AWK_EREXRECUR: \
(err == QSE_REX_ERPAREN)? QSE_AWK_EREXRPAREN: \
(err == QSE_REX_ERBRACKET)? QSE_AWK_EREXRBRACKET: \
(err == QSE_REX_ERBRACK)? QSE_AWK_EREXRBRACK: \
(err == QSE_REX_ERBRACE)? QSE_AWK_EREXRBRACE: \
(err == QSE_REX_EUNBALPAREN)? QSE_AWK_EREXUNBALPAREN: \
(err == QSE_REX_EINVALBRACE)? QSE_AWK_EREXINVALBRACE: \
@ -1040,7 +1041,7 @@ qse_char_t* qse_awk_rtx_strxnfld (
(err == QSE_REX_ECRANGE)? QSE_AWK_EREXCRANGE: \
(err == QSE_REX_ECCLASS)? QSE_AWK_EREXCCLASS: \
(err == QSE_REX_EBOUND)? QSE_AWK_EREXBOUND: \
(err == QSE_REX_EEND)? QSE_AWK_EREXEND: \
(err == QSE_REX_EPREEND)? QSE_AWK_EREXPREEND: \
(err == QSE_REX_EGARBAGE)? QSE_AWK_EREXGARBAGE: \
QSE_AWK_EINTERN)

View File

@ -1,5 +1,5 @@
/*
* $Id: rex.c 306 2009-11-22 13:58:53Z hyunghwan.chung $
* $Id: rex.c 307 2009-11-25 13:32:20Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -206,9 +206,6 @@ static int build_atom_occ_range (builder_t* rex, atom_t* cmd);
static int next_char (builder_t* rex, int level);
static int add_code (builder_t* rex, void* data, qse_size_t len);
static qse_bool_t __begin_with (
const qse_char_t* str, qse_size_t len, const qse_char_t* what);
static const qse_byte_t* match_pattern (
matcher_t* matcher, const qse_byte_t* base, match_t* mat);
static const qse_byte_t* match_branch (
@ -677,7 +674,7 @@ static int build_atom (builder_t* builder)
if (builder->ptn.curc.type != CT_SPECIAL ||
builder->ptn.curc.value != QSE_T(']'))
{
builder->errnum = QSE_REX_ERBRACKET;
builder->errnum = QSE_REX_ERBRACK;
return -1;
}
@ -819,7 +816,7 @@ static int build_atom_cclass (builder_t* builder, qse_char_t* cc)
while (ccp->name != QSE_NULL)
{
if (__begin_with (builder->ptn.curp, len, ccp->name)) break;
if (qse_strxbeg (builder->ptn.curp, len, ccp->name) != QSE_NULL) break;
ccp++;
}
@ -855,7 +852,7 @@ static int build_atom_cclass (builder_t* builder, qse_char_t* cc)
#ifdef DEBUG_REX
DPUTS (QSE_T("build_atom_cclass: ] expected\n"));
#endif
builder->errnum = QSE_REX_ERBRACKET;
builder->errnum = QSE_REX_ERBRACK;
return -1;
}
@ -973,7 +970,7 @@ what if it is not in the raight format? convert it to ordinary characters?? */
do { \
if (builder->ptn.curp >= builder->ptn.end) \
{ \
builder->errnum = QSE_REX_EEND; \
builder->errnum = QSE_REX_EPREEND; \
return -1; \
} \
} while(0)
@ -1192,23 +1189,6 @@ static int add_code (builder_t* builder, void* data, qse_size_t len)
return 0;
}
static qse_bool_t __begin_with (
const qse_char_t* str, qse_size_t len, const qse_char_t* what)
{
const qse_char_t* end = str + len;
while (str < end)
{
if (*what == QSE_T('\0')) return QSE_TRUE;
if (*what != *str) return QSE_FALSE;
str++; what++;
}
if (*what == QSE_T('\0')) return QSE_TRUE;
return QSE_FALSE;
}
static const qse_byte_t* match_pattern (
matcher_t* matcher, const qse_byte_t* base, match_t* mat)
{

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
AM_CPPFLAGS = -I$(top_srcdir)/include -DNDEBUG
bin_PROGRAMS = chr str sll map lda fio pio sio time rex
bin_PROGRAMS = chr str sll map lda fio pio sio time rex01
LDFLAGS = -L../../lib/cmn
LDADD = -lqsecmn
@ -14,9 +14,13 @@ fio_SOURCES = fio.c
pio_SOURCES = pio.c
sio_SOURCES = sio.c
time_SOURCES = time.c
rex01_SOURCES = rex01.c
rex_SOURCES = rex.cpp
rex_CXXFLAGS = -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread
if ENABLE_CXX
#rex_LDFLAGS = -pthread -Wl,-Bsymbolic-functions -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
rex_LDFLAGS = -pthread -Wl,-Bsymbolic-functions -lwx_gtk2ud_richtext-2.8 -lwx_gtk2ud_aui-2.8 -lwx_gtk2ud_xrc-2.8 -lwx_gtk2ud_qa-2.8 -lwx_gtk2ud_html-2.8 -lwx_gtk2ud_adv-2.8 -lwx_gtk2ud_core-2.8 -lwx_baseud_xml-2.8 -lwx_baseud_net-2.8 -lwx_baseud-2.8
bin_PROGRAMS += rex02
rex02_SOURCES = rex02.cpp
rex02_CXXFLAGS = -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread
rex02_LDFLAGS = -pthread -Wl,-Bsymbolic-functions -lwx_gtk2ud_richtext-2.8 -lwx_gtk2ud_aui-2.8 -lwx_gtk2ud_xrc-2.8 -lwx_gtk2ud_qa-2.8 -lwx_gtk2ud_html-2.8 -lwx_gtk2ud_adv-2.8 -lwx_gtk2ud_core-2.8 -lwx_baseud_xml-2.8 -lwx_baseud_net-2.8 -lwx_baseud-2.8
endif

View File

@ -36,7 +36,8 @@ build_triplet = @build@
host_triplet = @host@
bin_PROGRAMS = chr$(EXEEXT) str$(EXEEXT) sll$(EXEEXT) map$(EXEEXT) \
lda$(EXEEXT) fio$(EXEEXT) pio$(EXEEXT) sio$(EXEEXT) \
time$(EXEEXT) rex$(EXEEXT)
time$(EXEEXT) rex01$(EXEEXT) $(am__EXEEXT_1)
@ENABLE_CXX_TRUE@am__append_1 = rex02
subdir = samples/cmn
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
@ -51,6 +52,7 @@ mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
@ENABLE_CXX_TRUE@am__EXEEXT_1 = rex02$(EXEEXT)
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_chr_OBJECTS = chr.$(OBJEXT)
@ -73,13 +75,18 @@ am_pio_OBJECTS = pio.$(OBJEXT)
pio_OBJECTS = $(am_pio_OBJECTS)
pio_LDADD = $(LDADD)
pio_DEPENDENCIES =
am_rex_OBJECTS = rex-rex.$(OBJEXT)
rex_OBJECTS = $(am_rex_OBJECTS)
rex_LDADD = $(LDADD)
rex_DEPENDENCIES =
rex_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(rex_CXXFLAGS) $(CXXFLAGS) \
$(rex_LDFLAGS) $(LDFLAGS) -o $@
am_rex01_OBJECTS = rex01.$(OBJEXT)
rex01_OBJECTS = $(am_rex01_OBJECTS)
rex01_LDADD = $(LDADD)
rex01_DEPENDENCIES =
am__rex02_SOURCES_DIST = rex02.cpp
@ENABLE_CXX_TRUE@am_rex02_OBJECTS = rex02-rex02.$(OBJEXT)
rex02_OBJECTS = $(am_rex02_OBJECTS)
rex02_LDADD = $(LDADD)
rex02_DEPENDENCIES =
rex02_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(rex02_CXXFLAGS) $(CXXFLAGS) \
$(rex02_LDFLAGS) $(LDFLAGS) -o $@
am_sio_OBJECTS = sio.$(OBJEXT)
sio_OBJECTS = $(am_sio_OBJECTS)
sio_LDADD = $(LDADD)
@ -119,11 +126,12 @@ CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
$(LDFLAGS) -o $@
SOURCES = $(chr_SOURCES) $(fio_SOURCES) $(lda_SOURCES) $(map_SOURCES) \
$(pio_SOURCES) $(rex_SOURCES) $(sio_SOURCES) $(sll_SOURCES) \
$(str_SOURCES) $(time_SOURCES)
$(pio_SOURCES) $(rex01_SOURCES) $(rex02_SOURCES) \
$(sio_SOURCES) $(sll_SOURCES) $(str_SOURCES) $(time_SOURCES)
DIST_SOURCES = $(chr_SOURCES) $(fio_SOURCES) $(lda_SOURCES) \
$(map_SOURCES) $(pio_SOURCES) $(rex_SOURCES) $(sio_SOURCES) \
$(sll_SOURCES) $(str_SOURCES) $(time_SOURCES)
$(map_SOURCES) $(pio_SOURCES) $(rex01_SOURCES) \
$(am__rex02_SOURCES_DIST) $(sio_SOURCES) $(sll_SOURCES) \
$(str_SOURCES) $(time_SOURCES)
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@ -275,11 +283,10 @@ fio_SOURCES = fio.c
pio_SOURCES = pio.c
sio_SOURCES = sio.c
time_SOURCES = time.c
rex_SOURCES = rex.cpp
rex_CXXFLAGS = -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread
#rex_LDFLAGS = -pthread -Wl,-Bsymbolic-functions -lwx_gtk2u_richtext-2.8 -lwx_gtk2u_aui-2.8 -lwx_gtk2u_xrc-2.8 -lwx_gtk2u_qa-2.8 -lwx_gtk2u_html-2.8 -lwx_gtk2u_adv-2.8 -lwx_gtk2u_core-2.8 -lwx_baseu_xml-2.8 -lwx_baseu_net-2.8 -lwx_baseu-2.8
rex_LDFLAGS = -pthread -Wl,-Bsymbolic-functions -lwx_gtk2ud_richtext-2.8 -lwx_gtk2ud_aui-2.8 -lwx_gtk2ud_xrc-2.8 -lwx_gtk2ud_qa-2.8 -lwx_gtk2ud_html-2.8 -lwx_gtk2ud_adv-2.8 -lwx_gtk2ud_core-2.8 -lwx_baseud_xml-2.8 -lwx_baseud_net-2.8 -lwx_baseud-2.8
rex01_SOURCES = rex01.c
@ENABLE_CXX_TRUE@rex02_SOURCES = rex02.cpp
@ENABLE_CXX_TRUE@rex02_CXXFLAGS = -I/usr/lib/wx/include/gtk2-unicode-release-2.8 -I/usr/include/wx-2.8 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES -D__WXGTK__ -pthread
@ENABLE_CXX_TRUE@rex02_LDFLAGS = -pthread -Wl,-Bsymbolic-functions -lwx_gtk2ud_richtext-2.8 -lwx_gtk2ud_aui-2.8 -lwx_gtk2ud_xrc-2.8 -lwx_gtk2ud_qa-2.8 -lwx_gtk2ud_html-2.8 -lwx_gtk2ud_adv-2.8 -lwx_gtk2ud_core-2.8 -lwx_baseud_xml-2.8 -lwx_baseud_net-2.8 -lwx_baseud-2.8
all: all-am
.SUFFIXES:
@ -372,9 +379,12 @@ map$(EXEEXT): $(map_OBJECTS) $(map_DEPENDENCIES)
pio$(EXEEXT): $(pio_OBJECTS) $(pio_DEPENDENCIES)
@rm -f pio$(EXEEXT)
$(LINK) $(pio_OBJECTS) $(pio_LDADD) $(LIBS)
rex$(EXEEXT): $(rex_OBJECTS) $(rex_DEPENDENCIES)
@rm -f rex$(EXEEXT)
$(rex_LINK) $(rex_OBJECTS) $(rex_LDADD) $(LIBS)
rex01$(EXEEXT): $(rex01_OBJECTS) $(rex01_DEPENDENCIES)
@rm -f rex01$(EXEEXT)
$(LINK) $(rex01_OBJECTS) $(rex01_LDADD) $(LIBS)
rex02$(EXEEXT): $(rex02_OBJECTS) $(rex02_DEPENDENCIES)
@rm -f rex02$(EXEEXT)
$(rex02_LINK) $(rex02_OBJECTS) $(rex02_LDADD) $(LIBS)
sio$(EXEEXT): $(sio_OBJECTS) $(sio_DEPENDENCIES)
@rm -f sio$(EXEEXT)
$(LINK) $(sio_OBJECTS) $(sio_LDADD) $(LIBS)
@ -399,7 +409,8 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lda.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/map.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/pio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rex-rex.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rex01.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/rex02-rex02.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sio.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sll.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/str.Po@am__quote@
@ -447,19 +458,19 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -c -o $@ $<
rex-rex.o: rex.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rex_CXXFLAGS) $(CXXFLAGS) -MT rex-rex.o -MD -MP -MF $(DEPDIR)/rex-rex.Tpo -c -o rex-rex.o `test -f 'rex.cpp' || echo '$(srcdir)/'`rex.cpp
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/rex-rex.Tpo $(DEPDIR)/rex-rex.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='rex.cpp' object='rex-rex.o' libtool=no @AMDEPBACKSLASH@
rex02-rex02.o: rex02.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rex02_CXXFLAGS) $(CXXFLAGS) -MT rex02-rex02.o -MD -MP -MF $(DEPDIR)/rex02-rex02.Tpo -c -o rex02-rex02.o `test -f 'rex02.cpp' || echo '$(srcdir)/'`rex02.cpp
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/rex02-rex02.Tpo $(DEPDIR)/rex02-rex02.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='rex02.cpp' object='rex02-rex02.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rex_CXXFLAGS) $(CXXFLAGS) -c -o rex-rex.o `test -f 'rex.cpp' || echo '$(srcdir)/'`rex.cpp
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rex02_CXXFLAGS) $(CXXFLAGS) -c -o rex02-rex02.o `test -f 'rex02.cpp' || echo '$(srcdir)/'`rex02.cpp
rex-rex.obj: rex.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rex_CXXFLAGS) $(CXXFLAGS) -MT rex-rex.obj -MD -MP -MF $(DEPDIR)/rex-rex.Tpo -c -o rex-rex.obj `if test -f 'rex.cpp'; then $(CYGPATH_W) 'rex.cpp'; else $(CYGPATH_W) '$(srcdir)/rex.cpp'; fi`
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/rex-rex.Tpo $(DEPDIR)/rex-rex.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='rex.cpp' object='rex-rex.obj' libtool=no @AMDEPBACKSLASH@
rex02-rex02.obj: rex02.cpp
@am__fastdepCXX_TRUE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rex02_CXXFLAGS) $(CXXFLAGS) -MT rex02-rex02.obj -MD -MP -MF $(DEPDIR)/rex02-rex02.Tpo -c -o rex02-rex02.obj `if test -f 'rex02.cpp'; then $(CYGPATH_W) 'rex02.cpp'; else $(CYGPATH_W) '$(srcdir)/rex02.cpp'; fi`
@am__fastdepCXX_TRUE@ $(am__mv) $(DEPDIR)/rex02-rex02.Tpo $(DEPDIR)/rex02-rex02.Po
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='rex02.cpp' object='rex02-rex02.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rex_CXXFLAGS) $(CXXFLAGS) -c -o rex-rex.obj `if test -f 'rex.cpp'; then $(CYGPATH_W) 'rex.cpp'; else $(CYGPATH_W) '$(srcdir)/rex.cpp'; fi`
@am__fastdepCXX_FALSE@ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(rex02_CXXFLAGS) $(CXXFLAGS) -c -o rex02-rex02.obj `if test -f 'rex02.cpp'; then $(CYGPATH_W) 'rex02.cpp'; else $(CYGPATH_W) '$(srcdir)/rex02.cpp'; fi`
mostlyclean-libtool:
-rm -f *.lo

46
qse/samples/cmn/rex01.c Normal file
View File

@ -0,0 +1,46 @@
#include <qse/cmn/rex.h>
#include <qse/cmn/str.h>
#include <qse/cmn/main.h>
#include <qse/cmn/stdio.h>
static int rex_main (int argc, qse_char_t* argv[])
{
qse_rex_t* rex;
qse_rex_node_t* start;
rex = qse_rex_open (QSE_NULL, 0, QSE_NULL);
if (rex == QSE_NULL)
{
qse_printf (QSE_T("ERROR: cannot open rex\n"));
return -1;
}
start = qse_rex_comp (rex, argv[1], qse_strlen(argv[1]));
if (start == QSE_NULL)
{
qse_printf (QSE_T("ERROR: cannot compile - %s\n"),
qse_rex_geterrmsg(rex));
qse_rex_close (rex);
return -1;
}
if (qse_rex_exec (rex,
argv[2], qse_strlen(argv[2]),
argv[2], qse_strlen(argv[2])) <= -1)
{
qse_printf (QSE_T("ERROR: cannot execute - %s\n"),
qse_rex_geterrmsg(rex));
qse_rex_close (rex);
return -1;
}
qse_rex_close (rex);
return 0;
}
int qse_main (int argc, qse_achar_t* argv[])
{
return qse_runmain (argc, argv, rex_main);
}