5 def isAbstract(nodetype):
6 return nodetype in abstracts
8 def is_dynamic_pinned(node):
9 return node.pinned in ["memory", "exception"]
11 def verify_node(node):
12 if not hasattr(node, "pinned"):
13 print "%s: NO PINNED SET" % node.__name__
14 elif node.pinned not in ["yes", "no", "memory", "exception"]:
15 print "%s: UNKNOWN PINNED MODE: %s" % (node.__name__, node.pinned)
17 if not hasattr(node, "flags") and not isAbstract(node):
18 print "WARNING: no flags specified for %s\n" % node.__name__
19 elif type(node.flags) != list:
20 print "ERROR: flags of %s not a list" % node.__name__
22 def setldefault(node, attr, val):
23 # Don't use hasattr, as these things should not be inherited
24 if attr not in node.__dict__:
25 setattr(node, attr, val)
27 def setdefault(node, attr, val):
28 # Don't use hasattr, as these things should not be inherited
29 if not hasattr(node, attr):
30 setattr(node, attr, val)
32 def setnodedefaults(node):
33 setldefault(node, "name", node.__name__)
37 setdefault(node, "ins", [])
38 setdefault(node, "arity", len(node.ins))
39 setdefault(node, "attrs", [])
40 setdefault(node, "constructor_args", [])
41 setldefault(node, "constrname", node.name)
42 if hasattr(node, "outs"):