aboutsummaryrefslogtreecommitdiffstats
path: root/examples/cmdline
diff options
context:
space:
mode:
Diffstat (limited to 'examples/cmdline')
-rw-r--r--examples/cmdline/Makefile373
-rw-r--r--examples/cmdline/Makefile.in373
-rw-r--r--examples/cmdline/lookup.cpp51
-rw-r--r--examples/cmdline/search.cpp63
-rwxr-xr-xexamples/cmdline/threaded_search.cpp125
5 files changed, 985 insertions, 0 deletions
diff --git a/examples/cmdline/Makefile b/examples/cmdline/Makefile
new file mode 100644
index 0000000..e8b7c8a
--- /dev/null
+++ b/examples/cmdline/Makefile
@@ -0,0 +1,373 @@
+# Makefile.in generated by automake 1.6.2 from Makefile.am.
+# examples/cmdline/Makefile. Generated from Makefile.in by configure.
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# 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.
+
+
+SHELL = /bin/sh
+
+srcdir = .
+top_srcdir = ../..
+
+prefix = /usr
+exec_prefix = ${prefix}
+
+bindir = ${exec_prefix}/bin
+sbindir = ${exec_prefix}/sbin
+libexecdir = ${exec_prefix}/libexec
+datadir = ${prefix}/share
+sysconfdir = /etc
+sharedstatedir = ${prefix}/com
+localstatedir = ${prefix}/var
+libdir = ${exec_prefix}/lib
+infodir = ${prefix}/info
+mandir = ${prefix}/man
+includedir = ${prefix}/include
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/sword
+pkglibdir = $(libdir)/sword
+pkgincludedir = $(includedir)/sword
+top_builddir = ../..
+
+ACLOCAL = ${SHELL} /space/home/scribe/src/sword/missing --run aclocal-1.6
+AUTOCONF = ${SHELL} /space/home/scribe/src/sword/missing --run autoconf
+AUTOMAKE = ${SHELL} /space/home/scribe/src/sword/missing --run automake-1.6
+AUTOHEADER = ${SHELL} /space/home/scribe/src/sword/missing --run autoheader
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = /usr/bin/install -c
+INSTALL_PROGRAM = ${INSTALL}
+INSTALL_DATA = ${INSTALL} -m 644
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_SCRIPT = ${INSTALL}
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = s,x,x,
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = arm-v4l-linux
+host_triplet = arm-v4l-linux-gnu
+
+EXEEXT =
+OBJEXT = o
+PATH_SEPARATOR = :
+AMTAR = ${SHELL} /space/home/scribe/src/sword/missing --run tar
+AS = @AS@
+AWK = gawk
+CC = arm-v4l-linux-gcc
+CURL_CFLAGS =
+CURL_CONFIG = /usr/bin/curl-config
+CURL_LIBS = -lcurl -lssl -lcrypto -ldl
+CXX = arm-v4l-linux-g++
+DEPDIR = .deps
+DLLTOOL = @DLLTOOL@
+ECHO = echo
+GENCCODE =
+GENCMN =
+GENRB =
+INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
+LIBTOOL = $(SHELL) $(top_builddir)/libtool
+LN_S = ln -s
+MAINT = #
+OBJDUMP = @OBJDUMP@
+PACKAGE = sword
+PKGDATA =
+RANLIB = arm-v4l-linux-ranlib
+STRIP = arm-v4l-linux-strip
+VERSION = 1.5.4
+am__include = include
+am__quote =
+dir_confdef = no
+enable_debug = no
+enable_profile = no
+install_sh = /space/home/scribe/src/sword/install-sh
+target_cpu = arm
+target_mingw32 = no
+target_os = linux-gnu
+target_system = arm
+target_vendor = v4l
+with_conf = no
+with_icu = no
+with_zlib = yes
+AUTOMAKE_OPTIONS = 1.6
+INCLUDES = -I $(top_srcdir)/include
+LDADD = -L$(top_builddir)/lib -lsword
+
+noinst_PROGRAMS = lookup search threaded_search
+
+lookup_SOURCES = lookup.cpp
+search_SOURCES = search.cpp
+threaded_search_SOURCES = threaded_search.cpp
+threaded_search_LDADD = $(LDADD) -lpthread
+subdir = examples/cmdline
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+noinst_PROGRAMS = lookup$(EXEEXT) search$(EXEEXT) \
+ threaded_search$(EXEEXT)
+PROGRAMS = $(noinst_PROGRAMS)
+
+am_lookup_OBJECTS = lookup.$(OBJEXT)
+lookup_OBJECTS = $(am_lookup_OBJECTS)
+lookup_LDADD = $(LDADD)
+lookup_DEPENDENCIES =
+lookup_LDFLAGS =
+am_search_OBJECTS = search.$(OBJEXT)
+search_OBJECTS = $(am_search_OBJECTS)
+search_LDADD = $(LDADD)
+search_DEPENDENCIES =
+search_LDFLAGS =
+am_threaded_search_OBJECTS = threaded_search.$(OBJEXT)
+threaded_search_OBJECTS = $(am_threaded_search_OBJECTS)
+threaded_search_DEPENDENCIES =
+threaded_search_LDFLAGS =
+
+DEFS = -DHAVE_CONFIG_H
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+CPPFLAGS =
+LDFLAGS =
+LIBS = -lz
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+DEP_FILES = ./$(DEPDIR)/lookup.Po ./$(DEPDIR)/search.Po \
+ ./$(DEPDIR)/threaded_search.Po
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CXXFLAGS = -I/usr/include/g++-3 -O3 -ftemplate-depth-25
+DIST_SOURCES = $(lookup_SOURCES) $(search_SOURCES) \
+ $(threaded_search_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(lookup_SOURCES) $(search_SOURCES) $(threaded_search_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: # Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu examples/cmdline/Makefile
+Makefile: # $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+lookup$(EXEEXT): $(lookup_OBJECTS) $(lookup_DEPENDENCIES)
+ @rm -f lookup$(EXEEXT)
+ $(CXXLINK) $(lookup_LDFLAGS) $(lookup_OBJECTS) $(lookup_LDADD) $(LIBS)
+search$(EXEEXT): $(search_OBJECTS) $(search_DEPENDENCIES)
+ @rm -f search$(EXEEXT)
+ $(CXXLINK) $(search_LDFLAGS) $(search_OBJECTS) $(search_LDADD) $(LIBS)
+threaded_search$(EXEEXT): $(threaded_search_OBJECTS) $(threaded_search_DEPENDENCIES)
+ @rm -f threaded_search$(EXEEXT)
+ $(CXXLINK) $(threaded_search_LDFLAGS) $(threaded_search_OBJECTS) $(threaded_search_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+include ./$(DEPDIR)/lookup.Po
+include ./$(DEPDIR)/search.Po
+include ./$(DEPDIR)/threaded_search.Po
+
+distclean-depend:
+ -rm -rf ./$(DEPDIR)
+
+.cpp.o:
+ source='$<' object='$@' libtool=no \
+ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+ $(CXXDEPMODE) $(depcomp) \
+ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+.cpp.obj:
+ source='$<' object='$@' libtool=no \
+ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' \
+ $(CXXDEPMODE) $(depcomp) \
+ $(CXXCOMPILE) -c -o $@ `cygpath -w $<`
+
+.cpp.lo:
+ source='$<' object='$@' libtool=yes \
+ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' \
+ $(CXXDEPMODE) $(depcomp) \
+ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+CXXDEPMODE = depmode=gcc
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+tags: TAGS
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @list='$(DISTFILES)'; for file in $$list; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$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:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_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
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstPROGRAMS distclean distclean-compile \
+ distclean-depend distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ tags uninstall uninstall-am uninstall-info-am
+
+# 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/examples/cmdline/Makefile.in b/examples/cmdline/Makefile.in
new file mode 100644
index 0000000..fc0371e
--- /dev/null
+++ b/examples/cmdline/Makefile.in
@@ -0,0 +1,373 @@
+# Makefile.in generated by automake 1.6.2 from Makefile.am.
+# @configure_input@
+
+# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
+# 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@
+SHELL = @SHELL@
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+
+bindir = @bindir@
+sbindir = @sbindir@
+libexecdir = @libexecdir@
+datadir = @datadir@
+sysconfdir = @sysconfdir@
+sharedstatedir = @sharedstatedir@
+localstatedir = @localstatedir@
+libdir = @libdir@
+infodir = @infodir@
+mandir = @mandir@
+includedir = @includedir@
+oldincludedir = /usr/include
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+
+ACLOCAL = @ACLOCAL@
+AUTOCONF = @AUTOCONF@
+AUTOMAKE = @AUTOMAKE@
+AUTOHEADER = @AUTOHEADER@
+
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_DATA = @INSTALL_DATA@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = @program_transform_name@
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_alias = @host_alias@
+host_triplet = @host@
+
+EXEEXT = @EXEEXT@
+OBJEXT = @OBJEXT@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+AMTAR = @AMTAR@
+AS = @AS@
+AWK = @AWK@
+CC = @CC@
+CURL_CFLAGS = @CURL_CFLAGS@
+CURL_CONFIG = @CURL_CONFIG@
+CURL_LIBS = @CURL_LIBS@
+CXX = @CXX@
+DEPDIR = @DEPDIR@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+GENCCODE = @GENCCODE@
+GENCMN = @GENCMN@
+GENRB = @GENRB@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+MAINT = @MAINT@
+OBJDUMP = @OBJDUMP@
+PACKAGE = @PACKAGE@
+PKGDATA = @PKGDATA@
+RANLIB = @RANLIB@
+STRIP = @STRIP@
+VERSION = @VERSION@
+am__include = @am__include@
+am__quote = @am__quote@
+dir_confdef = @dir_confdef@
+enable_debug = @enable_debug@
+enable_profile = @enable_profile@
+install_sh = @install_sh@
+target_cpu = @target_cpu@
+target_mingw32 = @target_mingw32@
+target_os = @target_os@
+target_system = @target_system@
+target_vendor = @target_vendor@
+with_conf = @with_conf@
+with_icu = @with_icu@
+with_zlib = @with_zlib@
+AUTOMAKE_OPTIONS = 1.6
+INCLUDES = -I $(top_srcdir)/include
+LDADD = -L$(top_builddir)/lib -lsword
+
+noinst_PROGRAMS = lookup search threaded_search
+
+lookup_SOURCES = lookup.cpp
+search_SOURCES = search.cpp
+threaded_search_SOURCES = threaded_search.cpp
+threaded_search_LDADD = $(LDADD) -lpthread
+subdir = examples/cmdline
+mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+noinst_PROGRAMS = lookup$(EXEEXT) search$(EXEEXT) \
+ threaded_search$(EXEEXT)
+PROGRAMS = $(noinst_PROGRAMS)
+
+am_lookup_OBJECTS = lookup.$(OBJEXT)
+lookup_OBJECTS = $(am_lookup_OBJECTS)
+lookup_LDADD = $(LDADD)
+lookup_DEPENDENCIES =
+lookup_LDFLAGS =
+am_search_OBJECTS = search.$(OBJEXT)
+search_OBJECTS = $(am_search_OBJECTS)
+search_LDADD = $(LDADD)
+search_DEPENDENCIES =
+search_LDFLAGS =
+am_threaded_search_OBJECTS = threaded_search.$(OBJEXT)
+threaded_search_OBJECTS = $(am_threaded_search_OBJECTS)
+threaded_search_DEPENDENCIES =
+threaded_search_LDFLAGS =
+
+DEFS = @DEFS@
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+CPPFLAGS = @CPPFLAGS@
+LDFLAGS = @LDFLAGS@
+LIBS = @LIBS@
+depcomp = $(SHELL) $(top_srcdir)/depcomp
+am__depfiles_maybe = depfiles
+@AMDEP_TRUE@DEP_FILES = ./$(DEPDIR)/lookup.Po ./$(DEPDIR)/search.Po \
+@AMDEP_TRUE@ ./$(DEPDIR)/threaded_search.Po
+CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
+ $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
+CXXLD = $(CXX)
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+CXXFLAGS = @CXXFLAGS@
+DIST_SOURCES = $(lookup_SOURCES) $(search_SOURCES) \
+ $(threaded_search_SOURCES)
+DIST_COMMON = Makefile.am Makefile.in
+SOURCES = $(lookup_SOURCES) $(search_SOURCES) $(threaded_search_SOURCES)
+
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .cpp .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/configure.ac $(ACLOCAL_M4)
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu examples/cmdline/Makefile
+Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
+
+clean-noinstPROGRAMS:
+ @list='$(noinst_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+lookup$(EXEEXT): $(lookup_OBJECTS) $(lookup_DEPENDENCIES)
+ @rm -f lookup$(EXEEXT)
+ $(CXXLINK) $(lookup_LDFLAGS) $(lookup_OBJECTS) $(lookup_LDADD) $(LIBS)
+search$(EXEEXT): $(search_OBJECTS) $(search_DEPENDENCIES)
+ @rm -f search$(EXEEXT)
+ $(CXXLINK) $(search_LDFLAGS) $(search_OBJECTS) $(search_LDADD) $(LIBS)
+threaded_search$(EXEEXT): $(threaded_search_OBJECTS) $(threaded_search_DEPENDENCIES)
+ @rm -f threaded_search$(EXEEXT)
+ $(CXXLINK) $(threaded_search_LDFLAGS) $(threaded_search_OBJECTS) $(threaded_search_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT) core *.core
+
+distclean-compile:
+ -rm -f *.tab.c
+
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/lookup.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/search.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/threaded_search.Po@am__quote@
+
+distclean-depend:
+ -rm -rf ./$(DEPDIR)
+
+.cpp.o:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+
+.cpp.obj:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Po' tmpdepfile='$(DEPDIR)/$*.TPo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(CXXCOMPILE) -c -o $@ `cygpath -w $<`
+
+.cpp.lo:
+@AMDEP_TRUE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@
+@AMDEP_TRUE@ depfile='$(DEPDIR)/$*.Plo' tmpdepfile='$(DEPDIR)/$*.TPlo' @AMDEPBACKSLASH@
+@AMDEP_TRUE@ $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ $(LTCXXCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
+CXXDEPMODE = @CXXDEPMODE@
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ETAGS = etags
+ETAGSFLAGS =
+
+tags: TAGS
+
+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; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ 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; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(ETAGS_ARGS)$$tags$$unique" \
+ || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+
+top_distdir = ../..
+distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
+
+distdir: $(DISTFILES)
+ @list='$(DISTFILES)'; for file in $$list; do \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkinstalldirs) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$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:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f Makefile $(CONFIG_CLEAN_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
+
+distclean-am: clean-am distclean-compile distclean-depend \
+ distclean-generic distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+ mostlyclean-libtool
+
+uninstall-am: uninstall-info-am
+
+.PHONY: GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstPROGRAMS distclean distclean-compile \
+ distclean-depend distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
+ tags uninstall uninstall-am uninstall-info-am
+
+# 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/examples/cmdline/lookup.cpp b/examples/cmdline/lookup.cpp
new file mode 100644
index 0000000..6f67ed7
--- /dev/null
+++ b/examples/cmdline/lookup.cpp
@@ -0,0 +1,51 @@
+#include <stdio.h>
+#include <iostream>
+#include <stdlib.h>
+#include <swmgr.h>
+
+int main(int argc, char **argv)
+{
+ SWMgr manager;
+ SWModule *target;
+ ModMap::iterator it;
+
+ if (argc != 3) {
+ fprintf(stderr, "usage: %s <modname> <\"lookup key\">\n", argv[0]);
+ exit(-1);
+ }
+
+ it = manager.Modules.find(argv[1]);
+ if (it == manager.Modules.end()) {
+ fprintf(stderr, "Could not find module [%s]. Available modules:\n", argv[1]);
+ for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
+ fprintf(stderr, "[%s]\t - %s\n", (*it).second->Name(), (*it).second->Description());
+ }
+ exit(-1);
+ }
+
+ target = (*it).second;
+
+ target->SetKey(argv[2]);
+
+ (const char *)*target; // force an entry lookup to resolve key so we
+ // get the idxbuf entry for the key
+ std::cout << (const char *)(SWKey &)*target << ":\n";
+ std::cout << target->StripText();
+ std::cout << "\n";
+ std::cout << "==========================\n";
+ std::cout << "Entry Attributes:\n\n";
+ AttributeTypeList::iterator i1;
+ AttributeList::iterator i2;
+ AttributeValue::iterator i3;
+ for (i1 = target->getEntryAttributes().begin(); i1 != target->getEntryAttributes().end(); i1++) {
+ std::cout << "[ " << i1->first << " ]\n";
+ for (i2 = i1->second.begin(); i2 != i1->second.end(); i2++) {
+ std::cout << "\t[ " << i2->first << " ]\n";
+ for (i3 = i2->second.begin(); i3 != i2->second.end(); i3++) {
+ std::cout << "\t\t" << i3->first << " = " << i3->second << "\n";
+ }
+ }
+ }
+ std::cout << std::endl;
+ return 0;
+}
diff --git a/examples/cmdline/search.cpp b/examples/cmdline/search.cpp
new file mode 100644
index 0000000..ec55b14
--- /dev/null
+++ b/examples/cmdline/search.cpp
@@ -0,0 +1,63 @@
+#include <stdio.h>
+#include <rawtext.h>
+#include <swmgr.h>
+#include <regex.h> // GNU
+#include <iostream>
+
+void percentUpdate(char percent, void *userData) {
+ static char printed = 0;
+ char maxHashes = *((char *)userData);
+
+ while ((((float)percent)/100) * maxHashes > printed) {
+ std::cout << "=";
+ printed++;
+ std::cout.flush();
+ }
+/*
+ std::cout << (int)percent << "% ";
+*/
+ std::cout.flush();
+}
+
+
+int main(int argc, char **argv)
+{
+ SWMgr manager;
+ SWModule *target;
+ ListKey listkey;
+ VerseKey vk;
+ ModMap::iterator it;
+
+ if ((argc != 3) && (argc != 5)) {
+ fprintf(stderr, "usage: %s <modname> <\"search string\"> [\"min\" \"max\"]\n", argv[0]);
+ exit(-1);
+ }
+
+ it = manager.Modules.find(argv[1]);
+ if (it == manager.Modules.end()) {
+ fprintf(stderr, "Could not find module [%s]. Available modules:\n", argv[1]);
+ for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
+ fprintf(stderr, "[%s]\t - %s\n", (*it).second->Name(), (*it).second->Description());
+ }
+ exit(-1);
+ }
+
+ target = (*it).second;
+
+ if (argc == 5) { // if min / max specified
+ vk.LowerBound(argv[3]);
+ vk.UpperBound(argv[4]);
+ vk.Persist(1);
+ target->SetKey(vk);
+ }
+
+ std::cout << "[0=================================50===============================100]\n ";
+ char lineLen = 70;
+ listkey = target->Search(argv[2], -2, 0/*REG_ICASE*/, 0, 0, &percentUpdate, &lineLen);
+ std::cout << "\n";
+ while (!listkey.Error()) {
+ std::cout << (const char *)listkey << std::endl;
+ listkey++;
+ }
+
+}
diff --git a/examples/cmdline/threaded_search.cpp b/examples/cmdline/threaded_search.cpp
new file mode 100755
index 0000000..2267ed2
--- /dev/null
+++ b/examples/cmdline/threaded_search.cpp
@@ -0,0 +1,125 @@
+#include <stdio.h>
+#include <rawtext.h>
+#include <swmgr.h>
+#include <regex.h> // GNU
+#include <listkey.h>
+#include <iostream>
+
+#include <pthread.h>
+
+int cms_currentProgress;
+
+class CSwordModuleSearch {
+public:
+ CSwordModuleSearch();
+ ~CSwordModuleSearch();
+
+ char* m_searchedText;
+ SWModule* m_module;
+ ListKey m_searchResult;
+ bool m_isSearching;
+
+ void startThread();
+ void search();
+};
+
+void* dummy(void* p) {
+ CSwordModuleSearch* moduleSearch = (CSwordModuleSearch*)p;
+ moduleSearch->search();
+
+ return NULL;
+}
+
+void percentUpdate(char percent, void* userData) {
+ cms_currentProgress = (int)percent;
+ std::cout << cms_currentProgress << "% ";
+}
+
+CSwordModuleSearch::CSwordModuleSearch() {
+ m_isSearching = false;
+ m_module = 0;
+ m_searchedText = 0;
+ cms_currentProgress = -1;
+}
+
+CSwordModuleSearch::~CSwordModuleSearch() {
+}
+
+void CSwordModuleSearch::startThread() {
+ std::cout << "startThread" << std::endl;
+ std::cout.flush();
+
+ pthread_attr_t* attr = new pthread_attr_t;
+ pthread_attr_init(attr);
+ pthread_attr_setdetachstate(attr, PTHREAD_CREATE_DETACHED);
+
+ pthread_t *thread= new pthread_t;
+ m_isSearching = true;
+ int i = pthread_create(thread, attr, &dummy, this);
+
+ std::cout << "Created the thread: " << i << std::endl;
+ std::cout.flush();
+}
+
+void CSwordModuleSearch::search() {
+
+ if (!m_module) {
+ std::cout << "Return." << std::endl;
+ return;
+ }
+
+ ListKey scopeList = VerseKey().ParseVerseList("Luke;John;Revelation","", true);
+ for (int i=0; i < scopeList.Count(); ++i) {
+ std::cout << (const char*)*scopeList.GetElement(i) << std::endl;
+ }
+ SWKey* scope = &scopeList;
+
+ m_searchResult = m_module->Search(m_searchedText, -2, REG_ICASE, scope, 0, &percentUpdate);
+
+ if (!scope)
+ std::cout << "bad scope!" << std::endl;
+ m_isSearching = false;
+}
+
+int main(int argc, char **argv) {
+ SWMgr manager;
+ ModMap::iterator it;
+ int oldProgress = 0;
+
+ CSwordModuleSearch* moduleSearch = new CSwordModuleSearch();
+
+ if (argc != 3) {
+ fprintf(stderr, "usage: %s <modname> <searched text>\n", argv[0]);
+ exit(-1);
+ }
+
+ it = manager.Modules.find(argv[1]);
+ if (it == manager.Modules.end()) {
+ fprintf(stderr, "Could not find module [%s]. Available modules:\n", argv[1]);
+ for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) {
+ fprintf(stderr, "[%s]\t - %s\n", (*it).second->Name(), (*it).second->Description());
+ }
+ exit(-1);
+ }
+
+ moduleSearch->m_searchedText = argv[2];
+ moduleSearch->m_module = (*it).second;
+ moduleSearch->startThread();
+
+ std::cout << "Start loop" << std::endl;
+ std::cout.flush();
+ while (true) {
+ if (!moduleSearch->m_isSearching)
+ break;
+ else
+ std::cout.flush();
+ };
+
+ std::cout << std::endl << "Number of found items: " << moduleSearch->m_searchResult.Count() << std::endl;
+ std::cout << "Finished program" << std::endl;
+ std::cout.flush();
+
+ delete moduleSearch;
+ exit(0);
+}
+