Ejemplo n.º 1
0
 def __init__(self, db, STRUCT, varlength=None):
     NodeWithDependencies.__init__(self, db)
     self.STRUCT = STRUCT
     self.LLTYPE = STRUCT
     self.varlength = varlength
     if varlength is None:
         basename = STRUCT._name
         with_number = True
     else:
         basename = db.gettypedefnode(STRUCT).barename
         basename = "%s_len%d" % (basename, varlength)
         with_number = False
     if STRUCT._hints.get("union"):
         self.typetag = "union"
         assert STRUCT._gckind == "raw"  # not supported: "GcUnion"
     if STRUCT._hints.get("typedef"):
         self.typetag = ""
         assert STRUCT._hints.get("external")
     if self.STRUCT._hints.get("external"):  # XXX hack
         self.forward_decl = None
     if STRUCT._hints.get("c_name"):
         self.barename = self.name = STRUCT._hints["c_name"]
         self.c_struct_field_name = self.verbatim_field_name
     else:
         (self.barename, self.name) = db.namespace.uniquename(basename, with_number=with_number, bare=True)
         self.prefix = somelettersfrom(STRUCT._name) + "_"
     #
     self.fieldnames = STRUCT._names
     if STRUCT._hints.get("typeptr", False):
         if db.gcpolicy.need_no_typeptr():
             assert self.fieldnames == ("typeptr",)
             self.fieldnames = ()
     #
     self.fulltypename = "%s %s @" % (self.typetag, self.name)
Ejemplo n.º 2
0
 def __init__(self, db, STRUCT, varlength=None):
     NodeWithDependencies.__init__(self, db)
     self.STRUCT = STRUCT
     self.LLTYPE = STRUCT
     self.varlength = varlength
     if varlength is None:
         basename = STRUCT._name
         with_number = True
     else:
         basename = db.gettypedefnode(STRUCT).barename
         basename = '%s_len%d' % (basename, varlength)
         with_number = False
     if STRUCT._hints.get('union'):
         self.typetag = 'union'
         assert STRUCT._gckind == 'raw'  # not supported: "GcUnion"
     if STRUCT._hints.get('typedef'):
         self.typetag = ''
         assert STRUCT._hints.get('external')
     if self.STRUCT._hints.get('external'):  # XXX hack
         self.forward_decl = None
     if STRUCT._hints.get('c_name'):
         self.barename = self.name = STRUCT._hints['c_name']
         self.c_struct_field_name = self.verbatim_field_name
     else:
         (self.barename, self.name) = db.namespace.uniquename(
             basename, with_number=with_number, bare=True)
         self.prefix = somelettersfrom(STRUCT._name) + '_'
     #
     self.fieldnames = STRUCT._names
     if STRUCT._hints.get('typeptr', False):
         if db.gcpolicy.need_no_typeptr():
             assert self.fieldnames == ('typeptr', )
             self.fieldnames = ()
     #
     self.fulltypename = '%s %s @' % (self.typetag, self.name)
Ejemplo n.º 3
0
 def __init__(self, db, STRUCT, varlength=None):
     NodeWithDependencies.__init__(self, db)
     self.STRUCT = STRUCT
     self.LLTYPE = STRUCT
     self.varlength = varlength
     if varlength is None:
         basename = STRUCT._name
         with_number = True
     else:
         basename = db.gettypedefnode(STRUCT).barename
         basename = '%s_len%d' % (basename, varlength)
         with_number = False
     if STRUCT._hints.get('union'):
         self.typetag = 'union'
         assert STRUCT._gckind == 'raw'   # not supported: "GcUnion"
     if STRUCT._hints.get('typedef'):
         self.typetag = ''
         assert STRUCT._hints.get('external')
     if self.STRUCT._hints.get('external'):      # XXX hack
         self.forward_decl = None
     if STRUCT._hints.get('c_name'):
         self.barename = self.name = STRUCT._hints['c_name']
         self.c_struct_field_name = self.verbatim_field_name
     else:
         (self.barename,
          self.name) = db.namespace.uniquename(basename,
                                               with_number=with_number,
                                               bare=True)
         self.prefix = somelettersfrom(STRUCT._name) + '_'
     #
     self.fieldnames = STRUCT._names
     if STRUCT._hints.get('typeptr', False):
         if db.gcpolicy.need_no_typeptr():
             assert self.fieldnames == ('typeptr',)
             self.fieldnames = ()
     #
     self.fulltypename = '%s %s @' % (self.typetag, self.name)
Ejemplo n.º 4
0
 def argnames(self):
     return [
         '%s%d' % (somelettersfrom(self.argtypenames[i]), i)
         for i in range(len(self.argtypenames))
     ]
Ejemplo n.º 5
0
 def argnames(self):
     return ['%s%d' % (somelettersfrom(self.argtypenames[i]), i)
             for i in range(len(self.argtypenames))]