Sign in Join
Wiki copytemporary

Help protocol: what changed

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

OldNewLine
11## Overview
22
33This page describes the protocol used to communicate between the Lazarus IDE (as well as Lazarus applications that include chm help) and the help viewer. This protocol is used to provide context-sensitive help. Currently, the lhelp chm viewer supports this protocol.
44
55This page can be helpful in adapting alternative viewers (e.g. the one delivered with [[fpGUI]]) to be used more easily with Lazarus.
66
77## Required switches
88
99The viewer program needs to support these command-line switches as the IDE will start the viewer with them:
1010
1111- `--ipcname <name>`: name is the name of the IPC server started by the IDE
1212
1313## IPC protocol
1414
1515- The IDE sets up a [[SimpleIPC]] connection to the viewer and may send these commands (constant names):
1616 - `rtFile`: asks the viewer to open a help file (which is specified in a `TFileRequest`)
1717 - `rtURL`: asks the viewer to open an URL (specified in a `TURLRequest`)
1818 - `rtContext`: asks the viewer to open up a context/specific help item name? (specified in a `TContextRequest`)
1919- There is an additional IPC channel between viewer and IDE that carries data from viewer to IDE.
2020- The viewer responds success or failure (codes: see below) after receiving and processing a command from the IDE.
2121
2222As per July 2013, the viewer part is implemented in e.g. (\$lazarusdir)\components\chmhelp\lhelp\lhelpcore.pas; the request constants are defined in (\$lazarusdir)\components\chmhelp\packages\help\lhelpcontrol.pas
2323
2424## Current protocol
2525
2626Current protocol version is 2.1 (implemented in Lazarus trunk revision, 16 October 2014)
2727
2828- The IDE passes an `--ipcname` starting with a server dependent string constant \[1\] then string representation of the last 5 digits of the application processID/PID padded with 00000 at the right \[2\] so having multiple IDE/lhelp sets does not interfere with communication.
2929- The viewer must support a `--hide` command-line option: it should not show the contents of loading/loaded help files in the GUI but allow e.g. loading of help files and receiving further instructions from the IDE.
3030- After sending a command, the IDE must not send another command until:
3131 - it receives a response from the client (see above) or
3232 - a timeout has been reached.
3333- Additional commands:
3434 - `version` (IDE=\>viewer): passes help protocol version (e.g. 1). If the client does not support it, it should return `TLHelpResponse.srError`, else `TLHelpResponse.srSuccess`.
3535 - `close` (IDE=\>viewer): client may respond `TLHelpResponse.srSuccess` or not send a response, and then close itself. Used when the IDE is closed.
3636 - `TLHelpResponse.srSuccess` (viewer=\>IDE): viewer has succesfully completed the last command issued by the IDE.
3737 - General error code `TLHelpResponse.srError`, or the more specific `TLHelpResponse.srNoAnswer`, `TLHelpResponse.srInvalidFile`, `TLHelpResponse.srInvalidURL`, `TLHelpResponse.srInvalidContext` (viewer=\>IDE): viewer could not successfully complete the command.
3838
39-\[1\] The string constant may contain only \['a'..'z', 'A'..'Z', '_'\] characters. In the Lazarus implementation, this is <s>the value specified in tools/options/help options/chm help viewer/HelpLabel, default</s> lazhelp \[2\] code would be something like this:
39+\[1\] The string constant may contain only \['a'..'z', 'A'..'Z', '_'\] characters. In the Lazarus implementation, this is the value specified in tools/options/help options/chm help viewer/HelpLabel, default lazhelp \[2\] code would be something like this:
4040
4141``` pascal
4242copy(inttostr(GetProcessID)+'00000',1,5)
4343```
4444
4545## See also
4646
4747- [[Creating IDE Help]]
4848- [[chmhelp]]
4949- [SimpleIPC documentation](http://lazarus-ccr.sourceforge.net/docs/fcl/simpleipc/index.html)
5050
5151---
5252*From the Free Pascal wiki, page "Help protocol", as it stood on 2020-02-17 after a change by Trev, 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).*
5353Category: Help and Docs
5454Category: IDE
5555Category: Lazarus
5656Category: Lazarus internals

Back to history