Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => CodeCompletion redesign => Topic started by: ollydbg on February 23, 2009, 02:14:18 pm

Title: Solved parsing Opencv pre-function macros
Post by: ollydbg on February 23, 2009, 02:14:18 pm
Once I have post this message CodeCompletion can't recognize OpenCV function prototype  (http://forums.codeblocks.org/index.php/topic,10138.msg70057.html#msg70057). Now, after reading the CodeCompletion source code and do a lot debugging, I have get an answer to solve this problem.

Here is the patch

Code
Index: src/plugins/codecompletion/parser/parserthread.cpp
===================================================================
--- src/plugins/codecompletion/parser/parserthread.cpp (revision 5469)
+++ src/plugins/codecompletion/parser/parserthread.cpp (working copy)
@@ -593,7 +593,8 @@
                     (!m_pLastParent || m_pLastParent->m_Name != token)) // if func has same name as current scope (class)
                 {
                     m_Str.Clear();
-                    m_Tokenizer.GetToken(); // eat args ()
+                    wxString arg = m_Tokenizer.GetToken(); // eat args ()
+                    m_Str= arg.Mid(1,arg.Len()-2);
                 }
                 else if (peek.GetChar(0) == '(' && m_Options.handleFunctions)
                 {


For example. These is the code
Code
CVAPI(IplImage*) cvLoadImage( const char* filename, int iscolor CV_DEFAULT(CV_LOAD_IMAGE_COLOR));
m_Str = _T("IplImage*") in this situation, so, this became the function type.

By the way, at first, I want use m_Str = "CVAPI(IplImage*)" as the function type. But unluckily, this string can't be correctly recorded, I'm not sure why? :(


Also, you can see the screen shot


[attachment deleted by admin]
Title: Re: Solved parsing Opencv pre-function macros
Post by: killerbot on February 23, 2009, 03:44:06 pm
please also create a patch for this in our patch tracker at berlios. In the forum things can get out of sight too soon ;-)
Title: Re: Solved parsing Opencv pre-function macros
Post by: ollydbg on February 23, 2009, 04:07:31 pm
Done! :D This is my first open source activity. Thanks!