TCR

TCR is a compressed text file format.  It's especially useful with Psion Series 3 and Series 5 machines: there are text viewers for both which can display TCR-compressed files directly (VReader5 and EBook for the 5, Reader for the 3).  (There's nothing to stop you using it elsewhere, too, of course.)  It's rather like Palm DOC format, except with better compression.

And TCR is also a pair of programs I've written to convert text files to and from this format!  You can download the source to these two programs below; they're in bog-standard ANSI C (well, gcc) and should compile anywhere.


Usage

The programs have a basic text interface for simplicity.  Each takes one or more filenames on the command line, and de/compresses those files, creating ones with a different filename extension – .tcr for compressed files, .txt for uncompressed ones.

In addition, if the decompressor is launched with no parameters, it decompresses the standard input to the standard output, so it can be used in shell pipelines &c.


History

Ian Young originally designed a format called ZVR for a Psion text file viewer.  Most compression formats need to be decompressed right from the beginning each time, but ZVR is stateless, so you can restart anywhere – which is obviously much better for a text viewer.  Compression is still quite good though – average saving is about 50%, as compared with something of the order of 65% for ZIP, although for highly repetitive files, compression rates of over 80% aren't unheard-of.

When Barry Childress came to write a text file viewer for the Psion Series 3, Reader3 (available on 3-Lib), he adapted the ZVR format slightly to make TCR (Text Compression for Reader).  He also included a compression program called TCReader, which is very much faster than Ian's ZVRZ, but only runs on a PC.

The format has become quite popular in the Psion world, so that when Jean-Luc Damnet wrote his VReader5 viewer, he also included TCR support.

Meanwhile, although you could use TCR files on a Psion, you could only create them on Windows, which was very awkward for me as my home machines have never run Windows.  Barry Childress wasn't keen on letting me see his source code, so in desperation I decided to write my own!  (And don't I wish I hadn't :)  Although this version uses some ideas from Ian's original ZVRZ, and some from interesting discussions with Peter Maud, it's all my own work, and (in my very biased opinion) is better than previous ones :) 


Licence

TCR is released under the GNU General Public Licence.

This doesn't require that you let me know of any modifications, but if you've made any neat improvements, or have any other suggestions (anatomical or otherwise), I'd appreciate hearing.


Credits

TCR is copyright © UK  Andrew Giddings  2003

Thanks are due to Ian Young, Barry Childress and Jean-Luc Damnet for their programs, to Peter Maud for explaining ZVRZ to me, to Steve Litchfield for putting previous versions on his 3-Lib library, and to Stephan Hradek for testing and ideas.


Version History

v1.00 First release.
v1.01 Fixed two rare bugs in the compressor. Decompressor now handles zero codes properly.
v1.02 Various improvements.  The compressor is now slightly faster; the decompressor is about four times as fast.
v1.03 Fixed another rare bug in the compressor.  (Perhaps they're not so rare after all?)
v1.04 No functionality changes.  Fixed all compilation warnings, added a couple of compile flags, and tidied the code a bit.  First GPL release.


Download

TCR v1.04 (8KB) – zipped source code for the compressor and decompressor.


Last updated: 8/Jun/2003.

Back     Home