From e9f4fc638ed904cc0dcdac24ea7708c9a220a702 Mon Sep 17 00:00:00 2001 From: briaguya <70942617+briaguya-ai@users.noreply.github.com> Date: Tue, 17 Oct 2023 22:04:12 -0400 Subject: update to latest version used by SoH --- ZAPD/OutputFormatter.cpp | 42 +++++++++++++++++++++++++----------------- 1 file changed, 25 insertions(+), 17 deletions(-) (limited to 'ZAPD/OutputFormatter.cpp') diff --git a/ZAPD/OutputFormatter.cpp b/ZAPD/OutputFormatter.cpp index 393ec19..362ef98 100644 --- a/ZAPD/OutputFormatter.cpp +++ b/ZAPD/OutputFormatter.cpp @@ -1,32 +1,40 @@ #include "OutputFormatter.h" +#include void OutputFormatter::Flush() { - if (col > lineLimit) + //if (!Globals::Instance->otrMode) // OTRTODO: MULTITHREADING { - str.append(1, '\n'); - str.append(currentIndent, ' '); + if (col > lineLimit && !Globals::Instance->otrMode) + { + str.append(1, '\n'); + str.append(currentIndent, ' '); - uint32_t newCol = currentIndent + (wordP - word); + uint32_t newCol = currentIndent + (wordP - word); - for (uint32_t i = 0; i < wordNests; i++) - nestIndent[nest - i] -= col - newCol; + for (uint32_t i = 0; i < wordNests; i++) + nestIndent[nest - i] -= col - newCol; - col = newCol; - } - else - { - str.append(space, spaceP - space); - } - spaceP = space; + col = newCol; + } + else + { + str.append(space, spaceP - space); + } + spaceP = space; - str.append(word, wordP - word); - wordP = word; - wordNests = 0; + str.append(word, wordP - word); + wordP = word; + wordNests = 0; + } } int OutputFormatter::Write(const char* buf, int count) { + // OTRTODO + //if (!Globals::Instance->singleThreaded) + //return 0; + for (int i = 0; i < count; i++) { char c = buf[i]; @@ -88,7 +96,7 @@ int OutputFormatter::Write(const std::string& buf) return Write(buf.data(), buf.size()); } -OutputFormatter* OutputFormatter::Instance; +thread_local OutputFormatter* OutputFormatter::Instance; int OutputFormatter::WriteStatic(const char* buf, int count) { -- cgit v1.2.3