关于Borland cpp32.exe 的使用

        Borland的CPP32是预处理工具,可以去处注释,合并文件等,不但可以用在C/C++文件上,
还可以用在JAVA文件上,这样就可以在某些时候在JAVA文件里使用C/C++中的#include和#define,
比较方便.
以下是一个简单的说明,这个东西不容易找,呵呵~~
今天发现cpp32.exe产生的程序可避免行号,并且可保留用/*  */标记的注释,
 
拿我的某个项目来举个例子,原来调用cpp32程序的批处理中代码如下:
copy %APP_NAME%.java ../src/cpp32tmp.java
cpp32.exe -o ../src/%APP_NAME%.java ../src/cpp32tmp.java
 
修改最后一行,就是添加一个“-Sr”,即可避免输出行号,而且可以保留用/*  */标记的注释,
如下:cpp32.exe -Sr -o../src/%APP_NAME%.java ../src/cpp32tmp.java
 
同时cpp32还有其它参数,我在网上找到的,列在下面,供大家参考:
-Ax Specify language extensions
-C Allow nested comments
-Dname Define macro        //可以直接在命令行里进行
-gnnn Stop after N warnings
-innn Maximum identifier length N
 
-Ipath Include files directory
-jnnn Stop after N errors
-npath Output file directory
-ofilename Output file name
-p Pascal calls
-P Include source line info (on by default)
 
-Sc Keep comments in preprocessed file
-Sd Keep defines in preprocessed file
-Sk Keep output on errors
-Sr Make output readable by preserving comments and indentations
-Ss Show statistics of file names and line counts
-Uname Undefine macro
-w Enable all warnings
-w-xxx Disable warning xxx
-wxxx Enable warning xxx
 
挑几个我认为常用的解释一下
-Dname Define macro        //可以直接在命令行里进行
例如:“cpp32.exe -DNOKIA_S60” 即等于在代码最开头中使用#define NOKIA_S60 
 
-P Include source line info (on by default)   //包含代码的行信息(默认的),就是他产生很多无效的信息
要想屏蔽掉他需要这样:“cpp32.exe -P-”
 
-ofilename Output file name  //输出文件
例如::“cpp32.exe -o after.java before.jave”就将before.jave通过cpp.32处理后输出为after.java
PS:cpp32有一些bug,这个在Borland的官方网站bug反馈了可以看到,大家有兴趣可以去看看,
不过好象对我的使用影响不大 ^_^
转载请保留以下信息:
作者(Author):smilelance
时间( Time ):2006-05-24
出处( From ):http://blog.csdn.net/smilelance
 
posted @ 2006-08-14 14:51  MXi4oyu  阅读(165)  评论(0编辑  收藏  举报