summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
Diffstat (limited to 'sample')
-rw-r--r--sample/.gitignore10
-rw-r--r--sample/CMakeLists.txt28
-rw-r--r--sample/Makefile.am35
-rw-r--r--sample/Makefile.in560
-rw-r--r--sample/encode.c10
-rw-r--r--sample/listcap.c3
-rw-r--r--sample/names.c3
-rw-r--r--sample/posix.c3
-rw-r--r--sample/simple.c3
-rw-r--r--sample/sql.c3
-rw-r--r--sample/syntax.c4
-rw-r--r--sample/user_property.c87
12 files changed, 174 insertions, 575 deletions
diff --git a/sample/.gitignore b/sample/.gitignore
new file mode 100644
index 0000000..963d2e4
--- /dev/null
+++ b/sample/.gitignore
@@ -0,0 +1,10 @@
+/crnl
+/encode
+/listcap
+/names
+/posix
+/simple
+/sql
+/syntax
+/user_property
+/log*
diff --git a/sample/CMakeLists.txt b/sample/CMakeLists.txt
new file mode 100644
index 0000000..de25ee7
--- /dev/null
+++ b/sample/CMakeLists.txt
@@ -0,0 +1,28 @@
+
+cmake_minimum_required(VERSION 2.8)
+project(oniguruma_sample C)
+
+add_executable(crnl crnl.c)
+target_link_libraries(crnl onig)
+
+add_executable(encode encode.c)
+target_link_libraries(encode onig)
+
+add_executable(listcap listcap.c)
+target_link_libraries(listcap onig)
+
+add_executable(names names.c)
+target_link_libraries(names onig)
+
+add_executable(posix posix.c)
+target_link_libraries(posix onig)
+
+add_executable(simple simple.c)
+target_link_libraries(simple onig)
+
+add_executable(sql sql.c)
+target_link_libraries(sql onig)
+
+add_executable(syntax syntax.c)
+target_link_libraries(syntax onig)
+
diff --git a/sample/Makefile.am b/sample/Makefile.am
index af33057..53f0d08 100644
--- a/sample/Makefile.am
+++ b/sample/Makefile.am
@@ -1,8 +1,14 @@
-noinst_PROGRAMS = encode listcap names posix simple sql syntax crnl
+#noinst_PROGRAMS = encode listcap names posix simple sql syntax crnl
-libname = $(top_builddir)/libonig.la
-LDADD = $(libname)
-INCLUDES = -I$(top_srcdir) -I$(includedir)
+lib_onig = ../src/libonig.la
+LDADD = $(lib_onig)
+
+AM_LDFLAGS = -L$(prefix)/lib
+AM_CPPFLAGS = -I../src -I$(includedir)
+
+TESTS = encode listcap names posix simple sql syntax user_property
+
+check_PROGRAMS = encode listcap names posix simple sql syntax user_property
encode_SOURCES = encode.c
listcap_SOURCES = listcap.c
@@ -11,15 +17,16 @@ posix_SOURCES = posix.c
simple_SOURCES = simple.c
sql_SOURCES = sql.c
syntax_SOURCES = syntax.c
+user_property_SOURCES = user_property.c
+sampledir = .
-sampledir = $(top_builddir)/sample
-
-test: encode listcap names posix simple sql syntax
- @$(sampledir)/encode
- @$(sampledir)/listcap
- @$(sampledir)/names
- @$(sampledir)/posix
- @$(sampledir)/simple
- @$(sampledir)/sql
- @$(sampledir)/syntax
+test: encode listcap names posix simple sql syntax user_property
+ $(sampledir)/encode
+ $(sampledir)/listcap
+ $(sampledir)/names
+ $(sampledir)/posix
+ $(sampledir)/simple
+ $(sampledir)/sql
+ $(sampledir)/syntax
+ $(sampledir)/user_property
diff --git a/sample/Makefile.in b/sample/Makefile.in
deleted file mode 100644
index b780699..0000000
--- a/sample/Makefile.in
+++ /dev/null
@@ -1,560 +0,0 @@
-# Makefile.in generated by automake 1.11.3 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-VPATH = @srcdir@
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@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
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-noinst_PROGRAMS = encode$(EXEEXT) listcap$(EXEEXT) names$(EXEEXT) \
- posix$(EXEEXT) simple$(EXEEXT) sql$(EXEEXT) syntax$(EXEEXT) \
- crnl$(EXEEXT)
-subdir = sample
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/libtool.m4 \
- $(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
- $(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
- $(top_srcdir)/configure.in
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-PROGRAMS = $(noinst_PROGRAMS)
-crnl_SOURCES = crnl.c
-crnl_OBJECTS = crnl.$(OBJEXT)
-crnl_LDADD = $(LDADD)
-crnl_DEPENDENCIES = $(libname)
-am_encode_OBJECTS = encode.$(OBJEXT)
-encode_OBJECTS = $(am_encode_OBJECTS)
-encode_LDADD = $(LDADD)
-encode_DEPENDENCIES = $(libname)
-am_listcap_OBJECTS = listcap.$(OBJEXT)
-listcap_OBJECTS = $(am_listcap_OBJECTS)
-listcap_LDADD = $(LDADD)
-listcap_DEPENDENCIES = $(libname)
-am_names_OBJECTS = names.$(OBJEXT)
-names_OBJECTS = $(am_names_OBJECTS)
-names_LDADD = $(LDADD)
-names_DEPENDENCIES = $(libname)
-am_posix_OBJECTS = posix.$(OBJEXT)
-posix_OBJECTS = $(am_posix_OBJECTS)
-posix_LDADD = $(LDADD)
-posix_DEPENDENCIES = $(libname)
-am_simple_OBJECTS = simple.$(OBJEXT)
-simple_OBJECTS = $(am_simple_OBJECTS)
-simple_LDADD = $(LDADD)
-simple_DEPENDENCIES = $(libname)
-am_sql_OBJECTS = sql.$(OBJEXT)
-sql_OBJECTS = $(am_sql_OBJECTS)
-sql_LDADD = $(LDADD)
-sql_DEPENDENCIES = $(libname)
-am_syntax_OBJECTS = syntax.$(OBJEXT)
-syntax_OBJECTS = $(am_syntax_OBJECTS)
-syntax_LDADD = $(LDADD)
-syntax_DEPENDENCIES = $(libname)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp = $(SHELL) $(top_srcdir)/depcomp
-am__depfiles_maybe = depfiles
-am__mv = mv -f
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = crnl.c $(encode_SOURCES) $(listcap_SOURCES) $(names_SOURCES) \
- $(posix_SOURCES) $(simple_SOURCES) $(sql_SOURCES) \
- $(syntax_SOURCES)
-DIST_SOURCES = crnl.c $(encode_SOURCES) $(listcap_SOURCES) \
- $(names_SOURCES) $(posix_SOURCES) $(simple_SOURCES) \
- $(sql_SOURCES) $(syntax_SOURCES)
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ACLOCAL = @ACLOCAL@
-ALLOCA = @ALLOCA@
-AMTAR = @AMTAR@
-AR = @AR@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CC = @CC@
-CCDEPMODE = @CCDEPMODE@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFS = @DEFS@
-DEPDIR = @DEPDIR@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-FGREP = @FGREP@
-GREP = @GREP@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LIBOBJS = @LIBOBJS@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-LTVERSION = @LTVERSION@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-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@
-RANLIB = @RANLIB@
-RUBYDIR = @RUBYDIR@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-STATISTICS = @STATISTICS@
-STRIP = @STRIP@
-VERSION = @VERSION@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__include = @am__include@
-am__leading_dot = @am__leading_dot@
-am__quote = @am__quote@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-libname = $(top_builddir)/libonig.la
-LDADD = $(libname)
-INCLUDES = -I$(top_srcdir) -I$(includedir)
-encode_SOURCES = encode.c
-listcap_SOURCES = listcap.c
-names_SOURCES = names.c
-posix_SOURCES = posix.c
-simple_SOURCES = simple.c
-sql_SOURCES = sql.c
-syntax_SOURCES = syntax.c
-sampledir = $(top_builddir)/sample
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign sample/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --foreign sample/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(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):
-
-clean-noinstPROGRAMS:
- @list='$(noinst_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
-crnl$(EXEEXT): $(crnl_OBJECTS) $(crnl_DEPENDENCIES) $(EXTRA_crnl_DEPENDENCIES)
- @rm -f crnl$(EXEEXT)
- $(LINK) $(crnl_OBJECTS) $(crnl_LDADD) $(LIBS)
-encode$(EXEEXT): $(encode_OBJECTS) $(encode_DEPENDENCIES) $(EXTRA_encode_DEPENDENCIES)
- @rm -f encode$(EXEEXT)
- $(LINK) $(encode_OBJECTS) $(encode_LDADD) $(LIBS)
-listcap$(EXEEXT): $(listcap_OBJECTS) $(listcap_DEPENDENCIES) $(EXTRA_listcap_DEPENDENCIES)
- @rm -f listcap$(EXEEXT)
- $(LINK) $(listcap_OBJECTS) $(listcap_LDADD) $(LIBS)
-names$(EXEEXT): $(names_OBJECTS) $(names_DEPENDENCIES) $(EXTRA_names_DEPENDENCIES)
- @rm -f names$(EXEEXT)
- $(LINK) $(names_OBJECTS) $(names_LDADD) $(LIBS)
-posix$(EXEEXT): $(posix_OBJECTS) $(posix_DEPENDENCIES) $(EXTRA_posix_DEPENDENCIES)
- @rm -f posix$(EXEEXT)
- $(LINK) $(posix_OBJECTS) $(posix_LDADD) $(LIBS)
-simple$(EXEEXT): $(simple_OBJECTS) $(simple_DEPENDENCIES) $(EXTRA_simple_DEPENDENCIES)
- @rm -f simple$(EXEEXT)
- $(LINK) $(simple_OBJECTS) $(simple_LDADD) $(LIBS)
-sql$(EXEEXT): $(sql_OBJECTS) $(sql_DEPENDENCIES) $(EXTRA_sql_DEPENDENCIES)
- @rm -f sql$(EXEEXT)
- $(LINK) $(sql_OBJECTS) $(sql_LDADD) $(LIBS)
-syntax$(EXEEXT): $(syntax_OBJECTS) $(syntax_DEPENDENCIES) $(EXTRA_syntax_DEPENDENCIES)
- @rm -f syntax$(EXEEXT)
- $(LINK) $(syntax_OBJECTS) $(syntax_LDADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/crnl.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/encode.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listcap.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/names.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/posix.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/simple.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sql.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/syntax.Po@am__quote@
-
-.c.o:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c $<
-
-.c.obj:
-@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'`
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
-@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
-@am__fastdepCC_TRUE@ $(am__mv) $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
-@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
-@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- 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; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- set x; \
- here=`pwd`; \
- 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; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- 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)
- 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)$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- 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 "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- 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" \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile $(PROGRAMS)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
-mostlyclean-generic:
-
-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"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstPROGRAMS \
- mostlyclean-am
-
-distclean: distclean-am
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-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
- -rm -rf ./$(DEPDIR)
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-noinstPROGRAMS ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
-
-
-test: encode listcap names posix simple sql syntax
- @$(sampledir)/encode
- @$(sampledir)/listcap
- @$(sampledir)/names
- @$(sampledir)/posix
- @$(sampledir)/simple
- @$(sampledir)/sql
- @$(sampledir)/syntax
-
-# 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:
diff --git a/sample/encode.c b/sample/encode.c
index 3fbd03d..1daafa9 100644
--- a/sample/encode.c
+++ b/sample/encode.c
@@ -52,6 +52,8 @@ exec(OnigEncoding enc, OnigOptionType options,
UChar* pattern = (UChar* )apattern;
UChar* str = (UChar* )astr;
+ onig_initialize(&enc, 1);
+
r = onig_new(&reg, pattern,
pattern + onigenc_str_bytelen_null(enc, pattern),
options, enc, ONIG_SYNTAX_DEFAULT, &einfo);
@@ -92,6 +94,8 @@ exec_deluxe(OnigEncoding pattern_enc, OnigEncoding str_enc,
UChar* pattern = (UChar* )apattern;
UChar* str = (UChar* )astr;
+ onig_initialize(&str_enc, 1);
+
ci.num_of_elements = 5;
ci.pattern_enc = pattern_enc;
ci.target_enc = str_enc;
@@ -124,6 +128,12 @@ extern int main(int argc, char* argv[])
static unsigned char str[] = { 0xc7, 0xd6, 0xfe, 0xea, 0xe0, 0xe2, 0x00 };
static unsigned char pattern[] = { 0xe7, 0xf6, 0xde, '\\', 'w', '+', 0x00 };
+ r = exec(ONIG_ENCODING_SJIS, ONIG_OPTION_NONE,
+ "^a\\p{Hiragana}c$", "a\202\274c");
+
+ r = exec(ONIG_ENCODING_EUC_JP, ONIG_OPTION_NONE,
+ "^a\\p{Hiragana}c$", "a\244\276c");
+
r = exec(ONIG_ENCODING_CP1251, ONIG_OPTION_IGNORECASE,
"aBc", " AbC");
diff --git a/sample/listcap.c b/sample/listcap.c
index 9a4fd9a..e283890 100644
--- a/sample/listcap.c
+++ b/sample/listcap.c
@@ -93,6 +93,9 @@ extern int main(int argc, char* argv[])
static UChar* str3 = (UChar* )"0123";
static UChar* pattern3 = (UChar* )"(?@.)(?@.)(?@.)(?@.)";
+ OnigEncoding use_encs[] = { ONIG_ENCODING_ASCII };
+ onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0]));
+
/* enable capture hostory */
onig_copy_syntax(&syn, ONIG_SYNTAX_DEFAULT);
onig_set_syntax_op2(&syn,
diff --git a/sample/names.c b/sample/names.c
index 6667eb5..2cf3a2f 100644
--- a/sample/names.c
+++ b/sample/names.c
@@ -35,6 +35,9 @@ extern int main(int argc, char* argv[])
static UChar* pattern = (UChar* )"(?<foo>a*)(?<bar>b*)(?<foo>c*)";
static UChar* str = (UChar* )"aaabbbbcc";
+ OnigEncoding use_encs[] = { ONIG_ENCODING_ASCII };
+ onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0]));
+
r = onig_new(&reg, pattern, pattern + strlen((char* )pattern),
ONIG_OPTION_DEFAULT, ONIG_ENCODING_ASCII, ONIG_SYNTAX_DEFAULT, &einfo);
if (r != ONIG_NORMAL) {
diff --git a/sample/posix.c b/sample/posix.c
index d24ee35..f4cbe37 100644
--- a/sample/posix.c
+++ b/sample/posix.c
@@ -38,6 +38,8 @@ extern int main(int argc, char* argv[])
regex_t reg;
UChar* pattern;
+ reg_set_encoding(REG_POSIX_ENCODING_ASCII);
+
/* default syntax (ONIG_SYNTAX_RUBY) */
pattern = (UChar* )"^a+b{2,7}[c-f]?$|uuu";
r = regcomp(&reg, (char* )pattern, REG_EXTENDED);
@@ -89,5 +91,6 @@ extern int main(int argc, char* argv[])
x(&reg, pattern, (UChar* )"a\nb\n");
regfree(&reg);
+ onig_end();
return 0;
}
diff --git a/sample/simple.c b/sample/simple.c
index 948a542..e570a30 100644
--- a/sample/simple.c
+++ b/sample/simple.c
@@ -16,6 +16,9 @@ extern int main(int argc, char* argv[])
static UChar* pattern = (UChar* )"a(.*)b|[e-f]+";
static UChar* str = (UChar* )"zzzzaffffffffb";
+ OnigEncoding use_encs[] = { ONIG_ENCODING_ASCII };
+ onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0]));
+
r = onig_new(&reg, pattern, pattern + strlen((char* )pattern),
ONIG_OPTION_DEFAULT, ONIG_ENCODING_ASCII, ONIG_SYNTAX_DEFAULT, &einfo);
if (r != ONIG_NORMAL) {
diff --git a/sample/sql.c b/sample/sql.c
index e0ce62c..dfa176c 100644
--- a/sample/sql.c
+++ b/sample/sql.c
@@ -18,6 +18,9 @@ extern int main(int argc, char* argv[])
static UChar* pattern = (UChar* )"\\_%\\\\__zz";
static UChar* str = (UChar* )"a_abcabcabc\\ppzz";
+ OnigEncoding use_encs[] = { ONIG_ENCODING_ASCII };
+ onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0]));
+
onig_set_syntax_op (&SQLSyntax, ONIG_SYN_OP_VARIABLE_META_CHARACTERS);
onig_set_syntax_op2 (&SQLSyntax, 0);
onig_set_syntax_behavior(&SQLSyntax, 0);
diff --git a/sample/syntax.c b/sample/syntax.c
index 7cc353f..6bf27c5 100644
--- a/sample/syntax.c
+++ b/sample/syntax.c
@@ -51,7 +51,6 @@ extern int exec(OnigSyntaxType* syntax,
onig_region_free(region, 1 /* 1:free self, 0:free contents only */);
onig_free(reg);
- onig_end();
return 0;
}
@@ -59,6 +58,9 @@ extern int main(int argc, char* argv[])
{
int r;
+ OnigEncoding use_encs[] = { ONIG_ENCODING_ASCII };
+ onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0]));
+
r = exec(ONIG_SYNTAX_PERL,
"\\p{XDigit}\\P{XDigit}\\p{^XDigit}\\P{^XDigit}\\p{XDigit}",
"bgh3a");
diff --git a/sample/user_property.c b/sample/user_property.c
new file mode 100644
index 0000000..fb604f6
--- /dev/null
+++ b/sample/user_property.c
@@ -0,0 +1,87 @@
+/*
+ * user_property.c
+ */
+#include <stdio.h>
+#include <string.h>
+#include "oniguruma.h"
+
+extern int
+main(int argc, char* argv[])
+{
+ int r;
+ unsigned char *start, *range, *end;
+ regex_t* reg;
+ OnigErrorInfo einfo;
+ OnigRegion *region;
+
+ static OnigCodePoint handakuon_hiragana[] = {
+ 5, /* number of ranges */
+ 0x3071, 0x3071, /* PA */
+ 0x3074, 0x3074, /* PI */
+ 0x3077, 0x3077, /* PU */
+ 0x307a, 0x307a, /* PE */
+ 0x307d, 0x307d /* PO */
+ };
+
+ static UChar* pattern = (UChar* )"\\A(\\p{HandakuonHiragana}{5})\\p{^HandakuonHiragana}\\z";
+ //static UChar* pattern = (UChar* )"\\p{Handakuon_Hiragana}{5}\\P{Handakuon Hiragana}";
+
+ /* "PA PI PU PE PO a" */
+ static UChar* str = (UChar* )"\343\201\261\343\201\264\343\201\267\343\201\272\343\201\275a";
+
+ OnigEncoding use_encs[] = { ONIG_ENCODING_UTF8 };
+ onig_initialize(use_encs, sizeof(use_encs)/sizeof(use_encs[0]));
+
+ r = onig_unicode_define_user_property("HandakuonHiragana",
+ handakuon_hiragana);
+ if (r == ONIG_NORMAL) {
+ fprintf(stdout, "define HandakuonHiragana\n");
+ }
+ else {
+ char s[ONIG_MAX_ERROR_MESSAGE_LEN];
+ onig_error_code_to_str(s, r);
+ fprintf(stderr, "ERROR: %s\n", s);
+ return -1;
+ }
+
+ r = onig_new(&reg, pattern, pattern + strlen((char* )pattern),
+ ONIG_OPTION_DEFAULT, ONIG_ENCODING_UTF8, ONIG_SYNTAX_DEFAULT, &einfo);
+ if (r == ONIG_NORMAL) {
+ fprintf(stdout, "onig_new: success.\n");
+ }
+ else {
+ char s[ONIG_MAX_ERROR_MESSAGE_LEN];
+ onig_error_code_to_str(s, r, &einfo);
+ fprintf(stderr, "onig_new: ERROR: %s\n", s);
+ return -1;
+ }
+
+ region = onig_region_new();
+
+ end = str + strlen((char* )str);
+ start = str;
+ range = end;
+ r = onig_search(reg, str, end, start, range, region, ONIG_OPTION_NONE);
+ if (r >= 0) {
+ int i;
+
+ fprintf(stderr, "match at %d\n", r);
+ for (i = 0; i < region->num_regs; i++) {
+ fprintf(stderr, "%d: (%d-%d)\n", i, region->beg[i], region->end[i]);
+ }
+ }
+ else if (r == ONIG_MISMATCH) {
+ fprintf(stderr, "search fail\n");
+ }
+ else { /* error */
+ char s[ONIG_MAX_ERROR_MESSAGE_LEN];
+ onig_error_code_to_str(s, r);
+ fprintf(stderr, "ERROR: %s\n", s);
+ return -1;
+ }
+
+ onig_region_free(region, 1 /* 1:free self, 0:free contents only */);
+ onig_free(reg);
+ onig_end();
+ return 0;
+}