Search in sources :

Example 16 with Prototype

use of org.osate.aadl2.Prototype in project GameComposer by mirkosertic.

the class LuaJScriptEngineFactory method create.

private LuaJScriptEngine create(KeyValueObjectCache aScene, String aScriptCode, String aMethodName) throws IOException {
    CacheEntry theCacheEntry = prototypes.get(aScriptCode);
    if (theCacheEntry == null) {
        Globals theGlobals = createGlobals(aScene);
        Prototype thePrototype = theGlobals.compilePrototype(new StringReader(aScriptCode), "script");
        // Initialize the globals and the code
        LuaClosure theClosure = new LuaClosure(thePrototype, theGlobals);
        theClosure.call();
        theCacheEntry = new CacheEntry(thePrototype, theGlobals);
        prototypes.put(aScriptCode, theCacheEntry);
    }
    return theCacheEntry.getScriptEngineFor(aScene, aMethodName);
}
Also used : Globals(org.luaj.vm2.Globals) Prototype(org.luaj.vm2.Prototype) LuaClosure(org.luaj.vm2.LuaClosure) StringReader(java.io.StringReader)

Example 17 with Prototype

use of org.osate.aadl2.Prototype in project GameComposer by mirkosertic.

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 18 with Prototype

use of org.osate.aadl2.Prototype in project GameComposer by mirkosertic.

the class LexState method parlist.

/* }====================================================================== */
void parlist() {
    /* parlist -> [ param { `,' param } ] */
    FuncState fs = this.fs;
    Prototype f = fs.f;
    int nparams = 0;
    f.is_vararg = 0;
    if (this.t.token != ')') {
        /* is `parlist' not empty? */
        do {
            switch(this.t.token) {
                case TK_NAME:
                    {
                        /* param . NAME */
                        this.new_localvar(this.str_checkname());
                        ++nparams;
                        break;
                    }
                case TK_DOTS:
                    {
                        /* param . `...' */
                        this.next();
                        f.is_vararg = 1;
                        break;
                    }
                default:
                    this.syntaxerror("<name> or " + LUA_QL("...") + " expected");
            }
        } while ((f.is_vararg == 0) && this.testnext(','));
    }
    this.adjustlocalvars(nparams);
    f.numparams = fs.nactvar;
    fs.reserveregs(fs.nactvar);
/* reserve register for parameters */
}
Also used : Prototype(org.luaj.vm2.Prototype)

Example 19 with Prototype

use of org.osate.aadl2.Prototype in project GameComposer by mirkosertic.

the class LexState method registerlocalvar.

int registerlocalvar(LuaString varname) {
    FuncState fs = this.fs;
    Prototype f = fs.f;
    if (f.locvars == null || fs.nlocvars + 1 > f.locvars.length)
        f.locvars = LuaC.realloc(f.locvars, fs.nlocvars * 2 + 1);
    f.locvars[fs.nlocvars] = new LocVars(varname, 0, 0);
    return fs.nlocvars++;
}
Also used : Prototype(org.luaj.vm2.Prototype) LocVars(org.luaj.vm2.LocVars)

Example 20 with Prototype

use of org.osate.aadl2.Prototype in project GameComposer by mirkosertic.

the class LuaC method luaY_parser.

/**
 * Parse the input
 */
private Prototype luaY_parser(InputStream z, String name) throws IOException {
    LexState lexstate = new LexState(this, z);
    FuncState funcstate = new FuncState();
    // lexstate.buff = buff;
    lexstate.fs = funcstate;
    lexstate.setinput(this, z.read(), z, LuaValue.valueOf(name));
    /* main func. is always vararg */
    funcstate.f = new Prototype();
    funcstate.f.source = LuaValue.valueOf(name);
    lexstate.mainfunc(funcstate);
    LuaC._assert(funcstate.prev == null);
    /* all scopes should be correctly finished */
    LuaC._assert(lexstate.dyd == null || (lexstate.dyd.n_actvar == 0 && lexstate.dyd.n_gt == 0 && lexstate.dyd.n_label == 0));
    return funcstate.f;
}
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