lvm.cpp File Reference

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "lua.h"
#include "ldebug.h"
#include "ldo.h"
#include "lfunc.h"
#include "lgc.h"
#include "lobject.h"
#include "lopcodes.h"
#include "lstate.h"
#include "lstring.h"
#include "ltable.h"
#include "ltm.h"
#include "lvm.h"

Go to the source code of this file.

Defines

#define lvm_c
#define LUA_CORE
#define MAXTAGLOOP   100
#define runtime_check(L, c)   { if (!(c)) break; }
#define RA(i)   (base+GETARG_A(i))
#define RB(i)   check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i))
#define RC(i)   check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))
#define RKB(i)
#define RKC(i)
#define KBx(i)   check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i))
#define dojump(L, pc, i)   {(pc) += (i); luai_threadyield(L);}
#define Protect(x)   { L->savedpc = pc; {x;}; base = L->base; }
#define arith_op(op, tm)

Functions

const TValueluaV_tonumber (const TValue *obj, TValue *n)
int luaV_tostring (lua_State *L, StkId obj)
static void traceexec (lua_State *L, const Instruction *pc)
static void callTMres (lua_State *L, StkId res, const TValue *f, const TValue *p1, const TValue *p2)
static void callTM (lua_State *L, const TValue *f, const TValue *p1, const TValue *p2, const TValue *p3)
void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val)
void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val)
static int call_binTM (lua_State *L, const TValue *p1, const TValue *p2, StkId res, TMS event)
static const TValueget_compTM (lua_State *L, Table *mt1, Table *mt2, TMS event)
static int call_orderTM (lua_State *L, const TValue *p1, const TValue *p2, TMS event)
static int l_strcmp (const TString *ls, const TString *rs)
int luaV_lessthan (lua_State *L, const TValue *l, const TValue *r)
static int lessequal (lua_State *L, const TValue *l, const TValue *r)
int luaV_equalval (lua_State *L, const TValue *t1, const TValue *t2)
void luaV_concat (lua_State *L, int total, int last)
static void Arith (lua_State *L, StkId ra, const TValue *rb, const TValue *rc, TMS op)
void luaV_execute (lua_State *L, int nexeccalls)


Define Documentation

#define arith_op ( op,
tm   ) 

Value:

{ \
        TValue *rb = RKB(i); \
        TValue *rc = RKC(i); \
        if (ttisnumber(rb) && ttisnumber(rc)) { \
          lua_Number nb = nvalue(rb), nc = nvalue(rc); \
          setnvalue(ra, op(nb, nc)); \
        } \
        else \
          Protect(Arith(L, ra, rb, rc, tm)); \
      }

Definition at line 363 of file lvm.cpp.

#define dojump ( L,
pc,
 )     {(pc) += (i); luai_threadyield(L);}

Definition at line 357 of file lvm.cpp.

#define KBx (  )     check_exp(getBMode(GET_OPCODE(i)) == OpArgK, k+GETARG_Bx(i))

Definition at line 354 of file lvm.cpp.

#define LUA_CORE

Definition at line 13 of file lvm.cpp.

#define lvm_c

Definition at line 12 of file lvm.cpp.

#define MAXTAGLOOP   100

Definition at line 32 of file lvm.cpp.

Referenced by luaV_gettable(), and luaV_settable().

#define Protect ( x   )     { L->savedpc = pc; {x;}; base = L->base; }

Definition at line 360 of file lvm.cpp.

#define RA (  )     (base+GETARG_A(i))

Definition at line 346 of file lvm.cpp.

#define RB (  )     check_exp(getBMode(GET_OPCODE(i)) == OpArgR, base+GETARG_B(i))

Definition at line 348 of file lvm.cpp.

#define RC (  )     check_exp(getCMode(GET_OPCODE(i)) == OpArgR, base+GETARG_C(i))

Definition at line 349 of file lvm.cpp.

#define RKB (  ) 

Value:

Definition at line 350 of file lvm.cpp.

#define RKC (  ) 

Value:

Definition at line 352 of file lvm.cpp.

#define runtime_check ( L,
c   )     { if (!(c)) break; }

Definition at line 344 of file lvm.cpp.


Function Documentation

static void Arith ( lua_State L,
StkId  ra,
const TValue rb,
const TValue rc,
TMS  op 
) [static]

