C# Класс kOS.Safe.Compilation.Opcode

Показать файл Открыть проект

Открытые свойства

Свойство Тип Описание
SourcePath kOS.Safe.Persistence.GlobalPath

Открытые методы

Метод Описание
Execute ( ICpu cpu ) : void
GetArgumentDefs ( ) : IEnumerable

Return the list of member Properties that are part of what gets stored to machine langauge for this opcode.

InitMachineCodeData ( ) : void

This is intended to be called once, during the mod's initialization, and never again. It builds the Dictionaries that look up the type of opcode given its string name or code.

PopulateFromMLFields ( List fields ) : void

Starting from an empty instance of this opcode that you can assume was created from the default constructor, populate the Opcode's properties from a list of all the [MLFields] saved to the machine language file.
This needs to be overridden only if your Opcode has declared [MLField]'s. If your Opcode has no [MLFields] then the generic base version of this method works well enough.

TODO: Perhaps add an assert to the Init methods that will throw up a NagMessage if it detects an Opcode has be defined which has [MLFields] but lacks an override of this method.

ToString ( ) : string
TypeFromCode ( ByteCode code ) : Type

Given a string value of Code, find the Opcode Type that uses that as its CodeName.

TypeFromName ( string name ) : Type

Given a string value of Name, find the Opcode Type that uses that as its Name.

Защищенные методы

Метод Описание
Opcode ( ) : System
PopStructureAssertEncapsulated ( ICpu cpu, bool barewordOkay = false ) : Structure

A utility function that will do the same as a cpu.PopStructureEncapsulated, but with an additional check to ensure the value atop the stack isn't the arg bottom marker.

PopValueAssert ( ICpu cpu, bool barewordOkay = false ) : object

A utility function that will do a cpu.PopValue, but with an additional check to ensure the value atop the stack isn't the arg bottom marker.

PopValueAssertEncapsulated ( ICpu cpu, bool barewordOkay = false ) : object

A utility function that will do the same as a cpu.PopValueEncapsulated, but with an additional check to ensure the value atop the stack isn't the arg bottom marker.

Приватные методы

Метод Описание
MLFieldComparator ( MLArgInfo a1, MLArgInfo a2 ) : int

Delegate function used for Sort() of the MLFields on an Opcode. Should only be called on properties that have [MLField] attributes on them.

Описание методов

Execute() публичный Метод

public Execute ( ICpu cpu ) : void
cpu ICpu
Результат void

GetArgumentDefs() публичный Метод

Return the list of member Properties that are part of what gets stored to machine langauge for this opcode.
public GetArgumentDefs ( ) : IEnumerable
Результат IEnumerable

InitMachineCodeData() публичный статический Метод

This is intended to be called once, during the mod's initialization, and never again. It builds the Dictionaries that look up the type of opcode given its string name or code.
public static InitMachineCodeData ( ) : void
Результат void

Opcode() защищенный Метод

protected Opcode ( ) : System
Результат System

PopStructureAssertEncapsulated() защищенный Метод

A utility function that will do the same as a cpu.PopStructureEncapsulated, but with an additional check to ensure the value atop the stack isn't the arg bottom marker.
protected PopStructureAssertEncapsulated ( ICpu cpu, bool barewordOkay = false ) : Structure
cpu ICpu
barewordOkay bool
Результат Structure

PopValueAssert() защищенный Метод

A utility function that will do a cpu.PopValue, but with an additional check to ensure the value atop the stack isn't the arg bottom marker.
protected PopValueAssert ( ICpu cpu, bool barewordOkay = false ) : object
cpu ICpu
barewordOkay bool
Результат object

PopValueAssertEncapsulated() защищенный Метод

A utility function that will do the same as a cpu.PopValueEncapsulated, but with an additional check to ensure the value atop the stack isn't the arg bottom marker.
protected PopValueAssertEncapsulated ( ICpu cpu, bool barewordOkay = false ) : object
cpu ICpu
barewordOkay bool
Результат object

PopulateFromMLFields() публичный Метод

Starting from an empty instance of this opcode that you can assume was created from the default constructor, populate the Opcode's properties from a list of all the [MLFields] saved to the machine language file.
This needs to be overridden only if your Opcode has declared [MLField]'s. If your Opcode has no [MLFields] then the generic base version of this method works well enough.

TODO: Perhaps add an assert to the Init methods that will throw up a NagMessage if it detects an Opcode has be defined which has [MLFields] but lacks an override of this method.
public PopulateFromMLFields ( List fields ) : void
fields List A list of all the [MLFields] to populate the opcode with, /// given *IN ORDER* of their Ordering fields. This is important. If the /// opcode has 2 properties, one that was given attribute [MLField(10)] and the /// other that was given attribute [MLField(20)], then the one with ordering=10 /// will be the first one in this list, and the one with ordering=20 will be the /// second. You can process the list in the guaranteed assumption that the caller /// ordered the arguments this way.
/// NOTE: If the opcode has no MLField's attributes, then this may be passed in /// as null, rather than as a list of 0 items.
///
Результат void

ToString() публичный Метод

public ToString ( ) : string
Результат string

TypeFromCode() публичный статический Метод

Given a string value of Code, find the Opcode Type that uses that as its CodeName.
public static TypeFromCode ( ByteCode code ) : Type
code ByteCode ByteCode to look up
Результат System.Type

TypeFromName() публичный статический Метод

Given a string value of Name, find the Opcode Type that uses that as its Name.
public static TypeFromName ( string name ) : Type
name string name to look up
Результат System.Type

Описание свойств

SourcePath публичное свойство

public GlobalPath,kOS.Safe.Persistence SourcePath
Результат kOS.Safe.Persistence.GlobalPath