-- $LastChangedDate: 2011-03-17 19:59:52 -0400 (Thu, 17 Mar 2011) $
-- Macros written in Lua to expand C++ code for bindings between C++/Lua.
-- Avoid lua_/LUA_ which is reserved by Lua.

bindTable = {

class = "Math",
typesig = nil,
luaCanInstantiate = false,

headers =
[[
#include "base/module.hh"
using namespace base;
#include "math/module.hh"
#include "math/graphics.hh"
using namespace math;
]],

func_TruncInt = {
    comments = "int math:TruncInt( f ) / truncate Lua number to integer",
    code = [[
        lua_pushnumber( L, long( POP_FP( L ) ) );
        return 1;  // stack items to return
    ]]
},

func_AXIS_INVALID = {
    comments = "num math:AXIS_INVALID()\n * AXIS_INVALID is defined as ~0 in C++ which varies by CPU,\n * so Lua should get the right value from this.",
    code = [[
        lua_pushnumber( L, AXIS_INVALID );  // let C++ compiler promote it as usual
        return 1;  // stack items to return
    ]]
},

func_IF_Z_FACING = {
    comments = "bool math:IF_Z_FACING( z )\n * Returns true if the eye coordinate Z is facing the viewpoint.",
    code = [[
        const fp z = POP_FP( L );
        lua_pushboolean( L, IF_Z_FACING( z ) );
        return 1;  // stack items to return
    ]]
},

}
