[sword-svn] r1896 - in trunk: bindings/corba bindings/corba/orbitcpp include src/keys tests utilities

scribe at crosswire.org scribe at crosswire.org
Mon Feb 13 02:30:04 MST 2006


Author: scribe
Date: 2006-02-13 02:29:56 -0700 (Mon, 13 Feb 2006)
New Revision: 1896

Modified:
   trunk/bindings/corba/orbitcpp/swordorb-impl.hpp
   trunk/bindings/corba/swordorb.idl
   trunk/include/treekey.h
   trunk/include/treekeyidx.h
   trunk/src/keys/treekey.cpp
   trunk/src/keys/treekeyidx.cpp
   trunk/tests/genbooktest.cpp
   trunk/tests/treeidxtest.cpp
   trunk/utilities/addgb.cpp
   trunk/utilities/imp2gbs.cpp
   trunk/utilities/xml2gbs.cpp
Log:
Fixed TreeKey to act more like other sword keys when writing.
i.e. standard sword write methodology should work on genbooks now:
book.setKey("/this/is/a/test");
book.setEntry("Body of entry");

Maybe we can get rid of a number of our importers that handled treekeys special now???

Added CORBA write call to corba binding.



Modified: trunk/bindings/corba/orbitcpp/swordorb-impl.hpp
===================================================================
--- trunk/bindings/corba/orbitcpp/swordorb-impl.hpp	2006-02-08 21:57:47 UTC (rev 1895)
+++ trunk/bindings/corba/orbitcpp/swordorb-impl.hpp	2006-02-13 09:29:56 UTC (rev 1896)
@@ -22,10 +22,10 @@
 
 	SearchHitList *search(const char *istr, SearchType searchType, CORBA::Long flags, const char *scope) throw(CORBA::SystemException);
 	StringList *parseKeyList(const char *keyText) throw(CORBA::SystemException);
-	void   terminateSearch() throw(CORBA::SystemException) { delegate->terminateSearch = true; }
-	char   error() throw(CORBA::SystemException) { return delegate->Error(); }
+	void  terminateSearch() throw(CORBA::SystemException) { delegate->terminateSearch = true; }
+	char  error() throw(CORBA::SystemException) { return delegate->Error(); }
 	CORBA::Long getEntrySize() throw(CORBA::SystemException) { return delegate->getEntrySize(); }
-	void   setKeyText(const char *key) throw(CORBA::SystemException) { delegate->KeyText(key); }
+	void  setKeyText(const char *key) throw(CORBA::SystemException) { delegate->KeyText(key); }
 	char *getKeyText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->KeyText()); }
 	StringList *getKeyChildren() throw(CORBA::SystemException);
 	char *getKeyParent() throw(CORBA::SystemException);
@@ -33,13 +33,14 @@
 	char *getName() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->Name()); }
 	char *getDescription() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->Description()); }
 	char *getCategory() throw(CORBA::SystemException);
-	void   previous() throw(CORBA::SystemException) { delegate->decrement(); }
-	void   next() throw(CORBA::SystemException) { delegate->increment(); }
-	void   begin() throw(CORBA::SystemException) { delegate->setPosition(sword::TOP); }
+	void  previous() throw(CORBA::SystemException) { delegate->decrement(); }
+	void  next() throw(CORBA::SystemException) { delegate->increment(); }
+	void  begin() throw(CORBA::SystemException) { delegate->setPosition(sword::TOP); }
 	char *getStripText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->StripText()); }
 	StringList *getEntryAttribute(const char *level1, const char *level2, const char *level3, CORBA::Boolean filtered) throw(CORBA::SystemException);
 	char *getRenderText() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->RenderText()); }
 	char *getRawEntry() throw(CORBA::SystemException) { return CORBA::string_dup((char *)delegate->getRawEntry()); }
+	void  setRawEntry(const char *entryBuffer) throw(CORBA::SystemException) { delegate->setEntry(entryBuffer); }
 	char *getConfigEntry(const char *key) throw(CORBA::SystemException) { return CORBA::string_dup(((char *)delegate->getConfigEntry(key)) ? (char *)delegate->getConfigEntry(key):SWNULL); }
 	void deleteSearchFramework() throw(CORBA::SystemException) { return delegate->deleteSearchFramework(); }
 	CORBA::Boolean hasSearchFramework() throw(CORBA::SystemException) { return (delegate->hasSearchFramework() && delegate->isSearchOptimallySupported("God", -4, 0, 0)); }

