SConscript (6143:010490fd482a) | SConscript (6229:7cb9ce17a56f) |
---|---|
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 --- 195 unchanged lines hidden (view full) --- 204 raise AttributeError, "Flag %s already specified" % name 205 trace_flags[name] = (name, (), desc) 206 207def CompoundFlag(name, flags, desc=None): 208 if name in trace_flags: 209 raise AttributeError, "Flag %s already specified" % name 210 211 compound = tuple(flags) | 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 --- 195 unchanged lines hidden (view full) --- 204 raise AttributeError, "Flag %s already specified" % name 205 trace_flags[name] = (name, (), desc) 206 207def CompoundFlag(name, flags, desc=None): 208 if name in trace_flags: 209 raise AttributeError, "Flag %s already specified" % name 210 211 compound = tuple(flags) |
212 for flag in compound: 213 if flag not in trace_flags: 214 raise AttributeError, "Trace flag %s not found" % flag 215 if trace_flags[flag][1]: 216 raise AttributeError, \ 217 "Compound flag can't point to another compound flag" 218 | |
219 trace_flags[name] = (name, compound, desc) 220 221Export('TraceFlag') 222Export('CompoundFlag') 223 224######################################################################## 225# 226# Set some compiler variables --- 398 unchanged lines hidden (view full) --- 625 print >>f, '}' 626 f.close() 627 628env.Command('python/swig/init.cc', 629 map(Value, sorted(s.module for s in SwigSource.all)), 630 makeSwigInit) 631Source('python/swig/init.cc') 632 | 212 trace_flags[name] = (name, compound, desc) 213 214Export('TraceFlag') 215Export('CompoundFlag') 216 217######################################################################## 218# 219# Set some compiler variables --- 398 unchanged lines hidden (view full) --- 618 print >>f, '}' 619 f.close() 620 621env.Command('python/swig/init.cc', 622 map(Value, sorted(s.module for s in SwigSource.all)), 623 makeSwigInit) 624Source('python/swig/init.cc') 625 |
626def getFlags(source_flags): 627 flagsMap = {} 628 flagsList = [] 629 for s in source_flags: 630 val = eval(s.get_contents()) 631 name, compound, desc = val 632 flagsList.append(val) 633 flagsMap[name] = bool(compound) 634 635 for name, compound, desc in flagsList: 636 for flag in compound: 637 if flag not in flagsMap: 638 raise AttributeError, "Trace flag %s not found" % flag 639 if flagsMap[flag]: 640 raise AttributeError, \ 641 "Compound flag can't point to another compound flag" 642 643 flagsList.sort() 644 return flagsList 645 646 |
|
633# Generate traceflags.py 634def traceFlagsPy(target, source, env): 635 assert(len(target) == 1) 636 637 f = file(str(target[0]), 'w') | 647# Generate traceflags.py 648def traceFlagsPy(target, source, env): 649 assert(len(target) == 1) 650 651 f = file(str(target[0]), 'w') |
652 653 allFlags = getFlags(source) |
|
638 | 654 |
639 allFlags = [] 640 for s in source: 641 val = eval(s.get_contents()) 642 allFlags.append(val) 643 644 allFlags.sort() 645 | |
646 print >>f, 'basic = [' 647 for flag, compound, desc in allFlags: 648 if not compound: 649 print >>f, " '%s'," % flag 650 print >>f, " ]" 651 print >>f 652 653 print >>f, 'compound = [' --- 24 unchanged lines hidden (view full) --- 678 679 f.close() 680 681def traceFlagsCC(target, source, env): 682 assert(len(target) == 1) 683 684 f = file(str(target[0]), 'w') 685 | 655 print >>f, 'basic = [' 656 for flag, compound, desc in allFlags: 657 if not compound: 658 print >>f, " '%s'," % flag 659 print >>f, " ]" 660 print >>f 661 662 print >>f, 'compound = [' --- 24 unchanged lines hidden (view full) --- 687 688 f.close() 689 690def traceFlagsCC(target, source, env): 691 assert(len(target) == 1) 692 693 f = file(str(target[0]), 'w') 694 |
686 allFlags = [] 687 for s in source: 688 val = eval(s.get_contents()) 689 allFlags.append(val) | 695 allFlags = getFlags(source) |
690 691 # file header 692 print >>f, ''' 693/* 694 * DO NOT EDIT THIS FILE! Automatically generated 695 */ 696 697#include "base/traceflags.hh" --- 56 unchanged lines hidden (view full) --- 754 755 f.close() 756 757def traceFlagsHH(target, source, env): 758 assert(len(target) == 1) 759 760 f = file(str(target[0]), 'w') 761 | 696 697 # file header 698 print >>f, ''' 699/* 700 * DO NOT EDIT THIS FILE! Automatically generated 701 */ 702 703#include "base/traceflags.hh" --- 56 unchanged lines hidden (view full) --- 760 761 f.close() 762 763def traceFlagsHH(target, source, env): 764 assert(len(target) == 1) 765 766 f = file(str(target[0]), 'w') 767 |
762 allFlags = [] 763 for s in source: 764 val = eval(s.get_contents()) 765 allFlags.append(val) | 768 allFlags = getFlags(source) |
766 767 # file header boilerplate 768 print >>f, ''' 769/* 770 * DO NOT EDIT THIS FILE! 771 * 772 * Automatically generated from traceflags.py 773 */ --- 284 unchanged lines hidden --- | 769 770 # file header boilerplate 771 print >>f, ''' 772/* 773 * DO NOT EDIT THIS FILE! 774 * 775 * Automatically generated from traceflags.py 776 */ --- 284 unchanged lines hidden --- |