PeekStatementAST.py (10231:cb2e6950956d) PeekStatementAST.py (10963:51f40b101a56)
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;

--- 48 unchanged lines hidden (view full) ---

57 # Declare the new "in_msg_ptr" variable
58 mtid = msg_type.ident
59 qcode = self.queue_name.var.code
60 code('''
61{
62 // Declare message
63 const $mtid* in_msg_ptr M5_VAR_USED;
64 in_msg_ptr = dynamic_cast<const $mtid *>(($qcode).${{self.method}}());
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;

--- 48 unchanged lines hidden (view full) ---

57 # Declare the new "in_msg_ptr" variable
58 mtid = msg_type.ident
59 qcode = self.queue_name.var.code
60 code('''
61{
62 // Declare message
63 const $mtid* in_msg_ptr M5_VAR_USED;
64 in_msg_ptr = dynamic_cast<const $mtid *>(($qcode).${{self.method}}());
65 assert(in_msg_ptr != NULL); // Check the cast result
65 if (in_msg_ptr == NULL) {
66 // If the cast fails, this is the wrong inport (wrong message type).
67 // Throw an exception, and the caller will decide to either try a
68 // different inport or punt.
69 throw RejectException();
70 }
66''')
67
68 if self.pairs.has_key("block_on"):
69 address_field = self.pairs['block_on']
70 code('''
71 if (m_is_blocking &&
72 (m_block_map.count(in_msg_ptr->m_$address_field) == 1) &&
73 (m_block_map[in_msg_ptr->m_$address_field] != &$qcode)) {

--- 20 unchanged lines hidden ---
71''')
72
73 if self.pairs.has_key("block_on"):
74 address_field = self.pairs['block_on']
75 code('''
76 if (m_is_blocking &&
77 (m_block_map.count(in_msg_ptr->m_$address_field) == 1) &&
78 (m_block_map[in_msg_ptr->m_$address_field] != &$qcode)) {

--- 20 unchanged lines hidden ---