Author Topic: CC type tkMacro purpose?  (Read 8087 times)

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
CC type tkMacro purpose?
« on: April 14, 2014, 04:51:05 am »
I am unsure of what the purpose of tkMacro tokens in CC is.  However, when they show up, they tend to spam the popup:

Reducing the list to a logical set can easily be done with:
Code
Index: src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- src/plugins/codecompletion/codecompletion.cpp (revision 9752)
+++ src/plugins/codecompletion/codecompletion.cpp (working copy)
@@ -968,6 +968,9 @@
                 if (preprocessorOnly && token->m_TokenKind != tkPreprocessor)
                     continue;
 
+                if (token->m_TokenKind & tkMacro && uniqueStrings.find(token->m_Name) != uniqueStrings.end())
+                    continue; // what is a "tkMacro" ??
+
                 int iidx = m_NativeParser.GetTokenKindImage(token);
                 if (alreadyRegistered.find(iidx) == alreadyRegistered.end())
                 {

But should tkMacro tokens be included in the search results in the first place?  What are they?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: CC type tkMacro purpose?
« Reply #1 on: April 14, 2014, 06:32:02 am »
tkMacro means macro usage. (where the macros are used)
tkPreprocessor means macro definition.
I think tkMacro should be removed from the suggestion list, since there are many macros usages.

I think the "tkMacro" should be renamed to "tkMacroUsage", also, "tkPreprocessor" should be renamed to "tkMacroDefinition".
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: CC type tkMacro purpose?
« Reply #2 on: April 22, 2014, 09:30:14 am »
@Alpha:
The following 2 patches (in attachment) are what I would like to do such variable name refactoring, what's your opinion?
If no objections, I will commit them to trunk.
I think currently the CC plugin's "symbol tree" has a folder name "preprocessor" and "macro" which are quite confusing, so we need to fix them.
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.

Offline Alpha

  • Developer
  • Lives here!
  • *****
  • Posts: 1513
Re: CC type tkMacro purpose?
« Reply #3 on: April 23, 2014, 04:11:03 pm »
The following 2 patches (in attachment) are what I would like to do such variable name refactoring, what's your opinion?
I personally prefer the name changes: tkMacro -> tkMacroUse and tkPreprocessor-> tkMacroDef to avoid excess verbosity.  Other than that, I think the changes are fine.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: CC type tkMacro purpose?
« Reply #4 on: April 24, 2014, 08:07:39 am »
The following 2 patches (in attachment) are what I would like to do such variable name refactoring, what's your opinion?
I personally prefer the name changes: tkMacro -> tkMacroUse and tkPreprocessor-> tkMacroDef to avoid excess verbosity.  Other than that, I think the changes are fine.
Thanks, just follow your advice, and done in trunk rev 9757.

Now, one task left is to change the png file names associated with the new variable names, but I'm not sure git-svn can handle all those changes.  ;)

Code
preproc.png
preproc_folder.png
macro.png
macro_private.png
macro_protected.png
macro_public.png
macro_folder.png

Such as:  "preproc.png" to "macro_def.png";  "macro.png" to "macro_use.png", let me do it right now, If failed, I will report and seek help.

EDIT: image file name change is in r9758 now.
« Last Edit: April 24, 2014, 08:26:57 am by ollydbg »
If some piece of memory should be reused, turn them to variables (or const variables).
If some piece of operations should be reused, turn them to functions.
If they happened together, then turn them to classes.