Developer forums (C::B DEVELOPMENT STRICTLY!) > CodeCompletion redesign

Please help me fix it, I find the reasons!

<< < (2/4) > >>

Loaden:
I find: if the header file size more than 132KB, CC will not work!!
egg. Shlwapi.h,and CC work fine.

and if cut winuser.h from line 1 to line 8446, so, CC work fine.
Why?
need int to long long?

ollydbg:
What do you mean by "CC will not work!!"?

It seems the Parser can't recognize the function argument like this:

--- Code: ---MessageBoxA(
    __in_opt HWND hWnd,
    __in_opt LPCSTR lpText,
    __in_opt LPCSTR lpCaption,
    __in UINT uType);
--- End code ---

The related implementation was in

void ParserThread::HandleFunction(const wxString& name, bool isOperator)

So, you can exam these code carefully to see the reason. :D

MortenMacFly:

--- Quote from: ollydbg on June 01, 2009, 03:21:56 pm ---
--- Code: ---MessageBoxA(
    __in_opt HWND hWnd,
    __in_opt LPCSTR lpText,
    __in_opt LPCSTR lpCaption,
    __in UINT uType);
--- End code ---

--- End quote ---
Try replacing this "__in_opt" and alike with "empty", too... ;-) :lol: :lol: :lol:

Loaden:

--- Quote from: MortenMacFly on June 02, 2009, 08:08:11 am ---
--- Quote from: ollydbg on June 01, 2009, 03:21:56 pm ---
--- Code: ---MessageBoxA(
    __in_opt HWND hWnd,
    __in_opt LPCSTR lpText,
    __in_opt LPCSTR lpCaption,
    __in UINT uType);
--- End code ---

--- End quote ---
Try replacing this "__in_opt" and alike with "empty", too... ;-) :lol: :lol: :lol:

--- End quote ---

It does not parameters question, it is the analysis of the header file is too large, it can not be fully analyzed with CC.

ollydbg:
Hi, all.

Today, I'm thinking how to refactor the replacement function in

In Tokenizer.cpp GetToken() function

--- Code: ---    inline const wxString& ThisOrReplacement(const wxString& str) const
    {
        ConfigManagerContainer::StringToStringMap::const_iterator it = s_Replacements.find(str);
        if (it != s_Replacements.end())
            return it->second;
        return str;
    }

--- End code ---

I think this function is some kind too simple. At least, it can do a search, then a replacement.

 (I have exam the code in ctags and its manual, especially in it's code to do Macro replacement)
Here
http://ctags.sourceforge.net/ctags.html#OPERATIONAL%20DETAILS


--- Quote ---−I identifier−list

Specifies a list of identifiers which are to be specially handled while parsing C and C++ source files. This option is specifically provided to handle special cases arising through the use of preprocessor macros.

When the identifiers listed are simple identifiers, these identifiers will be ignored during parsing of the source files.

If an identifier is suffixed with a ’+’ character, ctags will also ignore any parenthesis-enclosed argument list which may immediately follow the identifier in the source files.

If two identifiers are separated with the ’=’ character, the first identifiers is replaced by the second identifiers for parsing purposes.


--- End quote ---

So, at least, we can do the same thing like in Ctags.

In the option.c of Ctags source code, there are the related codes to doing identifier replacement.


--- Code: ---/*  Determines whether or not "name" should be ignored, per the ignore list.
 */
extern boolean isIgnoreToken (
const char *const name, boolean *const pIgnoreParens,
const char **const replacement)
{
boolean result = FALSE;

if (Option.ignore != NULL)
{
const size_t nameLen = strlen (name);
unsigned int i;

if (pIgnoreParens != NULL)
*pIgnoreParens = FALSE;

for (i = 0  ;  i < stringListCount (Option.ignore)  ;  ++i)
{
vString *token = stringListItem (Option.ignore, i);

if (strncmp (vStringValue (token), name, nameLen) == 0)
{
const size_t tokenLen = vStringLength (token);

if (nameLen == tokenLen)
{
result = TRUE;
break;
}
else if (tokenLen == nameLen + 1  &&
vStringChar (token, tokenLen - 1) == '+')
{
result = TRUE;
if (pIgnoreParens != NULL)
*pIgnoreParens = TRUE;
break;
}
else if (vStringChar (token, nameLen) == '=')
{
if (replacement != NULL)
*replacement = vStringValue (token) + nameLen + 1;
break;
}
}
}
}
return result;
}

--- End code ---

Here is what we can do in our Code completion code:


--- Code: ---    inline const wxString& ThisOrReplacement(const wxString& str) const
    {
        ConfigManagerContainer::StringToStringMap::const_iterator it = s_Replacements.find(str);
        if (it != s_Replacements.end()){

            //Here we should example the "it->second"
            // if it is a "=new_token" string, the current_token should be replaced by "new_token"
            // if it is a "-" , the current string should be ignored, then we should return next token
            // if it is a "+",  the next "parenthesis-enclosed argument list" should be ignored
            // if it match any other pre-defined string grama, we will do other thing , eg, expand the current   token to two tokens...
            //......
            //return it->second;
        }
        return str;
    }

--- End code ---


Any Comments?









Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version