Migrated engine to using dlmalloc through eng::

This commit is contained in:
2022-02-24 02:17:41 -05:00
parent acc00289fb
commit f467944095
61 changed files with 631 additions and 590 deletions

View File

@@ -65,12 +65,12 @@
// LS.rawget(value, tab, key);
//
// Nominally, you would expect value, tab, and key to be lua local
// variables. But if you pass a std::string for key, then LuaStack will
// variables. But if you pass a eng::string for key, then LuaStack will
// automatically convert it. In general, class LuaStack can
// convert lua_Integer, lua_Number, std::string, bool, and LuaNil.
// convert lua_Integer, lua_Number, eng::string, bool, and LuaNil.
//
// On output, LuaStack can convert lua_Integers, lua_Numbers, and
// std::strings. In this case, strict type checking is done. If
// eng::strings. In this case, strict type checking is done. If
// there is a type mismatch, a lua error is thrown.
//
// You can use the operator 'set' to assign a value to a lua local
@@ -114,7 +114,7 @@
//
// lua_Integer LuaStack::ckinteger(LuaSlot s)
// lua_Number LuaStack::cknumber(LuaSlot s)
// std::string LuaStack::ckstring(LuaSlot s)
// eng::string LuaStack::ckstring(LuaSlot s)
// lua_State *LuaStack::ckthread(LuaSlot s)
//
// Like the other operations, they are strict.
@@ -295,7 +295,7 @@ private:
void push_any_value(LuaNewTableMarker s) const { lua_newtable(L_); }
void push_any_value(LuaNilMarker s) const { lua_pushnil(L_); }
void push_any_value(LuaSlot s) const { lua_pushvalue(L_, s); }
void push_any_value(const std::string &s) const { lua_pushlstring(L_, s.c_str(), s.size()); }
void push_any_value(const eng::string &s) const { lua_pushlstring(L_, s.c_str(), s.size()); }
void push_any_value(const char *s) const { lua_pushstring(L_, s); }
void push_any_value(float s) const { lua_pushnumber(L_, s); }
void push_any_value(double s) const { lua_pushnumber(L_, s); }
@@ -360,7 +360,7 @@ public:
lua_Integer ckinteger(LuaSlot s) const;
int ckint(LuaSlot s) const;
lua_Number cknumber(LuaSlot s) const;
std::string ckstring(LuaSlot s) const;
eng::string ckstring(LuaSlot s) const;
lua_State *ckthread(LuaSlot s) const;
void clearmetatable(LuaSlot tab) const;
@@ -379,28 +379,28 @@ public:
// Return true if the classname is legal.
bool validclassname(LuaSlot value) const;
static bool validclassname(const std::string &cname);
static bool validclassname(const eng::string &cname);
// Return the class name if x is a valid classtab.
// Otherwise, returns empty string. If nonempty, the
// result is guaranteed to be a validclassname.
// This can also function as an "isclass" operator.
std::string classname(LuaSlot x) const;
eng::string classname(LuaSlot x) const;
// Look up a class.
// If there is a problem, returns an error message.
// There are lots of error conditions, including such things
// as no such class, corrupted class, classname invalid, etc.
std::string getclass(LuaSlot tab, LuaSlot name) const;
std::string getclass(LuaSlot tab, const char *name) const;
std::string getclass(LuaSlot tab, const std::string &name) const;
eng::string getclass(LuaSlot tab, LuaSlot name) const;
eng::string getclass(LuaSlot tab, const char *name) const;
eng::string getclass(LuaSlot tab, const eng::string &name) const;
// Create a class, or look up an existing class.
// WARNING: this routine assert-fails if the parameter is not
// a valid classname. Check the classname before calling this!
void makeclass(LuaSlot tab, LuaSlot name) const;
void makeclass(LuaSlot tab, const char *name) const;
void makeclass(LuaSlot tab, const std::string &name) const;
void makeclass(LuaSlot tab, const eng::string &name) const;
// Get the ID of a tangible. It's a little weird to put this in
// this module.
@@ -481,7 +481,7 @@ private:
static LuaFunctionReg *LuaFunctionRegistry;
public:
using List = std::vector<LuaFunctionReg *>;
using List = eng::vector<LuaFunctionReg *>;
LuaFunctionReg(const char *name, const char *args, const char *docs, lua_CFunction f);
static List all();
@@ -507,5 +507,5 @@ public:
#define LuaStringify(x) #x
#define LuaAssert(L, x) if (!(x)) { luaL_error((L), "Assert failed: %s (file %s line %d)", LuaStringify(x), __FILE__, __LINE__); }
#define LuaAssertStrEq(L, x, y) { std::string _s1_(x); std::string _s2_(y); if (_s1_ != _s2_) luaL_error((L), "Assert failed: value=%s (file %s line %d)", _s1_.c_str(), __FILE__, __LINE__); }
#define LuaAssertStrEq(L, x, y) { eng::string _s1_(x); eng::string _s2_(y); if (_s1_ != _s2_) luaL_error((L), "Assert failed: value=%s (file %s line %d)", _s1_.c_str(), __FILE__, __LINE__); }
#endif // LUASTACK_HPP