emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] Changes to emacs/lib-src/etags.c,v


From: Francesco Potortì
Subject: [Emacs-diffs] Changes to emacs/lib-src/etags.c,v
Date: Sun, 30 Jul 2006 09:43:48 +0000

CVSROOT:        /sources/emacs
Module name:    emacs
Changes by:     Francesco Potortì <pot>        06/07/30 09:43:47

Index: etags.c
===================================================================
RCS file: /sources/emacs/emacs/lib-src/etags.c,v
retrieving revision 3.54
retrieving revision 3.55
diff -u -b -r3.54 -r3.55
--- etags.c     11 Jul 2006 11:00:44 -0000      3.54
+++ etags.c     30 Jul 2006 09:43:47 -0000      3.55
@@ -41,7 +41,7 @@
  * configuration file containing regexp definitions for etags.
  */
 
-char pot_etags_version[] = "@(#) pot revision number is 17.18";
+char pot_etags_version[] = "@(#) pot revision number is 17.20";
 
 #define        TRUE    1
 #define        FALSE   0
@@ -59,12 +59,10 @@
   /* On some systems, Emacs defines static as nothing for the sake
      of unexec.  We don't want that here since we don't use unexec. */
 # undef static
-# define ETAGS_REGEXPS         /* use the regexp features */
-# define LONG_OPTIONS          /* accept long options */
-# ifndef PTR                   /* for Xemacs */
+# ifndef PTR                   /* for XEmacs */
 #   define PTR void *
 # endif
-# ifndef __P                   /* for Xemacs */
+# ifndef __P                   /* for XEmacs */
 #   define __P(args) args
 # endif
 #else  /* no config.h */
@@ -82,14 +80,7 @@
 # define _GNU_SOURCE 1         /* enables some compiler checks on GNU */
 #endif
 
-#ifdef LONG_OPTIONS
-#  undef LONG_OPTIONS
-#  define LONG_OPTIONS TRUE
-#else
-#  define LONG_OPTIONS  FALSE
-#endif
-
-/* WIN32_NATIVE is for Xemacs.
+/* WIN32_NATIVE is for XEmacs.
    MSDOS, WINDOWSNT, DOS_NT are for Emacs. */
 #ifdef WIN32_NATIVE
 # undef MSDOS
@@ -167,25 +158,25 @@
 # define S_ISREG(m)    (((m) & S_IFMT) == S_IFREG)
 #endif
 
-#if LONG_OPTIONS
-# include <getopt.h>
-#else
+#ifdef NO_LONG_OPTIONS         /* define this if you don't have GNU getopt */
+# define NO_LONG_OPTIONS TRUE
 # define getopt_long(argc,argv,optstr,lopts,lind) getopt (argc, argv, optstr)
   extern char *optarg;
   extern int optind, opterr;
-#endif /* LONG_OPTIONS */
+#else
+# define NO_LONG_OPTIONS FALSE
+# include <getopt.h>
+#endif /* NO_LONG_OPTIONS */
 
-#ifdef ETAGS_REGEXPS
-# ifndef HAVE_CONFIG_H         /* this is a standalone compilation */
+#ifndef HAVE_CONFIG_H          /* this is a standalone compilation */
 #   ifdef __CYGWIN__           /* compiling on Cygwin */
                             !!! NOTICE !!!
  the regex.h distributed with Cygwin is not compatible with etags, alas!
 If you want regular expression support, you should delete this notice and
              arrange to use the GNU regex.h and regex.c.
 #   endif
-# endif
-# include <regex.h>
-#endif /* ETAGS_REGEXPS */
+#endif
+#include <regex.h>
 
 /* Define CTAGS to make the program "ctags" compatible with the usual one.
  Leave it undefined to make the program "etags", which makes emacs-style
@@ -312,7 +303,6 @@
   char *what;                  /* the argument itself */
 } argument;
 
