首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > C++ >

分享Code:Blocks的条件预加工模块

2013-01-02 
分享Code::Blocks的条件预处理模块本帖最后由 Loaden 于 2010-04-17 13:17:25 编辑近10天以来,我为Code::B

分享Code::Blocks的条件预处理模块
本帖最后由 Loaden 于 2010-04-17 13:17:25 编辑 近10天以来,我为Code::Blocks的代码完成设计了预处理分析模块。在之前,如下代码:

#if 0
    #define Expression_1
#else
    #define Expression_2
#endif

int main()
{
    Exp
    return 0;
}

在main函数中,Exp后面永远提示的是Expression_1,即第一条if语句下面的内容,而else对应的Expression_2将永远被忽略。
本模块可以解决复杂的条件表达式的分析。

补丁:http://portablecb.googlecode.com/files/handle_preprocessor.patch

如果你不想编译,可以下载已经编译好的codecompletion.dll,覆盖原来同名的share/CodeBlocks/plugins/codecompletion.dll
下载:http://portablecb.googlecode.com/files/codecompletion.dll
但前提条件是你已经下载过我发现的Code::Blocks双编译器绿色试用版:
http://topic.csdn.net/u/20100324/15/791b36e6-f885-4b0b-adfd-ceabd0a3d9ae.html

或者,更新CB到SVN6204:http://portablecb.googlecode.com/files/CB_SVN6024.7z

测试程序:
#if 0
    #define Expression_1
#elif 0
    #define Expression_2
#elif 0
    #define Expression_3
#elif 0
    #define Expression_4
#if 0
    #define Expression_4_if
#else
    #define Expression_4_else
#endif
#elif 0
    #define Expression_5
#else
    #define Expression_1_else
#if 0
    #define Expression_1_else_if
#elif 0
    #define Expression_1_else_elif
#else
    #define Expression_1_else_else
#if 0
    #define Expression_1_else_else_if
#elif 0
    #define Expression_1_else_else_elif_1
#elif 0
    #define Expression_1_else_else_elif_2
#else
    #define Expression_1_else_else_else
#if 1
    #define Expression_1_else_else_else_if
#endif
#if 1
    #define Expression_1_else_if2
#else
    #define Expression_1_else_else2
#endif
#endif
#endif
#endif

int main()
{
    Exp
    return 0;
}

可以任意增删条件语句,只要能正确编译,就可以正确分析。
欢迎使用,发现问题请反馈,谢谢!

之前,CB对这样的代码:
#include <windows.h>

int main()
{
    MessageBox // 这个VC下无法正常提示,后虽然经过补丁,但也只是权宜之计
    CreateFile // 这个在MinGW下是无法提示的,原因是无法包含WinUser.h
}

在启用这个补丁后,这些问题都可以得到正确的解决。
[解决办法]
顶老邓
[解决办法]
支持~~
[解决办法]
我可是顶你的,换台机器,我都忍不住装了个code block.
确实感觉很轻量级。。清爽。
[解决办法]
支持表达式求值不?
[解决办法]
支持...
[解决办法]
现在最新的 code block 是什么版本?
老邓给个链接啊!!
另外有什么好的插件啊 

热点排行