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