annotate lib-src/sorted-doc.c @ 13:13c6d0aaafe5

Added tag r19-15b7 for changeset bcdc7deadc19
author cvs
date Mon, 13 Aug 2007 08:48:18 +0200
parents 376386a54a3c
children 15872534500d
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
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
56 error (s1, s2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
57 char *s1, *s2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
58 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
59 fprintf (stderr, "sorted-doc: ");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
60 fprintf (stderr, s1, s2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
61 fprintf (stderr, "\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
62 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
63
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
64 /* Print error message and exit. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
65
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
66 static void
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
67 fatal (s1, s2)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
68 char *s1, *s2;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
69 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
70 error (s1, s2);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
71 exit (1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
72 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
73
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
74 /* Like malloc but get fatal error if memory is exhausted. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
75
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
76 static void *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
77 xmalloc (size)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
78 int size;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
79 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
80 char *result = malloc ((unsigned)size);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
81 if (result == NULL)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
82 fatal ("%s", "virtual memory exhausted");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
83 return result;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
84 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
85
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
86 static char *
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
87 strsav (char *str)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
88 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
89 char *buf = xmalloc (strlen (str) + 1);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
90 (void) strcpy (buf, str);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
91 return (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
92 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
93
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
94 /* Comparison function for qsort to call. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
95
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
96 static int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
97 cmpdoc (DOCSTR **a, DOCSTR **b)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
98 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
99 register int val = strcmp ((*a)->name, (*b)->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
100 if (val) return val;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
101 return (*a)->type - (*b)->type;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
102 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
103
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
104
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
105 enum state
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
106 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
107 WAITING, BEG_NAME, NAME_GET, BEG_DESC, DESC_GET
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
108 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
109
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
110 CONST char *states[] =
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
111 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
112 "WAITING", "BEG_NAME", "NAME_GET", "BEG_DESC", "DESC_GET"
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
113 };
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
114
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
115 int
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
116 main ()
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
117 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
118 register DOCSTR *dp = NULL; /* allocated DOCSTR */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
119 register LINE *lp = NULL; /* allocated line */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
120 register char *bp = 0; /* ptr inside line buffer */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
121 /* int notfirst = 0; / * set after read something */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
122 register enum state state = WAITING; /* state at start */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
123 int cnt = 0; /* number of DOCSTRs read */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
124
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
125 DOCSTR *docs = 0; /* chain of allocated DOCSTRS */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
126 char buf[512]; /* line buffer */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
127
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
128 while (1) /* process one char at a time */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
129 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
130 /* this char from the DOCSTR file */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
131 register int ch = getchar ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
132
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
133 /* Beginnings */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
134
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
135 if (state == WAITING)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
136 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
137 if (ch == MARKER)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
138 state = BEG_NAME;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
139 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
140 else if (state == BEG_NAME)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
141 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
142 cnt++;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
143 if (dp == NULL) /* first dp allocated */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
144 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
145 docs = dp = (DOCSTR*) xmalloc (sizeof (DOCSTR));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
146 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
147 else /* all the rest */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
148 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
149 dp->next = (DOCSTR*) xmalloc (sizeof (DOCSTR));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
150 dp = dp->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
151 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
152 lp = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
153 dp->next = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
154 bp = buf;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
155 state = NAME_GET;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
156 /* Record whether function or variable. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
157 dp->type = ch;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
158 ch = getchar ();
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
159 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
160 else if (state == BEG_DESC)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
161 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
162 if (lp == NULL) /* first line for dp */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
163 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
164 dp->first = lp = (LINE*)xmalloc (sizeof (LINE));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
165 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
166 else /* continuing lines */
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 = (LINE*)xmalloc (sizeof (LINE));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
169 lp = lp->next;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
170 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
171 lp->next = NULL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
172 bp = buf;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
173 state = DESC_GET;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
174 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
175
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
176 /* process gets */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
177
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
178 if (state == NAME_GET || state == DESC_GET)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
179 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
180 if (ch != MARKER && ch != '\n' && ch != EOF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
181 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
182 *bp++ = ch;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
183 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
184 else /* saving and changing state */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
185 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
186 *bp = NUL;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
187 bp = strsav (buf);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
188
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
189 if (state == NAME_GET)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
190 dp->name = bp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
191 else
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
192 lp->line = bp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
193
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
194 bp = buf;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
195 state = (ch == MARKER) ? BEG_NAME : BEG_DESC;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
196 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
197 } /* NAME_GET || DESC_GET */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
198 if (ch == EOF)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
199 break;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
200 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
201
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
202 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
203 DOCSTR **array;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
204 register int i; /* counter */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
205
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
206 /* build array of ptrs to DOCSTRs */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
207
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
208 array = (DOCSTR**)xmalloc (cnt * sizeof (*array));
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
209 for (dp = docs, i = 0; dp != NULL ; dp = dp->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
210 array[i++] = dp;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
211
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
212 /* sort the array by name; within each name, by type */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
213
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
214 qsort ((char*)array, cnt, sizeof (DOCSTR*),
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
215 /* was cast to (int (*)(CONST void *, CONST void *))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
216 but that loses on HP because CONST_IS_LOSING. */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
217 /* This one loses too: (int (*)()) */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
218 /* Ok, so let's try const instead of CONST. Fuck me!!! */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
219 (int (*)(const void *, const void *))
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
220 cmpdoc);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
221
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
222 /* write the output header */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
223
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
224 printf ("\\input texinfo @c -*-texinfo-*-\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
225 printf ("@setfilename ../info/summary\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
226 printf ("@settitle Command Summary for GNU Emacs\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
227 printf ("@unnumbered Command Summary for GNU Emacs\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
228 printf ("@table @asis\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
229 printf ("\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
230 printf ("@let@ITEM@item\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
231 printf ("@def@item{@filbreak@vskip5pt@ITEM}\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
232 printf ("@font@tensy cmsy10 scaled @magstephalf\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
233 printf ("@font@teni cmmi10 scaled @magstephalf\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
234 printf ("@def\\{{@tensy@char110}}\n"); /* this backslash goes with cmr10 */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
235 printf ("@def|{{@tensy@char106}}\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
236 printf ("@def@{{{@tensy@char102}}\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
237 printf ("@def@}{{@tensy@char103}}\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
238 printf ("@def<{{@teni@char62}}\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
239 printf ("@def>{{@teni@char60}}\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
240 printf ("@chardef@@64\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
241 printf ("@catcode43=12\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
242 printf ("@tableindent-0.2in\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
243
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
244 /* print each function from the array */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
245
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
246 for (i = 0; i < cnt; i++)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
247 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
248 printf ("\n@item %s @code{%s}\n@display\n",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
249 array[i]->type == 'F' ? "Function" : "Variable",
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
250 array[i]->name);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
251
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
252 for (lp = array[i]->first; lp != NULL ; lp = lp->next)
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
253 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
254 for (bp = lp->line; *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 /* the characters "@{}" need special treatment */
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
257 if (*bp == '@' || *bp == '{' || *bp == '}')
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
258 {
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
259 putchar('@');
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
260 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
261 putchar(*bp);
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
262 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
263 putchar ('\n');
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 display\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
266 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
267
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
268 printf ("@end table\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
269 printf ("@bye\n");
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
270 }
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
271
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
272 return 0;
376386a54a3c Import from CVS: tag r19-14
cvs
parents:
diff changeset
273 }