00001 
00002 
00003 
00004 
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 
00018 
00019 
00020 #define NO_JUMP (-1)
00021 
00022 
00023 
00024 
00025 
00026 typedef enum BinOpr {
00027   OPR_ADD, OPR_SUB, OPR_MULT, OPR_DIV, 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 #define binopistest(op) ((op) >= OPR_NE)
00036 
00037 typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_NOUNOPR } UnOpr;
00038 
00039 
00040 #define getcode(fs,e)   ((fs)->f->code[(e)->info])
00041 
00042 #define luaK_codeAsBx(fs,o,A,sBx)       luaK_codeABx(fs,o,A,(sBx)+MAXARG_sBx)
00043 
00044 int luaK_code (FuncState *fs, Instruction i, int line)
00045         ;
00046 int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx)
00047         ;
00048 int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C)
00049         ;
00050 void luaK_fixline (FuncState *fs, int line)
00051         ;
00052 void luaK_nil (FuncState *fs, int from, int n)
00053         ;
00054 void luaK_reserveregs (FuncState *fs, int n)
00055         ;
00056 void luaK_checkstack (FuncState *fs, int n)
00057         ;
00058 int luaK_stringK (FuncState *fs, TString *s)
00059         ;
00060 int luaK_numberK (FuncState *fs, lua_Number r)
00061         ;
00062 void luaK_dischargevars (FuncState *fs, expdesc *e)
00063         ;
00064 int luaK_exp2anyreg (FuncState *fs, expdesc *e)
00065         ;
00066 void luaK_exp2nextreg (FuncState *fs, expdesc *e)
00067         ;
00068 void luaK_exp2val (FuncState *fs, expdesc *e)
00069         ;
00070 int luaK_exp2RK (FuncState *fs, expdesc *e)
00071         ;
00072 void luaK_self (FuncState *fs, expdesc *e, expdesc *key)
00073         ;
00074 void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k)
00075         ;
00076 void luaK_goiftrue (FuncState *fs, expdesc *e)
00077         ;
00078 void luaK_goiffalse (FuncState *fs, expdesc *e)
00079         ;
00080 void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e)
00081         ;
00082 void luaK_setcallreturns (FuncState *fs, expdesc *var, int nresults)
00083         ;
00084 int luaK_jump (FuncState *fs)
00085         ;
00086 void luaK_patchlist (FuncState *fs, int list, int target)
00087         ;
00088 void luaK_patchtohere (FuncState *fs, int list)
00089         ;
00090 void luaK_concat (FuncState *fs, int *l1, int l2)
00091         ;
00092 int luaK_getlabel (FuncState *fs)
00093         ;
00094 void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v)
00095         ;
00096 void luaK_infix (FuncState *fs, BinOpr op, expdesc *v)
00097         ;
00098 void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2)
00099         ;
00100 
00101 
00102 #endif