Method GraphSomeData(loopsize As %Integer=100000) As %Status { // load libraries and get system-defined ID values set InputLibID = $ZF(-4,1,"c:\intersystems\iris\bin\inputlibrary.dll") set OutputLibID = $ZF(-4,1,"c:\intersystems\iris\bin\outputlibrary.dll") set fnGetData = $ZF(-4,3,InputLibID,"GetData") set fnAnalyzeData = $ZF(-4,3,OutputLibID,"AnalyzeData") set fnPlotPoint = $ZF(-4,3,OutputLibID,"PlotPoint") set fnWriteData = $ZF(-4,3,OutputLibID,"WriteData") // call functions from each library until we have 100000 good data items set count = 0 do { set datapoint = $ZF(-5,InputLibID,fnGetData) set normalized = $ZF(-5,OutputLibID,fnAnalyzeData,datapoint) if (normalized'="") { set flatdata($INCREMENT(count)) = normalized } } while (countset list = $ZF(-5,OutputLibID,fnPlotPoint,flatdata(point)) set x = $PIECE(list,",",1) set y = $PIECE(list,",",2) set sc = $ZF(-5,OutputLibID,fnWriteData,flatdata(point),x,y,"outputfile.dat") } set status = $ZF(-4,2,OutputLibID) //unload "outputlibrary.dll" quit 0 }
对 $ZF(-4,1) 的调用将标注库 inputlibrary.dll 和 outputlibrary.dll 加载到虚拟内存中,并为其返回系统定义的库 ID。
对 $ZF(-4,3) 的调用使用库 ID 和函数名称来获取库函数的 ID。返回的函数 ID 实际上是 ZFEntry 表序列号(请参阅上一章中的“创建 ZFEntry 表”)。
第一个循环使用 $ZF(-5) 调用每个库中的函数:
默认情况下,循环获取 100000 个项目。由于两个库都已加载并保留在内存中,因此在两个不同库之间切换没有处理开销。
以下部分介绍 $ZF(-6) 接口,它将库加载到与 $ZF(-5) 接口相同的虚拟内存空间中。
上一篇:Linux下进程控制