diff --git a/src/aspell/Makefile b/src/aspell/Makefile deleted file mode 100644 index 598acfca..00000000 --- a/src/aspell/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -PROGS = rclaspell -all: $(PROGS) - -RCLASPELL_OBJS= trrclaspell.o -rclaspell : $(RCLASPELL_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o rclaspell $(RCLASPELL_OBJS) \ - $(LIBRECOLL) -trrclaspell.o : rclaspell.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_RCLASPELL -c -o trrclaspell.o \ - rclaspell.cpp - -include ../utils/utmkdefs.mk diff --git a/src/bincimapmime/Makefile b/src/bincimapmime/Makefile deleted file mode 100644 index 218b1d52..00000000 --- a/src/bincimapmime/Makefile +++ /dev/null @@ -1,11 +0,0 @@ -PROGS = trbinc -all: $(PROGS) - -TRBINCOBJS = trbinc.o -trbinc: trbinc.o - $(CXX) -o trbinc trbinc.o $(LIBRECOLL) - -trbinc.o: trbinc.cc - $(CXX) $(ALL_CXXFLAGS) -c -o trbinc.o trbinc.cc - -include ../utils/utmkdefs.mk diff --git a/src/common/Makefile b/src/common/Makefile deleted file mode 100644 index c30268bc..00000000 --- a/src/common/Makefile +++ /dev/null @@ -1,33 +0,0 @@ - -PROGS = unacpp textsplit rclconfig syngroups - -all: $(PROGS) - -UNACPP_OBJS= trunacpp.o -unacpp : $(UNACPP_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o unacpp $(UNACPP_OBJS) $(LIBRECOLL) -trunacpp.o : unacpp.cpp unacpp.h - $(CXX) $(ALL_CXXFLAGS) -DTEST_UNACPP -c -o trunacpp.o unacpp.cpp - -TEXTSPLIT_OBJS= trtextsplit.o -textsplit : $(TEXTSPLIT_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o textsplit $(TEXTSPLIT_OBJS) $(LIBRECOLL) -trtextsplit.o : textsplit.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_TEXTSPLIT -c -o trtextsplit.o \ - textsplit.cpp - -RCLCONFIG_OBJS= trrclconfig.o -rclconfig : $(RCLCONFIG_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o rclconfig $(RCLCONFIG_OBJS) $(LIBRECOLL) -trrclconfig.o : rclconfig.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_RCLCONFIG -c -o trrclconfig.o \ - rclconfig.cpp - -SYNGROUPS_OBJS= trsyngroups.o -syngroups : $(SYNGROUPS_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o syngroups $(SYNGROUPS_OBJS) $(LIBRECOLL) -trsyngroups.o : syngroups.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_SYNGROUPS -c -o trsyngroups.o \ - syngroups.cpp - -include ../utils/utmkdefs.mk diff --git a/src/internfile/Makefile b/src/internfile/Makefile deleted file mode 100644 index 8520ef50..00000000 --- a/src/internfile/Makefile +++ /dev/null @@ -1,20 +0,0 @@ -PROGS = mh_mbox internfile - -all: $(PROGS) - -INTERNFILE_OBJS= trinternfile.o -internfile : $(INTERNFILE_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o internfile $(INTERNFILE_OBJS) $(LIBRECOLL) -trinternfile.o : internfile.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_INTERNFILE -c -o trinternfile.o \ - internfile.cpp - -MH_MBOX_OBJS= trmh_mbox.o $(BIGLIB) -mh_mbox : $(MH_MBOX_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o mh_mbox $(MH_MBOX_OBJS) $(LIBRECOLL) -trmh_mbox.o : mh_mbox.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_MH_MBOX -c -o trmh_mbox.o \ - mh_mbox.cpp - -include ../utils/utmkdefs.mk - diff --git a/src/rcldb/Makefile b/src/rcldb/Makefile deleted file mode 100644 index 20ab6b30..00000000 --- a/src/rcldb/Makefile +++ /dev/null @@ -1,21 +0,0 @@ -PROGS = synfamily stoplist - -all: $(PROGS) - -STOPLIST_OBJS= trstoplist.o -stoplist : $(STOPLIST_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o stoplist $(STOPLIST_OBJS) $(LIBRECOLL) -trstoplist.o : stoplist.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_STOPLIST -c -o trstoplist.o \ - stoplist.cpp - -SYNFAMILY_OBJS= trsynfamily.o -synfamily : $(SYNFAMILY_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o synfamily $(SYNFAMILY_OBJS) \ - $(LIBRECOLL) -lxapian - -trsynfamily.o : synfamily.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_SYNFAMILY -c -o trsynfamily.o \ - synfamily.cpp - -include ../utils/utmkdefs.mk diff --git a/src/rcldb/stoplist.cpp b/src/rcldb/stoplist.cpp index e000a1b9..e603441b 100644 --- a/src/rcldb/stoplist.cpp +++ b/src/rcldb/stoplist.cpp @@ -15,104 +15,44 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. */ -#ifndef TEST_STOPLIST #include "log.h" #include "readfile.h" #include "unacpp.h" #include "smallut.h" #include "stoplist.h" -#ifndef NO_NAMESPACES namespace Rcl { -#endif bool StopList::setFile(const string &filename) { m_stops.clear(); string stoptext, reason; if (!file_to_string(filename, stoptext, &reason)) { - LOGDEB0("StopList::StopList: file_to_string(" << (filename) << ") failed: " << (reason) << "\n" ); - return false; + LOGDEB0("StopList::StopList: file_to_string(" << filename << + ") failed: " << reason << "\n"); + return false; } set stops; stringToStrings(stoptext, stops); for (set::iterator it = stops.begin(); - it != stops.end(); it++) { - string dterm; - unacmaybefold(*it, dterm, "UTF-8", UNACOP_UNACFOLD); - m_stops.insert(dterm); + it != stops.end(); it++) { + string dterm; + unacmaybefold(*it, dterm, "UTF-8", UNACOP_UNACFOLD); + m_stops.insert(dterm); } return true; } // Most sites will have an empty stop list. We try to optimize the -// empty set case as much as possible. empty() is probably sligtly faster than -// find() in this case. +// empty set case as much as possible. empty() is probably sligtly +// faster than find() in this case. bool StopList::isStop(const string &term) const { return m_stops.empty() ? false : m_stops.find(term) != m_stops.end(); } - -#ifndef NO_NAMESPACES -} -#endif - -#else // TEST_STOPLIST - -#include -#include -#include -#include -#include - -#include -#include - -#include "stoplist.h" - -using namespace std; -using namespace Rcl; - -static char *thisprog; - -static char usage [] = -"trstoplist stopstermsfile\n\n" -; -static void -Usage(void) -{ - fprintf(stderr, "%s: usage:\n%s", thisprog, usage); - exit(1); } -const string tstwords[] = { - "the", "is", "xweird", "autre", "autre double", "mot1", "mot double", -}; -const int tstsz = sizeof(tstwords) / sizeof(string); - -int main(int argc, char **argv) -{ - int count = 10; - - thisprog = argv[0]; - argc--; argv++; - - if (argc != 1) - Usage(); - string filename = argv[0]; argc--; - - StopList sl(filename); - - for (int i = 0; i < tstsz; i++) { - const string &tst = tstwords[i]; - cout << "[" << tst << "] " << - (sl.isStop(tst) ? "in stop list" : "not in stop list") << endl; - } - exit(0); -} - -#endif // TEST_STOPLIST diff --git a/src/testmains/trstoplist.cpp b/src/testmains/trstoplist.cpp new file mode 100644 index 00000000..e011e763 --- /dev/null +++ b/src/testmains/trstoplist.cpp @@ -0,0 +1,70 @@ +/* Copyright (C) 2017-2019 J.F.Dockes + * + * License: GPL 2.1 + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + */ +#include +#include +#include +#include +#include + +#include +#include + +#include "stoplist.h" + +using namespace std; +using namespace Rcl; + +static char *thisprog; + +static char usage [] = + "trstoplist stopstermsfile\n\n" + ; +static void +Usage(void) +{ + fprintf(stderr, "%s: usage:\n%s", thisprog, usage); + exit(1); +} + +const string tstwords[] = { + "the", "is", "xweird", "autre", "autre double", "mot1", "mot double", +}; +const int tstsz = sizeof(tstwords) / sizeof(string); + +int main(int argc, char **argv) +{ + int count = 10; + + thisprog = argv[0]; + argc--; argv++; + + if (argc != 1) + Usage(); + string filename = argv[0]; argc--; + + StopList sl(filename); + + for (int i = 0; i < tstsz; i++) { + const string &tst = tstwords[i]; + cout << "[" << tst << "] " << + (sl.isStop(tst) ? "in stop list" : "not in stop list") << endl; + } + exit(0); +} diff --git a/src/utils/Makefile b/src/utils/Makefile deleted file mode 100644 index fbeda035..00000000 --- a/src/utils/Makefile +++ /dev/null @@ -1,171 +0,0 @@ - -include ../utils/utmkdefs.mk - -PROGS = pxattr trclosefrom trecrontab \ - trnetcon trcopyfile trcircache trmd5 trreadfile trfileudi \ - trconftree wipedir smallut trfstreewalk trpathut transcode trbase64 \ - trmimeparse trexecmd utf8iter idfile workqueue trappformime - -all: $(PROGS) - -PXATTROBJS = trpxattr.o pxattr.o -pxattr: $(PXATTROBJS) - $(CXX) -o pxattr $(PXATTROBJS) -trpxattr.o : pxattr.cpp - $(CXX) -c $(CXXFLAGS) -DTEST_PXATTR -o $@ pxattr.cpp - -CHRONOOBJS = trchrono.o chrono.o -trchrono: $(CHRONOOBJS) - $(CXX) -o chrono $(CHRONOOBJS) -trchrono.o : chrono.cpp - $(CXX) -c $(CXXFLAGS) -DTEST_CHRONO -o $@ chrono.cpp - -WORKQUEUEOBJS = workqueue.o -workqueue: $(WORKQUEUEOBJS) - $(CXX) -o workqueue $(WORKQUEUEOBJS) $(LIBRECOLL) -lpthread -workqueue.o : workqueue.cpp - $(CXX) -c $(CXXFLAGS) -o $@ $< - -ECRONTAB_OBJS= trecrontab.o -trecrontab : $(ECRONTAB_OBJS) - $(CXX) -o trecrontab $(ECRONTAB_OBJS) $(LIBRECOLL) -trecrontab.o : ecrontab.cpp ecrontab.h - $(CXX) -o trecrontab.o -c $(ALL_CXXFLAGS) \ - -DTEST_ECRONTAB ecrontab.cpp - -CLOSEFROM_OBJS= trclosefrom.o -trclosefrom : $(CLOSEFROM_OBJS) - $(CXX) -o trclosefrom $(CLOSEFROM_OBJS) $(LIBRECOLL) -trclosefrom.o : closefrom.cpp closefrom.h - $(CXX) -o trclosefrom.o -c $(ALL_CXXFLAGS) \ - -DTEST_CLOSEFROM closefrom.cpp - -FSTREEWALK_OBJS= trfstreewalk.o -trfstreewalk : $(FSTREEWALK_OBJS) - $(CXX) -o trfstreewalk $(FSTREEWALK_OBJS) $(LIBRECOLL) -trfstreewalk.o : fstreewalk.cpp fstreewalk.h - $(CXX) -o trfstreewalk.o -c $(ALL_CXXFLAGS) \ - -DTEST_FSTREEWALK fstreewalk.cpp - -APPFORMIME_OBJS= trappformime.o -trappformime : $(APPFORMIME_OBJS) - $(CXX) -o trappformime $(APPFORMIME_OBJS) $(LIBRECOLL) -trappformime.o : appformime.cpp - $(CXX) -o trappformime.o -c $(ALL_CXXFLAGS) \ - -DTEST_APPFORMIME appformime.cpp - -READFILE_OBJS= trreadfile.o -trreadfile : $(READFILE_OBJS) - $(CXX) -o trreadfile $(READFILE_OBJS) $(LIBRECOLL) -trreadfile.o : readfile.cpp readfile.h - $(CXX) -o trreadfile.o -c $(ALL_CXXFLAGS) \ - -DTEST_READFILE readfile.cpp - -CPUCONF_OBJS= trcpuconf.o -trcpuconf : $(CPUCONF_OBJS) - $(CXX) -o trcpuconf $(CPUCONF_OBJS) $(LIBRECOLL) -trcpuconf.o : cpuconf.cpp cpuconf.h - $(CXX) -o trcpuconf.o -c $(ALL_CXXFLAGS) -DTEST_CPUCONF cpuconf.cpp - -CIRCACHE_OBJS= trcircache.o -trcircache : $(CIRCACHE_OBJS) - $(CXX) -o trcircache $(CIRCACHE_OBJS) $(LIBRECOLL) -trcircache.o : circache.cpp circache.h - $(CXX) -o trcircache.o -c $(ALL_CXXFLAGS) \ - -DTEST_CIRCACHE circache.cpp - -COPYFILE_OBJS= trcopyfile.o -trcopyfile : $(COPYFILE_OBJS) - $(CXX) -o trcopyfile $(COPYFILE_OBJS) $(LIBRECOLL) -trcopyfile.o : copyfile.cpp copyfile.h - $(CXX) -o trcopyfile.o -c $(ALL_CXXFLAGS) \ - -DTEST_COPYFILE copyfile.cpp - -MD5_OBJS= trmd5.o -trmd5 : $(MD5_OBJS) - $(CXX) -o trmd5 $(MD5_OBJS) $(LIBRECOLL) -trmd5.o : md5ut.cpp md5ut.h md5.h - $(CXX) -o trmd5.o -c $(ALL_CXXFLAGS) -DTEST_MD5 md5ut.cpp - -PATHUT_OBJS= trpathut.o -trpathut : $(PATHUT_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o trpathut $(PATHUT_OBJS) $(LIBRECOLL) -trpathut.o : pathut.cpp pathut.h - $(CXX) -o trpathut.o -c $(ALL_CXXFLAGS) -DTEST_PATHUT pathut.cpp - -NETCON_OBJS= trnetcon.o -trnetcon : $(NETCON_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o trnetcon $(NETCON_OBJS) \ - $(LIBRECOLL) $(LIBICONV) $(LIBSYS) -trnetcon.o : netcon.cpp netcon.h - $(CXX) -o trnetcon.o -c $(ALL_CXXFLAGS) -DTEST_NETCON netcon.cpp - -FILEUDI_OBJS= trfileudi.o -trfileudi : $(FILEUDI_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o trfileudi $(FILEUDI_OBJS) $(LIBRECOLL) -trfileudi.o : fileudi.cpp fileudi.h - $(CXX) -o trfileudi.o -c $(ALL_CXXFLAGS) -DTEST_FILEUDI fileudi.cpp - -EXECMD_OBJS= trexecmd.o -trexecmd : $(EXECMD_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o trexecmd $(EXECMD_OBJS) $(LIBRECOLL) -trexecmd.o : trexecmd.cpp execmd.h - $(CXX) -o trexecmd.o -c $(ALL_CXXFLAGS) -I../xaposix trexecmd.cpp - -TRANSCODE_OBJS= trtranscode.o -transcode : $(TRANSCODE_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o transcode $(TRANSCODE_OBJS) $(LIBRECOLL) -trtranscode.o : transcode.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_TRANSCODE -c -o trtranscode.o \ - transcode.cpp - -IDFILE_OBJS= tridfile.o -idfile : $(IDFILE_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o idfile $(IDFILE_OBJS) $(LIBRECOLL) -tridfile.o : idfile.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_IDFILE -c -o tridfile.o idfile.cpp - -MIMEPARSE_OBJS= trmimeparse.o -trmimeparse : $(MIMEPARSE_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o trmimeparse $(MIMEPARSE_OBJS) $(LIBRECOLL) -trmimeparse.o : mimeparse.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_MIMEPARSE -c -o trmimeparse.o \ - mimeparse.cpp - -SMALLUT_OBJS= trsmallut.o -smallut : $(SMALLUT_OBJS) smallut.h - $(CXX) $(ALL_CXXFLAGS) -o smallut $(SMALLUT_OBJS) $(LIBRECOLL) -trsmallut.o : smallut.cpp smallut.h - $(CXX) $(ALL_CXXFLAGS) -DTEST_SMALLUT -c -o trsmallut.o smallut.cpp - -WIPEDIR_OBJS= trwipedir.o -wipedir : $(WIPEDIR_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o wipedir $(WIPEDIR_OBJS) $(LIBRECOLL) -trwipedir.o : wipedir.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_WIPEDIR -c -o trwipedir.o wipedir.cpp - -UTF8ITER_OBJS= trutf8iter.o -utf8iter : $(UTF8ITER_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o utf8iter $(UTF8ITER_OBJS) $(LIBRECOLL) -trutf8iter.o : utf8iter.cpp utf8iter.h - $(CXX) $(ALL_CXXFLAGS) -DTEST_UTF8ITER -c -o trutf8iter.o utf8iter.cpp - -CONFTREE_OBJS= trconftree.o -trconftree : $(CONFTREE_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o trconftree $(CONFTREE_OBJS) $(LIBRECOLL) -trconftree.o : conftree.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_CONFTREE -c -o trconftree.o conftree.cpp - -BASE64_OBJS= trbase64.o -trbase64 : $(BASE64_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o trbase64 $(BASE64_OBJS) $(LIBRECOLL) -trbase64.o : base64.cpp - $(CXX) $(ALL_CXXFLAGS) -DTEST_BASE64 -c -o trbase64.o base64.cpp - -X11MON_OBJS= trx11mon.o x11mon.o -trx11mon : $(X11MON_OBJS) - $(CXX) $(ALL_CXXFLAGS) -o trx11mon $(X11MON_OBJS) -L/usr/X11R6/lib -lX11 -trx11mon.o : x11mon.cpp x11mon.h - $(CXX) -o trx11mon.o -c $(ALL_CXXFLAGS) -DTEST_X11MON x11mon.cpp -x11mon.o: x11mon.cpp - $(CXX) -c -I/usr/X11R6/include $(ALL_CXXFLAGS) x11mon.cpp diff --git a/src/utils/utmkdefs.mk b/src/utils/utmkdefs.mk deleted file mode 100644 index bf1b8a19..00000000 --- a/src/utils/utmkdefs.mk +++ /dev/null @@ -1,13 +0,0 @@ -ALL_CXXFLAGS = -std=c++11 \ - -I../aspell \ - -I../bincimapmime \ - -I../common \ - -I../index \ - -I../internfile \ - -I../rcldb \ - -I../unac \ - -I../utils -LIBRECOLL = -L../.libs -lrecoll -Wl,-rpath=$(shell pwd)/../.libs - -clean: - rm -f $(PROGS) *.o