Enum sage::vm::StandardOp

source ·
pub enum StandardOp {
Show 23 variants CoreOp(CoreOp), Set(Vec<f64>), Alloc, Free, ToInt(usize), ToFloat(usize), Add(usize), Sub(usize), Mul(usize), Div(usize), Rem(usize), Neg(usize), IsNonNegative(usize), Sin(usize), Cos(usize), Tan(usize), ASin(usize), ACos(usize), ATan(usize), Pow(usize), Peek, Poke, Call(FFIBinding),
}
Expand description

An individual standard virtual machine instruction.

Variants§

§

CoreOp(CoreOp)

Execute a core instruction.

§

Set(Vec<f64>)

Set the register equal to a constant floating point value.

§

Alloc

Take the value of the register, and allocate that number of cells in memory. Set the register to the lowest address of the allocated memory.

§

Free

Free the memory pointed to by the register.

§

ToInt(usize)

Convert the register from a float to an integer.

§

ToFloat(usize)

Convert the register from an integer to a float.

§

Add(usize)

Add the value pointed to on the tape to the register (as floats).

§

Sub(usize)

Subtract the value pointed to on the tape from the register (as floats).

§

Mul(usize)

Multiply the register by the value pointed to on the tape (as floats).

§

Div(usize)

Divide the register by the value pointed to on the tape (as floats).

§

Rem(usize)

Store the remainder of the register and the value pointed to in the tape (as floats) into the register.

§

Neg(usize)

Negate the value of the register (as a float).

§

IsNonNegative(usize)

Make the register equal to the integer 1 if the register (as a float) is not negative, otherwise make it equal to 0.

§

Sin(usize)

Store the sine of the register (as a float) into the register. The argument is the size of the register vector.

§

Cos(usize)

Store the cosine of the register (as a float) into the register.

§

Tan(usize)

Store the tangent of the register (as a float) into the register.

§

ASin(usize)

Store the inverse-sine of the register (as a float) into the register.

§

ACos(usize)

Store the inverse-cosine of the register (as a float) into the register.

§

ATan(usize)

Store the inverse-tangent of the register (as a float) into the register.

§

Pow(usize)

Store the value of the register (as a float) to the power of the value pointed to on the tape (as a float) into the register.

§

Peek

Get a value from the input interface / device and store it in the register. This is intended to function something like system calls for using any external functionality that can’t be implemented in the virtual machine, such as I/O or OS operations.

Whenever a value is returned from the foreign function interface, it is stored in the FFI buffer of cells. Whenever an FFI function is called, it will receive its arguments from this buffer.

§

Poke

Write the value of the register to the output interface / device. This is intended to function something like system calls for using any external functionality that can’t be implemented in the virtual machine, such as I/O or OS operations.

Whenever a value is returned from the foreign function interface, it is stored in the FFI buffer of cells. Whenever an FFI function is called, it will receive its arguments from this buffer.

§

Call(FFIBinding)

Call a foreign function interface function.

Trait Implementations§

source§

impl Clone for StandardOp

source§

fn clone(&self) -> StandardOp

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for StandardOp

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Display for StandardOp

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl PartialEq for StandardOp

source§

fn eq(&self, other: &StandardOp) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl PartialOrd for StandardOp

source§

fn partial_cmp(&self, other: &StandardOp) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl StructuralPartialEq for StandardOp

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T> ToString for T
where T: Display + ?Sized,

source§

default fn to_string(&self) -> String

Converts the given value to a String. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.