comparison Resources/CodeGeneration/stonegentool.py @ 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 84af39146e76
children 163ac23b8bff
comparison
equal deleted inserted replaced
666:daf43666bbc2 670:5dd496343fad
184 RegisterTemplateFunction(template,CanonToTs) 184 RegisterTemplateFunction(template,CanonToTs)
185 RegisterTemplateFunction(template,NeedsTsConstruction) 185 RegisterTemplateFunction(template,NeedsTsConstruction)
186 RegisterTemplateFunction(template,NeedsCppConstruction) 186 RegisterTemplateFunction(template,NeedsCppConstruction)
187 RegisterTemplateFunction(template, DefaultValueToTs) 187 RegisterTemplateFunction(template, DefaultValueToTs)
188 RegisterTemplateFunction(template, DefaultValueToCpp) 188 RegisterTemplateFunction(template, DefaultValueToCpp)
189 RegisterTemplateFunction(template, sorted)
189 return template 190 return template
190 191
191 def MakeTemplateFromFile(templateFileName): 192 def MakeTemplateFromFile(templateFileName):
192 193
193 with open(templateFileName, "r") as templateFile: 194 with open(templateFileName, "r") as templateFile:
531 if ch == ':': 532 if ch == ':':
532 if not (nextCh == ' ' or nextCh == '\n'): 533 if not (nextCh == ' ' or nextCh == '\n'):
533 lineNumber = schemaText.count("\n",0,i) + 1 534 lineNumber = schemaText.count("\n",0,i) + 1
534 raise RuntimeError("Error at line " + str(lineNumber) + " in the schema: colons must be followed by a space or a newline!") 535 raise RuntimeError("Error at line " + str(lineNumber) + " in the schema: colons must be followed by a space or a newline!")
535 schema = yaml.load(schemaText) 536 schema = yaml.load(schemaText)
537 print("*******************************************")
538 print("*******************************************")
539 print(schema["struct EventBase"])
540 print("*******************************************")
541 print("*******************************************")
536 return schema 542 return schema
537 543
538 def GetTemplatingDictFromSchemaFilename(fn): 544 def GetTemplatingDictFromSchemaFilename(fn):
539 return GetTemplatingDictFromSchema(LoadSchema(fn)) 545 return GetTemplatingDictFromSchema(LoadSchema(fn))
540 546