SConscript (5798:edbf23127462) SConscript (5799:0af61da2b66a)
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

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

170Export('SimObject')
171Export('SwigSource')
172Export('UnitTest')
173
174########################################################################
175#
176# Trace Flags
177#
1# -*- mode:python -*-
2
3# Copyright (c) 2004-2005 The Regents of The University of Michigan
4# All rights reserved.
5#
6# Redistribution and use in source and binary forms, with or without
7# modification, are permitted provided that the following conditions are
8# met: redistributions of source code must retain the above copyright

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

170Export('SimObject')
171Export('SwigSource')
172Export('UnitTest')
173
174########################################################################
175#
176# Trace Flags
177#
178all_flags = {}
179trace_flags = []
180def TraceFlag(name, desc=''):
181 if name in all_flags:
178trace_flags = {}
179def TraceFlag(name, desc=None):
180 if name in trace_flags:
182 raise AttributeError, "Flag %s already specified" % name
181 raise AttributeError, "Flag %s already specified" % name
183 flag = (name, (), desc)
184 trace_flags.append(flag)
185 all_flags[name] = ()
182 trace_flags[name] = (name, (), desc)
186
183
187def CompoundFlag(name, flags, desc=''):
188 if name in all_flags:
184def CompoundFlag(name, flags, desc=None):
185 if name in trace_flags:
189 raise AttributeError, "Flag %s already specified" % name
190
191 compound = tuple(flags)
192 for flag in compound:
186 raise AttributeError, "Flag %s already specified" % name
187
188 compound = tuple(flags)
189 for flag in compound:
193 if flag not in all_flags:
190 if flag not in trace_flags:
194 raise AttributeError, "Trace flag %s not found" % flag
191 raise AttributeError, "Trace flag %s not found" % flag
195 if all_flags[flag]:
192 if trace_flags[flag][1]:
196 raise AttributeError, \
197 "Compound flag can't point to another compound flag"
198
193 raise AttributeError, \
194 "Compound flag can't point to another compound flag"
195
199 flag = (name, compound, desc)
200 trace_flags.append(flag)
201 all_flags[name] = compound
196 trace_flags[name] = (name, compound, desc)
202
203Export('TraceFlag')
204Export('CompoundFlag')
205
206########################################################################
207#
208# Set some compiler variables
209#

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

661
662 f = file(str(target[0]), 'w')
663
664 allFlags = []
665 for s in source:
666 val = eval(s.get_contents())
667 allFlags.append(val)
668
197
198Export('TraceFlag')
199Export('CompoundFlag')
200
201########################################################################
202#
203# Set some compiler variables
204#

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

656
657 f = file(str(target[0]), 'w')
658
659 allFlags = []
660 for s in source:
661 val = eval(s.get_contents())
662 allFlags.append(val)
663
669 print >>f, 'baseFlags = ['
664 allFlags.sort()
665
666 print >>f, 'basic = ['
670 for flag, compound, desc in allFlags:
671 if not compound:
672 print >>f, " '%s'," % flag
673 print >>f, " ]"
674 print >>f
675
667 for flag, compound, desc in allFlags:
668 if not compound:
669 print >>f, " '%s'," % flag
670 print >>f, " ]"
671 print >>f
672
676 print >>f, 'compoundFlags = ['
673 print >>f, 'compound = ['
677 print >>f, " 'All',"
678 for flag, compound, desc in allFlags:
679 if compound:
680 print >>f, " '%s'," % flag
681 print >>f, " ]"
682 print >>f
683
674 print >>f, " 'All',"
675 for flag, compound, desc in allFlags:
676 if compound:
677 print >>f, " '%s'," % flag
678 print >>f, " ]"
679 print >>f
680
684 print >>f, "allFlags = frozenset(baseFlags + compoundFlags)"
681 print >>f, "all = frozenset(basic + compound)"
685 print >>f
686
682 print >>f
683
687 print >>f, 'compoundFlagMap = {'
684 print >>f, 'compoundMap = {'
688 all = tuple([flag for flag,compound,desc in allFlags if not compound])
689 print >>f, " 'All' : %s," % (all, )
690 for flag, compound, desc in allFlags:
691 if compound:
692 print >>f, " '%s' : %s," % (flag, compound)
693 print >>f, " }"
694 print >>f
695
685 all = tuple([flag for flag,compound,desc in allFlags if not compound])
686 print >>f, " 'All' : %s," % (all, )
687 for flag, compound, desc in allFlags:
688 if compound:
689 print >>f, " '%s' : %s," % (flag, compound)
690 print >>f, " }"
691 print >>f
692
696 print >>f, 'flagDescriptions = {'
693 print >>f, 'descriptions = {'
697 print >>f, " 'All' : 'All flags',"
698 for flag, compound, desc in allFlags:
699 print >>f, " '%s' : '%s'," % (flag, desc)
700 print >>f, " }"
701
702 f.close()
703
704def traceFlagsCC(target, source, env):

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

842
843/* namespace Trace */ }
844
845#endif // __BASE_TRACE_FLAGS_HH__
846'''
847
848 f.close()
849
694 print >>f, " 'All' : 'All flags',"
695 for flag, compound, desc in allFlags:
696 print >>f, " '%s' : '%s'," % (flag, desc)
697 print >>f, " }"
698
699 f.close()
700
701def traceFlagsCC(target, source, env):

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

839
840/* namespace Trace */ }
841
842#endif // __BASE_TRACE_FLAGS_HH__
843'''
844
845 f.close()
846
850flags = [ Value(f) for f in trace_flags ]
847flags = [ Value(f) for f in trace_flags.values() ]
851env.Command('base/traceflags.py', flags, traceFlagsPy)
852PySource('m5', 'base/traceflags.py')
853
854env.Command('base/traceflags.hh', flags, traceFlagsHH)
855env.Command('base/traceflags.cc', flags, traceFlagsCC)
856Source('base/traceflags.cc')
857
858# embed python files. All .py files that have been indicated by a

--- 214 unchanged lines hidden ---
848env.Command('base/traceflags.py', flags, traceFlagsPy)
849PySource('m5', 'base/traceflags.py')
850
851env.Command('base/traceflags.hh', flags, traceFlagsHH)
852env.Command('base/traceflags.cc', flags, traceFlagsCC)
853Source('base/traceflags.cc')
854
855# embed python files. All .py files that have been indicated by a

--- 214 unchanged lines hidden ---