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.

To protect your data, the CISO officer has suggested users to enable 2FA as soon as possible.
Currently 2.7% of users enabled 2FA.

Commit 8006d14f authored by Stefan Marr's avatar Stefan Marr
Browse files

Added Primitive class

Signed-off-by: default avatarStefan Marr <git@stefan-marr.de>
parent 601e52da
from som.vmobjects.object import Object
from som.vmobjects.invokable import Invokable
class Primitive(Object, Invokable):
# Static field indices and number of primitive fields
def __init__(self, signature_string, universe, invoke, is_empty = None):
super(Primitive, self).__init__(universe.nilObject)
# Set the class of this primitive to be the universal primitive class
# Set the signature of this primitive
self.invoke = invoke
if is_empty:
self.is_empty = is_empty
def is_primitive(self):
return True
def get_signature(self):
# Get the signature by reading the field with signature index
return self.get_field(self.SIGNATURE_INDEX)
def _set_signature(self, value):
# Set the signature by writing to the field with signature index
self.set_field(self.SIGNATURE_INDEX, value)
def get_holder(self):
# Get the holder of this method by reading the field with holder index
return self.get_field(self.HOLDER_INDEX)
def set_holder(self, value):
# Set the holder of this method by writing to the field with holder index
self.set_field(self.HOLDER_INDEX, value)
def _get_default_number_of_fields(self):
# Return the default number of fields for a primitive
def is_empty(self):
# By default a primitive is not empty
return False
def get_empty_primitive(cls, signature_string, universe):
# Return an empty primitive with the given signature
def invoke(self, frame, interpreter):
# Write a warning to the screen
universe.println("Warning: undefined primitive " +
self.get_signature().get_string() + " called")
# The empty primitives are empty
def is_empty(self): return True
return Primitive(signature_string, universe, invoke, is_empty)
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