Author Topic: Find a C++ prototype from a Slick-C macro  (Read 4745 times)

gary_ash

  • Guest
Find a C++ prototype from a Slick-C macro
« on: August 04, 2006, 03:35:55 pm »
Hi,

I'm trying to right a C++ utility macro and I'm having a hard time with the tagging support functions
I'm trying to find function prototypes, using the tagging system, given function names, class names etc can anybody give an example?

Thanks

Gary

Dennis

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 2706
  • Hero Points: 413
Re: Find a C++ prototype from a Slick-C macro
« Reply #1 on: September 22, 2006, 01:49:32 pm »
This is a sketch, read the docs for the details on how to use each function.  There are many other "tag_" functions you could use (see the reference documentation), depending on exactly what you are trying to do, the scope of your search, etc.  tag_match_symbol_in_context() is the most general purpose and powerful.  Pay careful attention to how you put together "class_name", it needs to be normalized if it is nested, see tag_insert_tag().

Another complete command you should look at is "implement_protos".  Usually when someone is trying to find function prototypes, they are thinking they want to generate function stubs.  "implement_protos" does that (only a little clumsy, that why it is not advertised).
Code: [Select]
    int status = tag_match_symbol_in_context(
                         function_name, search_class,
                         0, 0, tags_filenamea(p_extension),
                         num_matches, max_matches,
                         VS_TAGFILTER_PROTO, VS_TAGCONTEXT_ANYTHING,
                         true, true, true, false, true
                         );
    int i, n = tag_get_num_of_matches();
    for ( i = 1; i <= n; ++i ) {
       VS_TAG_BROWSE_INFO cm;
       tag_get_match_info(i, cm);
       // cm now has everything you need to know about this prototype
    }

gary_ash

  • Guest
Re: Find a C++ prototype from a Slick-C macro
« Reply #2 on: September 22, 2006, 03:11:53 pm »
Thanks this is the missing bit for a few ideas I've had.