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# |
178trace_flags = {} 179def TraceFlag(name, desc=None): 180 if name in trace_flags: |
181 raise AttributeError, "Flag %s already specified" % name |
182 trace_flags[name] = (name, (), desc) |
183 |
184def CompoundFlag(name, flags, desc=None): 185 if name in trace_flags: |
186 raise AttributeError, "Flag %s already specified" % name 187 188 compound = tuple(flags) 189 for flag in compound: |
190 if flag not in trace_flags: |
191 raise AttributeError, "Trace flag %s not found" % flag |
192 if trace_flags[flag][1]: |
193 raise AttributeError, \ 194 "Compound flag can't point to another compound flag" 195 |
196 trace_flags[name] = (name, compound, desc) |
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 |
664 allFlags.sort() 665 666 print >>f, 'basic = [' |
667 for flag, compound, desc in allFlags: 668 if not compound: 669 print >>f, " '%s'," % flag 670 print >>f, " ]" 671 print >>f 672 |
673 print >>f, 'compound = [' |
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 |
681 print >>f, "all = frozenset(basic + compound)" |
682 print >>f 683 |
684 print >>f, 'compoundMap = {' |
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 |
693 print >>f, 'descriptions = {' |
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 |
847flags = [ Value(f) for f in trace_flags.values() ] |
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 --- |