Author Topic: New code completion remarks/issues  (Read 157627 times)

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #120 on: October 06, 2009, 03:54:58 am »
Still can not figure out why this happened.
See the pitcture snap5,the wwwwwwwww value tip is wrong when I use tkTypedef(snap 6).
If I use tkClass,(the pic snap 7) the wwwwwwwww value tip is snap 8.

[attachment deleted by admin]
« Last Edit: October 06, 2009, 04:02:22 am by blueshake »
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #121 on: October 06, 2009, 04:00:17 am »

See the pitcture,the wwwwwwwww value tip is wrong when I use tkTypedef.
confirmed. that's still something related to the source we mentioned in this thread.

http://forums.codeblocks.org/index.php/topic,11187.msg76830.html#msg76830

I believe comment them will let the suggestion list work ok. :D
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 blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #122 on: October 06, 2009, 04:17:04 am »
It is strange.I just test the same codes in svn 5731,it worked.



Edit:


I guess maybe the BreakUpComponents function break down something.


[attachment deleted by admin]
« Last Edit: October 06, 2009, 04:20:04 am by blueshake »
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #123 on: October 06, 2009, 04:33:45 am »
It is strange.I just test the same codes in svn 5731,it worked.



Edit:


I guess maybe the BreakUpComponents function break down something.

rev 5731 is before the cc_branch is merged. I'm just viewing the log Message of "nativeparser.cpp", and have a comparison with rev5682 of nativeparser.cpp.

Edit:

Both of the rev5844 and rev 5731 give the same token, like your screen shot. so, the main bug was located in the "nativeparser.cpp" :D

« Last Edit: October 06, 2009, 04:42:47 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.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #124 on: October 06, 2009, 05:00:00 am »
what I have found is that these code:

Code: [Select]
  if (local_result.size() == 1)
    {
        int id = *local_result.begin();
        Token* token = tree->at(id);

        if (token->m_TokenKind == tkTypedef)
        {
            std::queue<ParserComponent> type_components;
            BreakUpComponents(parser, token->m_ActualType, type_components);

            while(!components.empty())
            {
                ParserComponent comp = components.front();
                components.pop();
                type_components.push(comp);
            }

#if DEBUG_CC_AI
            if (s_DebugSmartSense)
            #if wxCHECK_VERSION(2, 9, 0)
                Manager::Get()->GetLogManager()->DebugLog(F(_T("FindAIMatches() : Replacing %s to %s"), token->m_Name.wx_str(), token->m_ActualType.wx_str()));
            #else
                Manager::Get()->GetLogManager()->DebugLog(F(_T("FindAIMatches() : Replacing %s to %s"), token->m_Name.c_str(), token->m_ActualType.c_str()));
            #endif
#endif
            return FindAIMatches(parser, type_components, result, parentTokenIdx, noPartialMatch, caseSensitive, use_inheritance, kindMask, search_scope);
        }

    }


