C# Class kOS.Safe.Compilation.Opcode

Afficher le fichier Open project: KSP-KOS/KOS

Méthodes publiques

Свойство Type Description
SourcePath kOS.Safe.Persistence.GlobalPath

Méthodes publiques

Méthode Description
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.

Méthodes protégées

Méthode Description
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.

Private Methods

Méthode Description
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.

Method Details

Execute() public méthode

public Execute ( ICpu cpu ) : void
cpu ICpu
Résultat void

GetArgumentDefs() public méthode

Return the list of member Properties that are part of what gets stored to machine langauge for this opcode.
public GetArgumentDefs ( ) : IEnumerable
Résultat IEnumerable

InitMachineCodeData() public static méthode

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
Résultat void

Opcode() protected méthode

protected Opcode ( ) : System
Résultat System

PopStructureAssertEncapsulated() protected méthode

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
Résultat Structure

PopValueAssert() protected méthode

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
Résultat object

PopValueAssertEncapsulated() protected méthode

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
Résultat object

PopulateFromMLFields() public méthode

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.
///
Résultat void

ToString() public méthode

public ToString ( ) : string
Résultat string

TypeFromCode() public static méthode

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
Résultat System.Type

TypeFromName() public static méthode

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
Résultat System.Type

Property Details

SourcePath public_oe property

public GlobalPath,kOS.Safe.Persistence SourcePath
Résultat kOS.Safe.Persistence.GlobalPath