]> code.delx.au - gnu-emacs/blobdiff - lib-src/ebrowse.c
(c-style-variables-are-local-p): Incompatible
[gnu-emacs] / lib-src / ebrowse.c
index 4e344a8bc118c48152b1e6181f1063f82506605c..e0f2f5ce9ef990605ca6e13b8ef2c1d85c1c24e8 100644 (file)
    along with GNU Emacs; see the file COPYING.  If not, write to
    the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.  */
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
 #include "getopt.h"
 
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
 /* Conditionalize function prototypes.  */
 
 #ifdef PROTOTYPES              /* From config.h.  */
 
 /* The character used as a separator in path lists (like $PATH).  */
 
-#if defined(__MSDOS__) || defined(WINDOWSNT)
+#if defined(__MSDOS__)
 #define PATH_LIST_SEPARATOR ';'
 #define FILENAME_EQ(X,Y)    (strcasecmp(X,Y) == 0)
 #else
+#if defined(WINDOWSNT)
+#define PATH_LIST_SEPARATOR ';'
+#define FILENAME_EQ(X,Y)    (stricmp(X,Y) == 0)
+#else
 #define PATH_LIST_SEPARATOR ':'
 #define FILENAME_EQ(X,Y)    (streq(X,Y))
 #endif
-
+#endif
 /* The default output file name.  */
 
-#define DEFAULT_OUTFILE "EBROWSE"
+#define DEFAULT_OUTFILE "BROWSE"
 
 /* A version string written to the output file.  Change this whenever
    the structure of the output file changes.  */
@@ -533,7 +537,9 @@ yyerror (format, a1, a2, a3, a4, a5)
 
 
 /* Like malloc but print an error and exit if not enough memory is
-   available.  */
+   available.  This isn't called `xmalloc' because src/m/alpha.h,
+   and maybe others, contain an incompatible prototype for xmalloc
+   and xrealloc.  */
 
 void *
 xmalloc (nbytes)
@@ -1456,7 +1462,7 @@ do {                                              \
 int
 process_pp_line ()
 {
-  int in_comment = 0;
+  int in_comment = 0, in_string = 0;
   int c;
   char *p = yytext;
 
@@ -1495,7 +1501,7 @@ process_pp_line ()
        }
     }
   
-  while (c && (c != '\n' || in_comment))
+  while (c && (c != '\n' || in_comment || in_string))
     {
       if (c == '\\')
        GET (c);
@@ -1509,13 +1515,15 @@ process_pp_line ()
          if (GET (c) == '/')
            in_comment = 0;
        }
+      else if (c == '"')
+       in_string = !in_string;
       
       if (c == '\n')
        INCREMENT_LINENO;
 
       GET (c);
     }
-  
+
   return c;
 }
 
@@ -1573,6 +1581,7 @@ yylex ()
                   else switch (c)
                     {
                     case '\n':
+                     INCREMENT_LINENO;
                     case 'a':
                     case 'b':
                     case 'f':
@@ -1635,7 +1644,7 @@ yylex ()
                   else
                     yyerror ("newline in string constant");
                   INCREMENT_LINENO;
-                  goto end_string;
+                  break;
 
                 default:
                   break;
@@ -2069,13 +2078,33 @@ token_string (t)
     case VOID:                  return "void";
     case VOLATILE:              return "volatile";
     case WHILE:                 return "while";
+    case MUTABLE:              return "mutable";
+    case BOOL:                 return "bool";
+    case TRUE:                 return "true";
+    case FALSE:                        return "false";
+    case SIGNATURE:            return "signature";
+    case NAMESPACE:            return "namespace";
+    case EXPLICIT:             return "explicit";
+    case TYPENAME:             return "typename";
+    case CONST_CAST:           return "const_cast";
+    case DYNAMIC_CAST:         return "dynamic_cast";
+    case REINTERPRET_CAST:     return "reinterpret_cast";
+    case STATIC_CAST:          return "static_cast";
+    case TYPEID:               return "typeid";
+    case USING:                        return "using";
+    case WCHAR:                        return "wchar_t";
     case YYEOF:                 return "EOF";
-    }
 
-  assert (t < 255);
-  b[0] = t;
-  b[1] = '\0';
-  return b;
+    default:
+      if (t < 255)
+       {
+         b[0] = t;
+         b[1] = '\0';
+         return b;
+       }
+      else
+       return "???";
+    }
 }
 
 
@@ -2369,14 +2398,18 @@ parm_list (flags)
         case IDENT:
           if (!type_seen)
             {
-             char *s;
+             char *last_id;
              unsigned ident_type_hash = 0;
              
-             parse_qualified_param_ident_or_type (&s);
-              for (; *s; ++s)
-                ident_type_hash = (ident_type_hash << 1) ^ *s;
-             hash = (hash << 1) ^ ident_type_hash;
-             type_seen = 1;
+             parse_qualified_param_ident_or_type (&last_id);
+             if (last_id)
+               {
+                 /* LAST_ID null means something like `X::*'.  */
+                 for (; *last_id; ++last_id)
+                   ident_type_hash = (ident_type_hash << 1) ^ *last_id;
+                 hash = (hash << 1) ^ ident_type_hash;
+                 type_seen = 1;
+               }
             }
          else
            MATCH ();
@@ -2898,7 +2931,7 @@ parse_qualified_param_ident_or_type (last_id)
   struct sym *cls = NULL;
   static char *id = NULL;
   static int id_size = 0;
-  
+
   while (LOOKING_AT (IDENT))
     {
       int len = strlen (yytext) + 1;