Debian Codegraph @

Instant/README

raw
1 #
2 # Copyright (c) 1994
3 # Open Software Foundation, Inc.
4 #
5 # Permission is hereby granted to use, copy, modify and freely distribute
6 # the software in this file and its documentation for any purpose without
7 # fee, provided that the above copyright notice appears in all copies and
8 # that both the copyright notice and this permission notice appear in
9 # supporting documentation. Further, provided that the name of Open
10 # Software Foundation, Inc. ("OSF") not be used in advertising or
11 # publicity pertaining to distribution of the software without prior
12 # written permission from OSF. OSF makes no representations about the
13 # suitability of this software for any purpose. It is provided "as is"
14 # without express or implied warranty.
15 #
16 # Copyright (c) 1996 X Consortium
17 # Copyright (c) 1995, 1996 Dalrymple Consulting
18 #
19 # Permission is hereby granted, free of charge, to any person obtaining a copy
20 # of this software and associated documentation files (the "Software"), to deal
21 # in the Software without restriction, including without limitation the rights
22 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23 # copies of the Software, and to permit persons to whom the Software is
24 # furnished to do so, subject to the following conditions:
25 #
26 # The above copyright notice and this permission notice shall be included in
27 # all copies or substantial portions of the Software.
28 #
29 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32 # X CONSORTIUM OR DALRYMPLE CONSULTING BE LIABLE FOR ANY CLAIM, DAMAGES OR
33 # OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
34 # ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
35 # OTHER DEALINGS IN THE SOFTWARE.
36 #
37 # Except as contained in this notice, the names of the X Consortium and
38 # Dalrymple Consulting shall not be used in advertising or otherwise to
39 # promote the sale, use or other dealings in this Software without prior
40 # written authorization.
41 #
42
43 instant - a formatting application for OSF SGML instances
44 ____________________________________________________________________________
45
46 Requirements
47
48 ANSI C compiler (gcc is one)
49
50 sgmls 1.1 -- sgml parser from James Clark. Based on Goldfarb's ARC parser.
51
52 Vanilla unix make
53
54 POSIX C libraries
55
56
57 Files for instant program
58
59 Module Function
60 ------ --------
61 browse.c interactive browser
62 general.h general definitions
63 info.c print information about the instances
64 main.c main entry, arg parsing, instance reading
65 tables.c table-specific formatting routines (TeX and tbl)
66 traninit.c translator initialization (read spec, etc.)
67 translate.c main translator
68 translate.h structure definitions for translation code
69 tranvar.c routines for handling "special variables"
70 util.c general utilities
71
72
73 Also required
74
75 1. Translation spec (transpec) files. (../transpecs/*.ts)
76 2. SDATA mapping files for mapping sdata entities. (../transpecs/*.sdata)
77 3. Character mapping files for mapping characters. (../transpecs/*.cmap)
78
79
80 Platforms tried on
81
82 OSF1 1.3 (i486)
83 Ultrix 4.2 (mips)
84 HP-UX 9.01 (hp 9000/700)
85 AIX 3.2 (rs6000)
86 SunOS [missing strerror()]
87
88 ____________________________________________________________________________
89
90 General outline of program
91 ------- ------- -- -------
92
93 To summarize in a sentence, instant reads the output of sgmls, builds a tree
94 of the instnace in memory, then traverses the tree in in-order, processing
95 the nodes according to a translation spec.
96
97 Element tree storage
98 ------- ---- -------
99
100 The first thing instant must do is read the ESIS (output of sgmls) from the
101 specified file or stdin, forming a tree in memory. (Nothing makes sense
102 without an instance...) Each element of the instance is a node in the tree,
103 stored as a structure called Element_t. Elements contain content (what
104 else?), which is a mixture of data (#PCDATA, #CDATA, #RCDATA - all the same
105 in the ESIS), child elements, and PIs. Each 'chunk' of content is referred
106 to by a Content_t structure. A Content_t contains an enum that can point to
107 a string (data or PI), another Element_t. For example, if a <p> element
108 contains some characters, an <emphasis> element, some more characters,
109 a <function> element, then some more characters, it has 5 Content_t children
110 as an array.
111
112 Element_t's have pointers to their parents, and a next element in a linked
113 list (they're stored as a linked list, for cases when you'd want to quickly
114 travers all the nodes, in no particular order).
115 For convenience, Element_t's have an array of pointers to it's child
116 Element_t's. These are just pointers to the same thing contained in the
117 Content_t array, without the intervening data or PIs. This makes it easier
118 for the program to traverse the elements of the tree (it does not have to
119 be concerned with skipping data, etc.). There is an analagous array of
120 pointers for the data content, an array of (char *)'s. This makes it easier
121 to consider the immediate character content of an element.
122
123 Attributes are kept as an array of name-value mappings (using the typedef
124 Mapping_t). ID attributes are also stored in a separate list of ID value -
125 element pointer pairs so that it is quick to find an element by ID.
126
127 Other information kept about each element (in the Element_t struct) includes
128 the line number in the EISI where the element occurs, the input filename.
129 (These depend on sgmls being run with the "-l" option.) Also stored is
130 an element's order in its parent's collection of children and an element's
131 depth in the tree.
132
133 Translation specs
134 ----------- -----
135
136 A translation spec is read into a linked list in memory. As the instance
137 tree is traversed, the transpecs are searched in order for a match. As a
138 rule, one should position the less specific transpecs later in the file.
139 Also, specs for seldom-used element are best placed later in the file, since
140 it takes cpu cycles to skip over them for each of the more-used elements.
141
142 During translation of a particular element, the list of Content_t structures
143 are processed in order. If a content 'chunk' is data, it is printed to
144 the output stream. If it is an element, the translation routine is called
145 for that elemen, recursively. Hence, in-order traversal.
146
147 Miscellaneous information displays
148 ------------- ----------- --------
149
150 There are several informational display options available. They include:
151 - a list of element usage (-u) -- lists each element in the instance,
152 it's attributes, number of children, parent, data content 'nodes'.
153 - statistics about elements (-S) -- lists elements, number of times
154 each is used, percent of elements that this is, total char content
155 in that element, average number of characters in they element.
156 - show context of each element (-x) -- lists each element and its
157 context, looking up the tree (this is the same context that
158 would match the Context field of a transpec).
159 - show the hierarchy of the instance (-h) -- show an ascii 'tree' of
160 the instance, where elements deeper in the tree are indented more.
161 Numbers after the element name in parentheses are the number of
162 element content nodes and the number of data content nodes.
163
164 Interactive browser
165 ----------- -------
166
167 Originally, the interactive browser was intended as a debugging aid for
168 the code developer. It was a way to examine a particular node of the
169 instance tree or process a subtree without being distracted by the rest
170 of the instance. Many of the commands test functionality of the query
171 and search code (such as testing whether a certain element has a given
172 relationship to the current position in the tree).
173
174
175 ____________________________________________________________________________
176