- Main Page
- Classes
- Files

# lcode.h

Go to the documentation of this file.

    00001 /*
    00002 ** $Id: lcode.h,v 1.48.1.1 2007/12/27 13:02:25 roberto Exp $
    00003 ** Code generator for Lua
    00004 ** See Copyright Notice in lua.h
    00005 */
    00006
    00007 #ifndef lcode_h
    00008 #define lcode_h
    00009
    00010 #include "llex.h"
    00011 #include "lobject.h"
    00012 #include "lopcodes.h"
    00013 #include "lparser.h"
    00014
    00015
    00016 /*
    00017 ** Marks the end of a patch list. It is an invalid value both as an absolute
    00018 ** address, and as a list link (would link an element to itself).
    00019 */
    00020 #define NO_JUMP (-1)
    00021
    00022
    00023 /*
    00024 ** grep "ORDER OPR" if you change these enums
    00025 */
    00026 typedef enum BinOpr {
    00027   OPR_ADD, OPR_SUB, OPR_MUL, OPR_DIV, OPR_MOD, OPR_POW,
    00028   OPR_CONCAT,
    00029   OPR_NE, OPR_EQ,
    00030   OPR_LT, OPR_LE, OPR_GT, OPR_GE,
    00031   OPR_AND, OPR_OR,
    00032   OPR_NOBINOPR
    00033 } BinOpr;
    00034
    00035
    00036 typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_LEN, OPR_NOUNOPR } UnOpr;
    00037
    00038
    00039 #define getcode(fs,e)   ((fs)->f->code[(e)->u.s.info])
    00040
    00041 #define luaK_codeAsBx(fs,o,A,sBx)       luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)
    00042
    00043 #define luaK_setmultret(fs,e)   luaK_setreturns(fs, e, LUA_MULTRET)
    00044
    00045 LUAI_FUNC int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx);
    00046 LUAI_FUNC int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C);
    00047 LUAI_FUNC void luaK_fixline (FuncState *fs, int line);
    00048 LUAI_FUNC void luaK_nil (FuncState *fs, int from, int n);
    00049 LUAI_FUNC void luaK_reserveregs (FuncState *fs, int n);
    00050 LUAI_FUNC void luaK_checkstack (FuncState *fs, int n);
    00051 LUAI_FUNC int luaK_stringK (FuncState *fs, TString *s);
    00052 LUAI_FUNC int luaK_numberK (FuncState *fs, lua_Number r);
    00053 LUAI_FUNC void luaK_dischargevars (FuncState *fs, expdesc *e);
    00054 LUAI_FUNC int luaK_exp2anyreg (FuncState *fs, expdesc *e);
    00055 LUAI_FUNC void luaK_exp2nextreg (FuncState *fs, expdesc *e);
    00056 LUAI_FUNC void luaK_exp2val (FuncState *fs, expdesc *e);
    00057 LUAI_FUNC int luaK_exp2RK (FuncState *fs, expdesc *e);
    00058 LUAI_FUNC void luaK_self (FuncState *fs, expdesc *e, expdesc *key);
    00059 LUAI_FUNC void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k);
    00060 LUAI_FUNC void luaK_goiftrue (FuncState *fs, expdesc *e);
    00061 LUAI_FUNC void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e);
    00062 LUAI_FUNC void luaK_setreturns (FuncState *fs, expdesc *e, int nresults);
    00063 LUAI_FUNC void luaK_setoneret (FuncState *fs, expdesc *e);
    00064 LUAI_FUNC int luaK_jump (FuncState *fs);
    00065 LUAI_FUNC void luaK_ret (FuncState *fs, int first, int nret);
    00066 LUAI_FUNC void luaK_patchlist (FuncState *fs, int list, int target);
    00067 LUAI_FUNC void luaK_patchtohere (FuncState *fs, int list);
    00068 LUAI_FUNC void luaK_concat (FuncState *fs, int *l1, int l2);
    00069 LUAI_FUNC int luaK_getlabel (FuncState *fs);
    00070 LUAI_FUNC void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v);
    00071 LUAI_FUNC void luaK_infix (FuncState *fs, BinOpr op, expdesc *v);
    00072 LUAI_FUNC void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2);
    00073 LUAI_FUNC void luaK_setlist (FuncState *fs, int base, int nelems, int tostore);
    00074
    00075
    00076 #endif