9 static define localeDir = "locale";
11 static bool outputPot;
12 static bool disabledPooling;
14 static Platform targetPlatform;
15 static int targetBits;
17 static bool isConsole;
18 static bool isDynamicLibrary;
19 static bool isStaticLibrary;
20 static OldList modules;
21 static File dcomSymbols;
23 static OldList _defines { };
24 static OldList _imports { };
25 static OldList _excludedSymbols { offset = (uint)(uintptr)&((Symbol)0).left };
26 static NameSpace globalData
28 classes.CompareKey = (void *)BinaryTree::CompareString;
29 defines.CompareKey = (void *)BinaryTree::CompareString;
30 functions.CompareKey = (void *)BinaryTree::CompareString;
31 nameSpaces.CompareKey = (void *)BinaryTree::CompareString;
33 static Context theGlobalContext { };
34 static ModuleImport mainModule;
35 static Module privateModule;
37 static char mainModuleName[MAX_LOCATION];
38 static char projectName[MAX_LOCATION];
39 static void LoadImports(const char * fileName)
41 File f = FileOpen(fileName, read);
47 if(!f.GetLine(line, sizeof(line))) break;
48 TrimLSpaces(line, line);
52 if(!strcmp(line, "[Imported Modules]"))
54 ModuleImport module = null;
57 if(!f.GetLine(line, sizeof(line))) break;
58 TrimLSpaces(line, line);
59 if(!strcmp(line, ".")) break;
63 ClassImport _class = null;
64 FunctionImport function = null;
66 if(!strcmp(line, "[This]"))
68 if((mainModule = GetMainModule()))
72 mainModule = ModuleImport { };
73 SetMainModule(mainModule);
75 _imports.AddName(module);
78 else if(!strcmp(line, "[Static]"))
80 module.importType = staticImport;
82 else if(!strcmp(line, "[Remote]"))
84 module.importType = remoteImport;
86 else if(!strcmp(line, "[Private]"))
88 if(module.importAccess != publicAccess)
89 module.importAccess = privateAccess;
91 else if(!strcmp(line, "[Public]"))
93 module.importAccess = publicAccess;
95 else if(!strcmp(line, "[Imported Classes]"))
99 if(!f.GetLine(line, sizeof(line))) break;
100 TrimLSpaces(line, line);
101 if(!strcmp(line, ".")) break;
105 if(!strcmp(line, "[Instantiated]"))
107 _class.itself = true;
109 else if(!strcmp(line, "[Remote]"))
113 else if(!strcmp(line, "[Imported Methods]"))
115 MethodImport method = null;
118 if(!f.GetLine(line, sizeof(line))) break;
119 TrimLSpaces(line, line);
120 if(!strcmp(line, ".")) break;
123 if(!(method = _class.methods.FindName(line, false)))
125 method = MethodImport { name = CopyString(line) };
126 _class.methods.AddName(method);
129 else if(!strcmp(line, "[Virtual]"))
130 method.isVirtual = true;
134 else if(!strcmp(line, "[Imported Properties]"))
136 PropertyImport prop = null;
139 if(!f.GetLine(line, sizeof(line))) break;
140 TrimLSpaces(line, line);
141 if(!strcmp(line, ".")) break;
144 if(!(prop = _class.properties.FindName(line, false)))
146 prop = PropertyImport { name = CopyString(line) };
147 _class.properties.AddName(prop);
150 else if(!strcmp(line, "[Set]"))
152 else if(!strcmp(line, "[Get]"))
154 else if(!strcmp(line, "[Virtual]"))
155 prop.isVirtual = true;
161 if(!(_class = module.classes.FindName(line, false)))
163 _class = ClassImport { name = CopyString(line) };
164 module.classes.AddName(_class);
169 else if(!strcmp(line, "[Imported Functions]"))
173 if(!f.GetLine(line, sizeof(line))) break;
174 TrimLSpaces(line, line);
175 if(!strcmp(line, ".")) break;
182 if(!(function = module.functions.FindName(line, false)))
184 function = FunctionImport { name = CopyString(line) };
185 module.functions.AddName(function);
193 if(!(module = _imports.FindName(line, false)))
195 if(!strcmp(line, "ecereCOM"))
197 module = _imports.FindName("ecere", false);
199 else if(!strcmp(line, "ecere"))
201 module = _imports.FindName("ecereCOM", false);
205 module.name = CopyString("ecere");
210 module = ModuleImport { name = CopyString(line) };
211 _imports.AddName(module);
223 // static Class applicationClass;
224 static Class thisAppClass;
226 class ModuleInfo : struct
228 ModuleInfo prev, next;
234 static bool SeardchModuleName(Module searchIn, char * name)
238 if(searchIn.name && !strcmp(searchIn.name, name))
241 for(subModule = searchIn.modules.first; subModule; subModule = subModule.next)
243 if(SearchModuleName(subModule.module, name))
249 static void WriteMain(const char * fileName)
251 File f = FileOpen(fileName, write);
255 ModuleInfo defModule;
256 bool /*nonInst = false, */anyMethod = false, anyProp = false, anyFunction = false;
257 ImportedModule importedModule;
259 GetLastDirectory(fileName, mainModuleName);
260 StripExtension(mainModuleName);
263 strcpy(projectName, mainModuleName);
264 StripExtension(projectName);
266 FixModuleName(mainModuleName);
268 if(targetPlatform == win32 && !isConsole && !isStaticLibrary && !isDynamicLibrary)
270 //f.Puts("#include <windows.h>\n\n");
272 f.Puts("typedef void * HINSTANCE;\n");
273 f.Puts("#define WINAPI __stdcall\n");
276 for(importedModule = ::_defines.first; importedModule; importedModule = importedModule.next)
278 if(importedModule.type == moduleDefinition)
281 if(importedModule.importType == staticImport)
282 f.Printf("static ", importedModule.name);
283 f.Printf("\"%s\"\n", importedModule.name);
287 f.Puts("default:\n");
288 f.Puts("static Module __currentModule;\n\n");
291 f.Puts("Module __thisModule;\n\n");
293 // TOCHECK: Problem compiling Scrabble.main.ec when binding Client first
298 f.Printf("void __ecereRegisterModule_%s(Module module);\n\n", mainModuleName);
300 for(module = _imports.first; module; module = module.next)
303 FunctionImport function;
304 if(module.importType == staticImport)
306 /*if(targetPlatform == win32)
308 f.Printf("bool __stdcall __ecereDll_Load_%s(Module module);\n", module.name);
309 f.Printf("bool __stdcall __ecereDll_Unload_%s(Module module);\n", module.name);
313 f.Printf("bool __ecereDll_Load_%s(Module module);\n", module.name);
314 f.Printf("bool __ecereDll_Unload_%s(Module module);\n", module.name);
317 for(_class = module.classes.first; _class; _class = _class.next)
321 char className[1024] = "";
322 Class regClass = eSystem_FindClass(privateModule, _class.name);
324 FullClassNameCat(className, _class.name, true);
327 f.Printf("Class __ecereClass_%s;\n", className);
330 //if(!_class.isRemote)
332 //if(strcmp(_class.name, "SerialBuffer"))
334 for(method = _class.methods.first; method; method = method.next)
336 Method meth = eClass_FindMethod(regClass, method.name, privateModule);
337 if(meth && !meth.dataType)
339 Context context = SetupTemplatesContext(regClass);
340 meth.dataType = ProcessTypeString(meth.dataTypeString, false);
341 FinishTemplatesContext(context);
345 f.Printf("int __ecereVMethodID_%s_%s;\n", className, method.name);
346 else if((!strcmp(_class.name, "float") || !strcmp(_class.name, "double") || module.name) && module.importType != staticImport && (!meth || !meth.dataType.dllExport))
356 sprintf(name, "__ecereMethod_%s_%s", className, method.name);
357 PrintType(type, name, true);
358 f.Printf("%s;\n", name);
361 //f.Printf("void * __ecereMethod_%s_%s;\n", className, method.name);
363 f.Printf("int (*__ecereMethod_%s_%s)();\n", className, method.name);
370 for(prop = _class.properties.first; prop; prop = prop.next)
374 FullClassNameCat(propName, prop.name, true);
376 if((!strcmp(_class.name, "float") || !strcmp(_class.name, "double") || module.name) && module.importType != staticImport)
379 f.Printf("void * __ecereProp_%s_Set_%s;\n", className, propName);
381 f.Printf("void * __ecereProp_%s_Get_%s;\n", className, propName);
383 f.Printf("Property __ecereProp_%s_%s;\n", className, propName);
388 for(function = module.functions.first; function; function = function.next)
390 GlobalFunction func = eSystem_FindFunction(privateModule, function.name);
391 if(func && !func.dataType)
392 func.dataType = ProcessTypeString(func.dataTypeString, false);
394 if(module.name && module.importType != staticImport && (!func || !func.dataType || !func.dataType.dllExport))
396 char functionName[1024];
398 FullClassNameCat(functionName, function.name, false);
399 f.Printf("void * __ecereFunction_%s;\n", functionName);
405 for(defModule = ::modules.first; defModule; defModule = defModule.next)
407 char moduleName[1024];
408 strcpy(moduleName, defModule.name);
409 FixModuleName(moduleName);
410 f.Printf("void __ecereRegisterModule_%s(Module module);\n", moduleName);
411 f.Printf("void __ecereUnregisterModule_%s(Module module);\n", moduleName);
412 if(defModule.globalInstance)
414 f.Printf("void __ecereCreateModuleInstances_%s();\n", moduleName);
415 f.Printf("void __ecereDestroyModuleInstances_%s();\n", moduleName);
424 // Insert DCOM bindings here
425 dcomSymbols.Seek(0, start);
426 while(!dcomSymbols.Eof())
429 int read = dcomSymbols.Read(buffer, 1, sizeof(buffer));
431 f.Write(buffer, 1, read);
440 /*if(targetPlatform == win32)
441 f.Printf("\nbool __stdcall __ecereDll_Load_%s(Module module)\n{\n", projectName);
443 f.Printf("\nbool __ecereDll_Load_%s(Module module)\n{\n", projectName);
445 else if(isDynamicLibrary)
447 if(targetPlatform == win32)
448 f.Puts("\ndllexport bool __stdcall __ecereDll_Load(Module module)\n{\n");
450 f.Puts("\ndllexport bool __ecereDll_Load(Module module)\n{\n");
452 else if(targetPlatform == win32 && !isConsole)
454 f.Puts("\nint WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInst, char * cmdLine, int show)\n{\n");
457 f.Puts("\nint main(int _argc, char * _argv[])\n{\n");
459 if(!isDynamicLibrary)
461 f.Puts(" int exitCode;\n");
462 f.Puts(" Module module;\n");
465 //if(nonInst || thisAppClass) // We use it all the time to get "Application" for the exit code now...
466 f.Puts(" __attribute__((unused)) Class _class;\n");
469 f.Puts(" __attribute__((unused)) Method method;\n");
471 f.Puts(" __attribute__((unused)) Property _property;\n");
473 f.Puts(" __attribute__((unused)) GlobalFunction function;\n");
479 f.Puts(" eSystem_SetPoolingDisabled(true);\n");
485 f.Puts(" if(!__currentModule)\n");
487 f.Puts(" __currentModule = module;\n");
489 f.Puts(" __thisModule = module;\n");
492 else if(targetPlatform == win32 && !isConsole)
493 f.Puts(" __thisModule = __currentModule = module = __ecere_COM_Initialize(1, 0, null);\n\n");
495 f.Puts(" __thisModule = __currentModule = module = __ecere_COM_Initialize(1, _argc, (void *)_argv);\n\n");
497 // First load all modules
500 for(module = _imports.first; module; module = module.next)
504 //if(strcmp(module.name, "ecereCOM") && strcmp(module.name, "ecere") )
506 if(module.importType == staticImport)
507 f.Printf(" eModule_LoadStatic(module, \"%s\", %s, __ecereDll_Load_%s, __ecereDll_Unload_%s);\n", module.name, (module.importAccess == privateAccess) ? "privateAccess" : "publicAccess", module.name,module.name);
509 f.Printf(" eModule_Load(module, \"%s\", %s);\n", module.name, (module.importAccess == privateAccess) ? "privateAccess" : "publicAccess");
516 // Then define the classes
519 for(defModule = ::modules.first; defModule; defModule = defModule.next)
521 char moduleName[1024];
522 strcpy(moduleName, defModule.name);
523 FixModuleName(moduleName);
524 f.Printf(" __ecereRegisterModule_%s(module);\n", moduleName);
529 // Register Remote Modules
532 f.Printf(" __ecereRegisterModule_%s(module);\n\n", mainModuleName);
538 f.Puts(" if(__currentModule == module)\n");
541 // Then load the imports
542 for(module = _imports.first; module; module = module.next)
545 FunctionImport function;
546 if(module.classes.count)
548 for(_class = module.classes.first; _class; _class = _class.next)
550 Class regClass = eSystem_FindClass(privateModule, _class.name);
552 //if(!_class.isRemote)
557 char className[1024] = "";
558 FullClassNameCat(className, _class.name, true);
561 sprintf(classID, "__ecereClass_%s", className);
563 strcpy(classID, "_class");
565 if(isDynamicLibrary && !isStaticLibrary)
566 f.Printf(" %s = eSystem_FindClass(__currentModule, \"%s\");\n", classID, _class.name);
568 f.Printf(" %s = eSystem_FindClass(module, \"%s\");\n", classID, _class.name);
570 for(method = _class.methods.first; method; method = method.next)
572 Method meth = eClass_FindMethod(regClass, method.name, privateModule);
573 if(!meth || !meth.dataType.dllExport)
575 if(method.isVirtual || ((!strcmp(_class.name, "float") || !strcmp(_class.name, "double") || module.name) && module.importType != staticImport))
577 f.Printf(" method = eClass_FindMethod(%s, \"%s\", module);\n",
578 classID, method.name);
580 f.Printf(" if(method) __ecereVMethodID_%s_%s = method.vid;\n", className, method.name);
582 f.Printf(" if(method) __ecereMethod_%s_%s = method.function;\n", className, method.name);
587 for(prop = _class.properties.first; prop; prop = prop.next)
591 FullClassNameCat(propName, prop.name, true);
593 f.Printf(" __ecereProp_%s_%s = _property = eClass_FindProperty(%s, \"%s\", module);\n",
594 className, propName, classID, prop.name);
596 if((!strcmp(_class.name, "float") || !strcmp(_class.name, "double") || module.name) && module.importType != staticImport)
599 f.Printf(" __ecereProp_%s_Set_%s = _property.Set;\n", className, propName);
601 f.Printf(" __ecereProp_%s_Get_%s = _property.Get;\n", className, propName);
608 if(module.functions.count)
610 for(function = module.functions.first; function; function = function.next)
612 GlobalFunction func = eSystem_FindFunction(privateModule, function.name);
613 if(module.name && module.importType != staticImport && (!func || !func.dataType || !func.dataType.dllExport))
615 char functionName[1024];
617 FullClassNameCat(functionName, function.name, false);
619 if(isDynamicLibrary && !isStaticLibrary)
620 f.Printf(" function = eSystem_FindFunction(__currentModule, \"%s\");\n", function.name);
622 f.Printf(" function = eSystem_FindFunction(module, \"%s\");\n", function.name);
624 f.Printf(" if(function) __ecereFunction_%s = function.function;\n", functionName);
632 for(defModule = ::modules.first; defModule; defModule = defModule.next)
633 if(defModule.globalInstance)
635 if(!strcmp(defModule.name, "i18n"))
636 f.Printf(" __ecereCreateModuleInstances_i18n();\n");
641 f.Printf(" LoadTranslatedStrings(\"%s\", \"%s\");\n", projectName, projectName);
643 f.Printf(" LoadTranslatedStrings(null, \"%s\");\n", projectName);
647 //f.Printf(" module._vTbl[10](module);\n");
651 if(!isDynamicLibrary && thisAppClass)
653 f.Printf(" _class = eSystem_FindClass(__currentModule, \"%s\");\n", thisAppClass.name);
654 f.Printf(" eInstance_Evolve((Instance *)&__currentModule, _class);\n");
655 f.Printf(" __thisModule = __currentModule;\n");
660 f.Puts(" if(__currentModule == module)\n");
664 // Then check if there's any global instances to create
667 for(defModule = ::modules.first; defModule; defModule = defModule.next)
668 if(defModule.globalInstance)
670 char moduleName[1024];
671 if(!strcmp(defModule.name, "i18n")) continue;
672 strcpy(moduleName, defModule.name);
673 FixModuleName(moduleName);
674 f.Printf(" __ecereCreateModuleInstances_%s();\n", moduleName);
684 if(!isDynamicLibrary && thisAppClass)
686 f.Printf(" ((void(*)(void *))(void *)__currentModule._vTbl[12])(__currentModule);\n");
691 f.Puts(" return true;\n");
695 /*if(targetPlatform == win32)
696 f.Printf("\nbool __stdcall __ecereDll_Unload_%s(Module module)\n{\n", projectName);
698 f.Printf("\nbool __ecereDll_Unload_%s(Module module)\n{\n", projectName);
702 if(targetPlatform == win32)
703 f.Puts("\ndllexport bool __stdcall __ecereDll_Unload(Module module)\n{\n");
705 f.Puts("\ndllexport bool __ecereDll_Unload(Module module)\n{\n");
711 f.Puts(" if(__currentModule == module)\n");
714 // Then check if there's any global instances to destroy
716 bool destroyI18n = false;
719 for(defModule = ::modules.last; defModule; defModule = defModule.prev)
720 if(defModule.globalInstance)
722 char moduleName[1024];
723 if(!strcmp(defModule.name, "i18n")) { destroyI18n = true; continue; }
724 strcpy(moduleName, defModule.name);
725 FixModuleName(moduleName);
726 f.Printf(" __ecereDestroyModuleInstances_%s();\n", moduleName);
732 //f.Printf(" UnloadTranslatedStrings(__currentModule);\n");
733 f.Printf(" UnloadTranslatedStrings(\"%s\");\n", projectName);
735 f.Printf(" __ecereDestroyModuleInstances_i18n();\n");
743 //f.Printf(" module._vTbl[11](module);\n");
748 for(defModule = ::modules.first; defModule; defModule = defModule.next)
750 char moduleName[1024];
751 strcpy(moduleName, defModule.name);
752 FixModuleName(moduleName);
753 f.Printf(" __ecereUnregisterModule_%s(module);\n", moduleName);
757 f.Puts(" if(__currentModule == module)\n");
758 f.Puts(" __currentModule = (void *)0;\n");
761 f.Puts(" if(__thisModule == module)\n");
762 f.Puts(" __thisModule = (void *)0;\n");
766 if(!isDynamicLibrary)
770 " _class = eSystem_FindClass(__currentModule, \"ecere::com::Application\");\n"
771 " exitCode = ((ecere::com::Application)__currentModule).exitCode;\n"
772 " delete __currentModule;\n"
773 " return exitCode;\n");
776 f.Puts(" return true;\n");
782 static Class FindAppClass(NameSpace * nameSpace, bool thisModule)
786 for(link = (BTNamedLink)nameSpace->classes.first; link; link = (BTNamedLink)((BTNode)link).next)
788 Class _class = link.data;
790 applicationClass = eSystem_FindClass(_class.module, "Application");
791 if(_class != applicationClass && eClass_IsDerived(_class, applicationClass) && (!thisModule || _class.module == privateModule))
794 if(strcmp(_class.fullName, "ecere::com::Application") && (!thisModule || _class.module == privateModule))
797 for(base = _class.base; base && base.type != systemClass; base = base.base)
798 if(!strcmp(base.fullName, "ecere::com::Application"))
803 for(ns = (NameSpace *)nameSpace->nameSpaces.first; ns; ns = (NameSpace *)((BTNode)ns).next)
805 Class _class = FindAppClass(ns, thisModule);
806 if(_class) // && _class != applicationClass)
809 return null; //applicationClass;
812 static Class SearchAppClass_Module(Module module)
817 appClass = FindAppClass(module.publicNameSpace, false);
818 if(appClass) return appClass;
819 appClass = FindAppClass(module.privateNameSpace, false);
820 if(appClass) return appClass;
822 for(subModule = module.modules.first; subModule; subModule = subModule.next)
824 appClass = SearchAppClass_Module(subModule.module);
825 if(appClass) return appClass;
830 static void BindDCOMClient()
832 Class dcomClientObjectClass = eSystem_FindClass(privateModule, "ecere::net::DCOMClientObject");
835 if(dcomClientObjectClass && dcomClientObjectClass.derivatives.first)
838 if(!dcomSymbols) dcomSymbols = TempFile { };
842 for(deriv = dcomClientObjectClass.derivatives.first; deriv; deriv = deriv.next)
844 Class _class = deriv.data;
850 DeclareClass(null, FindClass("ecere::net::DCOMClientObject"), "__ecereClass___ecereNameSpace__ecere__net__DCOMClientObject");
851 f.Printf("class %s : ecere::net::DCOMClientObject\n", _class.fullName);
854 // CLIENT VIRTUAL METHODS BINDINGS
855 if(_class.vTblSize > _class.base.vTblSize)
858 f.Printf(" virtual void CallVirtualMethod(uint __ecereMethodID, SerialBuffer __ecereBuffer)\n");
860 f.Printf(" switch(__ecereMethodID)\n");
863 for(vid = _class.base.vTblSize; vid < _class.vTblSize; vid++)
866 for(method = (Method)_class.methods.first; method; method = (Method)((BTNode)method).next)
868 if(method.type == virtualMethod && method._class == _class && method.vid == vid)
874 method.dataType = ProcessTypeString(method.dataTypeString, false);
875 if(method.dataType && method.dataType.name)
877 f.Printf(" case %d:\n", vid - _class.base.vTblSize);
880 if(method.dataType.returnType.kind != voidType)
883 OldList * specs = MkList();
885 char type[1024] = "";
886 char className[1024];
889 if(method.dataType.returnType.kind == classType)
890 classSym = method.dataType.returnType._class; // VERIFY THIS FindClass(method.dataType.returnType._class.string);
893 PrintTypeNoConst(method.dataType.returnType, type, false, true);
894 classSym = FindClass(type);
897 strcpy(className, "__ecereClass_");
898 FullClassNameCat(className, classSym.string, true);
899 DeclareClass(null, classSym, className);
901 PrintType(method.dataType.returnType, type, true, true);
903 decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereResult")));
904 resultType = MkTypeName(specs, decl);
907 OutputTypeName(resultType, f, false);
911 for(param = method.dataType.params.first; param; param = param.next)
913 if(param.kind == classType && !strcmp(param._class.string, "String"))
915 // Hardcode 1024 chars max string for now
916 f.Printf(" char %s[1024];\n", param.name);
917 DeclareClass(null, FindClass("StaticString"), "__ecereClass_StaticString");
918 DeclareClass(null, FindClass("String"), "__ecereClass_String");
922 TypeName paramTypeName;
923 OldList * specs = MkList();
925 char type[1024] = "";
926 char className[1024];
929 if(param.kind == classType)
930 classSym = param._class; // VERIFY THIS FindClass(param._class.string);
933 PrintTypeNoConst(param, type, false, true);
934 classSym = FindClass(type);
938 strcpy(className, "__ecereClass_");
939 FullClassNameCat(className, classSym.string, true);
940 DeclareClass(null, classSym, className);
942 PrintType(param, type, true, true);
944 decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier(param.name /*"__ecereResult"*/)));
945 paramTypeName = MkTypeName(specs, decl);
948 OutputTypeName(paramTypeName, f, false);
955 for(param = method.dataType.params.first; param; param = param.next)
957 f.Printf(" __ecereBuffer.Unserialize(");
958 if(param.kind == classType && !strcmp(param._class.string, "String"))
960 DeclareClass(null, FindClass("StaticString"), "__ecereClass_StaticString");
961 f.Printf("(StaticString)");
968 if(method.dataType.returnType.kind != voidType)
969 f.Printf("__ecereResult = ");
971 // f.Printf("this.instance.%s(", method.name);
972 f.Printf("%s(", method.name);
974 for(param = method.dataType.params.first; param; param = param.next)
978 f.Printf("%s", param.name);
983 for(param = method.dataType.params.first; param; param = param.next)
985 if(param.kind == classType && ((param._class && param._class.registered && param._class.registered.type == structClass) || !strcmp(param._class.string, "String")) && !param.constant)
987 if(!strcmp(param._class.string, "String"))
989 DeclareClass(null, FindClass("StaticString"), "__ecereClass_StaticString");
990 f.Printf(" __ecereBuffer.Serialize((StaticString)%s);\n", param.name);
993 f.Printf(" __ecereBuffer.Serialize(%s);\n", param.name);
996 if(method.dataType.returnType.kind != voidType)
998 f.Printf(" __ecereBuffer.Serialize(__ecereResult);\n");
1001 for(param = method.dataType.params.first; param; param = param.next)
1003 if(param.kind == classType && strcmp(param._class.string, "String") && param._class.registered &&
1004 (param._class.registered.type == normalClass || param._class.registered.type == noHeadClass))
1006 f.Printf(" delete %s;\n", param.name);
1009 if(method.dataType.returnType.kind == classType && strcmp(method.dataType.returnType._class.string, "String") && method.dataType.returnType._class.registered &&
1010 (method.dataType.returnType._class.registered.type == normalClass || method.dataType.returnType._class.registered.type == noHeadClass))
1012 f.Printf(" delete __ecereResult;\n");
1016 f.Printf(" break;\n");
1028 vid = _class.base.vTblSize;
1030 next = (Method)_class.methods.first;
1031 while(next && ((next.type == virtualMethod) != doVirtual || (doVirtual && next.vid != vid)))
1034 next = (Method)((BTNode)next).next;
1035 if(!next && doVirtual)
1037 if(vid == _class.vTblSize)
1042 next = (Method)_class.methods.first;
1045 for(method = next; method; method = next)
1049 if(!method.dataType)
1050 method.dataType = ProcessTypeString(method.dataTypeString, false);
1052 if(method.dataType.name)
1058 strcpy(name, "__ecereVMethodID_");
1059 FullClassNameCat(name, method._class.fullName, true);
1061 strcat(name, method.name);
1062 DeclareMethod(null, method, name);
1064 f.Printf("virtual ");
1066 f.Printf("%s\n", method.dataTypeString);
1071 if(method.dataType.returnType.kind != voidType)
1073 TypeName resultType;
1074 OldList * specs = MkList();
1076 char type[1024] = "";
1077 char className[1024];
1080 if(method.dataType.returnType.kind == classType)
1081 classSym = method.dataType.returnType._class; // VERIFY THIS FindClass(method.dataType.returnType._class.string);
1084 PrintTypeNoConst(method.dataType.returnType, type, false, true);
1085 classSym = FindClass(type);
1089 strcpy(className, "__ecereClass_");
1090 FullClassNameCat(className, classSym.string, true);
1091 DeclareClass(null, classSym, className);
1093 PrintType(method.dataType.returnType, type, true, true);
1095 decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereResult")));
1096 resultType = MkTypeName(specs, decl);
1099 OutputTypeName(resultType, f, false);
1100 if(method.dataType.returnType.kind == structType)
1101 f.Printf(" = { 0 }");
1102 else if(method.dataType.returnType.kind == classType && method.dataType.returnType._class.registered && method.dataType.returnType._class.registered.type == structClass)
1108 // f.Printf(" incref this;\n");
1109 f.Printf(" safeIncRef();\n");
1110 for(param = method.dataType.params.first; param; param = param.next)
1112 char type[1024] = "";
1113 char className[1024];
1116 if(param.kind == classType)
1117 classSym = param._class; // VERIFY THIS FindClass(param._class.string);
1120 PrintTypeNoConst(param, type, false, true);
1121 classSym = FindClass(type);
1124 strcpy(className, "__ecereClass_");
1125 FullClassNameCat(className, classSym.string, true);
1127 DeclareClass(null, classSym, className);
1129 if(param.kind == classType && !strcmp(param._class.string, "String"))
1131 DeclareClass(null, FindClass("StaticString"), "__ecereClass_StaticString");
1132 f.Printf(" __ecereBuffer.Serialize((StaticString)%s);\n", param.name);
1135 f.Printf(" __ecereBuffer.Serialize(%s);\n", param.name);
1139 eSystem_FindClass(privateModule, "ecere::net::DCOMClientObject"), "CallMethod", privateModule),
1140 "__ecereMethod___ecereNameSpace__ecere__net__DCOMClientObject_CallMethod");
1142 f.Printf(" if(DCOMClientObject::CallMethod(%d))\n", id++);
1144 for(param = method.dataType.params.first; param; param = param.next)
1146 if(param.kind == classType && ((param._class && param._class.registered && param._class.registered.type == structClass) || !strcmp(param._class.string, "String")) && !param.constant)
1148 if(!strcmp(param._class.string, "String"))
1150 DeclareClass(null, FindClass("StaticString"), "__ecereClass_StaticString");
1151 f.Printf(" __ecereBuffer.Unserialize((StaticString)%s);\n", param.name);
1154 f.Printf(" __ecereBuffer.Unserialize(%s);\n", param.name);
1157 if(method.dataType.returnType.kind != voidType)
1159 if(method.dataType.returnType.kind == classType && !strcmp(method.dataType.returnType._class.string, "String"))
1161 DeclareClass(null, FindClass("StaticString"), "__ecereClass_StaticString");
1162 f.Printf(" __ecereBuffer.Unserialize((StaticString)__ecereResult);\n");
1165 f.Printf(" __ecereBuffer.Unserialize(__ecereResult);\n");
1168 f.Printf(" __ecereBuffer.Free();\n");
1169 //f.Printf(" delete this;\n");
1170 f.Printf(" safeDecRef();\n");
1171 if(method.dataType.returnType.kind != voidType)
1173 f.Printf(" return __ecereResult;\n");
1179 next = (Method)((BTNode)method).next;
1180 while((!next && doVirtual) || (next && ((next.type == virtualMethod) != doVirtual || (doVirtual && next.vid != vid))))
1183 next = next ? (Method)((BTNode)next).next : null;
1184 if(!next && doVirtual)
1186 if(vid == _class.vTblSize)
1191 next = (Method)_class.methods.first;
1206 static void BindDCOMServer()
1208 bool mutexDeclared = false;
1210 for(_class = privateModule.classes.first; _class; _class = _class.next)
1212 if(_class.isRemote == 3) //)
1219 if(!dcomSymbols) dcomSymbols = TempFile { };
1222 DeclareClass(null, FindClass("ecere::net::DCOMServerObject"), "__ecereClass___ecereNameSpace__ecere__net__DCOMServerObject");
1225 for(_class = privateModule.classes.first; _class; _class = _class.next)
1227 if(_class.isRemote == 3) //2 && !strncmp(_class.fullName, "DCOMServer_", strlen("DCOMServer_")))
1233 f.Printf("class DCOM%s : ecere::net::DCOMServerObject\n", _class.fullName);
1234 // f.Printf("class DCOM%s\n", _class.fullName);
1237 f.Printf(" %s instance;\n", _class.fullName);
1238 f.Printf(" unsigned int id;\n");
1239 f.Printf(" SerialBuffer buffer { };\n");
1243 f.Printf(" DCOM%s()\n", _class.fullName);
1245 f.Printf(" instance = eInstance_New(class(%s));\n", _class.fullName);
1249 f.Printf(" virtual void CallMethod(uint __ecereMethodID, SerialBuffer __ecereBuffer)\n");
1251 f.Printf(" %s inst = (%s)instance;\n", _class.fullName, _class.fullName);
1252 f.Printf(" incref inst;\n");
1253 f.Printf(" switch(__ecereMethodID)\n");
1256 for(method = (Method)_class.methods.first; method; method = (Method)((BTNode)method).next)
1259 method.dataType = ProcessTypeString(method.dataTypeString, false);
1260 if(method.dataType && method.dataType.name)
1262 f.Printf(" case %d:\n", id++);
1266 if(method.dataType.returnType.kind != voidType)
1268 TypeName resultType;
1269 OldList * specs = MkList();
1271 char type[1024] = "";
1272 char className[1024];
1275 if(method.dataType.returnType.kind == classType)
1276 classSym = method.dataType.returnType._class; // VERIFY THIS FindClass(method.dataType.returnType._class.string);
1279 PrintTypeNoConst(method.dataType.returnType, type, false, true);
1280 classSym = FindClass(type);
1283 strcpy(className, "__ecereClass_");
1284 FullClassNameCat(className, classSym.string, true);
1285 DeclareClass(null, classSym, className);
1287 PrintType(method.dataType.returnType, type, true, true);
1289 decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereResult")));
1290 resultType = MkTypeName(specs, decl);
1293 OutputTypeName(resultType, f, false);
1297 for(param = method.dataType.params.first; param; param = param.next)
1299 if(param.kind == classType && !strcmp(param._class.string, "String"))
1301 // Hardcode 1024 chars max string for now
1302 f.Printf(" char %s[1024];\n", param.name);
1303 DeclareClass(null, FindClass("StaticString"), "__ecereClass_StaticString");
1304 DeclareClass(null, FindClass("String"), "__ecereClass_String");
1308 TypeName paramTypeName;
1309 OldList * specs = MkList();
1311 char type[1024] = "";
1312 char className[1024];
1315 if(param.kind == classType)
1316 classSym = param._class; // VERIFY THIS FindClass(param._class.string);
1319 PrintTypeNoConst(param, type, false, true);
1320 classSym = FindClass(type);
1324 strcpy(className, "__ecereClass_");
1325 FullClassNameCat(className, classSym.string, true);
1326 DeclareClass(null, classSym, className);
1328 PrintType(param, type, true, true);
1330 decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier(param.name /*"__ecereResult"*/)));
1331 paramTypeName = MkTypeName(specs, decl);
1334 OutputTypeName(paramTypeName, f, false);
1341 for(param = method.dataType.params.first; param; param = param.next)
1343 f.Printf(" __ecereBuffer.Unserialize(");
1344 if(param.kind == classType && !strcmp(param._class.string, "String"))
1346 DeclareClass(null, FindClass("StaticString"), "__ecereClass_StaticString");
1347 f.Printf("(StaticString)");
1354 if(method.dataType.returnType.kind != voidType)
1355 f.Printf("__ecereResult = ");
1357 // f.Printf("this.instance.%s(", method.name);
1358 f.Printf("((%s)instance).%s(", _class.fullName, method.name);
1360 for(param = method.dataType.params.first; param; param = param.next)
1364 f.Printf("%s", param.name);
1369 for(param = method.dataType.params.first; param; param = param.next)
1371 if(param.kind == classType && ((param._class && param._class.registered && param._class.registered.type == structClass) || !strcmp(param._class.string, "String")) && !param.constant)
1373 if(!strcmp(param._class.string, "String"))
1375 DeclareClass(null, FindClass("StaticString"), "__ecereClass_StaticString");
1376 f.Printf(" __ecereBuffer.Serialize((StaticString)%s);\n", param.name);
1379 f.Printf(" __ecereBuffer.Serialize(%s);\n", param.name);
1382 if(method.dataType.returnType.kind != voidType)
1384 f.Printf(" __ecereBuffer.Serialize(__ecereResult);\n");
1387 for(param = method.dataType.params.first; param; param = param.next)
1389 if(param.kind == classType && strcmp(param._class.string, "String") && param._class.registered &&
1390 (param._class.registered.type == normalClass || param._class.registered.type == noHeadClass))
1392 f.Printf(" delete %s;\n", param.name);
1395 if(method.dataType.returnType.kind == classType && strcmp(method.dataType.returnType._class.string, "String") && method.dataType.returnType._class.registered &&
1396 (method.dataType.returnType._class.registered.type == normalClass || method.dataType.returnType._class.registered.type == noHeadClass))
1398 f.Printf(" delete __ecereResult;\n");
1402 f.Printf(" break;\n");
1407 f.Printf(" delete inst;\n");
1410 // *** VIRTUAL FUNCTIONS BINDINGS ***
1411 for(vid = _class.base.vTblSize; vid < _class.vTblSize; vid++)
1416 for(method = (Method)_class.methods.first; method; method = (Method)((BTNode)method).next)
1417 if(method.type == virtualMethod && method._class == _class && method.vid == vid)
1423 DeclareClass(null, FindClass("ecere::sys::Mutex"), "__ecereClass___ecereNameSpace__ecere__sys__Mutex");
1426 eSystem_FindClass(privateModule, "ecere::sys::Mutex"), "Wait", privateModule),
1427 "__ecereMethod___ecereNameSpace__ecere__sys__Mutex_Wait");
1430 eSystem_FindClass(privateModule, "ecere::sys::Mutex"), "Release", privateModule),
1431 "__ecereMethod___ecereNameSpace__ecere__sys__Mutex_Release");
1432 mutexDeclared = true;
1436 if(!method.dataType)
1437 method.dataType = ProcessTypeString(method.dataTypeString, false);
1439 if(method.dataType.name)
1441 f.Printf(" virtual %s\n", method.dataTypeString);
1446 f.Printf(" DCOM%s __ecereObject = (void *)_vTbl[-1];\n", _class.fullName);
1447 if(method.dataType.returnType.kind != voidType)
1449 TypeName resultType;
1450 OldList * specs = MkList();
1452 char type[1024] = "";
1453 char className[1024];
1456 if(method.dataType.returnType.kind == classType)
1457 classSym = method.dataType.returnType._class; // VERIFY THIS FindClass(method.dataType.returnType._class.string);
1460 PrintTypeNoConst(method.dataType.returnType, type, false, true);
1461 classSym = FindClass(type);
1465 strcpy(className, "__ecereClass_");
1466 FullClassNameCat(className, classSym.string, true);
1467 DeclareClass(null, classSym, className);
1469 PrintType(method.dataType.returnType, type, true, true);
1471 decl = SpecDeclFromString(type, specs, MkDeclaratorIdentifier(MkIdentifier("__ecereResult")));
1472 resultType = MkTypeName(specs, decl);
1475 OutputTypeName(resultType, f, false);
1476 if(method.dataType.returnType.kind == structType)
1477 f.Printf(" = { 0 }");
1478 else if(method.dataType.returnType.kind == classType && method.dataType.returnType._class.registered && method.dataType.returnType._class.registered.type == structClass)
1485 f.Printf(" incref __ecereObject;\n");
1486 f.Printf(" __ecereMethod___ecereNameSpace__ecere__sys__Mutex_Wait(__ecereObject.mutex);\n");
1488 //f.Printf(" incref this;\n");
1489 for(param = method.dataType.params.first; param; param = param.next)
1491 char type[1024] = "";
1492 char className[1024];
1495 if(param.kind == classType)
1496 classSym = param._class; // VERIFY THIS FindClass(param._class.string);
1499 PrintTypeNoConst(param, type, false, true);
1500 classSym = FindClass(type);
1503 strcpy(className, "__ecereClass_");
1504 FullClassNameCat(className, classSym.string, true);
1505 DeclareClass(null, classSym, className);
1507 if(param.kind == classType && !strcmp(param._class.string, "String"))
1509 DeclareClass(null, FindClass("StaticString"), "__ecereClass_StaticString");
1510 f.Printf(" __ecereObject.argsBuffer.Serialize((StaticString)%s);\n", param.name);
1513 f.Printf(" __ecereObject.argsBuffer.Serialize(%s);\n", param.name);
1518 eSystem_FindClass(privateModule, "ecere::net::DCOMServerObject"), "CallVirtualMethod", privateModule),
1519 "__ecereMethod___ecereNameSpace__ecere__net__DCOMServerObject_CallVirtualMethod");
1521 // Check if this method needs to return anything (hasReturnValue)
1523 bool hasReturnValue = method.dataType.returnType.kind != voidType;
1526 for(param = method.dataType.params.first; param; param = param.next)
1528 if(param.kind == classType && ((param._class && param._class.registered && param._class.registered.type == structClass) || !strcmp(param._class.string, "String")) && !param.constant)
1530 hasReturnValue = true;
1535 f.Printf(" if(__ecereObject.CallVirtualMethod(%d, %s))\n", vid - _class.base.vTblSize,
1536 hasReturnValue ? "true" : "false");
1539 for(param = method.dataType.params.first; param; param = param.next)
1541 if(param.kind == classType && ((param._class && param._class.registered && param._class.registered.type == structClass) || !strcmp(param._class.string, "String")) && !param.constant)
1543 if(!strcmp(param._class.string, "String"))
1545 DeclareClass(null, FindClass("StaticString"), "__ecereClass_StaticString");
1546 f.Printf(" __ecereObject.returnBuffer.Unserialize((StaticString)%s);\n", param.name);
1549 f.Printf(" __ecereObject.returnBuffer.Unserialize(%s);\n", param.name);
1552 if(method.dataType.returnType.kind != voidType)
1554 if(method.dataType.returnType.kind == classType && !strcmp(method.dataType.returnType._class.string, "String"))
1556 DeclareClass(null, FindClass("StaticString"), "__ecereClass_StaticString");
1557 f.Printf(" __ecereObject.returnBuffer.Unserialize((StaticString)__ecereResult);\n");
1560 f.Printf(" __ecereObject.returnBuffer.Unserialize(__ecereResult);\n");
1563 f.Printf(" else\n");
1564 f.Printf(" ((%s)this).%s::%s(", _class.fullName, _class.fullName, method.name);
1565 for(param = method.dataType.params.first; param; param = param.next)
1567 f.Printf("%s", param.name);
1568 if(param.next) f.Printf(", ");
1572 f.Printf(" __ecereObject.returnBuffer.Free();\n");
1573 f.Printf(" __ecereMethod___ecereNameSpace__ecere__sys__Mutex_Release(__ecereObject.mutex);\n");
1574 //f.Printf(" delete this;\n");
1575 f.Printf(" delete __ecereObject;\n");
1576 if(method.dataType.returnType.kind != voidType)
1578 f.Printf(" return __ecereResult;\n");
1583 /*if(vid < _class.vTblSize)
1594 class SymbolgenApp : Application
1599 char ** argv = null;
1604 const char * output = null;
1607 disabledPooling = false;
1608 targetPlatform = __runtimePlatform;
1609 targetBits = GetHostBits();
1612 for(c = 0; c<this.argc; c++)
1614 char * arg = this.argv[c];
1615 int argLen = strlen(arg);
1617 argv = renew argv char *[argc + 1];
1618 argv[argc] = new char[argLen+1];
1619 strcpy(argv[argc], arg);
1621 while(argv[argc][argLen-1] == '\\' && c < this.argc-1)
1628 argv[argc] = renew argv[argc] char[argLen + len + 1];
1630 argv[argc][argLen-1] = ' ';
1631 strcpy(argv[argc] + argLen, arg);
1639 printf("\nArguments given:\n");
1640 for(c=1; c<argc; c++)
1641 printf(" %s", argv[c]);
1643 for(c=1; c<argc; c++)
1644 PrintLn("Arg", c, ": ", argv[c]);
1649 for(c = 1; c<argc; c++)
1651 const char * arg = argv[c];
1654 if(!strcmp(arg + 1, "m32") || !strcmp(arg + 1, "m64"))
1656 targetBits = !strcmp(arg + 1, "m32") ? 32 : 64;
1658 else if(!strcmp(arg + 1, "t32") || !strcmp(arg + 1, "t64"))
1660 targetBits = !strcmp(arg + 1, "t32") ? 32 : 64;
1662 else if(!strcmp(arg+1, "o"))
1664 if(!output && c + 1 < argc)
1672 else if(!strcmp(arg, "-name"))
1676 strcpy(projectName, argv[c+1]);
1682 else if(!strcmp(arg, "-t"))
1685 targetPlatform = argv[c];
1689 else if(!strcmp(arg, "-outputpot"))
1691 else if(!strcmp(arg, "-disabled-pooling"))
1692 disabledPooling = true;
1693 else if(!strcmp(arg, "-console"))
1695 else if(!strcmp(arg, "-dynamiclib"))
1696 isDynamicLibrary = true;
1697 else if(!strcmp(arg, "-staticlib"))
1699 isDynamicLibrary = true; // TOFIX: unmixup
1700 isStaticLibrary = true;
1702 else if(!strcmp(arg, "-symbols"))
1706 SetSymbolsDir(argv[c+1]);
1719 printf("%s", $"Syntax:\n ecs [-t <target platform>] <input>[, <input>]* -o <output>\n");
1724 char ext[MAX_EXTENSION];
1725 char symbolModule[MAX_FILENAME];
1726 GetExtension(output, ext);
1727 GetLastDirectory(output, symbolModule);
1729 SetDefines(&::_defines);
1730 SetImports(&_imports);
1731 SetGlobalData(&globalData);
1732 SetExcludedSymbols(&_excludedSymbols);
1733 SetGlobalContext(theGlobalContext);
1734 SetTopContext(theGlobalContext);
1735 SetCurrentContext(theGlobalContext);
1736 SetTargetPlatform(targetPlatform);
1737 SetTargetBits(targetBits);
1738 SetInSymbolGen(true);
1740 privateModule = (Module)__ecere_COM_Initialize((bool)(true | (targetBits == sizeof(uintptr)*8 ? 0 : targetBits == 64 ? 2 : targetBits==32 ? 4 : 0) | 8), 1, null);
1741 SetPrivateModule(privateModule);
1742 mainModule = ModuleImport { };
1743 SetMainModule(mainModule);
1744 _imports.Add(mainModule);
1746 //if(!strcmp(ext, "c"))
1748 //const String symbolsDir = GetSymbolsDir();
1749 // Only generating .pot files when building from release.* directory for now
1750 //bool outputPot = symbolsDir && SearchString(symbolsDir, 0, "release.", false, false);
1751 Map<ContextStringPair, List<String> > intlStrings { };
1752 MapIterator<ContextStringPair, List<String>> it { map = intlStrings };
1754 for(c = 1; c<argc; c++)
1756 const char * file = argv[c];
1763 if(!strcmp(file, "-c"))
1766 else if(file[0] == '@')
1767 f = FileOpen(&file[1], read);
1771 tokens[0] = (char *)file;
1778 while(!count && f.GetLine(line, sizeof(line)))
1779 count = Tokenize(line, sizeof(tokens)/sizeof(tokens[0]), tokens, forArgsPassing);
1783 for(c = 0; c < count; c++)
1785 char ext[MAX_EXTENSION];
1787 GetExtension(file, ext);
1788 if(!strcmp(ext, "imp"))
1795 // What is this supposed to do?
1796 for(c = 1; c<argc; c++)
1798 const char * file = argv[c];
1801 if(!strcmp(file, "-c"))
1806 for(c = 1; c<argc; c++)
1808 const char * file = argv[c];
1815 // Don't even know what it does here?
1816 if(!strcmp(file, "-c"))
1819 else if(file[0] == '@')
1820 f = FileOpen(&file[1], read);
1824 tokens[0] = (char *)file;
1832 while(!count && f.GetLine(line, sizeof(line)))
1833 count = Tokenize(line, sizeof(tokens)/sizeof(tokens[0]), tokens, forArgsPassing);
1837 for(c = 0; c < count; c++)
1839 char ext[MAX_EXTENSION];
1840 char moduleName[MAX_LOCATION];
1844 GetExtension(file, ext);
1846 GetLastDirectory(file, moduleName);
1847 StripExtension(moduleName);
1848 strcat(moduleName, ".ec");
1850 if(fstrcmp(moduleName, symbolModule) && (!strcmp(ext, "sym") || !strcmp(ext, "ec")))
1852 ImportedModule importedModule;
1853 ModuleInfo module { };
1854 char fileName[MAX_FILENAME];
1855 ::modules.Add(module);
1857 GetLastDirectory(file, fileName);
1859 module.name = CopyString(fileName);
1861 StripExtension(module.name);
1863 for(importedModule = ::_defines.first; importedModule; importedModule = importedModule.next)
1865 if(importedModule.type == moduleDefinition && !strcmpi(importedModule.name, module.name) && !(importedModule.importType == remoteImport))
1870 module.globalInstance = importedModule.globalInstance;
1873 importedModule = ImportedModule
1875 name = CopyString(module.name),
1876 type = moduleDefinition,
1877 importType = normalImport
1879 ::_defines.AddName(importedModule);
1881 module.globalInstance = LoadSymbols(file, normalImport, false);
1882 CheckDataRedefinitions();
1888 ChangeExtension(file, "bowl", fileName);
1889 f = FileOpen(fileName, read);
1892 static char line[65536];
1893 List<String> comments { };
1894 String msgid = null, msgstr = null, msgctxt = null;
1897 if(f.GetLine(line, sizeof(line)))
1900 TrimLSpaces(line, line);
1903 comments.Add(CopyString(line));
1905 else if(strstr(line, "msgid \"") == line)
1908 msgid = CopyString(line + 7);
1909 len = strlen(msgid);
1910 if(len) msgid[len-1] = 0;
1912 else if(strstr(line, "msgctxt \"") == line)
1915 msgctxt = CopyString(line + 9);
1916 len = strlen(msgctxt);
1917 if(len) msgctxt[len-1] = 0;
1919 else if(strstr(line, "msgstr \"") == line)
1922 msgstr = CopyString(line + 8);
1923 len = strlen(msgstr);
1924 if(len) msgstr[len-1] = 0;
1929 ContextStringPair pair { msgid, msgctxt };
1931 if(!it.Index(pair, false))
1933 msgid = null; msgctxt = null;
1934 intlStrings[pair] = comments;
1941 comments.RemoveAll();
1961 ComputeModuleClasses(privateModule);
1963 if(!isDynamicLibrary)
1965 // applicationClass = eSystem_FindClass(privateModule, "Application");
1967 thisAppClass = FindAppClass(&privateModule.application.publicNameSpace, true);
1969 thisAppClass = FindAppClass(&privateModule.application.privateNameSpace, true);
1971 thisAppClass = FindAppClass(&privateModule.application.publicNameSpace, false);
1973 thisAppClass = FindAppClass(&privateModule.application.privateNameSpace, false);
1975 thisAppClass = SearchAppClass_Module(privateModule);
1979 if(outputPot && intlStrings.count)
1982 char potFileName[MAX_LOCATION];
1983 //strcpy(potFileName, output);
1984 //StripExtension(potFileName);
1985 strcpy(potFileName, "locale");
1986 PathCat(potFileName, projectName);
1987 ChangeExtension(potFileName, "pot", potFileName);
1988 potFile = FileOpen(potFileName, write);
1992 potFile.Puts("msgid \"\"\n");
1993 potFile.Puts("msgstr \"\"\n");
1994 potFile.Puts("\"Project-Id-Version: \\n\"\n");
1995 potFile.Puts("\"POT-Creation-Date: \\n\"\n");
1996 potFile.Puts("\"PO-Revision-Date: \\n\"\n");
1997 potFile.Puts("\"Last-Translator: \\n\"\n");
1998 potFile.Puts("\"Language-Team: \\n\"\n");
1999 potFile.Puts("\"MIME-Version: 1.0\\n\"\n");
2000 potFile.Puts("\"Content-Type: text/plain; charset=iso-8859-1\\n\"\n");
2001 potFile.Puts("\"Content-Transfer-Encoding: 8bit\\n\"\n");
2002 potFile.Puts("\"X-Poedit-Basepath: ../\\n\"\n");
2005 for(i : intlStrings)
2007 ContextStringPair pair = &i;
2008 List<String> comments = i;
2017 potFile.Puts("msgctxt \""); potFile.Puts(pair.context); potFile.Puts("\"\n");
2019 potFile.Puts("msgid \""); potFile.Puts(pair.string); potFile.Puts("\"\n");
2020 potFile.Puts("msgstr \""); potFile.Puts(pair.string); potFile.Puts("\"\n");
2030 FreeContext(theGlobalContext);
2031 FreeExcludedSymbols(_excludedSymbols);
2033 ::_defines.Free(FreeModuleDefine);
2034 _imports.Free(FreeModuleImport);
2036 //precompDefines.Free(FreeDefinition);
2038 FreeTypeData(privateModule);
2040 FreeGlobalData(globalData);
2042 delete privateModule;
2045 SetSymbolsDir(null); // Free symbols dir
2048 for(c = 0; c<argc; c++)
2053 #if 0 //defined(_DEBUG) && defined(__WIN32__)