[jsword-devel] Module Format

Troy A. Griffitts jsword-devel@crosswire.org
Wed, 12 Mar 2003 17:04:34 -0700


Hey guys, I'll try to get you better documentation if you need it, but 
basically there are only a few classes involved.

SWCompress is a general interface to handle compression.
It support basically two properties:

setText(const char *uncompressedText);
getText()

setZText(const char *compressedText, long len);
getZText()

I think I have those close to, at least, conceptually correct.

As stated before, we have 2 algorithms that are used in 2 respective 
implementations of this SWCompress interface:

ZipCompress, and
LZSSCompress

Obviously implmenting ZipCompress will be quite trivial, as there are 
already built in classes to handle such for you.

This is where I would start, and I would suggest grabbing the classnames 
and sigs directly from the C++ source since you haven't implemented any 
of this yet anyway.  I think the method names are Buf and zBuf, so 
changing them to something more Java-like-- possibly the previously 
mentioned names-- would be appreciated.

ZipCompress should give you access to most (if not all) compressed 
modules.  I don't know of any that use LZSS.  It was added mostly for 
STEP support which uses this compression by mandate.

After these 2 classes are done (SWCompress and ZipCompress:SWCompress), 
you'll want to have a look at sword/src/modules/common/zverse and .../zstr.

These are the major classes that access the data files: zstr for 
compressed modules with a 'string' key, like dictionaries, lexicons, 
etc., and zverse for compressed modules that use a verse key, like 
Bibles and Commentaries.

After you understand these and provide their functionality, they are 
used by the actual low level drivers like:

zld.cpp
ztext.cpp
zcom.cpp

Hope this helps.  I might be able to give you more specifics if you get 
stuck, but taking things a chunk at a time like this should make the 
task seem less overwhelming.  And I'd have to remember exactly what's 
going on in there myself.  I didn't write much of that code.

Hope this helps,
	-Troy.






Joe Walker wrote:
> 
> Stephen Denne wrote:
> 
>>> Hi,
>>>
>>> I'm back from my self-enforced jsword coding ban, and wanting to finish
>>>   
>>
>>
>> I've been waiting for you to say you were back... while you were away, I
>> decided to take a look at jsword. I also decided to download and play 
>> with
>> eclipse, as I'd been using Netbeans (to create the indexes for my PalmOS
>> concordance), and I kept hearing about eclipse. Anyway, I managed to 
>> get it
>> to do lots of copying from cvs, but couldn't find osis dependencies.
>>
>> Are they not checked in?
>>  
>>
> 
> I need to document this in some way - you're not the first to ask. They 
> are generated from the .xsd file. Just run the default ANT task and they 
> will all be created for you
> 
>>> off the Sword drivers. The biggest open question is on basic file
>>> format, especially .zip encoded Bibles.
>>> Is there any documentation anywhere on this?
>>>   
>>
>>
>> I've only quickly looked at (quite an old copy of) the c source, and I 
>> think
>> SWCompress gets implemented as either an ZipCompress using zlib 
>> (source in
>> utilfuns), or LZSSCompress (source in lzsscomprs.cpp)
>>  
>>
> Yes. I've spent a something like 10mins looking at them, discovering 
> that I'm not as fluent in C as I was 6 years ago!
> 
> I'm hoping that the compression routines in Java will help us, so all 
> that would be needed is to get the appropriate byte[] and pass it in an 
> InputStream to java.util.zip/gzip and all is done for us.
> Maybe I'll have another go at reading the C.
> 
> Joe.
> 
> _______________________________________________
> jsword-devel mailing list
> jsword-devel@crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel