rubyx/lib/virtual/slots/message_slot.rb

51 lines
1.3 KiB
Ruby
Raw Normal View History

2015-05-06 07:38:29 +02:00
module Virtual
2015-06-20 22:49:30 +02:00
2015-06-21 20:09:15 +02:00
#TODO : this constant approach is a bit old, from before PArfait adapter
# nowadays these are unneccessary as we can resolve the names by using the
# layout of the class. (get Class from space)
TYPE_INDEX = 0
LAYOUT_INDEX = 1
CALLER_INDEX = 2
RETURN_INDEX = 3
EXCEPTION_INDEX = 4
SELF_INDEX = 5
NAME_INDEX = 6
FRAME_INDEX = 7
ARGUMENT_START = 8
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
def initialize index , type = Unknown , value = nil
2015-05-06 07:38:29 +02:00
super(index ,type , value )
end
end
2015-06-20 23:21:42 +02:00
# named classes exist for slots that often accessed
2015-06-21 20:09:15 +02:00
# Return is the MessageSlot(RETURN_INDEX)
2015-05-06 07:38:29 +02:00
class Return < MessageSlot
def initialize type = Unknown, value = nil
2015-06-21 20:09:15 +02:00
super( RETURN_INDEX , type , value )
2015-05-06 07:38:29 +02:00
end
end
2015-06-21 20:09:15 +02:00
# Self is the MessageSlot(SELF_INDEX)
2015-05-06 07:38:29 +02:00
class Self < MessageSlot
def initialize type = Unknown, value = nil
2015-06-21 20:09:15 +02:00
super( SELF_INDEX , type , value )
2015-05-06 07:38:29 +02:00
end
end
2015-06-20 23:21:42 +02:00
# MessageName of the current message
class MessageName < MessageSlot
def initialize type = Unknown, value = nil
2015-06-21 20:09:15 +02:00
super( NAME_INDEX , type , value )
2015-05-06 07:38:29 +02:00
end
end
end