lua/lcode.h

Go to the documentation of this file.
00001 /*
00002 ** $Id: lcode.h,v 1.2 2004/03/23 05:09:14 jbj 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_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         /*@modifies fs @*/;
00046 int luaK_codeABx (FuncState *fs, OpCode o, int A, unsigned int Bx)
00047         /*@modifies fs @*/;
00048 int luaK_codeABC (FuncState *fs, OpCode o, int A, int B, int C)
00049         /*@modifies fs @*/;
00050 void luaK_fixline (FuncState *fs, int line)
00051         /*@modifies fs @*/;
00052 void luaK_nil (FuncState *fs, int from, int n)
00053         /*@modifies fs @*/;
00054 void luaK_reserveregs (FuncState *fs, int n)
00055         /*@modifies fs @*/;
00056 void luaK_checkstack (FuncState *fs, int n)
00057         /*@modifies fs @*/;
00058 int luaK_stringK (FuncState *fs, TString *s)
00059         /*@modifies fs @*/;
00060 int luaK_numberK (FuncState *fs, lua_Number r)
00061         /*@modifies fs @*/;
00062 void luaK_dischargevars (FuncState *fs, expdesc *e)
00063         /*@modifies fs, e @*/;
00064 int luaK_exp2anyreg (FuncState *fs, expdesc *e)
00065         /*@modifies fs, e @*/;
00066 void luaK_exp2nextreg (FuncState *fs, expdesc *e)
00067         /*@modifies fs, e @*/;
00068 void luaK_exp2val (FuncState *fs, expdesc *e)
00069         /*@modifies fs, e @*/;
00070 int luaK_exp2RK (FuncState *fs, expdesc *e)
00071         /*@modifies fs, e @*/;
00072 void luaK_self (FuncState *fs, expdesc *e, expdesc *key)
00073         /*@modifies fs, e, key @*/;
00074 void luaK_indexed (FuncState *fs, expdesc *t, expdesc *k)
00075         /*@modifies fs, t, k @*/;
00076 void luaK_goiftrue (FuncState *fs, expdesc *e)
00077         /*@modifies fs, e @*/;
00078 void luaK_goiffalse (FuncState *fs, expdesc *e)
00079         /*@modifies fs, e @*/;
00080 void luaK_storevar (FuncState *fs, expdesc *var, expdesc *e)
00081         /*@modifies fs, e @*/;
00082 void luaK_setcallreturns (FuncState *fs, expdesc *var, int nresults)
00083         /*@modifies fs, var @*/;
00084 int luaK_jump (FuncState *fs)
00085         /*@modifies fs @*/;
00086 void luaK_patchlist (FuncState *fs, int list, int target)
00087         /*@modifies fs @*/;
00088 void luaK_patchtohere (FuncState *fs, int list)
00089         /*@modifies fs @*/;
00090 void luaK_concat (FuncState *fs, int *l1, int l2)
00091         /*@modifies fs, *l1 @*/;
00092 int luaK_getlabel (FuncState *fs)
00093         /*@modifies fs @*/;
00094 void luaK_prefix (FuncState *fs, UnOpr op, expdesc *v)
00095         /*@modifies fs, v @*/;
00096 void luaK_infix (FuncState *fs, BinOpr op, expdesc *v)
00097         /*@modifies fs, v @*/;
00098 void luaK_posfix (FuncState *fs, BinOpr op, expdesc *v1, expdesc *v2)
00099         /*@modifies fs, v1, v2 @*/;
00100 
00101 
00102 #endif

Generated on Fri Oct 12 08:44:54 2007 for rpm by  doxygen 1.5.2