static bool i18n;
static Platform targetPlatform;
+static int targetBits;
static bool isConsole;
static bool isDynamicLibrary;
}
if(!isDynamicLibrary && thisAppClass)
{
- f.Printf(" __currentModule._vTbl[12](__currentModule);\n");
+ f.Printf(" ((void(*)(void *))(void *)__currentModule._vTbl[12])(__currentModule);\n");
}
if(isDynamicLibrary)
resultType = MkTypeName(specs, decl);
f.Printf(" ");
- OutputTypeName(resultType, f);
+ OutputTypeName(resultType, f, false);
f.Printf(";\n");
}
paramTypeName = MkTypeName(specs, decl);
f.Printf(" ");
- OutputTypeName(paramTypeName, f);
+ OutputTypeName(paramTypeName, f, false);
f.Printf(";\n");
}
resultType = MkTypeName(specs, decl);
f.Printf(" ");
- OutputTypeName(resultType, f);
+ OutputTypeName(resultType, f, false);
if(method.dataType.returnType.kind == structType)
f.Printf(" = { 0 }");
else if(method.dataType.returnType.kind == classType && method.dataType.returnType._class.registered && method.dataType.returnType._class.registered.type == structClass)
resultType = MkTypeName(specs, decl);
f.Printf(" ");
- OutputTypeName(resultType, f);
+ OutputTypeName(resultType, f, false);
f.Printf(";\n");
}
paramTypeName = MkTypeName(specs, decl);
f.Printf(" ");
- OutputTypeName(paramTypeName, f);
+ OutputTypeName(paramTypeName, f, false);
f.Printf(";\n");
}
resultType = MkTypeName(specs, decl);
f.Printf(" ");
- OutputTypeName(resultType, f);
+ OutputTypeName(resultType, f, false);
if(method.dataType.returnType.kind == structType)
f.Printf(" = { 0 }");
else if(method.dataType.returnType.kind == classType && method.dataType.returnType._class.registered && method.dataType.returnType._class.registered.type == structClass)
char * output = null;
targetPlatform = GetRuntimePlatform();
+ targetBits = GetHostBits();
/*
for(c = 0; c<this.argc; c++)
char * arg = argv[c];
if(arg[0] == '-')
{
- if(!strcmp(arg+1, "o"))
+ if(!strcmp(arg + 1, "m32") || !strcmp(arg + 1, "m64"))
+ {
+ targetBits = !strcmp(arg + 1, "m32") ? 32 : 64;
+ }
+ else if(!strcmp(arg+1, "o"))
{
if(!output && c + 1 < argc)
{
SetTopContext(theGlobalContext);
SetCurrentContext(theGlobalContext);
SetTargetPlatform(targetPlatform);
+ SetTargetBits(targetBits);
+ SetInSymbolGen(true);
- privateModule = __ecere_COM_Initialize(true, 1, null);
+ privateModule = (Module)__ecere_COM_Initialize(true | (targetBits == sizeof(uintptr)*8 ? 0 : targetBits == 64 ? 2 : targetBits==32 ? 4 : 0) | 8, 1, null);
SetPrivateModule(privateModule);
mainModule = ModuleImport { };
SetMainModule(mainModule);
//if(!strcmp(ext, "c"))
{
+ String symbolsDir = GetSymbolsDir();
+ // Only generating .pot files when building from release.* directory for now
+ bool outputPot = symbolsDir && SearchString(symbolsDir, 0, "release.", false, false);
Map<ContextStringPair, List<String> > intlStrings { };
MapIterator<ContextStringPair, List<String>> it { map = intlStrings };
}
WriteMain(output);
- if(intlStrings.count)
+ if(outputPot && intlStrings.count)
{
File potFile;
char potFileName[MAX_LOCATION];
//strcpy(potFileName, output);
//StripExtension(potFileName);
- strcpy(potFileName, projectName);
+ strcpy(potFileName, "locale");
+ MakeDir(potFileName);
+ PathCat(potFileName, projectName);
ChangeExtension(potFileName, "pot", potFileName);
potFile = FileOpen(potFileName, write);
if(potFile)
{
+ // Write header:
+ potFile.Puts("msgid \"\"\n");
+ potFile.Puts("msgstr \"\"\n");
+ potFile.Puts("\"Project-Id-Version: \\n\"\n");
+ potFile.Puts("\"POT-Creation-Date: \\n\"\n");
+ potFile.Puts("\"PO-Revision-Date: \\n\"\n");
+ potFile.Puts("\"Last-Translator: \\n\"\n");
+ potFile.Puts("\"Language-Team: \\n\"\n");
+ potFile.Puts("\"MIME-Version: 1.0\\n\"\n");
+ potFile.Puts("\"Content-Type: text/plain; charset=iso-8859-1\\n\"\n");
+ potFile.Puts("\"Content-Transfer-Encoding: 8bit\\n\"\n");
+ potFile.Puts("\"X-Poedit-Basepath: ../\\n\"\n");
+ potFile.Puts("\n");
+
for(i : intlStrings)
{
ContextStringPair pair = &i;
potFile.Puts("\n");
}
- potFile.Puts("msgid \""); potFile.Puts(pair.string); potFile.Puts("\"\n");
if(pair.context)
{
potFile.Puts("msgctxt \""); potFile.Puts(pair.context); potFile.Puts("\"\n");
}
+ potFile.Puts("msgid \""); potFile.Puts(pair.string); potFile.Puts("\"\n");
potFile.Puts("msgstr \""); potFile.Puts(pair.string); potFile.Puts("\"\n");
potFile.Puts("\n");
}