-#ifdef ETAGS_REGEXPS
 /* Structure defining a regular expression. */
 typedef struct regexp
 {
@@ -327,7 +317,6 @@
   bool ignore_case;            /* ignore case when matching */
   bool multi_line;             /* do a multi-line match on the whole file */
 } regexp;
-#endif /* ETAGS_REGEXPS */
 
 
 /* Many compilers barf on this:
@@ -375,11 +364,9 @@
 static bool nocase_tail __P((char *));
 static void get_tag __P((char *, char **));
 
-#ifdef ETAGS_REGEXPS
 static void analyse_regex __P((char *));
 static void free_regexps __P((void));
 static void regex_tag_multiline __P((void));
-#endif /* ETAGS_REGEXPS */
 static void error __P((const char *, const char *));
 static void suggest_asking_for_help __P((void));
 void fatal __P((char *, char *));
@@ -485,14 +472,9 @@
 #define STDIN 0x1001           /* returned by getopt_long on --parse-stdin */
 static bool parsing_stdin;     /* --parse-stdin used */
 
-#ifdef ETAGS_REGEXPS
 static regexp *p_head;         /* list of all regexps */
 static bool need_filebuf;      /* some regexes are multi-line */
-#else
-# define need_filebuf FALSE
-#endif /* ETAGS_REGEXPS */
 
-#if LONG_OPTIONS
 static struct option longopts[] =
 {
   { "append",            no_argument,       NULL,               'a'   },
@@ -507,11 +489,9 @@
   { "members",           no_argument,       &members,           TRUE  },
   { "no-members",        no_argument,       &members,           FALSE },
   { "output",            required_argument, NULL,               'o'   },
-#ifdef ETAGS_REGEXPS
   { "regex",             required_argument, NULL,               'r'   },
   { "no-regex",                  no_argument,       NULL,               'R'   
},
   { "ignore-case-regex",  required_argument, NULL,              'c'   },
-#endif /* ETAGS_REGEXPS */
   { "parse-stdin",        required_argument, NULL,               STDIN },
   { "version",           no_argument,       NULL,               'V'   },
 
@@ -533,7 +513,6 @@
 #endif
   { NULL }
 };
