From 03134fa5f6f25d92724ce4c183f9bbe12a9e37dc Mon Sep 17 00:00:00 2001 From: "Roberto C. Sanchez" Date: Sat, 29 Mar 2014 10:53:59 -0400 Subject: Imported Upstream version 1.5.11 --- examples/.cvsignore | 3 + examples/Makefile.am | 3 + examples/Makefile.in | 518 +++++++++++++++++++++++++++++++++++ examples/classes/Makefile | 10 + examples/classes/ciphercng.cpp | 50 ++++ examples/classes/swmgrex.cpp | 58 ++++ examples/cmdline/.cvsignore | 7 + examples/cmdline/Makefile.am | 12 + examples/cmdline/Makefile.in | 512 ++++++++++++++++++++++++++++++++++ examples/cmdline/listoptions.cpp | 21 ++ examples/cmdline/lookup.cpp | 75 +++++ examples/cmdline/search.cpp | 97 +++++++ examples/cmdline/threaded_search.cpp | 134 +++++++++ examples/cmdline/verserangeparse.cpp | 69 +++++ examples/simple.cpp | 33 +++ 15 files changed, 1602 insertions(+) create mode 100644 examples/.cvsignore create mode 100644 examples/Makefile.am create mode 100644 examples/Makefile.in create mode 100644 examples/classes/Makefile create mode 100644 examples/classes/ciphercng.cpp create mode 100644 examples/classes/swmgrex.cpp create mode 100644 examples/cmdline/.cvsignore create mode 100644 examples/cmdline/Makefile.am create mode 100644 examples/cmdline/Makefile.in create mode 100644 examples/cmdline/listoptions.cpp create mode 100644 examples/cmdline/lookup.cpp create mode 100644 examples/cmdline/search.cpp create mode 100755 examples/cmdline/threaded_search.cpp create mode 100644 examples/cmdline/verserangeparse.cpp create mode 100644 examples/simple.cpp (limited to 'examples') diff --git a/examples/.cvsignore b/examples/.cvsignore new file mode 100644 index 0000000..22a4e72 --- /dev/null +++ b/examples/.cvsignore @@ -0,0 +1,3 @@ +Makefile +Makefile.in + diff --git a/examples/Makefile.am b/examples/Makefile.am new file mode 100644 index 0000000..3160def --- /dev/null +++ b/examples/Makefile.am @@ -0,0 +1,3 @@ +AUTOMAKE_OPTIONS = 1.6 + +SUBDIRS = cmdline diff --git a/examples/Makefile.in b/examples/Makefile.in new file mode 100644 index 0000000..0622bd3 --- /dev/null +++ b/examples/Makefile.in @@ -0,0 +1,518 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 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@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@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@ +target_triplet = @target@ +subdir = examples +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/acx_clucene.m4 \ + $(top_srcdir)/m4/cppunit.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +SOURCES = +DIST_SOURCES = +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CXXFLAGS = @AM_CXXFLAGS@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLUCENE_CXXFLAGS = @CLUCENE_CXXFLAGS@ +CLUCENE_LIBS = @CLUCENE_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ +CPPUNIT_CONFIG = @CPPUNIT_CONFIG@ +CPPUNIT_LIBS = @CPPUNIT_LIBS@ +CURL_AM_CFLAGS = @CURL_AM_CFLAGS@ +CURL_CONFIG = @CURL_CONFIG@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GENCCODE = @GENCCODE@ +GENCMN = @GENCMN@ +GENRB = @GENRB@ +GREP = @GREP@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_IOLIBS = @ICU_IOLIBS@ +ICU_LIBS = @ICU_LIBS@ +ICU_VER = @ICU_VER@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGDATA = @PKGDATA@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +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@ +dir_confdef = @dir_confdef@ +docdir = @docdir@ +dvidir = @dvidir@ +enable_debug = @enable_debug@ +enable_profile = @enable_profile@ +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 = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_mingw32 = @target_mingw32@ +target_os = @target_os@ +target_system = @target_system@ +target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +with_conf = @with_conf@ +with_icu = @with_icu@ +with_zlib = @with_zlib@ +AUTOMAKE_OPTIONS = 1.6 +SUBDIRS = cmdline +all: all-recursive + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign examples/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +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: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + tags=; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + 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; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(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 "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_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 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 $(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 + list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + distdir=`$(am__cd) $(distdir) && pwd`; \ + top_distdir=`$(am__cd) $(top_distdir) && pwd`; \ + (cd $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$top_distdir" \ + distdir="$$distdir/$$subdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + distdir) \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-recursive +all-am: Makefile +installdirs: installdirs-recursive +installdirs-am: +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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-recursive + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-recursive + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-recursive + +dvi-am: + +html: html-recursive + +info: info-recursive + +info-am: + +install-data-am: + +install-dvi: install-dvi-recursive + +install-exec-am: + +install-html: install-html-recursive + +install-info: install-info-recursive + +install-man: + +install-pdf: install-pdf-recursive + +install-ps: install-ps-recursive + +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-recursive + +pdf-am: + +ps: ps-recursive + +ps-am: + +uninstall-am: + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) install-am \ + install-strip + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am check check-am clean clean-generic clean-libtool \ + ctags ctags-recursive distclean 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 installdirs-am maintainer-clean \ + maintainer-clean-generic mostlyclean mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-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/classes/Makefile b/examples/classes/Makefile new file mode 100644 index 0000000..882d9b8 --- /dev/null +++ b/examples/classes/Makefile @@ -0,0 +1,10 @@ +TARGETS= ciphercng swmgrex +all: $(TARGETS) + +clean: + rm $(TARGETS) + +.cpp: + g++ -g `pkg-config --cflags sword` $< -o $@ `pkg-config --libs sword` + + diff --git a/examples/classes/ciphercng.cpp b/examples/classes/ciphercng.cpp new file mode 100644 index 0000000..e1cd042 --- /dev/null +++ b/examples/classes/ciphercng.cpp @@ -0,0 +1,50 @@ +/****************************************************************************** + * + * This example demonstrates how to change the cipher key of a module + * The change is only in effect for this run. This DOES NOT change the + * cipherkey in the module's .conf file. + * + */ + +#include + +#include +#include + + +using namespace sword; +using namespace std; + +int main(int argc, char **argv) { + + if (argc != 2) { + fprintf(stderr, "usage: %s \n", *argv); + exit(-1); + } + + SWMgr manager; // create a default manager that looks in the current directory for mods.conf + ModMap::iterator it; + it = manager.Modules.find(argv[1]); + + if (it == manager.Modules.end()) { + fprintf(stderr, "%s: couldn't find module: %s\n", *argv, argv[1]); + exit(-1); + } + + SWModule *module = (*it).second; + string key; + + cout << "\nPress [CTRL-C] to end\n\n"; + while (true) { + cout << "\nModule text:\n"; + module->setKey("1jn 1:9"); + cout << "[ " << module->KeyText() << " ]\n"; + cout << (const char *)*module; + cout << "\n\nEnter new cipher key: "; + cin >> key; + cout << "\nSetting key to: " << key; + manager.setCipherKey(argv[1], key.c_str()); + } + + +} diff --git a/examples/classes/swmgrex.cpp b/examples/classes/swmgrex.cpp new file mode 100644 index 0000000..a3d6591 --- /dev/null +++ b/examples/classes/swmgrex.cpp @@ -0,0 +1,58 @@ +/****************************************************************************** + * Class SWMgr manages installed modules for a frontend. + * SWMgr reads a mods.conf file to discover its information. + * It then instantiates the correct decendent of SWModule for each + * module entry in mods.conf + * The developer may use this class to query what modules are installed + * and to retrieve an (SWModule *) for any one of these modules + * + * SWMgr makes its modules available as an STL Map. + * The Map definition is typedef'ed as ModMap + * ModMap consists of: FIRST : SWBuf moduleName + * SECOND: SWModule *module + * + */ + +#include + +#include +#include + +using namespace sword; +using namespace std; + +main() { + SWMgr manager; // create a default manager that looks in the current directory for mods.conf + + cout << "\nInstalled Modules:\n\n"; + + ModMap::iterator modIterator; + +// Loop thru all installed modules and print out information + + for (modIterator = manager.Modules.begin(); modIterator != manager.Modules.end(); modIterator++) { + SWBuf modName = (*modIterator).first; // mod.conf section name (stored in module->Name()) + SWModule *module = (*modIterator).second; + + cout << modName << "(" << module->Name() << ") | " << module->Type() << "\n"; + } + +// Print out a verse from the first module: + + cout << "\n" << manager.Modules.begin()->second->KeyText() << ":\n"; + cout << (const char *)(*manager.Modules.begin()->second); + cout << " (" << manager.Modules.begin()->second->Name() << ")\n"; + +// Print out the same verse from the second module (less confusing): + + modIterator = manager.Modules.begin(); // get first module + modIterator++; // increment to next module + + SWModule *mod = modIterator->second; + + cout << "\n" << mod->KeyText() << ":\n"; +// cout << (const char *)(*mod); // we could do this, the same as above + mod->Display(); // instead of casting mod to const char * to get its contents, we'll call the default display method that writes to stdout; + cout << " (" << mod->Name() << ")\n\n"; + +} diff --git a/examples/cmdline/.cvsignore b/examples/cmdline/.cvsignore new file mode 100644 index 0000000..bbe4fbe --- /dev/null +++ b/examples/cmdline/.cvsignore @@ -0,0 +1,7 @@ +.deps +.libs +Makefile +Makefile.in +lookup +search +threaded_search \ No newline at end of file diff --git a/examples/cmdline/Makefile.am b/examples/cmdline/Makefile.am new file mode 100644 index 0000000..6aaea63 --- /dev/null +++ b/examples/cmdline/Makefile.am @@ -0,0 +1,12 @@ +AUTOMAKE_OPTIONS = 1.6 +INCLUDES = -I $(top_srcdir)/include +LDADD = $(top_builddir)/lib/libsword.la + +noinst_PROGRAMS = lookup search threaded_search listoptions verserangeparse + +lookup_SOURCES = lookup.cpp +search_SOURCES = search.cpp +listoptions_SOURCES = listoptions.cpp +verserangeparse_SOURCES = verserangeparse.cpp +threaded_search_SOURCES = threaded_search.cpp +threaded_search_LDADD = $(LDADD) -lpthread diff --git a/examples/cmdline/Makefile.in b/examples/cmdline/Makefile.in new file mode 100644 index 0000000..b868c64 --- /dev/null +++ b/examples/cmdline/Makefile.in @@ -0,0 +1,512 @@ +# Makefile.in generated by automake 1.10 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006 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@ +pkglibdir = $(libdir)/@PACKAGE@ +pkgincludedir = $(includedir)/@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@ +target_triplet = @target@ +noinst_PROGRAMS = lookup$(EXEEXT) search$(EXEEXT) \ + threaded_search$(EXEEXT) listoptions$(EXEEXT) \ + verserangeparse$(EXEEXT) +subdir = examples/cmdline +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/acx_clucene.m4 \ + $(top_srcdir)/m4/cppunit.m4 $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/include/config.h +CONFIG_CLEAN_FILES = +PROGRAMS = $(noinst_PROGRAMS) +am_listoptions_OBJECTS = listoptions.$(OBJEXT) +listoptions_OBJECTS = $(am_listoptions_OBJECTS) +listoptions_LDADD = $(LDADD) +listoptions_DEPENDENCIES = $(top_builddir)/lib/libsword.la +am_lookup_OBJECTS = lookup.$(OBJEXT) +lookup_OBJECTS = $(am_lookup_OBJECTS) +lookup_LDADD = $(LDADD) +lookup_DEPENDENCIES = $(top_builddir)/lib/libsword.la +am_search_OBJECTS = search.$(OBJEXT) +search_OBJECTS = $(am_search_OBJECTS) +search_LDADD = $(LDADD) +search_DEPENDENCIES = $(top_builddir)/lib/libsword.la +am_threaded_search_OBJECTS = threaded_search.$(OBJEXT) +threaded_search_OBJECTS = $(am_threaded_search_OBJECTS) +threaded_search_DEPENDENCIES = $(LDADD) +am_verserangeparse_OBJECTS = verserangeparse.$(OBJEXT) +verserangeparse_OBJECTS = $(am_verserangeparse_OBJECTS) +verserangeparse_LDADD = $(LDADD) +verserangeparse_DEPENDENCIES = $(top_builddir)/lib/libsword.la +DEFAULT_INCLUDES = -I. -I$(top_builddir)/include@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) +CXXLD = $(CXX) +CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(listoptions_SOURCES) $(lookup_SOURCES) $(search_SOURCES) \ + $(threaded_search_SOURCES) $(verserangeparse_SOURCES) +DIST_SOURCES = $(listoptions_SOURCES) $(lookup_SOURCES) \ + $(search_SOURCES) $(threaded_search_SOURCES) \ + $(verserangeparse_SOURCES) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +AMTAR = @AMTAR@ +AM_CXXFLAGS = @AM_CXXFLAGS@ +AR = @AR@ +AS = @AS@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CLUCENE_CXXFLAGS = @CLUCENE_CXXFLAGS@ +CLUCENE_LIBS = @CLUCENE_LIBS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@ +CPPUNIT_CONFIG = @CPPUNIT_CONFIG@ +CPPUNIT_LIBS = @CPPUNIT_LIBS@ +CURL_AM_CFLAGS = @CURL_AM_CFLAGS@ +CURL_CONFIG = @CURL_CONFIG@ +CURL_LIBS = @CURL_LIBS@ +CXX = @CXX@ +CXXCPP = @CXXCPP@ +CXXDEPMODE = @CXXDEPMODE@ +CXXFLAGS = @CXXFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +ECHO = @ECHO@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +F77 = @F77@ +FFLAGS = @FFLAGS@ +GENCCODE = @GENCCODE@ +GENCMN = @GENCMN@ +GENRB = @GENRB@ +GREP = @GREP@ +ICU_CONFIG = @ICU_CONFIG@ +ICU_IOLIBS = @ICU_IOLIBS@ +ICU_LIBS = @ICU_LIBS@ +ICU_VER = @ICU_VER@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MKDIR_P = @MKDIR_P@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PKGDATA = @PKGDATA@ +PKG_CONFIG = @PKG_CONFIG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +VERSION = @VERSION@ +XML_LIBS = @XML_LIBS@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_CXX = @ac_ct_CXX@ +ac_ct_F77 = @ac_ct_F77@ +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@ +dir_confdef = @dir_confdef@ +docdir = @docdir@ +dvidir = @dvidir@ +enable_debug = @enable_debug@ +enable_profile = @enable_profile@ +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 = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_mingw32 = @target_mingw32@ +target_os = @target_os@ +target_system = @target_system@ +target_vendor = @target_vendor@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +with_conf = @with_conf@ +with_icu = @with_icu@ +with_zlib = @with_zlib@ +AUTOMAKE_OPTIONS = 1.6 +INCLUDES = -I $(top_srcdir)/include +LDADD = $(top_builddir)/lib/libsword.la +lookup_SOURCES = lookup.cpp +search_SOURCES = search.cpp +listoptions_SOURCES = listoptions.cpp +verserangeparse_SOURCES = verserangeparse.cpp +threaded_search_SOURCES = threaded_search.cpp +threaded_search_LDADD = $(LDADD) -lpthread +all: all-am + +.SUFFIXES: +.SUFFIXES: .cpp .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign examples/cmdline/Makefile'; \ + cd $(top_srcdir) && \ + $(AUTOMAKE) --foreign examples/cmdline/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: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +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 +listoptions$(EXEEXT): $(listoptions_OBJECTS) $(listoptions_DEPENDENCIES) + @rm -f listoptions$(EXEEXT) + $(CXXLINK) $(listoptions_OBJECTS) $(listoptions_LDADD) $(LIBS) +lookup$(EXEEXT): $(lookup_OBJECTS) $(lookup_DEPENDENCIES) + @rm -f lookup$(EXEEXT) + $(CXXLINK) $(lookup_OBJECTS) $(lookup_LDADD) $(LIBS) +search$(EXEEXT): $(search_OBJECTS) $(search_DEPENDENCIES) + @rm -f search$(EXEEXT) + $(CXXLINK) $(search_OBJECTS) $(search_LDADD) $(LIBS) +threaded_search$(EXEEXT): $(threaded_search_OBJECTS) $(threaded_search_DEPENDENCIES) + @rm -f threaded_search$(EXEEXT) + $(CXXLINK) $(threaded_search_OBJECTS) $(threaded_search_LDADD) $(LIBS) +verserangeparse$(EXEEXT): $(verserangeparse_OBJECTS) $(verserangeparse_DEPENDENCIES) + @rm -f verserangeparse$(EXEEXT) + $(CXXLINK) $(verserangeparse_OBJECTS) $(verserangeparse_LDADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/listoptions.Po@am__quote@ +@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@ +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/verserangeparse.Po@am__quote@ + +.cpp.o: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ $< + +.cpp.obj: +@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ `$(CYGPATH_W) '$<'` +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Po +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.cpp.lo: +@am__fastdepCXX_TRUE@ $(LTCXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $< +@am__fastdepCXX_TRUE@ mv -f $(DEPDIR)/$*.Tpo $(DEPDIR)/$*.Plo +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCXX_FALSE@ $(LTCXXCOMPILE) -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; } \ + END { for (i in files) print i; }'`; \ + mkid -fID $$unique +tags: TAGS + +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; }'`; \ + if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$tags $$unique; \ + fi +ctags: CTAGS +CTAGS: $(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 "$(CTAGS_ARGS)$$tags$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_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 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 $(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_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(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 + -rm -rf ./$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +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 + +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 + +# 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/listoptions.cpp b/examples/cmdline/listoptions.cpp new file mode 100644 index 0000000..580695b --- /dev/null +++ b/examples/cmdline/listoptions.cpp @@ -0,0 +1,21 @@ +#include +#include + +using sword::SWMgr; +using sword::StringList; +using std::cout; + +int main(int argc, char **argv) +{ + SWMgr library; + + StringList options = library.getGlobalOptions(); + for (StringList::const_iterator it = options.begin(); it != options.end(); it++) { + cout << *it << " (" << library.getGlobalOptionTip(*it) << ")\n"; + StringList optionValues = library.getGlobalOptionValues(*it); + for (StringList::const_iterator it2 = optionValues.begin(); it2 != optionValues.end(); it2++) { + cout << "\t" << *it2 << "\n"; + } + } + return 0; +} diff --git a/examples/cmdline/lookup.cpp b/examples/cmdline/lookup.cpp new file mode 100644 index 0000000..481961b --- /dev/null +++ b/examples/cmdline/lookup.cpp @@ -0,0 +1,75 @@ +#include +#include +#include +#include +#include +#include + +using sword::SWMgr; +using sword::MarkupFilterMgr; +using sword::SWModule; +using sword::FMT_WEBIF; +using sword::FMT_HTMLHREF; +using sword::ModMap; +using sword::AttributeTypeList; +using sword::AttributeList; +using sword::AttributeValue; + +int main(int argc, char **argv) +{ + + SWMgr manager(new MarkupFilterMgr(FMT_WEBIF)); +// SWMgr manager(new MarkupFilterMgr(FMT_HTMLHREF)); + SWModule *target; + + if (argc != 3) { + fprintf(stderr, "\nusage: %s <\"lookup key\">\n" + "\tExample: lookup KJV \"James 1:19\"\n\n", argv[0]); + + exit(-1); + } + + target = manager.getModule(argv[1]); + if (!target) { + fprintf(stderr, "Could not find module [%s]. Available modules:\n", argv[1]); + ModMap::iterator it; + for (it = manager.Modules.begin(); it != manager.Modules.end(); it++) { + fprintf(stderr, "[%s]\t - %s\n", (*it).second->Name(), (*it).second->Description()); + } + exit(-1); + } + + // turn all filters to default values + manager.setGlobalOption("Headings", "On"); + manager.setGlobalOption("Strong's Numbers", "On"); + manager.setGlobalOption("Lemmas", "Off"); +// manager.setGlobalOption("Greek Accents", "Off"); + + target->setKey(argv[2]); + + target->RenderText(); // force an entry lookup to resolve key to something in the index + + std::cout << "==Raw=Entry===============\n"; + std::cout << target->getKeyText() << ":\n"; + std::cout << target->getRawEntry(); + std::cout << "\n"; + std::cout << "==Render=Entry============\n"; + std::cout << target->RenderText(); + 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..31a9ad9 --- /dev/null +++ b/examples/cmdline/search.cpp @@ -0,0 +1,97 @@ +#include +#include +#include +#include +#include +#include // GNU +#include + +#ifndef NO_SWORD_NAMESPACE +using namespace sword; +#endif + + /* + * >=0 - regex + * -1 - phrase + * -2 - multiword + * -3 - entryAttrib (eg. Word//Lemma/G1234/) + * -4 - Lucene + */ +char SEARCH_TYPE=-2; + +char printed = 0; +void percentUpdate(char percent, void *userData) { + char maxHashes = *((char *)userData); + + while ((((float)percent)/100) * maxHashes > printed) { + std::cerr << "="; + printed++; + std::cerr.flush(); + } +/* + std::cout << (int)percent << "% "; +*/ + std::cout.flush(); +} + + +int main(int argc, char **argv) +{ +// SWMgr manager(0, 0, true, new MarkupFilterMgr(FMT_RTF, ENC_RTF)); + SWMgr manager; + SWModule *target; + ListKey listkey; + ListKey scope; + VerseKey parser; + ModMap::iterator it; + + if ((argc < 3) || (argc > 5)) { + fprintf(stderr, "\nusage: %s <\"search string\"> [\"search_scope\"] [\"search again for string in previous result set\"]\n" + "\tExample: search KJV \"swift hear slow speak\"\n\n", argv[0]); + + exit(-1); + } + + + SWBuf searchTerm = argv[2]; + manager.setGlobalOption("Greek Accents", "Off"); + manager.setGlobalOption("Strong's Numbers", "On"); + manager.filterText("Greek Accents", searchTerm); + + 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 > 3) { // if min / max specified + scope = parser.ParseVerseList(argv[3], parser, true); + scope.Persist(1); + target->setKey(scope); + } + + std::cerr << "[0=================================50===============================100]\n "; + char lineLen = 70; + listkey = target->Search(searchTerm.c_str(), SEARCH_TYPE, /*SEARCHFLAG_MATCHWHOLEENTRY*/ REG_ICASE, 0, 0, &percentUpdate, &lineLen); + std::cerr << std::endl; + if (argc > 4) { // if min / max specified + scope = listkey; + scope.Persist(1); + target->setKey(scope); + printed = 0; + std::cerr << " "; + listkey = target->Search(argv[4], SEARCH_TYPE, /*SEARCHFLAG_MATCHWHOLEENTRY*/ REG_ICASE, 0, 0, &percentUpdate, &lineLen); + std::cerr << std::endl; + } + listkey.sort(); + 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..ce322a4 --- /dev/null +++ b/examples/cmdline/threaded_search.cpp @@ -0,0 +1,134 @@ +#include +#include +#include +#include // GNU +#include +#include +#include + +#include + +#ifndef NO_SWORD_NAMESPACE +using sword::SWMgr; +using sword::ListKey; +using sword::SWModule; +using sword::VerseKey; +using sword::SWKey; +using sword::ModMap; +#endif + +int cms_currentProgress; + +class SearchThread { +public: + SearchThread(); + ~SearchThread(); + + char* searchedText; + SWModule* module; + ListKey searchResult; + bool isSearching; + + void startThread(); + void search(); +}; + +void* dummy(void* p) { + SearchThread* searchThread = (SearchThread*)p; + searchThread->search(); + + return NULL; +} + +void percentUpdate(char percent, void* userData) { + cms_currentProgress = (int)percent; + std::cout << cms_currentProgress << "% "; +} + +SearchThread::SearchThread() { + isSearching = false; + module = 0; + searchedText = 0; + cms_currentProgress = -1; +} + +SearchThread::~SearchThread() { +} + +void SearchThread::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; + isSearching = true; + int i = pthread_create(thread, attr, &dummy, this); + + std::cout << "Created the thread: " << i << std::endl; + std::cout.flush(); +} + +void SearchThread::search() { + + if (!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; + + searchResult = module->Search(searchedText, -2, REG_ICASE, scope, 0, &percentUpdate); + + if (!scope) + std::cout << "bad scope!" << std::endl; + isSearching = false; +} + +int main(int argc, char **argv) { + SWMgr manager; + ModMap::iterator it; + + SearchThread* searchThread = new SearchThread(); + + if (argc != 3) { + fprintf(stderr, "usage: %s \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); + } + + searchThread->searchedText = argv[2]; + searchThread->module = (*it).second; + searchThread->startThread(); + + std::cout << "Start loop" << std::endl; + std::cout.flush(); + while (true) { + if (!searchThread->isSearching) + break; + else + std::cout.flush(); + }; + + std::cout << std::endl << "Number of found items: " << searchThread->searchResult.Count() << std::endl; + std::cout << "Finished program" << std::endl; + std::cout.flush(); + + delete searchThread; + exit(0); +} + diff --git a/examples/cmdline/verserangeparse.cpp b/examples/cmdline/verserangeparse.cpp new file mode 100644 index 0000000..544a7b0 --- /dev/null +++ b/examples/cmdline/verserangeparse.cpp @@ -0,0 +1,69 @@ +/****************************************************************** + * This example shows: + * How to parse a verse reference + * How to persist a custom range key in a book + */ + +#include +#include +#include +#include +#include +#include + +using sword::SWMgr; +using sword::VerseKey; +using sword::ListKey; +using sword::SWModule; +using sword::SW_POSITION; +using sword::FMT_PLAIN; +using sword::MarkupFilterMgr; +using std::cout; +using std::endl; + +int main(int argc, char **argv) +{ + const char *range = (argc > 1) ? argv[1] : "Mat 2:10,12-15"; + + VerseKey parser; + ListKey result; + + result = parser.ParseVerseList(range, parser, true); + // let's iterate the key and display + for (result = TOP; !result.Error(); result++) { + cout << result << "\n"; + } + cout << endl; + + // Now if we'd like persist this key for use inside of a book... + result.Persist(true); + + // Let's get a book; + SWMgr library(new MarkupFilterMgr(FMT_PLAIN)); // render plain without fancy markup + SWModule *book = library.getModule("KJV"); + + // and set our limited key inside + book->setKey(result); + + // now let's iterate the book and display + for ((*book) = TOP; !book->Error(); (*book)++) { + cout << "*** " << book->getKeyText() << ": " << book->RenderText() << "\n"; + } + + // since we've told our result key to persist in book, we can reuse our + // setup by simply resetting result, e.g. + // + // result = parser.ParseVerseList(someNewRange, parser, true); + // + // now an iteration of book will give us our new range. + // + // to stop persistence of our custom key, we'll need to set our book's key + // to something simple: + // + // book->setKey("gen.1.1"); + // + // this allows book to create and use an instance of its preferred key type + // + + return 0; +} diff --git a/examples/simple.cpp b/examples/simple.cpp new file mode 100644 index 0000000..33a6f22 --- /dev/null +++ b/examples/simple.cpp @@ -0,0 +1,33 @@ +/****************************************************************************** + * This is about the simplest useful example of using the sword engine. + * + * After sword is installed, it should compile with something similar to: + * + * g++ -o simple simple.cpp `pkg-config --cflags --libs sword` + * + * If you'd like to choose the type of tag markup which sword will output + * for you, include: + * + * #include + * + * and change your instantiation of SWMgr, below, to (e.g., for HTML): + * + * SWMgr library(0, 0, true, new MarkupFilterMgr(FMT_HTMLHREF)); + * + */ + +#include +#include +#include + +using namespace sword; +using std::cout; + +int main(int argc, char **argv) { + SWMgr library; + SWModule *darby = library.getModule("Darby"); + darby->setKey("James 1:19"); + cout << darby->RenderText(); + + return 0; +} -- cgit v1.2.3