Modified: trunk/bindings/corba/swordorb.idl
===================================================================
--- trunk/bindings/corba/swordorb.idl	2006-02-08 21:57:47 UTC (rev 1895)
+++ trunk/bindings/corba/swordorb.idl	2006-02-13 09:29:56 UTC (rev 1896)
@@ -58,6 +58,7 @@
 	string        getStripText();
 	string        getRenderText();
 	string        getRawEntry();
+	void          setRawEntry(in string entryBuffer);
 	string        getConfigEntry(in string key);
 	void          deleteSearchFramework();
 	boolean       hasSearchFramework();

Modified: trunk/include/treekey.h
===================================================================
--- trunk/include/treekey.h	2006-02-08 21:57:47 UTC (rev 1895)
+++ trunk/include/treekey.h	2006-02-13 09:29:56 UTC (rev 1896)
@@ -24,6 +24,7 @@
 #define TREEKEY_H
 
 #include <swkey.h>
+#include <swbuf.h>
 
 #include <defs.h>
 
@@ -37,6 +38,12 @@
 	static SWClass classdef;
 	void init();
 
+protected:
+	// hold on to setText until we've done a snap action: getText or navigation
+	// if we set, and then write out userData, we want to assure the path exists.
+	// This better conforms to the SWORD write methodology: mod.setKey, mod.setEntry
+	mutable SWBuf unsnappedKeyText;
+
 public:
 //	TreeKey (const char *ikey = 0);
 //	TreeKey (const SWKey * ikey);
@@ -51,11 +58,10 @@
 	virtual const char *getUserData(int *size = 0) = 0;
 	virtual void setUserData(const char *userData, int size = 0) = 0;
 
-	virtual const char *getFullName() const = 0;
-
 	/** Go to the root node
 	*/
 	virtual void root() = 0;
+
 	/** Go to the parent of the current node
 	* @return success or failure
 	*/
@@ -65,10 +71,12 @@
 	* @return success or failure
 	*/
 	virtual bool firstChild() = 0;
+
 	/** Go to the next sibling of the current node
 	* @return success or failure
 	*/
 	virtual bool nextSibling() = 0;
+
 	/** Go to the previous sibling of the current node
 	* @return success or failure
 	*/
@@ -85,6 +93,7 @@
 
 	virtual void remove() = 0;
 
+
 	virtual void setOffset(unsigned long offset) = 0;
 	virtual unsigned long getOffset() const = 0;
 
@@ -95,9 +104,16 @@
 	virtual void decrement(int steps = 1) = 0;
 	virtual void increment(int steps = 1) = 0;
 	virtual bool isTraversable() { return true; }
-	virtual long Index () const { return getOffset(); }
-	virtual long Index (long iindex) { setOffset(iindex); return getOffset(); }
+	virtual long Index() const { return getOffset(); }
+	virtual long Index(long iindex) { setOffset(iindex); return getOffset(); }
 
+	/** Set the key to this path.  If the path doesn't exist, then
+	 *	nodes are created as necessary
+	 * @keyPath = path to set/create; if unsupplied, then use any unsnapped setText value.
+	 */
+	virtual void assureKeyPath(const char *keyPath = 0);
+	virtual void save() {}
+
 	SWKEY_OPERATORS
 
 	};

Modified: trunk/include/treekeyidx.h
===================================================================
--- trunk/include/treekeyidx.h	2006-02-08 21:57:47 UTC (rev 1895)
+++ trunk/include/treekeyidx.h	2006-02-13 09:29:56 UTC (rev 1896)
@@ -76,8 +76,6 @@
 	virtual const char *getUserData(int *size = 0);
 	virtual void setUserData(const char *userData, int size = 0);
 
-	virtual const char *getFullName() const;
-
 	virtual void root();
 	virtual bool parent();
 
@@ -95,13 +93,12 @@
 	virtual void save();
 
 	virtual void copyFrom(const TreeKeyIdx &ikey);
-	virtual void copyFrom(const SWKey & ikey);
+	virtual void copyFrom(const SWKey &ikey);
 
 	void setOffset(unsigned long offset);
 	unsigned long getOffset() const;
 
 
-
 	// OPERATORS ------------------------------------------------------------
 
 

Modified: trunk/src/keys/treekey.cpp
===================================================================
--- trunk/src/keys/treekey.cpp	2006-02-08 21:57:47 UTC (rev 1895)
+++ trunk/src/keys/treekey.cpp	2006-02-13 09:29:56 UTC (rev 1896)
@@ -21,6 +21,8 @@
 
 
 #include <treekey.h>
