コード例 #1
0
ファイル: model.py プロジェクト: matthias-springer/RSqueak
 def unwrap_char(self, space):
     w_class = self.getclass(space)
     if not w_class.is_same_object(space.w_Character):
         raise error.UnwrappingError("expected Character")
     w_ord = self.fetch(space, constants.CHARACTER_VALUE_INDEX)
     if not isinstance(w_ord, W_SmallInteger):
         raise error.UnwrappingError("expected SmallInteger from Character")
     return chr(w_ord.value)
コード例 #2
0
ファイル: model.py プロジェクト: matthias-springer/RSqueak
 def unwrap_longlong(self, space):
     # TODO: Completely untested! This failed translation bigtime...
     # XXX Probably we want to allow all subclasses
     if not self.getclass(space).is_same_object(space.w_LargePositiveInteger):
         raise error.UnwrappingError("Failed to convert bytes to word")
     if self.size() > 8:
         raise error.UnwrappingError("Too large to convert bytes to word")
     word = r_longlong(0)
     for i in range(self.size()):
         word += r_longlong(ord(self.getchar(i))) << 8*i
     return word
コード例 #3
0
ファイル: model.py プロジェクト: matthias-springer/RSqueak
 def unwrap_int(self, space):
     if self.value >= 0:
         return intmask(self.value)
     else:
         raise error.UnwrappingError("The value is negative when interpreted as 32bit value.")
コード例 #4
0
ファイル: model.py プロジェクト: matthias-springer/RSqueak
 def unwrap_longlong(self, space):
     raise error.UnwrappingError("Got unexpected class unwrap_longlong")
コード例 #5
0
ファイル: model.py プロジェクト: matthias-springer/RSqueak
 def unwrap_positive_32bit_int(self, space):
     raise error.UnwrappingError("Got unexpected class unwrap_positive_32bit_int")
コード例 #6
0
ファイル: model.py プロジェクト: matthias-springer/RSqueak
 def unwrap_uint(self, space):
     raise error.UnwrappingError("Got unexpected class in unwrap_uint")