Type.py (9298:9a087e046c58) Type.py (9302:c2e70a9bc340)
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;

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

24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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 m5.util import orderdict
29
30from slicc.util import PairContainer
31from slicc.symbols.Symbol import Symbol
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;

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

24# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
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 m5.util import orderdict
29
30from slicc.util import PairContainer
31from slicc.symbols.Symbol import Symbol
32from slicc.symbols.Var import Var
32
33class DataMember(PairContainer):
34 def __init__(self, ident, type, pairs, init_code):
35 super(DataMember, self).__init__(pairs)
36 self.ident = ident
37 self.type = type
38 self.init_code = init_code
39

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

146 # Return false on error
147 def addDataMember(self, ident, type, pairs, init_code):
148 if ident in self.data_members:
149 return False
150
151 member = DataMember(ident, type, pairs, init_code)
152 self.data_members[ident] = member
153
33
34class DataMember(PairContainer):
35 def __init__(self, ident, type, pairs, init_code):
36 super(DataMember, self).__init__(pairs)
37 self.ident = ident
38 self.type = type
39 self.init_code = init_code
40

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

147 # Return false on error
148 def addDataMember(self, ident, type, pairs, init_code):
149 if ident in self.data_members:
150 return False
151
152 member = DataMember(ident, type, pairs, init_code)
153 self.data_members[ident] = member
154
155 var = Var(self.symtab, ident, self.location, type,
156 "m_%s" % ident, {}, None)
157 self.symtab.registerSym(ident, var)
154 return True
155
156 def dataMemberType(self, ident):
157 return self.data_members[ident].type
158
159 def methodId(self, name, param_type_vec):
160 return '_'.join([name] + [ pt.c_ident for pt in param_type_vec ])
161

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

410/** \\file ${{self.c_ident}}.cc
411 *
412 * Auto generated C++ code started by $__file__:$__line__
413 */
414
415#include <iostream>
416
417#include "mem/protocol/${{self.c_ident}}.hh"
158 return True
159
160 def dataMemberType(self, ident):
161 return self.data_members[ident].type
162
163 def methodId(self, name, param_type_vec):
164 return '_'.join([name] + [ pt.c_ident for pt in param_type_vec ])
165

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

414/** \\file ${{self.c_ident}}.cc
415 *
416 * Auto generated C++ code started by $__file__:$__line__
417 */
418
419#include <iostream>
420
421#include "mem/protocol/${{self.c_ident}}.hh"
422#include "mem/ruby/slicc_interface/RubySlicc_Util.hh"
418
419using namespace std;
420''')
421
422 code('''
423/** \\brief Print the state of this object */
424void
425${{self.c_ident}}::print(ostream& out) const

--- 375 unchanged lines hidden ---
423
424using namespace std;
425''')
426
427 code('''
428/** \\brief Print the state of this object */
429void
430${{self.c_ident}}::print(ostream& out) const

--- 375 unchanged lines hidden ---