SlickEdit Community

SlickEdit Product Discussion => SlickEditĀ® => Slick-CĀ® Macro Programming => Topic started by: Alexs on February 15, 2009, 05:54:15 pm

Title: context and tags definition question
Post by: Alexs on February 15, 2009, 05:54:15 pm

I am trying to write a macro that will expand a current capabilities of Doxygen comment style present in VS.
In cases like function definitions or declarations I actually simulate default vs. behavior, since it is perfect for my needs. However when it comes to enumerations, structures, classes, defines slick edit is not providing any support. May be in future versions it will.

While going through SlickC API and code examples in forum, I saw that there are quite always two steps that are performed while parsing a code:
1. Current or nearest context is obtained using tag_get_current_context() and tag_nearest_context() correspondingly. These are actually returns context ids.
2. tag information is obtained from different query APIs like tag_get_detail2()

I must admit that I am new to Slick-C and I feel that I miss a very basic understanding of a following topics:
1. what is a definition of a context, when I obtain a context id - what does it mean for me?
2. what is a definition of a tag? How it is relates to context?

Actually I tried to find information in manuals, but unsuccessfully. If I missed it, please don't hesitate just to point where to look, however a direct explanation will be great.

Title: Re: context and tags definition question
Post by: hs2 on February 15, 2009, 09:02:14 pm
From Dennis (SE team)
The context is the set of global symbols and statements in the current file.
We have a MRU ring of contexts, containing the symbol information for the
most recently visited files.  Though we have this ring for caching, you can
think of the current context as matching the lifetime of the buffer.

The context id is an index within all enumerated tags in the current context.
It means nothing to you - it's only used as 'handle' with related tagging functions.
A 'tag' is a symbol or an item that the SE tagging engine has found in your sources.

You'll find information by looking at the appr. macro sources and reading the code docs of e.g. the tagging functions.
The docs already cover a lot of macro programmig stuff and not that much users really do macro programming.
And only a few of them use the tagging API (I think). That might be the reason, why this topic is not part of the docs yet.

Good luck,