News:

Accounts with zero posts and zero activity during the last months will be deleted periodically to fight SPAM!

Main Menu

Adding not-included header files to code completition

Started by aXyde, October 13, 2009, 10:09:13 PM

Previous topic - Next topic

aXyde

Hi,

is there a way to add stuff from header files that are not really added inside the code to the code completition feature (the thing when u push strg + space)?

Example: if you use the glut framework you only want to do "#include <GL/glut.h>" and not "#include <GL/gl.h> #include <GL/glu.h>" but I still want to have those GL-functions inside my code completition.

ollydbg

Quote from: aXyde on October 13, 2009, 10:09:13 PM
Hi,

is there a way to add stuff from header files that are not really added inside the code to the code completition feature (the thing when u push strg + space)?

Example: if you use the glut framework you only want to do "#include <GL/glut.h>" and not "#include <GL/gl.h> #include <GL/glu.h>" but I still want to have those GL-functions inside my code completition.

Hi, I'm not sure if GL/glut.h is internally include gl.h and glu.h, if it is true, then all the headers will be automatically parsed by CodeCompletion. That's because CC will do the include file expansion. :D

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.

aXyde

Quote from: ollydbg on October 14, 2009, 03:06:06 AMHi, I'm not sure if GL/glut.h is internally include gl.h and glu.h, if it is true, then all the headers will be automatically parsed by CodeCompletion. That's because CC will do the include file expansion. :D

Well i'm using some framework similar to glut, its called glfw but I chose glut for my example because its more popular. And all my GL code runs flawlessly without including gl or glu. So i guess C::B does not to this "include file expansion", is there a way to turn it on/off? Or maybe it just doesn't parse includes that are inside a preprocessor condition.

blueshake

QuoteOr maybe it just doesn't parse includes that are inside a preprocessor condition.

#if
#else
is not supported.
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 October 14, 2009, 12:38:39 PM
#if
#else
is not supported.

From the source code of parserthrerad.cpp

void ParserThread::HandlePreprocessorBlocks(const wxString& preproc)
{
    if (preproc.StartsWith(ParserConsts::kw_if)) // #if, #ifdef, #ifndef
    {
        wxString token = preproc;
        ++m_PreprocessorIfCount;

        token = m_Tokenizer.GetToken();
        if (token.IsSameAs(_T("0")))
        {
            // TODO: handle special case "#if 0"
            TRACE(_T("HandlePreprocessorBlocks() : Special case \"#if 0\" not skipped."));
        }
        m_Tokenizer.SkipToEOL();
    }
    else if (preproc==ParserConsts::kw_else || preproc==ParserConsts::kw_elif) // #else, #elif
    {
        TRACE(_T("HandlePreprocessorBlocks() : Saving nesting level: %d"), m_Tokenizer.GetNestingLevel());
        m_Tokenizer.SaveNestingLevel();
        wxString token = preproc;
        while (!token.IsEmpty() && token != ParserConsts::kw_endif)
            token = m_Tokenizer.GetToken();
        --m_PreprocessorIfCount;
#if PARSERTHREAD_DEBUG_OUTPUT
        int l = m_Tokenizer.GetNestingLevel();
#endif
        m_Tokenizer.RestoreNestingLevel();
        TRACE(_T("HandlePreprocessorBlocks() : Restoring nesting level: %d (was %d)"), m_Tokenizer.GetNestingLevel(), l);
    }
    else if (preproc==ParserConsts::kw_endif) // #endif
        --m_PreprocessorIfCount;
}


only #if is treated, and #else is omitted.
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.