ScriptStack 1.0.0
A .NET scripting language
Lade ...
Suche ...
Keine Treffer
ScriptStack.Runtime.Instruction Klassenreferenz

An instruction in a virtual intermediate language. Mehr ...

Öffentliche Methoden

 Instruction (OpCode opcode, Operand first, Operand second)
 
 Instruction (OpCode opcode, Operand operand0)
 
 Instruction (OpCode opcode)
 
override string ToString ()
 

Propertys

uint Address [get, set]
 
OpCode OpCode [get, set]
 
Operand First [get, set]
 
Operand Second [get, set]
 

Private Methoden

string ToLiteral (string input)
 

Private Attribute

uint address
 
OpCode opcode
 
Operand first
 
Operand second
 

Ausführliche Beschreibung

An instruction in a virtual intermediate language.

Beschreibung der Konstruktoren und Destruktoren

◆ Instruction() [1/3]

ScriptStack.Runtime.Instruction.Instruction ( OpCode opcode,
Operand first,
Operand second )
66 {
67 address = 0;
68 this.opcode = opcode;
69 this.first = first;
70 this.second = second;
71 }
uint address
Definition Instruction.cs:16
OpCode opcode
Definition Instruction.cs:17
Operand second
Definition Instruction.cs:19
Operand first
Definition Instruction.cs:18

Benutzt ScriptStack.Runtime.Instruction.address, ScriptStack.Runtime.Instruction.first, ScriptStack.Runtime.Instruction.opcode und ScriptStack.Runtime.Instruction.second.

◆ Instruction() [2/3]

ScriptStack.Runtime.Instruction.Instruction ( OpCode opcode,
Operand operand0 )
74 : this(opcode, operand0, null)
75 {
76 }

◆ Instruction() [3/3]

ScriptStack.Runtime.Instruction.Instruction ( OpCode opcode)
79 : this(opcode, null, null)
80 {
81 }

Dokumentation der Elementfunktionen

◆ ToLiteral()

string ScriptStack.Runtime.Instruction.ToLiteral ( string input)
private
26 {
27 var literal = new StringBuilder(input.Length + 2);
28 //literal.Append("\"");
29 foreach (var c in input)
30 {
31 switch (c)
32 {
33 case '\'': literal.Append(@"\'"); break;
34 case '\"': literal.Append("\\\""); break;
35 case '\\': literal.Append(@"\\"); break;
36 case '\0': literal.Append(@"\0"); break;
37 case '\a': literal.Append(@"\a"); break;
38 case '\b': literal.Append(@"\b"); break;
39 case '\f': literal.Append(@"\f"); break;
40 case '\n': literal.Append(@"\n"); break;
41 case '\r': literal.Append(@"\r"); break;
42 case '\t': literal.Append(@"\t"); break;
43 case '\v': literal.Append(@"\v"); break;
44 default:
45 if (Char.GetUnicodeCategory(c) != System.Globalization.UnicodeCategory.Control)
46 {
47 literal.Append(c);
48 }
49 else
50 {
51 literal.Append(@"\u");
52 literal.Append(((ushort)c).ToString("x4"));
53 }
54 break;
55 }
56 }
57 //literal.Append("\"");
58 return literal.ToString();
59 }
override string ToString()
Definition Instruction.cs:83

Benutzt ScriptStack.Runtime.Instruction.ToString().

◆ ToString()

override string ScriptStack.Runtime.Instruction.ToString ( )
84 {
85
86 if (opcode == OpCode.DBG)
87 {
88
89 int lineNumber = (int)first.Value;
90 return "Verarbeite Zeile: " + lineNumber + "\n" + second.Value;
91
92 }
93
94 StringBuilder stringBuilder = new StringBuilder();
95
96 stringBuilder.Append("["+string.Format(address.ToString("X8"))+"]");
97 stringBuilder.Append(" ");
98
99 stringBuilder.Append(opcode.ToString());
100 int iOpcodeLength = opcode.ToString().Length;
101 if (iOpcodeLength == 2)
102 stringBuilder.Append(" ");
103 if (iOpcodeLength == 3)
104 stringBuilder.Append(" ");
105
106 if (first != null)
107 {
108 stringBuilder.Append(" ");
109 stringBuilder.Append(first.ToString());
110 }
111
112 if (second != null)
113 {
114 stringBuilder.Append(", ");
115 stringBuilder.Append(second.ToString());
116 }
117
118 return stringBuilder.ToString();
119 }
OpCode OpCode
Definition Instruction.cs:132
object Value
Definition Operand.cs:205
string ToString(object objectValue)
Definition Operand.cs:42

Benutzt ScriptStack.Runtime.Instruction.address, ScriptStack.Runtime.Instruction.first, ScriptStack.Runtime.Instruction.opcode, ScriptStack.Runtime.Instruction.second, ScriptStack.Runtime.Operand.ToString() und ScriptStack.Runtime.Operand.Value.

Wird benutzt von ScriptStack.Runtime.Instruction.ToLiteral().

Dokumentation der Datenelemente

◆ address

uint ScriptStack.Runtime.Instruction.address
private

◆ first

Operand ScriptStack.Runtime.Instruction.first
private

◆ opcode

OpCode ScriptStack.Runtime.Instruction.opcode
private

◆ second

Operand ScriptStack.Runtime.Instruction.second
private

Dokumentation der Propertys

◆ Address

◆ First

◆ OpCode

◆ Second


Die Dokumentation für diese Klasse wurde erzeugt aufgrund der Datei: