当前位置: 首页>>代码示例>>Python>>正文


Python State.makeStartState方法代码示例

本文整理汇总了Python中state.State.makeStartState方法的典型用法代码示例。如果您正苦于以下问题:Python State.makeStartState方法的具体用法?Python State.makeStartState怎么用?Python State.makeStartState使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在state.State的用法示例。


在下文中一共展示了State.makeStartState方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from state import State [as 别名]
# 或者: from state.State import makeStartState [as 别名]
def main():
    dirName = sys.argv[1]
    
    path = "../tmd_dirs/" + dirName + "/"

    try:
        functions = [string.strip(x) for x in open(path + "functions", "r").readlines()]
    except:  
        print "No functions file found in directory " + path
        raise 

    functionLabelDictionary, functionDictionary, _, _ = getFunctionLabelDictionary(functions, path)
    functionVariableDictionary = getFunctionVariableDictionary(functions, path)

###################################################################

    try:
        initValueString = string.strip(open(path + "initvar", "r").read()) + "H"
    except:
        print "No initvar file found in directory " + path
        raise 

###################################################################

    inState = State("start_processor")
    inState.makeStartState()

    listOfStates = []

    mainFunctionInputLine = open(path + functions[0] + ".tmd", "r").readlines()[0]

    numberOfVariables = len(string.split(mainFunctionInputLine)) - 1
    numberOfFunctions = len(functions)
	
    inState = incrementLineNumberIDs(listOfStates, inState)
    inState = markFunctionNames(listOfStates, inState)
    inState = incrementFunctionIDs(listOfStates, inState)
    inState = firstPrepTopFunction(inState, listOfStates, "first_prep")
    inState = processCentrally(inState, listOfStates)
	
#    print "States in processor:", len(listOfStates)
    
    convertStatesToString(listOfStates, open("../../tm/tm4/tm4_files/" + dirName + "_proc.tm4", "w"))
开发者ID:BrotherPhil,项目名称:parsimony,代码行数:45,代码来源:processor.py


注:本文中的state.State.makeStartState方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。