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/ebrowse.c


From: Pavel Janík
Subject: [Emacs-diffs] Changes to emacs/lib-src/ebrowse.c
Date: Wed, 19 Dec 2001 01:03:40 -0500

Index: emacs/lib-src/ebrowse.c
diff -c emacs/lib-src/ebrowse.c:1.28 emacs/lib-src/ebrowse.c:1.29
*** emacs/lib-src/ebrowse.c:1.28        Fri Nov 16 05:48:38 2001
--- emacs/lib-src/ebrowse.c     Wed Dec 19 01:03:40 2001
***************
*** 6,12 ****
  
     Author: Gerd Moellmann <address@hidden>
     Maintainer: FSF
!    
     This file is part of GNU Emacs.
  
     GNU Emacs is free software; you can redistribute it and/or modify
--- 6,12 ----
  
     Author: Gerd Moellmann <address@hidden>
     Maintainer: FSF
! 
     This file is part of GNU Emacs.
  
     GNU Emacs is free software; you can redistribute it and/or modify
***************
*** 28,35 ****
--- 28,42 ----
  #endif
  
  #include <stdio.h>
+ 
+ #ifdef HAVE_STDLIB_H
  #include <stdlib.h>
+ #endif
+ 
+ #ifdef HAVE_STRING_H
  #include <string.h>
+ #endif
+ 
  #include <ctype.h>
  #include <assert.h>
  #include "getopt.h"
***************
*** 400,406 ****
  
  #define BUFFER_POS() (in - inbuffer)
  
! /* If current lookahead is CSTRING, the following points to the 
     first character in the string constant.  Used for recognizing
     extern "C".  */
  
--- 407,413 ----
  
  #define BUFFER_POS() (in - inbuffer)
  
! /* If current lookahead is CSTRING, the following points to the
     first character in the string constant.  Used for recognizing
     extern "C".  */
  
***************
*** 686,692 ****
      {
        lnk = (struct link *) xmalloc (sizeof *lnk);
        lnk2 = (struct link *) xmalloc (sizeof *lnk2);
!   
        lnk->sym = sub;
        lnk->next = p;
  
--- 693,699 ----
      {
        lnk = (struct link *) xmalloc (sizeof *lnk);
        lnk2 = (struct link *) xmalloc (sizeof *lnk2);
! 
        lnk->sym = sub;
        lnk->next = p;
  
***************
*** 728,742 ****
      case SC_FRIEND:
        list = &cls->friends;
        break;
!       
      case SC_TYPE:
        list = &cls->types;
        break;
!       
      case SC_STATIC:
        list = var ? &cls->static_vars : &cls->static_fns;
        break;
!       
      default:
        list = var ? &cls->vars : &cls->fns;
        break;
--- 735,749 ----
      case SC_FRIEND:
        list = &cls->friends;
        break;
! 
      case SC_TYPE:
        list = &cls->types;
        break;
! 
      case SC_STATIC:
        list = var ? &cls->static_vars : &cls->static_fns;
        break;
! 
      default:
        list = var ? &cls->vars : &cls->fns;
        break;
***************
*** 928,934 ****
     a bit set giving additional information about the member (see the
     F_* defines).  */
  
! void 
  add_global_decl (name, regexp, pos, hash, var, sc, flags)
       char *name, *regexp;
       int pos;
--- 935,941 ----
     a bit set giving additional information about the member (see the
     F_* defines).  */
  
! void
  add_global_decl (name, regexp, pos, hash, var, sc, flags)
       char *name, *regexp;
       int pos;
***************
*** 1008,1022 ****
      case SC_FRIEND:
        list = &cls->friends;
        break;
!       
      case SC_TYPE:
        list = &cls->types;
        break;
!       
      case SC_STATIC:
        list = var ? &cls->static_vars : &cls->static_fns;
        break;
!       
      default:
        list = var ? &cls->vars : &cls->fns;
        break;
--- 1015,1029 ----
      case SC_FRIEND:
        list = &cls->friends;
        break;
! 
      case SC_TYPE:
        list = &cls->types;
        break;
! 
      case SC_STATIC:
        list = var ? &cls->static_vars : &cls->static_fns;
        break;
! 
      default:
        list = var ? &cls->vars : &cls->fns;
        break;
***************
*** 1112,1118 ****
       struct sym *context;
  {
    struct sym *p = NULL;
!   
    for (p = all_namespaces; p; p = p->next)
      {
        if (streq (p->name, name) && (p->namesp == context))
--- 1119,1125 ----
       struct sym *context;
  {
    struct sym *p = NULL;
! 
    for (p = all_namespaces; p; p = p->next)
      {
        if (streq (p->name, name) && (p->namesp == context))
***************
*** 1137,1143 ****
  
    return p;
  }
!   
  
  /* Find namespace alias with name NAME. If not found return NULL. */
  
--- 1144,1150 ----
  
    return p;
  }
! 
  
  /* Find namespace alias with name NAME. If not found return NULL. */
  
***************
*** 1210,1216 ****
                                    size * sizeof *namespace_stack);
        namespace_stack_size = size;
      }
!   
    namespace_stack[namespace_sp++] = current_namespace;
    current_namespace = p;
  }
--- 1217,1223 ----
                                    size * sizeof *namespace_stack);
        namespace_stack_size = size;
      }
