chm

From Free Pascal wiki
Jump to navigationJump to search

Package CHM is a set of units distributed with FPC 2.2.2 and newer that allow to read/write .chm compressed html help files on multiple platforms. There are two projects that read these, the textmode IDE ( 2.2.2 not yet), and the Lazarus chmhelp package (which features a separate helpsystem, connected over TCPIP). The original author is Andrew Haines, but some parts are by others (specially Lars/z505).

It is expected that in the next FPC release, chm will replace the doc-html archive with its thousands of separate htmls.

The package is pure pascal, and thus portable in principle (and seems to have had endianess fixes). 64-bit status not known yet.

Units

  1. chmbase - some structures, constants and helper funcs (compare and compression streaming helpers)
  2. chmfiftimain - the unit that is responsible for reading and writing the search index of chms (TChmSearchReader, TChmSearchWriter)
  3. chmfilewriter - TChmProject, a class that describes a CHM project in the form of a XML description. Can be used to generate CHMs easily.
  4. chmreader - the base CHM Reader
  5. chmsitemap - Support for sitemaps (toc and index, the unit helps transforming these xml files to collections)
  6. chmspecialfiles - Streaming helpers for special index files in the chm
  7. chmtypes - CHM helper class types.
  8. chmwriter - the base CHM Writer.
  9. fasthtmlparser - Base skeleton of a html parser.
  10. htmlindexer - Contains classes that TChmWriter uses to parse and index the contents of html files for searching
  11. htmlutil - helperfunctions. Mostly getting info out of html/xml tags.
  12. lzxcompressthread - wrapper around paslzxcomp that will do compression in multiple threads
  13. paslznonslide - (de)compression routines
  14. paslzxcomp - (de)compression routines
  15. paslzx - (de)compression routines

Files

Besides the library units, there are also two endprograms:

  • chmls - lists contents of a chm
  • chmcmd - creates a CHM using a XML file made with the TCHMProject class

Missing features

  • Binary indexes. Might make files slightly slower, but more importantly, is said to tremendously speed up loading of files with large indexes (like LCL) and combining of indexes of multiple chm files. (.CHW/.CHI?)

Implemented features

  • Full text search
  • Binary Table of contents
  • Experimental threaded LZX Compression


How to enable threaded LZX Compression

If you want to test multithreaded chm compression add -dLZX_USETHREADS when compiling the package (or the whole snapshot).

The program using the package (fpdoc must have cthreads added in it's uses section on *nix.

On my Core2 1.73GHz laptop this reduced time from 2min 57s to 2m 7s, iow a reduction by slightly less that a third.

It is unknown how to configure the number of paralel threads.

See also

Go to back Packages List