2000-02-22 16:31:19 +03:00
|
|
|
/*
|
2000-06-29 00:21:06 +04:00
|
|
|
** $Id: lcode.h,v 1.14 2000/06/16 17:51:40 roberto Exp roberto $
|
2000-02-22 16:31:19 +03:00
|
|
|
** Code generator for Lua
|
|
|
|
** See Copyright Notice in lua.h
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef lcode_h
|
|
|
|
#define lcode_h
|
|
|
|
|
|
|
|
#include "llex.h"
|
|
|
|
#include "lobject.h"
|
2000-03-03 15:33:59 +03:00
|
|
|
#include "lopcodes.h"
|
|
|
|
#include "lparser.h"
|
2000-02-22 16:31:19 +03:00
|
|
|
|
|
|
|
|
2000-04-12 22:47:03 +04:00
|
|
|
/*
|
|
|
|
** Marks the end of a patch list. It is an invalid value both as an absolute
|
|
|
|
** address, and as a list link (would link an element to itself).
|
|
|
|
*/
|
|
|
|
#define NO_JUMP (-1)
|
2000-04-05 21:51:58 +04:00
|
|
|
|
|
|
|
|
2000-05-22 22:44:46 +04:00
|
|
|
enum Mode {iO, iU, iS, iAB}; /* instruction format */
|
|
|
|
|
2000-06-29 00:21:06 +04:00
|
|
|
#define VD 100 /* flag for variable delta */
|
|
|
|
|
2000-05-22 22:44:46 +04:00
|
|
|
extern const struct OpProperties {
|
|
|
|
char mode;
|
2000-06-29 00:21:06 +04:00
|
|
|
unsigned char push;
|
|
|
|
unsigned char pop;
|
2000-05-22 22:44:46 +04:00
|
|
|
} luaK_opproperties[];
|
|
|
|
|
|
|
|
|
2000-03-03 15:33:59 +03:00
|
|
|
void luaK_error (LexState *ls, const char *msg);
|
2000-04-07 23:35:20 +04:00
|
|
|
int luaK_code0 (FuncState *fs, OpCode o);
|
|
|
|
int luaK_code1 (FuncState *fs, OpCode o, int arg1);
|
|
|
|
int luaK_code2 (FuncState *fs, OpCode o, int arg1, int arg2);
|
2000-04-05 21:51:58 +04:00
|
|
|
int luaK_jump (FuncState *fs);
|
2000-03-13 23:37:16 +03:00
|
|
|
void luaK_patchlist (FuncState *fs, int list, int target);
|
2000-04-05 21:51:58 +04:00
|
|
|
void luaK_concat (FuncState *fs, int *l1, int l2);
|
2000-03-13 23:37:16 +03:00
|
|
|
void luaK_goiftrue (FuncState *fs, expdesc *v, int keepvalue);
|
|
|
|
int luaK_getlabel (FuncState *fs);
|
|
|
|
void luaK_deltastack (FuncState *fs, int delta);
|
2000-03-03 21:53:17 +03:00
|
|
|
void luaK_kstr (LexState *ls, int c);
|
2000-03-13 23:37:16 +03:00
|
|
|
void luaK_number (FuncState *fs, Number f);
|
|
|
|
void luaK_adjuststack (FuncState *fs, int n);
|
|
|
|
int luaK_lastisopen (FuncState *fs);
|
|
|
|
void luaK_setcallreturns (FuncState *fs, int nresults);
|
2000-03-09 16:57:37 +03:00
|
|
|
void luaK_tostack (LexState *ls, expdesc *v, int onlyone);
|
2000-03-03 15:33:59 +03:00
|
|
|
void luaK_storevar (LexState *ls, const expdesc *var);
|
|
|
|
void luaK_prefix (LexState *ls, int op, expdesc *v);
|
2000-03-04 23:18:15 +03:00
|
|
|
void luaK_infix (LexState *ls, int op, expdesc *v);
|
2000-03-03 15:33:59 +03:00
|
|
|
void luaK_posfix (LexState *ls, int op, expdesc *v1, expdesc *v2);
|
2000-02-22 16:31:19 +03:00
|
|
|
|
|
|
|
|
|
|
|
#endif
|