! 
    namespace_stack[namespace_sp++] = current_namespace;
    current_namespace = p;
  }
***************
*** 1282,1288 ****
       struct sym *p;
  {
    int len;
!   
    if (p->namesp)
      sym_scope_1 (p->namesp);
  
--- 1289,1295 ----
       struct sym *p;
  {
    int len;
! 
    if (p->namesp)
      sym_scope_1 (p->namesp);
  
***************
*** 1297,1310 ****
    ensure_scope_buffer_room (len + 1);
    strcat (scope_buffer, p->name);
    scope_buffer_len += len;
!   
    if (HAS_FLAG (p->flags, F_TEMPLATE))
      {
        ensure_scope_buffer_room (3);
        strcat (scope_buffer, "<>");
        scope_buffer_len += 2;
      }
!   
    return scope_buffer;
  }
  
--- 1304,1317 ----
    ensure_scope_buffer_room (len + 1);
    strcat (scope_buffer, p->name);
    scope_buffer_len += len;
! 
    if (HAS_FLAG (p->flags, F_TEMPLATE))
      {
        ensure_scope_buffer_room (3);
        strcat (scope_buffer, "<>");
        scope_buffer_len += 2;
      }
! 
    return scope_buffer;
  }
  
***************
*** 1321,1330 ****
        scope_buffer_size = 1024;
        scope_buffer = (char *) xmalloc (scope_buffer_size);
      }
!   
    *scope_buffer = '\0';
    scope_buffer_len = 0;
!   
    if (p->namesp)
      sym_scope_1 (p->namesp);
  
--- 1328,1337 ----
        scope_buffer_size = 1024;
        scope_buffer = (char *) xmalloc (scope_buffer_size);
      }
! 
    *scope_buffer = '\0';
    scope_buffer_len = 0;
! 
    if (p->namesp)
      sym_scope_1 (p->namesp);
  
***************
*** 1377,1389 ****
  {
    fputs (CLASS_STRUCT, fp);
    PUTSTR (root->name, fp);
!   
    /* Print scope, if any.  */
    if (root->namesp)
      PUTSTR (sym_scope (root), fp);
    else
      PUTSTR (NULL, fp);
!   
    /* Print flags.  */
    fprintf (fp, "%u", root->flags);
    PUTSTR (root->filename, fp);
--- 1384,1396 ----
  {
    fputs (CLASS_STRUCT, fp);
    PUTSTR (root->name, fp);
! 
    /* Print scope, if any.  */
    if (root->namesp)
      PUTSTR (sym_scope (root), fp);
    else
      PUTSTR (NULL, fp);
! 
    /* Print flags.  */
    fprintf (fp, "%u", root->flags);
    PUTSTR (root->filename, fp);
***************
*** 1563,1569 ****
          add_define (yytext, regexp, pos);
        }
      }
