使用Understand for Mac编写您的第一个API脚本
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中的示例。
- Dialogue System for Unity文档中英对照版(简雨原创翻译)完结篇(内置脚本使用,脚本API)
- 老李推荐: 第3章2节《MonkeyRunner源码剖析》脚本编写示例: MonkeyDevice API使用示例 3
- 老李推荐: 第3章2节《MonkeyRunner源码剖析》脚本编写示例: MonkeyDevice API使用示例 4
- 老李推荐: 第3章2节《MonkeyRunner源码剖析》脚本编写示例: MonkeyDevice API使用示例 2
- 老李推荐:第3章3节《MonkeyRunner源码剖析》脚本编写示例: MonkeyImage API使用示例 2
- 使用ArcGIS API for JavaScript创建第一个应用
- 第3章2节《MonkeyRunner源码剖析》脚本编写示例: MonkeyDevice API使用示例(原创)
- 第3章2节《MonkeyRunner源码剖析》脚本编写示例: MonkeyDevice API使用示例 4
- 第3章3节《MonkeyRunner源码剖析》脚本编写示例: MonkeyImage API使用示例(原创)
- 使用脚本卸载.net framework for mac
- 使用PyPharm编写第一个selenium脚本
- 使用Shell编写定时向指定API获取数据的脚本
- 第3章2节《MonkeyRunner源码剖析》脚本编写示例: MonkeyDevice API使用示例(原创)
- 老李推荐:第3章3节《MonkeyRunner源码剖析》脚本编写示例: MonkeyImage API使用示例 1
- 老李推荐: 第3章2节《MonkeyRunner源码剖析》脚本编写示例: MonkeyDevice API使用示例 3
- 老李推荐:第3章3节《MonkeyRunner源码剖析》脚本编写示例: MonkeyImage API使用示例 2
- 老李推荐: 第3章2节《MonkeyRunner源码剖析》脚本编写示例: MonkeyDevice API使用示例 1
- 老李推荐:第3章3节《MonkeyRunner源码剖析》脚本编写示例: MonkeyImage API使用示例 1
- Android For JNI(一)——JNI的概念以及C语言开发工具dev-c++,编写你的第一个C语言程序,使用C启动JAVA程序
- 老李推荐: 第3章2节《MonkeyRunner源码剖析》脚本编写示例: MonkeyDevice API使用示例 2