InPortDeclAST.py (9820:2f9aecba2362) | InPortDeclAST.py (9996:150338b8ba12) |
---|---|
1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 2# Copyright (c) 2009 The Hewlett-Packard Development Company 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 16 unchanged lines hidden (view full) --- 25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 28from slicc.ast.DeclAST import DeclAST 29from slicc.ast.TypeAST import TypeAST 30from slicc.symbols import Func, Type, Var 31 32class InPortDeclAST(DeclAST): | 1# Copyright (c) 1999-2008 Mark D. Hill and David A. Wood 2# Copyright (c) 2009 The Hewlett-Packard Development Company 3# All rights reserved. 4# 5# Redistribution and use in source and binary forms, with or without 6# modification, are permitted provided that the following conditions are 7# met: redistributions of source code must retain the above copyright 8# notice, this list of conditions and the following disclaimer; --- 16 unchanged lines hidden (view full) --- 25# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 26# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 28from slicc.ast.DeclAST import DeclAST 29from slicc.ast.TypeAST import TypeAST 30from slicc.symbols import Func, Type, Var 31 32class InPortDeclAST(DeclAST): |
33 max_port_rank = 0 34 | |
35 def __init__(self, slicc, ident, msg_type, var_expr, pairs, statements): 36 super(InPortDeclAST, self).__init__(slicc, pairs) 37 38 self.ident = ident 39 self.msg_type = msg_type 40 self.var_expr = var_expr 41 self.statements = statements 42 self.queue_type = TypeAST(slicc, "InPort") | 33 def __init__(self, slicc, ident, msg_type, var_expr, pairs, statements): 34 super(InPortDeclAST, self).__init__(slicc, pairs) 35 36 self.ident = ident 37 self.msg_type = msg_type 38 self.var_expr = var_expr 39 self.statements = statements 40 self.queue_type = TypeAST(slicc, "InPort") |
43 if self.pairs.has_key("rank"): 44 InPortDeclAST.max_port_rank = max(self.pairs["rank"], 45 InPortDeclAST.max_port_rank) | |
46 47 def __repr__(self): 48 return "[InPortDecl: %s]" % self.ident 49 50 def generate(self): 51 symtab = self.symtab 52 void_type = symtab.find("void", Type) 53 --- 61 unchanged lines hidden (view full) --- 115 rcode.indent() 116 self.statements.generate(rcode, None) 117 in_port["c_code_in_port"] = str(rcode) 118 119 symtab.popFrame() 120 121 # Add port to state machine 122 machine.addInPort(in_port) | 41 42 def __repr__(self): 43 return "[InPortDecl: %s]" % self.ident 44 45 def generate(self): 46 symtab = self.symtab 47 void_type = symtab.find("void", Type) 48 --- 61 unchanged lines hidden (view full) --- 110 rcode.indent() 111 self.statements.generate(rcode, None) 112 in_port["c_code_in_port"] = str(rcode) 113 114 symtab.popFrame() 115 116 # Add port to state machine 117 machine.addInPort(in_port) |
123 124 # Include max_rank to be used by StateMachine.py 125 in_port["max_port_rank"] = InPortDeclAST.max_port_rank | |