remove Data2 in favour of Data4
as we write a Marker, type and marker make up 2 so data2 is just the type, not useful
This commit is contained in:
@ -13,8 +13,8 @@
|
||||
# logical and math operation that are bundled into the OperatorInstruction.
|
||||
#
|
||||
# For safe access the access code needs to know the length of the data, which is
|
||||
# encoded in the class/type name. Ie An Integer derives from Data2, which is 2 long
|
||||
# (minus one for the type, so exactly the one word for the integer)
|
||||
# encoded in the class/type name. Ie An Integer derives from Data4, which is 4 long
|
||||
# ( one for the type, one for the next, one word for the integer and currently still a marker)
|
||||
#
|
||||
# DataObjects still have a type, and so can have objects before the data starts
|
||||
#
|
||||
@ -44,9 +44,9 @@ module Parfait
|
||||
end
|
||||
end
|
||||
|
||||
class Data2 < DataObject
|
||||
class Data4 < DataObject
|
||||
def data_length
|
||||
1
|
||||
3
|
||||
end
|
||||
def padded_length
|
||||
2 * 4
|
||||
|
@ -7,15 +7,18 @@
|
||||
# Ie it would be possible to change the value, we just don't support that)
|
||||
|
||||
module Parfait
|
||||
class Integer < Data2
|
||||
class Integer < Data4
|
||||
|
||||
#FIXME: this is "just" for compilation
|
||||
def initialize(value)
|
||||
def initialize(value , next_i = nil)
|
||||
super()
|
||||
@value = value
|
||||
@next_i = next_i
|
||||
end
|
||||
attr_reader :value
|
||||
attr_reader :next_i, :value
|
||||
|
||||
def self.integer_index
|
||||
3 # 1 type, 2 next_i
|
||||
end
|
||||
# :integer?, :odd?, :even?, :upto, :downto, :times, :succ, :next, :pred, :chr, :ord, :to_i, :to_int, :floor,
|
||||
# :ceil, :truncate, :round, :gcd, :lcm, :gcdlcm, :numerator, :denominator, :to_r, :rationalize,
|
||||
# :singleton_method_added, :coerce, :i, :+@, :-@, :fdiv, :div, :divmod, :%, :modulo, :remainder, :abs, :magnitude,
|
||||
@ -30,19 +33,19 @@ module Parfait
|
||||
end
|
||||
|
||||
# adding other base classes in here for now:
|
||||
class FalseClass < Data2
|
||||
class FalseClass < Data4
|
||||
#FIXME: this is "just" for compilation
|
||||
def initialize
|
||||
super
|
||||
end
|
||||
end
|
||||
class TrueClass < Data2
|
||||
class TrueClass < Data4
|
||||
#FIXME: this is "just" for compilation
|
||||
def initialize
|
||||
super
|
||||
end
|
||||
end
|
||||
class NilClass < Data2
|
||||
class NilClass < Data4
|
||||
#FIXME: this is "just" for compilation
|
||||
def initialize
|
||||
super
|
||||
|
Reference in New Issue
Block a user