annotate lib-src/make-docfile.c @ 5353:38e24b8be4ea

Improve the lexical scoping in #'block, #'return-from. lisp/ChangeLog addition: 2011-02-07 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el: * bytecomp.el (byte-compile-initial-macro-environment): Shadow `block', `return-from' here, we implement them differently when byte-compiling. * bytecomp.el (byte-compile-active-blocks): New. * bytecomp.el (byte-compile-block-1): New. * bytecomp.el (byte-compile-return-from-1): New. * bytecomp.el (return-from-1): New. * bytecomp.el (block-1): New. These are two aliases that exist to have their own associated byte-compile functions, which functions implement `block' and `return-from'. * cl-extra.el (cl-macroexpand-all): Fix a bug here when macros in the environment have been compiled. * cl-macs.el (block): * cl-macs.el (return): * cl-macs.el (return-from): Be more careful about lexical scope in these macros. * cl.el: * cl.el ('cl-block-wrapper): Removed. * cl.el ('cl-block-throw): Removed. These aren't needed in code generated by this XEmacs. They shouldn't be needed in code generated by XEmacs 21.4, but if it turns out the packages do need them, we can put them back. 2011-01-30 Mike Sperber <mike@xemacs.org> * font-lock.el (font-lock-fontify-pending-extents): Don't fail if `font-lock-mode' is unset, which can happen in the middle of `revert-buffer'. 2011-01-23 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (delete): * cl-macs.el (delq): * cl-macs.el (remove): * cl-macs.el (remq): Don't use the compiler macro if these functions were given the wrong number of arguments, as happens in lisp-tests.el. * cl-seq.el (remove, remq): Removed. I added these to subr.el, and forgot to remove them from here. 2011-01-22 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-setq, byte-compile-set): Remove kludge allowing keywords' values to be set, all the code that does that is gone. * cl-compat.el (elt-satisfies-test-p): * faces.el (set-face-parent): * faces.el (face-doc-string): * gtk-font-menu.el: * gtk-font-menu.el (gtk-reset-device-font-menus): * msw-font-menu.el: * msw-font-menu.el (mswindows-reset-device-font-menus): * package-get.el (package-get-installedp): * select.el (select-convert-from-image-data): * sound.el: * sound.el (load-sound-file): * x-font-menu.el (x-reset-device-font-menus-core): Don't quote keywords, they're self-quoting, and the win from backward-compatibility is sufficiently small now that the style problem overrides it. 2011-01-22 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (block, return-from): Require that NAME be a symbol in these macros, as always documented in the #'block docstring and as required by Common Lisp. * descr-text.el (unidata-initialize-unihan-database): Correct the use of non-symbols in #'block and #'return-from in this function. 2011-01-15 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (concatenate): Accept more complicated TYPEs in this function, handing the sequences over to #'coerce if we don't understand them here. * cl-macs.el (inline): Don't proclaim #'concatenate as inline, its compiler macro is more useful than doing that. 2011-01-11 Aidan Kehoe <kehoea@parhasard.net> * subr.el (delete, delq, remove, remq): Move #'remove, #'remq here, they don't belong in cl-seq.el; move #'delete, #'delq here from fns.c, implement them in terms of #'delete*, allowing support for sequences generally. * update-elc.el (do-autoload-commands): Use #'delete*, not #'delq here, now the latter's no longer dumped. * cl-macs.el (delete, delq): Add compiler macros transforming #'delete and #'delq to #'delete* calls. 2011-01-10 Aidan Kehoe <kehoea@parhasard.net> * dialog.el (make-dialog-box): Correct a misplaced parenthesis here, thank you Mats Lidell in 87zkr9gqrh.fsf@mail.contactor.se ! 2011-01-02 Aidan Kehoe <kehoea@parhasard.net> * dialog.el (make-dialog-box): * list-mode.el (display-completion-list): These functions used to use cl-parsing-keywords; change them to use defun* instead, fixing the build. (Not sure what led to me not including this change in d1b17a33450b!) 2011-01-02 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (define-star-compiler-macros): Make sure the form has ITEM and LIST specified before attempting to change to calls with explicit tests; necessary for some tests in lisp-tests.el to compile correctly. (stable-union, stable-intersection): Add compiler macros for these functions, in the same way we do for most of the other functions in cl-seq.el. 2011-01-01 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (dolist, dotimes, do-symbols, macrolet) (symbol-macrolet): Define these macros with defmacro* instead of parsing the argument list by hand, for the sake of style and readability; use backquote where appropriate, instead of calling #'list and and friends, for the same reason. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * x-misc.el (device-x-display): Provide this function, documented in the Lispref for years, but not existing previously. Thank you Julian Bradfield, thank you Jeff Mincy. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * cl-seq.el: Move the heavy lifting from this file to C. Dump the cl-parsing-keywords macro, but don't use defun* for the functions we define that do take keywords, dynamic scope lossage makes that not practical. * subr.el (sort, fillarray): Move these aliases here. (map-plist): #'nsublis is now built-in, but at this point #'eql isn't necessarily available as a test; use #'eq. * obsolete.el (cl-delete-duplicates): Make this available for old compiler macros and old code. (memql): Document that this is equivalent to #'member*, and worse. * cl.el (adjoin, subst): Removed. These are in C. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * simple.el (assoc-ignore-case): Remove a duplicate definition of this function (it's already in subr.el). * iso8859-1.el (char-width): On non-Mule, make this function equivalent to that produced by (constantly 1), but preserve its docstring. * subr.el (subst-char-in-string): Define this in terms of #'substitute, #'nsubstitute. (string-width): Define this using #'reduce and #'char-width. (char-width): Give this a simpler definition, it makes far more sense to check for mule at load time and redefine, as we do in iso8859-1.el. (store-substring): Implement this in terms of #'replace, now #'replace is cheap. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * update-elc.el (lisp-files-needed-for-byte-compilation) (lisp-files-needing-early-byte-compilation): cl-macs belongs in the former, not the latter, it is as fundamental as bytecomp.el. 2010-12-30 Aidan Kehoe <kehoea@parhasard.net> * cl.el: Provde the Common Lisp program-error, type-error as error symbols. This doesn't nearly go far enough for anyone using the Common Lisp errors. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (delete-duplicates): If the form has an incorrect number of arguments, don't attempt a compiler macroexpansion. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (cl-safe-expr-p): Forms that start with the symbol lambda are also safe. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (= < > <= >=): For these functions' compiler macros, the optimisation is safe even if the first and the last arguments have side effects, since they're only used the once. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (inline-side-effect-free-compiler-macros): Unroll a loop here at macro-expansion time, so these compiler macros are compiled. Use #'eql instead of #'eq in a couple of places for better style. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (notany, notevery): Avoid some dynamic scope stupidity with local variable names in these functions, when they weren't prefixed with cl-; go into some more detail in the doc strings. 2010-12-29 Aidan Kehoe <kehoea@parhasard.net> * byte-optimize.el (side-effect-free-fns): #'remove, #'remq are free of side-effects. (side-effect-and-error-free-fns): Drop dot, dot-marker from the list. 2010-11-17 Aidan Kehoe <kehoea@parhasard.net> * cl-extra.el (coerce): In the argument list, name the first argument OBJECT, not X; the former name was always used in the doc string and is clearer. Handle vector type specifications which include the length of the target sequence, error if there's a mismatch. * cl-macs.el (cl-make-type-test): Handle type specifications starting with the symbol 'eql. 2010-11-14 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (eql): Don't remove the byte-compile property of this symbol. That was necessary to override a bug in bytecomp.el where #'eql was confused with #'eq, which bug we no longer have. If neither expression is constant, don't attempt to handle the expression in this compiler macro, leave it to byte-compile-eql, which produces better code anyway. * bytecomp.el (eq): #'eql is not the function associated with the byte-eq byte code. (byte-compile-eql): Add an explicit compile method for this function, for cases where the cl-macs compiler macro hasn't reduced it to #'eq or #'equal. 2010-10-25 Aidan Kehoe <kehoea@parhasard.net> Add compiler macros and compilation sanity-checking for various functions that take keywords. * byte-optimize.el (side-effect-free-fns): #'symbol-value is side-effect free and not error free. * bytecomp.el (byte-compile-normal-call): Check keyword argument lists for sanity; store information about the positions where keyword arguments start using the new byte-compile-keyword-start property. * cl-macs.el (cl-const-expr-val): Take a new optional argument, cl-not-constant, defaulting to nil, in this function; return it if the expression is not constant. (cl-non-fixnum-number-p): Make this into a separate function, we want to pass it to #'every. (eql): Use it. (define-star-compiler-macros): Use the same code to generate the member*, assoc* and rassoc* compiler macros; special-case some code in #'add-to-list in subr.el. (remove, remq): Add compiler macros for these two functions, in preparation for #'remove being in C. (define-foo-if-compiler-macros): Transform (remove-if-not ...) calls to (remove ... :if-not) at compile time, which will be a real win once the latter is in C. (define-substitute-if-compiler-macros) (define-subst-if-compiler-macros): Similarly for these functions. (delete-duplicates): Change this compiler macro to use #'plists-equal; if we don't have information about the type of SEQUENCE at compile time, don't bother attempting to inline the call, the function will be in C soon enough. (equalp): Remove an old commented-out compiler macro for this, if we want to see it it's in version control. (subst-char-in-string): Transform this to a call to nsubstitute or nsubstitute, if that is appropriate. * cl.el (ldiff): Don't call setf here, this makes for a load-time dependency problem in cl-macs.el 2010-06-14 Stephen J. Turnbull <stephen@xemacs.org> * term/vt100.el: Refer to XEmacs, not GNU Emacs, in permissions. * term/bg-mouse.el: * term/sup-mouse.el: Put copyright notice in canonical "Copyright DATE AUTHOR" form. Refer to XEmacs, not GNU Emacs, in permissions. * site-load.el: Add permission boilerplate. * mule/canna-leim.el: * alist.el: Refer to XEmacs, not APEL/this program, in permissions. * mule/canna-leim.el: Remove my copyright, I've assigned it to the FSF. 2010-06-14 Stephen J. Turnbull <stephen@xemacs.org> * gtk.el: * gtk-widget-accessors.el: * gtk-package.el: * gtk-marshal.el: * gtk-compose.el: * gnome.el: Add copyright notice based on internal evidence. 2010-06-14 Stephen J. Turnbull <stephen@xemacs.org> * easymenu.el: Add reference to COPYING to permission notice. * gutter.el: * gutter-items.el: * menubar-items.el: Fix typo "Xmacs" in permissions notice. 2010-06-14 Stephen J. Turnbull <stephen@xemacs.org> * auto-save.el: * font.el: * fontconfig.el: * mule/kinsoku.el: Add "part of XEmacs" text to permission notice. 2010-10-14 Aidan Kehoe <kehoea@parhasard.net> * byte-optimize.el (side-effect-free-fns): * cl-macs.el (remf, getf): * cl-extra.el (tailp, cl-set-getf, cl-do-remf): * cl.el (ldiff, endp): Tighten up Common Lisp compatibility for #'ldiff, #'endp, #'tailp; add circularity checking for the first two. #'cl-set-getf and #'cl-do-remf were Lisp implementations of #'plist-put and #'plist-remprop; change the names to aliases, changes the macros that use them to using #'plist-put and #'plist-remprop directly. 2010-10-12 Aidan Kehoe <kehoea@parhasard.net> * abbrev.el (fundamental-mode-abbrev-table, global-abbrev-table): Create both these abbrev tables using the usual #'define-abbrev-table calls, rather than attempting to special-case them. * cl-extra.el: Force cl-macs to be loaded here, if cl-extra.el is being loaded interpreted. Previously other, later files would redundantly call (load "cl-macs") when interpreted, it's more reasonable to do it here, once. * cmdloop.el (read-quoted-char-radix): Use defcustom here, we don't have any dump-order dependencies that would prevent that. * custom.el (eval-when-compile): Don't load cl-macs when interpreted or when byte-compiling, rely on cl-extra.el in the former case and the appropriate entry in bytecomp-load-hook in the latter. Get rid of custom-declare-variable-list, we have no dump-time dependencies that would require it. * faces.el (eval-when-compile): Don't load cl-macs when interpreted or when byte-compiling. * packages.el: Remove some inaccurate comments. * post-gc.el (cleanup-simple-finalizers): Use #'delete-if-not here, now the order of preloaded-file-list has been changed to make it available. * subr.el (custom-declare-variable-list): Remove. No need for it. Also remove a stub define-abbrev-table from this file, given the current order of preloaded-file-list there's no need for it. 2010-10-10 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-constp) Forms quoted with FUNCTION are also constant. (byte-compile-initial-macro-environment): In #'the, if FORM is constant and does not match TYPE, warn at byte-compile time. 2010-10-10 Aidan Kehoe <kehoea@parhasard.net> * backquote.el (bq-vector-contents, bq-list*): Remove; the former is equivalent to (append VECTOR nil), the latter to (list* ...). (bq-process-2): Use (append VECTOR nil) instead of using #'bq-vector-contents to convert to a list. (bq-process-1): Now we use list* instead of bq-list * subr.el (list*): Moved from cl.el, since it is now required to be available the first time a backquoted form is encountered. * cl.el (list*): Move to subr.el. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * test-harness.el (Check-Message): Add an omitted comma here, thank you the buildbot. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * hash-table.el (hash-table-key-list, hash-table-value-list) (hash-table-key-value-alist, hash-table-key-value-plist): Remove some useless #'nreverse calls in these files; our hash tables have no order, it's not helpful to pretend they do. * behavior.el (read-behavior): Do the same in this file, in some code evidently copied from hash-table.el. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * info.el (Info-insert-dir): * format.el (format-deannotate-region): * files.el (cd, save-buffers-kill-emacs): Use #'some, #'every and related functions for applying boolean operations to lists, instead of rolling our own ones that cons and don't short-circuit. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-initial-macro-environment): * cl-macs.el (the): Rephrase the docstring, make its implementation when compiling files a little nicer. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * descr-text.el (unidata-initialize-unicodedata-database) (unidata-initialize-unihan-database, describe-char-unicode-data) (describe-char-unicode-data): Wrap calls to the database functions with (with-fboundp ...), avoiding byte compile warnings on builds without support for the database functions. (describe-char): (reduce #'max ...), not (apply #'max ...), no need to cons needlessly. (describe-char): Remove a redundant lambda wrapping #'extent-properties. (describe-char-unicode-data): Call #'nsubst when replacing "" with nil in the result of #'split-string, instead of consing inside mapcar. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * x-faces.el (x-available-font-sizes): * specifier.el (let-specifier): * package-ui.el (pui-add-required-packages): * msw-faces.el (mswindows-available-font-sizes): * modeline.el (modeline-minor-mode-menu): * minibuf.el (minibuf-directory-files): Replace the O2N (delq nil (mapcar (lambda (W) (and X Y)) Z)) with the ON (mapcan (lambda (W) (and X (list Y))) Z) in these files. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * cl-macs.el (= < > <= >=): When these functions are handed more than two arguments, and those arguments have no side effects, transform to a series of two argument calls, avoiding funcall in the byte-compiled code. * mule/mule-cmds.el (finish-set-language-environment): Take advantage of this change in a function called 256 times at startup. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * bytecomp.el (byte-compile-function-form, byte-compile-quote) (byte-compile-quote-form): Warn at compile time, and error at runtime, if a (quote ...) or a (function ...) form attempts to quote more than one object. 2010-09-16 Aidan Kehoe <kehoea@parhasard.net> * byte-optimize.el (byte-optimize-apply): Transform (apply 'nconc (mapcar ...)) to (mapcan ...); warn about use of the first idiom. * update-elc.el (do-autoload-commands): * packages.el (packages-find-package-library-path): * frame.el (frame-list): * extents.el (extent-descendants): * etags.el (buffer-tag-table-files): * dumped-lisp.el (preloaded-file-list): * device.el (device-list): * bytecomp-runtime.el (proclaim-inline, proclaim-notinline) Use #'mapcan, not (apply #'nconc (mapcar ...) in all these files. * bytecomp-runtime.el (eval-when-compile, eval-and-compile): In passing, mention that these macros also evaluate the body when interpreted. tests/ChangeLog addition: 2011-02-07 Aidan Kehoe <kehoea@parhasard.net> * automated/lisp-tests.el: Test lexical scope for `block', `return-from'; add a Known-Bug-Expect-Failure for a contorted example that fails when byte-compiled.
author Aidan Kehoe <kehoea@parhasard.net>
date Mon, 07 Feb 2011 12:01:24 +0000
parents 39d74978fd32
children 308d34e9f07d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1 /* Generate doc-string file for XEmacs from source files.
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
2 Copyright (C) 1985, 86, 92, 93, 94, 97, 1999, 2000, 2001
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
3 Free Software Foundation, Inc.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
4 Copyright (C) 1995 Board of Trustees, University of Illinois.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
5 Copyright (C) 1998, 1999 J. Kean Johnston.
5076
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
6 Copyright (C) 2001, 2002, 2010 Ben Wing.
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
7
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
8 This file is part of XEmacs.
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
9
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
10 XEmacs is free software; you can redistribute it and/or modify
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
11 it under the terms of the GNU General Public License as published by
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
12 the Free Software Foundation; either version 2, or (at your option)
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
13 any later version.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
14
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
15 XEmacs is distributed in the hope that it will be useful,
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
16 but WITHOUT ANY WARRANTY; without even the implied warranty of
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
18 GNU General Public License for more details.
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
19
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
20 You should have received a copy of the GNU General Public License
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
21 along with XEmacs; see the file COPYING. If not, write to
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
22 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
23 Boston, MA 02111-1307, USA. */
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
24
1618
1038bc1b8cb9 [xemacs-hg @ 2003-08-12 14:47:07 by james]
james
parents: 1111
diff changeset
25 /* Synched up with: FSF 21.3. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
26
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
27 /* The arguments given to this program are all the C and Lisp source files
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
28 of XEmacs. .elc and .el and .c files are allowed.
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
29 A .o or .obj file can also be specified; the .c file it was made from is used.
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
30 This helps the makefile pass the correct list of files.
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
31
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
32 The results, which go to standard output or to a file
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
33 specified with -a or -o (-a to append, -o to start from nothing),
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
34 are entries containing function or variable names and their documentation.
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
35 Each entry starts with a ^_ character.
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
36 Then comes F for a function or V for a variable.
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
37 Then comes the function or variable name, terminated with a newline.
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
38 Then comes the documentation for that function or variable.
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
39
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
40 Added 19.15/20.1: `-i site-packages' allow installer to dump extra packages
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
41 without modifying Makefiles, etc.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
42 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
43
438
84b14dcb0985 Import from CVS: tag r21-2-27
cvs
parents: 428
diff changeset
44 #include <config.h>
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
45 #include <sysfile.h>
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
46
3368
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
47 #include <assert.h>
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
48 #include <stdio.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
49 #include <stdlib.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
50 #include <string.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
51 #include <ctype.h>
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
52
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1618
diff changeset
53 #include "compiler.h"
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1618
diff changeset
54
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
55 /* XEmacs addition */
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
56 #define C_IDENTIFIER_CHAR_P(c) \
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
57 (('A' <= c && c <= 'Z') || \
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
58 ('a' <= c && c <= 'z') || \
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
59 ('0' <= c && c <= '9') || \
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
60 (c == '_'))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
61
3368
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
62 static void put_filename (const char *filename);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
63 static int scan_file (const char *filename);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
64 static int read_c_string (FILE *, int, int);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
65 static void write_c_args (FILE *out, const char *func, char *buf, int minargs,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
66 int maxargs);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
67 static int scan_c_file (const char *filename, const char *mode);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
68 static void skip_white (FILE *);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
69 static void read_lisp_symbol (FILE *, char *);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
70 static int scan_lisp_file (const char *filename, const char *mode);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
71
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
72 /* Stdio stream for output to the DOC file. */
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
73 static FILE *outfile;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
74
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
75 /* XEmacs addition */
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
76 enum
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
77 {
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
78 el_file,
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
79 elc_file,
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
80 c_file
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
81 } Current_file_type;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
82
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
83 /* Name this program was invoked with. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
84 char *progname;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
85
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
86 /* XEmacs addition: set to 1 if this was invoked by ellcc */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
87 int ellcc = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
88
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
89 /* Print error message. `s1' is printf control string, `s2' is arg for it. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
90
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
91 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
92 error (const char *s1, const char *s2)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
93 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
94 fprintf (stderr, "%s: ", progname);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
95 fprintf (stderr, s1, s2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
96 fprintf (stderr, "\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
97 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
98
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
99 /* Print error message and exit. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
100
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
101 static void
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
102 fatal (const char *s1, const char *s2)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
103 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
104 error (s1, s2);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
105 exit (1);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
106 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
107
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
108 /* Like malloc but get fatal error if memory is exhausted. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
109
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
110 static long *
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
111 xmalloc (unsigned int size)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
112 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
113 long *result = (long *) malloc (size);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
114 if (result == NULL)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
115 fatal ("virtual memory exhausted", 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
116 return result;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
117 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
118
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
119 /* XEmacs addition */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
120 static char *
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
121 next_extra_elc (char *extra_elcs)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
122 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
123 static FILE *fp = NULL;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
124 static char line_buf[BUFSIZ];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
125 char *p = line_buf+1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
126
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
127 if (!fp)
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
128 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
129 if (!extra_elcs)
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
130 return NULL;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
131 else if (!(fp = fopen (extra_elcs, READ_BINARY)))
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
132 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
133 /* It is not an error if this file doesn't exist. */
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
134 /*fatal ("error opening site package file list", 0);*/
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
135 return NULL;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
136 }
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
137 fgets (line_buf, BUFSIZ, fp);
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
138 }
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
139
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
140 do
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
141 {
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
142 if (!fgets (line_buf, BUFSIZ, fp))
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
143 {
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
144 fclose (fp);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
145 fp = NULL;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
146 return NULL;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
147 }
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
148 line_buf[0] = '\0';
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
149 /* reject too short or too long lines */
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
150 } while (strlen (p) <= 2 || strlen (p) >= (BUFSIZ - 5));
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
151
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
152 p[strlen (p) - 2] = '\0';
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
153 strcat (p, ".elc");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
154
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
155 return p;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
156 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
157
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
158
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
159 int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
160 main (int argc, char **argv)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
161 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
162 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
163 int err_count = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
164 int first_infile;
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
165 char *extra_elcs = NULL; /* XEmacs addition */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
166
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
167 progname = argv[0];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
168
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
169 outfile = stdout;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
170
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
171 /* Don't put CRs in the DOC file. */
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
172 #ifdef WIN32_NATIVE
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
173 _fmode = O_BINARY;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
174 _setmode (fileno (stdout), O_BINARY);
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
175 #endif /* WIN32_NATIVE */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
176
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
177 /* If first two args are -o FILE, output to FILE. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
178 i = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
179 if (argc > i + 1 && !strcmp (argv[i], "-o"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
180 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
181 outfile = fopen (argv[i + 1], WRITE_BINARY);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
182 i += 2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
183 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
184 if (argc > i + 1 && !strcmp (argv[i], "-a"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
185 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
186 outfile = fopen (argv[i + 1], APPEND_BINARY);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
187 i += 2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
188 }
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
189 if (argc > i + 1 && !strcmp (argv[i], "-d"))
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
190 {
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
191 chdir (argv[i + 1]);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
192 i += 2;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
193 }
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
194
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
195 /* Additional command line arguments for XEmacs */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
196 if (argc > i + 1 && !strcmp (argv[i], "-E"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
197 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
198 outfile = fopen (argv[i + 1], APPEND_BINARY);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
199 i += 2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
200 ellcc = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
201 }
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
202 if (argc > (i + 1) && !strcmp (argv[i], "-i"))
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
203 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
204 extra_elcs = argv[i + 1];
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
205 i += 2;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
206 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
207
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
208 if (outfile == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
209 fatal ("No output file specified", "");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
210
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
211 /* XEmacs addition */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
212 if (ellcc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
213 fprintf (outfile, "{\n");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
214
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
215 first_infile = i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
216 for (; i < argc; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
217 {
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
218 /* XEmacs addition: the "if" clause is new; the "else" clause is the
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
219 original FSF Emacs code */
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
220 if (argv[i][0] == '@')
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
221 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
222 /* Allow a file containing files to process, for use w/MS Windows
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
223 (where command-line length limits are more problematic) */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
224 FILE *argfile = fopen (argv[i] + 1, READ_TEXT);
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2286
diff changeset
225 char arg[QXE_PATH_MAX];
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
226
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
227 if (!argfile)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
228 fatal ("Unable to open argument file %s", argv[i] + 1);
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2286
diff changeset
229 while (fgets (arg, QXE_PATH_MAX, argfile))
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
230 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
231 if (arg[strlen (arg) - 1] == '\n')
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
232 arg[strlen (arg) - 1] = '\0'; /* chop \n */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
233 err_count += scan_file (arg);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
234 }
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
235 }
4539
061e030e3270 Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4456
diff changeset
236 else if (argc > i + 1 && !strcmp (argv[i], "-d"))
061e030e3270 Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4456
diff changeset
237 {
061e030e3270 Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4456
diff changeset
238 /* XEmacs change; allow more than one chdir.
061e030e3270 Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4456
diff changeset
239 The idea is that the second chdir is to source-lisp, and that
061e030e3270 Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4456
diff changeset
240 any Lisp files not under there have the full path specified. */
061e030e3270 Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4456
diff changeset
241 i += 1;
061e030e3270 Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4456
diff changeset
242 chdir (argv[i]);
061e030e3270 Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4456
diff changeset
243 continue;
061e030e3270 Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4456
diff changeset
244 }
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
245 else
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
246 {
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
247 int j;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
248 /* Don't process one file twice. */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
249 for (j = first_infile; j < i; j++)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
250 if (! strcmp (argv[i], argv[j]))
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
251 break;
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
252 if (j == i)
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
253 err_count += scan_file (argv[i]);
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
254 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
255 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
256
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
257 /* XEmacs addition */
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
258 if (extra_elcs)
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
259 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
260 char *p;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
261
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
262 while ((p = next_extra_elc (extra_elcs)) != NULL)
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
263 err_count += scan_file (p);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
264 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
265
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
266 putc ('\n', outfile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
267 if (ellcc)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
268 fprintf (outfile, "}\n\n");
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
269 /* End XEmacs addition */
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
270
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
271 #ifndef VMS
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
272 exit (err_count > 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
273 #endif /* VMS */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
274 return err_count > 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
275 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
276
3368
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
277 /* Add a source file name boundary in the output file. */
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
278 static void
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
279 put_filename (const char *filename)
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
280 {
4539
061e030e3270 Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4456
diff changeset
281 /* XEmacs change; don't strip directory information. */
061e030e3270 Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4456
diff changeset
282 #if 0
3368
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
283 const char *tmp;
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
284
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
285 for (tmp = filename; *tmp; tmp++)
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
286 {
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
287 if (IS_DIRECTORY_SEP(*tmp))
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
288 filename = tmp + 1;
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
289 }
4539
061e030e3270 Fix some bugs in load-history construction, built-in symbol file names.
Aidan Kehoe <kehoea@parhasard.net>
parents: 4456
diff changeset
290 #endif
3368
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
291
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
292 /* <= because sizeof includes the nul byte at the end. Not quite right,
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
293 because it should include the length of the symbol + "\037[VF]" instead
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
294 of simply 10. */
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
295 assert(sizeof("\037S\n") + strlen(filename) + 10
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
296 <= DOC_MAX_FILENAME_LENGTH);
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
297
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
298 putc (037, outfile);
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
299 putc ('S', outfile);
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
300 fprintf (outfile, "%s\n", filename);
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
301 }
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
302
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
303 /* Read file FILENAME and output its doc strings to outfile. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
304 /* Return 1 if file is not found, 0 if it is found. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
305
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
306 static int
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
307 scan_file (const char *filename)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
308 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
309 int len = strlen (filename);
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
310
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
311 /* XEmacs change: test ellcc and set Current_file_type in each case */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
312 if (ellcc == 0 && len > 4 && !strcmp (filename + len - 4, ".elc"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
313 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
314 Current_file_type = elc_file;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
315 return scan_lisp_file (filename, READ_BINARY);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
316 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
317 else if (ellcc == 0 && len > 3 && !strcmp (filename + len - 3, ".el"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
318 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
319 Current_file_type = el_file;
4456
c785f98c6737 Pass READ_BINARY to scan_lisp_file, scan_c_file in make-docfile.c
Aidan Kehoe <kehoea@parhasard.net>
parents: 3368
diff changeset
320 return scan_lisp_file (filename, READ_BINARY);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
321 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
322 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
323 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
324 Current_file_type = c_file;
4456
c785f98c6737 Pass READ_BINARY to scan_lisp_file, scan_c_file in make-docfile.c
Aidan Kehoe <kehoea@parhasard.net>
parents: 3368
diff changeset
325 return scan_c_file (filename, READ_BINARY);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
326 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
327 }
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
328
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
329 /* XEmacs addition: ISO 2022 handling */
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
330 static int
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
331 getc_skipping_iso2022 (FILE *file)
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
332 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
333 register int c;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
334 /* #### Kludge -- Ignore any ISO2022 sequences */
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
335 c = getc (file);
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
336 while (c == 27)
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
337 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
338 c = getc (file);
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
339 if (c == '$')
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
340 c = getc (file);
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
341 if (c >= '(' && c <= '/')
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
342 c = getc (file);
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
343 c = getc (file);
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
344 }
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
345 return c;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
346 }
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
347
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
348 enum iso2022_state
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
349 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
350 ISO_NOTHING,
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
351 ISO_ESC,
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
352 ISO_DOLLAR,
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
353 ISO_FINAL_IS_NEXT,
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
354 ISO_DOLLAR_AND_FINAL_IS_NEXT
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
355 };
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
356
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
357 static int non_ascii_p;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
358
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
359 static int
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
360 getc_iso2022 (FILE *file)
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
361 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
362 /* #### Kludge -- Parse ISO2022 sequences (more or less) */
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
363 static enum iso2022_state state;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
364 static int prevc;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
365 register int c;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
366 c = getc (file);
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
367 switch (state)
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
368 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
369 case ISO_NOTHING:
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
370 if (c == 27)
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
371 state = ISO_ESC;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
372 break;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
373
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
374 case ISO_ESC:
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
375 if (c == '$')
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
376 state = ISO_DOLLAR;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
377 else if (c >= '(' && c <= '/')
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
378 state = ISO_FINAL_IS_NEXT;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
379 else
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
380 state = ISO_NOTHING;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
381 break;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
382
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
383 case ISO_DOLLAR:
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
384 if (c >= '(' && c <= '/')
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
385 state = ISO_DOLLAR_AND_FINAL_IS_NEXT;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
386 else if (c >= '@' && c <= 'B') /* ESC $ @ etc */
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
387 {
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
388 non_ascii_p = 1;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
389 state = ISO_NOTHING;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
390 }
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
391 else
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
392 state = ISO_NOTHING;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
393 break;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
394
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
395 case ISO_FINAL_IS_NEXT:
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
396 if (prevc == '(' && c == 'B') /* ESC ( B, invoke ASCII */
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
397 non_ascii_p = 0;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
398 else if (prevc == '(' || prevc == ',') /* ESC ( x or ESC , x */
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
399 non_ascii_p = 1;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
400 state = ISO_NOTHING;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
401 break;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
402
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
403 case ISO_DOLLAR_AND_FINAL_IS_NEXT:
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
404 if (prevc == '(' || prevc == ',') /* ESC $ ( x or ESC $ , x */
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
405 non_ascii_p = 1;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
406 state = ISO_NOTHING;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
407 break;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
408 }
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
409
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
410 prevc = c;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
411 return c;
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
412 }
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
413
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
414
1111
184461bc8de4 [xemacs-hg @ 2002-11-18 06:52:23 by ben]
ben
parents: 930
diff changeset
415 char globalbuf[128];
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
416
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
417 /* Skip a C string from INFILE,
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
418 and return the character that follows the closing ".
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
419 If printflag is positive, output string contents to outfile.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
420 If it is negative, store contents in buf.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
421 Convert escape sequences \n and \t to newline and tab;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
422 discard \ followed by newline. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
423
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
424 #define MDGET do { prevc = c; c = getc_iso2022 (infile); } while (0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
425 static int
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
426 read_c_string (FILE *infile, int printflag, int c_docstring)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
427 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
428 register int prevc = 0, c = 0;
1111
184461bc8de4 [xemacs-hg @ 2002-11-18 06:52:23 by ben]
ben
parents: 930
diff changeset
429 char *p = globalbuf;
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
430 int start = -1; /* XEmacs addition */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
431
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
432 MDGET;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
433 while (c != EOF)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
434 {
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
435 while ((c_docstring || c != '"' || non_ascii_p) && c != EOF)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
436 {
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
437 /* XEmacs addition: the first two "if" clauses are new */
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
438 if (c == '*' && !non_ascii_p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
439 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
440 int cc = getc (infile);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
441 if (cc == '/')
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
442 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
443 if (prevc != '\n')
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
444 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
445 if (printflag > 0)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
446 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
447 if (ellcc)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
448 fprintf (outfile, "\\n\\");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
449 putc ('\n', outfile);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
450 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
451 else if (printflag < 0)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
452 *p++ = '\n';
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
453 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
454 break;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
455 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
456 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
457 ungetc (cc, infile);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
458 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
459
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
460 if (start == 1)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
461 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
462 if (printflag > 0)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
463 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
464 if (ellcc)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
465 fprintf (outfile, "\\n\\");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
466 putc ('\n', outfile);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
467 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
468 else if (printflag < 0)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
469 *p++ = '\n';
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
470 }
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
471 /* End XEmacs addition */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
472
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
473 if (c == '\\' && !non_ascii_p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
474 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
475 MDGET;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
476 if (c == '\n')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
477 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
478 MDGET;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
479 start = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
480 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
481 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
482 if (!c_docstring && c == 'n')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
483 c = '\n';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
484 if (c == 't')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
485 c = '\t';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
486 }
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
487
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
488 /* XEmacs change: the "if" clause is new; the "else" clause is
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
489 mostly the original FSF Emacs code */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
490 if (c == '\n')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
491 start = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
492 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
493 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
494 start = 0;
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
495 if (printflag > 0)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
496 {
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
497 if (ellcc && c == '"' && !non_ascii_p)
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
498 putc ('\\', outfile);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
499 putc (c, outfile);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
500 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
501 else if (printflag < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
502 *p++ = c;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
503 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
504 MDGET;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
505 }
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
506 /* XEmacs change: look for continuation of string */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
507 if (Current_file_type == c_file)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
508 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
509 do
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
510 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
511 MDGET;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
512 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
513 while (isspace (c));
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
514 if (c != '"' || non_ascii_p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
515 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
516 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
517 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
518 {
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
519 MDGET;
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
520 if (c != '"' || non_ascii_p)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
521 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
522 /* If we had a "", concatenate the two strings. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
523 }
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
524 MDGET;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
525 }
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
526
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
527 if (printflag < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
528 *p = 0;
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
529
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
530 return c;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
531 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
532
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
533 /* Write to file OUT the argument names of function FUNC, whose text is in BUF.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
534 MINARGS and MAXARGS are the minimum and maximum number of arguments. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
535
4665
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
536 #define SKIPWHITE do { while (isspace ((unsigned char) (*p))) p++; } while (0)
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
537
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
538 static void
2286
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1618
diff changeset
539 write_c_args (FILE *out, const char *UNUSED (func), char *buf,
04bc9d2f42c7 [xemacs-hg @ 2004-09-20 19:18:55 by james]
james
parents: 1618
diff changeset
540 int minargs, int maxargs)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
541 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
542 register char *p;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
543 int in_ident = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
544 int just_spaced = 0;
4665
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
545 int need_paren = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
546 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
547 int need_space = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
548
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
549 fprintf (out, "(%s", func);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
550 #else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
551 /* XEmacs - "arguments:" is for parsing the docstring. FSF's help system
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
552 doesn't parse the docstring for arguments like we do, so we're also
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
553 going to omit the function name to preserve compatibility with elisp
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
554 that parses the docstring. Finally, not prefixing the arglist with
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
555 anything is asking for trouble because it's not uncommon to have an
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
556 unescaped parenthesis at the beginning of a line. --Stig */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
557 fprintf (out, "arguments: (");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
558 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
559
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
560 if (*buf == '(')
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
561 ++buf;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
562
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
563 for (p = buf; *p; p++)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
564 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
565 char c = *p;
4665
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
566 #if 0
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
567 int ident_start = 0;
4665
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
568 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
569
4665
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
570 /* XEmacs addition: used for ANSI prototypes and UNUSED macros. */
2603
43ba9e13ee82 [xemacs-hg @ 2005-02-22 08:05:58 by stephent]
stephent
parents: 2421
diff changeset
571 static char uu [] = "UNUSED";
43ba9e13ee82 [xemacs-hg @ 2005-02-22 08:05:58 by stephent]
stephent
parents: 2421
diff changeset
572 static char ui [] = "USED_IF_";
4665
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
573 static char lo [] = "Lisp_Object";
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
574
4665
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
575 /* Notice when we enter or leave an identifier. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
576 if (C_IDENTIFIER_CHAR_P (c) != in_ident)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
577 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
578 if (!in_ident)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
579 {
4665
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
580 /* Entering identifier. Print as we parse. */
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
581 char *here; /* Target for backtracking. */
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
582
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
583 /* XEmacs addition: add support for ANSI prototypes and the
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
584 UNUSED macros. Hop over them. "Lisp_Object" is the only
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
585 C type allowed in DEFUNs. For the UNUSED macros we need
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
586 to eat parens, too. */
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
587 /* Aren't these all vulnerable to buffer overrun? I guess that
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
588 means that the .c is busted, so we may as well just die ... */
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
589
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
590 /* Skip over "Lisp_Object". */
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
591 if ((strncmp (p, lo, sizeof (lo) - 1) == 0) &&
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
592 isspace ((unsigned char) p[sizeof (lo) - 1]))
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
593 {
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
594 p += (sizeof (lo) - 1);
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
595 SKIPWHITE;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
596 }
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
597 /* Skip over "UNUSED" or "USED_IF_*" invocation. */
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
598 need_paren = 1;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
599 here = p;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
600 if (strncmp (p, uu, sizeof (uu) - 1) == 0)
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
601 p += (sizeof (uu) - 1);
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
602 else if (strncmp (p, ui, sizeof (ui) - 1) == 0)
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
603 p += (sizeof (ui) - 1);
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
604 else
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
605 need_paren = 0;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
606
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
607 if (need_paren)
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
608 {
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
609 /* Skip rest of macro name, open paren, whitespace. */
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
610 while (*p && C_IDENTIFIER_CHAR_P (*p))
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
611 p++;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
612 SKIPWHITE;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
613 if (*p++ == '(')
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
614 SKIPWHITE;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
615 else
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
616 {
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
617 need_paren = 0;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
618 p = here;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
619 }
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
620 }
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
621 c = *p;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
622
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
623 /* Do bookkeeping. Maybe output lambda keywords. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
624 in_ident = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
625 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
626 /* XEmacs - This goes along with the change above. */
4665
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
627 ident_start = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
628 if (need_space)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
629 putc (' ', out);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
630 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
631 if (minargs == 0 && maxargs > 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
632 fprintf (out, "&optional ");
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
633 just_spaced = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
634
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
635 minargs--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
636 maxargs--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
637 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
638 else
4665
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
639 {
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
640 /* Leaving identifier. */
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
641 in_ident = 0;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
642 if (need_paren)
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
643 {
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
644 SKIPWHITE;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
645 if (*p == ')')
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
646 p++;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
647 c = *p;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
648 need_paren = 0;
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
649 }
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
650 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
651 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
652
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
653 /* Print the C argument list as it would appear in lisp:
5076
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
654 print underscores as hyphens, and print commas, tabs and newlines
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
655 as spaces. Collapse adjacent spaces into one. */
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
656 if (c == '_')
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
657 c = '-';
5076
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
658 else if (c == ',' || c == '\n' || c == '\t')
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
659 c = ' ';
1618
1038bc1b8cb9 [xemacs-hg @ 2003-08-12 14:47:07 by james]
james
parents: 1111
diff changeset
660 /* XEmacs change: handle \n below for readability */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
661
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
662 #if 0
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
663 /* In C code, `default' is a reserved word, so we spell it
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
664 `defalt'; unmangle that here. */
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
665 if (ident_start
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
666 && strncmp (p, "defalt", 6) == 0
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
667 && ! (('A' <= p[6] && p[6] <= 'Z')
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
668 || ('a' <= p[6] && p[6] <= 'z')
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
669 || ('0' <= p[6] && p[6] <= '9')
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
670 || p[6] == '_'))
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
671 {
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
672 fprintf (out, "DEFAULT");
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
673 p += 5;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
674 in_ident = 0;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
675 just_spaced = 0;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
676 }
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
677 #endif
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
678 /* If the C argument name ends with `_', change it to ' ',
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
679 to allow use of C reserved words or global symbols as Lisp args. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
680 if (c == '-' && ! C_IDENTIFIER_CHAR_P (p[1]))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
681 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
682 in_ident = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
683 just_spaced = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
684 }
5076
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
685 #if 0
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
686 /* [[ XEmacs change: if the character is carriage return or linefeed,
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
687 escape it for the compiler ]] I doubt the clause with '\r' ever
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
688 worked right, and outputting newlines now screws up the regexp
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
689 in function-documentation-1, so don't do this; instead, we treat
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
690 newlines like spaces. --ben */
1618
1038bc1b8cb9 [xemacs-hg @ 2003-08-12 14:47:07 by james]
james
parents: 1111
diff changeset
691 else if (c == '\n')
1038bc1b8cb9 [xemacs-hg @ 2003-08-12 14:47:07 by james]
james
parents: 1111
diff changeset
692 {
1038bc1b8cb9 [xemacs-hg @ 2003-08-12 14:47:07 by james]
james
parents: 1111
diff changeset
693 putc('\\', out);
1038bc1b8cb9 [xemacs-hg @ 2003-08-12 14:47:07 by james]
james
parents: 1111
diff changeset
694 putc('\n', out);
5076
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
695 c = ' ';
1618
1038bc1b8cb9 [xemacs-hg @ 2003-08-12 14:47:07 by james]
james
parents: 1111
diff changeset
696 }
1038bc1b8cb9 [xemacs-hg @ 2003-08-12 14:47:07 by james]
james
parents: 1111
diff changeset
697 else if (c == '\r')
1038bc1b8cb9 [xemacs-hg @ 2003-08-12 14:47:07 by james]
james
parents: 1111
diff changeset
698 {
1038bc1b8cb9 [xemacs-hg @ 2003-08-12 14:47:07 by james]
james
parents: 1111
diff changeset
699 putc('\\', out);
1038bc1b8cb9 [xemacs-hg @ 2003-08-12 14:47:07 by james]
james
parents: 1111
diff changeset
700 putc('\r', out);
1038bc1b8cb9 [xemacs-hg @ 2003-08-12 14:47:07 by james]
james
parents: 1111
diff changeset
701 }
5076
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
702 #else
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
703 else if (c == '\r') /* Just eat it, since we expect a newline to
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
704 follow */
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
705 ;
d555581e3cba fix issues with display of argument docstrings
Ben Wing <ben@xemacs.org>
parents: 4665
diff changeset
706 #endif /* (not) 0 */
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
707 else if (c != ' ' || !just_spaced)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
708 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
709 if (c >= 'a' && c <= 'z')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
710 /* Upcase the letter. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
711 c += 'A' - 'a';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
712 putc (c, out);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
713 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
714
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
715 just_spaced = (c == ' ');
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
716 #if 0
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
717 need_space = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
718 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
719 }
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
720 /* XEmacs addition */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
721 if (!ellcc)
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
722 putc ('\n', out);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
723 }
4665
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
724 #undef SKIPWHITE
f3a65dff1912 Fix UNUSED and USED_IF parsing in make-docfile.c.
Stephen J. Turnbull <stephen@xemacs.org>
parents: 4539
diff changeset
725
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
726
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
727 /* Read through a c file. If a .o or .obj file is named,
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
728 the corresponding .c file is read instead.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
729 Looks for DEFUN constructs such as are defined in ../src/lisp.h.
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
730 Accepts any word starting DEF... so it finds DEFSIMPLE and DEFPRED ...
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
731 which don't exist anymore! */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
732
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
733 static int
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
734 scan_c_file (const char *filename, const char *mode)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
735 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
736 FILE *infile;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
737 register int c;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
738 register int commas;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
739 register int defunflag;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
740 register int defvarperbufferflag = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
741 register int defvarflag;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
742 int minargs, maxargs;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
743 int l = strlen (filename);
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2286
diff changeset
744 char f[QXE_PATH_MAX];
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
745
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
746 /* XEmacs change: different method for checking filename extension */
2421
ab71ad6ff3dd [xemacs-hg @ 2004-12-06 03:50:53 by ben]
ben
parents: 2286
diff changeset
747 if (l > QXE_PATH_MAX - 1)
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 442
diff changeset
748 {
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
749 #ifdef ENAMETOOLONG
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 442
diff changeset
750 errno = ENAMETOOLONG;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
751 #else
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 442
diff changeset
752 errno = EINVAL;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
753 #endif
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
754 return 0;
647
b39c14581166 [xemacs-hg @ 2001-08-13 04:45:47 by ben]
ben
parents: 442
diff changeset
755 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
756
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
757 strcpy (f, filename);
771
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
758 if (l > 4 && !strcmp (f + l - 4, ".obj")) /* MS Windows */
943eaba38521 [xemacs-hg @ 2002-03-13 08:51:24 by ben]
ben
parents: 647
diff changeset
759 strcpy (f + l - 4, ".c");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
760 if (f[l - 1] == 'o')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
761 f[l - 1] = 'c';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
762 infile = fopen (f, mode);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
763
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
764 /* No error if non-ex input file */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
765 if (infile == NULL)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
766 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
767 perror (f);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
768 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
769 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
770
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
771 #if 0
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
772 /* Reset extension to be able to detect duplicate files. */
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
773 filename[strlen (filename) - 1] = extension;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
774 #endif
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
775
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
776 c = '\n';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
777 while (!feof (infile))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
778 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
779 if (c != '\n')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
780 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
781 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
782 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
783 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
784 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
785 if (c == ' ')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
786 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
787 while (c == ' ')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
788 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
789 if (c != 'D')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
790 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
791 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
792 if (c != 'E')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
793 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
794 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
795 if (c != 'F')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
796 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
797 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
798 if (c != 'V')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
799 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
800 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
801 if (c != 'A')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
802 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
803 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
804 if (c != 'R')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
805 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
806 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
807 if (c != '_')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
808 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
809
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
810 defvarflag = 1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
811 defunflag = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
812
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
813 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
814 /* Note that this business doesn't apply under XEmacs.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
815 DEFVAR_BUFFER_LOCAL in XEmacs behaves normally. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
816 defvarperbufferflag = (c == 'P');
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
817
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
818 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
819 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
820 else if (c == 'D')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
821 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
822 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
823 if (c != 'E')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
824 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
825 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
826 if (c != 'F')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
827 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
828 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
829 defunflag = (c == 'U');
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
830 defvarflag = 0;
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
831 c = getc (infile); /* XEmacs addition */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
832 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
833 else continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
834
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
835 while (c != '(')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
836 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
837 if (c < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
838 goto eof;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
839 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
840 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
841
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
842 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
843 if (c != '"')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
844 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
845 c = read_c_string (infile, -1, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
846
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
847 if (defunflag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
848 commas = 4;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
849 else if (defvarperbufferflag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
850 commas = 2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
851 else if (defvarflag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
852 commas = 1;
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
853 else /* For DEFSIMPLE and DEFPRED ... which now don't exist! */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
854 commas = 2;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
855
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
856 while (commas)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
857 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
858 if (c == ',')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
859 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
860 commas--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
861 if (defunflag && (commas == 1 || commas == 2))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
862 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
863 do
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
864 c = getc (infile);
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
865 while (c == ' ' || c == '\n' || c == '\t');
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
866 if (c < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
867 goto eof;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
868 ungetc (c, infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
869 if (commas == 2) /* pick up minargs */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
870 fscanf (infile, "%d", &minargs);
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
871 else /* pick up maxargs */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
872 if (c == 'M' || c == 'U') /* MANY || UNEVALLED */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
873 maxargs = -1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
874 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
875 fscanf (infile, "%d", &maxargs);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
876 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
877 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
878 if (c < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
879 goto eof;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
880 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
881 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
882 while (c == ' ' || c == '\n' || c == '\t')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
883 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
884 if (c == '"')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
885 c = read_c_string (infile, 0, 0);
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
886 /* XEmacs change */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
887 if (defunflag | defvarflag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
888 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
889 while (c != '/')
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
890 {
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
891 if (c < 0)
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
892 goto eof;
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
893 if (defunflag && c == '(')
1111
184461bc8de4 [xemacs-hg @ 2002-11-18 06:52:23 by ben]
ben
parents: 930
diff changeset
894 fatal ("Missing doc string for DEFUN %s\n", globalbuf);
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
895 c = getc (infile);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
896 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
897 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
898 while (c == '*')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
899 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
900 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
901 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
902 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
903 while (c != ',')
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
904 {
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
905 if (c < 0)
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
906 goto eof;
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
907 c = getc (infile);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
908 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
909 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
910 }
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
911 /* End XEmacs change */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
912 while (c == ' ' || c == '\n' || c == '\t')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
913 c = getc (infile);
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
914 /* XEmacs addition */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
915 if (defunflag | defvarflag)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
916 ungetc (c, infile);
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
917 /* End XEmacs addition */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
918
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
919 if (defunflag || defvarflag || c == '"')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
920 {
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
921 /* XEmacs change: the original code is in the "else" clause */
3368
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
922 /* XXX Must modify the documentation file name code to handle
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
923 ELLCCs */
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
924 if (ellcc)
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
925 fprintf (outfile, " CDOC%s(\"%s\", \"\\\n",
1111
184461bc8de4 [xemacs-hg @ 2002-11-18 06:52:23 by ben]
ben
parents: 930
diff changeset
926 defvarflag ? "SYM" : "SUBR", globalbuf);
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
927 else
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
928 {
3368
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
929 put_filename (filename); /* XEmacs addition */
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
930 putc (037, outfile);
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
931 putc (defvarflag ? 'V' : 'F', outfile);
1111
184461bc8de4 [xemacs-hg @ 2002-11-18 06:52:23 by ben]
ben
parents: 930
diff changeset
932 fprintf (outfile, "%s\n", globalbuf);
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
933 }
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
934 c = read_c_string (infile, 1, defunflag || defvarflag);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
935
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
936 /* If this is a defun, find the arguments and print them. If
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
937 this function takes MANY or UNEVALLED args, then the C source
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
938 won't give the names of the arguments, so we shouldn't bother
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
939 trying to find them. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
940 if (defunflag && maxargs != -1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
941 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
942 char argbuf[1024], *p = argbuf;
2603
43ba9e13ee82 [xemacs-hg @ 2005-02-22 08:05:58 by stephent]
stephent
parents: 2421
diff changeset
943 int paren_level = 1;
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
944 #if 0 /* For old DEFUN's only */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
945 while (c != ')')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
946 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
947 if (c < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
948 goto eof;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
949 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
950 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
951 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
952 /* Skip into arguments. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
953 while (c != '(')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
954 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
955 if (c < 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
956 goto eof;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
957 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
958 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
959 /* Copy arguments into ARGBUF. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
960 *p++ = c;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
961 do
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
962 {
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
963 *p++ = c = getc (infile);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
964 if (c < 0)
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
965 goto eof;
2603
43ba9e13ee82 [xemacs-hg @ 2005-02-22 08:05:58 by stephent]
stephent
parents: 2421
diff changeset
966 /* XEmacs change: handle macros with args (eg, UNUSED) */
43ba9e13ee82 [xemacs-hg @ 2005-02-22 08:05:58 by stephent]
stephent
parents: 2421
diff changeset
967 if (c == ')')
43ba9e13ee82 [xemacs-hg @ 2005-02-22 08:05:58 by stephent]
stephent
parents: 2421
diff changeset
968 paren_level--;
43ba9e13ee82 [xemacs-hg @ 2005-02-22 08:05:58 by stephent]
stephent
parents: 2421
diff changeset
969 if (c == '(')
43ba9e13ee82 [xemacs-hg @ 2005-02-22 08:05:58 by stephent]
stephent
parents: 2421
diff changeset
970 paren_level++;
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
971 }
2603
43ba9e13ee82 [xemacs-hg @ 2005-02-22 08:05:58 by stephent]
stephent
parents: 2421
diff changeset
972 while (paren_level > 0);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
973 *p = '\0';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
974 /* Output them. */
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
975 if (ellcc)
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
976 fprintf (outfile, "\\n\\\n\\n\\\n");
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
977 else
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
978 fprintf (outfile, "\n\n");
1111
184461bc8de4 [xemacs-hg @ 2002-11-18 06:52:23 by ben]
ben
parents: 930
diff changeset
979 write_c_args (outfile, globalbuf, argbuf, minargs, maxargs);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
980 }
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
981 if (ellcc)
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
982 fprintf (outfile, "\\n\");\n\n");
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
983 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
984 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
985 eof:
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
986 fclose (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
987 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
988 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
989
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
990 /* Read a file of Lisp code, compiled or interpreted.
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
991 Looks for
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
992 (defun NAME ARGS DOCSTRING ...)
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
993 (defmacro NAME ARGS DOCSTRING ...)
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
994 (defsubst NAME ARGS DOCSTRING ...)
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
995 (autoload (quote NAME) FILE DOCSTRING ...)
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
996 (defvar NAME VALUE DOCSTRING)
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
997 (defconst NAME VALUE DOCSTRING)
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
998 (fset (quote NAME) (make-byte-code ... DOCSTRING ...))
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
999 (fset (quote NAME) #[... DOCSTRING ...])
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1000 (defalias (quote NAME) #[... DOCSTRING ...])
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1001 (custom-declare-variable (quote NAME) VALUE DOCSTRING ...)
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1002 starting in column zero.
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1003 (quote NAME) may appear as 'NAME as well.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1004
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1005 We also look for #@LENGTH CONTENTS^_ at the beginning of the line.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1006 When we find that, we save it for the following defining-form,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1007 and we use that instead of reading a doc string within that defining-form.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1008
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1009 For defvar, defconst, and fset we skip to the docstring with a kludgy
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1010 formatting convention: all docstrings must appear on the same line as the
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1011 initial open-paren (the one in column zero) and must contain a backslash
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1012 and a newline immediately after the initial double-quote. No newlines
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1013 must appear between the beginning of the form and the first double-quote.
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1014 For defun, defmacro, and autoload, we know how to skip over the
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1015 arglist, but the doc string must still have a backslash and newline
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1016 immediately after the double quote.
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1017 The only source files that must follow this convention are preloaded
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1018 uncompiled ones like loaddefs.el and bindings.el; aside
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1019 from that, it is always the .elc file that we look at, and they are no
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1020 problem because byte-compiler output follows this convention.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1021 The NAME and DOCSTRING are output.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1022 NAME is preceded by `F' for a function or `V' for a variable.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1023 An entry is output only if DOCSTRING has \ newline just after the opening "
3368
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
1024
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
1025 Adds the filename a symbol or function was found in before its docstring;
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
1026 there's no need for this with the load-history available, but we do it for
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
1027 consistency with the C parsing code.
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1028 */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1029
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1030 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1031 skip_white (FILE *infile)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1032 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1033 char c = ' ';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1034 while (c == ' ' || c == '\t' || c == '\n')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1035 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1036 ungetc (c, infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1037 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1038
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1039 static void
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1040 read_lisp_symbol (FILE *infile, char *buffer)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1041 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1042 char c;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1043 char *fillp = buffer;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1044
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1045 skip_white (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1046 while (1)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1047 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1048 c = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1049 if (c == '\\')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1050 /* FSF has *(++fillp), which is wrong. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1051 *fillp++ = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1052 else if (c == ' ' || c == '\t' || c == '\n' || c == '(' || c == ')')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1053 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1054 ungetc (c, infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1055 *fillp = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1056 break;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1057 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1058 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1059 *fillp++ = c;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1060 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1061
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1062 if (! buffer[0])
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1063 fprintf (stderr, "## expected a symbol, got '%c'\n", c);
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1064
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1065 skip_white (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1066 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1067
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1068 static int
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents: 440
diff changeset
1069 scan_lisp_file (const char *filename, const char *mode)
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1070 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1071 FILE *infile;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1072 register int c;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1073 char *saved_string = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1074
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1075 infile = fopen (filename, mode);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1076 if (infile == NULL)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1077 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1078 perror (filename);
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1079 return 0; /* No error */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1080 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1081
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1082 c = '\n';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1083 while (!feof (infile))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1084 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1085 char buffer[BUFSIZ];
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1086 char type;
5206
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1087 int no_docstring = 0;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1088
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1089 /* If not at end of line, skip till we get to one. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1090 if (c != '\n')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1091 {
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1092 c = getc_skipping_iso2022 (infile);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1093 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1094 }
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1095 /* Skip the line break. */
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1096 while (c == '\n')
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1097 c = getc_skipping_iso2022 (infile);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1098 /* Detect a dynamic doc string and save it for the next expression. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1099 if (c == '#')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1100 {
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1101 c = getc_skipping_iso2022 (infile);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1102 if (c == '@')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1103 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1104 int length = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1105 int i;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1106
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1107 /* Read the length. */
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1108 while ((c = getc_skipping_iso2022 (infile),
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1109 c >= '0' && c <= '9'))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1110 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1111 length *= 10;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1112 length += c - '0';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1113 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1114
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1115 /* The next character is a space that is counted in the length
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1116 but not part of the doc string.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1117 We already read it, so just ignore it. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1118 length--;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1119
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1120 /* Read in the contents. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1121 if (saved_string != 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1122 free (saved_string);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1123 saved_string = (char *) xmalloc (length);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1124 for (i = 0; i < length; i++)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1125 saved_string[i] = getc (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1126 /* The last character is a ^_.
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1127 That is needed in the .elc file
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1128 but it is redundant in DOC. So get rid of it here. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1129 saved_string[length - 1] = 0;
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1130 /* Skip the line break. */
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1131 while (c == '\n')
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1132 c = getc_skipping_iso2022 (infile);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1133 /* Skip the following line. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1134 while (c != '\n')
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1135 c = getc_skipping_iso2022 (infile);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1136 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1137 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1138 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1139
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1140 if (c != '(')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1141 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1142
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1143 read_lisp_symbol (infile, buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1144
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1145 if (! strcmp (buffer, "defun")
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1146 || ! strcmp (buffer, "defmacro")
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1147 || ! strcmp (buffer, "defsubst"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1148 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1149 type = 'F';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1150 read_lisp_symbol (infile, buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1151
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1152 /* Skip the arguments: either "nil" or a list in parens */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1153
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1154 c = getc_skipping_iso2022 (infile);
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1155 if (c == 'n') /* nil */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1156 {
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1157 if ((c = getc_skipping_iso2022 (infile)) != 'i' ||
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1158 (c = getc_skipping_iso2022 (infile)) != 'l')
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1159 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1160 fprintf (stderr, "## unparsable arglist in %s (%s)\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1161 buffer, filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1162 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1163 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1164 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1165 else if (c != '(')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1166 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1167 fprintf (stderr, "## unparsable arglist in %s (%s)\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1168 buffer, filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1169 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1170 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1171 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1172 while (c != ')')
853
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
1173 {
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
1174 c = getc_skipping_iso2022 (infile);
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
1175 if (c < 0)
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
1176 continue;
2b6fa2618f76 [xemacs-hg @ 2002-05-28 08:44:22 by ben]
ben
parents: 814
diff changeset
1177 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1178 skip_white (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1179
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1180 /* If the next three characters aren't `dquote bslash newline'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1181 then we're not reading a docstring.
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1182 */
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1183 if ((c = getc_skipping_iso2022 (infile)) != '"' ||
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1184 (c = getc_skipping_iso2022 (infile)) != '\\' ||
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1185 (c = getc_skipping_iso2022 (infile)) != '\n')
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1186 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1187 #ifdef DEBUG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1188 fprintf (stderr, "## non-docstring in %s (%s)\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1189 buffer, filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1190 #endif
5206
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1191 no_docstring = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1192 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1193 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1194
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1195 else if (! strcmp (buffer, "defvar")
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1196 || ! strcmp (buffer, "defconst"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1197 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1198 char c1 = 0, c2 = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1199 type = 'V';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1200 read_lisp_symbol (infile, buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1201
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1202 if (saved_string == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1203 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1204
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1205 /* Skip until the end of line; remember two previous chars. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1206 while (c != '\n' && c >= 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1207 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1208 c2 = c1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1209 c1 = c;
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1210 c = getc_skipping_iso2022 (infile);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1211 }
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1212
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1213 /* If two previous characters were " and \,
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1214 this is a doc string. Otherwise, there is none. */
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1215 if (c2 != '"' || c1 != '\\')
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1216 {
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1217 #ifdef DEBUG
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1218 fprintf (stderr, "## non-docstring in %s (%s)\n",
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1219 buffer, filename);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1220 #endif
5206
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1221 no_docstring = 1;
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1222 }
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1223 }
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1224 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1225
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1226 else if (! strcmp (buffer, "custom-declare-variable"))
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1227 {
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1228 char c1 = 0, c2 = 0;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1229 type = 'V';
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1230
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1231 c = getc (infile);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1232 if (c == '\'')
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1233 read_lisp_symbol (infile, buffer);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1234 else
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1235 {
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1236 if (c != '(')
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1237 {
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1238 fprintf (stderr,
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1239 "## unparsable name in custom-declare-variable in %s\n",
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1240 filename);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1241 continue;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1242 }
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1243 read_lisp_symbol (infile, buffer);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1244 if (strcmp (buffer, "quote"))
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1245 {
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1246 fprintf (stderr,
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1247 "## unparsable name in custom-declare-variable in %s\n",
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1248 filename);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1249 continue;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1250 }
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1251 read_lisp_symbol (infile, buffer);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1252 c = getc (infile);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1253 if (c != ')')
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1254 {
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1255 fprintf (stderr,
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1256 "## unparsable quoted name in custom-declare-variable in %s\n",
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1257 filename);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1258 continue;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1259 }
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1260 }
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1261
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1262 if (saved_string == 0)
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1263 {
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1264 /* Skip to end of line; remember the two previous chars. */
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1265 while (c != '\n' && c >= 0)
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1266 {
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1267 c2 = c1;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1268 c1 = c;
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1269 c = getc_skipping_iso2022 (infile);
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1270 }
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1271
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1272 /* If two previous characters were " and \,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1273 this is a doc string. Otherwise, there is none. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1274 if (c2 != '"' || c1 != '\\')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1275 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1276 #ifdef DEBUG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1277 fprintf (stderr, "## non-docstring in %s (%s)\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1278 buffer, filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1279 #endif
5206
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1280 no_docstring = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1281 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1282 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1283 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1284
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1285 else if (! strcmp (buffer, "fset") || ! strcmp (buffer, "defalias"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1286 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1287 char c1 = 0, c2 = 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1288 type = 'F';
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1289
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1290 c = getc_skipping_iso2022 (infile);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1291 if (c == '\'')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1292 read_lisp_symbol (infile, buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1293 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1294 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1295 if (c != '(')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1296 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1297 fprintf (stderr, "## unparsable name in fset in %s\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1298 filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1299 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1300 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1301 read_lisp_symbol (infile, buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1302 if (strcmp (buffer, "quote"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1303 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1304 fprintf (stderr, "## unparsable name in fset in %s\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1305 filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1306 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1307 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1308 read_lisp_symbol (infile, buffer);
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1309 c = getc_skipping_iso2022 (infile);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1310 if (c != ')')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1311 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1312 fprintf (stderr,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1313 "## unparsable quoted name in fset in %s\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1314 filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1315 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1316 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1317 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1318
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1319 if (saved_string == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1320 {
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1321 /* Skip to end of line; remember the two previous chars. */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1322 while (c != '\n' && c >= 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1323 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1324 c2 = c1;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1325 c1 = c;
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1326 c = getc_skipping_iso2022 (infile);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1327 }
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1328
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1329 /* If two previous characters were " and \,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1330 this is a doc string. Otherwise, there is none. */
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1331 if (c2 != '"' || c1 != '\\')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1332 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1333 #ifdef DEBUG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1334 fprintf (stderr, "## non-docstring in %s (%s)\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1335 buffer, filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1336 #endif
5206
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1337 no_docstring = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1338 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1339 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1340 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1341
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1342 else if (! strcmp (buffer, "autoload"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1343 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1344 type = 'F';
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1345 c = getc_skipping_iso2022 (infile);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1346 if (c == '\'')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1347 read_lisp_symbol (infile, buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1348 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1349 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1350 if (c != '(')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1351 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1352 fprintf (stderr, "## unparsable name in autoload in %s\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1353 filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1354 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1355 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1356 read_lisp_symbol (infile, buffer);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1357 if (strcmp (buffer, "quote"))
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1358 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1359 fprintf (stderr, "## unparsable name in autoload in %s\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1360 filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1361 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1362 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1363 read_lisp_symbol (infile, buffer);
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1364 c = getc_skipping_iso2022 (infile);
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1365 if (c != ')')
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1366 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1367 fprintf (stderr,
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1368 "## unparsable quoted name in autoload in %s\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1369 filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1370 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1371 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1372 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1373 skip_white (infile);
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1374 if ((c = getc_skipping_iso2022 (infile)) != '\"')
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1375 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1376 fprintf (stderr, "## autoload of %s unparsable (%s)\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1377 buffer, filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1378 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1379 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1380 read_c_string (infile, 0, 0);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1381 skip_white (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1382
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1383 if (saved_string == 0)
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1384 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1385 /* If the next three characters aren't `dquote bslash newline'
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1386 then we're not reading a docstring. */
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1387 if ((c = getc_skipping_iso2022 (infile)) != '"' ||
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1388 (c = getc_skipping_iso2022 (infile)) != '\\' ||
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1389 (c = getc_skipping_iso2022 (infile)) != '\n')
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1390 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1391 #ifdef DEBUG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1392 fprintf (stderr, "## non-docstring in %s (%s)\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1393 buffer, filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1394 #endif
5206
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1395 no_docstring = 1;
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1396 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1397 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1398 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1399
814
a634e3b7acc8 [xemacs-hg @ 2002-04-14 12:41:59 by ben]
ben
parents: 771
diff changeset
1400 #if 0 /* causes crash */
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1401 else if (! strcmp (buffer, "if")
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1402 || ! strcmp (buffer, "byte-code"))
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1403 ;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1404 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1405
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1406 else
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1407 {
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1408 #ifdef DEBUG
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1409 fprintf (stderr, "## unrecognized top-level form, %s (%s)\n",
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1410 buffer, filename);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1411 #endif
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1412 continue;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1413 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1414
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1415 /* At this point, we should either use the previous
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1416 dynamic doc string in saved_string
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1417 or gobble a doc string from the input file.
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1418
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1419 In the latter case, the opening quote (and leading
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1420 backslash-newline) have already been read. */
930
eaedf30d9d76 [xemacs-hg @ 2002-07-23 08:34:59 by youngs]
youngs
parents: 853
diff changeset
1421
3368
959746c534f6 [xemacs-hg @ 2006-04-29 16:15:21 by aidan]
aidan
parents: 2603
diff changeset
1422 put_filename (filename); /* XEmacs addition */
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1423 putc (037, outfile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1424 putc (type, outfile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1425 fprintf (outfile, "%s\n", buffer);
5206
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1426 if (!no_docstring)
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1427 {
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1428 if (saved_string)
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1429 {
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1430 fputs (saved_string, outfile);
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1431 /* Don't use one dynamic doc string twice. */
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1432 free (saved_string);
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1433 saved_string = 0;
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1434 }
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1435 else
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1436 read_c_string (infile, 1, 0);
39d74978fd32 Keep around file info for dumped functions and variables without docstrings.
Aidan Kehoe <kehoea@parhasard.net>
parents: 5076
diff changeset
1437 }
428
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1438 }
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1439 fclose (infile);
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1440 return 0;
3ecd8885ac67 Import from CVS: tag r21-2-22
cvs
parents:
diff changeset
1441 }