+#include <utilstr.h>
+#include <string.h>
 
 SWORD_NAMESPACE_START
 
@@ -29,6 +31,67 @@
 
 void TreeKey::init() {
 	myclass = &classdef;
+	unsnappedKeyText = "";
 }
 
+
+void TreeKey::assureKeyPath(const char *keyBuffer) {
+
+	if (!keyBuffer) {
+		keyBuffer = unsnappedKeyText;
+		//assert we have something to do before setting root
+		if (!*keyBuffer)
+			return;
+	}
+
+	char *keybuf = 0;
+	stdstr(&keybuf, keyBuffer);
+
+	root();
+
+	//assert we have more to do
+	if (!*keybuf)
+		return;
+
+	// TODO: change to NOT use strtok. strtok is dangerous.
+	char *tok = strtok(keybuf, "/");
+	while (tok) {
+		bool foundkey = false;
+		if (hasChildren()) {
+			firstChild();
+			if (!strcmp(getLocalName(), tok)) {
+				foundkey = true;
+			}
+			else {
+				while (nextSibling()) {
+					if (getLocalName()) {
+						if (!strcmp(getLocalName(), tok)) {
+							foundkey = true;
+						}
+					}
+				}
+			}
+			if (!foundkey) {
+				append();
+				setLocalName(tok);
+				save();	    
+			}
+		}
+		else {
+			appendChild();
+			setLocalName(tok);
+			save();
+		}
+
+#ifdef DEBUG
+//      std::cout << getLocalName() << " : " << tok << std::endl;
+#endif
+
+		tok = strtok(NULL, "/");
+
+	}
+	delete [] keybuf;
+}
+
+
 SWORD_NAMESPACE_END

Modified: trunk/src/keys/treekeyidx.cpp
===================================================================
--- trunk/src/keys/treekeyidx.cpp	2006-02-08 21:57:47 UTC (rev 1895)
+++ trunk/src/keys/treekeyidx.cpp	2006-02-13 09:29:56 UTC (rev 1896)
@@ -86,11 +86,13 @@
 
 
 const char *TreeKeyIdx::getLocalName() {
+	unsnappedKeyText = "";
 	return currentNode.name;
 }
 
 
 const char *TreeKeyIdx::getUserData(int *size) {
+	unsnappedKeyText = "";
 	if (size)
 		*size = (int)currentNode.dsize;
 	return currentNode.userData;
@@ -98,6 +100,8 @@
 
 
 void TreeKeyIdx::setUserData(const char *userData, int size) {
+	// this makes sure any unsnapped path exists
+	assureKeyPath();
 	if (currentNode.userData)
 		delete currentNode.userData;
 
@@ -110,6 +114,7 @@
 }
 
 const char *TreeKeyIdx::setLocalName(const char *newName) {
+	unsnappedKeyText = "";
 	stdstr(&(currentNode.name), newName);
 	return currentNode.name;
 }
@@ -120,19 +125,6 @@
 }
 
 
-const char *TreeKeyIdx::getFullName() const {
-	TreeNode parent;
-	static SWBuf fullPath;
-	fullPath = currentNode.name;
-	parent.parent = currentNode.parent;
-	while (parent.parent > -1) {
-		getTreeNodeFromIdxOffset(parent.parent, &parent);
-		fullPath = ((SWBuf)parent.name) + (SWBuf) "/" + fullPath;
-	}
-	return fullPath.c_str();
-}
-
-
 void TreeKeyIdx::root() {
 	error = getTreeNodeFromIdxOffset(0, &currentNode);
 }
