return a==b
def __getitem__(self, key):
- return self.map[(key[0], "*", "*")]
- for k, v in self.map.iteritems():
- if strip_name(k[0])==strip_name(key[0]) and self.wildcard_match(k[1], key[1]) and self.wildcard_match(k[2], key[2]):
- return v
- raise KeyError, key
+ try:
+ return self.map[(key[0], "*", "*")]
+ except KeyError:
+ for k, v in self.map.iteritems():
+ if strip_name(k[0])==strip_name(key[0]) and self.wildcard_match(k[1], key[1]) and self.wildcard_match(k[2], key[2]):
+ return v
+ raise KeyError, key
def update(self, other):
self.map.update(other.map)
self.size = size
def derive_ctype(self):
- self.ctype = typemap[(self.type, self.direction, self.kind)][0]
+ m = typemap[(self.type, self.direction, self.kind)]
+ self.ctype = m[0]
+ if m[1]!="*":
+ self.direction = m[1]
+ if m[2]!="*":
+ self.kind = m[2]
self.base_ctype = self.ctype
if self.kind=="value":
if self.base_ctype.startswith("const "):
def __init__(self, fn):
self.typemap = None
self.iomap = None
- self.spec = None
+ self.specs = []
self.prefix = None
self.ignore_categs = []
self.ignore_funcs = []
elif parts[0]=="iomap":
self.iomap = parts[1]
elif parts[0]=="spec":
- self.spec = parts[1]
+ self.specs.append(parts[1])
elif parts[0]=="prefix":
self.prefix = parts[1]
elif parts[0]=="ignore":
return funcs
template = Template(sys.argv[1])
+functions = []
for i in sys.argv[2:]:
files = Files(i)
typemap = Typemap(files.typemap)
iomap = IOmap(files.iomap)
- functions = read_spec(files.spec, files.prefix)
- functions = [f for f in functions if f.name not in files.ignore_funcs and f.category not in files.ignore_categs]
- for f in functions:
- f.finalize()
-
- template.process(functions)
+ for s in files.specs:
+ funcs = read_spec(s, files.prefix)
+ funcs = [f for f in funcs if f.name not in files.ignore_funcs and f.category not in files.ignore_categs]
+ for f in funcs:
+ f.finalize()
+ names = [f.name for f in funcs]
+ functions = [f for f in functions if f.name not in names]+funcs
+
+template.process(functions)