Sign in Join
Wiki copytemporary

chm: what changed

Revision 0 to 1. Removed lines have a minus sign; added lines have a plus sign.

Title: chm

OldNewLine
1+## Overview
2+
3+The FPC CHM package is a set of units distributed with FPC 2.2.2+ that allow to read/write .chm compressed HTML help files on multiple platforms.
4+
5+There are two projects that use the CHM package:
6+
7+1. the textmode IDE (FPC 2.2.4+)
8+2. the Lazarus [[chmhelp]] package (which features lhelp, a separate help viewer, connected over TCPIP). The original author is Andrew Haines, but some parts are by others (specially Lars/z505).
9+
10+The write aspect is mostly used in combination with [[FPDoc Editor|fpdoc]], a doxygen like documentation tool, and [[chmcmd]] the commandline compiler.
11+
12+It is expected that in the next FPC release, chm will replace the doc-html archive with its thousands of separate htmls.
13+
14+The package is pure Pascal, and thus portable in principle:
15+
16+- The package is prepared for different endianness, but has not been extensively tested on Big endian systems
17+- No testing has been done on systems that generate an exception on unaligned memory access (like arm-wince). Specially the reader parts should be made `aligned()` clean.
18+
19+The package also packages two examples:
20+
21+1. chmls
22+2. [[chmcmd]] (see below)
23+
24+## Package status
25+
26+The basic system works since 2.2.4. However keep in mind that the FPC help systems, while massive (30000+ webpages in the various chms) are generated, compiled and read mostly by FPC tools (with an occasional test in Windows/gnochm/kchmviewer to see if it opens properly).
27+
28+If you want to use FPC's chm package/compiler for your own projects, take the follow advice under consideration:
29+
30+- Work on data that is backed up. I haven't lost data yet, but better be safe than sorry.
31+- Don't expect it to work right away.
32+- Keep in mind what is implemented and what is not (see below)
33+- report bugs in the FPC tracker with a reproducible description (if you are in an hurry with patch :_)
34+
35+## Units
36+
37+1. chmbase - some structures, constants and helper functions (compare and compression streaming helpers)
38+2. chmfiftimain - the unit that is responsible for reading and writing the search index of CHMs (TChmSearchReader, TChmSearchWriter)
39+3. chmfilewriter - TChmProject, a class that describes a CHM project in the form of a XML description. Can be used to generate CHMs easily.
40+4. chmreader - the base CHM Reader
41+5. chmsitemap - Support for sitemaps (TOC - table of contents - and index) The unit helps transforming these XML files to collections.
42+6. chmspecialfiles - Streaming helpers for special index files in the chm
43+7. chmtypes - CHM helper class types.
44+8. chmwriter - the base CHM Writer.
45+9. fasthtmlparser - Base skeleton of an HTML parser.
46+10. htmlindexer - Contains classes that TChmWriter uses to parse and index the contents of HTML files for searching
47+11. htmlutil - helper functions. Mostly getting info out of HTML/XML tags.
48+12. lzxcompressthread - wrapper around paslzxcomp that will do compression in multiple threads
49+13. paslznonslide - (de)compression routines
50+14. paslzxcomp - (de)compression routines
51+15. paslzx - (de)compression routines
52+
53+## Files
54+
55+This describes the FPC 2.6+ situation.
56+
57+Besides the library units, there are also two end user programs:
58+
59+- chmls - listing, extracting and unblocking (needed on Windows XP SP2+ and presumably newer Windows versions) of a chm
60+- [[chmcmd]] - creates a CHM using a XML file made with the TCHMProject class. Roughly equivalent to a simple help compiler. Experimental support for .hhp is also available.
61+
62+chmcmd used to be very rough in pre 3.0.0 times, but hhp usage is on firmer ground now, and with 3.2.0 the binary sitemap support has been rewritten and the (binary) indexes and tocs generated from HHPs are better now. It still does not support goodies like autoindexing, since it is mostly used as a backend for tools that already generate hhc/hhk themselves. (iow I rather like that to be in the workshop part rather than the compiler)
63+
64+### chmls
65+
66+Help output of chmls (FPC trunk, September 2014):
67+
68+ chmls, a CHM utility. (c) 2010 Free Pascal core.
69+
70+ Usage: chmls [switches] [command] [command specific parameters]
71+
72+ Switches :
73+ -h, --help : this screen
74+ -p, --no-page : do not page list output
75+ -n,--name-only : only show "name" column in list output
76+
77+ Where command is one of the following or if omitted, equal to LIST.
78+ list <filename> [section number]
79+ Shows contents of the archive's directory
80+ extract <chm filename> <filename to extract> [saveasname]
81+ Extracts file "filename to get" from archive "filename",
82+ and, if specified, saves it to [saveasname]
83+ extractall <chm filename> [directory]
84+ Extracts all files from archive "filename" to directory
85+ "directory"
86+ unblockchm <filespec1> [filespec2] ..
87+ Mass unblocks (XPsp2+) the relevant CHMs. Multiple files
88+ and wildcards allowed
89+ extractalias <chmfilename> [basefilename] [symbolprefix]
90+ Extracts context info from file "chmfilename"
91+ to a "basefilename".h and "basefilename".ali,
92+ using symbols "symbolprefix"contextnr
93+ extracttoc <chmfilename> [filename]
94+ Extracts the toc (mainly to check binary TOC)
95+ extractindex <chmfilename> [filename]
96+ Extracts the index (mainly to check binary index)
97+ printidxhdr <chmfilename>
98+ prints #IDXHDR in readable format
99+ printsystem <chmfilename>
100+ prints #SYSTEM in readable format
101+ printwindows <chmfilename>
102+ prints #WINDOWS in readable format
103+ printtopics <chmfilename>
104+ prints #TOPICS in readable format
105+
106+## Missing features
107+
108+(the bulletlist is old)
109+
110+- merged chm support/ \#idxhdr
111+ - Combining of indexes of multiple chm files. (.CHW/.CHI?)
112+ - slave file support ? (making slave CHMs, and getting them out, will make for easy master/toc CHMs later)
113+- Writing of binary indexes is multiple level, loading not. (???)
114+- Expand TCHMProject to support
115+ - aliases. 2.4.2+ (via .hhp in 2.4.4+)
116+ - control over textual/binary toc generation, textual/binary index generation etc from the XML/project (2.4.2+)
117+ - also support .ini (MS helpcompiler compat?) (2.4.4+)
118+ - lcid/language (?)
119+ - Window list (in progress, probably 2.4.4+)
120+- Alinks
121+- auto index/toc(?) generation (maybe better keep this in the GUI tooling?)
122+- (popup) comments
123+- samples (fpdoc?) Make samples extractable, MSDN style.
124+- exclusion lists (stoplists) for wordindexing.
125+ - why is a MS generated index larger while we also index words like "the" and "of" ? Possible reason: probably the parser doesn't see all text.
126+
127+So the major missing feature is master/slave CHMs. I tried to fix this several times, but the Windows reader doesn't seem to accept it. (neither slave nor master, I mostly worked on slave support.
128+
129+If somebody has more knowledge about this subject , don't hesitate to contact me (e.g. via the FPC bugtracker or lazarus forum. Add CHM in the subject to make sure I see it )
130+
131+## Implemented features
132+
133+- Full text search
134+- Binary Table of contents
135+- Binary Index (experimental, completely rewritten in 3.2.0+)
136+- Experimental threaded LZX Compression
137+- context ids.
138+- threaded compilation (requires recompile, see below)
139+- windows support
140+- toc and indexfile are not always "default.hh\[c/k\]"
141+- chmcmd and chmls totally revised, and chmcmd now also compiles .HHPs.
142+
143+### Disable binary toc/index generation
144+
145+Generating binary versions of the TOC and/or index can be disabled in [[FPDoc Editor|fpdoc]] respectively with `--no-bintoc` and `--no-indextoc`.
146+
147+Note that these options were not added to save space, but to be able to temporarily not generate them if some viewer has a problem with them, and refuses to fall back to default.
148+
149+One can notice that kchmviewer loads chms with binary index and TOC significantly faster.
150+
151+### How to enable threaded LZX Compression
152+
153+If you want to test multithreaded chm compression add `-dLZX_USETHREADS` when compiling the package (or the whole snapshot).
154+
155+The program using the package (fpdoc must have cthreads added in its uses section on *nix.
156+
157+On my Core2 1.73GHz laptop this reduced time from 2min 57s to 2m 7s, in other words a reduction by slightly less that a third.
158+
159+It is unknown how to configure the number of parallel threads.
160+
161+## See also
162+
163+- [[chm backend for fpdoc]]
164+- [[Textmode IDE development|Textmode IDE development#Chm Support]]
165+- Lazarus [[chmhelp]] component
166+- [CheckHelpLinks](http://www.codeproject.com/Articles/7997/Check-Help-Links-Tool) Tool that displays links etc in CHM files; open CHM (suggest using Fast mode to avoid crashes) and File/Work to check links
167+- [Unofficial CHM file specs](http://www.nongnu.org/chmspec/latest/)
168+
169+Go to back [[Package List|Packages List]]
170+
171+---
172+*From the Free Pascal wiki, page "chm", as it stood on 2022-02-05 after a change by Marcov, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's [[Licensing]] page. If you have concerns about this material, [message the admin](/wiki-contact).*
173+Category: CHM
174+Category: Help and Docs
175+Category: Packages

Back to history