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:
sprintf(docFile, "%s/%s.eCdoc", settings.docDir, (!module || !module.name || (ns && ns->name && !strcmp(ns->name, "namespaces/ecere/namespaces/com"))) ? "ecereCOM" : module.name);
- archive = ArchiveOpen(docFile, { true } );
- readOnly = archive == null;
- delete archive;
+ if(FileExists(docFile))
+ {
+ archive = ArchiveOpen(docFile, { true } );
+ readOnly = archive == null;
+ delete archive;
+ }
+ else
+ {
+ readOnly = true;
+ archive = ArchiveOpen(docFile, { true } );
+ if(archive)
+ {
+ // Must create root directory on archive creation
+ ArchiveDir dir = archive.OpenDirectory("", null, replace);
+ if(dir)
+ readOnly = false;
+ delete dir;
+ }
+ delete archive;
+ }
}
page.Generate(f);
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;
+ if(commandThread.created)
+ {
+ 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;
+ }
+};