在代码中修剪#ifdefs所需的特殊C预处理工具 [英] Special C Preprocessing Tool Needed for Pruning of #ifdefs in code

查看:85
本文介绍了在代码中修剪#ifdefs所需的特殊C预处理工具的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有C大师知道一个C预处理工具,它将允许基于单个#define变量对C源进行有限的修剪。


也就是说,在下面的代码片段中:


XXX

#ifdef UndesirableTag

YYY

#ifdef TagB

ZZZ

#endif

AAA

#endif

BBB

#ifdef TagC

CCC。

#endif

DDD

如果UndesirableTag并且它的所有代码都将从文件中删除(其中包含

其他#defines),然后外部的#ifdef和代码一直到

第二个#endif包含应该删除,但没有其他任何接触。


Cpp不合适,因为它将删除所有定义并内联

#includes。理想情况下,该工具将处理ifdef,ifndef,else,elif,endif,

if Defined,if expr和嵌套ifs。我们需要这个项目包含许多

源文件和项目中的许多定义。


任何人都知道会有这样的工具,或者关闭的东西这个?


任何帮助将不胜感激。请发送电子邮件至 cr*******@rogers.com


谢谢,并致以最诚挚的问候。

Does any C guru out there know of a C pre-processing tool that will allow
limited pruning of C source based on a single #define variable.

That is, in the code fragment below:

XXX
#ifdef UndesirableTag
YYY
#ifdef TagB
ZZZ
#endif
AAA
#endif
BBB
#ifdef TagC
CCC.
#endif
DDD

If "UndesirableTag" and all of its code is to be removed from a file (with
other #defines in it), then the outer #ifdef and the code all the way to the
2nd #endif inclusive should be removed, but nothing else touched.

Cpp is not suitable because it will remove all the defines and inline the
#includes. Ideally the tool will handle ifdef, ifndef, else, elif, endif,
if Defined, if expr, and nested ifs. We need this for a project with many
source files and many defines in the project.

Anyone know of a tool that will do this, or something close to this?

Any help would be appreciated. Please email to cr*******@rogers.com.

Thanks and best regards.

推荐答案

2005年1月10日星期一23:36:56 -0500,jvankay

< jv ***** @ rogers.com>写道:
On Mon, 10 Jan 2005 23:36:56 -0500, jvankay
<jv*****@rogers.com> wrote:
有没有C大师知道一个C预处理工具,它将允许基于单个#define变量对C源进行有限的修剪。 />
也就是说,在下面的代码片段中:

XXX
#ifdef UndesirableTag
YYY
#ifdef TagB
ZZZ
#endif
AAA
#endif
BBB
#ifdef TagC
CCC。
#endif
DDD

如果UndesirableTag并且它的所有代码都将从文件中删除(其中包含其他#defines),然后外部的#ifdef和代码一直到第二个#endif包含的内容应被删除,但没有其他感动。


是的。您可以查找名为rmif和scpp的内容,如果您可以在系统上编译并运行它们。或者我最近写了一个



http://www.keristor.co.uk/stuff/xcpp-0.4.0.tar.gz


Mine是ISO C89(其他版本是ISO之前的版本,我记得)。我已经把它扔给它的所有东西都应付了b $ b,如果你发现任何

错误或任何编译它的问题,我会感兴趣某个平台,我想

修复它们。它还处理limits.h,float.h和

autoconf类型config.h文件,它们使用#define和#undef,其中

其他人不要,以及-D和-U到已定义和未定义的宏。它是
没有带有varargs的宏但我怀疑你想要那个......

Cpp不合适,因为它会删除所有的定义并内联
#includes。理想情况下,该工具将处理ifdef,ifndef,else,elif,endif,
如果定义,if expr和嵌套ifs。我们需要这个项目包含许多源文件和项目中的许多定义。


是的,这就是我的设计目标。它是作为自由软件发布的

(Zlib类型许可证)。

任何人都知道会有这样的工具,或者接近这个的东西吗?

任何帮助将不胜感激。请发送电子邮件至 cr*******@rogers.com
Does any C guru out there know of a C pre-processing tool that will allow
limited pruning of C source based on a single #define variable.

That is, in the code fragment below:

XXX
#ifdef UndesirableTag
YYY
#ifdef TagB
ZZZ
#endif
AAA
#endif
BBB
#ifdef TagC
CCC.
#endif
DDD

If "UndesirableTag" and all of its code is to be removed from a file (with
other #defines in it), then the outer #ifdef and the code all the way to the
2nd #endif inclusive should be removed, but nothing else touched.
Yes. You can look for things called rmif and scpp, if you can get them
to compile and run on your system. Or I have one which I wrote
recently:

http://www.keristor.co.uk/stuff/xcpp-0.4.0.tar.gz

Mine is ISO C89 (other versions are pre-ISO, as I recall). It''s coped
with everything I''ve thrown at it, I''d be interested if you find any
bugs in it or any problems compiling it on some platform, I''d like to
fix them if found. It also handles things like limits.h, float.h and
autoconf type config.h files which use #define and #undef, which the
others don''t, as well as -D and -U to defined and undefine macros. It
doesn''t hadle macros with varargs but I doubt you want that...
Cpp is not suitable because it will remove all the defines and inline the
#includes. Ideally the tool will handle ifdef, ifndef, else, elif, endif,
if Defined, if expr, and nested ifs. We need this for a project with many
source files and many defines in the project.
Yup, that''s what mine is designed for. It''s released as Free Software
(Zlib type licence).
Anyone know of a tool that will do this, or something close to this?

Any help would be appreciated. Please email to cr*******@rogers.com.




通过电子邮件发送和发布。


Chris C



Emailed as well as posted.

Chris C


2005年1月11日星期二08: 53:01 +0000,Chris Croughton

< ch *** @ keristor.net>写道:
On Tue, 11 Jan 2005 08:53:01 +0000, Chris Croughton
<ch***@keristor.net> wrote:
2005年1月10日星期一23:36:56 -0500,jvankay
< jv ***** @ rogers.com>写道:
On Mon, 10 Jan 2005 23:36:56 -0500, jvankay
<jv*****@rogers.com> wrote:
有没有C大师知道一个C预处理工具,它将允许基于单个#define变量对C源进行有限的修剪。
Does any C guru out there know of a C pre-processing tool that will allow
limited pruning of C source based on a single #define variable.



是的。您可以查找名为rmif和scpp的内容,如果您可以在系统上编译和运行它们。或者我最近写了一篇


http://www.keristor.co.uk/stuff/xcpp-0.4.0.tar.gz




哎呀,应该是

http://www.keristor.co.uk/stuff/xcpp-0.5.0.tar.gz


我修了一些bug并上传到网站但没有重新生成

我的网页以表明最新版本。


通过电子邮件发送和发布。


Chris C



Oops, that should be

http://www.keristor.co.uk/stuff/xcpp-0.5.0.tar.gz

I fixed some bugs and uploaded it to the website but didn''t regenerate
my web page to indicate the latest version.

Emailed as well as posted.

Chris C


" jvankay" < JV ***** @ rogers.com>在消息中写道

新闻:我们******************** @ rogers.com ...
"jvankay" <jv*****@rogers.com> wrote in message
news:we********************@rogers.com...
是吗任何C大师都知道一个C预处理工具,它允许基于单个#define变量对C源进行有限的修剪。

也就是说,在下面的代码片段中:

XXX
#ifdef UndesirableTag
YYY
#ifdef TagB
ZZZ
#endif
AAA
#endif
BBB
#ifdef TagC
CCC。
#endif
DDD

如果UndesirableTag并且它的所有代码都将从文件中删除(其中包含其他#defines),然后外部的#ifdef和代码一直到
,第二个#endif包含应删除,但没有其他任何因素触及。

Cpp不适合,因为它将删除所有定义并内联
#includes。理想情况下,该工具将处理ifdef,ifndef,else,elif,endif,
如果定义,if expr和嵌套ifs。我们需要这个包含许多源文件和项目中许多定义的项目。

任何人都知道会有这样的工具,或者接近这个的东西吗?
Does any C guru out there know of a C pre-processing tool that will allow
limited pruning of C source based on a single #define variable.

That is, in the code fragment below:

XXX
#ifdef UndesirableTag
YYY
#ifdef TagB
ZZZ
#endif
AAA
#endif
BBB
#ifdef TagC
CCC.
#endif
DDD

If "UndesirableTag" and all of its code is to be removed from a file (with
other #defines in it), then the outer #ifdef and the code all the way to the 2nd #endif inclusive should be removed, but nothing else touched.

Cpp is not suitable because it will remove all the defines and inline the
#includes. Ideally the tool will handle ifdef, ifndef, else, elif, endif,
if Defined, if expr, and nested ifs. We need this for a project with many
source files and many defines in the project.

Anyone know of a tool that will do this, or something close to this?




请参阅 http:// www。 semanticdesigns.com/Products/Tools.html


- IDB



See http://www.semanticdesigns.com/Products/Tools.html

-- IDB


这篇关于在代码中修剪#ifdefs所需的特殊C预处理工具的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