Code::Blocks
July 29, 2010, 06:06:47 pm *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: New release 10.05 is ready. Grab it while it's hot!!!
 
   Home   Help Search Login Register  :: WebsiteWiki  
Pages: [1] 2 3 ... 8
  Send this topic  |  Print  
Author Topic: vector<int> is OK, but string or wstring no-work.  (Read 7755 times)
Loaden
Regular
***
Posts: 464



« on: January 06, 2010, 05:39:50 am »

Hello, everyone! I compiled SVN6056 version, and do not use already existing default.conf, but by the CB to generate a new configuration file.
After I found: vector <int> can already be a normal CB resolved, but the string and wstring not be resolved CB. As shown in the following code: there is no intelligence tips.
Code:
#include <iostream>
#include <string>

int main()
{
    std::string s;
    s.
    return 0;
}

Code:
#include <iostream>
#include <string>

using namespace std;

int main()
{
    string s;
    s.
    return 0;
}

« Last Edit: January 06, 2010, 05:42:13 am by Loaden » Logged

Arch & XP -|- GCC & VC  -|- Code::Blocks SVN Latest
------------------------------------------
Index for my patches
Loaden
Regular
***
Posts: 464



« Reply #1 on: January 06, 2010, 05:46:27 am »

but if i use this code, it's work!
Code:
#include <iostream>
#include <string>

using namespace std;

int main()
{
    basic_string<char> s;
    s.
    return 0;
}

but if use wchar_t, it's no-work too.
Code:
#include <iostream>
#include <string>

using namespace std;

int main()
{
    basic_string<wchar_t> ws;
    ws.
    return 0;
}

Logged

Arch & XP -|- GCC & VC  -|- Code::Blocks SVN Latest
------------------------------------------
Index for my patches
Loaden
Regular
***
Posts: 464



« Reply #2 on: January 06, 2010, 05:49:51 am »

but this code is work fine.
Code:
#include <iostream>
#include <string>

int main()
{
    std::basic_string<char> s;
    s.
    return 0;
}
Logged

Arch & XP -|- GCC & VC  -|- Code::Blocks SVN Latest
------------------------------------------
Index for my patches
blueshake
Regular
***
Posts: 433



« Reply #3 on: January 06, 2010, 06:03:44 am »

the string's ancestor is lost.that is why it can not work.



Note:it work in svn 5986.
« Last Edit: January 06, 2010, 06:26:47 am by blueshake » Logged

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?
MortenMacFly
Administrator
Lives here!
*****
Posts: 4593



WWW
« Reply #4 on: January 06, 2010, 08:23:08 am »

the string's ancestor is lost.that is why it can not work.
I don't thinks that's the reason. In fact I think I found it.

I've submitted some minor enhancements to debug SmartSense.
If you do exactly the following (with this code base):
0.) Open C::B with debug log enabled
1.) Open the CC testing project
2.) Activate the STL project
3.) Open the stl.cpp file
4.) Uncomment the "s." line (do not save!)
5.) Go to the symbols browser, enable SmartSense
6.) Clear the Debug log
7.) After the "s." try CTRL+SPACE (CC kicks in)
8.) Notice this output in the debug log:

FindCurrentFunctionStart() Looking for tokens in 'C:\Devel\CodeBlocks\src\plugins\codecompletion\testing\stl.cpp'
FindCurrentFunctionStart() Found 1 results
FindCurrentFunctionStart() (Next) Iteration...
FindCurrentFunctionStart() Iterating: tN='int main(void)', tF='C:\Devel\CodeBlocks\src\plugins\codecompletion\testing\duplicate_header.cpp', tStart=52, tEnd=117
FindCurrentFunctionStart() Function out of bounds: tN='int main(void)', tF='C:\Devel\CodeBlocks\src\plugins\codecompletion\testing\duplicate_header.cpp', tStart=52, tEnd=117, line=9 (size_t)line=9
FindCurrentFunctionStart() Can't determine current function...

