aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Blandy1992-09-29 03:14:35 +0000
committerJim Blandy1992-09-29 03:14:35 +0000
commit30e4c427e196052d6e76dafe02feee1e1dcbd405 (patch)
tree053f0cff445b6b4c334f5d670a97ebcf5dcebc08
parent98b7fe026f670a7500bb379fea168fff4155b05c (diff)
downloademacs-30e4c427e196052d6e76dafe02feee1e1dcbd405.tar.gz
emacs-30e4c427e196052d6e76dafe02feee1e1dcbd405.zip
entered into RCS
-rw-r--r--lib-src/make-docfile.c51
1 files changed, 31 insertions, 20 deletions
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index 037e00e6800..3b5d3a16052 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -144,37 +144,48 @@ write_c_args (out, buf, minargs, maxargs)
144 int minargs, maxargs; 144 int minargs, maxargs;
145{ 145{
146 register char *p; 146 register char *p;
147 int space = 0; 147 int in_ident = 0;
148 int just_spaced = 0;
148 149
149 fprintf (out, "arguments: "); 150 fprintf (out, "arguments: ");
150 151
151 for (p = buf; *p; p++) 152 for (p = buf; *p; p++)
152 { 153 {
153 if (*p == ',' || p == buf) 154 char c = *p;
155
156 /* Notice when we start printing a new identifier. */
157 if ((('A' <= c && c <= 'Z')
158 || ('a' <= c && c <= 'z')
159 || ('0' <= c && c <= '9')
160 || c == '_')
161 != in_ident)
154 { 162 {
155 if (!space) 163 if (!in_ident)
156 putc (' ', out); 164 {
157 if (minargs == 0 && maxargs > 0) 165 in_ident = 1;
158 fprintf (out, "&optional ");
159 space = 1;
160 166
161 minargs--; 167 if (minargs == 0 && maxargs > 0)
162 maxargs--; 168 fprintf (out, "&optional ");
169 just_spaced = 1;
163 170
164 continue; 171 minargs--;
172 maxargs--;
173 }
174 else
175 in_ident = 0;
165 } 176 }
166 else if (*p == ' ' && space)
167 continue;
168 space = (*p == ' ');
169 177
170 /* Print the C arguments as they would appear in Elisp; 178 /* Print the C argument list as it would appear in lisp:
171 print underscores as hyphens. */ 179 print underscores as hyphens, and print commas as spaces.
172 if (*p == '_') 180 Collapse adjacent spaces into one. */
173 putc ('-', out); 181 if (c == '_') c = '-';
174 else 182 if (c == ',') c = ' ';
175 putc (*p, out); 183
184 if (c != ' ' || ! just_spaced)
185 putc (c, out);
186
187 just_spaced = (c == ' ');
176 } 188 }
177 putc ('\n', out);
178} 189}
179 190
180/* Read through a c file. If a .o file is named, 191/* Read through a c file. If a .o file is named,