[jsword-devel] Sword drivers

Troy A. Griffitts jsword-devel@crosswire.org
Wed, 16 Oct 2002 13:00:31 -0700

Hey guys.  The best place to look is in the sword drivers and helper 
classes.  The driver are found at the lowest level in the modules/ tree, 
e.g. sword/src/modules/texts/ztext/ztext.cpp
Most of these drivers use common functionality found in utility classes 
located in sword/src/modules/common, e.g. zverse.cpp-- used for 
read/write access to compressed files indexed by 'verse'.  Also, there 
is a class hierarchy in here LZSSCompress::SWCompress and 
ZipCompress::SWCompress.  These are the implementations of sword's 
SWCompress interface that the ztext and zstr compress classes use for 
compression.  Also SWCipher which has a base implementation using 
sapphire encryption but is the interface for en/deciphering text for 
locked modules.

the sword engine allow hooks for filtering the text of the modules in 
various places.  Implementations of these hooks can be found in:


Current hooks include:

rawFilter (3 modes that should probably be split into 3 different hooks):
   before write sync-- mostly used by encipher filter
   after read cache-- mostly used by decipher filter
   on getText of an entry-- mostly used by text encoding (utf8, etc)

stripFilter-- to allow a filter that removes all tags and markup. 
Prepares an entry for searching.

renderFilter-- to allow a filter to place markup appropriate for the 
frontend renderer (html, rtf, etc).

SWFilter is the interface.  SWBasicFilter is a helper implementation. 
Classes found in sword/src/modules/filters are the useful 
implementations.  These should be easy to convert into java.  They 
aren't pretty, but need to be fast, as they process alot of text at a 
low level in the api.

Hope this gives some good insight into the underlying workings of the 


Mark Goodwin wrote:
> On Wed, 2002-10-16 at 17:58, Mark Goodwin wrote:
>>Hello people.
>>Plain text Sword drivers are now working.
> I should perhaps add that whilst the plain text drivers work, they are
> not complete....
> We're still missing useful implementations of findPassage, getStartsWith
> and listWords.  This means that searches do not work on sword modules. 
> I've not taken a look at what's involved in implementing this
> functionality.
> Also, there's currently no support for locked, or compressed Sword
> modules.  Compressed sword modules may be compressed with either Zip, or
> LZSS compression.  There is support (as you all know) for zip files in
> the java.util.zip package, for LZSS, I found this:
> http://home.tiscali.cz:8080/~cz210552/lzss.html 
> I've not checked out the license or the code yet, but it features on a
> page of "Open Source" programs.  The license may, or may not be GPL
> compatible, and the code may, or may not be any good.
> I've not looked at locked modules yet, Perhaps Troy could point us in
> the direction of some documentation for these?
> Finally, it would be good if we could write Sword modules as well.
> So then, there's lots of work still to be done.  Unfortunately I won't
> have time to do much for at least the next week and a half.  Hopefully
> the information above is helpful to someone who will ;-)
> MarkG
> _______________________________________________
> jsword-devel mailing list
> jsword-devel@crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel