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

@@ -1,3 +1,4 @@
#include "wrap-ostream.hpp"
#include "pprint.hpp"
@@ -7,7 +8,7 @@
#include <iostream>
void atomic_print(LuaStack &LS, LuaSlot val, bool quote, std::ostream *os) {
void atomic_print(LuaStack &LS, LuaSlot val, bool quote, eng::ostream *os) {
int tt = LS.type(val);
switch (tt) {
case LUA_TNIL:
@@ -102,7 +103,7 @@ struct Inspector {
bool indent;
int maxlen;
bool anyindent;
std::ostream *stream;
eng::ostream *stream;
};
static void tabify(Inspector &insp, int level) {
@@ -142,7 +143,7 @@ static void pprint_r(Inspector &insp, int level, LuaSlot root) {
// Print the table's name, if any.
bool is_class = false;
bool is_tangible = false;
std::string cname = LS.classname(root);
eng::string cname = LS.classname(root);
if (cname != "") {
is_class = true;
(*insp.stream) << "<class " << cname << ">";
@@ -234,7 +235,7 @@ static void pprint_r(Inspector &insp, int level, LuaSlot root) {
LS.result();
}
void pprint(LuaStack &LS0, LuaSlot root, bool indent, std::ostream *os) {
void pprint(LuaStack &LS0, LuaSlot root, bool indent, eng::ostream *os) {
Inspector insp;
LuaStack LS(LS0.state(), insp.ids);
findtables(LS, root, insp.ids);
@@ -252,7 +253,7 @@ LuaDefine(string_isidentifier, "str", "return true if the string is a valid lua
LuaRet result;
LuaStack LS(L, str, result);
if (LS.isstring(str)) {
std::string s = LS.ckstring(str);
eng::string s = LS.ckstring(str);
LS.set(result, util::is_identifier(s));
} else {
LS.set(result, false);
@@ -264,7 +265,7 @@ LuaDefine(string_print, "obj", "print the specified object into a string") {
LuaArg val;
LuaRet result;
LuaStack LS(L, val, result);
std::ostringstream oss;
eng::ostringstream oss;
atomic_print(LS, val, false, &oss);
LS.set(result, oss.str());
return LS.result();
@@ -275,7 +276,7 @@ LuaDefine(string_pprint, "obj,indent", "pretty-print the specified object into a
LuaRet result;
LuaStack LS(L, root, indent, result);
bool ind = LS.ckboolean(indent);
std::ostringstream oss;
eng::ostringstream oss;
pprint(LS, root, ind, &oss);
LS.set(result, oss.str());
return LS.result();
@@ -285,7 +286,7 @@ LuaDefine(tostring, "obj", "print the specified object into a string") {
LuaArg val;
LuaRet result;
LuaStack LS(L, val, result);
std::ostringstream oss;
eng::ostringstream oss;
atomic_print(LS, val, false, &oss);
LS.set(result, oss.str());
return LS.result();