static OldList excludedSymbols { offset = (uint)&((Symbol)0).left };
static bool readOnly;
+define app = (GuiApplication)__thisModule.application;
+
#define UTF8_NUM_BYTES(x) (__extension__({ byte b = x; (b & 0x80 && b & 0x40) ? ((b & 0x20) ? ((b & 0x10) ? 4 : 3) : 2) : 1; }))
default:
SetExcludedSymbols(&excludedSymbols);
SetDefines(&::defines);
SetImports(&imports);
-
+
SetGlobalData(globalData);
settingsContainer.dataOwner = &settings;
row.collapsed = false;
#endif
}
+
+ commandThread.Create();
+ return true;
+ }
+
+ bool Cycle(bool idle)
+ {
+ if(quit)
+ mainForm.Destroy(0);
return true;
}
void Terminate()
{
+ PrintLn("Exited");
+ console.Flush();
+ quit = true;
+ console.CloseInput();
+ console.CloseOutput();
+ app.Unlock();
+ commandThread.Wait();
+ app.Lock();
+
FreeContext(globalContext);
FreeExcludedSymbols(excludedSymbols);
::defines.Free(FreeModuleDefine);
}
}
+ConsoleFile console { };
MainForm mainForm { };
+bool quit;
+
+Thread commandThread
+{
+ unsigned int Main()
+ {
+ while(!quit)
+ {
+ char command[1024];
+ console.GetLine(command, sizeof(command));
+ if(!quit && command[0])
+ {
+ app.Lock();
+ if(!strcmpi(command, "Activate"))
+ mainForm.Activate();
+ else if(!strcmpi(command, "Quit"))
+ quit = true;
+ app.Unlock();
+ }
+ }
+ return 0;
+ }
+};
#include <stdlib.h>
#include <string.h>
-#define POM_output 1
-#define POM_error 2
-#define POM_input 4
+#define POM_output 1
+#define POM_error 2
+#define POM_input 4
+#define POM_showWindow 8
#define FSM_start 0
#define FSM_current 1
// Set up the start up info struct.
si.cb = sizeof(STARTUPINFO);
- si.dwFlags = STARTF_USESTDHANDLES|STARTF_USESHOWWINDOW;
+ si.dwFlags = STARTF_USESTDHANDLES | STARTF_USESHOWWINDOW;
+ si.wShowWindow = (mode & POM_showWindow) ? SW_SHOW : SW_HIDE;
si.hStdOutput = hOutput[PIPE_WRITE] ? hOutput[PIPE_WRITE] : hStdOut;
si.hStdInput = hInput [PIPE_READ] ? hInput [PIPE_READ] : hStdIn;
if((mode & POM_error) && (mode & POM_output))
MenuItem * driverItems, * skinItems;
StatusField pos { width = 150 };
StatusField ovr, caps, num;
+ DualPipe documentor;
BitmapResource back { ":ecereBack.jpg", window = this };
BitmapResource bmpBp { ":codeMarks/breakpoint.png", window = this };
helpMenu, $"API Reference", r, f1;
bool NotifySelect(MenuItem selection, Modifiers mods)
{
- char * p = new char[MAX_LOCATION];
- p[0] = '\0';
- strncpy(p, settingsContainer.moduleLocation, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
- PathCat(p, "documentor");
-#if defined(__WIN32__)
- ChangeExtension(p, "exe", p);
-#endif
- if(FileExists(p).isFile)
- Execute(p);
+ if(!documentor)
+ {
+ char * p = new char[MAX_LOCATION];
+ p[0] = '\0';
+ strncpy(p, settingsContainer.moduleLocation, MAX_LOCATION); p[MAX_LOCATION-1] = '\0';
+ PathCat(p, "documentor");
+ #if defined(__WIN32__)
+ ChangeExtension(p, "exe", p);
+ #endif
+ if(!FileExists(p).isFile)
+ strcpy(p, "documentor");
+
+ documentor = DualPipeOpen({ input = true, output = true, showWindow = true }, p);
+ delete p;
+ }
else
- Execute("documentor");
- delete p;
+ {
+ Process_ShowWindows(documentor.GetProcessID());
+ // documentor.Puts("Activate\n");
+ }
return true;
}
}
delete driverItems;
delete skinItems;
delete ideSettings;
+ if(documentor)
+ {
+ documentor.Puts("Quit\n");
+ documentor.Wait();
+ delete documentor;
+ }
}
}
return true;
}
+ bool Cycle(bool idle)
+ {
+ if(ide.documentor)
+ {
+ if(ide.documentor.Peek())
+ {
+ char line[1024];
+ ide.documentor.GetLine(line, sizeof(line));
+ if(!strcmpi(line, "Exited"))
+ delete ide.documentor;
+ }
+ if(ide.documentor && ide.documentor.eof)
+ delete ide.documentor;
+ }
+ return true;
+ }
+
bool LoadIncludeFile()
{
bool result = false;