summaryrefslogtreecommitdiff
path: root/lib-src/make-docfile.c
diff options
context:
space:
mode:
authorJim Blandy <jimb@redhat.com>1992-09-29 03:14:35 +0000
committerJim Blandy <jimb@redhat.com>1992-09-29 03:14:35 +0000
commitbb8e17bb7f8fbb12442ad5b5c77c3658b543c220 (patch)
tree535d6e085d449a513fdf7f529a4eff27b470dd72 /lib-src/make-docfile.c
parentfc57bdc3d0efa8dadee9f57a14a5c08bcb067cd8 (diff)
downloademacs-bb8e17bb7f8fbb12442ad5b5c77c3658b543c220.tar.gz
entered into RCS
Diffstat (limited to 'lib-src/make-docfile.c')
-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)
int minargs, maxargs;
{
register char *p;
- int space = 0;
+ int in_ident = 0;
+ int just_spaced = 0;
fprintf (out, "arguments: ");
for (p = buf; *p; p++)
{
- if (*p == ',' || p == buf)
+ char c = *p;
+
+ /* Notice when we start printing a new identifier. */
+ if ((('A' <= c && c <= 'Z')
+ || ('a' <= c && c <= 'z')
+ || ('0' <= c && c <= '9')
+ || c == '_')
+ != in_ident)
{
- if (!space)
- putc (' ', out);
- if (minargs == 0 && maxargs > 0)
- fprintf (out, "&optional ");
- space = 1;
+ if (!in_ident)
+ {
+ in_ident = 1;
- minargs--;
- maxargs--;
+ if (minargs == 0 && maxargs > 0)
+ fprintf (out, "&optional ");
+ just_spaced = 1;
- continue;
+ minargs--;
+ maxargs--;
+ }
+ else
+ in_ident = 0;
}
- else if (*p == ' ' && space)
- continue;
- space = (*p == ' ');
- /* Print the C arguments as they would appear in Elisp;
- print underscores as hyphens. */
- if (*p == '_')
- putc ('-', out);
- else
- putc (*p, out);
+ /* Print the C argument list as it would appear in lisp:
+ print underscores as hyphens, and print commas as spaces.
+ Collapse adjacent spaces into one. */
+ if (c == '_') c = '-';
+ if (c == ',') c = ' ';
+
+ if (c != ' ' || ! just_spaced)
+ putc (c, out);
+
+ just_spaced = (c == ' ');
}
- putc ('\n', out);
}
/* Read through a c file. If a .o file is named,