annotate lib-src/sorted-doc.c @ 380:8626e4521993 r21-2-5

Import from CVS: tag r21-2-5
author cvs
date Mon, 13 Aug 2007 11:07:10 +0200
parents cc15677e0335
children 74fd4e045ea6
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
1 /* Give this program DOCSTR.mm.nn as standard input
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
2 and it outputs to standard output
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
3 a file of texinfo input containing the doc strings.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
4
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
5 This version sorts the output by function name.
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
6 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
7
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
8 /* Synched up with: FSF 19.28. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
9
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
10 #include <../src/config.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
11
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
12 #include <stdio.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
13 #include <ctype.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
14 #if __STDC__ || defined(STDC_HEADERS)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
15 # include <stdlib.h> /* for qsort() and malloc() */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
16 # include <string.h>
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
17 static void *xmalloc (int);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
18 # ifndef CONST
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
19 # define CONST const
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
20 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
21 #else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
22 extern char *malloc ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
23 static void *xmalloc ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
24 # ifndef CONST
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
25 # define CONST
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
26 # endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
27 #endif
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
28
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
29 #define NUL '\0'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
30 #define MARKER '\037'
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
31
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
32 #define DEBUG 0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
33
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
34 typedef struct line LINE;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
35
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
36 struct line
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
37 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
38 LINE *next; /* ptr to next or NULL */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
39 char *line; /* text of the line */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
40 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
41
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
42 typedef struct docstr DOCSTR;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
43
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
44 struct docstr /* Allocated thing for an entry. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
45 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
46 DOCSTR *next; /* next in the chain */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
47 char *name; /* name of the function or var */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
48 LINE *first; /* first line of doc text. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
49 char type; /* 'F' for function, 'V' for variable */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
50 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
51
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
52
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
53 /* Print error message. `s1' is printf control string, `s2' is arg for it. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
54
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
55 static void
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 0
diff changeset
56 error (char *s1, char *s2)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 fprintf (stderr, "sorted-doc: ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 fprintf (stderr, s1, s2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 fprintf (stderr, "\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63 /* Print error message and exit. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65 static void
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 0
diff changeset
66 fatal (char *s1, char *s2)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 error (s1, s2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 /* Like malloc but get fatal error if memory is exhausted. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 static void *
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 0
diff changeset
75 xmalloc (int size)
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 char *result = malloc ((unsigned)size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 if (result == NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 fatal ("%s", "virtual memory exhausted");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 static char *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 strsav (char *str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 char *buf = xmalloc (strlen (str) + 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 (void) strcpy (buf, str);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 return (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 /* Comparison function for qsort to call. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 cmpdoc (DOCSTR **a, DOCSTR **b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 register int val = strcmp ((*a)->name, (*b)->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 if (val) return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 return (*a)->type - (*b)->type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 enum state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104 WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 CONST char *states[] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109 "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 int
169
15872534500d Import from CVS: tag r20-3b11
cvs
parents: 0
diff changeset
113 main (int argc, char *argv[])
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 register DOCSTR *dp = NULL; /* allocated DOCSTR */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 register LINE *lp = NULL; /* allocated line */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 register char *bp = 0; /* ptr inside line buffer */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 /* int notfirst = 0; / * set after read something */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 register enum state state = WAITING; /* state at start */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 int cnt = 0; /* number of DOCSTRs read */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 DOCSTR *docs = 0; /* chain of allocated DOCSTRS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 char buf[512]; /* line buffer */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 while (1) /* process one char at a time */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127 /* this char from the DOCSTR file */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 register int ch = getchar ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 /* Beginnings */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132 if (state == WAITING)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134 if (ch == MARKER)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 state = BEG_NAME;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 else if (state == BEG_NAME)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 cnt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 if (dp == NULL) /* first dp allocated */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 docs = dp = (DOCSTR*) xmalloc (sizeof (DOCSTR));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 else /* all the rest */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 dp->next = (DOCSTR*) xmalloc (sizeof (DOCSTR));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 dp = dp->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 lp = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 dp->next = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 bp = buf;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 state = NAME_GET;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 /* Record whether function or variable. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 dp->type = ch;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 ch = getchar ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 else if (state == BEG_DESC)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 if (lp == NULL) /* first line for dp */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 dp->first = lp = (LINE*)xmalloc (sizeof (LINE));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 else /* continuing lines */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 lp->next = (LINE*)xmalloc (sizeof (LINE));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 lp = lp->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
167 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
168 lp->next = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 bp = buf;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 state = DESC_GET;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 /* process gets */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175 if (state == NAME_GET || state == DESC_GET)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177 if (ch != MARKER && ch != '\n' && ch != EOF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 *bp++ = ch;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 else /* saving and changing state */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 *bp = NUL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 bp = strsav (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 if (state == NAME_GET)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 dp->name = bp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 lp->line = bp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 bp = buf;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 state = (ch == MARKER) ? BEG_NAME : BEG_DESC;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 } /* NAME_GET || DESC_GET */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 if (ch == EOF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 DOCSTR **array;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201 register int i; /* counter */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 /* build array of ptrs to DOCSTRs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205 array = (DOCSTR**)xmalloc (cnt * sizeof (*array));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 for (dp = docs, i = 0; dp != NULL ; dp = dp->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207 array[i++] = dp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 /* sort the array by name; within each name, by type */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211 qsort ((char*)array, cnt, sizeof (DOCSTR*),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 /* was cast to (int (*)(CONST void *, CONST void *))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213 but that loses on HP because CONST_IS_LOSING. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 /* This one loses too: (int (*)()) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 /* Ok, so let's try const instead of CONST. Fuck me!!! */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 (int (*)(const void *, const void *))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 cmpdoc);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 /* write the output header */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221 printf ("\\input texinfo @c -*-texinfo-*-\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 printf ("@setfilename ../info/summary\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223 printf ("@settitle Command Summary for GNU Emacs\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 printf ("@unnumbered Command Summary for GNU Emacs\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 printf ("@table @asis\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 printf ("\n");
371
cc15677e0335 Import from CVS: tag r21-2b1
cvs
parents: 339
diff changeset
227 printf ("@let@ITEM@item\n");
0
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 printf ("@def@item{@filbreak@vskip5pt@ITEM}\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 printf ("@font@tensy cmsy10 scaled @magstephalf\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 printf ("@font@teni cmmi10 scaled @magstephalf\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 printf ("@def\\{{@tensy@char110}}\n"); /* this backslash goes with cmr10 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 printf ("@def|{{@tensy@char106}}\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 printf ("@def@{{{@tensy@char102}}\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 printf ("@def@}{{@tensy@char103}}\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 printf ("@def<{{@teni@char62}}\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 printf ("@def>{{@teni@char60}}\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 printf ("@chardef@@64\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 printf ("@catcode43=12\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 printf ("@tableindent-0.2in\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 /* print each function from the array */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243 for (i = 0; i < cnt; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245 printf ("\n@item %s @code{%s}\n@display\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 array[i]->type == 'F' ? "Function" : "Variable",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 array[i]->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 for (lp = array[i]->first; lp != NULL ; lp = lp->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251 for (bp = lp->line; *bp; bp++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 /* the characters "@{}" need special treatment */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 if (*bp == '@' || *bp == '{' || *bp == '}')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
255 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
256 putchar('@');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 putchar(*bp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 putchar ('\n');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 printf("@end display\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
264
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
265 printf ("@end table\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 printf ("@bye\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 }