Example #1
0
 def check(self, value):
     vecinfo = forwarded_vecinfo(value)
     assert vecinfo.datatype != '\x00'
     if self.type != TypeRestrict.ANY_TYPE:
         if self.type != vecinfo.datatype:
             msg = "type mismatch %s != %s" % \
                     (self.type, vecinfo.datatype)
             failnbail_transformation(msg)
     assert vecinfo.bytesize > 0
     if not self.any_size():
         if self.bytesize != vecinfo.bytesize:
             msg = "bytesize mismatch %s != %s" % \
                     (self.bytesize, vecinfo.bytesize)
             failnbail_transformation(msg)
     assert vecinfo.count > 0
     if self.count != TypeRestrict.ANY_COUNT:
         if vecinfo.count < self.count:
             msg = "count mismatch %s < %s" % \
                     (self.count, vecinfo.count)
             failnbail_transformation(msg)
     if self.sign != TypeRestrict.ANY_SIGN:
         if bool(self.sign) == vecinfo.sign:
             msg = "sign mismatch %s < %s" % \
                     (self.sign, vecinfo.sign)
             failnbail_transformation(msg)
Example #2
0
 def check(self, value):
     vecinfo = forwarded_vecinfo(value)
     assert vecinfo.datatype != '\x00'
     if self.type != TypeRestrict.ANY_TYPE:
         if self.type != vecinfo.datatype:
             msg = "type mismatch %s != %s" % \
                     (self.type, vecinfo.datatype)
             failnbail_transformation(msg)
     assert vecinfo.bytesize > 0
     if not self.any_size():
         if self.bytesize != vecinfo.bytesize:
             msg = "bytesize mismatch %s != %s" % \
                     (self.bytesize, vecinfo.bytesize)
             failnbail_transformation(msg)
     assert vecinfo.count > 0
     if self.count != TypeRestrict.ANY_COUNT:
         if vecinfo.count < self.count:
             msg = "count mismatch %s < %s" % \
                     (self.count, vecinfo.count)
             failnbail_transformation(msg)
     if self.sign != TypeRestrict.ANY_SIGN:
         if bool(self.sign) == vecinfo.sign:
             msg = "sign mismatch %s < %s" % \
                     (self.sign, vecinfo.sign)
             failnbail_transformation(msg)
Example #3
0
 def get_operation_restriction(self, op):
     res = self.TR_MAPPING.get(op.vector, None)
     if not res:
         failnbail_transformation("could not get OpRestrict for " + str(op))
     return res
Example #4
0
 def get_operation_restriction(self, op):
     res = self.TR_MAPPING.get(op.vector, None)
     if not res:
         failnbail_transformation("could not get OpRestrict for " + str(op))
     return res