+ def process( self, capabilities, macros, variables, gitRev, gitChanges ):
+ # Build string list of compiler arguments
+ compilerArgs = ""
+ for arg in sys.argv:
+ if "--" in arg or ".py" in arg:
+ compilerArgs += "// {0}\n".format( arg )
+ else:
+ compilerArgs += "// {0}\n".format( arg )
+
+ # Build a string of modified files, if any
+ gitChangesStr = "\n"
+ if len( gitChanges ) > 0:
+ for gitFile in gitChanges:
+ gitChangesStr += "// {0}\n".format( gitFile )
+ else:
+ gitChangesStr = " None\n"
+
+ # Prepare BaseLayout and Layer Info
+ baseLayoutInfo = ""
+ defaultLayerInfo = ""
+ partialLayersInfo = ""
+ for file, name in zip( variables.baseLayout['*LayerFiles'], variables.baseLayout['*NameStack'] ):
+ baseLayoutInfo += "// {0}\n// {1}\n".format( name, file )
+ if '*LayerFiles' in variables.layerVariables[0].keys():
+ for file, name in zip( variables.layerVariables[0]['*LayerFiles'], variables.layerVariables[0]['*NameStack'] ):
+ defaultLayerInfo += "// {0}\n// {1}\n".format( name, file )
+ if '*LayerFiles' in variables.layerVariables[1].keys():
+ for layer in range( 1, len( variables.layerVariables ) ):
+ partialLayersInfo += "// Layer {0}\n".format( layer )
+ if len( variables.layerVariables[ layer ]['*LayerFiles'] ) > 0:
+ for file, name in zip( variables.layerVariables[ layer ]['*LayerFiles'], variables.layerVariables[ layer ]['*NameStack'] ):
+ partialLayersInfo += "// {0}\n// {1}\n".format( name, file )
+
+
+ ## Information ##
+ self.fill_dict['Information'] = "// This file was generated by the kll compiler, DO NOT EDIT.\n"
+ self.fill_dict['Information'] += "// Generation Date: {0}\n".format( date.today() )
+ self.fill_dict['Information'] += "// KLL Backend: {0}\n".format( "kiibohd" )
+ self.fill_dict['Information'] += "// KLL Git Rev: {0}\n".format( gitRev )
+ self.fill_dict['Information'] += "// KLL Git Changes:{0}".format( gitChangesStr )
+ self.fill_dict['Information'] += "// Compiler arguments:\n{0}".format( compilerArgs )
+ self.fill_dict['Information'] += "//\n"
+ self.fill_dict['Information'] += "// - Base Layer -\n{0}".format( baseLayoutInfo )
+ self.fill_dict['Information'] += "// - Default Layer -\n{0}".format( defaultLayerInfo )
+ self.fill_dict['Information'] += "// - Partial Layers -\n{0}".format( partialLayersInfo )
+
+
+ ## Variable Information ##
+ self.fill_dict['VariableInformation'] = ""
+
+ # Iterate through the variables, output, and indicate the last file that modified it's value
+ # Output separate tables per file, per table and overall
+ # TODO
+
+
+ ## Defines ##
+ self.fill_dict['Defines'] = ""
+
+ # Iterate through defines and lookup the variables
+ for define in variables.defines.keys():
+ if define in variables.overallVariables.keys():
+ self.fill_dict['Defines'] += "\n#define {0} {1}".format( variables.defines[ define ], variables.overallVariables[ define ].replace( '\n', ' \\\n' ) )
+ else:
+ print( "{0} '{1}' not defined...".format( WARNING, define ) )
+
+