Definition at line 316 of file lvm.cpp.

References call_binTM(), lua_assert, luaG_aritherror(), luaV_tonumber(), NULL, nvalue, setnvalue, TM_ADD, TM_DIV, TM_MOD, TM_MUL, TM_POW, TM_SUB, and TM_UNM.

static int call_binTM ( lua_State L,
const TValue p1,
const TValue p2,
StkId  res,
TMS  event 
) [static]

Definition at line 163 of file lvm.cpp.

References callTMres(), luaT_gettmbyobj(), and ttisnil.

Referenced by Arith(), and luaV_concat().

static int call_orderTM ( lua_State L,
const TValue p1,
const TValue p2,
TMS  event 
) [static]

Definition at line 188 of file lvm.cpp.

References callTMres(), l_isfalse, luaO_rawequalObj(), luaT_gettmbyobj(), lua_State::top, and ttisnil.

Referenced by lessequal(), and luaV_lessthan().

static void callTM ( lua_State L,
const TValue f,
const TValue p1,
const TValue p2,
const TValue p3 
) [static]

Definition at line 98 of file lvm.cpp.

References luaD_call(), luaD_checkstack, setobj2s, and lua_State::top.

Referenced by luaV_settable().

static void callTMres ( lua_State L,
StkId  res,
const TValue f,
const TValue p1,
const TValue p2 
) [static]

Definition at line 82 of file lvm.cpp.

References luaD_call(), luaD_checkstack, restorestack, savestack, setobj2s, setobjs2s, and lua_State::top.

Referenced by call_binTM(), call_orderTM(), luaV_equalval(), and luaV_gettable().

static const TValue* get_compTM ( lua_State L,
Table mt1,
Table mt2,
TMS  event 
) [static]

Definition at line 174 of file lvm.cpp.

References fasttm, luaO_rawequalObj(), and NULL.

Referenced by luaV_equalval().

static int l_strcmp ( const TString ls,
const TString rs 
) [static]

Definition at line 201 of file lvm.cpp.

References getstr, TString::len, LangStringUtil::strlen(), and TString::tsv.

Referenced by lessequal(), and luaV_lessthan().

static int lessequal ( lua_State L,
const TValue l,
const TValue r 
) [static]

Definition at line 237 of file lvm.cpp.

References call_orderTM(), l_strcmp(), luaG_ordererror(), nvalue, rawtsvalue, TM_LE, TM_LT, ttisnumber, ttisstring, and ttype.

void luaV_concat ( lua_State L,
int  total,
int  last 
)

Definition at line 281 of file lvm.cpp.

Referenced by lua_concat(), and luaO_pushvfstring().

int luaV_equalval ( lua_State L,
const TValue t1,
const TValue t2 
)

Definition at line 253 of file lvm.cpp.

void luaV_execute ( lua_State L,
int  nexeccalls 
)

Definition at line 376 of file lvm.cpp.

Referenced by luaD_call(), and resume().

void luaV_gettable ( lua_State L,
const TValue t,
TValue key,
StkId  val 
)

Definition at line 110 of file lvm.cpp.

Referenced by lua_getfield(), and lua_gettable().

int luaV_lessthan ( lua_State L,
const TValue l,
const TValue r 
)

Definition at line 223 of file lvm.cpp.

Referenced by lua_lessthan().

void luaV_settable ( lua_State L,
const TValue t,
TValue key,
StkId  val 
)

Definition at line 136 of file lvm.cpp.

Referenced by lua_setfield(), and lua_settable().

const TValue* luaV_tonumber ( const TValue obj,
TValue n 
)

Definition at line 35 of file lvm.cpp.

Referenced by Arith(), and luaG_aritherror().

int luaV_tostring ( lua_State L,
StkId  obj 
)

Definition at line 47 of file lvm.cpp.

Referenced by lua_objlen(), and lua_tolstring().

static void traceexec ( lua_State L,
const Instruction pc 
) [static]

Definition at line 60 of file lvm.cpp.

References lua_State::ci, ci_func, getline, lua_State::hookcount, lua_State::hookmask, LUA_HOOKCOUNT, LUA_HOOKLINE, LUA_MASKLINE, luaD_callhook(), pcRel, resethookcount, and lua_State::savedpc.


Generated on Mon Feb 16 15:14:58 2009 for Scorched3D by  doxygen 1.5.3