use of org.osate.aadl2.Prototype in project aerospike-client-java by aerospike.
the class LuaInstance method loadPackage.
public void loadPackage(Statement statement) {
if (loadedTable.get(statement.getPackageName()).toboolean()) {
return;
}
Prototype prototype;
if (statement.getResourceLoader() == null || statement.getResourcePath() == null) {
prototype = LuaCache.loadPackageFromFile(statement.getPackageName());
} else {
prototype = LuaCache.loadPackageFromResource(statement.getResourceLoader(), statement.getResourcePath(), statement.getPackageName());
}
LuaClosure function = new LuaClosure(prototype, globals);
function.invoke();
loadedTable.set(statement.getPackageName(), LuaValue.TRUE);
}
use of org.osate.aadl2.Prototype in project aerospike-client-java by aerospike.
the class LuaInstance method loadSystemPackage.
private void loadSystemPackage(ClassLoader resourceLoader, String packageName) {
String resourcePath = "udf/" + packageName + ".lua";
Prototype prototype = LuaCache.loadPackageFromResource(resourceLoader, resourcePath, packageName);
LuaClosure function = new LuaClosure(prototype, globals);
function.invoke();
loadedTable.set(packageName, LuaValue.TRUE);
}
use of org.osate.aadl2.Prototype in project LuaViewSDK by alibaba.
the class LexState method close_func.
void close_func() {
FuncState fs = this.fs;
Prototype f = fs.f;
fs.ret(0, 0);
/* final return */
fs.leaveblock();
f.code = LuaC.realloc(f.code, fs.pc);
f.lineinfo = LuaC.realloc(f.lineinfo, fs.pc);
f.k = LuaC.realloc(f.k, fs.nk);
f.p = LuaC.realloc(f.p, fs.np);
f.locvars = LuaC.realloc(f.locvars, fs.nlocvars);
f.upvalues = LuaC.realloc(f.upvalues, fs.nups);
LuaC._assert(fs.bl == null);
this.fs = fs.prev;
// last token read was anchored in defunct function; must reanchor it
// ls.anchor_token();
}
use of org.osate.aadl2.Prototype in project LuaViewSDK by alibaba.
the class LexState method addprototype.
Prototype addprototype() {
Prototype clp;
Prototype f = fs.f;
/* prototype of current function */
if (f.p == null || fs.np >= f.p.length) {
f.p = LuaC.realloc(f.p, Math.max(1, fs.np * 2));
}
f.p[fs.np++] = clp = new Prototype();
return clp;
}
use of org.osate.aadl2.Prototype in project LuaViewSDK by alibaba.
the class FuncState method code.
int code(int instruction, int line) {
Prototype f = this.f;
this.dischargejpc();
/* put new instruction in code array */
if (f.code == null || this.pc + 1 > f.code.length)
f.code = LuaC.realloc(f.code, this.pc * 2 + 1);
f.code[this.pc] = instruction;
/* save corresponding line information */
if (f.lineinfo == null || this.pc + 1 > f.lineinfo.length)
f.lineinfo = LuaC.realloc(f.lineinfo, this.pc * 2 + 1);
f.lineinfo[this.pc] = line;
return this.pc++;
}
Aggregations