def _get_list(self, i): from pycket.values import W_Fixnum if i == 0: return W_Fixnum(self.vals_fixed_0) else: assert i == 1 return W_Fixnum(self.vals_fixed_1)
def make_known_char_range_list(args): all_known = [None] * LEN_CHAR_RANGES for i, (start, end, same_props) in enumerate(known_char_ranges): all_known[i] = to_list( [W_Fixnum(start), W_Fixnum(end), W_Bool.make(same_props)]) return to_list(all_known)
def to_num(value): if value[0] == "+": value = value[1:] if value == "inf.0": return W_Flonum.INF elif value == "-inf.0": return W_Flonum.NEGINF elif value == "nan.0": return W_Flonum.NAN if "/" in value: if len(re.findall('/', value)) > 1: raise Exception( "Something's wrong with this rational number : %s" % value) sides = value.split("/") numer = sides[0] denom = sides[1] return W_Rational.make(to_num(numer), to_num(denom)) v = float(value) if "." in value: return W_Flonum(v) else: try: return W_Fixnum.make(string_to_int(value)) except ParseStringOverflowError: val = rbigint.fromdecimalstr(value) return W_Bignum(val) raise Exception("Didn't know what to do with this number : %s" % value)
def wrap(self, val): assert isinstance(val, float) bits = float2longlong(val) if is_int32_from_longlong_nan(bits): bits = decode_int32_from_longlong_nan(bits) return W_Fixnum(bits) return W_Flonum(val)
def _get_list(self, i): from pycket.values import W_Fixnum assert i == 0 return W_Fixnum(self.vals_fixed_0)
def ref_all(self, w_vector): unwrapped = self._storage(w_vector) return [W_Fixnum.make_or_interned(i) for i in unwrapped]
def wrap(self, val): assert isinstance(val, int) return W_Fixnum(val)