summaryrefslogtreecommitdiff
path: root/miscutil.cpp
diff options
context:
space:
mode:
authorakshay-c2018-05-21 23:03:31 +0530
committerakshay-c2018-05-21 23:03:31 +0530
commit8deab843fa6d616086955702c77751f631badc0d (patch)
tree56569336b3a84cd63d34bead87ee340ba3964347 /miscutil.cpp
downloadLDMicroGtk-8deab843fa6d616086955702c77751f631badc0d.tar.gz
LDMicroGtk-8deab843fa6d616086955702c77751f631badc0d.tar.bz2
LDMicroGtk-8deab843fa6d616086955702c77751f631badc0d.zip
First Commit
Diffstat (limited to 'miscutil.cpp')
-rw-r--r--miscutil.cpp42
1 files changed, 42 insertions, 0 deletions
diff --git a/miscutil.cpp b/miscutil.cpp
new file mode 100644
index 0000000..0377654
--- /dev/null
+++ b/miscutil.cpp
@@ -0,0 +1,42 @@
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdbool.h>
+#include <iostream>
+#include <linux/limits.h>
+#include<X11/Xlib.h>
+#include "ldmicro.h"
+
+// We should display messages to the user differently if we are running
+// interactively vs. in batch (command-line) mode.
+//char CurrentSaveFile[PATH_MAX];
+//char CurrentCompileFile[PATH_MAX];
+bool RunningInBatchMode;
+
+void Error(char *str, ...)
+{
+ va_list f;
+ char buf[1024];
+ va_start(f, str);
+ vsprintf(buf, str, f);
+ if(RunningInBatchMode) {
+ /*AttachConsoleDynamic(ATTACH_PARENT_PROCESS);
+ HANDLE h = GetStdHandle(STD_OUTPUT_HANDLE);
+ DWORD written;*/
+
+ // Indicate that it's an error, plus the output filename
+ char str[PATH_MAX+100];
+ sprintf(str, "compile error ('%s'): ", CurrentCompileFile);
+ std::cout<<str<<std::endl;
+ //WriteFile(h, str, strlen(str), &written, NULL);
+ // The error message itself
+ std::cout<<buf<<std::endl;
+ //WriteFile(h, buf, strlen(buf), &written, NULL);
+ // And an extra newline to be safe.
+ std::cout<<str<<std::endl;
+ //strcpy(str, "\n");
+ //WriteFile(h, str, strlen(str), &written, NULL);
+ } else {
+ //HWND h = GetForegroundWindow();
+ //MessageBox(h, buf, _("LDmicro Error"), MB_OK | MB_ICONERROR);
+ }
+}