changeset 670:5dd496343fad

Restored missing code + fixed key ordering when generating code
author Benjamin Golinvaux <bgo@osimis.io>
date Wed, 15 May 2019 18:29:42 +0200
parents daf43666bbc2
children 28dca6cd827b
files Applications/Wasm/StartupParametersBuilder.cpp Resources/CodeGeneration/stonegentool.py Resources/CodeGeneration/template.in.h.j2
diffstat 3 files changed, 13 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/Applications/Wasm/StartupParametersBuilder.cpp	Wed May 15 15:42:49 2019 +0200
+++ b/Applications/Wasm/StartupParametersBuilder.cpp	Wed May 15 18:29:42 2019 +0200
@@ -42,6 +42,11 @@
         argSs << "--" << std::get<0>(*it);
         if(std::get<1>(*it).length() > 0)
           argSs << "=" << std::get<1>(*it);
+
+        argvStrings[argCounter] = argSs.str();
+        cmdLine = cmdLine + " " + argvStrings[argCounter];
+        argv[argCounter] = argvStrings[argCounter].c_str();
+        argCounter++;
     }
 
 
--- a/Resources/CodeGeneration/stonegentool.py	Wed May 15 15:42:49 2019 +0200
+++ b/Resources/CodeGeneration/stonegentool.py	Wed May 15 18:29:42 2019 +0200
@@ -186,6 +186,7 @@
   RegisterTemplateFunction(template,NeedsCppConstruction)
   RegisterTemplateFunction(template, DefaultValueToTs)
   RegisterTemplateFunction(template, DefaultValueToCpp)
+  RegisterTemplateFunction(template, sorted)
   return template
 
 def MakeTemplateFromFile(templateFileName):
@@ -533,6 +534,11 @@
           lineNumber = schemaText.count("\n",0,i) + 1
           raise RuntimeError("Error at line " + str(lineNumber) + " in the schema: colons must be followed by a space or a newline!")
     schema = yaml.load(schemaText)
+    print("*******************************************")
+    print("*******************************************")
+    print(schema["struct EventBase"])
+    print("*******************************************")
+    print("*******************************************")
     return schema
 
 def GetTemplatingDictFromSchemaFilename(fn):
--- a/Resources/CodeGeneration/template.in.h.j2	Wed May 15 15:42:49 2019 +0200
+++ b/Resources/CodeGeneration/template.in.h.j2	Wed May 15 18:29:42 2019 +0200
@@ -394,9 +394,9 @@
 
   struct {{struct['name']}}
   {
-{% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%}    {{CanonToCpp(struct['fields'][key]['type'])}} {{key}};
+{% if struct %}{% if struct['fields'] %}{% for key in sorted(struct['fields']) %}    {{CanonToCpp(struct['fields'][key]['type'])}} {{key}};
 {% endfor %}{% endif %}{% endif %}
-    {{struct['name']}}({% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%}{{CanonToCpp(struct['fields'][key]['type'])}} {{key}} = {% if struct['fields'][key]['defaultValue'] %}{{DefaultValueToCpp(rootName,enums,struct['fields'][key])}} {%else%} {{CanonToCpp(struct['fields'][key]['type'])}}() {%endif%} {{ ", " if not loop.last }}{% endfor %}{% endif %}{% endif %})
+    {{struct['name']}}({% if struct %}{% if struct['fields'] %}{% for key in sorted(struct['fields']) %}{{CanonToCpp(struct['fields'][key]['type'])}} {{key}} = {% if struct['fields'][key]['defaultValue'] %}{{DefaultValueToCpp(rootName,enums,struct['fields'][key])}} {%else%} {{CanonToCpp(struct['fields'][key]['type'])}}() {%endif%} {{ ", " if not loop.last }}{% endfor %}{% endif %}{% endif %})
     {
 {% if struct %}{% if struct['fields'] %}{% for key in struct['fields']%}      this->{{key}} = {{key}};
 {% endfor %}{% endif %}{% endif %}    }