-#endif /* LONG_OPTIONS */
 
 static compressor compressors[] =
 {
@@ -681,13 +660,15 @@
 static char Objc_help [] =
 "In Objective C code, tags include Objective C definitions for classes,\n\
 class categories, methods and protocols.  Tags for variables and\n\
-functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.";
+functions in classes are named `CLASS::VARIABLE' and `CLASS::FUNCTION'.\n\
+(Use --help --lang=c --lang=objc --lang=java for full help.)";
 
 static char *Pascal_suffixes [] =
   { "p", "pas", NULL };
 static char Pascal_help [] =
 "In Pascal code, the tags are the functions and procedures defined\n\
 in the file.";
+/* " // this is for working around an Emacs highlighting bug... */
 
 static char *Perl_suffixes [] =
   { "pl", "pm", NULL };
@@ -885,11 +866,11 @@
   printf ("Usage: %s [options] [[regex-option ...] file-name] ...\n\
 \n\
 These are the options accepted by %s.\n", progname, progname);
-  if (LONG_OPTIONS)
-    puts ("You may use unambiguous abbreviations for the long option names.");
+  if (NO_LONG_OPTIONS)
+    puts ("WARNING: long option names do not work with this executable,\n\
+as it is not linked with GNU getopt.");
   else
-    puts ("Long option names do not work with this executable, as it is not\n\
-linked with GNU getopt.");
+    puts ("You may use unambiguous abbreviations for the long option names.");
   puts ("  A - as file name means read names from stdin (one per line).\n\
 Absolute names are stored in the output file as they are.\n\
 Relative ones are stored relative to the output file's directory.\n");
@@ -949,7 +930,6 @@
   puts ("--members\n\
        Create tag entries for members of structures in some languages.");
 
-#ifdef ETAGS_REGEXPS
   puts ("-r REGEXP, --regex=REGEXP or address@hidden
         Make a tag for each line matching a regular expression pattern\n\
        in the following files.  {LANGUAGE}REGEXP uses REGEXP for LANGUAGE\n\
@@ -964,7 +944,6 @@
        causes dot to match any character, including newline.");
   puts ("-R, --no-regex\n\
         Don't create tags from regexps for the following files.");
-#endif /* ETAGS_REGEXPS */
   puts ("-I, --ignore-indentation\n\
         In C and C++ do not assume that a closing brace in the first\n\
         column is the final brace of a function or structure definition.");
@@ -1194,14 +1173,8 @@
 
   /* When the optstring begins with a '-' getopt_long does not rearrange the
      non-options arguments to be at the end, but leaves them alone. */
-  optstring = "-";
-#ifdef ETAGS_REGEXPS
-  optstring = "-r:Rc:";
-#endif /* ETAGS_REGEXPS */
-  if (!LONG_OPTIONS)
-    optstring += 1;            /* remove the initial '-' */
-  optstring = concat (optstring,
-                     "aCf:Il:o:SVhH",
+  optstring = concat (NO_LONG_OPTIONS ? "" : "-",
+                     "ac:Cf:Il:o:r:RSVhH",
                      (CTAGS) ? "BxdtTuvw" : "Di:");
 
   while ((opt = getopt_long (argc, argv, optstring, longopts, NULL)) != EOF)
@@ -1375,11 +1348,9 @@
        case at_language:
          lang = argbuffer[i].lang;
          break;
-#ifdef ETAGS_REGEXPS
        case at_regexp:
          analyse_regex (argbuffer[i].what);
          break;
-#endif
        case at_filename:
 #ifdef VMS
          while ((this_file = gfnames (argbuffer[i].what, &got_err)) != NULL)
@@ -1419,9 +1390,7 @@
        }
     }
 
-#ifdef ETAGS_REGEXPS
   free_regexps ();
-#endif /* ETAGS_REGEXPS */
   free (lb.buffer);
   free (filebuf.buffer);
   free (token_name.buffer);
@@ -1979,9 +1948,7 @@
 
   parser (inf);
 
-#ifdef ETAGS_REGEXPS
   regex_tag_multiline ();
-#endif /* ETAGS_REGEXPS */
 }
 
 
@@ -3239,7 +3206,7 @@
   int typdefbracelev;          /* bracelev where a typedef struct body begun */
   bool incomm, inquote, inchar, quotednl, midtoken;
   bool yacc_rules;             /* in the rules part of a yacc file */
-  struct tok savetoken;                /* token saved during preprocessor 
handling */
+  struct tok savetoken = {0};  /* token saved during preprocessor handling */
 
 
   linebuffer_init (&lbs[0].lb);
@@ -5735,8 +5702,6 @@
 }
 
 
-#ifdef ETAGS_REGEXPS
-
 static char *scan_separators __P((char *));
 static void add_regex __P((char *, language *));
 static char *substitute __P((char *, char *, struct re_registers *));
@@ -6141,8 +6106,6 @@
     }
 }
 
-#endif /* ETAGS_REGEXPS */
-
 
 static bool
 nocase_tail (cp)
@@ -6405,7 +6368,6 @@
        }
     } /* if #line directives should be considered */
 
-#ifdef ETAGS_REGEXPS
   {
     int match;
     regexp *rp;
@@ -6462,7 +6424,6 @@
            }
        }
   }
-#endif /* ETAGS_REGEXPS */
 }
 
 
@@ -6623,7 +6584,7 @@
 suggest_asking_for_help ()
 {
   fprintf (stderr, "\tTry `%s %s' for a complete list of options.\n",
-          progname, LONG_OPTIONS ? "--help" : "-h");
+          progname, NO_LONG_OPTIONS ? "-h" : "--help");
   exit (EXIT_FAILURE);
 }
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]