2015-05-06 07:38:29 +02:00
|
|
|
module Virtual
|
2015-06-20 22:49:30 +02:00
|
|
|
|
|
|
|
# The current Message is one of four objects the virtual machine knows
|
|
|
|
#
|
|
|
|
# Slots represent instance variables of objects, so MessageSlots
|
|
|
|
# represent instance variables of Message objects.
|
|
|
|
# The Message has a layout as per the constant above
|
|
|
|
|
2015-05-06 07:38:29 +02:00
|
|
|
class MessageSlot < Slot
|
2015-09-23 17:35:37 +02:00
|
|
|
def initialize type , value = nil
|
2015-06-29 09:55:22 +02:00
|
|
|
super(type , value )
|
2015-05-06 07:38:29 +02:00
|
|
|
end
|
2015-06-30 08:39:45 +02:00
|
|
|
def object_name
|
|
|
|
:message
|
|
|
|
end
|
2015-05-06 07:38:29 +02:00
|
|
|
end
|
|
|
|
|
2015-06-20 23:21:42 +02:00
|
|
|
# named classes exist for slots that often accessed
|
|
|
|
|
2015-06-29 09:55:22 +02:00
|
|
|
# Return is the return of MessageSlot
|
2015-05-06 07:38:29 +02:00
|
|
|
class Return < MessageSlot
|
2015-09-23 17:35:37 +02:00
|
|
|
def initialize type , value = nil
|
2015-06-29 09:55:22 +02:00
|
|
|
super( type , value )
|
2015-05-06 07:38:29 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-06-29 09:55:22 +02:00
|
|
|
# Self is the self in MessageSlot
|
2015-05-06 07:38:29 +02:00
|
|
|
class Self < MessageSlot
|
2015-09-23 17:35:37 +02:00
|
|
|
def initialize type , value = nil
|
2015-06-29 09:55:22 +02:00
|
|
|
super( type , value )
|
2015-05-06 07:38:29 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2015-07-02 08:48:41 +02:00
|
|
|
# MessageName of the current message
|
|
|
|
class MessageName < MessageSlot
|
2015-09-23 17:35:37 +02:00
|
|
|
def initialize type , value = nil
|
2015-06-29 09:55:22 +02:00
|
|
|
super( type , value )
|
2015-05-06 07:38:29 +02:00
|
|
|
end
|
|
|
|
end
|
2015-07-19 12:20:34 +02:00
|
|
|
|
|
|
|
# NewMessageName of the next message
|
|
|
|
class ArgSlot < MessageSlot
|
2015-09-23 17:35:37 +02:00
|
|
|
def initialize index , type , value = nil
|
2015-07-19 12:20:34 +02:00
|
|
|
@index = index
|
|
|
|
super( type , value )
|
|
|
|
end
|
|
|
|
attr_reader :index
|
2015-10-06 14:26:57 +02:00
|
|
|
def to_s
|
|
|
|
"#{self.class.name}.new(#{index} , #{type}, #{value})"
|
|
|
|
end
|
2015-07-19 12:20:34 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
|
2015-05-06 07:38:29 +02:00
|
|
|
end
|