News:

When registered with our forums, feel free to send a "here I am" post here to differ human beings from SPAM bots.

Main Menu

Solved parsing Opencv pre-function macros

Started by ollydbg, February 23, 2009, 02:14:18 PM

Previous topic - Next topic

ollydbg

Once I have post this message CodeCompletion can't recognize OpenCV function prototype . 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


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

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]
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.

killerbot

please also create a patch for this in our patch tracker at berlios. In the forum things can get out of sight too soon ;-)

ollydbg

Done! :D This is my first open source activity. 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.