You will realise that the token returned does not match in the file name even though FindTokensInFile was given the right file name. The result: The function bounds check will fail and thus CC cannot code complete (no matter if it's string or vector or alike).

blueshake: I believe this is related to the "real time parse" where probably some false file information is passed... Could that be? Can you please try SVN trunk?
Logged

Logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
Compiling help
Debugging help
Portable C::B
blueshake
Regular
***
Posts: 433



« Reply #5 on: January 06, 2010, 12:06:23 pm »

Quote
blueshake: I believe this is related to the "real time parse" where probably some false file information is passed... Could that be? Can you please try SVN trunk?

ok,i will try it.but I just pass the filename .nothing more.

and see the string information in svn 5986 and svn 6056.see the screen shot.

« Last Edit: January 06, 2010, 12:12:15 pm by blueshake » Logged

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?
blueshake
Regular
***
Posts: 433



« Reply #6 on: January 06, 2010, 12:23:31 pm »

um,it seems something relatived to the files.

in svn 6056(which not work),the debug log output:only 141 files are parsed.

Quote
Parsing stage done (141 total parsed files, 28885 tokens in 0 minute(s), 1.781 seconds).


in svn 5986(which work,I have apply the real-time parser in my local copy with this svn version),the debug log output:164 files are parsed.

Quote
Parsing stage done (164 total parsed files, 30028 tokens in 0 minute(s), 1.985 seconds).

Logged

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?
MortenMacFly
Administrator
Lives here!
*****
Posts: 4593



WWW
« Reply #7 on: January 06, 2010, 12:23:34 pm »

and see the string information in svn 5986 and svn 6056.see the screen shot.
Hmmm... weird. So it could also e related to OllyDbg's modifications for the typedef handling. Because it's in fact a typedef.
Logged

Logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
Compiling help
Debugging help
Portable C::B
blueshake
Regular
***
Posts: 433



« Reply #8 on: January 06, 2010, 12:34:16 pm »

mention to typedef ,but these codes work fine.
Code:
#include <iostream>

using namespace std;
class qq
{
    int x;
    int y;
};
typedef qq pp;
typedef pp tt;

int main()
{
    cout << "Hello world!" << endl;
    return 0;
}

see the attachmet.
Logged

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?
MortenMacFly
Administrator
Lives here!
*****
Posts: 4593



WWW
« Reply #9 on: January 06, 2010, 01:01:49 pm »

Quote
Parsing stage done (141 total parsed files, 28885 tokens in 0 minute(s), 1.781 seconds).
Quote
Parsing stage done (164 total parsed files, 30028 tokens in 0 minute(s), 1.985 seconds).
Hmmm... could you do me a favour and try r6044 versus r6045? r6044 should still work. The modifications between r5986 and r6044 should not matter.
Logged

Logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
Compiling help
Debugging help
Portable C::B
blueshake
Regular
***
Posts: 433



« Reply #10 on: January 06, 2010, 01:19:01 pm »

Quote
Parsing stage done (141 total parsed files, 28885 tokens in 0 minute(s), 1.781 seconds).
Quote
Parsing stage done (164 total parsed files, 30028 tokens in 0 minute(s), 1.985 seconds).
Hmmm... could you do me a favour and try r6044 versus r6045? r6044 should still work. The modifications between r5986 and r6044 should not matter.

It is a shame to say that I don't know how to do it.

and I turn the real-time parse off in latest svn with nothing changed.

the issue still exist.so I think there is something wrong with parserthread.


I found a big problem.
try these codes.

Code:
#include <iostream>

using namespace std;
class qq
{
    int x;
    int y;
};
typedef qq pp;
typedef pp tt;
tt cc;//



int main()
{
    cout << "Hello world!" << endl;
    return 0;
}


follow the steps below:
-save the codes in cb
-close the cb application.
-restart the cb ----------------at this point .the parser work fine.
-add any codes below tt cc;//-----------------then the variable can not be parsed correctly.there is no any variable in the symboltree.
Logged

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?
MortenMacFly
Administrator
Lives here!
*****
Posts: 4593



WWW
« Reply #11 on: January 06, 2010, 02:27:20 pm »

the issue still exist.so I think there is something wrong with parserthread.
OK - after some tests it's definitely related to:
http://forums.codeblocks.org/index.php/topic,11754.msg79756.html#msg79756

Stage management is not working as before. OllyDbg?!
Logged

Logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
Compiling help
Debugging help
Portable C::B
ollydbg
Lives here!
****
Posts: 1484


Interests on OpenCV and Robotics


WWW
« Reply #12 on: January 06, 2010, 02:34:09 pm »

the issue still exist.so I think there is something wrong with parserthread.
OK - after some tests it's definitely related to:
http://forums.codeblocks.org/index.php/topic,11754.msg79756.html#msg79756

I will check this bug. It seems the preprocessor of "include" statement is not correct.

Quote
Stage management is not working as before. OllyDbg?!
what does "stage management" means???
« Last Edit: January 06, 2010, 02:36:20 pm by ollydbg » Logged

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.
MortenMacFly
Administrator
Lives here!
*****
Posts: 4593



WWW
« Reply #13 on: January 06, 2010, 02:47:09 pm »

Quote
Stage management is not working as before. OllyDbg?!
what does "stage management" means???
It meant the modifications you did with Tokenizer state (introducing the enum TokenizerState).
For example (void ParserThread::DoParse()):
Before:
Code:
       else if (token==ParserConsts::kw_operator)
        {
            bool oldState = m_Tokenizer.IsSkippingUnwantedTokens();
            m_Tokenizer.SetSkipUnwantedTokens(false);
            m_Tokenizer.SetOperatorState(true);
After:
Code:
           TokenizerState oldState = m_Tokenizer.GetState();
            m_Tokenizer.SetState(tsSkipNone);

...or (void ParserThread::HandleClass(EClassType ct, const wxString& templateArgs)):
Before:
Code:
    // don't forget to reset that if you add any early exit condition!
    bool oldState = m_Tokenizer.IsSkippingUnwantedTokens();
    m_Tokenizer.SetSkipUnwantedTokens(false);
After:
Code:
    // don't forget to reset that if you add any early exit condition!
    TokenizerState oldState = m_Tokenizer.GetState();
    m_Tokenizer.SetState(tsSkipUnWanted);

This might be a mistake...?!
« Last Edit: January 06, 2010, 02:48:56 pm by MortenMacFly » Logged

Logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
Compiling help
Debugging help
Portable C::B
ollydbg
Lives here!
****
Posts: 1484


Interests on OpenCV and Robotics


WWW
« Reply #14 on: January 06, 2010, 03:06:06 pm »

Ok, let's explain some thing about introduce a "state" variable in the Tokenizer.
There are several reasons:

1, Before that, Tokenizer use a bool variable SkipUnWanted to determine where the Tokenizer need to skip some statement like  assignment "=" or array subscirpt "[]".

2, Angle Brace is a single token return from the Tokenizer::GetToken or Tokenizer::PeekToken.
But when we want to read the template argument. like the code below:
Code:
template < XXXX >
class AAA{
...
}

I would perfer the Tokenizer return the whole string < XXXX >

3,When we are entering some context, we should save the context state.
Before:
Code:
bool oldState = m_Tokenizer.IsSkippingUnwantedTokens();
            m_Tokenizer.SetSkipUnwantedTokens(false);
            m_Tokenizer.SetOperatorState(true);
            

Do some parsing..


            m_Tokenizer.SetSkipUnwantedTokens(oldState);

But I think a bool variable is not enough to describe all the context, so ,I use a more flexiable enum variable.

The benifit is that Currently, CC is only a partily parser, which means some statements are skiped( currently, the member function body is skiped, the statement in the right side of an assignment is skiped too). But for the long run, I think add a state is convient Very Happy
« Last Edit: January 06, 2010, 03:10:48 pm by ollydbg » Logged

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.
Pages: [1] 2 3 ... 8
  Send this topic  |  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC Valid XHTML 1.0! Valid CSS!