Author Topic: The 06 March 2011 build (7040) is out.  (Read 48650 times)

Offline Cubic

  • Single posting newcomer
  • *
  • Posts: 3
Re: The 06 March 2011 build (7040) is out.
« Reply #15 on: April 01, 2011, 11:01:01 pm »
Another thing I noticed: This doesn't happen the first time code completition kicks in - the first time everything works fine, it is only after you deleted a -first- comma for the first time (while the tip is being shown) it starts behaving weird.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: The 06 March 2011 build (7040) is out.
« Reply #16 on: April 02, 2011, 04:12:49 am »
If I revert the change in rev 6997 around the line 1888 in nativeparser

revert to:
Code
            if (token->GetFormattedArgs() != _T("()"))
            {
                wxString s;
                BreakUpInLines(s, token->GetFormattedArgs(), chars_per_line);
                m_CallTips.Add(s);
            }
            else if (token->m_TokenKind == tkTypedef && token->m_ActualType.Contains(_T("(")))
                m_CallTips.Add(token->m_ActualType);

then, the highlight in call tip works fine.  :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 killerbot

  • Administrator
  • Lives here!
  • *****
  • Posts: 5490
Re: The 06 March 2011 build (7040) is out.
« Reply #17 on: April 02, 2011, 07:52:18 am »
could you commit this ? Then we can include it in this weekends nightly build.

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: The 06 March 2011 build (7040) is out.
« Reply #18 on: April 02, 2011, 08:05:15 am »
could you commit this ? Then we can include it in this weekends nightly build.
?me? or other guy??? :?

PS:
forget to mention there is a patch to avoid a recursive class hierarchy search which can avoid the crash of CC.
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: 9694
Re: The 06 March 2011 build (7040) is out.
« Reply #19 on: April 02, 2011, 09:09:55 am »
could you commit this ?
Please don't. This would disable the pretty print of tokens and (even worse) would leave unused code stubs.

I think oBFusCATed should look into it. He provided the pretty print part and I believe with the research done by ollydbg he might be able to fix this in a way that we can keep the pretty printing (I am personally quite used to it meanwhile).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: https://www.codeblocks.org/docs/main_codeblocks_en.html
C::B FAQ: https://wiki.codeblocks.org/index.php?title=FAQ

Offline oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: The 06 March 2011 build (7040) is out.
« Reply #20 on: April 02, 2011, 12:55:00 pm »
Yes, I'll look at it :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: The 06 March 2011 build (7040) is out.
« Reply #21 on: April 02, 2011, 03:02:12 pm »
By reading the CC's source code these days, I just realize that "calltip" and "valuetip" are not the same thing. :D, I do not quite understand this before.

call tip is some tips showing when user were entering a function call statement, it assist the user by highlight the current function argument. call tips can fired by user adding a char, or by short cut key. it surely need to count the "commas" numbers user has already entered.

value tip is some tips that when you mouse hover an identifier, the tips contains the "type" information about the current token under mouse.

so, I think some comments which I created before in CC was wrong, I will try to fix them. :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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: The 06 March 2011 build (7040) is out.
« Reply #22 on: April 02, 2011, 07:47:13 pm »
Probably something like that should fix the bug: http://smrt.is-a-geek.org/codeblocks/patches/call_tip_highlight1.patch

The patch is tested only on a small example, so please test and report if there are problems with it.
If there are no problems in the next week, I'll commit it.  :lol:
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: The 06 March 2011 build (7040) is out.
« Reply #23 on: April 03, 2011, 08:07:58 am »
Probably something like that should fix the bug: http://smrt.is-a-geek.org/codeblocks/patches/call_tip_highlight1.patch

The patch is tested only on a small example, so please test and report if there are problems with it.
If there are no problems in the next week, I'll commit it.  :lol:
nice, one thing I should suggest is :

