Mercurial > hg > xemacs-beta
view lib-src/make-docfile.c @ 4952:19a72041c5ed
Mule-izing, various fixes related to char * arguments
-------------------- ChangeLog entries follow: --------------------
modules/ChangeLog addition:
2010-01-26 Ben Wing <ben@xemacs.org>
* postgresql/postgresql.c:
* postgresql/postgresql.c (CHECK_LIVE_CONNECTION):
* postgresql/postgresql.c (print_pgresult):
* postgresql/postgresql.c (Fpq_conn_defaults):
* postgresql/postgresql.c (Fpq_connectdb):
* postgresql/postgresql.c (Fpq_connect_start):
* postgresql/postgresql.c (Fpq_result_status):
* postgresql/postgresql.c (Fpq_res_status):
Mule-ize large parts of it.
2010-01-26 Ben Wing <ben@xemacs.org>
* ldap/eldap.c (print_ldap):
* ldap/eldap.c (allocate_ldap):
Use write_ascstring().
src/ChangeLog addition:
2010-01-26 Ben Wing <ben@xemacs.org>
* alloc.c:
* alloc.c (build_ascstring):
* alloc.c (build_msg_cistring):
* alloc.c (staticpro_1):
* alloc.c (staticpro_name):
* alloc.c (staticpro_nodump_1):
* alloc.c (staticpro_nodump_name):
* alloc.c (unstaticpro_nodump_1):
* alloc.c (mcpro_1):
* alloc.c (mcpro_name):
* alloc.c (object_memory_usage_stats):
* alloc.c (common_init_alloc_early):
* alloc.c (init_alloc_once_early):
* buffer.c (print_buffer):
* buffer.c (vars_of_buffer):
* buffer.c (common_init_complex_vars_of_buffer):
* buffer.c (init_initial_directory):
* bytecode.c (invalid_byte_code):
* bytecode.c (print_compiled_function):
* bytecode.c (mark_compiled_function):
* chartab.c (print_table_entry):
* chartab.c (print_char_table):
* config.h.in:
* console-gtk.c:
* console-gtk.c (gtk_device_to_console_connection):
* console-gtk.c (gtk_semi_canonicalize_console_connection):
* console-gtk.c (gtk_canonicalize_console_connection):
* console-gtk.c (gtk_semi_canonicalize_device_connection):
* console-gtk.c (gtk_canonicalize_device_connection):
* console-stream.c (stream_init_frame_1):
* console-stream.c (vars_of_console_stream):
* console-stream.c (init_console_stream):
* console-x.c (x_semi_canonicalize_console_connection):
* console-x.c (x_semi_canonicalize_device_connection):
* console-x.c (x_canonicalize_device_connection):
* console-x.h:
* data.c (eq_with_ebola_notice):
* data.c (Fsubr_interactive):
* data.c (Fnumber_to_string):
* data.c (digit_to_number):
* device-gtk.c (gtk_init_device):
* device-msw.c (print_devmode):
* device-x.c (x_event_name):
* dialog-msw.c (handle_directory_dialog_box):
* dialog-msw.c (handle_file_dialog_box):
* dialog-msw.c (vars_of_dialog_mswindows):
* doc.c (weird_doc):
* doc.c (Fsnarf_documentation):
* doc.c (vars_of_doc):
* dumper.c (pdump):
* dynarr.c:
* dynarr.c (Dynarr_realloc):
* editfns.c (Fuser_real_login_name):
* editfns.c (get_home_directory):
* elhash.c (print_hash_table_data):
* elhash.c (print_hash_table):
* emacs.c (main_1):
* emacs.c (vars_of_emacs):
* emodules.c:
* emodules.c (_emodules_list):
* emodules.c (Fload_module):
* emodules.c (Funload_module):
* emodules.c (Flist_modules):
* emodules.c (find_make_module):
* emodules.c (attempt_module_delete):
* emodules.c (emodules_load):
* emodules.c (emodules_doc_subr):
* emodules.c (emodules_doc_sym):
* emodules.c (syms_of_module):
* emodules.c (vars_of_module):
* emodules.h:
* eval.c (print_subr):
* eval.c (signal_call_debugger):
* eval.c (build_error_data):
* eval.c (signal_error):
* eval.c (maybe_signal_error):
* eval.c (signal_continuable_error):
* eval.c (maybe_signal_continuable_error):
* eval.c (signal_error_2):
* eval.c (maybe_signal_error_2):
* eval.c (signal_continuable_error_2):
* eval.c (maybe_signal_continuable_error_2):
* eval.c (signal_ferror):
* eval.c (maybe_signal_ferror):
* eval.c (signal_continuable_ferror):
* eval.c (maybe_signal_continuable_ferror):
* eval.c (signal_ferror_with_frob):
* eval.c (maybe_signal_ferror_with_frob):
* eval.c (signal_continuable_ferror_with_frob):
* eval.c (maybe_signal_continuable_ferror_with_frob):
* eval.c (syntax_error):
* eval.c (syntax_error_2):
* eval.c (maybe_syntax_error):
* eval.c (sferror):
* eval.c (sferror_2):
* eval.c (maybe_sferror):
* eval.c (invalid_argument):
* eval.c (invalid_argument_2):
* eval.c (maybe_invalid_argument):
* eval.c (invalid_constant):
* eval.c (invalid_constant_2):
* eval.c (maybe_invalid_constant):
* eval.c (invalid_operation):
* eval.c (invalid_operation_2):
* eval.c (maybe_invalid_operation):
* eval.c (invalid_change):
* eval.c (invalid_change_2):
* eval.c (maybe_invalid_change):
* eval.c (invalid_state):
* eval.c (invalid_state_2):
* eval.c (maybe_invalid_state):
* eval.c (wtaerror):
* eval.c (stack_overflow):
* eval.c (out_of_memory):
* eval.c (print_multiple_value):
* eval.c (issue_call_trapping_problems_warning):
* eval.c (backtrace_specials):
* eval.c (backtrace_unevalled_args):
* eval.c (Fbacktrace):
* eval.c (warn_when_safe):
* event-Xt.c (modwarn):
* event-Xt.c (modbarf):
* event-Xt.c (check_modifier):
* event-Xt.c (store_modifier):
* event-Xt.c (emacs_Xt_format_magic_event):
* event-Xt.c (describe_event):
* event-gtk.c (dragndrop_data_received):
* event-gtk.c (store_modifier):
* event-gtk.c (gtk_reset_modifier_mapping):
* event-msw.c (dde_eval_string):
* event-msw.c (Fdde_alloc_advise_item):
* event-msw.c (mswindows_dde_callback):
* event-msw.c (FROB):
* event-msw.c (emacs_mswindows_format_magic_event):
* event-stream.c (external_debugging_print_event):
* event-stream.c (execute_help_form):
* event-stream.c (vars_of_event_stream):
* events.c (print_event_1):
* events.c (print_event):
* events.c (event_equal):
* extents.c (print_extent_1):
* extents.c (print_extent):
* extents.c (vars_of_extents):
* faces.c (print_face):
* faces.c (complex_vars_of_faces):
* file-coding.c:
* file-coding.c (print_coding_system):
* file-coding.c (print_coding_system_in_print_method):
* file-coding.c (default_query_method):
* file-coding.c (find_coding_system):
* file-coding.c (make_coding_system_1):
* file-coding.c (chain_print):
* file-coding.c (undecided_print):
* file-coding.c (gzip_print):
* file-coding.c (vars_of_file_coding):
* file-coding.c (complex_vars_of_file_coding):
* fileio.c:
* fileio.c (report_file_type_error):
* fileio.c (report_error_with_errno):
* fileio.c (report_file_error):
* fileio.c (barf_or_query_if_file_exists):
* fileio.c (vars_of_fileio):
* floatfns.c (matherr):
* fns.c (print_bit_vector):
* fns.c (Fmapconcat):
* fns.c (add_suffix_to_symbol):
* fns.c (add_prefix_to_symbol):
* frame-gtk.c:
* frame-gtk.c (Fgtk_window_id):
* frame-x.c (def):
* frame-x.c (x_cde_transfer_callback):
* frame.c:
* frame.c (Fmake_frame):
* gc.c (show_gc_cursor_and_message):
* gc.c (vars_of_gc):
* glyphs-eimage.c (png_instantiate):
* glyphs-eimage.c (tiff_instantiate):
* glyphs-gtk.c (gtk_print_image_instance):
* glyphs-msw.c (mswindows_print_image_instance):
* glyphs-x.c (x_print_image_instance):
* glyphs-x.c (update_widget_face):
* glyphs.c (make_string_from_file):
* glyphs.c (print_image_instance):
* glyphs.c (signal_image_error):
* glyphs.c (signal_image_error_2):
* glyphs.c (signal_double_image_error):
* glyphs.c (signal_double_image_error_2):
* glyphs.c (xbm_mask_file_munging):
* glyphs.c (pixmap_to_lisp_data):
* glyphs.h:
* gui.c (gui_item_display_flush_left):
* hpplay.c (player_error_internal):
* hpplay.c (myHandler):
* intl-win32.c:
* intl-win32.c (langcode_to_lang):
* intl-win32.c (sublangcode_to_lang):
* intl-win32.c (Fmswindows_get_locale_info):
* intl-win32.c (lcid_to_locale_mule_or_no):
* intl-win32.c (mswindows_multibyte_to_unicode_print):
* intl-win32.c (complex_vars_of_intl_win32):
* keymap.c:
* keymap.c (print_keymap):
* keymap.c (ensure_meta_prefix_char_keymapp):
* keymap.c (Fkey_description):
* keymap.c (Ftext_char_description):
* lisp.h:
* lisp.h (struct):
* lisp.h (DECLARE_INLINE_HEADER):
* lread.c (Fload_internal):
* lread.c (locate_file):
* lread.c (read_escape):
* lread.c (read_raw_string):
* lread.c (read1):
* lread.c (read_list):
* lread.c (read_compiled_function):
* lread.c (init_lread):
* lrecord.h:
* marker.c (print_marker):
* marker.c (marker_equal):
* menubar-msw.c (displayable_menu_item):
* menubar-x.c (command_builder_operate_menu_accelerator):
* menubar.c (vars_of_menubar):
* minibuf.c (reinit_complex_vars_of_minibuf):
* minibuf.c (complex_vars_of_minibuf):
* mule-charset.c (Fmake_charset):
* mule-charset.c (complex_vars_of_mule_charset):
* mule-coding.c (iso2022_print):
* mule-coding.c (fixed_width_query):
* number.c (bignum_print):
* number.c (ratio_print):
* number.c (bigfloat_print):
* number.c (bigfloat_finalize):
* objects-msw.c:
* objects-msw.c (mswindows_color_to_string):
* objects-msw.c (mswindows_color_list):
* objects-tty.c:
* objects-tty.c (tty_font_list):
* objects-tty.c (tty_find_charset_font):
* objects-xlike-inc.c (xft_find_charset_font):
* objects-xlike-inc.c (endif):
* print.c:
* print.c (write_istring):
* print.c (write_ascstring):
* print.c (Fterpri):
* print.c (Fprint):
* print.c (print_error_message):
* print.c (print_vector_internal):
* print.c (print_cons):
* print.c (print_string):
* print.c (printing_unreadable_object):
* print.c (print_internal):
* print.c (print_float):
* print.c (print_symbol):
* process-nt.c (mswindows_report_winsock_error):
* process-nt.c (nt_canonicalize_host_name):
* process-unix.c (unix_canonicalize_host_name):
* process.c (print_process):
* process.c (report_process_error):
* process.c (report_network_error):
* process.c (make_process_internal):
* process.c (Fstart_process_internal):
* process.c (status_message):
* process.c (putenv_internal):
* process.c (vars_of_process):
* process.h:
* profile.c (vars_of_profile):
* rangetab.c (print_range_table):
* realpath.c (vars_of_realpath):
* redisplay.c (vars_of_redisplay):
* search.c (wordify):
* search.c (Freplace_match):
* sheap.c (sheap_adjust_h):
* sound.c (report_sound_error):
* sound.c (Fplay_sound_file):
* specifier.c (print_specifier):
* symbols.c (Fsubr_name):
* symbols.c (do_symval_forwarding):
* symbols.c (set_default_buffer_slot_variable):
* symbols.c (set_default_console_slot_variable):
* symbols.c (store_symval_forwarding):
* symbols.c (default_value):
* symbols.c (defsymbol_massage_name_1):
* symbols.c (defsymbol_massage_name_nodump):
* symbols.c (defsymbol_massage_name):
* symbols.c (defsymbol_massage_multiword_predicate_nodump):
* symbols.c (defsymbol_massage_multiword_predicate):
* symbols.c (defsymbol_nodump):
* symbols.c (defsymbol):
* symbols.c (defkeyword):
* symbols.c (defkeyword_massage_name):
* symbols.c (check_module_subr):
* symbols.c (deferror_1):
* symbols.c (deferror):
* symbols.c (deferror_massage_name):
* symbols.c (deferror_massage_name_and_message):
* symbols.c (defvar_magic):
* symeval.h:
* symeval.h (DEFVAR_SYMVAL_FWD):
* sysdep.c:
* sysdep.c (init_system_name):
* sysdll.c:
* sysdll.c (MAYBE_PREPEND_UNDERSCORE):
* sysdll.c (dll_function):
* sysdll.c (dll_variable):
* sysdll.c (dll_error):
* sysdll.c (dll_open):
* sysdll.c (dll_close):
* sysdll.c (image_for_address):
* sysdll.c (my_find_image):
* sysdll.c (search_linked_libs):
* sysdll.h:
* sysfile.h:
* sysfile.h (DEFAULT_DIRECTORY_FALLBACK):
* syswindows.h:
* tests.c (DFC_CHECK_LENGTH):
* tests.c (DFC_CHECK_CONTENT):
* tests.c (Ftest_hash_tables):
* text.c (vars_of_text):
* text.h:
* tooltalk.c (tt_opnum_string):
* tooltalk.c (tt_message_arg_ival_string):
* tooltalk.c (Ftooltalk_default_procid):
* tooltalk.c (Ftooltalk_default_session):
* tooltalk.c (init_tooltalk):
* tooltalk.c (vars_of_tooltalk):
* ui-gtk.c (Fdll_load):
* ui-gtk.c (type_to_marshaller_type):
* ui-gtk.c (Fgtk_import_function_internal):
* ui-gtk.c (emacs_gtk_object_printer):
* ui-gtk.c (emacs_gtk_boxed_printer):
* unicode.c (unicode_to_ichar):
* unicode.c (unicode_print):
* unicode.c (unicode_query):
* unicode.c (vars_of_unicode):
* unicode.c (complex_vars_of_unicode):
* win32.c:
* win32.c (mswindows_report_process_error):
* window.c (print_window):
* xemacs.def.in.in:
BASIC IDEA: Further fixing up uses of char * and CIbyte *
to reflect their actual semantics; Mule-izing some code;
redoing of the not-yet-working code to handle message translation.
Clean up code to handle message-translation (not yet working).
Create separate versions of build_msg_string() for working with
Ibyte *, CIbyte *, and Ascbyte * arguments. Assert that Ascbyte *
arguments are pure-ASCII. Make build_msg_string() be the same
as build_msg_ascstring(). Create same three versions of GETTEXT()
and DEFER_GETTEXT(). Also create build_defer_string() and
variants for the equivalent of DEFER_GETTEXT() when building a
string. Remove old CGETTEXT(). Clean up code where GETTEXT(),
DEFER_GETTEXT(), build_msg_string(), etc. was being called and
introduce some new calls to build_msg_string(), etc. Remove
GETTEXT() from calls to weird_doc() -- we assume that the
message snarfer knows about weird_doc(). Remove uses of
DEFER_GETTEXT() from error messages in sysdep.c and instead use
special comments /* @@@begin-snarf@@@ */ and /* @@@end-snarf@@@ */
that the message snarfer presumably knows about.
Create build_ascstring() and use it in many instances in place
of build_string(). The purpose of having Ascbyte * variants is
to make the code more self-documenting in terms of what sort of
semantics is expected for char * strings. In fact in the process
of looking for uses of build_string(), much improperly Mule-ized
was discovered.
Mule-ize a lot of code as described in previous paragraph,
e.g. in sysdep.c.
Make the error functions take Ascbyte * strings and fix up a
couple of places where non-pure-ASCII strings were being passed in
(file-coding.c, mule-coding.c, unicode.c). (It's debatable whether
we really need to make the error functions work this way. It
helps catch places where code is written in a way that message
translation won't work, but we may well never implement message
translation.)
Make staticpro() and friends take Ascbyte * strings instead of
raw char * strings. Create a const_Ascbyte_ptr dynarr type
to describe what's held by staticpro_names[] and friends,
create pdump descriptions for const_Ascbyte_ptr dynarrs, and
use them in place of specially-crafted staticpro descriptions.
Mule-ize certain other functions (e.g. x_event_name) by correcting
raw use of char * to Ascbyte *, Rawbyte * or another such type,
and raw use of char[] buffers to another type (usually Ascbyte[]).
Change many uses of write_c_string() to write_msg_string(),
write_ascstring(), etc.
Mule-ize emodules.c, emodules.h, sysdll.h.
Fix some un-Mule-ized code in intl-win32.c.
A comment in event-Xt.c and the limitations of the message
snarfer (make-msgfile or whatever) is presumably incorrect --
it should be smart enough to handle function calls spread over
more than one line. Clean up code in event-Xt.c that was
written awkwardly for this reason.
In config.h.in, instead of NEED_ERROR_CHECK_TYPES_INLINES,
create a more general XEMACS_DEFS_NEEDS_INLINE_DECLS to
indicate when inlined functions need to be declared in
xemacs.defs.in.in, and make use of it in xemacs.defs.in.in.
We need to do this because postgresql.c now calls qxestrdup(),
which is an inline function.
Make nconc2() and other such functions MODULE_API and put
them in xemacs.defs.in.in since postgresql.c now uses them.
Clean up indentation in lread.c and a few other places.
In text.h, document ASSERT_ASCTEXT_ASCII() and
ASSERT_ASCTEXT_ASCII_LEN(), group together the stand-in
encodings and add some more for DLL symbols, function and
variable names, etc.
author | Ben Wing <ben@xemacs.org> |
---|---|
date | Tue, 26 Jan 2010 23:22:30 -0600 |
parents | f3a65dff1912 |
children | d555581e3cba |
line wrap: on
line source
/* Generate doc-string file for XEmacs from source files. Copyright (C) 1985, 86, 92, 93, 94, 97, 1999, 2000, 2001 Free Software Foundation, Inc. Copyright (C) 1995 Board of Trustees, University of Illinois. Copyright (C) 1998, 1999 J. Kean Johnston. Copyright (C) 2001, 2002 Ben Wing. This file is part of XEmacs. XEmacs is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. XEmacs is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with XEmacs; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* Synched up with: FSF 21.3. */ /* The arguments given to this program are all the C and Lisp source files of XEmacs. .elc and .el and .c files are allowed. A .o or .obj file can also be specified; the .c file it was made from is used. This helps the makefile pass the correct list of files. The results, which go to standard output or to a file specified with -a or -o (-a to append, -o to start from nothing), are entries containing function or variable names and their documentation. Each entry starts with a ^_ character. Then comes F for a function or V for a variable. Then comes the function or variable name, terminated with a newline. Then comes the documentation for that function or variable. Added 19.15/20.1: `-i site-packages' allow installer to dump extra packages without modifying Makefiles, etc. */ #include <config.h> #include <sysfile.h> #include <assert.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include "compiler.h" /* XEmacs addition */ #define C_IDENTIFIER_CHAR_P(c) \ (('A' <= c && c <= 'Z') || \ ('a' <= c && c <= 'z') || \ ('0' <= c && c <= '9') || \ (c == '_')) static void put_filename (const char *filename); static int scan_file (const char *filename); static int read_c_string (FILE *, int, int); static void write_c_args (FILE *out, const char *func, char *buf, int minargs, int maxargs); static int scan_c_file (const char *filename, const char *mode); static void skip_white (FILE *); static void read_lisp_symbol (FILE *, char *); static int scan_lisp_file (const char *filename, const char *mode); /* Stdio stream for output to the DOC file. */ static FILE *outfile; /* XEmacs addition */ enum { el_file, elc_file, c_file } Current_file_type; /* Name this program was invoked with. */ char *progname; /* XEmacs addition: set to 1 if this was invoked by ellcc */ int ellcc = 0; /* Print error message. `s1' is printf control string, `s2' is arg for it. */ static void error (const char *s1, const char *s2) { fprintf (stderr, "%s: ", progname); fprintf (stderr, s1, s2); fprintf (stderr, "\n"); } /* Print error message and exit. */ static void fatal (const char *s1, const char *s2) { error (s1, s2); exit (1); } /* Like malloc but get fatal error if memory is exhausted. */ static long * xmalloc (unsigned int size) { long *result = (long *) malloc (size); if (result == NULL) fatal ("virtual memory exhausted", 0); return result; } /* XEmacs addition */ static char * next_extra_elc (char *extra_elcs) { static FILE *fp = NULL; static char line_buf[BUFSIZ]; char *p = line_buf+1; if (!fp) { if (!extra_elcs) return NULL; else if (!(fp = fopen (extra_elcs, READ_BINARY))) { /* It is not an error if this file doesn't exist. */ /*fatal ("error opening site package file list", 0);*/ return NULL; } fgets (line_buf, BUFSIZ, fp); } do { if (!fgets (line_buf, BUFSIZ, fp)) { fclose (fp); fp = NULL; return NULL; } line_buf[0] = '\0'; /* reject too short or too long lines */ } while (strlen (p) <= 2 || strlen (p) >= (BUFSIZ - 5)); p[strlen (p) - 2] = '\0'; strcat (p, ".elc"); return p; } int main (int argc, char **argv) { int i; int err_count = 0; int first_infile; char *extra_elcs = NULL; /* XEmacs addition */ progname = argv[0]; outfile = stdout; /* Don't put CRs in the DOC file. */ #ifdef WIN32_NATIVE _fmode = O_BINARY; _setmode (fileno (stdout), O_BINARY); #endif /* WIN32_NATIVE */ /* If first two args are -o FILE, output to FILE. */ i = 1; if (argc > i + 1 && !strcmp (argv[i], "-o")) { outfile = fopen (argv[i + 1], WRITE_BINARY); i += 2; } if (argc > i + 1 && !strcmp (argv[i], "-a")) { outfile = fopen (argv[i + 1], APPEND_BINARY); i += 2; } if (argc > i + 1 && !strcmp (argv[i], "-d")) { chdir (argv[i + 1]); i += 2; } /* Additional command line arguments for XEmacs */ if (argc > i + 1 && !strcmp (argv[i], "-E")) { outfile = fopen (argv[i + 1], APPEND_BINARY); i += 2; ellcc = 1; } if (argc > (i + 1) && !strcmp (argv[i], "-i")) { extra_elcs = argv[i + 1]; i += 2; } if (outfile == 0) fatal ("No output file specified", ""); /* XEmacs addition */ if (ellcc) fprintf (outfile, "{\n"); first_infile = i; for (; i < argc; i++) { /* XEmacs addition: the "if" clause is new; the "else" clause is the original FSF Emacs code */ if (argv[i][0] == '@') { /* Allow a file containing files to process, for use w/MS Windows (where command-line length limits are more problematic) */ FILE *argfile = fopen (argv[i] + 1, READ_TEXT); char arg[QXE_PATH_MAX]; if (!argfile) fatal ("Unable to open argument file %s", argv[i] + 1); while (fgets (arg, QXE_PATH_MAX, argfile)) { if (arg[strlen (arg) - 1] == '\n') arg[strlen (arg) - 1] = '\0'; /* chop \n */ err_count += scan_file (arg); } } else if (argc > i + 1 && !strcmp (argv[i], "-d")) { /* XEmacs change; allow more than one chdir. The idea is that the second chdir is to source-lisp, and that any Lisp files not under there have the full path specified. */ i += 1; chdir (argv[i]); continue; } else { int j; /* Don't process one file twice. */ for (j = first_infile; j < i; j++) if (! strcmp (argv[i], argv[j])) break; if (j == i) err_count += scan_file (argv[i]); } } /* XEmacs addition */ if (extra_elcs) { char *p; while ((p = next_extra_elc (extra_elcs)) != NULL) err_count += scan_file (p); } putc ('\n', outfile); if (ellcc) fprintf (outfile, "}\n\n"); /* End XEmacs addition */ #ifndef VMS exit (err_count > 0); #endif /* VMS */ return err_count > 0; } /* Add a source file name boundary in the output file. */ static void put_filename (const char *filename) { /* XEmacs change; don't strip directory information. */ #if 0 const char *tmp; for (tmp = filename; *tmp; tmp++) { if (IS_DIRECTORY_SEP(*tmp)) filename = tmp + 1; } #endif /* <= because sizeof includes the nul byte at the end. Not quite right, because it should include the length of the symbol + "\037[VF]" instead of simply 10. */ assert(sizeof("\037S\n") + strlen(filename) + 10 <= DOC_MAX_FILENAME_LENGTH); putc (037, outfile); putc ('S', outfile); fprintf (outfile, "%s\n", filename); } /* Read file FILENAME and output its doc strings to outfile. */ /* Return 1 if file is not found, 0 if it is found. */ static int scan_file (const char *filename) { int len = strlen (filename); /* XEmacs change: test ellcc and set Current_file_type in each case */ if (ellcc == 0 && len > 4 && !strcmp (filename + len - 4, ".elc")) { Current_file_type = elc_file; return scan_lisp_file (filename, READ_BINARY); } else if (ellcc == 0 && len > 3 && !strcmp (filename + len - 3, ".el")) { Current_file_type = el_file; return scan_lisp_file (filename, READ_BINARY); } else { Current_file_type = c_file; return scan_c_file (filename, READ_BINARY); } } /* XEmacs addition: ISO 2022 handling */ static int getc_skipping_iso2022 (FILE *file) { register int c; /* #### Kludge -- Ignore any ISO2022 sequences */ c = getc (file); while (c == 27) { c = getc (file); if (c == '$') c = getc (file); if (c >= '(' && c <= '/') c = getc (file); c = getc (file); } return c; } enum iso2022_state { ISO_NOTHING, ISO_ESC, ISO_DOLLAR, ISO_FINAL_IS_NEXT, ISO_DOLLAR_AND_FINAL_IS_NEXT }; static int non_ascii_p; static int getc_iso2022 (FILE *file) { /* #### Kludge -- Parse ISO2022 sequences (more or less) */ static enum iso2022_state state; static int prevc; register int c; c = getc (file); switch (state) { case ISO_NOTHING: if (c == 27) state = ISO_ESC; break; case ISO_ESC: if (c == '$') state = ISO_DOLLAR; else if (c >= '(' && c <= '/') state = ISO_FINAL_IS_NEXT; else state = ISO_NOTHING; break; case ISO_DOLLAR: if (c >= '(' && c <= '/') state = ISO_DOLLAR_AND_FINAL_IS_NEXT; else if (c >= '@' && c <= 'B') /* ESC $ @ etc */ { non_ascii_p = 1; state = ISO_NOTHING; } else state = ISO_NOTHING; break; case ISO_FINAL_IS_NEXT: if (prevc == '(' && c == 'B') /* ESC ( B, invoke ASCII */ non_ascii_p = 0; else if (prevc == '(' || prevc == ',') /* ESC ( x or ESC , x */ non_ascii_p = 1; state = ISO_NOTHING; break; case ISO_DOLLAR_AND_FINAL_IS_NEXT: if (prevc == '(' || prevc == ',') /* ESC $ ( x or ESC $ , x */ non_ascii_p = 1; state = ISO_NOTHING; break; } prevc = c; return c; } char globalbuf[128]; /* Skip a C string from INFILE, and return the character that follows the closing ". If printflag is positive, output string contents to outfile. If it is negative, store contents in buf. Convert escape sequences \n and \t to newline and tab; discard \ followed by newline. */ #define MDGET do { prevc = c; c = getc_iso2022 (infile); } while (0) static int read_c_string (FILE *infile, int printflag, int c_docstring) { register int prevc = 0, c = 0; char *p = globalbuf; int start = -1; /* XEmacs addition */ MDGET; while (c != EOF) { while ((c_docstring || c != '"' || non_ascii_p) && c != EOF) { /* XEmacs addition: the first two "if" clauses are new */ if (c == '*' && !non_ascii_p) { int cc = getc (infile); if (cc == '/') { if (prevc != '\n') { if (printflag > 0) { if (ellcc) fprintf (outfile, "\\n\\"); putc ('\n', outfile); } else if (printflag < 0) *p++ = '\n'; } break; } else ungetc (cc, infile); } if (start == 1) { if (printflag > 0) { if (ellcc) fprintf (outfile, "\\n\\"); putc ('\n', outfile); } else if (printflag < 0) *p++ = '\n'; } /* End XEmacs addition */ if (c == '\\' && !non_ascii_p) { MDGET; if (c == '\n') { MDGET; start = 1; continue; } if (!c_docstring && c == 'n') c = '\n'; if (c == 't') c = '\t'; } /* XEmacs change: the "if" clause is new; the "else" clause is mostly the original FSF Emacs code */ if (c == '\n') start = 1; else { start = 0; if (printflag > 0) { if (ellcc && c == '"' && !non_ascii_p) putc ('\\', outfile); putc (c, outfile); } else if (printflag < 0) *p++ = c; } MDGET; } /* XEmacs change: look for continuation of string */ if (Current_file_type == c_file) { do { MDGET; } while (isspace (c)); if (c != '"' || non_ascii_p) break; } else { MDGET; if (c != '"' || non_ascii_p) break; /* If we had a "", concatenate the two strings. */ } MDGET; } if (printflag < 0) *p = 0; return c; } /* Write to file OUT the argument names of function FUNC, whose text is in BUF. MINARGS and MAXARGS are the minimum and maximum number of arguments. */ #define SKIPWHITE do { while (isspace ((unsigned char) (*p))) p++; } while (0) static void write_c_args (FILE *out, const char *UNUSED (func), char *buf, int minargs, int maxargs) { register char *p; int in_ident = 0; int just_spaced = 0; int need_paren = 0; #if 0 int need_space = 1; fprintf (out, "(%s", func); #else /* XEmacs - "arguments:" is for parsing the docstring. FSF's help system doesn't parse the docstring for arguments like we do, so we're also going to omit the function name to preserve compatibility with elisp that parses the docstring. Finally, not prefixing the arglist with anything is asking for trouble because it's not uncommon to have an unescaped parenthesis at the beginning of a line. --Stig */ fprintf (out, "arguments: ("); #endif if (*buf == '(') ++buf; for (p = buf; *p; p++) { char c = *p; #if 0 int ident_start = 0; #endif /* XEmacs addition: used for ANSI prototypes and UNUSED macros. */ static char uu [] = "UNUSED"; static char ui [] = "USED_IF_"; static char lo [] = "Lisp_Object"; /* Notice when we enter or leave an identifier. */ if (C_IDENTIFIER_CHAR_P (c) != in_ident) { if (!in_ident) { /* Entering identifier. Print as we parse. */ char *here; /* Target for backtracking. */ /* XEmacs addition: add support for ANSI prototypes and the UNUSED macros. Hop over them. "Lisp_Object" is the only C type allowed in DEFUNs. For the UNUSED macros we need to eat parens, too. */ /* Aren't these all vulnerable to buffer overrun? I guess that means that the .c is busted, so we may as well just die ... */ /* Skip over "Lisp_Object". */ if ((strncmp (p, lo, sizeof (lo) - 1) == 0) && isspace ((unsigned char) p[sizeof (lo) - 1])) { p += (sizeof (lo) - 1); SKIPWHITE; } /* Skip over "UNUSED" or "USED_IF_*" invocation. */ need_paren = 1; here = p; if (strncmp (p, uu, sizeof (uu) - 1) == 0) p += (sizeof (uu) - 1); else if (strncmp (p, ui, sizeof (ui) - 1) == 0) p += (sizeof (ui) - 1); else need_paren = 0; if (need_paren) { /* Skip rest of macro name, open paren, whitespace. */ while (*p && C_IDENTIFIER_CHAR_P (*p)) p++; SKIPWHITE; if (*p++ == '(') SKIPWHITE; else { need_paren = 0; p = here; } } c = *p; /* Do bookkeeping. Maybe output lambda keywords. */ in_ident = 1; #if 0 /* XEmacs - This goes along with the change above. */ ident_start = 1; if (need_space) putc (' ', out); #endif if (minargs == 0 && maxargs > 0) fprintf (out, "&optional "); just_spaced = 1; minargs--; maxargs--; } else { /* Leaving identifier. */ in_ident = 0; if (need_paren) { SKIPWHITE; if (*p == ')') p++; c = *p; need_paren = 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 = ' '; /* XEmacs change: handle \n below for readability */ #if 0 /* 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; } #endif /* If the C argument name ends with `_', change it to ' ', to allow use of C reserved words or global symbols as Lisp args. */ if (c == '-' && ! C_IDENTIFIER_CHAR_P (p[1])) { in_ident = 0; just_spaced = 0; } /* XEmacs change: if the character is carriage return or linefeed, escape it for the compiler */ else if (c == '\n') { putc('\\', out); putc('\n', out); } else if (c == '\r') { putc('\\', out); putc('\r', out); } else if (c != ' ' || !just_spaced) { if (c >= 'a' && c <= 'z') /* Upcase the letter. */ c += 'A' - 'a'; putc (c, out); } just_spaced = (c == ' '); #if 0 need_space = 0; #endif } /* XEmacs addition */ if (!ellcc) putc ('\n', out); } #undef SKIPWHITE /* Read through a c file. If a .o or .obj file is named, the corresponding .c file is read instead. Looks for DEFUN constructs such as are defined in ../src/lisp.h. Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED ... which don't exist anymore! */ static int scan_c_file (const char *filename, const char *mode) { FILE *infile; register int c; register int commas; register int defunflag; register int defvarperbufferflag = 0; register int defvarflag; int minargs, maxargs; int l = strlen (filename); char f[QXE_PATH_MAX]; /* XEmacs change: different method for checking filename extension */ if (l > QXE_PATH_MAX - 1) { #ifdef ENAMETOOLONG errno = ENAMETOOLONG; #else errno = EINVAL; #endif return 0; } strcpy (f, filename); if (l > 4 && !strcmp (f + l - 4, ".obj")) /* MS Windows */ strcpy (f + l - 4, ".c"); if (f[l - 1] == 'o') f[l - 1] = 'c'; infile = fopen (f, mode); /* No error if non-ex input file */ if (infile == NULL) { perror (f); return 0; } #if 0 /* Reset extension to be able to detect duplicate files. */ filename[strlen (filename) - 1] = extension; #endif c = '\n'; while (!feof (infile)) { if (c != '\n') { c = getc (infile); continue; } c = getc (infile); if (c == ' ') { while (c == ' ') c = getc (infile); if (c != 'D') continue; c = getc (infile); if (c != 'E') continue; c = getc (infile); if (c != 'F') continue; c = getc (infile); if (c != 'V') continue; c = getc (infile); if (c != 'A') continue; c = getc (infile); if (c != 'R') continue; c = getc (infile); if (c != '_') continue; defvarflag = 1; defunflag = 0; c = getc (infile); /* Note that this business doesn't apply under XEmacs. DEFVAR_BUFFER_LOCAL in XEmacs behaves normally. */ defvarperbufferflag = (c == 'P'); c = getc (infile); } else if (c == 'D') { c = getc (infile); if (c != 'E') continue; c = getc (infile); if (c != 'F') continue; c = getc (infile); defunflag = (c == 'U'); defvarflag = 0; c = getc (infile); /* XEmacs addition */ } else continue; while (c != '(') { if (c < 0) goto eof; c = getc (infile); } c = getc (infile); if (c != '"') continue; c = read_c_string (infile, -1, 0); if (defunflag) commas = 4; else if (defvarperbufferflag) commas = 2; else if (defvarflag) commas = 1; else /* For DEFSIMPLE and DEFPRED ... which now don't exist! */ commas = 2; while (commas) { if (c == ',') { commas--; if (defunflag && (commas == 1 || commas == 2)) { do c = getc (infile); while (c == ' ' || c == '\n' || c == '\t'); if (c < 0) goto eof; ungetc (c, infile); if (commas == 2) /* pick up minargs */ fscanf (infile, "%d", &minargs); else /* pick up maxargs */ if (c == 'M' || c == 'U') /* MANY || UNEVALLED */ maxargs = -1; else fscanf (infile, "%d", &maxargs); } } if (c < 0) goto eof; c = getc (infile); } while (c == ' ' || c == '\n' || c == '\t') c = getc (infile); if (c == '"') c = read_c_string (infile, 0, 0); /* XEmacs change */ if (defunflag | defvarflag) { while (c != '/') { if (c < 0) goto eof; if (defunflag && c == '(') fatal ("Missing doc string for DEFUN %s\n", globalbuf); c = getc (infile); } c = getc (infile); while (c == '*') c = getc (infile); } else { while (c != ',') { if (c < 0) goto eof; c = getc (infile); } c = getc (infile); } /* End XEmacs change */ while (c == ' ' || c == '\n' || c == '\t') c = getc (infile); /* XEmacs addition */ if (defunflag | defvarflag) ungetc (c, infile); /* End XEmacs addition */ if (defunflag || defvarflag || c == '"') { /* XEmacs change: the original code is in the "else" clause */ /* XXX Must modify the documentation file name code to handle ELLCCs */ if (ellcc) fprintf (outfile, " CDOC%s(\"%s\", \"\\\n", defvarflag ? "SYM" : "SUBR", globalbuf); else { put_filename (filename); /* XEmacs addition */ putc (037, outfile); putc (defvarflag ? 'V' : 'F', outfile); fprintf (outfile, "%s\n", globalbuf); } c = read_c_string (infile, 1, defunflag || defvarflag); /* If this is a defun, find the arguments and print them. If this function takes MANY or UNEVALLED args, then the C source won't give the names of the arguments, so we shouldn't bother trying to find them. */ if (defunflag && maxargs != -1) { char argbuf[1024], *p = argbuf; int paren_level = 1; #if 0 /* For old DEFUN's only */ while (c != ')') { if (c < 0) goto eof; c = getc (infile); } #endif /* Skip into arguments. */ while (c != '(') { if (c < 0) goto eof; c = getc (infile); } /* Copy arguments into ARGBUF. */ *p++ = c; do { *p++ = c = getc (infile); if (c < 0) goto eof; /* XEmacs change: handle macros with args (eg, UNUSED) */ if (c == ')') paren_level--; if (c == '(') paren_level++; } while (paren_level > 0); *p = '\0'; /* Output them. */ if (ellcc) fprintf (outfile, "\\n\\\n\\n\\\n"); else fprintf (outfile, "\n\n"); write_c_args (outfile, globalbuf, argbuf, minargs, maxargs); } if (ellcc) fprintf (outfile, "\\n\");\n\n"); } } eof: fclose (infile); return 0; } /* Read a file of Lisp code, compiled or interpreted. Looks for (defun NAME ARGS DOCSTRING ...) (defmacro NAME ARGS DOCSTRING ...) (defsubst NAME ARGS DOCSTRING ...) (autoload (quote NAME) FILE DOCSTRING ...) (defvar NAME VALUE DOCSTRING) (defconst NAME VALUE DOCSTRING) (fset (quote NAME) (make-byte-code ... DOCSTRING ...)) (fset (quote NAME) #[... DOCSTRING ...]) (defalias (quote NAME) #[... DOCSTRING ...]) (custom-declare-variable (quote NAME) VALUE DOCSTRING ...) starting in column zero. (quote NAME) may appear as 'NAME as well. We also look for #@LENGTH CONTENTS^_ at the beginning of the line. When we find that, we save it for the following defining-form, and we use that instead of reading a doc string within that defining-form. For defvar, defconst, and fset we skip to the docstring with a kludgy formatting convention: all docstrings must appear on the same line as the initial open-paren (the one in column zero) and must contain a backslash and a newline immediately after the initial double-quote. No newlines must appear between the beginning of the form and the first double-quote. For defun, defmacro, and autoload, we know how to skip over the arglist, but the doc string must still have a backslash and newline immediately after the double quote. The only source files that must follow this convention are preloaded uncompiled ones like loaddefs.el and bindings.el; aside from that, it is always the .elc file that we look at, and they are no problem because byte-compiler output follows this convention. The NAME and DOCSTRING are output. NAME is preceded by `F' for a function or `V' for a variable. An entry is output only if DOCSTRING has \ newline just after the opening " Adds the filename a symbol or function was found in before its docstring; there's no need for this with the load-history available, but we do it for consistency with the C parsing code. */ static void skip_white (FILE *infile) { char c = ' '; while (c == ' ' || c == '\t' || c == '\n') c = getc (infile); ungetc (c, infile); } static void read_lisp_symbol (FILE *infile, char *buffer) { char c; char *fillp = buffer; skip_white (infile); while (1) { c = getc (infile); if (c == '\\') /* FSF has *(++fillp), which is wrong. */ *fillp++ = getc (infile); else if (c == ' ' || c == '\t' || c == '\n' || c == '(' || c == ')') { ungetc (c, infile); *fillp = 0; break; } else *fillp++ = c; } if (! buffer[0]) fprintf (stderr, "## expected a symbol, got '%c'\n", c); skip_white (infile); } static int scan_lisp_file (const char *filename, const char *mode) { FILE *infile; register int c; char *saved_string = 0; infile = fopen (filename, mode); if (infile == NULL) { perror (filename); return 0; /* No error */ } c = '\n'; while (!feof (infile)) { char buffer[BUFSIZ]; char type; /* If not at end of line, skip till we get to one. */ if (c != '\n') { c = getc_skipping_iso2022 (infile); continue; } /* Skip the line break. */ while (c == '\n') c = getc_skipping_iso2022 (infile); /* Detect a dynamic doc string and save it for the next expression. */ if (c == '#') { c = getc_skipping_iso2022 (infile); if (c == '@') { int length = 0; int i; /* Read the length. */ while ((c = getc_skipping_iso2022 (infile), c >= '0' && c <= '9')) { length *= 10; length += c - '0'; } /* The next character is a space that is counted in the length but not part of the doc string. We already read it, so just ignore it. */ length--; /* Read in the contents. */ if (saved_string != 0) free (saved_string); saved_string = (char *) xmalloc (length); for (i = 0; i < length; i++) saved_string[i] = getc (infile); /* The last character is a ^_. That is needed in the .elc file but it is redundant in DOC. So get rid of it here. */ saved_string[length - 1] = 0; /* Skip the line break. */ while (c == '\n') c = getc_skipping_iso2022 (infile); /* Skip the following line. */ while (c != '\n') c = getc_skipping_iso2022 (infile); } continue; } if (c != '(') continue; read_lisp_symbol (infile, buffer); if (! strcmp (buffer, "defun") || ! strcmp (buffer, "defmacro") || ! strcmp (buffer, "defsubst")) { type = 'F'; read_lisp_symbol (infile, buffer); /* Skip the arguments: either "nil" or a list in parens */ c = getc_skipping_iso2022 (infile); if (c == 'n') /* nil */ { if ((c = getc_skipping_iso2022 (infile)) != 'i' || (c = getc_skipping_iso2022 (infile)) != 'l') { fprintf (stderr, "## unparsable arglist in %s (%s)\n", buffer, filename); continue; } } else if (c != '(') { fprintf (stderr, "## unparsable arglist in %s (%s)\n", buffer, filename); continue; } else while (c != ')') { c = getc_skipping_iso2022 (infile); if (c < 0) continue; } skip_white (infile); /* If the next three characters aren't `dquote bslash newline' then we're not reading a docstring. */ if ((c = getc_skipping_iso2022 (infile)) != '"' || (c = getc_skipping_iso2022 (infile)) != '\\' || (c = getc_skipping_iso2022 (infile)) != '\n') { #ifdef DEBUG fprintf (stderr, "## non-docstring in %s (%s)\n", buffer, filename); #endif continue; } } else if (! strcmp (buffer, "defvar") || ! strcmp (buffer, "defconst")) { char c1 = 0, c2 = 0; type = 'V'; read_lisp_symbol (infile, buffer); if (saved_string == 0) { /* Skip until the end of line; remember two previous chars. */ while (c != '\n' && c >= 0) { c2 = c1; c1 = c; c = getc_skipping_iso2022 (infile); } /* If two previous characters were " and \, this is a doc string. Otherwise, there is none. */ if (c2 != '"' || c1 != '\\') { #ifdef DEBUG fprintf (stderr, "## non-docstring in %s (%s)\n", buffer, filename); #endif continue; } } } else if (! strcmp (buffer, "custom-declare-variable")) { char c1 = 0, c2 = 0; type = 'V'; c = getc (infile); if (c == '\'') read_lisp_symbol (infile, buffer); else { if (c != '(') { fprintf (stderr, "## unparsable name in custom-declare-variable in %s\n", filename); continue; } read_lisp_symbol (infile, buffer); if (strcmp (buffer, "quote")) { fprintf (stderr, "## unparsable name in custom-declare-variable in %s\n", filename); continue; } read_lisp_symbol (infile, buffer); c = getc (infile); if (c != ')') { fprintf (stderr, "## unparsable quoted name in custom-declare-variable in %s\n", filename); continue; } } if (saved_string == 0) { /* Skip to end of line; remember the two previous chars. */ while (c != '\n' && c >= 0) { c2 = c1; c1 = c; c = getc_skipping_iso2022 (infile); } /* If two previous characters were " and \, this is a doc string. Otherwise, there is none. */ if (c2 != '"' || c1 != '\\') { #ifdef DEBUG fprintf (stderr, "## non-docstring in %s (%s)\n", buffer, filename); #endif continue; } } } else if (! strcmp (buffer, "fset") || ! strcmp (buffer, "defalias")) { char c1 = 0, c2 = 0; type = 'F'; c = getc_skipping_iso2022 (infile); if (c == '\'') read_lisp_symbol (infile, buffer); else { if (c != '(') { fprintf (stderr, "## unparsable name in fset in %s\n", filename); continue; } read_lisp_symbol (infile, buffer); if (strcmp (buffer, "quote")) { fprintf (stderr, "## unparsable name in fset in %s\n", filename); continue; } read_lisp_symbol (infile, buffer); c = getc_skipping_iso2022 (infile); if (c != ')') { fprintf (stderr, "## unparsable quoted name in fset in %s\n", filename); continue; } } if (saved_string == 0) { /* Skip to end of line; remember the two previous chars. */ while (c != '\n' && c >= 0) { c2 = c1; c1 = c; c = getc_skipping_iso2022 (infile); } /* If two previous characters were " and \, this is a doc string. Otherwise, there is none. */ if (c2 != '"' || c1 != '\\') { #ifdef DEBUG fprintf (stderr, "## non-docstring in %s (%s)\n", buffer, filename); #endif continue; } } } else if (! strcmp (buffer, "autoload")) { type = 'F'; c = getc_skipping_iso2022 (infile); if (c == '\'') read_lisp_symbol (infile, buffer); else { if (c != '(') { fprintf (stderr, "## unparsable name in autoload in %s\n", filename); continue; } read_lisp_symbol (infile, buffer); if (strcmp (buffer, "quote")) { fprintf (stderr, "## unparsable name in autoload in %s\n", filename); continue; } read_lisp_symbol (infile, buffer); c = getc_skipping_iso2022 (infile); if (c != ')') { fprintf (stderr, "## unparsable quoted name in autoload in %s\n", filename); continue; } } skip_white (infile); if ((c = getc_skipping_iso2022 (infile)) != '\"') { fprintf (stderr, "## autoload of %s unparsable (%s)\n", buffer, filename); continue; } read_c_string (infile, 0, 0); skip_white (infile); if (saved_string == 0) { /* If the next three characters aren't `dquote bslash newline' then we're not reading a docstring. */ if ((c = getc_skipping_iso2022 (infile)) != '"' || (c = getc_skipping_iso2022 (infile)) != '\\' || (c = getc_skipping_iso2022 (infile)) != '\n') { #ifdef DEBUG fprintf (stderr, "## non-docstring in %s (%s)\n", buffer, filename); #endif continue; } } } #if 0 /* causes crash */ else if (! strcmp (buffer, "if") || ! strcmp (buffer, "byte-code")) ; #endif else { #ifdef DEBUG fprintf (stderr, "## unrecognized top-level form, %s (%s)\n", buffer, filename); #endif continue; } /* At this point, we should either use the previous dynamic doc string in saved_string or gobble a doc string from the input file. In the latter case, the opening quote (and leading backslash-newline) have already been read. */ put_filename (filename); /* XEmacs addition */ putc (037, outfile); putc (type, outfile); fprintf (outfile, "%s\n", buffer); if (saved_string) { fputs (saved_string, outfile); /* Don't use one dynamic doc string twice. */ free (saved_string); saved_string = 0; } else read_c_string (infile, 1, 0); } fclose (infile); return 0; }