Is added from rev 5682 to rev5840 of nativeparser.cpp.

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 blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #125 on: October 06, 2009, 05:51:33 am »
I just noticed that in the codecompletion.cpp
Code: [Select]
    if (event.GetEventType() == wxEVT_SCI_CHARADDED &&
            !control->AutoCompActive()) { // not already active autocompletion

They have been changed to
Code: [Select]
    if (event.GetEventType() == wxEVT_SCI_CHARADDED)
why we do this here,what are the better things?
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #126 on: October 06, 2009, 06:03:21 am »
what I have found is that these code:

Code: [Select]
 if (local_result.size() == 1)
    {
        int id = *local_result.begin();
        Token* token = tree->at(id);

        if (token->m_TokenKind == tkTypedef)
        {
            std::queue<ParserComponent> type_components;
            BreakUpComponents(parser, token->m_ActualType, type_components);

            while(!components.empty())
            {
                ParserComponent comp = components.front();
                components.pop();
                type_components.push(comp);
            }

#if DEBUG_CC_AI
            if (s_DebugSmartSense)
            #if wxCHECK_VERSION(2, 9, 0)
                Manager::Get()->GetLogManager()->DebugLog(F(_T("FindAIMatches() : Replacing %s to %s"), token->m_Name.wx_str(), token->m_ActualType.wx_str()));
            #else
                Manager::Get()->GetLogManager()->DebugLog(F(_T("FindAIMatches() : Replacing %s to %s"), token->m_Name.c_str(), token->m_ActualType.c_str()));
            #endif
#endif
            return FindAIMatches(parser, type_components, result, parentTokenIdx, noPartialMatch, caseSensitive, use_inheritance, kindMask, search_scope);
        }

    }


Is added from rev 5682 to rev5840 of nativeparser.cpp.




Can somebody make some explanation about adding these codes here? Thanks.
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #127 on: October 06, 2009, 09:04:23 am »
I would like Morten could give some explanation on the above two reply (reply#125, reply#126).
I also have the same question. :D
Thanks.
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: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #128 on: October 06, 2009, 09:27:01 am »
Dear Morten,Jens and other devs.
In the post

http://forums.codeblocks.org/index.php/topic,11187.msg76809.html#msg76809
I would like to make the code of DebugLog more clean. Now, I have finally find the way, please see here:

we can define this macro:

Code: [Select]
#define TOKENIZER_DEBUG_OUTPUT 1

#if TOKENIZER_DEBUG_OUTPUT
    #define TRACE(format, args...)\
    Manager::Get()->GetLogManager()->DebugLog(F( format , ## args))
#else
    #define TRACE(format, args...)
#endif

So, the code can change like below:
Code: [Select]
#if TOKENIZER_DEBUG_OUTPUT
        Manager::Get()->GetLogManager()->DebugLog(F(_T("Init() : Called without filename.")));
#endif
to
Code: [Select]
TRACE(_T("Init() : Called without filename."));
Also,

Code: [Select]
#if TOKENIZER_DEBUG_OUTPUT
        Manager::Get()->GetLogManager()->DebugLog(F(_T("Init() : m_Filename='%s'"), m_Filename.c_str()));
#endif

to

Code: [Select]
TRACE(_T("Init() : m_Filename='%s'"), m_Filename.c_str());

I have already tested, and it works great! :D

I think all the DebugLog related code can change to this format, which make the code more clean. :)

Any comments? Thanks.



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 MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: New code completion remarks/issues
« Reply #129 on: October 06, 2009, 10:24:50 am »
Code: [Select]
#define TOKENIZER_DEBUG_OUTPUT 1

#if TOKENIZER_DEBUG_OUTPUT
    #define TRACE(format, args...)\
    Manager::Get()->GetLogManager()->DebugLog(F( format , ## args))
#else
    #define TRACE(format, args...)
#endif
Any comments? Thanks.
Sure this looks nice. But keep in mind that this should be in implementation files only, or rename TRACE into a more specific TRACE_NATIVEPARSER or alike. Otherwise you might define the macros also for other files (debug outputs). Patches against trunk are welcome.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: New code completion remarks/issues
« Reply #130 on: October 06, 2009, 11:01:58 am »
Guys, I've added testing projects (and a workspace) into trunk. If you find functionality to test, feel free to enhance this.

In the CC plugin folder there is now a "testing" sub-folder with a workspace called... erm... TESTING. This will open (so far) 3 projects that test a specific functionality of CC. Ifyou want to enhance this (or provide new tests), please do the following:

- create a new project named like what you are testing (missing is for example "defines", "inheritance" etc.)
- create the files needed *all* having the same prefix like the test
- if you need additional stuff, place it in a sub-folder named like the test.
- provide a main function (named like the test ;-)) and comment lines where a user should do a certain test
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline MortenMacFly

  • Administrator
  • Lives here!
  • *****
  • Posts: 9606
Re: New code completion remarks/issues
« Reply #131 on: October 06, 2009, 11:11:54 am »
I would like Morten could give some explanation on the above two reply (reply#125, reply#126).
I can't because I don't recall exactly. This code snippet was part of a patch that enabled parsing of typedefs correctly at all (it was not possible before). Probably it's obsolete now. I am testing CC without this snippet atm (you can do the same, if you like). If I don't see any issues I'll simply remove that portion.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: http://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: http://wiki.codeblocks.org/index.php?title=FAQ

Offline blueshake

  • Regular
  • ***
  • Posts: 459
Re: New code completion remarks/issues
« Reply #132 on: October 06, 2009, 01:40:57 pm »
In the thread ,http://forums.codeblocks.org/index.php/topic,11187.msg76812.html#msg76812

for the latest cc,the issue can not be solved.

I believe the std:: int the actualtype cause it.

By the way,how to insert a picture,not as a attachment. :?

[attachment deleted by admin]
Keep low and hear the sadness of little dog.
I fall in love with a girl,but I don't dare to tell her.What should I do?

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #133 on: October 06, 2009, 01:58:36 pm »
By the way,how to insert a picture,not as a attachment. :?
Google: image sharing site
Then choose one, and register an ID, and upload your image, then copy the image link, and add to your post.
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: 5277
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: New code completion remarks/issues
« Reply #134 on: October 06, 2009, 02:05:18 pm »
Code: [Select]
#define TOKENIZER_DEBUG_OUTPUT 1

#if TOKENIZER_DEBUG_OUTPUT
    #define TRACE(format, args...)\
    Manager::Get()->GetLogManager()->DebugLog(F( format , ## args))
#else
    #define TRACE(format, args...)
#endif
Any comments? Thanks.
Sure this looks nice. But keep in mind that this should be in implementation files only, or rename TRACE into a more specific TRACE_NATIVEPARSER or alike. Otherwise you might define the macros also for other files (debug outputs). Patches against trunk are welcome.

Thanks for the hint.
For now, I would prefer still useing the name "TRACE", then, add these macros in every implementation files, such as tokenizer.cpp , parserthread.cpp and nativeparser.cpp.

Patches will be uploaded soon. :D
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.