import proxy
import m5
from util import *
-from multidict import multidict
# These utility functions have to come first because they're
# referenced in params.py... otherwise they won't be defined when we
# just declaring a pointer.
decl = 'class %s;' % _cxx_class
if namespace:
- decl = 'namespace %s { %s }' % (namespace, decl)
+ namespaces = namespace.split('::')
+ namespaces.reverse()
+ for namespace in namespaces:
+ decl = 'namespace %s { %s }' % (namespace, decl)
cls._value_dict['cxx_predecls'] = [decl]
if 'swig_predecls' not in cls._value_dict:
for child in child_names:
self._children[child].unproxy_all()
- def print_ini(self):
- print '[' + self.path() + ']' # .ini section header
+ def print_ini(self, ini_file):
+ print >>ini_file, '[' + self.path() + ']' # .ini section header
instanceDict[self.path()] = self
if hasattr(self, 'type'):
- print 'type=%s' % self.type
+ print >>ini_file, 'type=%s' % self.type
child_names = self._children.keys()
child_names.sort()
if len(child_names):
- print 'children=%s' % ' '.join(child_names)
+ print >>ini_file, 'children=%s' % ' '.join(child_names)
param_names = self._params.keys()
param_names.sort()
for param in param_names:
value = self._values.get(param)
if value != None:
- print '%s=%s' % (param, self._values[param].ini_str())
+ print >>ini_file, '%s=%s' % (param,
+ self._values[param].ini_str())
port_names = self._ports.keys()
port_names.sort()
for port_name in port_names:
port = self._port_refs.get(port_name, None)
if port != None:
- print '%s=%s' % (port_name, port.ini_str())
+ print >>ini_file, '%s=%s' % (port_name, port.ini_str())
- print # blank line between objects
+ print >>ini_file # blank line between objects
for child in child_names:
- self._children[child].print_ini()
+ self._children[child].print_ini(ini_file)
def getCCParams(self):
if self._ccParams:
# necessary to construct it. Does *not* recursively create
# children.
def getCCObject(self):
- params = self.getCCParams()
if not self._ccObject:
- self._ccObject = -1 # flag to catch cycles in recursion
+ # Cycles in the configuration heirarchy are not supported. This
+ # will catch the resulting recursion and stop.
+ self._ccObject = -1
+ params = self.getCCParams()
self._ccObject = params.create()
elif self._ccObject == -1:
- raise RuntimeError, "%s: recursive call to getCCObject()" \
+ raise RuntimeError, "%s: Cycle found in configuration heirarchy." \
% self.path()
return self._ccObject