rename internal get/set functions
mainly because the salaam parser chokes on internal…
This commit is contained in:
@ -125,7 +125,7 @@ module Interpreter
|
||||
else
|
||||
index = get_register(@instruction.index)
|
||||
end
|
||||
value = object.internal_object_get( index )
|
||||
value = object.get_internal( index )
|
||||
#value = value.object_id unless value.is_a? Fixnum
|
||||
set_register( @instruction.register , value )
|
||||
true
|
||||
@ -134,7 +134,7 @@ module Interpreter
|
||||
def execute_SetSlot
|
||||
value = object_for( @instruction.register )
|
||||
object = object_for( @instruction.array )
|
||||
object.internal_object_set( @instruction.index , value )
|
||||
object.set_internal( @instruction.index , value )
|
||||
trigger(:object_changed, @instruction.array , @instruction.index)
|
||||
true
|
||||
end
|
||||
@ -152,7 +152,7 @@ module Interpreter
|
||||
|
||||
def execute_FunctionReturn
|
||||
object = object_for( @instruction.register )
|
||||
link = object.internal_object_get( @instruction.index )
|
||||
link = object.get_internal( @instruction.index )
|
||||
@instruction = link
|
||||
# we jump back to the call instruction. so it is as if the call never happened and we continue
|
||||
true
|
||||
|
@ -154,7 +154,7 @@ module Parfait
|
||||
end
|
||||
|
||||
define_method :get_length do
|
||||
r = internal_object_get( offset ) #one for layout
|
||||
r = get_internal( offset ) #one for layout
|
||||
r.nil? ? 0 : r
|
||||
end
|
||||
|
||||
@ -166,7 +166,7 @@ module Parfait
|
||||
grow_to(index)
|
||||
end
|
||||
# start one higher than offset, which is where the length is
|
||||
internal_object_set( index + offset, value)
|
||||
set_internal( index + offset, value)
|
||||
end
|
||||
|
||||
# set the value at index.
|
||||
@ -176,7 +176,7 @@ module Parfait
|
||||
ret = nil
|
||||
if(index <= self.get_length)
|
||||
# start one higher than offset, which is where the length is
|
||||
ret = internal_object_get(index + offset )
|
||||
ret = get_internal(index + offset )
|
||||
end
|
||||
ret
|
||||
end
|
||||
@ -187,14 +187,14 @@ module Parfait
|
||||
return if old_length >= len
|
||||
# raise "bounds error at #{len}" if( len + offset > 16 )
|
||||
# be nice to use the indexed_length , but that relies on booted space
|
||||
internal_object_set( offset , len) #one for layout
|
||||
set_internal( offset , len) #one for layout
|
||||
end
|
||||
|
||||
define_method :shrink_to do | len|
|
||||
raise "Only positive lenths, #{len}" if len < 0
|
||||
old_length = self.get_length
|
||||
return if old_length <= len
|
||||
internal_object_set( offset , len)
|
||||
set_internal( offset , len)
|
||||
end
|
||||
|
||||
end
|
||||
|
@ -74,8 +74,8 @@ module Parfait
|
||||
raise "Use variable_index instead"
|
||||
end
|
||||
|
||||
# index of the variable when using internal_object_get
|
||||
# (internal_object_get is 1 based and 1 is always the layout)
|
||||
# index of the variable when using get_internal
|
||||
# (get_internal is 1 based and 1 is always the layout)
|
||||
def variable_index name
|
||||
has = super_index(name)
|
||||
return nil unless has
|
||||
|
@ -56,16 +56,16 @@ module Parfait
|
||||
def set_layout(layout)
|
||||
# puts "Layout was set for #{self.class}"
|
||||
raise "Nil layout" unless layout
|
||||
internal_object_set(LAYOUT_INDEX , layout)
|
||||
set_internal(LAYOUT_INDEX , layout)
|
||||
end
|
||||
|
||||
# so we can keep the raise in get_layout
|
||||
def has_layout?
|
||||
! internal_object_get(LAYOUT_INDEX).nil?
|
||||
! get_internal(LAYOUT_INDEX).nil?
|
||||
end
|
||||
|
||||
def get_layout()
|
||||
l = internal_object_get(LAYOUT_INDEX)
|
||||
l = get_internal(LAYOUT_INDEX)
|
||||
#puts "get layout for #{self.class} returns #{l.class}"
|
||||
raise "No layout #{self.object_id}:#{self.class} " unless l
|
||||
return l
|
||||
@ -84,13 +84,13 @@ module Parfait
|
||||
index = instance_variable_defined(name)
|
||||
#puts "getting #{name} at #{index}"
|
||||
return nil if index == nil
|
||||
return internal_object_get(index)
|
||||
return get_internal(index)
|
||||
end
|
||||
|
||||
def set_instance_variable name , value
|
||||
index = instance_variable_defined(name)
|
||||
return nil if index == nil
|
||||
return internal_object_set(index , value)
|
||||
return set_internal(index , value)
|
||||
end
|
||||
|
||||
def instance_variable_defined name
|
||||
|
@ -82,7 +82,7 @@ module Parfait
|
||||
def set_char at , char
|
||||
raise "char not fixnum #{char.class}" unless char.kind_of? Fixnum
|
||||
index = range_correct_index(at)
|
||||
internal_object_set( index + 2, char )
|
||||
set_internal( index + 2, char )
|
||||
end
|
||||
|
||||
# get the character at the given index
|
||||
@ -91,7 +91,7 @@ module Parfait
|
||||
#the return "character" is an integer
|
||||
def get_char at
|
||||
index = range_correct_index(at)
|
||||
return internal_object_get(index + 2 )
|
||||
return get_internal(index + 2 )
|
||||
end
|
||||
|
||||
# private method to calculate negative indexes into positives
|
||||
|
@ -74,11 +74,11 @@ module Parfait
|
||||
end
|
||||
|
||||
# 1 -based index
|
||||
def internal_object_get(index)
|
||||
def get_internal(index)
|
||||
@memory[index]
|
||||
end
|
||||
# 1 -based index
|
||||
def internal_object_set(index , value)
|
||||
def set_internal(index , value)
|
||||
raise "failed init for #{self.class}" unless @memory
|
||||
@memory[index] = value
|
||||
value
|
||||
|
Reference in New Issue
Block a user