Class: Wilson::Label
Overview
Label is a known point in the byte stream that we can jmp/loop back to.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#position ⇒ Object
Returns the value of attribute position.
Attributes inherited from Operand
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Operand
#initialize, #instructionFromMessage, #method_missing, on, #operand?
Constructor Details
This class inherits a constructor from Wilson::Operand
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Wilson::Operand
Instance Attribute Details
#position ⇒ Object
Returns the value of attribute position.
1069 1070 1071 |
# File 'lib/wilson.rb', line 1069 def position @position end |
Class Method Details
.on_at(machine, position) ⇒ Object
1071 1072 1073 1074 1075 1076 |
# File 'lib/wilson.rb', line 1071 def self.on_at machine, position label = self.new label.machine = machine label.position = position label end |
Instance Method Details
#bits ⇒ Object
1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 |
# File 'lib/wilson.rb', line 1078 def bits distance = machine.stream.size - position if distance < 256 then 8 elsif distance < 65536 then 16 else 32 end end |
#label? ⇒ Boolean
1090 1091 1092 |
# File 'lib/wilson.rb', line 1090 def label? true end |