[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r100764: * make-docfile.c (write_c_ar
From: |
Andreas Schwab |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r100764: * make-docfile.c (write_c_args): Restructure scanning loop. |
Date: |
Fri, 09 Jul 2010 19:00:04 +0200 |
User-agent: |
Bazaar (2.0.3) |
------------------------------------------------------------
revno: 100764
committer: Andreas Schwab <address@hidden>
branch nick: emacs
timestamp: Fri 2010-07-09 19:00:04 +0200
message:
* make-docfile.c (write_c_args): Restructure scanning loop.
modified:
lib-src/ChangeLog
lib-src/make-docfile.c
=== modified file 'lib-src/ChangeLog'
--- a/lib-src/ChangeLog 2010-07-09 01:09:50 +0000
+++ b/lib-src/ChangeLog 2010-07-09 17:00:04 +0000
@@ -1,3 +1,7 @@
+2010-07-09 Andreas Schwab <address@hidden>
+
+ * make-docfile.c (write_c_args): Restructure scanning loop.
+
2010-07-09 Dan Nicolaescu <address@hidden>
* make-docfile.c (write_c_args): Deal with type names in DEFUN
=== modified file 'lib-src/make-docfile.c'
--- a/lib-src/make-docfile.c 2010-07-09 01:09:50 +0000
+++ b/lib-src/make-docfile.c 2010-07-09 17:00:04 +0000
@@ -440,8 +440,8 @@
{
register char *p;
int in_ident = 0;
- int just_spaced = 0;
- int need_space = 1;
+ char *ident_start;
+ int ident_length;
fprintf (out, "(fn");
@@ -450,25 +450,9 @@
for (p = buf; *p; p++)
{
- char c;
- int ident_start = 0;
-
- /* FIXME: this must be made a bit more robust*/
-
- /* Skip "register Lisp_Object", this can be removed when we get
- rid of "register" for DEFUNs. */
- if (strncmp ("register Lisp_Object", p, 20) == 0)
- p += 20;
-
- if (strncmp ("Lisp_Object", p, 11) == 0)
- p += 11;
-
- if (strncmp ("void", p, 4) == 0)
- p += 4;
-
- c = *p;
-
- /* Notice when we start printing a new identifier. */
+ char c = *p;
+
+ /* Notice when a new identifier starts. */
if ((('A' <= c && c <= 'Z')
|| ('a' <= c && c <= 'z')
|| ('0' <= c && c <= '9')
@@ -478,55 +462,50 @@
if (!in_ident)
{
in_ident = 1;
- ident_start = 1;
-
- if (need_space)
- putc (' ', out);
-
- if (minargs == 0 && maxargs > 0)
- fprintf (out, "&optional ");
- just_spaced = 1;
-
- minargs--;
- maxargs--;
- }
- else
- in_ident = 0;
- }
-
- /* Print the C argument list as it would appear in lisp:
- print underscores as hyphens, and print commas and newlines
- as spaces. Collapse adjacent spaces into one. */
- if (c == '_')
- c = '-';
- else if (c == ',' || c == '\n')
- c = ' ';
-
- /* In C code, `default' is a reserved word, so we spell it
- `defalt'; unmangle that here. */
- if (ident_start
- && strncmp (p, "defalt", 6) == 0
- && ! (('A' <= p[6] && p[6] <= 'Z')
- || ('a' <= p[6] && p[6] <= 'z')
- || ('0' <= p[6] && p[6] <= '9')
- || p[6] == '_'))
- {
- fprintf (out, "DEFAULT");
- p += 5;
- in_ident = 0;
- just_spaced = 0;
- }
- else if (c != ' ' || !just_spaced)
- {
- if (c >= 'a' && c <= 'z')
- /* Upcase the letter. */
- c += 'A' - 'a';
- putc (c, out);
- }
-
- just_spaced = c == ' ';
- need_space = 0;
+ ident_start = p;
+ }
+ else
+ {
+ in_ident = 0;
+ ident_length = p - ident_start;
+ }
+ }
+
+ /* Found the end of an argument, write out the last seen
+ identifier. */
+ if (c == ',' || c == ')')
+ {
+ if (strncmp (ident_start, "void", ident_length) == 0)
+ continue;
+
+ putc (' ', out);
+
+ if (minargs == 0 && maxargs > 0)
+ fprintf (out, "&optional ");
+
+ minargs--;
+ maxargs--;
+
+ /* In C code, `default' is a reserved word, so we spell it
+ `defalt'; unmangle that here. */
+ if (strncmp (ident_start, "defalt", ident_length) == 0)
+ fprintf (out, "DEFAULT");
+ else
+ while (ident_length-- > 0)
+ {
+ c = *ident_start++;
+ if (c >= 'a' && c <= 'z')
+ /* Upcase the letter. */
+ c += 'A' - 'a';
+ else if (c == '_')
+ /* Print underscore as hyphen. */
+ c = '-';
+ putc (c, out);
+ }
+ }
}
+
+ putc (')', out);
}
/* Read through a c file. If a .o file is named,
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r100764: * make-docfile.c (write_c_args): Restructure scanning loop.,
Andreas Schwab <=