diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-09 11:49:13 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2000-08-09 11:49:13 -0300 |
| commit | 5f22f8961c80ce36297f086ae31d87bbb6897c97 (patch) | |
| tree | 61837abde7ea51dfe61140734af716437253f605 /lcode.h | |
| parent | a7c1390ffaf0edfe839d075df484f2b81b3151bf (diff) | |
| download | lua-5f22f8961c80ce36297f086ae31d87bbb6897c97.tar.gz lua-5f22f8961c80ce36297f086ae31d87bbb6897c97.tar.bz2 lua-5f22f8961c80ce36297f086ae31d87bbb6897c97.zip | |
better code for unary/binary operators
Diffstat (limited to 'lcode.h')
| -rw-r--r-- | lcode.h | 22 |
1 files changed, 18 insertions, 4 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lcode.h,v 1.14 2000/06/16 17:51:40 roberto Exp roberto $ | 2 | ** $Id: lcode.h,v 1.15 2000/06/28 20:20:36 roberto Exp roberto $ |
| 3 | ** Code generator for Lua | 3 | ** Code generator for Lua |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -20,6 +20,20 @@ | |||
| 20 | #define NO_JUMP (-1) | 20 | #define NO_JUMP (-1) |
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | /* | ||
| 24 | ** grep "ORDER OPR" if you change these enums | ||
| 25 | */ | ||
| 26 | typedef enum BinOpr { | ||
| 27 | OPR_ADD, OPR_SUB, OPR_MULT, OPR_DIV, OPR_POW, | ||
| 28 | OPR_CONCAT, | ||
| 29 | OPR_NE, OPR_EQ, OPR_LT, OPR_LE, OPR_GT, OPR_GE, | ||
| 30 | OPR_AND, OPR_OR, | ||
| 31 | OPR_NOBINOPR | ||
| 32 | } BinOpr; | ||
| 33 | |||
| 34 | typedef enum UnOpr { OPR_MINUS, OPR_NOT, OPR_NOUNOPR } UnOpr; | ||
| 35 | |||
| 36 | |||
| 23 | enum Mode {iO, iU, iS, iAB}; /* instruction format */ | 37 | enum Mode {iO, iU, iS, iAB}; /* instruction format */ |
| 24 | 38 | ||
| 25 | #define VD 100 /* flag for variable delta */ | 39 | #define VD 100 /* flag for variable delta */ |
| @@ -48,9 +62,9 @@ int luaK_lastisopen (FuncState *fs); | |||
| 48 | void luaK_setcallreturns (FuncState *fs, int nresults); | 62 | void luaK_setcallreturns (FuncState *fs, int nresults); |
| 49 | void luaK_tostack (LexState *ls, expdesc *v, int onlyone); | 63 | void luaK_tostack (LexState *ls, expdesc *v, int onlyone); |
| 50 | void luaK_storevar (LexState *ls, const expdesc *var); | 64 | void luaK_storevar (LexState *ls, const expdesc *var); |
| 51 | void luaK_prefix (LexState *ls, int op, expdesc *v); | 65 | void luaK_prefix (LexState *ls, UnOpr op, expdesc *v); |
| 52 | void luaK_infix (LexState *ls, int op, expdesc *v); | 66 | void luaK_infix (LexState *ls, BinOpr op, expdesc *v); |
| 53 | void luaK_posfix (LexState *ls, int op, expdesc *v1, expdesc *v2); | 67 | void luaK_posfix (LexState *ls, BinOpr op, expdesc *v1, expdesc *v2); |
| 54 | 68 | ||
| 55 | 69 | ||
| 56 | #endif | 70 | #endif |