@@ -281,6 +273,7 @@
  */
 
 void TreeKeyIdx::getTreeNodeFromDatOffset(long ioffset, TreeNode *node) const {
+	unsnappedKeyText = "";
 	char ch;
 	__s32  tmp;
 	__u16  tmp2;
@@ -329,6 +322,7 @@
  */
 
 char TreeKeyIdx::getTreeNodeFromIdxOffset(long ioffset, TreeNode *node) const {
+	unsnappedKeyText = "";
 	__u32 offset;
 	char error = KEYERR_OUTOFBOUNDS;
 	
@@ -360,6 +354,7 @@
 
 
 unsigned long TreeKeyIdx::getOffset() const {
+	unsnappedKeyText = "";
 	return currentNode.offset;
 }
 
@@ -369,6 +364,7 @@
 
 
 void TreeKeyIdx::saveTreeNodeOffsets(TreeNode *node) {
+	unsnappedKeyText = "";
 	long datOffset = 0;
 	__s32 tmp;
 
@@ -397,6 +393,7 @@
 
 
 void TreeKeyIdx::copyFrom(const TreeKeyIdx &ikey) {
+	unsnappedKeyText = "";
 
 	SWKey::copyFrom(ikey);
 
@@ -483,11 +480,13 @@
 		}
 	}
 	delete [] buf;
+	unsnappedKeyText = ikey;
 }
 
 
 
 void TreeKeyIdx::copyFrom(const SWKey &ikey) {
+	unsnappedKeyText = ikey;
 	SWKey::copyFrom(ikey);
 }
 
@@ -503,11 +502,7 @@
 	Error();	// clear error from normalize
 }
 
-const char *TreeKeyIdx::getText() const {
-	return getFullName();
-}
 
-
 int TreeKeyIdx::_compare (const TreeKeyIdx & ikey) {
 		return (getOffset() - ikey.getOffset());
 }
@@ -549,6 +544,21 @@
 
 
 
+const char *TreeKeyIdx::getText() const {
+	TreeNode parent;
+	static SWBuf fullPath;
+	fullPath = currentNode.name;
+	parent.parent = currentNode.parent;
+	while (parent.parent > -1) {
+		getTreeNodeFromIdxOffset(parent.parent, &parent);
+		fullPath = ((SWBuf)parent.name) + (SWBuf) "/" + fullPath;
+	}
+	// we've snapped; clear our unsnapped text holder
+	unsnappedKeyText = "";
+	return fullPath.c_str();
+}
+
+
 TreeKeyIdx::TreeNode::TreeNode() {
 
 	name       = 0;

Modified: trunk/tests/genbooktest.cpp
===================================================================
--- trunk/tests/genbooktest.cpp	2006-02-08 21:57:47 UTC (rev 1895)
+++ trunk/tests/genbooktest.cpp	2006-02-13 09:29:56 UTC (rev 1896)
@@ -48,6 +48,14 @@
 }
 
 
