diff options
Diffstat (limited to 'lib-src/make-docfile.c')
| -rw-r--r-- | lib-src/make-docfile.c | 62 |
1 files changed, 21 insertions, 41 deletions
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c index bd87b5b6524..2654387fb37 100644 --- a/lib-src/make-docfile.c +++ b/lib-src/make-docfile.c | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | /* Generate doc-string file for GNU Emacs from source files. | 1 | /* Generate doc-string file for GNU Emacs from source files. |
| 2 | Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2012 | 2 | |
| 3 | Free Software Foundation, Inc. | 3 | Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2012 |
| 4 | Free Software Foundation, Inc. | ||
| 4 | 5 | ||
| 5 | This file is part of GNU Emacs. | 6 | This file is part of GNU Emacs. |
| 6 | 7 | ||
| @@ -35,22 +36,26 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 35 | 36 | ||
| 36 | #include <config.h> | 37 | #include <config.h> |
| 37 | 38 | ||
| 38 | /* Defined to be emacs_main, sys_fopen, etc. in config.h. */ | ||
| 39 | #undef main | ||
| 40 | #undef fopen | ||
| 41 | #undef chdir | ||
| 42 | |||
| 43 | #include <stdio.h> | 39 | #include <stdio.h> |
| 44 | #include <stdlib.h> | 40 | #include <stdlib.h> /* config.h unconditionally includes this anyway */ |
| 45 | #ifdef MSDOS | 41 | #ifdef MSDOS |
| 46 | #include <fcntl.h> | 42 | #include <fcntl.h> |
| 47 | #endif /* MSDOS */ | 43 | #endif /* MSDOS */ |
| 48 | #ifdef WINDOWSNT | 44 | #ifdef WINDOWSNT |
| 45 | /* Defined to be sys_fopen in ms-w32.h, but only #ifdef emacs, so this | ||
| 46 | is really just insurance. */ | ||
| 47 | #undef fopen | ||
| 49 | #include <fcntl.h> | 48 | #include <fcntl.h> |
| 50 | #include <direct.h> | 49 | #include <direct.h> |
| 51 | #endif /* WINDOWSNT */ | 50 | #endif /* WINDOWSNT */ |
| 52 | 51 | ||
| 53 | #ifdef DOS_NT | 52 | #ifdef DOS_NT |
| 53 | /* Defined to be sys_chdir in ms-w32.h, but only #ifdef emacs, so this | ||
| 54 | is really just insurance. | ||
| 55 | |||
| 56 | Similarly, msdos defines this as sys_chdir, but we're not linking with the | ||
| 57 | file where that function is defined. */ | ||
| 58 | #undef chdir | ||
| 54 | #define READ_TEXT "rt" | 59 | #define READ_TEXT "rt" |
| 55 | #define READ_BINARY "rb" | 60 | #define READ_BINARY "rb" |
| 56 | #else /* not DOS_NT */ | 61 | #else /* not DOS_NT */ |
| @@ -58,33 +63,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ | |||
| 58 | #define READ_BINARY "r" | 63 | #define READ_BINARY "r" |
| 59 | #endif /* not DOS_NT */ | 64 | #endif /* not DOS_NT */ |
| 60 | 65 | ||
| 61 | #ifndef DIRECTORY_SEP | ||
| 62 | #define DIRECTORY_SEP '/' | ||
| 63 | #endif | ||
| 64 | |||
| 65 | #ifndef IS_DIRECTORY_SEP | ||
| 66 | #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP) | ||
| 67 | #endif | ||
| 68 | |||
| 69 | /* Use this to suppress gcc's `...may be used before initialized' warnings. */ | ||
| 70 | #ifdef lint | ||
| 71 | # define IF_LINT(Code) Code | ||
| 72 | #else | ||
| 73 | # define IF_LINT(Code) /* empty */ | ||
| 74 | #endif | ||
| 75 | |||
| 76 | static int scan_file (char *filename); | 66 | static int scan_file (char *filename); |
| 77 | static int scan_lisp_file (const char *filename, const char *mode); | 67 | static int scan_lisp_file (const char *filename, const char *mode); |
| 78 | static int scan_c_file (char *filename, const char *mode); | 68 | static int scan_c_file (char *filename, const char *mode); |
| 79 | static void start_globals (void); | 69 | static void start_globals (void); |
| 80 | static void write_globals (void); | 70 | static void write_globals (void); |
| 81 | 71 | ||
| 82 | #ifdef MSDOS | ||
| 83 | /* s/msdos.h defines this as sys_chdir, but we're not linking with the | ||
| 84 | file where that function is defined. */ | ||
| 85 | #undef chdir | ||
| 86 | #endif | ||
| 87 | |||
| 88 | #include <unistd.h> | 72 | #include <unistd.h> |
| 89 | 73 | ||
| 90 | /* Stdio stream for output to the DOC file. */ | 74 | /* Stdio stream for output to the DOC file. */ |
| @@ -561,14 +545,15 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs) | |||
| 561 | putc (')', out); | 545 | putc (')', out); |
| 562 | } | 546 | } |
| 563 | 547 | ||
| 564 | /* The types of globals. */ | 548 | /* The types of globals. These are sorted roughly in decreasing alignment |
| 549 | order to avoid allocation gaps, except that functions are last. */ | ||
| 565 | enum global_type | 550 | enum global_type |
| 566 | { | 551 | { |
| 567 | FUNCTION, | 552 | INVALID, |
| 553 | LISP_OBJECT, | ||
| 568 | EMACS_INTEGER, | 554 | EMACS_INTEGER, |
| 569 | BOOLEAN, | 555 | BOOLEAN, |
| 570 | LISP_OBJECT, | 556 | FUNCTION, |
| 571 | INVALID | ||
| 572 | }; | 557 | }; |
| 573 | 558 | ||
| 574 | /* A single global. */ | 559 | /* A single global. */ |
| @@ -617,13 +602,8 @@ compare_globals (const void *a, const void *b) | |||
| 617 | const struct global *ga = a; | 602 | const struct global *ga = a; |
| 618 | const struct global *gb = b; | 603 | const struct global *gb = b; |
| 619 | 604 | ||
| 620 | if (ga->type == FUNCTION) | 605 | if (ga->type != gb->type) |
| 621 | { | 606 | return ga->type - gb->type; |
| 622 | if (gb->type != FUNCTION) | ||
| 623 | return 1; | ||
| 624 | } | ||
| 625 | else if (gb->type == FUNCTION) | ||
| 626 | return -1; | ||
| 627 | 607 | ||
| 628 | return strcmp (ga->name, gb->name); | 608 | return strcmp (ga->name, gb->name); |
| 629 | } | 609 | } |
| @@ -650,7 +630,7 @@ write_globals (void) | |||
| 650 | type = "EMACS_INT"; | 630 | type = "EMACS_INT"; |
| 651 | break; | 631 | break; |
| 652 | case BOOLEAN: | 632 | case BOOLEAN: |
| 653 | type = "int"; | 633 | type = "bool"; |
| 654 | break; | 634 | break; |
| 655 | case LISP_OBJECT: | 635 | case LISP_OBJECT: |
| 656 | type = "Lisp_Object"; | 636 | type = "Lisp_Object"; |