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);
}
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;
}
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 */
}
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++;
}
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;
}
Aggregations