Code
        while (--pos > 0)
        {
            const int style = searchData.control->GetStyleAt(pos);
            if (   searchData.control->IsString(style)
                || searchData.control->IsCharacter(style)
                || searchData.control->IsComment(style) )
            {
                continue;
            }

            const wxChar ch = searchData.control->GetCharAt(pos);
            if (ch == _T(';'))
                return;

this is a "backword" search, I think it should break on a "{".

so
Code
            if (ch == _T(';')  || ch == _T('{')  )
                return;

and, for a consistent, the "(" we call open parenthesis instead of open bracket.

see: in the parserthread.cpp
Code
namespace ParserConsts
{
    const wxString space           (_T(" "));
    const wxString spaced_colon    (_T(" : "));
    const wxString empty           (_T(""));
    const wxString equals          (_T("="));
    const wxString hash            (_T("#"));
    const wxString plus            (_T("+"));
    const wxString asterisk        (_T("*"));
    const wxString comma           (_T(","));
    const wxString commaclbrace    (_T(",}"));
    const wxString dash            (_T("-"));
    const wxString dot             (_T("."));
    const wxString colon           (_T(":"));
    const wxString dcolon          (_T("::"));
    const wxString semicolon       (_T(";"));
    const wxString semicolonopbrace(_T(";{"));
    const wxString semicolonclbrace(_T(";}"));
    const wxString lt              (_T("<"));
    const wxString gt              (_T(">"));
    const wxString gtsemicolon     (_T(">;"));
    const wxString quot            (_T("\""));
    const wxString kw_C            (_T("\"C\""));
    const wxString kw_CPP          (_T("\"C++\""));
    const wxString kw__asm         (_T("__asm"));
    const wxString kw_class        (_T("class"));
    const wxString kw_const        (_T("const"));
    const wxString kw_define       (_T("define"));
    const wxString kw_undef        (_T("undef"));
    const wxString kw_delete       (_T("delete"));
    const wxString kw_do           (_T("do"));
    const wxString kw_else         (_T("else"));
    const wxString kw_enum         (_T("enum"));
    const wxString kw_extern       (_T("extern"));
    const wxString kw_for          (_T("for"));
    const wxString kw_friend       (_T("friend"));
    const wxString kw_if           (_T("if"));
    const wxString kw_elif         (_T("elif"));
    const wxString kw_include      (_T("include"));
    const wxString kw_inline       (_T("inline"));
    const wxString kw_namespace    (_T("namespace"));
    const wxString kw_operator     (_T("operator"));
    const wxString kw_private      (_T("private"));
    const wxString kw_protected    (_T("protected"));
    const wxString kw_public       (_T("public"));
    const wxString kw_return       (_T("return"));
    const wxString kw_static       (_T("static"));
    const wxString kw_struct       (_T("struct"));
    const wxString kw_switch       (_T("switch"));
    const wxString kw_template     (_T("template"));
    const wxString kw_typedef      (_T("typedef"));
    const wxString kw_typename     (_T("typename"));
    const wxString kw_union        (_T("union"));
    const wxString kw_using        (_T("using"));
    const wxString kw_virtual      (_T("virtual"));
    const wxString kw_volatile     (_T("volatile"));
    const wxString kw_while        (_T("while"));
    const wxString opbrace         (_T("{"));
    const wxString opbracesemicolon(_T("{;"));
    const wxString clbrace         (_T("}"));
    const wxString tilde           (_T("~"));
};

So, I suggest using the name "FindFunctionOpenParenthesis". :D

I just test your patch, and works flawless. great job!!!
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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: The 06 March 2011 build (7040) is out.
« Reply #24 on: April 03, 2011, 12:53:09 pm »
Ollydbg: I don't understand what you are trying to say...

I've just modified the code and tried to follow the style of the code around it...
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: The 06 March 2011 build (7040) is out.
« Reply #25 on: April 03, 2011, 02:07:23 pm »
Ollydbg: I don't understand what you are trying to say...
I mean the function name FindFunctionOpenBrace should be changed to FindFunctionOpenParenthesis.

Also, when counting the commas, it should stopped when meet a "{".
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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: The 06 March 2011 build (7040) is out.
« Reply #26 on: April 03, 2011, 02:28:13 pm »
I mean the function name FindFunctionOpenBrace should be changed to FindFunctionOpenParenthesis.
This could be done.

Also, when counting the commas, it should stopped when meet a "{".
Why? Do you have a failing test case?
I think, it would stop earlier, so the change is not needed. By the way, I've not modified this searching code, I've just removed some member variables there.

BTW: This patch will fail with a function returning a function pointer, but at the moment the CC doesn't parse such functions correctly anyway :)
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: The 06 March 2011 build (7040) is out.
« Reply #27 on: April 03, 2011, 03:35:42 pm »
Also, when counting the commas, it should stopped when meet a "{".
Why? Do you have a failing test case?
I think, it would stop earlier, so the change is not needed. By the way, I've not modified this searching code, I've just removed some member variables there.

for example:
Code
c.g();
a.f(arg0,|);
this way, the backward search will stop at the first semicolon.

for example:

Code
for(...)
{
a.f(arg0,|);
}
You see, the backward search should stop at the first open brace.

Os, the backward search should stop after a "C statement".
« Last Edit: April 03, 2011, 03:37:38 pm 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 oBFusCATed

  • Developer
  • Lives here!
  • *****
  • Posts: 13413
    • Travis build status
Re: The 06 March 2011 build (7040) is out.
« Reply #28 on: April 03, 2011, 05:06:50 pm »
I don't understand what is the problem here?
Can you show me a testcase where the code fails?
If you can't no changes to the code will be made!
(most of the time I ignore long posts)
[strangers don't send me private messages, I'll ignore them; post a topic in the forum, but first read the rules!]

Offline ollydbg

  • Developer
  • Lives here!
  • *****
  • Posts: 5910
  • OpenCV and Robotics
    • Chinese OpenCV forum moderator
Re: The 06 March 2011 build (7040) is out.
« Reply #29 on: April 04, 2011, 02:52:03 am »
I don't understand what is the problem here?
Can you show me a testcase where the code fails?
If you can't no changes to the code will be made!
I just do a research a little, and found that the "backward search" is expat started in the parentheses.
So, e.g.
Code
for(...)
{
a.f(arg0,|);
}
This way, the "backward search" will stop at the open parenthesis of the a.f(. Let's say, the "backward search" stops at an un-balanced open parenthesis. So, this works OK normally.

But what dose the code:
Code
            if (ch == _T(';'))
                return;
I suspect: In a function call statement, in the parentheses, does any one will write a ";" ?
I think these will be no semicolon there.
The semicolon is just used to stop the "backward search" in some cases to avoid the "backward search" goes too far.

So, if the code:
Code
c.g();
a.f(arg0)|

or

for(...)
{
a.f(arg0)|
}

If the user mistakenly press the short cut to show tip, then, the "backward search" can safely be stopped at the "{" or ";" to save a lot of performance. Otherwise, the "backward search" will go to an earlier and wrong place.

Any ideas?

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.