Ejemplo n.º 1
0
 def __new__(self, name, cls, typedict):
     d = dict(
         size       = _rawffi.sizeof('P'),
         align      = _rawffi.alignment('P'),
         length     = 1,
         _ffiargshape_ = 'P',
         _ffishape_  = 'P',
         _fficompositesize_ = None,
     )
     # XXX check if typedict['_type_'] is any sane
     # XXX remember about paramfunc
     obj = type.__new__(self, name, cls, typedict)
     for k, v in d.iteritems():
         setattr(obj, k, v)
     if '_type_' in typedict:
         self.set_type(obj, typedict['_type_'])
     else:
         def __init__(self, value=None):
             raise TypeError("%s has no type" % obj)
         obj.__init__ = __init__
     return obj
Ejemplo n.º 2
0
 def _alignmentofinstances(self):
     return _rawffi.alignment('P')
Ejemplo n.º 3
0
 def test_sizes_and_alignments(self):
     import _rawffi
     for k, (s, a) in self.sizes_and_alignments.iteritems():
         print k, s, a
         assert _rawffi.sizeof(k) == s
         assert _rawffi.alignment(k) == a
Ejemplo n.º 4
0
 def _alignmentofinstances(self):
     return _rawffi.alignment(self._type_)
Ejemplo n.º 5
0
 def _alignmentofinstances(self):
     return _rawffi.alignment('P')
Ejemplo n.º 6
0
 def test_sizes_and_alignments(self):
     import _rawffi
     for k, (s, a) in self.sizes_and_alignments.iteritems():
         print k,s,a
         assert _rawffi.sizeof(k) == s
         assert _rawffi.alignment(k) == a
Ejemplo n.º 7
0
 def _alignmentofinstances(self):
     return _rawffi.alignment(self._type_)