[ctypes-commit] ctypes/sandbox/tools/codegen nodes.py,1.7,1.8
Brought to you by:
theller
From: Thomas H. <th...@us...> - 2004-10-05 06:52:57
|
Update of /cvsroot/ctypes/ctypes/sandbox/tools/codegen In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv428 Modified Files: nodes.py Log Message: Remove all the unneeded stuff. Index: nodes.py =================================================================== RCS file: /cvsroot/ctypes/ctypes/sandbox/tools/codegen/nodes.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** nodes.py 4 Oct 2004 19:42:49 -0000 1.7 --- nodes.py 5 Oct 2004 06:52:44 -0000 1.8 *************** *** 18,26 **** self.extern = extern - def depends(self): - result = set(self.arguments) - result.add(self.returns) - return result - class Constructor(_HasArgs): def __init__(self, name): --- 18,21 ---- *************** *** 28,34 **** self.arguments = [] - def depends(self): - return [] - class OperatorFunction(_HasArgs): def __init__(self, name, returns): --- 23,26 ---- *************** *** 42,50 **** self.arguments = [] - def depends(self): - result = set(self.arguments) - result.add(self.returns) - return result - class Method(_HasArgs): def __init__(self, name, returns): --- 34,37 ---- *************** *** 53,94 **** self.arguments = [] - def depends(self): - result = set(self.arguments) - result.add(self.returns) - return result - class FundamentalType(object): def __init__(self, name): self.name = name - def depends(self): - return [] - def __repr__(self): return "<FundamentalType(%s)>" % self.name - def get_pointed_to(p): - # if p is a pointer, return the end of the chain pointed to. - if isinstance(p, PointerType): - return get_pointed_to(p.typ) - elif isinstance(p, CvQualifiedType): - return get_pointed_to(p.typ) - elif isinstance(p, Typedef): - return get_pointed_to(p.typ) - return p - class PointerType(object): def __init__(self, typ): self.typ = typ - def depends(self): - # Well, if the pointer points to a structure or union, - # we don't need the complete struct or union definition. - # The header will suffice. - t = get_pointed_to(self) - if type(t) in (Structure, Union): - return [t.get_head()] - return [t] - def __repr__(self): return "<POINTER(%s)>" % self.typ --- 40,54 ---- *************** *** 99,107 **** self.typ = typ - def depends(self): - if type(self.typ) in (Structure, Union): - return [self.typ.get_head()] - return [self.typ] - def __repr__(self): return "<Typedef(%s) at %x>" % (self.name, id(self)) --- 59,62 ---- *************** *** 113,152 **** self.max = max - def depends(self): - return [self.typ] - def __repr__(self): return "<Array(%s[%s]) at %x>" % (self.typ, self.max, id(self)) - # Structures (and Unions, as well) are split into three objects. - # Structure depends on StructureHead and StructureBody - # StructureHead depends on bases, - # StructureBody depends on head and members. - # - # Pointer to Structure depends on StructureHead only - class StructureHead(object): def __init__(self, struct): self.struct = struct - def depends(self): - # XXX Hm, does it depend on bases, or does it depends on the bases' head? - return self.struct.bases - class StructureBody(object): def __init__(self, struct): self.struct = struct - def depends(self): - result = set() - # needed, so that the head is defined before the body - result.add(self.struct.get_head()) - for m in self.struct.members: - if type(m) is Field: - result.add(m.typ) - if type(m) is Method: - result.update(m.depends()) - return result - def __repr__(self): return "<StructureBody(%s) at %x>" % (self.struct.name, id(self)) --- 68,82 ---- *************** *** 202,208 **** self.offset = offset - def depends(self): - return [self.typ] - class CvQualifiedType(object): def __init__(self, typ, attrib): --- 132,135 ---- *************** *** 210,216 **** self.attrib = attrib - def depends(self): - return self.typ.depends() - class Enumeration(object): def __init__(self, name): --- 137,140 ---- *************** *** 221,226 **** self.values.append((name, value)) - def depends(self): - return [] - ################################################################ --- 145,147 ---- |