[sword-svn] r2214 - in trunk: bindings/corba/java/src/org/crosswire/sword/orb examples/cmdline include src/mgr src/modules src/modules/texts tests

scribe at www.crosswire.org scribe at www.crosswire.org
Fri Dec 12 16:41:37 MST 2008


Author: scribe
Date: 2008-12-12 16:41:36 -0700 (Fri, 12 Dec 2008)
New Revision: 2214

Modified:
   trunk/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java
   trunk/examples/cmdline/search.cpp
   trunk/include/config.h
   trunk/include/ftptrans.h
   trunk/include/installmgr.h
   trunk/src/mgr/curlftpt.cpp
   trunk/src/mgr/ftplibftpt.cpp
   trunk/src/mgr/ftptrans.cpp
   trunk/src/mgr/installmgr.cpp
   trunk/src/modules/swmodule.cpp
   trunk/src/modules/texts/swtext.cpp
   trunk/tests/keytest.cpp
   trunk/tests/lextest.cpp
   trunk/tests/versekeytest.cpp
Log:
Added ability to allow username/passwd 
Added beginnings of new search type
Added beginnings of master repo list
Added specific corba version which didn't fix a bug. keep trying here
updated some tests... need fix for final tests


Modified: trunk/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java
===================================================================
--- trunk/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/bindings/corba/java/src/org/crosswire/sword/orb/SwordOrb.java	2008-12-12 23:41:36 UTC (rev 2214)
@@ -34,7 +34,7 @@
 		p.setProperty("com.sun.CORBA.codeset.wcharsets", "0x00010109, 0x05010001");    // UTF-16, UTF-8
 	}
 
-	static org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(new String[]{}, p);
+	static org.omg.CORBA.ORB orb = org.omg.CORBA_2_3.ORB.init(new String[]{}, p);
 	static Hashtable clients = new Hashtable();
 	String ior = null;
 	String remoteAddr = null;

