def compile_Succs(self, node): body = [] body.extend(self.compile(node.body)) body.append(cyast.E("return " + node.arg_marking_acc_var.name)) f1 = cyast.Builder.FunctionCpDef( name=node.function_name, args=self.main_succ_function_args(node), body=body, lang=cyast.CpDef(public=True), returns=cyast.Name("set"), decl=[ cyast.CVar(name=node.arg_marking_acc_var.name, type=self.env.type2str( node.arg_marking_acc_var.type), init=self.env.marking_set_type.new_marking_set_expr( self.env)) ]) body = [cyast.E("l = ctypes_ext.neco_list_new()")] body.append( cyast.For( target=cyast.to_ast(cyast.E("e")), iter=cyast.to_ast(cyast.E("succs(m, ctx)")), body=[ cyast.to_ast( cyast.stmt(cyast.E("ctypes_ext.__Pyx_INCREF(e)"))), cyast.Expr( cyast.Call( func=cyast.to_ast( cyast.E("ctypes_ext.neco_list_push_front")), args=[cyast.to_ast(cyast.E("l")), cyast.Name("e")], keywords=[], starargs=None, kwargs=None)) ])) body.append(cyast.E("return l")) f2 = cyast.Builder.FunctionCDef( name="neco_succs", args=(cyast.A( "m", type=self.env.type2str(node.arg_marking_var.type)).param( "ctx", type=self.env.type2str(node.arg_ctx_var.type))), body=body, returns=cyast.Name("ctypes_ext.neco_list_t*"), decl=[ cyast.CVar(name="l", type="ctypes_ext.neco_list_t*"), cyast.CVar(name="e", type="Marking") ]) return [f1]
def compile_Succs(self, node): body = [] body.extend(self.compile(node.body)) body.append(cyast.E("return " + node.arg_marking_acc_var.name)) f1 = cyast.Builder.FunctionCpDef(name = node.function_name, args = self.main_succ_function_args(node), body = body, lang = cyast.CpDef(public = True), returns = cyast.Name("set"), decl = [ cyast.CVar(name = node.arg_marking_acc_var.name, type = self.env.type2str(node.arg_marking_acc_var.type), init = self.env.marking_set_type.new_marking_set_expr(self.env)) ] ) body = [ cyast.E("l = ctypes_ext.neco_list_new()") ] body.append(cyast.For(target = cyast.to_ast(cyast.E("e")), iter = cyast.to_ast(cyast.E("succs(m, ctx)")), body = [ cyast.to_ast(cyast.stmt(cyast.E("ctypes_ext.__Pyx_INCREF(e)"))), cyast.Expr(cyast.Call(func = cyast.to_ast(cyast.E("ctypes_ext.neco_list_push_front")), args = [cyast.to_ast(cyast.E("l")), cyast.Name("e")], keywords = [], starargs = None, kwargs = None)) ])) body.append(cyast.E("return l")) f2 = cyast.Builder.FunctionCDef(name = "neco_succs", args = (cyast.A("m", type = self.env.type2str(node.arg_marking_var.type)) .param("ctx", type = self.env.type2str(node.arg_ctx_var.type))), body = body, returns = cyast.Name("ctypes_ext.neco_list_t*"), decl = [cyast.CVar(name = "l", type = "ctypes_ext.neco_list_t*"), cyast.CVar(name = "e", type = "Marking")] ) return [f1]
def compile_NormalizeMarking(self, node): return cyast.stmt(cyast.Call(func = cyast.E('normalize_pids'), args = [cyast.E(node.marking_var.name)]))
def compile_AddMarking(self, node): return cyast.stmt(self.env.marking_set_type.add_marking_stmt(env = self.env, markingset_var = node.marking_set_var, marking_var = node.marking_var))
def compile_ProcedureCall(self, node): return cyast.stmt(cyast.Call(func = cyast.Name(node.function_name), args = [ self.compile(arg) for arg in node.arguments ]) )
def compile_NormalizeMarking(self, node): return cyast.stmt( cyast.Call(func=cyast.E('normalize_pids'), args=[cyast.E(node.marking_var.name)]))
def compile_AddMarking(self, node): return cyast.stmt( self.env.marking_set_type.add_marking_stmt( env=self.env, markingset_var=node.marking_set_var, marking_var=node.marking_var))
def compile_ProcedureCall(self, node): return cyast.stmt( cyast.Call(func=cyast.Name(node.function_name), args=[self.compile(arg) for arg in node.arguments]))
def normalize_marking_call(self, env, marking_var): return cyast.stmt( cyast.Call(func=cyast.E("{}.normalize_pids".format( marking_var.name)), args=[]))