Debian Codegraph @

TECHSTUFF

raw
1 How does this program work. (for hackers ;)
2
3 1. Info file format
4
5 Info files always contain a tag_table, which contains offsets to all nodes.
6 If the info is splitted up into several subinfo files, there is a indirect
7 table, which indicates, which offsets are in which file. Every node starts
8 from an INFO_TAG, and ends at the EOF, or at another INFO_TAG.
9
10 Menus are recognized as lines of format
11
12 *Tag Table Node Name::comment
13
14 and also as
15
16 * comment: [spaces] Tag Table Node Name.
17
18 Notes are recognized as lines of format
19
20 blabla*note Tag Table Node Name::blabla
21
22 and also as
23
24 blabla*note comment: [spaces] Tag Table Node Name.
25
26 Notes may be split up across lines.
27
28 The offsets in tag_table in an indirect split are counted as follows:
29
30 tag_table_offset-indirect_offset+tag_table[1]_offset
31
32 In nonindirect splits it's normal.
33
34 2. How are man pages handled?
35
36 All of this is handled in manual.c. It is called man program there to
37 produce output, which is then parsed by pinfo.
38
39 3. A scheme of working when viewing info
40
41 a) opening file (pinfo.c, filehandling_functions.c)
42 b) seeking to the indirect table, and reading it
43 - important function here is read_item, which reads an info
44 node; that is a block of text starting with INFOTAG, and ending
45 with it, or with another INFOTAG
46 c) doing the same for tag_table
47 d) running 'work' function (mainfunction.c), which handles keyboard actions
48 - when this function is called, before it gets to the main loop,
49 it sets up some standard variables, like position in viewed node,
50 position of selected line with node (it is line oriented selection
51 here).
52 * it handles also here situations like 'aftersearch',
53 where the function recognizes, that it's called after
54 a search across infofiles, and that it must set the
55 position to a value determined by previous search
56 * besides aftersearch it must also handle the history
57 -backward move; it uses then the npos and ncursor vars.
58 * it also initializes caches for isnote and ismenu functions
59 which check if given line contains a menu or note.
60 - after that there follows a normal loop with quite clear cases.
61 e) from the 'work' function there is called a function showscreen, which
62 paints the screen (in quite simple way).
63
64 The scheme of work when viewing manual is quite similar.
65
66 4. Additional notes
67 - the regexp search via all info files is probably one of the most
68 complicated functions
69 For regexp search I've adapted a procedure from midnight commander, and
70 put it into the file regexp_search.c
71
72 For list of global variables, see datatypes.h
73
74 For list of global vars for the manual code, see manual.c