当前位置: 首页>>代码示例>>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;未经允许,请勿转载。