1.1 --- a/micropython/table.py Sat Feb 06 21:00:28 2010 +0100
1.2 +++ b/micropython/table.py Sun Feb 07 02:02:15 2010 +0100
1.3 @@ -3,7 +3,7 @@
1.4 """
1.5 Preparation of run-time attribute lookup tables.
1.6
1.7 -Copyright (C) 2007, 2008 Paul Boddie <paul@boddie.org.uk>
1.8 +Copyright (C) 2007, 2008, 2009, 2010 Paul Boddie <paul@boddie.org.uk>
1.9
1.10 This program is free software; you can redistribute it and/or modify it under
1.11 the terms of the GNU General Public License as published by the Free Software
1.12 @@ -353,6 +353,37 @@
1.13
1.14 list_class = ObjectList
1.15
1.16 + def all_possible_objects_plus_status(self, names):
1.17 +
1.18 + """
1.19 + Return all objects supporting attributes with the given 'names' plus
1.20 + whether such attributes can be exclusively static or may belong to
1.21 + instances. A list of tuples of the form (object name, is_static) is thus
1.22 + returned.
1.23 + """
1.24 +
1.25 + possible = []
1.26 + for objname in self.all_possible_objects(names):
1.27 + attributes = self.table[objname]
1.28 +
1.29 + is_static = 0
1.30 + is_instance = 0
1.31 +
1.32 + for name in names:
1.33 + if attributes[name].is_static_attribute():
1.34 + is_static = 1
1.35 + else:
1.36 + is_instance = 1
1.37 +
1.38 + if is_static and not is_instance:
1.39 + is_static = 1
1.40 + else:
1.41 + is_static = 0
1.42 +
1.43 + possible.append((objname, is_static))
1.44 +
1.45 + return possible
1.46 +
1.47 class ParameterTable(Table):
1.48
1.49 "A parameter table."