Search in sources :

Example 51 with Prototype

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);
}
Also used : Prototype(org.luaj.vm2.Prototype) LuaClosure(org.luaj.vm2.LuaClosure)

Example 52 with Prototype

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);
}
Also used : Prototype(org.luaj.vm2.Prototype) LuaClosure(org.luaj.vm2.LuaClosure) LuaString(org.luaj.vm2.LuaString)

Example 53 with Prototype

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();
}
Also used : Prototype(org.luaj.vm2.Prototype)

Example 54 with Prototype

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;
}
Also used : Prototype(org.luaj.vm2.Prototype)

Example 55 with Prototype

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++;
}
Also used : Prototype(org.luaj.vm2.Prototype)

Aggregations

Prototype (org.luaj.vm2.Prototype)39 Prototype (org.osate.aadl2.Prototype)24 Classifier (org.osate.aadl2.Classifier)20 ComponentPrototype (org.osate.aadl2.ComponentPrototype)20 ComponentClassifier (org.osate.aadl2.ComponentClassifier)19 FeatureGroupPrototype (org.osate.aadl2.FeatureGroupPrototype)17 ComponentPrototypeBinding (org.osate.aadl2.ComponentPrototypeBinding)16 FeaturePrototype (org.osate.aadl2.FeaturePrototype)14 FeaturePrototypeBinding (org.osate.aadl2.FeaturePrototypeBinding)14 FeatureGroupPrototypeBinding (org.osate.aadl2.FeatureGroupPrototypeBinding)13 PrototypeBinding (org.osate.aadl2.PrototypeBinding)13 Subcomponent (org.osate.aadl2.Subcomponent)13 FeatureGroupType (org.osate.aadl2.FeatureGroupType)11 DataPrototype (org.osate.aadl2.DataPrototype)10 NamedElement (org.osate.aadl2.NamedElement)10 ComponentPrototypeActual (org.osate.aadl2.ComponentPrototypeActual)9 DataClassifier (org.osate.aadl2.DataClassifier)9 Feature (org.osate.aadl2.Feature)9 FeatureGroupPrototypeActual (org.osate.aadl2.FeatureGroupPrototypeActual)9 EClass (org.eclipse.emf.ecore.EClass)7