A lot of refactoring on the PrettyPrint code and the various printf routines.

This commit is contained in:
2026-02-18 22:26:11 -05:00
parent ad9f8e0309
commit 0de2a50843
5 changed files with 160 additions and 142 deletions

View File

@@ -865,7 +865,7 @@ LuaDefine(print, "obj1, obj2, ...",
int n = lua_gettop(L);
for (int i = 1; i <= n; i++) {
LuaSpecial root(i);
atomic_print(LS, root, false, ostream);
PrettyPrint::Atomic(false).print(LS, root, ostream);
if (i < n) (*ostream) << " ";
}
(*ostream) << std::endl;
@@ -879,7 +879,7 @@ LuaDefine(dprint, "obj1, obj2, ...",
int n = lua_gettop(L);
for (int i = 1; i <= n; i++) {
LuaSpecial root(i);
atomic_print(LS, root, false, &oss);
PrettyPrint::Atomic(false).print(LS, root, &oss);
if (i < n) oss << " ";
}
oss << std::endl;
@@ -925,7 +925,7 @@ LuaDefine(printf, "fmt, ...",
LuaExtraArgs extra;
LuaDefStack LS(L, lfmt, extra);
eng::string fmtstr = LS.ckstring(lfmt, "format string");
eng::string err = format(LS, fmtstr, extra, ostream);
eng::string err = PrettyPrint::format(LS, fmtstr, extra, ostream);
if (!err.empty()) {
luaL_error(L, "%s", err.c_str());
}
@@ -942,7 +942,7 @@ LuaDefine(dprintf, "fmt, ...",
LuaDefStack LS(L, lfmt, extra);
eng::string fmtstr = LS.ckstring(lfmt, "format string");
std::ostringstream oss;
eng::string err = format(LS, fmtstr, extra, &oss);
eng::string err = PrettyPrint::format(LS, fmtstr, extra, &oss);
if (!err.empty()) {
luaL_error(L, "%s", err.c_str());
}
@@ -961,7 +961,7 @@ LuaDefine(string_format, "fmt, ...",
LuaDefStack LS(L, lfmt, result, extra);
eng::string fmtstr = LS.ckstring(lfmt, "format string");
util::ostringstream oss;
eng::string err = format(LS, fmtstr, extra, &oss);
eng::string err = PrettyPrint::format(LS, fmtstr, extra, &oss);
if (!err.empty()) {
luaL_error(L, "%s", err.c_str());
}