Examples of Prototype


Examples of org.luaj.vm2.Prototype

    this.f.lineinfo[this.pc - 1] = line;
  }


  int code(int instruction, int line) {
    Prototype f = this.f;
    this.dischargejpc(); /* `pc' will change */
    /* 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;
View Full Code Here

Examples of org.luaj.vm2.Prototype

        InputStream ris = new Utf8Encoder(reader);
        try {
          final LuaFunction f = LoadState.load(ris, "script", null);
          if ( f.isclosure() ) {
            // most compiled functions are closures with prototypes
            final Prototype p = f.checkclosure().p;
          return new CompiledScriptImpl() {
            protected LuaFunction newFunctionInstance() {
              return new LuaClosure( p, null );
            }
          };
View Full Code Here

Examples of org.luaj.vm2.Prototype

  }

 
  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++;
  }
View Full Code Here

Examples of org.luaj.vm2.Prototype

    L.nCcalls--;
  }
 
  void pushclosure(FuncState func, expdesc v) {
    FuncState fs = this.fs;
    Prototype f = fs.f;
    if (f.p == null || fs.np + 1 > f.p.length)
      f.p = LuaC.realloc( f.p, fs.np*2 + 1 );
    f.p[fs.np++] = func.f;
    v.init(VRELOCABLE, fs.codeABx(Lua.OP_CLOSURE, 0, fs.np - 1));
    for (int i = 0; i < func.f.nups; i++) {
View Full Code Here

Examples of org.luaj.vm2.Prototype

    }
  }
 
  void open_func (FuncState fs) {
      LuaC L = this.L;
      Prototype f = new Prototype();
      if ( this.fs!=null )
        f.source = this.fs.f.source;
      fs.f = f;
      fs.prev = this.fs;  /* linked list of funcstates */
      fs.ls = this;
View Full Code Here

Examples of org.luaj.vm2.Prototype

      fs.htable = new Hashtable();
  }

  void close_func() {
    FuncState fs = this.fs;
    Prototype f = fs.f;
    this.removevars(0);
    fs.ret(0, 0); /* final return */
    f.code = LuaC.realloc(f.code, fs.pc);
    f.lineinfo = LuaC.realloc(f.lineinfo, fs.pc);
    // f.sizelineinfo = fs.pc;
View Full Code Here

Examples of org.luaj.vm2.Prototype

  /* }====================================================================== */

  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) {
View Full Code Here

Examples of org.luaj.vm2.Prototype

    LuaClosure c = di.closure;
    for (int i = 0, j = what.length(); i < j; i++) {
      switch (what.charAt(i)) {
        case 'S': {
          if ( c != null ) {
            Prototype p = c.p;
            info.set(WHAT, LUA);
            info.set(SOURCE, p.source);
            info.set(SHORT_SRC, valueOf(sourceshort(p)));
            info.set(LINEDEFINED, valueOf(p.linedefined));
            info.set(LASTLINEDEFINED, valueOf(p.lastlinedefined));
View Full Code Here

Examples of org.luaj.vm2.Prototype

 
  // return StrValue[] { name, namewhat } if found, null if not
  static LuaString[] getobjname(DebugInfo di, int stackpos) {
    LuaString name;
    if (di.closure != null) { /* a Lua function? */
      Prototype p = di.closure.p;
      int pc = di.pc; // currentpc(L, ci);
      int i;// Instruction i;
      name = p.getlocalname(stackpos + 1, pc);
      if (name != null) /* is a local? */
        return new LuaString[] { name, LOCAL };
      i = symbexec(p, pc, stackpos); /* try symbolic execution */
      lua_assert(pc != -1);
      switch (Lua.GET_OPCODE(i)) {
View Full Code Here

Examples of org.luaj.vm2.Prototype

  public void load(String packageName, boolean system) throws AerospikeException {
    if (loadedTable.get(packageName).toboolean()) {
      return;
    }
   
    Prototype prototype = LuaCache.loadPackage(packageName, system);
    LuaClosure function = new LuaClosure(prototype, globals);
    function.invoke();
   
    loadedTable.set(packageName, LuaValue.TRUE);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.