still coding rex1.c

This commit is contained in:
2009-11-20 23:12:27 +00:00
parent a6162f3eea
commit 1d5be1f982
45 changed files with 6140 additions and 12759 deletions

View File

@ -1,8 +1,9 @@
# Makefile.in generated by automake 1.10.2 from Makefile.am.
# Makefile.in generated by automake 1.11 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
# 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation,
# Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@ -17,6 +18,7 @@
VPATH = @srcdir@
pkgdatadir = $(datadir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
pkglibexecdir = $(libexecdir)/@PACKAGE@
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
@ -45,6 +47,7 @@ am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
mkinstalldirs = $(install_sh) -d
CONFIG_HEADER = $(top_builddir)/include/qse/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
SOURCES =
DIST_SOURCES =
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
@ -52,9 +55,23 @@ am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = `echo $$p | sed -e 's|^.*/||'`;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__installdirs = "$(DESTDIR)$(pkgincludedir)"
pkgincludeHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(pkginclude_HEADERS)
ETAGS = etags
CTAGS = ctags
@ -123,6 +140,7 @@ PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
QSE_SIZEOF_CHAR = @QSE_SIZEOF_CHAR@
@ -213,9 +231,9 @@ $(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
exit 1;; \
esac; \
done; \
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/qse/cmn/Makefile'; \
cd $(top_srcdir) && \
$(AUTOMAKE) --foreign include/qse/cmn/Makefile
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/qse/cmn/Makefile'; \
$(am__cd) $(top_srcdir) && \
$(AUTOMAKE) --foreign include/qse/cmn/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@ -233,6 +251,7 @@ $(top_srcdir)/configure: $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
@ -242,20 +261,23 @@ clean-libtool:
install-pkgincludeHEADERS: $(pkginclude_HEADERS)
@$(NORMAL_INSTALL)
test -z "$(pkgincludedir)" || $(MKDIR_P) "$(DESTDIR)$(pkgincludedir)"
@list='$(pkginclude_HEADERS)'; for p in $$list; do \
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
f=$(am__strip_dir) \
echo " $(pkgincludeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(pkgincludedir)/$$f'"; \
$(pkgincludeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(pkgincludedir)/$$f"; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(pkgincludedir)'"; \
$(INSTALL_HEADER) $$files "$(DESTDIR)$(pkgincludedir)" || exit $$?; \
done
uninstall-pkgincludeHEADERS:
@$(NORMAL_UNINSTALL)
@list='$(pkginclude_HEADERS)'; for p in $$list; do \
f=$(am__strip_dir) \
echo " rm -f '$(DESTDIR)$(pkgincludedir)/$$f'"; \
rm -f "$(DESTDIR)$(pkgincludedir)/$$f"; \
done
@list='$(pkginclude_HEADERS)'; test -n "$(pkgincludedir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
test -n "$$files" || exit 0; \
echo " ( cd '$(DESTDIR)$(pkgincludedir)' && rm -f" $$files ")"; \
cd "$(DESTDIR)$(pkgincludedir)" && rm -f $$files
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
@ -269,7 +291,7 @@ tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
set x; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
@ -277,29 +299,34 @@ TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
shift; \
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
test -n "$$unique" || unique=$$empty_fix; \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$tags $$unique; \
if test $$# -gt 0; then \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
"$$@" $$unique; \
else \
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
$$unique; \
fi; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
tags=; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
END { if (nonempty) { for (i in files) print i; }; }'`; \
test -z "$(CTAGS_ARGS)$$tags$$unique" \
test -z "$(CTAGS_ARGS)$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
$$tags $$unique
$$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
&& cd $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) $$here
&& $(am__cd) $(top_srcdir) \
&& gtags -i $(GTAGS_ARGS) "$$here"
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@ -320,13 +347,17 @@ distdir: $(DISTFILES)
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
if test -d $$d/$$file; then \
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
if test -d "$(distdir)/$$file"; then \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
fi; \
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
else \
test -f $(distdir)/$$file \
|| cp -p $$d/$$file $(distdir)/$$file \
test -f "$(distdir)/$$file" \
|| cp -p $$d/$$file "$(distdir)/$$file" \
|| exit 1; \
fi; \
done
@ -357,6 +388,7 @@ clean-generic:
distclean-generic:
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@ -375,6 +407,8 @@ dvi-am:
html: html-am
html-am:
info: info-am
info-am:
@ -383,18 +417,28 @@ install-data-am: install-pkgincludeHEADERS
install-dvi: install-dvi-am
install-dvi-am:
install-exec-am:
install-html: install-html-am
install-html-am:
install-info: install-info-am
install-info-am:
install-man:
install-pdf: install-pdf-am
install-pdf-am:
install-ps: install-ps-am
install-ps-am:
installcheck-am:
maintainer-clean: maintainer-clean-am
@ -434,6 +478,7 @@ uninstall-am: uninstall-pkgincludeHEADERS
#if ENABLE_CXX
#pkginclude_HEADERS +=
#endif
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:

View File

@ -1,5 +1,5 @@
/*
* $Id: rex.h 302 2009-11-18 13:47:12Z hyunghwan.chung $
* $Id: rex.h 304 2009-11-20 05:12:27Z hyunghwan.chung $
*
Copyright 2006-2009 Chung, Hyung-Hwan.
This file is part of QSE.
@ -56,7 +56,6 @@
*
* @todo
* - support \\n to refer to the nth matching substring
* - change to adopt Thomson's NFA (http://swtch.com/~rsc/regexp/regexp1.html)
*/
#define QSE_REX_NA(code) (*(qse_size_t*)(code))
@ -67,7 +66,14 @@
enum qse_rex_option_t
{
QSE_REX_BUILD_NOBOUND = (1 << 0),
QSE_REX_MATCH_IGNORECASE = (1 << 8)
QSE_REX_MATCH_IGNORECASE = (1 << 8),
/**< do not support the {n,m} style occurrence specifier */
QSE_REX_NOBOUND = (1 << 0),
/**< perform case-insensitive match */
QSE_REX_IGNORECASE = (1 << 8)
};
enum qse_rex_errnum_t
@ -89,32 +95,13 @@ enum qse_rex_errnum_t
};
typedef enum qse_rex_errnum_t qse_rex_errnum_t;
typedef struct qse_rex_t qse_rex_t;
#if 0
struct qse_rex_t
{
QSE_DEFINE_COMMON_FIELDS (rex)
qse_rex_errnum_t errnum;
int option;
struct
{
int build;
int match;
} depth;
void* code;
};
#endif
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_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 */
@ -127,7 +114,10 @@ typedef enum qse_rex_node_id_t qse_rex_node_id_t;
typedef struct qse_rex_node_t qse_rex_node_t;
struct qse_rex_node_t
{
qse_rex_node_t* link; /* for internal management. not used for startnode */
/* for internal management. not used for startnode */
qse_rex_node_t* link;
/* connect to the next node in the graph */
qse_rex_node_t* next;
qse_rex_node_id_t id;
@ -135,7 +125,7 @@ struct qse_rex_node_t
{
struct
{
qse_mmgr_t* mmgr;
qse_mmgr_t* mmgr;
qse_rex_node_t* link;
} s;
@ -166,6 +156,19 @@ struct qse_rex_node_t
} occ;
};
/**
* The qse_rex_t type defines a regular expression processor.
* You can compile a regular expression and match it againt a string.
*/
typedef struct qse_rex_t qse_rex_t;
struct qse_rex_t
{
QSE_DEFINE_COMMON_FIELDS (rex)
qse_rex_errnum_t errnum;
int option;
qse_rex_node_t* code;
};
#ifdef __cplusplus
extern "C" {
#endif
@ -173,15 +176,31 @@ extern "C" {
QSE_DEFINE_COMMON_FUNCTIONS (rex)
qse_rex_t* qse_rex_open (
qse_mmgr_t* mmgr,
qse_size_t xtn,
void* code
qse_mmgr_t* mmgr,
qse_size_t xtn,
qse_rex_node_t* code
);
void qse_rex_close (
qse_rex_t* rex
);
/**
* The qse_rex_getoption() function returns the current options.
*/
int qse_rex_getoption (
qse_rex_t* rex /**< regular expression processor */
);
/**
* The qse_rex_setoption() function overrides the current options with options.
*/
void qse_rex_setoption (
qse_rex_t* rex, /**< regular expression processor */
int opts /**< 0 or number XORed of ::qse_rex_option_t enumerators */
);
qse_rex_node_t* qse_rex_comp (
qse_rex_t* rex,
const qse_char_t* ptn,