summaryrefslogtreecommitdiff
path: root/lib-src
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2012-05-29 23:59:42 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2012-05-29 23:59:42 -0400
commit61b108cc62d69c96c20b9e23b248185591563c1f (patch)
treee07c24a1ec29b567b1f2de381e486f83a5da6211 /lib-src
parent934f3f582d0369e95c6495748e3944405d3629b8 (diff)
downloademacs-61b108cc62d69c96c20b9e23b248185591563c1f.tar.gz
emacs-61b108cc62d69c96c20b9e23b248185591563c1f.tar.bz2
emacs-61b108cc62d69c96c20b9e23b248185591563c1f.zip
* lisp/emacs-lisp/byte-run.el (defmacro, defun): Move from C.
(macro-declaration-function): Move var from C code. (macro-declaration-function): Define function with defalias. * lisp/emacs-lisp/macroexp.el (macroexpand-all-1): * lisp/emacs-lisp/cconv.el (cconv-convert, cconv-analyse-form): * lisp/emacs-lisp/byte-opt.el (byte-optimize-form-code-walker): Don't handle defun/defmacro any more. * lisp/emacs-lisp/bytecomp.el (byte-compile-arglist-signature): Provide fallback for unknown arglist. (byte-compile-arglist-warn): Change calling convention. (byte-compile-output-file-form): Move print-vars binding. (byte-compile-output-docform): Simplify accordingly. (byte-compile-file-form-defun, byte-compile-file-form-defmacro) (byte-compile-defmacro-declaration): Remove. (byte-compile-file-form-defmumble): Generalize to defalias. (byte-compile-output-as-comment): Return byte-positions. Simplify callers accordingly. (byte-compile-lambda): Use `assert'. (byte-compile-defun, byte-compile-defmacro): Remove. (byte-compile-file-form-defalias): Use byte-compile-file-form-defmumble. (byte-compile-defalias-warn): Remove. * src/eval.c (Fdefun, Fdefmacro, Vmacro_declaration_function): Move to byte-run.el. (Fautoload): Do the hash-doc more carefully. * src/data.c (Fdefalias): Purify definition, except for keymaps. (Qdefun): Move from eval.c. * src/lisp.h (Qdefun): Remove. * src/lread.c (read1): Tiny simplification. * lib-src/make-docfile.c: Improve comment style. (search_lisp_doc_at_eol): New function. (scan_lisp_file): Use it.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog48
-rw-r--r--lib-src/make-docfile.c153
2 files changed, 80 insertions, 121 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 7dc02ccaa95..d95137852e0 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,9 @@
+2012-05-30 Stefan Monnier <monnier@iro.umontreal.ca>
+
+ * make-docfile.c: Improve comment style.
+ (search_lisp_doc_at_eol): New function.
+ (scan_lisp_file): Use it.
+
2012-05-26 Glenn Morris <rgm@gnu.org>
* Makefile.in (INSTALL_DATA): Remove; unused.
@@ -441,8 +447,8 @@
* etags.c (canonicalize_filename, ISUPPER): Fix last change.
- * makefile.w32-in ($(BLD)/ebrowse.$(O), $(BLD)/pop.$(O)): Depend
- on ../lib/min-max.h.
+ * makefile.w32-in ($(BLD)/ebrowse.$(O), $(BLD)/pop.$(O)):
+ Depend on ../lib/min-max.h.
2011-02-22 Paul Eggert <eggert@cs.ucla.edu>
@@ -2819,7 +2825,7 @@
* make-docfile.c (read_c_string_or_comment): Declare msgno.
- * Makefile.in (YACC): Deleted.
+ * Makefile.in (YACC): Delete.
2002-10-19 Andreas Schwab <schwab@suse.de>
@@ -3037,7 +3043,7 @@
(TeX_commands): Names now include the initial backslash.
(TeX_commands): Names do not include numeric args #n.
(TeX_commands): Correct line char number in tags.
- (TEX_tabent, TEX_token): Deleted.
+ (TEX_tabent, TEX_token): Delete.
(TeX_commands, TEX_decode_env): Streamlined.
2002-06-05 Francesco Potortì <pot@gnu.org>
@@ -3078,7 +3084,7 @@
(main): New argument -d, for specifying directory.
(usage): Document.
(get_user_id): Compute.
- (get_home_dir): Deleted.
+ (get_home_dir): Delete.
(get_prefix): New function, taken from main.
(main): Check whether or not we are running setuid. Move prefix
computation to get_prefix. Don't call getpwent; we don't need to
@@ -3339,7 +3345,7 @@
(LOOKING_AT, get_tag, PHP_functions): Use notinname.
(Ada_getit, Ada_funcs, Python_functions, Scheme_functions):
Clarified, using strneq or notinname.
- (L_isdef, L_isquote): Removed.
+ (L_isdef, L_isquote): Remove.
(Lisp_functions, L_getit): Clarified.
* etags.c (P_): Rename to __P for consistency with config.h.
@@ -3776,7 +3782,7 @@
comma when --declarations is used.
(C_entries): More accurate tagging of members and declarations.
(yacc_rules): Was global, made local to C_entries.
- (next_token_is_func): Removed.
+ (next_token_is_func): Remove.
(fvdef): New constants fdefunkey, fdefunname.
(consider_token, C_entries): Use them.
(C_entries): Build proper lisp names for Emacs DEFUNs.
@@ -4252,7 +4258,7 @@
(find_entries, takeprec, getit, Fortran_functions, Perl_functions)
(Python_functions, L_getit, Lisp_functions, Scheme_functions)
(prolog_pred, erlanf_func, erlang_attribute): Use them.
- (eat_white): Deleted.
+ (eat_white): Delete.
* etags.c (CHAR, init): Keep into account non US-ASCII
characters and compilers with default signed chars.
@@ -4775,7 +4781,7 @@
1997-05-13 Francesco Potortì <F.Potorti@cnuce.cnr.it>
* etags.c (TeX_functions): Cleaned up.
- (tex_getit): Removed.
+ (tex_getit): Remove.
1997-05-13 Paul Eggert <eggert@twinsun.com>
@@ -5296,7 +5302,7 @@
* etags.c: Prolog language totally rewritten.
(Prolog_functions): Rewritten from scratch.
- (skip_comment, prolog_getit): Removed.
+ (skip_comment, prolog_getit): Remove.
(prolog_skip_comment): New function, like old skip_comment.
(prolog_pred, prolog_atom, prolog_white): New functions.
(erlang_func, erlang_attributes): Forward declarations added.
@@ -5797,7 +5803,7 @@
1995-01-12 Francesco Potortì (pot@cnuce.cnr.it)
- * etags.c (FILEPOS, GET_CHARNO, GET_FILEPOS, max, LINENO): Deleted.
+ * etags.c (FILEPOS, GET_CHARNO, GET_FILEPOS, max, LINENO): Delete.
(append_to_tagfile, typedefs, typedefs_and_cplusplus)
(constantypedefs, update, vgrind_style, no_warnings)
(cxref_style, cplusplus, noindentypedefs): Were int, now logical.
@@ -5816,9 +5822,9 @@
(consider_token): Don't take a token as argument. Use savenstr
when saving a tag in structtag. Callers changed.
(TOKEN): Structure changed. Now used only in C_entries.
- (TOKEN_SAVED_P, SAVE_TOKEN, RESTORE_TOKEN): Deleted.
+ (TOKEN_SAVED_P, SAVE_TOKEN, RESTORE_TOKEN): Delete.
(C_entries): nameb and savenameb deleted. Use dinamic allocation.
- (pfcnt): Deleted. Users updated.
+ (pfcnt): Delete. Users updated.
(getit, Asm_labels, Pascal_functions, L_getit, get_scheme)
(TEX_getit, prolog_getit): Use dinamic allocation for storing
the tag instead of a fixed size buffer.
@@ -6394,7 +6400,7 @@
1994-03-25 Francesco Potortì (pot@cnuce.cnr.it)
- * etags.c (emacs_tags_format, ETAGS): Removed. Use CTAGS instead.
+ * etags.c (emacs_tags_format, ETAGS): Remove. Use CTAGS instead.
(main): Don't allow the use of -t and -T in etags mode.
(print_help): Don't show options enabled by default.
(print_version): Show the emacs version number if VERSION is #defined.
@@ -6511,9 +6517,9 @@
1994-01-14 Francesco Potortì (pot@cnuce.cnr.it)
* etags.c (stab_entry, stab_create, stab_find, stab_search,
- stab_type, add_keyword, C_reate_stab, C_create_stabs): Deleted.
+ stab_type, add_keyword, C_reate_stab, C_create_stabs): Delete.
Use gperf generated hash table instead of linked list.
- (C_stab_entry, hash, in_word_set, get_C_stab, C_symtype): Added.
+ (C_stab_entry, hash, in_word_set, get_C_stab, C_symtype): Add.
Mostly code generated by gperf.
(consider_token): Remove unused parameter `lp'.
(PF_funcs, getit): Allow subroutine and similar declarations
@@ -6832,7 +6838,7 @@
* etags.c (consider_token): Was `==', now is `='.
(consider_token): DEFUNs now treated like funcs in ctags mode.
- * etags.c (LEVEL_OK_FOR_FUNCDEF): Removed.
+ * etags.c (LEVEL_OK_FOR_FUNCDEF): Remove.
(C_entries): Optimized the test that used LEVEL_OK_FOR_FUNCDEF.
(C_entries): Remove a piece of useless code.
(C_entries): Making typedef tags is delayed until a semicolon
@@ -7131,10 +7137,10 @@
* etags.c (GET_COOKIE): And related macros removed.
(logical): Is now int, no more a char.
(reg): Define deleted.
- (isgood, _gd, notgd): Deleted.
- (gotone): Deleted.
+ (isgood, _gd, notgd): Delete.
+ (gotone): Delete.
(TOKEN): Member linestart removed.
- (linepos, prev_linepos, lb1): Deleted.
+ (linepos, prev_linepos, lb1): Delete.
(main): Call initbuffer on lbs array instead of lb1.
(init): Remove the initialization of the logical _gd array.
(find_entries): A .sa suffix means assembler file.
@@ -7142,7 +7148,7 @@
All C state machines rewritten.
(C_entries): Complete rewrite.
(condider_token): Complete rewrite.
- (getline): Deleted.
+ (getline): Delete.
1993-03-01 Francesco Potortì (pot@fly.CNUCE.CNR.IT)
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index b33b13f34ce..1314a7b6829 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -35,7 +35,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#include <config.h>
-/* defined to be emacs_main, sys_fopen, etc. in config.h */
+/* Defined to be emacs_main, sys_fopen, etc. in config.h. */
#undef main
#undef fopen
#undef chdir
@@ -66,7 +66,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
#define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
#endif
-/* Use this to suppress gcc's `...may be used before initialized' warnings. */
+/* Use this to suppress gcc's `...may be used before initialized' warnings. */
#ifdef lint
# define IF_LINT(Code) Code
#else
@@ -226,7 +226,7 @@ put_filename (char *filename)
for (tmp = filename; *tmp; tmp++)
{
- if (IS_DIRECTORY_SEP(*tmp))
+ if (IS_DIRECTORY_SEP (*tmp))
filename = tmp + 1;
}
@@ -675,14 +675,14 @@ scan_c_file (char *filename, const char *mode)
if (infile == NULL && extension == 'o')
{
- /* try .m */
+ /* Try .m. */
filename[strlen (filename) - 1] = 'm';
infile = fopen (filename, mode);
if (infile == NULL)
- filename[strlen (filename) - 1] = 'c'; /* don't confuse people */
+ filename[strlen (filename) - 1] = 'c'; /* Don't confuse people. */
}
- /* No error if non-ex input file */
+ /* No error if non-ex input file. */
if (infile == NULL)
{
perror (filename);
@@ -800,8 +800,8 @@ scan_c_file (char *filename, const char *mode)
input_buffer[i++] = c;
c = getc (infile);
}
- while (! (c == ',' || c == ' ' || c == '\t' ||
- c == '\n' || c == '\r'));
+ while (! (c == ',' || c == ' ' || c == '\t'
+ || c == '\n' || c == '\r'));
input_buffer[i] = '\0';
name = xmalloc (i + 1);
@@ -820,7 +820,7 @@ scan_c_file (char *filename, const char *mode)
commas = 3;
else if (defvarflag)
commas = 1;
- else /* For DEFSIMPLE and DEFPRED */
+ else /* For DEFSIMPLE and DEFPRED. */
commas = 2;
while (commas)
@@ -838,9 +838,9 @@ scan_c_file (char *filename, const char *mode)
if (c < 0)
goto eof;
ungetc (c, infile);
- if (commas == 2) /* pick up minargs */
+ if (commas == 2) /* Pick up minargs. */
scanned = fscanf (infile, "%d", &minargs);
- else /* pick up maxargs */
+ else /* Pick up maxargs. */
if (c == 'M' || c == 'U') /* MANY || UNEVALLED */
maxargs = -1;
else
@@ -893,7 +893,7 @@ scan_c_file (char *filename, const char *mode)
fprintf (outfile, "%s\n", input_buffer);
if (comment)
- getc (infile); /* Skip past `*' */
+ getc (infile); /* Skip past `*'. */
c = read_c_string_or_comment (infile, 1, comment, &saw_usage);
/* If this is a defun, find the arguments and print them. If
@@ -979,7 +979,7 @@ scan_c_file (char *filename, const char *mode)
problem because byte-compiler output follows this convention.
The NAME and DOCSTRING are output.
NAME is preceded by `F' for a function or `V' for a variable.
- An entry is output only if DOCSTRING has \ newline just after the opening "
+ An entry is output only if DOCSTRING has \ newline just after the opening ".
*/
static void
@@ -1020,6 +1020,32 @@ read_lisp_symbol (FILE *infile, char *buffer)
}
static int
+search_lisp_doc_at_eol (FILE *infile)
+{
+ char c = 0, c1 = 0, c2 = 0;
+
+ /* Skip until the end of line; remember two previous chars. */
+ while (c != '\n' && c != '\r' && c >= 0)
+ {
+ c2 = c1;
+ c1 = c;
+ c = getc (infile);
+ }
+
+ /* If two previous characters were " and \,
+ this is a doc string. Otherwise, there is none. */
+ if (c2 != '"' || c1 != '\\')
+ {
+#ifdef DEBUG
+ fprintf (stderr, "## non-docstring in %s (%s)\n",
+ buffer, filename);
+#endif
+ return 0;
+ }
+ return 1;
+}
+
+static int
scan_lisp_file (const char *filename, const char *mode)
{
FILE *infile;
@@ -1033,7 +1059,7 @@ scan_lisp_file (const char *filename, const char *mode)
if (infile == NULL)
{
perror (filename);
- return 0; /* No error */
+ return 0; /* No error. */
}
c = '\n';
@@ -1110,7 +1136,7 @@ scan_lisp_file (const char *filename, const char *mode)
type = 'F';
read_lisp_symbol (infile, buffer);
- /* Skip the arguments: either "nil" or a list in parens */
+ /* Skip the arguments: either "nil" or a list in parens. */
c = getc (infile);
if (c == 'n') /* nil */
@@ -1154,39 +1180,18 @@ scan_lisp_file (const char *filename, const char *mode)
|| ! strcmp (buffer, "defconst")
|| ! strcmp (buffer, "defcustom"))
{
- char c1 = 0, c2 = 0;
type = 'V';
read_lisp_symbol (infile, buffer);
if (saved_string == 0)
- {
-
- /* Skip until the end of line; remember two previous chars. */
- while (c != '\n' && c != '\r' && c >= 0)
- {
- c2 = c1;
- c1 = c;
- c = getc (infile);
- }
-
- /* If two previous characters were " and \,
- this is a doc string. Otherwise, there is none. */
- if (c2 != '"' || c1 != '\\')
- {
-#ifdef DEBUG
- fprintf (stderr, "## non-docstring in %s (%s)\n",
- buffer, filename);
-#endif
- continue;
- }
- }
+ if (!search_lisp_doc_at_eol (infile))
+ continue;
}
else if (! strcmp (buffer, "custom-declare-variable")
|| ! strcmp (buffer, "defvaralias")
)
{
- char c1 = 0, c2 = 0;
type = 'V';
c = getc (infile);
@@ -1221,31 +1226,12 @@ scan_lisp_file (const char *filename, const char *mode)
}
if (saved_string == 0)
- {
- /* Skip to end of line; remember the two previous chars. */
- while (c != '\n' && c != '\r' && c >= 0)
- {
- c2 = c1;
- c1 = c;
- c = getc (infile);
- }
-
- /* If two previous characters were " and \,
- this is a doc string. Otherwise, there is none. */
- if (c2 != '"' || c1 != '\\')
- {
-#ifdef DEBUG
- fprintf (stderr, "## non-docstring in %s (%s)\n",
- buffer, filename);
-#endif
- continue;
- }
- }
+ if (!search_lisp_doc_at_eol (infile))
+ continue;
}
else if (! strcmp (buffer, "fset") || ! strcmp (buffer, "defalias"))
{
- char c1 = 0, c2 = 0;
type = 'F';
c = getc (infile);
@@ -1278,26 +1264,8 @@ scan_lisp_file (const char *filename, const char *mode)
}
if (saved_string == 0)
- {
- /* Skip to end of line; remember the two previous chars. */
- while (c != '\n' && c != '\r' && c >= 0)
- {
- c2 = c1;
- c1 = c;
- c = getc (infile);
- }
-
- /* If two previous characters were " and \,
- this is a doc string. Otherwise, there is none. */
- if (c2 != '"' || c1 != '\\')
- {
-#ifdef DEBUG
- fprintf (stderr, "## non-docstring in %s (%s)\n",
- buffer, filename);
-#endif
- continue;
- }
- }
+ if (!search_lisp_doc_at_eol (infile))
+ continue;
}
else if (! strcmp (buffer, "autoload"))
@@ -1339,23 +1307,10 @@ scan_lisp_file (const char *filename, const char *mode)
continue;
}
read_c_string_or_comment (infile, 0, 0, 0);
- skip_white (infile);
if (saved_string == 0)
- {
- /* If the next three characters aren't `dquote bslash newline'
- then we're not reading a docstring. */
- if ((c = getc (infile)) != '"'
- || (c = getc (infile)) != '\\'
- || ((c = getc (infile)) != '\n' && c != '\r'))
- {
-#ifdef DEBUG
- fprintf (stderr, "## non-docstring in %s (%s)\n",
- buffer, filename);
-#endif
- continue;
- }
- }
+ if (!search_lisp_doc_at_eol (infile))
+ continue;
}
#ifdef DEBUG
@@ -1373,12 +1328,10 @@ scan_lisp_file (const char *filename, const char *mode)
continue;
}
- /* At this point, we should either use the previous
- dynamic doc string in saved_string
- or gobble a doc string from the input file.
-
- In the latter case, the opening quote (and leading
- backslash-newline) have already been read. */
+ /* At this point, we should either use the previous dynamic doc string in
+ saved_string or gobble a doc string from the input file.
+ In the latter case, the opening quote (and leading backslash-newline)
+ have already been read. */
putc (037, outfile);
putc (type, outfile);