+void assurePath(TreeKeyIdx *treeKey) {
+	char buf[1023];
+	std::cout << "Enter Path: ";
+	gets(buf);
+	treeKey->assureKeyPath(buf);
+}
+
+
 void viewEntryText(RawGenBook *book) {
 	std::cout << "\n";
 	std::cout << book->RenderText();
@@ -129,7 +137,7 @@
 	char line[1024];
 
 	do {
-		std::cout << "[" << treeKey->getFullName() << "] > ";
+		std::cout << "[" << treeKey->getText() << "] > ";
 		gets(line);
 		input = line;
 		if (input.length() > 0) {
@@ -137,6 +145,7 @@
 				case 'n': printLocalName(treeKey); break;
 				case 's': setLocalName(treeKey); break;
 				case 'g': gotoPath(treeKey); break;
+				case 'G': assurePath(treeKey); break;
 				case 'p':	root.root(); printTree(root, treeKey); break;
 				case 'a':	appendSibbling(treeKey); break;
 				case 'c':	appendChild(treeKey); break;
@@ -159,6 +168,7 @@
 					std::cout << " l - first child\n";
 					std::cout << " r - root\n";
 					std::cout << " g - goto path\n";
+					std::cout << " G   goto path; create if it doesn't exist\n";
 					std::cout << " a - append sibbling\n";
 					std::cout << " c - append child\n";
 					std::cout << " v - view entry text\n";

Modified: trunk/tests/treeidxtest.cpp
===================================================================
--- trunk/tests/treeidxtest.cpp	2006-02-08 21:57:47 UTC (rev 1895)
+++ trunk/tests/treeidxtest.cpp	2006-02-13 09:29:56 UTC (rev 1896)
@@ -40,6 +40,14 @@
 }
 
 
+void assurePath(TreeKeyIdx *treeKey) {
+	char buf[1023];
+	std::cout << "Enter path: ";
+	gets(buf);
+	treeKey->assureKeyPath(buf);
+}
+
+
 void appendSibbling(TreeKeyIdx *treeKey) {
 	if (treeKey->getOffset()) {
 		char buf[1023];
@@ -92,7 +100,7 @@
 	char line[1024];
 
 	do {
-		std::cout << "[" << treeKey->getFullName() << "] > ";
+		std::cout << "[" << treeKey->getText() << "] > ";
 		gets(line);
 		input = line;
 		if (input.length() > 0) {
@@ -103,6 +111,7 @@
 				case 'a':	appendSibbling(treeKey); break;
 				case 'c':	appendChild(treeKey); break;
 				case 'j':	treeKey->nextSibling(); break;
+				case 'g': assurePath(treeKey); break;
 				case 'k':	treeKey->previousSibling(); break;
 				case 'h':	treeKey->parent(); break;
 				case 'l':	treeKey->firstChild(); break;
@@ -122,6 +131,7 @@
 					std::cout << " c - append child\n";
 					std::cout << " u - get user data\n";
 					std::cout << " d - set user data\n";
+					std::cout << " g - goto path; create if it doesn't exist\n";
 					std::cout << " q - quit\n\n";
 					break;
 			}

Modified: trunk/utilities/addgb.cpp
===================================================================
--- trunk/utilities/addgb.cpp	2006-02-08 21:57:47 UTC (rev 1895)
+++ trunk/utilities/addgb.cpp	2006-02-13 09:29:56 UTC (rev 1896)
@@ -68,45 +68,10 @@
   }
   delete treeKey;
   RawGenBook *book = new RawGenBook(argv[2]);
-  TreeKeyIdx root = *((TreeKeyIdx *)((SWKey *)(*book)));
-  treeKey = (TreeKeyIdx *)(SWKey *)(*book);  
 
   if ((mode == 'a') && (argc == 4 || argc == 5)) {	
     char buffer[1048576];  //this is the max size of any entry
 
-    char* tok = strtok(argv[3], "/");
-    while (tok) {
-      bool foundkey = false;
-      if (treeKey->hasChildren()) {
-	treeKey->firstChild();
-	if (!strcmp(treeKey->getLocalName(), tok)) {
-	  foundkey = true;
-	} else {
-	  while (treeKey->nextSibling()) {
-	    if (treeKey->getLocalName()) {
-	      if (!strcmp(treeKey->getLocalName(), tok)) {
-		foundkey = true;
-	      }
-	    }
-	  }
-	}
-	if (!foundkey) {
-	  treeKey->append();
-	  treeKey->setLocalName(tok);
-	  treeKey->save();	    
-	}
-      }
-      else {
-	treeKey->appendChild();
-	treeKey->setLocalName(tok);
-	treeKey->save();
-      }
-      
-      //DEBUG      std::cout << treeKey->getLocalName() << " : " << tok << endl;
-      
-      tok = strtok(NULL, "/");
-      
-    }
     
     FILE *infile;
     // case: add from text file
@@ -116,6 +81,7 @@
     else infile = stdin;
     
     entrysize = fread(buffer, sizeof(char), sizeof(buffer), infile);
+    book->setKey(argv[3]);
     book->setEntry(buffer, entrysize); // save text to module at current position
   }
   

Modified: trunk/utilities/imp2gbs.cpp
===================================================================
--- trunk/utilities/imp2gbs.cpp	2006-02-08 21:57:47 UTC (rev 1895)
+++ trunk/utilities/imp2gbs.cpp	2006-02-13 09:29:56 UTC (rev 1896)
@@ -37,42 +37,6 @@
     printTree(treeKey, target, level);
 }
 
-void setKey(TreeKeyIdx * treeKey, char* keyBuffer) {
-  char* tok = strtok(keyBuffer, "/");
-  while (tok) {
-    bool foundkey = false;
-    if (treeKey->hasChildren()) {
-      treeKey->firstChild();
-      if (!strcmp(treeKey->getLocalName(), tok)) {
-	foundkey = true;
-      } else {
-	while (treeKey->nextSibling()) {
-	  if (treeKey->getLocalName()) {
-	    if (!strcmp(treeKey->getLocalName(), tok)) {
-	      foundkey = true;
-	    }
-	  }
-	}
-      }
-      if (!foundkey) {
-	treeKey->append();
-	treeKey->setLocalName(tok);
-	treeKey->save();	    
-      }
-    }
-    else {
-      treeKey->appendChild();
-      treeKey->setLocalName(tok);
-      treeKey->save();
-    }
-    
-    //DEBUG      std::cout << treeKey->getLocalName() << " : " << tok << std::endl;
-    
-    tok = strtok(NULL, "/");
-    
-  }
-}
-
 int readline(FILE* infile, char* lineBuffer) {
   signed char c;
   char* lbPtr = lineBuffer;
@@ -123,14 +87,12 @@
   delete treeKey;
   book = new RawGenBook(modname);
   //DEBUG  TreeKeyIdx root = *((TreeKeyIdx *)((SWKey *)(*book)));
-  treeKey = ((TreeKeyIdx *)((SWKey *)(*book)));
   
   while (readline(infile, lineBuffer)) {
     if (!strncmp(lineBuffer, "$$$", 3)) {
       if (strlen(keyBuffer) && strlen(entBuffer)) {
 	std::cout << keyBuffer << std::endl;
-	treeKey->root();
-	setKey(treeKey, keyBuffer);
+	book->setKey(keyBuffer);
 	book->setEntry(entBuffer, strlen(entBuffer));
       }
       lineBuffer[strlen(lineBuffer) - 1] = 0;
@@ -145,8 +107,7 @@
   //handle final entry
   if (strlen(keyBuffer) && strlen(entBuffer)) {
     std::cout << keyBuffer << std::endl;
-    treeKey->root();
-    setKey(treeKey, keyBuffer);
+    book->setKey(keyBuffer);
     book->setEntry(entBuffer, strlen(entBuffer));
   }
   

Modified: trunk/utilities/xml2gbs.cpp
===================================================================
--- trunk/utilities/xml2gbs.cpp	2006-02-08 21:57:47 UTC (rev 1895)
+++ trunk/utilities/xml2gbs.cpp	2006-02-13 09:29:56 UTC (rev 1896)
@@ -20,46 +20,7 @@
 
 //#define DEBUG
 
-void setkey (TreeKeyIdx * treeKey, const char* keybuffer) {
-    char *keybuf = strdup(keybuffer);
-    char* tok = strtok(keybuf, "/");
-    while (tok) {
-      bool foundkey = false;
-      if (treeKey->hasChildren()) {
-	treeKey->firstChild();
-	if (!strcmp(treeKey->getLocalName(), tok)) {
-	  foundkey = true;
-	} else {
-	  while (treeKey->nextSibling()) {
-	    if (treeKey->getLocalName()) {
-	      if (!strcmp(treeKey->getLocalName(), tok)) {
-		foundkey = true;
-	      }
-	    }
-	  }
-	}
-	if (!foundkey) {
-	  treeKey->append();
-	  treeKey->setLocalName(tok);
-	  treeKey->save();	    
-	}
-      }
-      else {
-	treeKey->appendChild();
-	treeKey->setLocalName(tok);
-	treeKey->save();
-      }
 
-#ifdef DEBUG
-//      std::cout << treeKey->getLocalName() << " : " << tok << std::endl;
-#endif
-      
-      tok = strtok(NULL, "/");
-      
-    }
-    free(keybuf);
-}
-
 enum XML_FORMATS { F_AUTODETECT, F_OSIS, F_THML };
 
 #define HELPTEXT "xml2gbs 1.0 OSIS/ThML General Book module creation tool for the SWORD Project\n  usage:\n   xml2gbs [-l] [-i] [-fT|-fO] <filename> [modname]\n  -l uses long div names in ThML files\n  -i exports to IMP format instead of creating a module\n  -fO and -fT will set the importer to expect OSIS or ThML format respectively\n    (otherwise it attempts to autodetect)\n"
@@ -133,7 +94,6 @@
     RawGenBook::createModule(modname);
     delete treeKey;
     book = new RawGenBook(modname);
-    treeKey = ((TreeKeyIdx *)((SWKey *)(*book)));
   }
 
 #ifdef DEBUG
@@ -170,8 +130,7 @@
 		outfile << "$$$" << keybuffer2 << std::endl << entbuffer << std::endl;
 	      }
 	      else {
-		treeKey->root();
-		setkey(treeKey, keybuffer2.c_str());
+		book->setKey(keybuffer2.c_str());
 		book->setEntry(entbuffer.c_str(), entrysize); // save text to module at current position
 	      }
 	    }
@@ -208,8 +167,7 @@
 		outfile << "$$$" << keybuffer2 << std::endl << entbuffer << std::endl;
 	      }
 	      else {
-		treeKey->root();
-		setkey(treeKey, keybuffer2.c_str());
+		book->setKey(keybuffer2.c_str());
 		book->setEntry(entbuffer.c_str(), entrysize); // save text to module at current position
 	      }
 	    }



More information about the sword-cvs mailing list