summaryrefslogtreecommitdiff
path: root/ZAPD/OutputFormatter.cpp
diff options
context:
space:
mode:
authorbriaguya <70942617+briaguya-ai@users.noreply.github.com>2023-10-17 22:04:12 -0400
committerbriaguya <70942617+briaguya-ai@users.noreply.github.com>2023-10-17 22:04:12 -0400
commite9f4fc638ed904cc0dcdac24ea7708c9a220a702 (patch)
tree114c3d432697e04831741e623ae2340f6239bbe9 /ZAPD/OutputFormatter.cpp
parentdcf56d93ecbd4db3bfd8a4832d7f991467964b98 (diff)
update to latest version used by SoH
Diffstat (limited to 'ZAPD/OutputFormatter.cpp')
-rw-r--r--ZAPD/OutputFormatter.cpp42
1 files changed, 25 insertions, 17 deletions
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 <Globals.h>
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)
{