# HG changeset patch # User Roland McGrath # Date 682479434 0 # Node ID 24b63d6679b6d3eb1adba4e6af19a057baeecb25 # Parent 10994e9105913611c3283c491f4a817e63c1ca66 *** empty log message *** diff -r 10994e910591 -r 24b63d6679b6 lib-src/etags.c --- a/lib-src/etags.c Sun Aug 18 01:05:27 1991 +0000 +++ b/lib-src/etags.c Sun Aug 18 01:37:14 1991 +0000 @@ -31,6 +31,16 @@ #include #include +#ifdef __GNUC__ +#define alloca __builtin_alloca +#else +#ifdef sparc +#include +#else +extern char *alloca (); +#endif +#endif + extern char *malloc (), *realloc (); extern char *getenv (); extern char *index (), *rindex (); @@ -444,8 +454,6 @@ int cxref_style; /* -x: create cxref style output */ int cplusplus; /* .[hc] means C++, not C */ int noindentypedefs; /* -S: ignore indentation in C */ -int files_are_tag_tables; /* -i: treat all spec'd files as */ - /* included sub-tag-tables. */ /* Name this program was invoked with. */ char *progname; @@ -480,6 +488,8 @@ char cmd[100]; int i; int outfflag = 0; + unsigned int nincluded_files = 0; + char **included_files = (char *) alloca (argc * sizeof (char *)); char *this_file; #ifdef VMS char got_err; @@ -553,10 +563,19 @@ /* Etags options */ case 'i': - files_are_tag_tables++; if (!emacs_tags_format) goto usage; - break; + --argc; + ++argv; + if (argc <= 1 || argv[1][0] == '\0') + { + fprintf (stderr, + "%s: -i flag must be followed by a filename\n", + progname); + goto usage; + } + included_files[nincluded_files++] = argv[1]; + goto next_arg; /* Ctags options. */ case 'B': @@ -675,6 +694,9 @@ if (emacs_tags_format) { + while (nincluded_files-- > 0) + fprintf (outf, "\f\n%s,include\n", *included_files++); + (void) fclose (outf); exit (0); } @@ -733,11 +755,6 @@ fprintf (stderr, "Skipping inclusion of %s in self.\n", file); return; } - if (files_are_tag_tables) - { - fprintf (outf, "\f\n%s,include\n", file); - return; - } if (emacs_tags_format) { char *cp = rindex (file, '/'); @@ -745,11 +762,6 @@ ++cp; else cp = file; - if (streq (cp, outfile)) /*file == "TAGS"*/ - { - fprintf (outf, "\f\n%s,include\n", file); - return; - } } find_entries (file); if (emacs_tags_format) @@ -1302,32 +1314,19 @@ while (!feof (inf)) { c = *lp++; - if (c == 0) - { - CNL; - gotone = FALSE; - } if (c == '\\') { - c = *lp++; - if (c == 0) - { - CNL_SAVE_DEFINEDEF; - } + if (*lp == 0) + continue; + lp++; c = ' '; } else if (incomm) { - if (c == '*') + if (c == '*' && *lp == '/') { - while ((c = *lp++) == '*') - continue; - if (c == 0) - { - CNL; - } - if (c == '/') - incomm = FALSE; + c = *lp++; + incomm = FALSE; } } else if (inquote) @@ -1363,7 +1362,7 @@ } else if (c_ext && *lp == '/') { - CNL; /* C++ comment: skip rest of line */ + c = 0; /* C++ comment: skip rest of line */ } continue; case '#': @@ -1439,6 +1438,9 @@ } else { + /* The following is no longer true, + now that we advance to the next line + at the end of processing the character. */ /* * We've just finished lexing an identifier. * Note that if `c' is '\0', `lb' is the NEXT @@ -1458,6 +1460,7 @@ logical bingo, tok_at_end_of_line; char *lp_tmp; /* addressable */ +#if 0 if (c == '\0') { getline (GET_COOKIE (prev_linepos)); @@ -1467,6 +1470,7 @@ tok.lineno = lineno - 1; } else +#endif { tok_linebuf = lb.buffer; tok_at_end_of_line = FALSE; @@ -1524,6 +1528,12 @@ midtoken = TRUE; } } + /* Detect end of line, after having handled the last token on the line. */ + if (c == 0) + { + CNL; + gotone = FALSE; + } if (c == ';' && tydef == end) /* clean with typedefs */ tydef = none; } @@ -1629,9 +1639,8 @@ c = *lp++; if (c == 0) { - if (feof (inf)) - break; - CNL; + lp--; + break; } } if (c == '*' && *lp == '/') @@ -1648,9 +1657,8 @@ if (c == 0) { - if (feof (inf)) - break; - CNL; + lp--; + break; } } @@ -1767,9 +1775,8 @@ { if (c == 0) { - if (feof (inf)) - break; - CNL; + lp--; + break; } /* * This line used to confuse ctags: @@ -1787,9 +1794,8 @@ { if (c == 0) { - if (feof (inf)) - break; - CNL; + lp--; + break; } } if (!isgood (c)) diff -r 10994e910591 -r 24b63d6679b6 src/fns.c --- a/src/fns.c Sun Aug 18 01:05:27 1991 +0000 +++ b/src/fns.c Sun Aug 18 01:37:14 1991 +0000 @@ -644,6 +644,39 @@ return list; } +DEFUN ("delq", Fdelq, Sdelq, 2, 2, 0, + "Delete by side effect any occurrences of ELT as a member of LIST.\n\ +The modified LIST is returned. Comparison is done with `equal'.\n\ +If the first member of LIST is ELT, there is no way to remove it by side effect;\n\ +therefore, write `(setq foo (delete element foo))'\n\ +to be sure of changing the value of `foo'.") + (elt, list) + register Lisp_Object elt; + Lisp_Object list; +{ + register Lisp_Object tail, prev; + register Lisp_Object tem; + + tail = list; + prev = Qnil; + while (!NULL (tail)) + { + tem = Fcar (tail); + if (Fequal (elt, tem)) + { + if (NULL (prev)) + list = Fcdr (tail); + else + Fsetcdr (prev, Fcdr (tail)); + } + else + prev = tail; + tail = Fcdr (tail); + QUIT; + } + return list; +} + DEFUN ("nreverse", Fnreverse, Snreverse, 1, 1, 0, "Reverse LIST by modifying cdr pointers.\n\ Returns the beginning of the reversed list.")