當前位置: 首頁>>代碼示例>>Java>>正文


Java Prototype類代碼示例

本文整理匯總了Java中se.krka.kahlua.vm.Prototype的典型用法代碼示例。如果您正苦於以下問題:Java Prototype類的具體用法?Java Prototype怎麽用?Java Prototype使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Prototype類屬於se.krka.kahlua.vm包,在下文中一共展示了Prototype類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: close_func

import se.krka.kahlua.vm.Prototype; //導入依賴的package包/類
void close_func() {
        FuncState fs = this.fs;
        Prototype f = fs.f;
        f.isVararg = fs.isVararg != 0;

        this.removevars(0);
        fs.ret(0, 0); /* final return */
        f.code = FuncState.realloc(f.code, fs.pc);
        f.lines = FuncState.realloc(f.lines, fs.pc);
        // f.sizelineinfo = fs.pc;
        f.constants = FuncState.realloc(f.constants, fs.nk);
        f.prototypes = FuncState.realloc(f.prototypes, fs.np);
        fs.locvars = FuncState.realloc(fs.locvars, fs.nlocvars);
        // f.sizelocvars = fs.nlocvars;
        fs.upvalues = FuncState.realloc(fs.upvalues, f.numUpvalues);
        // FuncState._assert (CheckCode.checkcode(f));
        FuncState._assert(fs.bl == null);
        this.fs = fs.prev;
//		L.top -= 2; /* remove table and prototype from the stack */
        // /* last token read was anchored in defunct function; must reanchor it
        // */
        // if (fs!=null) ls.anchor_token();
    }
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:24,代碼來源:KahluaParser.java

示例2: FuncState

import se.krka.kahlua.vm.Prototype; //導入依賴的package包/類
FuncState(KahluaParser lexState) {
       Prototype f = new Prototype();
       if ( lexState.fs!=null )
           f.name = lexState.fs.f.name;
       this.f = f;

       this.prev = lexState.fs;  /* linked list of funcstates */
       this.ls = lexState;
       lexState.fs = this;

       this.pc = 0;
       this.lasttarget = -1;
       this.jpc = KahluaParser.NO_JUMP;
       this.freereg = 0;
       this.nk = 0;
       this.np = 0;
       this.nlocvars = 0;
       this.nactvar = 0;
       this.bl = null;
       f.maxStacksize = 2;  /* registers 0/1 are always valid */
       //fs.h = new LTable();
       this.htable = new Hashtable();

}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:25,代碼來源:FuncState.java

示例3: addk

import se.krka.kahlua.vm.Prototype; //導入依賴的package包/類
int addk(Object v) {
	int idx;
       if (v == null) return 0;
       
	if (this.htable.containsKey(v)) {
		idx = ((Integer) htable.get(v)).intValue();
	} else {
		idx = this.nk;
		this.htable.put(v, new Integer(idx));
		final Prototype f = this.f;
		if (f.constants == null || nk + 1 >= f.constants.length)
			f.constants = realloc( f.constants, nk*2 + 1 );
		if (v == NULL_OBJECT) {
			v = null;
		}
		f.constants[this.nk++] = v;
	}
	return idx;
}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:20,代碼來源:FuncState.java

示例4: loadByteCodeFromResource

import se.krka.kahlua.vm.Prototype; //導入依賴的package包/類
public static LuaClosure loadByteCodeFromResource(String name, KahluaTable environment) {
	InputStream stream = null;
	try {
		stream = new FileInputStream(new File(name + ".lbc"));
	} catch (FileNotFoundException e) {
		e.printStackTrace();
	}
	if (stream == null) {
		return null;
	} else {
		try {
			return Prototype.loadByteCode(stream, environment);
		} catch (IOException arg3) {
			throw new RuntimeException(arg3.getMessage());
		}
	}
}
 
開發者ID:JabJabJab,項目名稱:Sledgehammer,代碼行數:18,代碼來源:KahluaUtil.java

示例5: pushclosure

import se.krka.kahlua.vm.Prototype; //導入依賴的package包/類
void pushclosure(FuncState func, ExpDesc v) {
    FuncState fs = this.fs;
    Prototype f = fs.f;
    if (f.prototypes == null || fs.np + 1 > f.prototypes.length)
        f.prototypes = FuncState.realloc(f.prototypes, fs.np * 2 + 1);
    f.prototypes[fs.np++] = func.f;
    v.init(VRELOCABLE, fs.codeABx(FuncState.OP_CLOSURE, 0, fs.np - 1));
    for (int i = 0; i < func.f.numUpvalues; i++) {
        int o = (func.upvalues_k[i] == VLOCAL) ? FuncState.OP_MOVE
                : FuncState.OP_GETUPVAL;
        fs.codeABC(o, 0, func.upvalues_info[i], 0);
    }
}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:14,代碼來源:KahluaParser.java

示例6: code

import se.krka.kahlua.vm.Prototype; //導入依賴的package包/類
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 = realloc(f.code, this.pc * 2 + 1);
	f.code[this.pc] = instruction;
	/* save corresponding line information */
	if (f.lines == null || this.pc + 1 > f.lines.length)
		f.lines = realloc(f.lines,
				this.pc * 2 + 1);
	f.lines[this.pc] = line;
	return this.pc++;
}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:15,代碼來源:FuncState.java

示例7: parlist

import se.krka.kahlua.vm.Prototype; //導入依賴的package包/類
void parlist() {
        //log.info(">>> parlist");

        /* parlist -> [ param { `,' param } ] */
        FuncState fs = this.fs;
        Prototype f = fs.f;
        int nparams = 0;
        fs.isVararg = 0;
        if (this.t != RPAREN) {  /* is `parlist' not empty? */

            do {
                PsiBuilder.Marker parm = builder.mark();
//                    PsiBuilder.Marker mark = builder.mark();
                if (this.t == NAME) {
                    /* param . NAME */

                    String name = this.str_checkname();
//                    mark.done(LOCAL_NAME_DECL);
                    this.new_localvar(name, nparams++);
                    parm.done(PARAMETER);
                    // break;
                } else if (this.t == ELLIPSIS) {  /* param . `...' */
                    this.next();
//                    mark.done(LOCAL_NAME_DECL);

                    parm.done(PARAMETER);
                    fs.isVararg |= FuncState.VARARG_ISVARARG;
                    //   break;
                } else {
//                    mark.drop();
                    parm.drop();
                    this.syntaxerror("<name> or " + LUA_QL("...") + " expected");
                }
            } while ((fs.isVararg == 0) && this.testnext(COMMA));

        }
        this.adjustlocalvars(nparams);
        f.numParams = (fs.nactvar - (fs.isVararg & FuncState.VARARG_HASARG));
        fs.reserveregs(fs.nactvar);  /* reserve register for parameters */

        //log.info("<<< parlist");
    }
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:43,代碼來源:KahluaParser.java

示例8: realloc

import se.krka.kahlua.vm.Prototype; //導入依賴的package包/類
static Prototype[] realloc(Prototype[] v, int n) {
	Prototype[] a = new Prototype[n];
	if ( v != null )
		System.arraycopy(v, 0, a, 0, Math.min(v.length,n));
	return a;
}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:7,代碼來源:FuncState.java


注:本文中的se.krka.kahlua.vm.Prototype類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。