parameters: (filename, numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting, timingScript)
docstring: Generate a random Kaleidoscope script based on the given parameters
docstring_summary: Generate a random Kaleidoscope script based on the given parameters
docstring_tokens: Generate a random Kaleidoscope script based on the given parameters
function: def generateKScript(filename, numFuncs, elementsPerFunc, funcsBetweenExec, callWeighting, timingScript):
      """ Generate a random Kaleidoscope script based on the given parameters """
      print "Generating " + filename
      print("  %d functions, %d elements per function, %d functions between execution" %
            (numFuncs, elementsPerFunc, funcsBetweenExec))
      print("  Call weighting = %f" % callWeighting)
      script = KScriptGenerator(filename)
      script.setCallWeighting(callWeighting)
      script.writeComment("===========================================================================")
      script.writeComment("Auto-generated script")
      script.writeComment("  %d functions, %d elements per function, %d functions between execution"
                           % (numFuncs, elementsPerFunc, funcsBetweenExec))
      script.writeComment("  call weighting = %f" % callWeighting)
      script.writeComment("===========================================================================")
      script.writeEmptyLine()
      script.writePredefinedFunctions()
      funcsSinceLastExec = 0
      for i in range(numFuncs):
          script.writeFunction(elementsPerFunc)
          funcsSinceLastExec += 1
          if funcsSinceLastExec == funcsBetweenExec:
              script.writeFunctionCall()
              funcsSinceLastExec = 0
      # Always end with a function call
      if funcsSinceLastExec > 0:
          script.writeFunctionCall()
      script.writeEmptyLine()
      script.writeFinalFunctionCounts()
      funcsCalled = len(script.calledFunctions)
      print "  Called %d of %d functions, %d total" % (funcsCalled, numFuncs, script.totalCallsExecuted)
      timingScript.writeTimingCall(filename, numFuncs, funcsCalled, script.totalCallsExecuted)
function_tokens: def generateKScript ( filename , numFuncs , elementsPerFunc , funcsBetweenExec , callWeighting , timingScript ) : print "Generating " + filename print ( "  %d functions, %d elements per function, %d functions between execution" % ( numFuncs , elementsPerFunc , funcsBetweenExec ) ) print ( "  Call weighting = %f" % callWeighting ) script = KScriptGenerator ( filename ) script . setCallWeighting ( callWeighting ) script . writeComment ( "===========================================================================" ) script . writeComment ( "Auto-generated script" ) script . writeComment ( "  %d functions, %d elements per function, %d functions between execution" % ( numFuncs , elementsPerFunc , funcsBetweenExec ) ) script . writeComment ( "  call weighting = %f" % callWeighting ) script . writeComment ( "===========================================================================" ) script . writeEmptyLine ( ) script . writePredefinedFunctions ( ) funcsSinceLastExec = 0 for i in range ( numFuncs ) : script . writeFunction ( elementsPerFunc ) funcsSinceLastExec += 1 if funcsSinceLastExec == funcsBetweenExec : script . writeFunctionCall ( ) funcsSinceLastExec = 0 # Always end with a function call if funcsSinceLastExec > 0 : script . writeFunctionCall ( ) script . writeEmptyLine ( ) script . writeFinalFunctionCounts ( ) funcsCalled = len ( script . calledFunctions ) print "  Called %d of %d functions, %d total" % ( funcsCalled , numFuncs , script . totalCallsExecuted ) timingScript . writeTimingCall ( filename , numFuncs , funcsCalled , script . totalCallsExecuted )