News:

As usual while waiting for the next release - don't forget to check the nightly builds in the forum.

Main Menu

vector<int> is OK, but string or wstring no-work.

Started by Loaden, January 06, 2010, 05:39:50 AM

Previous topic - Next topic

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.

blueshake

hi,I encouter that the parser can not parse in real-time even I enable "parse while typing".

edit:
     update to the latest svn without any change.
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?

ollydbg

Quote from: blueshake on January 14, 2010, 03:10:21 AM
hi,I encouter that the parser can not parse in real-time even I enable "parse while typing".

edit:
     update to the latest svn without any change.

Yes, I can confirm this bug.
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.

blueshake

the reason is simple.
the variable needParse's scope is function scope.when it (needParse) leave the functioin body.it will be destroyed.so it will be false again when the carect is in different line.
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?

Loaden

Quote from: ollydbg on January 14, 2010, 02:09:35 AM
Quote from: Loaden on January 13, 2010, 02:24:59 PM
Oh, look this screenshot.
#include <iostream>
#include <string>

using namespace std;

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

@Loaden
This works fine here, rev 6083.
You can see the screen shot below:

If you drag the scroll bar prompt window, you will find many non-basic_string <T> function, it seems from iostream.


[attachment deleted by admin]

Loaden


blueshake

QuoteIf you drag the scroll bar prompt window, you will find many non-basic_string <T> function, it seems from iostream.


you can not use variable name ws here.because it has been defined in istream.tcc which belong to gcc files.


Note:

try another name e.g. wsss,you will get the answer.
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?

ollydbg

Quote from: blueshake on January 14, 2010, 06:18:32 AM
QuoteIf you drag the scroll bar prompt window, you will find many non-basic_string <T> function, it seems from iostream.


you can not use variable name ws here.because it has been defined in istream.tcc which belong to gcc files.


Note:

try another name e.g. wsss,you will get the answer.

Good! So, this is not a problem. :wink:
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.

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.

Loaden

Quote from: ollydbg on January 14, 2010, 06:38:29 AM
Quote from: blueshake on January 14, 2010, 06:18:32 AM
QuoteIf you drag the scroll bar prompt window, you will find many non-basic_string <T> function, it seems from iostream.


you can not use variable name ws here.because it has been defined in istream.tcc which belong to gcc files.


Note:

try another name e.g. wsss,you will get the answer.

Good! So, this is not a problem. :wink:
Confirm it! Thanks!
Below code works fine.
#include <iostream>
#include <string>

int main()
{
    std::wstring ws;
    ws.
    return 0;
}

MortenMacFly

Quote from: blueshake on January 14, 2010, 03:59:41 AM
the reason is simple.
the variable needParse's scope is function scope.when it (needParse) leave the functioin body.it will be destroyed.so it will be false again when the carect is in different line.
I don't get it. m_NeedReparse was used just there. So what's wrong with this piece of code:

    Parser* parser = m_NativeParser.GetParserPtr();
    bool needReparse = false;
    if (   parser && parser->Options().whileTyping
        && (   (event.GetModificationType() & wxSCI_MOD_INSERTTEXT)
            || (event.GetModificationType() & wxSCI_MOD_DELETETEXT) ) )
    {
        needReparse = true;
    }
    if (control->GetCurrentLine() != m_CurrentLine)
    {
        if (parser && needReparse)
            parser->Reparse(editor->GetFilename());
        else
            FindFunctionAndUpdate(control->GetCurrentLine());
    }

It will trigger the re-parse correctly in the case a parser is present, the option is enabled and a char was inserted/deleted.

So...?! (I am a bit sick, so probably you should explain slowly... ;-)).
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

MortenMacFly

Quote from: ollydbg on January 14, 2010, 06:46:52 AM
@morten
This is a big bug, should be fixed soon.
Re: The 12 January 2010 build (6080) is out.
Done in my local copy. Will commit in a while... probably after blueshake answered the other question which may require some modifications, too.
Compiler logging: Settings->Compiler & Debugger->tab "Other"->Compiler logging="Full command line"
C::B Manual: [url="https://www.codeblocks.org/docs/main_codeblocks_en.html"]https://www.codeblocks.org/docs/main_codeblocks_en.html[/url]
C::B FAQ: [url="https://wiki.codeblocks.org/index.php?title=FAQ"]https://wiki.codeblocks.org/index.php?title=FAQ[/url]

blueshake

QuoteI don't get it. m_NeedReparse was used just there. So what's wrong with this piece of code:


see the codes below,in the new codes,it declare a new variable needReparse ,not m_NeedReparse.
   Parser* parser = m_NativeParser.GetParserPtr();
    bool needReparse = false;
    if (   parser && parser->Options().whileTyping
        && (   (event.GetModificationType() & wxSCI_MOD_INSERTTEXT)
            || (event.GetModificationType() & wxSCI_MOD_DELETETEXT) ) )
    {
        needReparse = true;
    }
    if (control->GetCurrentLine() != m_CurrentLine)
    {
        if (parser && needReparse)
            parser->Reparse(editor->GetFilename());
        else
            FindFunctionAndUpdate(control->GetCurrentLine());
    }
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

#73
maybe this will help a little.
Index: src/plugins/codecompletion/codecompletion.cpp
===================================================================
--- src/plugins/codecompletion/codecompletion.cpp (revision 6083)
+++ src/plugins/codecompletion/codecompletion.cpp (working copy)
@@ -2085,17 +2085,24 @@
    }

    Parser* parser = m_NativeParser.GetParserPtr();
-    bool needReparse = false;
+    //bool needReparse = false;
    if (   parser && parser->Options().whileTyping
        && (   (event.GetModificationType() & wxSCI_MOD_INSERTTEXT)
            || (event.GetModificationType() & wxSCI_MOD_DELETETEXT) ) )
    {
-        needReparse = true;
+        //needReparse = true;
+        m_NeedReparse = true;
    }
    if (control->GetCurrentLine() != m_CurrentLine)
    {
-        if (parser && needReparse)
-            parser->Reparse(editor->GetFilename());
+
+        if (parser && m_NeedReparse)
+           {
+               m_NeedReparse = false;
+               parser->Reparse(editor->GetFilename());
+           }
        else
            FindFunctionAndUpdate(control->GetCurrentLine());
    }
Index: src/plugins/codecompletion/codecompletion.h
===================================================================
--- src/plugins/codecompletion/codecompletion.h (revision 6083)
+++ src/plugins/codecompletion/codecompletion.h (working copy)
@@ -135,7 +135,7 @@
        int                                m_ActiveCalltipsNest;

        bool                               m_IsAutoPopup;
-
+        bool                                m_NeedReparse;
        wxChoice*                          m_Function;
        wxChoice*                          m_Scope;
        FunctionsScopeVec                  m_FunctionsScope;



NOTE:

the patch is used to show what changed(or explain what I try to say.please do not apply it)
:wink:
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?

Jenna

To make it clear, why the current code does not work:

needReparse is set to true whenever text is inserted or deleted, but the reparsing is only triggered if we leave the current line.
This does normally (never ?) happen inside the same event, so we have to remember whether a reparse is needed, either with a member-variable or a static local variable.