ScriptStack 1.0.5
Loading...
Searching...
No Matches
ScriptStack.Runtime.Executable Class Reference

Public Member Functions

 Executable (Script script)
bool FunctionExists (string function)

Properties

Script Script [get]
 Access the script from which the executable was created.
ReadOnlyCollection< InstructionRunnable [get]
Dictionary< String, FunctionFunctions [get]
Function MainFunction [get]
Memory ScriptMemory [get]

Private Member Functions

void Clean (Operand operand)

Private Attributes

Script script
List< Instructioninstructions
Dictionary< String, Functionfunctions
Memory scriptMemory

Detailed Description

Definition at line 14 of file Executable.cs.

Constructor & Destructor Documentation

◆ Executable()

ScriptStack.Runtime.Executable.Executable ( Script script)

Definition at line 103 of file Executable.cs.

103 {
104
105 this.script = script;
106
107 instructions = new List<Instruction>();
108
109 functions = new Dictionary<string, Function>();
110
111 scriptMemory = Memory.AllocateScriptMemory(script.Manager.SharedMemory);
112
113 }

References ScriptStack.Runtime.Memory.AllocateScriptMemory(), functions, instructions, Script, script, and scriptMemory.

Member Function Documentation

◆ Clean()

void ScriptStack.Runtime.Executable.Clean ( Operand operand)
private

Definition at line 28 of file Executable.cs.

29 {
30
31 if (operand == null)
32 return;
33
34 if (operand.Type != OperandType.InstructionPointer)
35 return;
36
37 Instruction instruction = operand.InstructionPointer;
38
39 if (instruction.OpCode != OpCode.NOP && instruction.OpCode != OpCode.DBG)
40 return;
41
42 Instruction nextInstruction = instruction;
43
44 while (nextInstruction.OpCode == OpCode.NOP || nextInstruction.OpCode == OpCode.DBG)
45 nextInstruction = instructions[(int)nextInstruction.Address + 1];
46
47 operand.InstructionPointer = nextInstruction;
48
49 }

References ScriptStack.Runtime.Instruction.Address, ScriptStack.Runtime.Operand.InstructionPointer, instructions, ScriptStack.Runtime.Instruction.OpCode, and ScriptStack.Runtime.Operand.Type.

◆ FunctionExists()

bool ScriptStack.Runtime.Executable.FunctionExists ( string function)

Definition at line 115 of file Executable.cs.

116 {
117
118 return functions.ContainsKey(function);
119
120 }

References functions.

Member Data Documentation

◆ functions

Dictionary<String, Function> ScriptStack.Runtime.Executable.functions
private

Definition at line 21 of file Executable.cs.

Referenced by Executable(), and FunctionExists().

◆ instructions

List<Instruction> ScriptStack.Runtime.Executable.instructions
private

Definition at line 20 of file Executable.cs.

Referenced by Clean(), and Executable().

◆ script

Script ScriptStack.Runtime.Executable.script
private

Definition at line 19 of file Executable.cs.

Referenced by Executable().

◆ scriptMemory

Memory ScriptStack.Runtime.Executable.scriptMemory
private

Definition at line 22 of file Executable.cs.

Referenced by Executable().

Property Documentation

◆ Functions

Dictionary<String, Function> ScriptStack.Runtime.Executable.Functions
get

Definition at line 139 of file Executable.cs.

140 {
141 get { return functions; }
142 }

◆ MainFunction

Function ScriptStack.Runtime.Executable.MainFunction
get

Definition at line 144 of file Executable.cs.

145 {
146
147 get
148 {
149
150 if (!functions.ContainsKey("main"))
151 throw new ParserException("Das Script hat keinen Einstiegspunkt.");
152
153 return functions["main"];
154
155 }
156
157 }

◆ Runnable

ReadOnlyCollection<Instruction> ScriptStack.Runtime.Executable.Runnable
get

Definition at line 134 of file Executable.cs.

135 {
136 get { return instructions.AsReadOnly(); }
137 }

◆ Script

Script ScriptStack.Runtime.Executable.Script
get

Access the script from which the executable was created.

Definition at line 129 of file Executable.cs.

130 {
131 get { return script; }
132 }

Referenced by Executable().

◆ ScriptMemory

Memory ScriptStack.Runtime.Executable.ScriptMemory
get

Definition at line 159 of file Executable.cs.

160 {
161 get { return scriptMemory; }
162 }

The documentation for this class was generated from the following file: