C# Class kOS.Safe.Execution.ProgramContext

Inheritance: IProgramContext
显示文件 Open project: KSP-KOS/KOS Class Usage Examples

Private Properties

Property Type Description
ProtectCSVField string
UpdateFileMap void
UpdateInstructionPointer void
UpdateProgram void

Public Methods

Method Description
ActivatePendingTriggers ( ) : void

Take all the pending triggers that have been added by AddPendingTrigger, and finally make them become active. To be called by the CPU when it decides that enough mainline code has had a chance to happen that it's okay to enable triggers again.

ActiveTriggerCount ( ) : int

How many triggers (active) there are.

AddObjectParts ( IEnumerable parts, string objectFileID ) : int
AddParts ( IEnumerable parts ) : void
AddPendingTrigger ( int instructionPointer ) : void

Add a trigger to the list of triggers pending insertion. It will not *finish* inserting it until the CPU tells us it's a good time to do so, by calling ActivatePendingTriggers(). It will also refuse to insert a trigger that's already either active or pending insertion to the active list (avoids duplication).

ClearTriggers ( ) : void

Remove all active and pending triggers.

ContainsTrigger ( int instructionPointer ) : bool

True if the given trigger's IP is for a trigger that is currently active, or is about to become active.

DisableActiveFlyByWire ( IBindingManager manager ) : void
EnableActiveFlyByWire ( IBindingManager manager ) : void
GetAlreadyCompiledEntryPoint ( string fileID ) : int

Return the entry point into the program context where this filename was already inserted into the system before. If it hasn't been inserted before, returns a negative number as a flag indicating this fact. fileID should be a string that will be fully unique for each file (the fully qualified path name, for example).

GetCodeFragment ( int contextLines ) : List
GetCodeFragment ( int start, int stop, bool doProfile = false ) : List
GetTriggerByIndex ( int index ) : int

Return the active trigger at the given index. Cannot be used to get pending insertion triggers.

ProgramContext ( bool interpreterContext ) : System
ProgramContext ( bool interpreterContext, List program ) : System
RemoveTrigger ( int instructionPointer ) : void

Remove a trigger from current triggers or pending insertion triggers or both if need be, so it's not there anymore at all.

ToggleFlyByWire ( string paramName, bool enabled ) : void

Private Methods

Method Description
ProtectCSVField ( string s ) : string

Return a version of the string that has been protected for use in a comma-separated file field by quoting and escaping as necessary any special characters inside it.

UpdateFileMap ( string fileID, int entryPoint ) : void
UpdateInstructionPointer ( List oldProgram ) : void
UpdateProgram ( List newProgram ) : void

Method Details

ActivatePendingTriggers() public method

Take all the pending triggers that have been added by AddPendingTrigger, and finally make them become active. To be called by the CPU when it decides that enough mainline code has had a chance to happen that it's okay to enable triggers again.
public ActivatePendingTriggers ( ) : void
return void

ActiveTriggerCount() public method

How many triggers (active) there are.
public ActiveTriggerCount ( ) : int
return int

AddObjectParts() public method

public AddObjectParts ( IEnumerable parts, string objectFileID ) : int
parts IEnumerable
objectFileID string
return int

AddParts() public method

public AddParts ( IEnumerable parts ) : void
parts IEnumerable
return void

AddPendingTrigger() public method

Add a trigger to the list of triggers pending insertion. It will not *finish* inserting it until the CPU tells us it's a good time to do so, by calling ActivatePendingTriggers(). It will also refuse to insert a trigger that's already either active or pending insertion to the active list (avoids duplication).
public AddPendingTrigger ( int instructionPointer ) : void
instructionPointer int
return void

ClearTriggers() public method

Remove all active and pending triggers.
public ClearTriggers ( ) : void
return void

ContainsTrigger() public method

True if the given trigger's IP is for a trigger that is currently active, or is about to become active.
public ContainsTrigger ( int instructionPointer ) : bool
instructionPointer int
return bool

DisableActiveFlyByWire() public method

public DisableActiveFlyByWire ( IBindingManager manager ) : void
manager IBindingManager
return void

EnableActiveFlyByWire() public method

public EnableActiveFlyByWire ( IBindingManager manager ) : void
manager IBindingManager
return void

GetAlreadyCompiledEntryPoint() public method

Return the entry point into the program context where this filename was already inserted into the system before. If it hasn't been inserted before, returns a negative number as a flag indicating this fact. fileID should be a string that will be fully unique for each file (the fully qualified path name, for example).
public GetAlreadyCompiledEntryPoint ( string fileID ) : int
fileID string
return int

GetCodeFragment() public method

public GetCodeFragment ( int contextLines ) : List
contextLines int
return List

GetCodeFragment() public method

public GetCodeFragment ( int start, int stop, bool doProfile = false ) : List
start int
stop int
doProfile bool
return List

GetTriggerByIndex() public method

Return the active trigger at the given index. Cannot be used to get pending insertion triggers.
public GetTriggerByIndex ( int index ) : int
index int
return int

ProgramContext() public method

public ProgramContext ( bool interpreterContext ) : System
interpreterContext bool
return System

ProgramContext() public method

public ProgramContext ( bool interpreterContext, List program ) : System
interpreterContext bool
program List
return System

RemoveTrigger() public method

Remove a trigger from current triggers or pending insertion triggers or both if need be, so it's not there anymore at all.
public RemoveTrigger ( int instructionPointer ) : void
instructionPointer int
return void

ToggleFlyByWire() public method

public ToggleFlyByWire ( string paramName, bool enabled ) : void
paramName string
enabled bool
return void