!   
    while (c && (c != '\n' || in_comment || in_string))
      {
        if (c == '\\')
--- 1570,1576 ----
          add_define (yytext, regexp, pos);
        }
      }
! 
    while (c && (c != '\n' || in_comment || in_string))
      {
        if (c == '\\')
***************
*** 1580,1586 ****
        }
        else if (c == '"')
        in_string = !in_string;
!       
        if (c == '\n')
        INCREMENT_LINENO;
  
--- 1587,1593 ----
        }
        else if (c == '"')
        in_string = !in_string;
! 
        if (c == '\n')
        INCREMENT_LINENO;
  
***************
*** 2184,2190 ****
  {
    in = inbuffer;
    yyline = 1;
!   
    if (yytext == NULL)
      {
        int size = 256;
--- 2191,2197 ----
  {
    in = inbuffer;
    yyline = 1;
! 
    if (yytext == NULL)
      {
        int size = 256;
***************
*** 2386,2404 ****
      case '{':
        close = '}';
        break;
!       
      case '(':
        close = ')';
        break;
!       
      case '<':
        close = '>';
        break;
!       
      case '[':
        close = ']';
        break;
!       
      default:
        abort ();
      }
--- 2393,2411 ----
      case '{':
        close = '}';
        break;
! 
      case '(':
        close = ')';
        break;
! 
      case '<':
        close = '>';
        break;
! 
      case '[':
        close = ']';
        break;
! 
      default:
        abort ();
      }
***************
*** 2505,2511 ****
              {
              char *last_id;
              unsigned ident_type_hash = 0;
!             
              parse_qualified_param_ident_or_type (&last_id);
              if (last_id)
                {
--- 2512,2518 ----
              {
              char *last_id;
              unsigned ident_type_hash = 0;
! 
              parse_qualified_param_ident_or_type (&last_id);
              if (last_id)
                {
***************
*** 2533,2539 ****
          case DOUBLE:    case ENUM:      case FLOAT:     case INT:
          case LONG:      case SHORT:     case SIGNED:    case STRUCT:
          case UNION:     case UNSIGNED:  case VOLATILE:  case WCHAR:
!         case ELLIPSIS:  
            type_seen = 1;
            hash = (hash << 1) ^ LA1;
            MATCH ();
--- 2540,2546 ----
          case DOUBLE:    case ENUM:      case FLOAT:     case INT:
          case LONG:      case SHORT:     case SIGNED:    case STRUCT:
          case UNION:     case UNSIGNED:  case VOLATILE:  case WCHAR:
!         case ELLIPSIS:
            type_seen = 1;
            hash = (hash << 1) ^ LA1;
            MATCH ();
***************
*** 2553,2559 ****
    if (LOOKING_AT (')'))
      {
        MATCH ();
!       
        if (LOOKING_AT (CONST))
          {
            /* We can overload the same function on `const' */
--- 2560,2566 ----
    if (LOOKING_AT (')'))
      {
        MATCH ();
! 
        if (LOOKING_AT (CONST))
          {
            /* We can overload the same function on `const' */
***************
*** 2638,2644 ****
          case EXPLICIT:
            SET_FLAG (flags, F_EXPLICIT);
            goto typeseen;
!           
          case MUTABLE:
            SET_FLAG (flags, F_MUTABLE);
            goto typeseen;
--- 2645,2651 ----
          case EXPLICIT:
            SET_FLAG (flags, F_EXPLICIT);
            goto typeseen;
! 
          case MUTABLE:
            SET_FLAG (flags, F_MUTABLE);
            goto typeseen;
***************
*** 2773,2779 ****
          {
            regexp = matching_regexp ();
            pos = BUFFER_POS ();
!           
            if (cls != NULL)
              {
                if (type_seen || !paren_seen)
--- 2780,2786 ----
          {
            regexp = matching_regexp ();
            pos = BUFFER_POS ();
! 
            if (cls != NULL)
              {
                if (type_seen || !paren_seen)
***************
*** 2782,2788 ****
                add_member_decl (cls, id, regexp, pos, hash, 0, sc, vis, 0);
              }
          }
!       
        MATCH ();
        print_info ();
      }
--- 2789,2795 ----
                add_member_decl (cls, id, regexp, pos, hash, 0, sc, vis, 0);
              }
          }
! 
        MATCH ();
        print_info ();
      }
***************
*** 2879,2885 ****
  parse_classname ()
  {
    struct sym *last_class = NULL;
!   
    while (LOOKING_AT (IDENT))
      {
        last_class = add_sym (yytext, last_class);
--- 2886,2892 ----
  parse_classname ()
  {
    struct sym *last_class = NULL;
! 
    while (LOOKING_AT (IDENT))
      {
        last_class = add_sym (yytext, last_class);
***************
*** 2890,2899 ****
            skip_matching ();
            SET_FLAG (last_class->flags, F_TEMPLATE);
          }
!       
        if (!LOOKING_AT (DCOLON))
          break;
!       
        MATCH ();
      }
  
--- 2897,2906 ----
            skip_matching ();
            SET_FLAG (last_class->flags, F_TEMPLATE);
          }
! 
        if (!LOOKING_AT (DCOLON))
          break;
! 
        MATCH ();
      }
  
***************
*** 2913,2919 ****
    static char *id = NULL;
    char *s;
    int len;
!   
    MATCH ();
  
    if (LOOKING_AT2 (NEW, DELETE))
--- 2920,2926 ----
    static char *id = NULL;
    char *s;
    int len;
! 
    MATCH ();
  
    if (LOOKING_AT2 (NEW, DELETE))
***************
*** 2924,2930 ****
  
        s = token_string (LA1);
        MATCH ();
!       
        len = strlen (s) + 10;
        if (len > id_size)
        {
--- 2931,2937 ----
  
        s = token_string (LA1);
        MATCH ();
! 
        len = strlen (s) + 10;
        if (len > id_size)
        {
***************
*** 2934,2945 ****
        }
        strcpy (id, s);
  
!       /* Vector new or delete? */
        if (LOOKING_AT ('['))
        {
          strcat (id, "[");
          MATCH ();
!         
          if (LOOKING_AT (']'))
            {
              strcat (id, "]");
--- 2941,2952 ----
        }
        strcpy (id, s);
  
!       /* Vector new or delete?  */
        if (LOOKING_AT ('['))
        {
          strcat (id, "[");
          MATCH ();
! 
          if (LOOKING_AT (']'))
            {
              strcat (id, "]");
***************
*** 3004,3010 ****
    char *id = NULL;
    size_t id_size = 0;
    int enter = 0;
!   
    while (LOOKING_AT (IDENT))
      {
        int len = strlen (yytext) + 1;
--- 3011,3017 ----
    char *id = NULL;
    size_t id_size = 0;
    int enter = 0;
! 
    while (LOOKING_AT (IDENT))
      {
        int len = strlen (yytext) + 1;
***************
*** 3233,3239 ****
            sc = SC_TYPE;
            MATCH ();
            break;
!           
          case STATIC:
            sc = SC_STATIC;
            MATCH ();
--- 3240,3246 ----
            sc = SC_TYPE;
            MATCH ();
            break;
! 
          case STATIC:
            sc = SC_STATIC;
            MATCH ();
***************
*** 3361,3367 ****
            else
              add_global_defn (id, regexp, pos, 0, 1, sc, flags);
          }
!         
        MATCH ();
        print_info ();
      }
--- 3368,3374 ----
            else
              add_global_defn (id, regexp, pos, 0, 1, sc, flags);
          }
! 
        MATCH ();
        print_info ();
      }
***************
*** 3399,3405 ****
    for (;;)
      {
        char *prev_in = in;
!       
        switch (LA1)
          {
          case NAMESPACE:
--- 3406,3412 ----
    for (;;)
      {
        char *prev_in = in;
! 
        switch (LA1)
          {
          case NAMESPACE:
***************
*** 3410,3422 ****
                {
                  char *namespace_name = xstrdup (yytext);
                  MATCH ();
!                 
                  if (LOOKING_AT ('='))
                    {
                    struct link *qna = match_qualified_namespace_alias ();
                    if (qna)
                        register_namespace_alias (namespace_name, qna);
!                     
                      if (skip_to (';') == ';')
                        MATCH ();
                    }
--- 3417,3429 ----
                {
                  char *namespace_name = xstrdup (yytext);
                  MATCH ();
! 
                  if (LOOKING_AT ('='))
                    {
                    struct link *qna = match_qualified_namespace_alias ();
                    if (qna)
                        register_namespace_alias (namespace_name, qna);
! 
                      if (skip_to (';') == ';')
                        MATCH ();
                    }
***************
*** 3441,3447 ****
              {
                /* This is `extern "C"'.  */
                MATCH ();
!               
                if (LOOKING_AT ('{'))
                  {
                    MATCH ();
--- 3448,3454 ----
              {
                /* This is `extern "C"'.  */
                MATCH ();
! 
                if (LOOKING_AT ('{'))
                  {
                    MATCH ();
***************
*** 3452,3458 ****
                  SET_FLAG (flags, F_EXTERNC);
              }
            break;
!           
          case TEMPLATE:
            MATCH ();
            SKIP_MATCHING_IF ('<');
--- 3459,3465 ----
                  SET_FLAG (flags, F_EXTERNC);
              }
            break;
! 
          case TEMPLATE:
            MATCH ();
            SKIP_MATCHING_IF ('<');
***************
*** 3492,3498 ****
  
          case '}':
            return 0;
!           
          default:
            declaration (flags);
            flags = start_flags;
--- 3499,3505 ----
  
          case '}':
            return 0;
! 
          default:
            declaration (flags);
            flags = start_flags;
***************
*** 3531,3540 ****
      {
        char *start = path_list;
        struct search_path *p;
!       
        while (*path_list && *path_list != PATH_LIST_SEPARATOR)
          ++path_list;
!       
        p = (struct search_path *) xmalloc (sizeof *p);
        p->path = (char *) xmalloc (path_list - start + 1);
        memcpy (p->path, start, path_list - start);
--- 3538,3547 ----
      {
        char *start = path_list;
        struct search_path *p;
! 
        while (*path_list && *path_list != PATH_LIST_SEPARATOR)
          ++path_list;
! 
        p = (struct search_path *) xmalloc (sizeof *p);
        p->path = (char *) xmalloc (path_list - start + 1);
        memcpy (p->path, start, path_list - start);
***************
*** 3568,3574 ****
    static int buffer_size;
    struct search_path *path;
    int flen = strlen (file) + 1;       /* +1 for the slash */
!   
    filename = xstrdup (file);
  
    for (path = search_path; path && fp == NULL; path = path->next)
--- 3575,3581 ----
    static int buffer_size;
    struct search_path *path;
    int flen = strlen (file) + 1;       /* +1 for the slash */
! 
    filename = xstrdup (file);
  
    for (path = search_path; path && fp == NULL; path = path->next)
***************
*** 3580,3599 ****
          buffer_size = max (len + 1, 2 * buffer_size);
          buffer = (char *) xrealloc (buffer, buffer_size);
        }
!       
        strcpy (buffer, path->path);
        strcat (buffer, "/");
        strcat (buffer, file);
        fp = fopen (buffer, "r");
      }
!   
    /* Try the original file name.  */
    if (fp == NULL)
       fp = fopen (file, "r");
  
    if (fp == NULL)
      yyerror ("cannot open", NULL);
!   
    return fp;
  }
  
--- 3587,3606 ----
          buffer_size = max (len + 1, 2 * buffer_size);
          buffer = (char *) xrealloc (buffer, buffer_size);
        }
! 
        strcpy (buffer, path->path);
        strcat (buffer, "/");
        strcat (buffer, file);
        fp = fopen (buffer, "r");
      }
! 
    /* Try the original file name.  */
    if (fp == NULL)
       fp = fopen (file, "r");
  
    if (fp == NULL)
      yyerror ("cannot open", NULL);
! 
    return fp;
  }
  
***************
*** 3653,3662 ****
       char *file;
  {
    FILE *fp;
!   
    fp = open_file (file);
    if (fp)
!     {      
        int nread, nbytes;
  
        /* Give a progress indication if needed.  */
--- 3660,3669 ----
       char *file;
  {
    FILE *fp;
! 
    fp = open_file (file);
    if (fp)
!     {
        int nread, nbytes;
  
        /* Give a progress indication if needed.  */
***************
*** 3679,3685 ****
              inbuffer_size = nread + READ_CHUNK_SIZE + 1;
              inbuffer = (char *) xrealloc (inbuffer, inbuffer_size);
            }
!         
          nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp);
          if (nbytes <= 0)
            break;
--- 3686,3692 ----
              inbuffer_size = nread + READ_CHUNK_SIZE + 1;
              inbuffer = (char *) xrealloc (inbuffer, inbuffer_size);
            }
! 
          nbytes = fread (inbuffer + nread, 1, READ_CHUNK_SIZE, fp);
          if (nbytes <= 0)
            break;
***************
*** 3722,3731 ****
  
        buffer[i++] = c;
      }
!   
    if (c == EOF && i == 0)
      return NULL;
!   
    if (i == buffer_size)
      {
        buffer_size = max (100, buffer_size * 2);
--- 3729,3738 ----
  
        buffer[i++] = c;
      }
! 
    if (c == EOF && i == 0)
      return NULL;
! 
    if (i == buffer_size)
      {
        buffer_size = max (100, buffer_size * 2);
***************
*** 3765,3771 ****
        case 'p':
          info_position = atoi (optarg);
          break;
!         
          case 'n':
            f_nested_classes = 0;
            break;
--- 3772,3778 ----
        case 'p':
          info_position = atoi (optarg);
          break;
! 
          case 'n':
            f_nested_classes = 0;
            break;
***************
*** 3773,3779 ****
          case 'x':
            f_regexps = 0;
            break;
!         
            /* Add the name of a file containing more input files.  */
          case 'f':
          if (n_input_files == input_filenames_size)
--- 3780,3786 ----
          case 'x':
            f_regexps = 0;
            break;
! 
            /* Add the name of a file containing more input files.  */
          case 'f':
          if (n_input_files == input_filenames_size)
***************
*** 3870,3879 ****
            yyerror ("error getting size of file `%s'", out_filename);
          else if (rc == 0)
            yyerror ("file `%s' is empty", out_filename);
!         
          fclose (fp);
        }
!       
        yyout = fopen (out_filename, f_append ? "a" : "w");
        if (yyout == NULL)
        {
--- 3877,3886 ----
            yyerror ("error getting size of file `%s'", out_filename);
          else if (rc == 0)
            yyerror ("file `%s' is empty", out_filename);
! 
          fclose (fp);
        }
! 
        yyout = fopen (out_filename, f_append ? "a" : "w");
        if (yyout == NULL)
        {
***************
*** 3903,3909 ****
        for (i = 0; i < n_input_files; ++i)
          {
            FILE *fp = fopen (input_filenames[i], "r");
!           
            if (fp == NULL)
              yyerror ("cannot open input file `%s'", input_filenames[i]);
            else
--- 3910,3916 ----
        for (i = 0; i < n_input_files; ++i)
          {
            FILE *fp = fopen (input_filenames[i], "r");
! 
            if (fp == NULL)
              yyerror ("cannot open input file `%s'", input_filenames[i]);
            else



reply via email to

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