WARNING! Access to this system is limited to authorised users only.
Unauthorised users may be subject to prosecution.
Unauthorised access to this system is a criminal offence under Australian law (Federal Crimes Act 1914 Part VIA)
It is a criminal offence to:
(1) Obtain access to data without authority. -Penalty 2 years imprisonment.
(2) Damage, delete, alter or insert data without authority. -Penalty 10 years imprisonment.
User activity is monitored and recorded. Anyone using this system expressly consents to such monitoring and recording.

Commit 04495acc authored by Stefan Marr's avatar Stefan Marr
Browse files

Added ArrayPrimitives

Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent 00b61f56
from som.vmobjects.primitive import Primitive
from som.primitives.primitives import Primitives
class ArrayPrimitives(Primitives):
def install_primitives(self):
def _at(self, frame, interpreter):
i = frame.pop()
rcvr = frame.pop()
frame.push(rcvr.get_indexable_field(i.get_embedded_integer() - 1))
self._install_instance_primitive(Primitive("at:", self._universe, _at))
def _atPut(self, frame, interpreter):
value = frame.pop()
index = frame.pop()
rcvr = frame.get_stack_element(0)
rcvr.set_indexable_field(index.get_embedded_integer() - 1, value)
self._install_instance_primitive(Primitive("at:put:", self._universe, _atPut))
def _length(self, frame, interpreter):
rcvr = frame.pop()
self._install_instance_primitive(Primitive("length", self._universe, _length))
def _new(self, frame, interpreter):
length = frame.pop()
frame.pop() # not required
self._install_instance_primitive(Primitive("new:", self._universe, _new))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment