Author Topic: How to retrieve line of a reference  (Read 2618 times)

cguillemette

  • New Community Member
  • Posts: 1
  • Hero Points: 0
How to retrieve line of a reference
« on: January 26, 2010, 01:24:22 pm »
Hi!

With the SlickEdit API we are attempting to retrieve the line where a reference is found.

Here's the most simplified code to retrieve a reference and its line.
The problem is the line number is always 0.
What am I doing wrong?

Note: I did another code to retrieve symbols and lines and it worked.

Code: [Select]
#include <stdio.h>

#include <vsapi.h>

int main(int argv, char** argc)
{
if (argv != 3)
{
printf("Usage: FindVsTagRef <tagdb_file.vtg> <tag>\n");
return 1;
}

if (tag_read_db(argc[1]) != 0)
{
printf("Problem openning tag DB %s\n", argc[0]);
return 1;
}

VSHVAR FileName = vsHvarAlloc();
VSHVAR Word = vsHvarAlloc();

if (tag_find_occurrence(argc[2]) == 0)
{
do
{
tag_get_occurrence(Word, FileName);

      VSHVAR Line = vsHvarAlloc();
      tag_get_detail(VS_TAGDETAIL_file_line, Line);

const char* f = vsHvarGetZ(FileName);
const char* l = vsHvarGetZ(Line);
      printf("%s:%s\n", f, l);


} while (tag_next_occurrence(argc[2]) == 0);
}

vsHvarFree(FileName);
vsHvarFree(Word);

tag_close_db();

return 0;
}

Any help is appreciated!
Thanks
« Last Edit: February 10, 2010, 06:43:44 pm by cguillemette »