f.Printf(" = 0");
f.Printf(";\n\n");
}
- //f.Printf(" incref this;\n");
+ f.Printf(" incref this;\n");
for(param = method.dataType.params.first; param; param = param.next)
{
char type[1024] = "";
}
f.Printf(" }\n");
f.Printf(" __ecereBuffer.Free();\n");
- //f.Printf(" delete this;\n");
+ f.Printf(" delete this;\n");
if(method.dataType.returnType.kind != voidType)
{
f.Printf(" return __ecereResult;\n");
// f.Printf("\n");
f.Printf(" virtual void CallMethod(uint __ecereMethodID, SerialBuffer __ecereBuffer)\n");
f.Printf(" {\n");
+ f.Printf(" %s inst = (%s)instance;\n", _class.fullName, _class.fullName);
+ f.Printf(" incref inst;\n");
f.Printf(" switch(__ecereMethodID)\n");
f.Printf(" {\n");
}
}
f.Printf(" }\n");
+ f.Printf(" delete inst;\n");
f.Printf(" }\n");
// *** VIRTUAL FUNCTIONS BINDINGS ***
f.Printf(" = 0");
f.Printf(";\n\n");
}
-
+
+ f.Printf(" incref __ecereObject;\n");
f.Printf(" __ecereMethod___ecereNameSpace__ecere__sys__Mutex_Wait(__ecereObject.mutex);\n");
//f.Printf(" incref this;\n");
if(param.kind == classType && !strcmp(param._class.string, "String"))
{
DeclareClass(FindClass("StaticString"), "__ecereClass_StaticString");
- f.Printf(" __ecereObject.virtualsBuffer.Serialize((StaticString)%s);\n", param.name);
+ f.Printf(" __ecereObject.argsBuffer.Serialize((StaticString)%s);\n", param.name);
}
else
- f.Printf(" __ecereObject.virtualsBuffer.Serialize(%s);\n", param.name);
+ f.Printf(" __ecereObject.argsBuffer.Serialize(%s);\n", param.name);
}
DeclareMethod(
// Check if this method needs to return anything (hasReturnValue)
{
- bool hasReturnValue = false;
- for(param = method.dataType.params.first; param; param = param.next)
+ bool hasReturnValue = method.dataType.returnType.kind != voidType;
+ if(!hasReturnValue)
{
- if(param.kind == classType && ((param._class && param._class.registered && param._class.registered.type == structClass) || !strcmp(param._class.string, "String")) && !param.constant)
+ for(param = method.dataType.params.first; param; param = param.next)
{
- hasReturnValue = true;
- break;
+ if(param.kind == classType && ((param._class && param._class.registered && param._class.registered.type == structClass) || !strcmp(param._class.string, "String")) && !param.constant)
+ {
+ hasReturnValue = true;
+ break;
+ }
}
}
f.Printf(" if(__ecereObject.CallVirtualMethod(%d, %s))\n", vid - _class.base.vTblSize,
if(!strcmp(param._class.string, "String"))
{
DeclareClass(FindClass("StaticString"), "__ecereClass_StaticString");
- f.Printf(" __ecereObject.virtualsBuffer.Unserialize((StaticString)%s);\n", param.name);
+ f.Printf(" __ecereObject.returnBuffer.Unserialize((StaticString)%s);\n", param.name);
}
else
- f.Printf(" __ecereObject.virtualsBuffer.Unserialize(%s);\n", param.name);
+ f.Printf(" __ecereObject.returnBuffer.Unserialize(%s);\n", param.name);
}
}
if(method.dataType.returnType.kind != voidType)
if(method.dataType.returnType.kind == classType && !strcmp(method.dataType.returnType._class.string, "String"))
{
DeclareClass(FindClass("StaticString"), "__ecereClass_StaticString");
- f.Printf(" __ecereObject.virtualsBuffer.Unserialize((StaticString)__ecereResult);\n");
+ f.Printf(" __ecereObject.returnBuffer.Unserialize((StaticString)__ecereResult);\n");
}
else
- f.Printf(" __ecereObject.virtualsBuffer.Unserialize(__ecereResult);\n");
+ f.Printf(" __ecereObject.returnBuffer.Unserialize(__ecereResult);\n");
}
f.Printf(" }\n");
f.Printf(" else\n");
}
f.Printf(");\n");
- f.Printf(" __ecereObject.virtualsBuffer.Free();\n");
+ f.Printf(" __ecereObject.returnBuffer.Free();\n");
f.Printf(" __ecereMethod___ecereNameSpace__ecere__sys__Mutex_Release(__ecereObject.mutex);\n");
//f.Printf(" delete this;\n");
+ f.Printf(" delete __ecereObject;\n");
if(method.dataType.returnType.kind != voidType)
{
f.Printf(" return __ecereResult;\n");
valid = false;
if(!valid)
- printf("Syntax:\n ecs [-t <target platform>] <input>[, <input>]* -o <output>\n");
+ printf($"Syntax:\n ecs [-t <target platform>] <input>[, <input>]* -o <output>\n");
else
{
int c;
//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");
}