Loading ...
Sorry, an error occurred while loading the content.

Vim-5.0 ctags is broken [patch included]

Expand Messages
  • Darren Hiebert
    Unfortunately, Bram missed a correction to my ctags archive before he included it in the public release of vim-5.0. This means that the version of ctags
    Message 1 of 1 , Feb 19, 1998
    • 0 Attachment
      Unfortunately, Bram missed a correction to my ctags archive before he
      included it in the public release of vim-5.0.

      This means that the version of ctags included with vim-5.0 has a problem
      which causes ctags to go into an infinite loop when the -a (--append)
      option is used. Below is the patch which I posted two days ago which
      corrects the problem. Apply it while in the vim-5.0/src/ctags directory.


      *** /home/darren/Packages/vim-5.0x/src/ctags/entry.c Sat Feb 7 00:34:03 1998
      --- entry.c Wed Feb 18 09:45:34 1998
      ***************
      *** 57,62 ****
      --- 57,63 ----
      static boolean includeTag __ARGS((const tagScope scope, const tagType type));
      static void makeTagEntry __ARGS((const tagInfo *const tag, const memberInfo *const pMember, const tagScope scope, const tagType type, const boolean useLineNumber));
      static void writePseudoTag __ARGS((const char *const tagName, const char *const fileName, const char *const pattern));
      + static void updateSortedFlag __ARGS((const char *const line, FILE *const fp, const boolean startOfLine));

      /*============================================================================
      = Function definitions
      ***************
      *** 472,477 ****
      --- 473,500 ----
      }
      }

      + static void updateSortedFlag( line, fp, startOfLine )
      + const char *const line;
      + FILE *const fp;
      + const boolean startOfLine;
      + {
      + const char *const tab = strchr(line, '\t');
      +
      + if (tab != NULL)
      + {
      + const size_t boolOffset = tab - line + 1; /* where it should be */
      +
      + if (line[boolOffset] == '0' || line[boolOffset] == '1')
      + {
      + const long nextLine = ftell(fp);
      +
      + fseek(fp, startOfLine + boolOffset, SEEK_SET);
      + fputc(Option.sorted ? '1' : '0', fp);
      + fseek(fp, nextLine, SEEK_SET);
      + }
      + }
      + }
      +
      /* Look through all line beginning with "!_TAG_FILE", and update those which
      * require it.
      */
      ***************
      *** 491,527 ****
      rewind(fp);
      line = readLine(&TagFile.line, fp);
      while (line != NULL && line[0] == class[0])
      if (strncmp(line, class, classLength) == 0)
      {
      char tab, classType[16];

      - ++linesRead;
      if (sscanf(line + classLength, "%15s%c", classType, &tab) == 2 &&
      tab == '\t')
      {
      if (strcmp(classType, "_SORTED") == 0)
      ! {
      ! const size_t boolOffset =
      ! (const char *)strchr(line, '\t') - line + 1;
      !
      ! if (line[boolOffset] == '0' || line[boolOffset] == '1')
      ! {
      ! const long nextLine = ftell(fp);
      !
      ! fseek(fp, startOfLine + boolOffset, SEEK_SET);
      ! fputc(Option.sorted ? '1' : '0', fp);
      ! fseek(fp, nextLine, SEEK_SET);
      ! }
      ! }
      ! #if 0 /* not yet necessary */
      ! else if (strcmp(classType, "_FORMAT") == 0)
      ! {
      ! }
      ! #endif
      }
      startOfLine = ftell(fp);
      - line = readLine(&TagFile.line, fp);
      }
      while (line != NULL) /* skip to end of file */
      {
      ++linesRead;
      --- 514,535 ----
      rewind(fp);
      line = readLine(&TagFile.line, fp);
      while (line != NULL && line[0] == class[0])
      + {
      + ++linesRead;
      if (strncmp(line, class, classLength) == 0)
      {
      char tab, classType[16];

      if (sscanf(line + classLength, "%15s%c", classType, &tab) == 2 &&
      tab == '\t')
      {
      if (strcmp(classType, "_SORTED") == 0)
      ! updateSortedFlag(line, fp, startOfLine);
      }
      startOfLine = ftell(fp);
      }
      + line = readLine(&TagFile.line, fp);
      + }
      while (line != NULL) /* skip to end of file */
      {
      ++linesRead;

      ----------------------------------------------------------------------------
      Darren Hiebert <darren@...> http://home.hiwaay.net/~darren

      Experience is what you get when you don't get what you want.
    Your message has been successfully submitted and would be delivered to recipients shortly.