Modified: trunk/examples/cmdline/search.cpp
===================================================================
--- trunk/examples/cmdline/search.cpp	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/examples/cmdline/search.cpp	2008-12-12 23:41:36 UTC (rev 2214)
@@ -17,7 +17,7 @@
 	 *			-3  - entryAttrib (eg. Word//Lemma/G1234/)
 	 *			-4  - Lucene
    */
-char SEARCH_TYPE=-4;
+char SEARCH_TYPE=-2;
 
 char printed = 0;
 void percentUpdate(char percent, void *userData) {

Modified: trunk/include/config.h
===================================================================
--- trunk/include/config.h	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/include/config.h	2008-12-12 23:41:36 UTC (rev 2214)
@@ -1,6 +1,9 @@
 /* include/config.h.  Generated from config.h.in by configure.  */
 /* include/config.h.in.  Generated from configure.ac by autoheader.  */
 
+/* Define if building universal (internal helper macro) */
+/* #undef AC_APPLE_UNIVERSAL_BUILD */
+
 /* Define to 1 if you have the <dlfcn.h> header file. */
 #define HAVE_DLFCN_H 1
 
@@ -61,6 +64,14 @@
 /* Version number of package */
 #define VERSION "1.5.11"
 
-/* Define to 1 if your processor stores words with the most significant byte
-   first (like Motorola and SPARC, unlike Intel and VAX). */
-/* #undef WORDS_BIGENDIAN */
+/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
+   significant byte first (like Motorola and SPARC, unlike Intel). */
+#if defined AC_APPLE_UNIVERSAL_BUILD
+# if defined __BIG_ENDIAN__
+#  define WORDS_BIGENDIAN 1
+# endif
+#else
+# ifndef WORDS_BIGENDIAN
+/* #  undef WORDS_BIGENDIAN */
+# endif
+#endif

Modified: trunk/include/ftptrans.h
===================================================================
--- trunk/include/ftptrans.h	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/include/ftptrans.h	2008-12-12 23:41:36 UTC (rev 2214)
@@ -38,6 +38,8 @@
 	bool passive;
 	bool term;
 	SWBuf host;
+	SWBuf u;
+	SWBuf p;
 	
 public:
 	FTPTransport(const char *host, StatusReporter *statusReporter = 0);
@@ -55,6 +57,8 @@
 
 	virtual std::vector<struct DirEntry> getDirList(const char *dirURL);
 	void setPassive(bool passive) { this->passive = passive; }
+	void setUser(const char *user) { u = user; }
+	void setPasswd(const char *passwd) { p = passwd; }
 	void terminate() { term = true; }
 };
 

Modified: trunk/include/installmgr.h
===================================================================
--- trunk/include/installmgr.h	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/include/installmgr.h	2008-12-12 23:41:36 UTC (rev 2214)
@@ -22,12 +22,15 @@
 	InstallSource(const char *type, const char *confEnt = 0);
 	virtual ~InstallSource();
 	SWBuf getConfEnt() {
-		return caption +"|" + source + "|" + directory;
+		return caption +"|" + source + "|" + directory + "|" + u + "|" + p;
 	}
-	SWBuf type;
+	SWBuf caption;
 	SWBuf source;
 	SWBuf directory;
-	SWBuf caption;
+	SWBuf u;
+	SWBuf p;
+
+	SWBuf type;
 	SWBuf localShadow;
 	void *userData;
 	SWMgr *getMgr();
@@ -46,6 +49,7 @@
 	char *privatePath;
 	StatusReporter *statusReporter;
 	bool passive;
+	SWBuf u, p;
 	
 	// override this method and provide your own custom FTPTransport subclass
 	virtual FTPTransport *createFTPTransport(const char *host, StatusReporter *statusReporter);
@@ -67,7 +71,7 @@
 	InstallSourceMap sources;
 	bool term;
 
-	InstallMgr(const char *privatePath = "./", StatusReporter *statusReporter = 0);
+	InstallMgr(const char *privatePath = "./", StatusReporter *statusReporter = 0, SWBuf u="ftp", SWBuf p="installmgr at user.com");
 	virtual ~InstallMgr();
 
 	virtual int removeModule(SWMgr *manager, const char *modName);

Modified: trunk/src/mgr/curlftpt.cpp
===================================================================
--- trunk/src/mgr/curlftpt.cpp	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/src/mgr/curlftpt.cpp	2008-12-12 23:41:36 UTC (rev 2214)
@@ -109,7 +109,8 @@
 	if (session) {
 		curl_easy_setopt(session, CURLOPT_URL, sourceURL);
 	
-		curl_easy_setopt(session, CURLOPT_USERPWD, "ftp:installmgr at user.com");
+		SWBuf credentials = u + ":" + p;
+		curl_easy_setopt(session, CURLOPT_USERPWD, credentials.c_str());
 		curl_easy_setopt(session, CURLOPT_WRITEFUNCTION, my_fwrite);
 		if (!passive)
 			curl_easy_setopt(session, CURLOPT_FTPPORT, "-");

Modified: trunk/src/mgr/ftplibftpt.cpp
===================================================================
--- trunk/src/mgr/ftplibftpt.cpp	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/src/mgr/ftplibftpt.cpp	2008-12-12 23:41:36 UTC (rev 2214)
@@ -43,7 +43,7 @@
 	if (ftpConnection == 0) {
 		SWLog::getSystemLog()->logDebug("connecting to host %s\n", host.c_str());
 		if (FtpConnect(host, &ftpConnection))
-			if (FtpLogin("anonymous", "installmgr at user.com", ftpConnection)) {
+			if (FtpLogin(u.c_str(), p.c_str(), ftpConnection)) {
 				retVal = 0;
 			}
 			else {

Modified: trunk/src/mgr/ftptrans.cpp
===================================================================
--- trunk/src/mgr/ftptrans.cpp	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/src/mgr/ftptrans.cpp	2008-12-12 23:41:36 UTC (rev 2214)
@@ -40,6 +40,8 @@
 FTPTransport::FTPTransport(const char *host, StatusReporter *statusReporter) {
 	this->statusReporter = statusReporter;
 	this->host = host;
+	u = "ftp";
+	p = "installmgr at user.com";
 	term = false;
 }
 

Modified: trunk/src/mgr/installmgr.cpp
===================================================================
--- trunk/src/mgr/installmgr.cpp	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/src/mgr/installmgr.cpp	2008-12-12 23:41:36 UTC (rev 2214)
@@ -43,6 +43,8 @@
 		buf.size(len-1);
 }
 
+const char *crosswireMasterRepoList = "http://crosswire.org/repos.conf";
+
 };
 
 
@@ -69,8 +71,11 @@
 
 
 
-InstallMgr::InstallMgr(const char *privatePath, StatusReporter *sr) {
+InstallMgr::InstallMgr(const char *privatePath, StatusReporter *sr, SWBuf u, SWBuf p) {
+	userDisclaimerConfirmed = false;
 	statusReporter = sr;
+	this->u = u;
+	this->p = p;
 	this->privatePath = 0;
 	this->transport = 0;
 	stdstr(&(this->privatePath), privatePath);
@@ -204,6 +209,14 @@
 	int retVal = 0;
 	FTPTransport *trans = createFTPTransport(is->source, statusReporter);
 	transport = trans; // set classwide current transport for other thread terminate() call
+	if (is->u.length()) {
+		trans->setUser(is->u);
+		trans->setPasswd(is->p);
+	}
+	else {
+		trans->setUser(u);
+		trans->setPasswd(p);
+	}
 	trans->setPassive(passive);
 	
 	SWBuf urlPrefix = (SWBuf)"ftp://" + is->source;
@@ -536,6 +549,23 @@
 }
 
 
+/************************************************************************
+ * refreshRemoteSourceConfiguration - grab master list of know remote
+ * 	sources and integrate it with our configurations.
+ */
+int InstallMgr::refreshRemoteSourceConfiguration() {
+	// TODO: something
+	// 	well a litte more specific:
+	// 	add hash YYYYMMDDHHMMSSUU to each entry and use this
+	// 	for dir name
+	// 	master list should be commands like:
+	// 	YYYYMMDDHHMMSSUU=delete
+	// 	YYYYMMDDHHMMSSUU=FTPSource=...
+	// 	YYYYMMDDHHMMSSUU=delete
+	//
+}
+
+
 InstallSource::InstallSource(const char *type, const char *confEnt) {
 	this->type = type;
 	mgr = 0;
@@ -548,6 +578,8 @@
 		source = strtok(0, "|");
 		directory = strtok(0, "|");
 		removeTrailingSlash(directory);
+		u = strtok(0, "|");
+		p = strtok(0, "|");
 		delete [] buf;
 	}
 }

Modified: trunk/src/modules/swmodule.cpp
===================================================================
--- trunk/src/modules/swmodule.cpp	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/src/modules/swmodule.cpp	2008-12-12 23:41:36 UTC (rev 2214)
@@ -398,6 +398,7 @@
  *				-2  - multiword
  *				-3  - entryAttrib (eg. Word//Lemma/G1234/)
  *				-4  - clucene
+ *				-5  - multilemma window; flags = window size
  * 	flags		- options flags for search
  *	justCheckIfSupported	- if set, don't search, only tell if this
  *							function supports requested search.
@@ -432,6 +433,7 @@
 	SWKey *resultKey = CreateKey();
 	regex_t preg;
 	vector<SWBuf> words;
+	vector<SWBuf> window;
 	const char *sres;
 	terminateSearch = false;
 	char perc = 1;
@@ -541,6 +543,7 @@
 
 	// multi-word
 	case -2:
+	case -5:
 		// let's break the term down into our words vector
 		while (1) {
 			const char *word = term.stripPrefix(' ');
@@ -577,7 +580,7 @@
 	(*percent)(perc, percentUserData);
 
 	
-	while ((searchType > -4) && !Error() && !terminateSearch) {
+	while ((searchType != -4) && !Error() && !terminateSearch) {
 		long mindex = key->Index();
 		float per = (float)mindex / highIndex;
 		per *= 93;
@@ -649,7 +652,7 @@
 				} break;
 
 			// entry attributes
-			case -3:
+			case -3: {
 				RenderText();	// force parse
 				AttributeTypeList &entryAttribs = getEntryAttributes();
 				AttributeTypeList::iterator i1Start, i1End;
@@ -712,6 +715,54 @@
 						break;
 				}
 				break;
+			}
+			case -5:
+				AttributeList &words = getEntryAttributes()["Word"];
+				SWBuf kjvWord = "";
+				SWBuf bibWord = "";
+				for (AttributeList::iterator it = words.begin(); it != words.end(); it++) {
+					int parts = atoi(it->second["PartCount"]);
+					SWBuf lemma = "";
+					SWBuf morph = "";
+					for (int i = 1; i <= parts; i++) {
+						SWBuf key = "";
+						key = (parts == 1) ? "Lemma" : SWBuf().setFormatted("Lemma.%d", i);
+						AttributeValue::iterator li = it->second.find(key);
+						if (li != it->second.end()) {
+							if (i > 1) lemma += " ";
+							key = (parts == 1) ? "LemmaClass" : SWBuf().setFormatted("LemmaClass.%d", i);
+							AttributeValue::iterator lci = it->second.find(key);
+							if (lci != it->second.end()) {
+								lemma += lci->second + ":";
+							}
+							lemma += li->second;
+						}
+						key = (parts == 1) ? "Morph" : SWBuf().setFormatted("Morph.%d", i);
+						li = it->second.find(key);
+						// silly.  sometimes morph counts don't equal lemma counts
+						if (i == 1 && parts != 1 && li == it->second.end()) {
+							li = it->second.find("Morph");
+						}
+						if (li != it->second.end()) {
+							if (i > 1) morph += " ";
+							key = (parts == 1) ? "MorphClass" : SWBuf().setFormatted("MorphClass.%d", i);
+							AttributeValue::iterator lci = it->second.find(key);
+							// silly.  sometimes morph counts don't equal lemma counts
+							if (i == 1 && parts != 1 && lci == it->second.end()) {
+								lci = it->second.find("MorphClass");
+							}
+							if (lci != it->second.end()) {
+								morph += lci->second + ":";
+							}
+							morph += li->second;
+						}
+						// TODO: add src tags and maybe other attributes
+					}
+					while (window.size() < (unsigned)flags) {
+						
+					}
+				}
+				break;
 			} // end switch
 		}
 		(*this)++;

Modified: trunk/src/modules/texts/swtext.cpp
===================================================================
--- trunk/src/modules/texts/swtext.cpp	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/src/modules/texts/swtext.cpp	2008-12-12 23:41:36 UTC (rev 2214)
@@ -39,7 +39,15 @@
  */
 
 SWKey *SWText::CreateKey() {
-	return new VerseKey();
+	VerseKey *vk = new VerseKey();
+
+// TODO: put this config check somewhere once
+//	SWBuf versif = getConfigEntry("Versification");
+//
+//	if (versif.length() > 0)
+//	vk->setVersificationSystem(versif);
+//
+	return vk;
 }
 
 

Modified: trunk/tests/keytest.cpp
===================================================================
--- trunk/tests/keytest.cpp	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/tests/keytest.cpp	2008-12-12 23:41:36 UTC (rev 2214)
@@ -17,6 +17,8 @@
 	int loop;
 	int max;
 
+	VerseKey yo("Gen.1.1", "Gen.1.2");
+	std::cout << yo.getRangeText();
 	if (argc > 1)
 		LocaleMgr::getSystemLocaleMgr()->setDefaultLocaleName(argv[1]);
 

Modified: trunk/tests/lextest.cpp
===================================================================
--- trunk/tests/lextest.cpp	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/tests/lextest.cpp	2008-12-12 23:41:36 UTC (rev 2214)
@@ -3,6 +3,8 @@
 #ifndef NO_SWORD_NAMESPACE
 using namespace sword;
 #endif
+using std::cout;
+using std::endl;
 
 int main(int argc, char **argv)
 {
@@ -10,11 +12,16 @@
 	RawLD lex("tmp/lextest");
 
 	lex.setKey("b");
-	lex << "x";
+	lex << "entry for b";
 
 	lex.setKey("a");
-	lex << "x";
+	lex << "entry for a";
 
+	lex = TOP;
+	cout << lex.getKeyText() << endl;
+	lex++;
+	cout << lex.getKeyText() << endl;
+
 	lex.setKey("a");
 	lex.deleteEntry();
 

Modified: trunk/tests/versekeytest.cpp
===================================================================
--- trunk/tests/versekeytest.cpp	2008-12-02 17:24:46 UTC (rev 2213)
+++ trunk/tests/versekeytest.cpp	2008-12-12 23:41:36 UTC (rev 2214)
@@ -9,7 +9,17 @@
 using namespace sword;
 #endif
 
+using std::cout;
+using std::endl;
+
 int main(int argc, char **argv) {
+VerseKey currentVerse;
+currentVerse.AutoNormalize(0);
+currentVerse.Headings(1);
+currentVerse.Persist(1);
+currentVerse = "jn2";
+cout << currentVerse << endl;
+/*
 	VerseKey parser;
 
      ListKey scope = parser.ParseVerseList("amos", parser, true);
@@ -53,6 +63,7 @@
      x = "1Sam.21.1";
      scope = x;
      if (!scope.Error()) std::cout << "Error restricting bounds: " << x.getText() << " is in " << bounds << "\n";
+*/
 
 	return 0;
 }




More information about the sword-cvs mailing list