Page 1 of 1

I have hacked ctags58 to support macros preprocessing

Posted: Sat Feb 04, 2012 6:05 pm
by fanhe0513
Hi, as title, I have done. Also added "text" and "template" field of tag entry. Have not modify pattern field.

test code

Code: Select all

// your compiler really, really wants main() to be in your main program (e.g.
// hello.cpp). Now IMPLEMENT_APP should add this code if required.

#define IMPLEMENT_WXWIN_MAIN_CONSOLE \
        int main(int argc, char **argv) { return wxEntry(argc, argv); }

// port-specific header could have defined it already in some special way
#ifndef IMPLEMENT_WXWIN_MAIN
    #define IMPLEMENT_WXWIN_MAIN IMPLEMENT_WXWIN_MAIN_CONSOLE
#endif // defined(IMPLEMENT_WXWIN_MAIN)

#ifdef __WXUNIVERSAL__
    #include "wx/univ/theme.h"

    #ifdef wxUNIV_DEFAULT_THEME
        #define IMPLEMENT_WX_THEME_SUPPORT \
            WX_USE_THEME(wxUNIV_DEFAULT_THEME);
    #else
        #define IMPLEMENT_WX_THEME_SUPPORT
    #endif
#else
    #define IMPLEMENT_WX_THEME_SUPPORT
#endif

// Use this macro if you want to define your own main() or WinMain() function
// and call wxEntry() from there.
#define IMPLEMENT_APP_NO_MAIN(appname)                                      \
    wxAppConsole *wxCreateApp()                                             \
    {                                                                       \
        wxAppConsole::CheckBuildOptions(WX_BUILD_OPTIONS_SIGNATURE,         \
                                        "your program");                    \
        return new appname;                                                 \
    }                                                                       \
    wxAppInitializer                                                        \
        wxTheAppInitializer((wxAppInitializerFunction) wxCreateApp);        \
    DECLARE_APP(appname)                                                    \
    appname& wxGetApp() { return *wx_static_cast(appname*, wxApp::GetInstance()); }

// Same as IMPLEMENT_APP() normally but doesn't include themes support in
// wxUniversal builds
#define IMPLEMENT_APP_NO_THEMES(appname)    \
    IMPLEMENT_APP_NO_MAIN(appname)          \
    IMPLEMENT_WXWIN_MAIN

// Use this macro exactly once, the argument is the name of the wxApp-derived
// class which is the class of your application.
#define IMPLEMENT_APP(appname)              \
    IMPLEMENT_APP_NO_THEMES(appname)        \
    IMPLEMENT_WX_THEME_SUPPORT

// Same as IMPLEMENT_APP(), but for console applications.
#define IMPLEMENT_APP_CONSOLE(appname)      \
    IMPLEMENT_APP_NO_MAIN(appname)          \
    IMPLEMENT_WXWIN_MAIN_CONSOLE

// this macro can be used multiple times and just allows you to use wxGetApp()
// function
#define DECLARE_APP(appname) extern appname& wxGetApp();

IMPLEMENT_APP(App);
ctags58md is debug version. Need libqalculate.
ctags58m is release version.
Tested on Ubuntu 10.04.

If you are interested in it, let me know and I will send you the source code. :P

Usage:

Code: Select all

./ctags58md --excmd=pattern --sort=no --fields=aKmSsnit --c-kinds=+p --C++-kinds=+p -f TAGS {file}

PS. In case "#if" preprocessor, it lacks a c integer expression evaluator. I have not found a c library for it. Currently I prefer libqalculate, but it depends to many other libraries. So in release version, I just use atoi() function. :P