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

cscope problem

Expand Messages
  • brian
    Hi, I am having a problem with cscope and vim. I am using cscope / vim with the prepend path option. When I do a cs find 0 a list of possibilites
    Message 1 of 3 , Sep 9, 2000
    • 0 Attachment
      Hi,

      I am having a problem with cscope and vim. I am using cscope / vim with
      the "prepend path" option.

      When I do a 'cs find 0 <symbol>' a list of possibilites is presented.
      The option chosen does not necessarily become the symbol shown on the
      screen..:) That is, I select an option that should take me to line x of
      file 'a', but I goto line y of file 'b'. This seems odd.

      Info:
      Tried both vim 5.6 and 5.7.
      I am using cscope version 15.0bl2.
      I have: 'cs add /tmp/test/cscope.out /tmp/test' in my .vimrc.
      The cscope.out was made with 'cscope -R -b' while in /tmp/test.

      Attached is a tar file containing an example problem. There are two
      directories and two files. One file per directory. One file has the
      declaration and definition of a global struct, while the other uses the
      global struct.

      To replicate the problem untar the files into a direcotry (I used
      /tmp/test) and go to directory 'a'. Once there load up a.c. Next do a
      'cs find 0 apple'. Select option 3. When I do this I am taken to line 6
      of file uio.c instead of line 3 of a.c.

      Can someone else please run through this test? Does it work for you?
      Do I have something setup incorrectly?

      --
      ~'`^`'~=-.,__,.-=~'`^`'~=-.,__,.-=~'`^`'~=-., \|/ (___) \|/ _,.-=~'`^`
      Brian Medley @~./'O o`\.~@
      "Knowledge is Power" bmedley@... /__( \___/ )__\ *PPPFFBT!*
      -- Francis Bacon `\__`U_/'
      _,.-=~'`^`'~=-.,__,.-=~'`^`'~=-.,__,.-=~'`^`'~= <____|' ^^`'~=-.,__,.-=
      ~`'^`'~=-.,__,.-=~'`^`'~=-.,__,.-=~'`^`'~=-.,__,.-==--^'~=-.,__,.-=~'`^`
    • David Bustos
      ... The problem lies in cs_print_matches_priv, in if_cscope.c. The function decides which matches are in the current buffer so it can print them first. As it
      Message 2 of 3 , Sep 10, 2000
      • 0 Attachment
        On Sat, Sep 09, 2000 at 01:24:20PM -0500, brian wrote:
        > When I do a 'cs find 0 <symbol>' a list of possibilites is presented.
        > The option chosen does not necessarily become the symbol shown on the
        > screen..:) That is, I select an option that should take me to line x of
        > file 'a', but I goto line y of file 'b'. This seems odd.

        The problem lies in cs_print_matches_priv, in if_cscope.c. The function
        decides which matches are in the current buffer so it can print them first.
        As it doesn't test for absolute paths, it doesn't work when the prepend
        path option is used. So the matches are not printed in "sorted" order.
        However, when you go to choose a match, the matches *are* "sorted", so you
        jump to the wrong match. The following patch will fix that. (It is
        against 6.0g, but with the context it should patch the other versions,
        too.)

        --- - Sun Sep 10 16:41:35 2000
        +++ vim60g/src/if_cscope.c Sun Sep 10 16:27:36 2000
        @@ -1446,15 +1446,18 @@
        if (curbuf->b_fname != NULL)
        {
        char *f;
        - int len;
        + int fname_len, ffname_len;
        +
        + fname_len = strlen((const char *)(curbuf->b_fname));
        + ffname_len = strlen((const char *)(curbuf->b_ffname));

        - len = strlen((const char *)(curbuf->b_fname));
        for (i = 0; i < num_matches; i++)
        {
        if ((f = strchr(matches[i], '\t')) != NULL)
        {
        f++;
        - if (strncmp((const char *)(curbuf->b_fname), f, len) == 0)
        + if (strncmp((const char *)(curbuf->b_fname), f, fname_len) == 0
        + || strncmp((const char *)(curbuf->b_ffname), f, ffname_len) == 0)
        in_cur_file[i] = TRUE;
        }
        }


        David Bustos
      • Bram Moolenaar
        Brian - In an old message from you, you mention a problem with using cscope. I wonder if this problem still exists. Especially in Vim 6.0am (still in alpha
        Message 3 of 3 , Jul 2, 2001
        • 0 Attachment
          Brian -

          In an old message from you, you mention a problem with using cscope. I wonder
          if this problem still exists. Especially in Vim 6.0am (still in alpha
          testing).

          > I am having a problem with cscope and vim. I am using cscope / vim with
          > the "prepend path" option.
          >
          > When I do a 'cs find 0 <symbol>' a list of possibilites is presented.
          > The option chosen does not necessarily become the symbol shown on the
          > screen..:) That is, I select an option that should take me to line x of
          > file 'a', but I goto line y of file 'b'. This seems odd.

          - Bram

          --
          hundred-and-one symptoms of being an internet addict:
          84. Books in your bookcase bear the names Bongo, WinSock and Inside OLE

          /// Bram Moolenaar -- Bram@... -- http://www.moolenaar.net \\\
          ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim )))
          \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///
        Your message has been successfully submitted and would be delivered to recipients shortly.