使用Understand for Mac编写您的第一个API脚本 Understand 使用教程
时间:2022-09-15 21:51:54
Understand具有广泛的API,可让您查询所捕获的有关代码的数据。它具有三种风格:Perl,Python和C。PerlAPI比其他两种更强大,因为它允许与Understand GUI交互,并且不需要其他设置。这三个API都是只读的,它们不会修改Understand项目。在创建Understanding Eclipse Plugin的过程中还编写了Java API 。但是,它更轻巧,没有其他API的全部功能。
打开一个理解项目
让我们先来看一个非常简单的Perl API脚本。
sample.pl
使用了解;
$ db =理解:: open(“ c:\ projects \ test.udb”);
foreach $ file($ db-> ents(“ file”)){
打印$ file-> longname(),“ \ n”;
}
第一行告诉Perl解释器您想使用Understand API库。然后,它将打开一个Understand项目文件(c:\ projectstest.udb),并遍历该项目中每个文件实体的列表,并在单独的行上打印每个文件的名称。
要自己运行它,请更改路径以指向您自己的项目之一。请注意,对于Windows路径,您需要通过将斜杠加倍来对其进行转义。
Uperl是bin \ system目录中的Understand随附的perl解释器。要运行此脚本,请打开命令行/终端并运行:
cd“ c:\ program files \ scitools \ bin \ pc-win64”或系统上的适当路径uperl.exe myscript.pl
这是Python 3 API的相同脚本。需要在系统上安装Python,并且正确理解Python库。
sample.py
导入了解
db =谅解.open(“ c:\ projects \ test.udb”)
对于db.ents(“ file”)中的文件:
打印(file.longname())
同样,C API也是如此。
样本
#include
#include
#include“ C:\ Program Files \ SciTools \ src \ udb \ udb.h”
静态字符* dbFilename =“ c:\ projects \ test.udb”;
mAIn(int argc,char * argv []){
UdbStatus status = udbDbOpen(dbFilename);
UdbEntity * ents;
int entsSize;
我
udbListEntity(“ file”,&ents,&entsSize);
对于(i = 0; i printf(“%s \ n”,udbEntityNameLong(ents [i]));
}
udbListEntityFree(ents);
udbDbClos??e();
}
生成文件
sample.exe:sample.obj
由于C API示例的大小,这些教程的其余部分将仅显示Perl和Python中的示例。
![](/images/zang.png)
![](/images/jiucuo.png)
猜你喜欢
word2003文档如何给表格设置底纹
wps office怎么压缩文件大小
![](https://img.aspxhome.com/file/2023/2/a168032_0s.png)
word如何设置表格中的文字行距
![](https://img.aspxhome.com/file/2023/6/31756_0s.png)
VLOOKUP函数的一个小技巧
WPS默认模板如何设置
WPS 如何设置word默认字体
![](https://img.aspxhome.com/file/2023/6/a186246_0s.jpg)
LEFT、RIGHT函数快速分列,快速填充
![](https://img.aspxhome.com/file/2023/4/a142274_0s.png)
Word表格怎么插入ppt
![](https://img.aspxhome.com/file/2023/3/19873_0s.jpg)
wps如何使用书签
![](https://img.aspxhome.com/file/2023/7/a170287_0s.jpg)
excel表格中怎么怎么将销售工资按比例计算提成?
![](https://img.aspxhome.com/file/2023/3/a141533_0s.jpg)
苹果Mac休眠唤醒后出现死机情况如何解决?
![](https://img.aspxhome.com/file/2023/7/a207887_0s.jpeg)
Luminar Neo 教程「48」,如何在 Luminar Neo 中使用快捷方式查找照片?
![](https://img.aspxhome.com/file/2023/7/a202027_0s.jpeg)
Win10如何开启HDR功能?Win10开启HDR功能的方法
![](https://img.aspxhome.com/file/2023/1/52301_0s.jpg)
删除现有Word文档页码的技巧
WPS如何撤销背景音乐
![](https://img.aspxhome.com/file/2023/6/a170666_0s.jpg)
Excel轻松查看数据记录
Excel中使用方法的操作技巧
Win10控制面板中没有语言选项怎么办?
![](https://img.aspxhome.com/file/2023/7/52457_0s.png)