summaryrefslogtreecommitdiffhomepage
path: root/FoundationEx
diff options
context:
space:
mode:
authorAki <please@ignore.pl>2022-02-15 00:14:59 +0100
committerAki <please@ignore.pl>2022-02-15 00:14:59 +0100
commit2ba78cf22f6f0f7c488d0d4cb606c05a841474f2 (patch)
tree16fa28469582c2fd5c9b0bde85f619336a2d4076 /FoundationEx
parent0ea71e86d0cf91718d3a9406060d7413f9c5aa01 (diff)
downloadstarshatter-2ba78cf22f6f0f7c488d0d4cb606c05a841474f2.zip
starshatter-2ba78cf22f6f0f7c488d0d4cb606c05a841474f2.tar.gz
starshatter-2ba78cf22f6f0f7c488d0d4cb606c05a841474f2.tar.bz2
Exported infamous Print to FoundationEx
Diffstat (limited to 'FoundationEx')
-rw-r--r--FoundationEx/CMakeLists.txt1
-rw-r--r--FoundationEx/Utils.cpp39
-rw-r--r--FoundationEx/Utils.h17
3 files changed, 57 insertions, 0 deletions
diff --git a/FoundationEx/CMakeLists.txt b/FoundationEx/CMakeLists.txt
index 8672619..c2b546b 100644
--- a/FoundationEx/CMakeLists.txt
+++ b/FoundationEx/CMakeLists.txt
@@ -4,6 +4,7 @@ add_library(
STATIC
MemDebug.cpp
Text.cpp
+ Utils.cpp
)
target_include_directories(
FoundationEx
diff --git a/FoundationEx/Utils.cpp b/FoundationEx/Utils.cpp
new file mode 100644
index 0000000..8a9f157
--- /dev/null
+++ b/FoundationEx/Utils.cpp
@@ -0,0 +1,39 @@
+/* Starshatter: The Open Source Project
+ Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
+ Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
+ Copyright (c) 1997-2006, Destroyer Studios LLC.
+*/
+
+#include <stdarg.h>
+#include <stdio.h>
+
+
+FILE* ErrLog = nullptr;
+
+
+void AssignErrLog(FILE * out)
+{
+ ErrLog = out;
+}
+
+
+int CloseErrLog()
+{
+ if (ErrLog)
+ return fclose(Errlog);
+ return 0;
+}
+
+
+void Print(const char* fmt, ...)
+{
+ if (!ErrLog) return;
+ va_list args;
+ va_start(args, fmt);
+ vfprintf_s(ErrLog, fmt, args);
+ fflush(ErrLog);
+ va_end(args);
+}
+
+
+#endif // Utils_h
diff --git a/FoundationEx/Utils.h b/FoundationEx/Utils.h
new file mode 100644
index 0000000..da7b66d
--- /dev/null
+++ b/FoundationEx/Utils.h
@@ -0,0 +1,17 @@
+/* Starshatter: The Open Source Project
+ Copyright (c) 2021-2022, Starshatter: The Open Source Project Contributors
+ Copyright (c) 2011-2012, Starshatter OpenSource Distribution Contributors
+ Copyright (c) 1997-2006, Destroyer Studios LLC.
+*/
+
+#ifndef Utils_h
+#define Utils_h
+
+#include <stdio.h>
+
+
+void AssignErrLog(FILE * out);
+void CloseErrLog();
+void Print(const char* fmt, ...);
+
+#endif // Utils_h