A variable consists of ...
DefineVariable("...") is the same as: Define("Variable: x")
Dim VariableX = uc.DefineVariable("x")
Dim Expression As string
Console.Write("Enter an expression (Ex: x^2 * 10): ")
Expression = Console.ReadLine()
Dim ParsedExpr = uc.Parse(Expression)
Dim x As double
for x = 1 To 10
VariableX.SetVariableValue(x)
Console.WriteLine("x = " + x + " Result = " + ParsedExpr.Evaluate())
Next
' Output
' x = 1 Result = 10
' x = 2 Result = 40
' x = 3 Result = 90
' x = 4 Result = 160
' x = 5 Result = 250
' x = 6 Result = 360
' x = 7 Result = 490
' x = 8 Result = 640
' x = 9 Result = 810
' x = 10 Result = 1000
ParsedExpr.Release()
VariableX.Release()
var VariableX = uc.DefineVariable("x");
string Expression;
Console.Write("Enter an expression (Ex: x^2 * 10): ");
Expression = Console.ReadLine();
var ParsedExpr = uc.Parse(Expression);
for (double x = 1; x <= 10; x = x + 1) {
VariableX.SetVariableValue(x);
Console.WriteLine("x = " + x + " Result = " + ParsedExpr.Evaluate());
}
// Output
// x = 1 Result = 10
// x = 2 Result = 40
// x = 3 Result = 90
// x = 4 Result = 160
// x = 5 Result = 250
// x = 6 Result = 360
// x = 7 Result = 490
// x = 8 Result = 640
// x = 9 Result = 810
// x = 10 Result = 1000
ParsedExpr.Release();
VariableX.Release();
//var VariableX = uc.DefineVariable('x');
Write('Enter an expression (Ex: x^2 * 10): ')
Expression = ReadLn();
//var ParsedExpr = uc.Parse(Expression);
for x := 1 to 10 do
begin
VariableX.SetVariableValue(x);
WriteLn('x = ' + x + ' Result = ' + ParsedExpr.Evaluate());
End;
// Output
// x = 1 Result = 10
// x = 2 Result = 40
// x = 3 Result = 90
// x = 4 Result = 160
// x = 5 Result = 250
// x = 6 Result = 360
// x = 7 Result = 490
// x = 8 Result = 640
// x = 9 Result = 810
// x = 10 Result = 1000
ParsedExpr.Release();
VariableX.Release();
auto VariableX = uc.DefineVariable("x");
string Expression;
cout << "Enter an expression (Ex: x^2 * 10): " << endl;
cin >> Expression; // Ex: x^2 * 10
auto ParsedExpr = uc.Parse(Expression);
for (double x = 1; x <= 10; x = x + 1) {
VariableX.SetVariableValue(x);
cout << "x = " << x << " Result = " << ParsedExpr.Evaluate() << endl;
}
// Output
// x = 1 Result = 10
// x = 2 Result = 40
// x = 3 Result = 90
// x = 4 Result = 160
// x = 5 Result = 250
// x = 6 Result = 360
// x = 7 Result = 490
// x = 8 Result = 640
// x = 9 Result = 810
// x = 10 Result = 1000
ParsedExpr.Release();
VariableX.Release();
auto VariableX = uc.DefineVariable("x");
string ^ Expression;
Console::Write("Enter an expression (Ex: x^2 * 10): ");
Expression = Console::ReadLine();
auto ParsedExpr = uc.Parse(Expression);
for (double x = 1; x <= 10; x = x + 1) {
VariableX.SetVariableValue(x);
Console::WriteLine("x = " + x + " Result = " + ParsedExpr.Evaluate());
}
// Output
// x = 1 Result = 10
// x = 2 Result = 40
// x = 3 Result = 90
// x = 4 Result = 160
// x = 5 Result = 250
// x = 6 Result = 360
// x = 7 Result = 490
// x = 8 Result = 640
// x = 9 Result = 810
// x = 10 Result = 1000
ParsedExpr.Release();
VariableX.Release();
Dim Int32Var = uc.DefineVariable("Int32Var As Int32")
Dim ByteVar = uc.DefineVariable("ByteVar As Byte")
Dim StrVar = uc.DefineVariable("StrVar As String")
Dim SngVar = uc.DefineVariable("SngVar As Single")
Int32Var.SetVariableValueAny("4.25"): ' Will be converted to integer
ByteVar.SetVariableValueAny("-1"): ' Will be converted to unsigned byte
StrVar.SetVariableValueAny("'Test'")
SngVar.SetVariableValueAny("1.25")
Console.WriteLine(uc.Eval("Int32Var")) ' Returns 4
Console.WriteLine(uc.Eval("ByteVar")) ' Returns 255
Console.WriteLine(uc.EvalStr("StrVar")) ' Returns "Test"
Console.WriteLine(uc.EvalStr("SngVar")) ' Returns 1.25
var Int32Var = uc.DefineVariable("Int32Var As Int32");
var ByteVar = uc.DefineVariable("ByteVar As Byte");
var StrVar = uc.DefineVariable("StrVar As String");
var SngVar = uc.DefineVariable("SngVar As Single");
Int32Var.SetVariableValueAny("4.25"); // Will be converted to integer
ByteVar.SetVariableValueAny("-1"); // Will be converted to unsigned byte
StrVar.SetVariableValueAny("'Test'");
SngVar.SetVariableValueAny("1.25");
Console.WriteLine(uc.Eval("Int32Var")); // Returns 4;
Console.WriteLine(uc.Eval("ByteVar")); // Returns 255;
Console.WriteLine(uc.EvalStr("StrVar")); // Returns "Test";
Console.WriteLine(uc.EvalStr("SngVar")); // Returns 1.25;
//var Int32Var = uc.DefineVariable('Int32Var As Int32');
//var ByteVar = uc.DefineVariable('ByteVar As Byte');
//var StrVar = uc.DefineVariable('StrVar As String');
//var SngVar = uc.DefineVariable('SngVar As Single');
Int32Var.SetVariableValueAny('4.25'); // Will be converted to integer
ByteVar.SetVariableValueAny('-1'); // Will be converted to unsigned byte
StrVar.SetVariableValueAny('"Test"');
SngVar.SetVariableValueAny('1.25');
WriteLn(uc.Eval('Int32Var')); // Returns 4;
WriteLn(uc.Eval('ByteVar')); // Returns 255;
WriteLn(uc.EvalStr('StrVar')); // Returns 'Test';
WriteLn(uc.EvalStr('SngVar')); // Returns 1.25;
auto Int32Var = uc.DefineVariable("Int32Var As Int32");
auto ByteVar = uc.DefineVariable("ByteVar As Byte");
auto StrVar = uc.DefineVariable("StrVar As String");
auto SngVar = uc.DefineVariable("SngVar As Single");
Int32Var.SetVariableValueAny("4.25"); // Will be converted to integer
ByteVar.SetVariableValueAny("-1"); // Will be converted to unsigned byte
StrVar.SetVariableValueAny("'Test'");
SngVar.SetVariableValueAny("1.25");
cout << uc.Eval("Int32Var") << endl; // Returns 4;
cout << uc.Eval("ByteVar") << endl; // Returns 255;
cout << uc.EvalStr("StrVar") << endl; // Returns "Test";
cout << uc.EvalStr("SngVar") << endl; // Returns 1.25;
auto Int32Var = uc.DefineVariable("Int32Var As Int32");
auto ByteVar = uc.DefineVariable("ByteVar As Byte");
auto StrVar = uc.DefineVariable("StrVar As String");
auto SngVar = uc.DefineVariable("SngVar As Single");
Int32Var.SetVariableValueAny("4.25"); // Will be converted to integer
ByteVar.SetVariableValueAny("-1"); // Will be converted to unsigned byte
StrVar.SetVariableValueAny("'Test'");
SngVar.SetVariableValueAny("1.25");
Console::WriteLine(uc.Eval("Int32Var")); // Returns 4;
Console::WriteLine(uc.Eval("ByteVar")); // Returns 255;
Console::WriteLine(uc.EvalStr("StrVar")); // Returns "Test";
Console::WriteLine(uc.EvalStr("SngVar")); // Returns 1.25;
Dim var = uc.DefineVariable("Var")
Dim ByteVar = uc.DefineVariable("ByteVar As Int8")
Dim Int16uVar = uc.DefineVariable("Int16uVar As Int16u")
Dim Int32uVar = uc.DefineVariable("Int32uVar As Int32u")
Dim Int64uVar = uc.DefineVariable("Int64uVar As Int64u")
Dim SingleVar = uc.DefineVariable("SingleVar As Single")
Dim DoubleVar = uc.DefineVariable("DoubleVar As Double")
Dim StringVar = uc.DefineVariable("StringVar As String")
var.SetVariableValue(1.25)
ByteVar.SetVariableValueByte(255)
Int16uVar.SetVariableValueInt16(-1)
Int32uVar.SetVariableValueInt32(-1)
Int64uVar.SetVariableValueInt64(-1)
SingleVar.SetVariableValueSng(1.5)
DoubleVar.SetVariableValueDbl(2.5)
StringVar.SetVariableValueStr("Test")
Console.WriteLine("Var value: " + uc.EvalStr("Var")) ' Returns "Var value: 1.25"
Console.WriteLine("ByteVar value: " + uc.EvalStr("ByteVar")) ' Returns "ByteVar value: -1"
Console.WriteLine("Int16uVar value: " + uc.EvalStr("Int16uVar")) ' Returns "Int16uVar value: 65535"
Console.WriteLine("Int32uVar value: " + uc.EvalStr("Int32uVar")) ' Returns "Int32uVar value: 4294967295"
Console.WriteLine("Int64uVar value: " + uc.EvalStr("Int64uVar")) ' Returns "Int64uVar value: 18446744073709551615"
Console.WriteLine("SingleVar value: " + uc.EvalStr("SingleVar")) ' Returns "SingleVar value: 1.5"
Console.WriteLine("DoubleVar value: " + uc.EvalStr("DoubleVar")) ' Returns "DoubleVar value: 2.5"
Console.WriteLine("StringVar value: " + uc.EvalStr("StringVar")) ' Returns "StringVar value: Test"
var var = uc.DefineVariable("Var");
var ByteVar = uc.DefineVariable("ByteVar As Int8");
var Int16uVar = uc.DefineVariable("Int16uVar As Int16u");
var Int32uVar = uc.DefineVariable("Int32uVar As Int32u");
var Int64uVar = uc.DefineVariable("Int64uVar As Int64u");
var SingleVar = uc.DefineVariable("SingleVar As Single");
var DoubleVar = uc.DefineVariable("DoubleVar As Double");
var StringVar = uc.DefineVariable("StringVar As String");
var.SetVariableValue(1.25);
ByteVar.SetVariableValueByte(255);
Int16uVar.SetVariableValueInt16(-1);
Int32uVar.SetVariableValueInt32(-1);
Int64uVar.SetVariableValueInt64(-1);
SingleVar.SetVariableValueSng((float)1.5);
DoubleVar.SetVariableValueDbl(2.5);
StringVar.SetVariableValueStr("Test");
Console.WriteLine("Var value: " + uc.EvalStr("Var")); // Returns "Var value: 1.25";
Console.WriteLine("ByteVar value: " + uc.EvalStr("ByteVar")); // Returns "ByteVar value: -1";
Console.WriteLine("Int16uVar value: " + uc.EvalStr("Int16uVar")); // Returns "Int16uVar value: 65535";
Console.WriteLine("Int32uVar value: " + uc.EvalStr("Int32uVar")); // Returns "Int32uVar value: 4294967295";
Console.WriteLine("Int64uVar value: " + uc.EvalStr("Int64uVar")); // Returns "Int64uVar value: 18446744073709551615";
Console.WriteLine("SingleVar value: " + uc.EvalStr("SingleVar")); // Returns "SingleVar value: 1.5";
Console.WriteLine("DoubleVar value: " + uc.EvalStr("DoubleVar")); // Returns "DoubleVar value: 2.5";
Console.WriteLine("StringVar value: " + uc.EvalStr("StringVar")); // Returns "StringVar value: Test";
//var Var = uc.DefineVariable('Var');
//var ByteVar = uc.DefineVariable('ByteVar As Int8');
//var Int16uVar = uc.DefineVariable('Int16uVar As Int16u');
//var Int32uVar = uc.DefineVariable('Int32uVar As Int32u');
//var Int64uVar = uc.DefineVariable('Int64uVar As Int64u');
//var SingleVar = uc.DefineVariable('SingleVar As Single');
//var DoubleVar = uc.DefineVariable('DoubleVar As Double');
//var StringVar = uc.DefineVariable('StringVar As String');
var.SetVariableValue(1.25);
ByteVar.SetVariableValueByte(255);
Int16uVar.SetVariableValueInt16(-1);
Int32uVar.SetVariableValueInt32(-1);
Int64uVar.SetVariableValueInt64(-1);
SingleVar.SetVariableValueSng(1.5);
DoubleVar.SetVariableValueDbl(2.5);
StringVar.SetVariableValueStr('Test');
WriteLn('Var value: ' + uc.EvalStr('Var')); // Returns 'Var value: 1.25';
WriteLn('ByteVar value: ' + uc.EvalStr('ByteVar')); // Returns 'ByteVar value: -1';
WriteLn('Int16uVar value: ' + uc.EvalStr('Int16uVar')); // Returns 'Int16uVar value: 65535';
WriteLn('Int32uVar value: ' + uc.EvalStr('Int32uVar')); // Returns 'Int32uVar value: 4294967295';
WriteLn('Int64uVar value: ' + uc.EvalStr('Int64uVar')); // Returns 'Int64uVar value: 18446744073709551615';
WriteLn('SingleVar value: ' + uc.EvalStr('SingleVar')); // Returns 'SingleVar value: 1.5';
WriteLn('DoubleVar value: ' + uc.EvalStr('DoubleVar')); // Returns 'DoubleVar value: 2.5';
WriteLn('StringVar value: ' + uc.EvalStr('StringVar')); // Returns 'StringVar value: Test';
auto var = uc.DefineVariable("Var");
auto ByteVar = uc.DefineVariable("ByteVar As Int8");
auto Int16uVar = uc.DefineVariable("Int16uVar As Int16u");
auto Int32uVar = uc.DefineVariable("Int32uVar As Int32u");
auto Int64uVar = uc.DefineVariable("Int64uVar As Int64u");
auto SingleVar = uc.DefineVariable("SingleVar As Single");
auto DoubleVar = uc.DefineVariable("DoubleVar As Double");
auto StringVar = uc.DefineVariable("StringVar As String");
var.SetVariableValue(1.25);
ByteVar.SetVariableValueByte(255);
Int16uVar.SetVariableValueInt16(-1);
Int32uVar.SetVariableValueInt32(-1);
Int64uVar.SetVariableValueInt64(-1);
SingleVar.SetVariableValueSng((float)1.5);
DoubleVar.SetVariableValueDbl(2.5);
StringVar.SetVariableValueStr("Test");
cout << "Var value: " << uc.EvalStr("Var") << endl; // Returns "Var value: 1.25";
cout << "ByteVar value: " << uc.EvalStr("ByteVar") << endl; // Returns "ByteVar value: -1";
cout << "Int16uVar value: " << uc.EvalStr("Int16uVar") << endl; // Returns "Int16uVar value: 65535";
cout << "Int32uVar value: " << uc.EvalStr("Int32uVar") << endl; // Returns "Int32uVar value: 4294967295";
cout << "Int64uVar value: " << uc.EvalStr("Int64uVar") << endl; // Returns "Int64uVar value: 18446744073709551615";
cout << "SingleVar value: " << uc.EvalStr("SingleVar") << endl; // Returns "SingleVar value: 1.5";
cout << "DoubleVar value: " << uc.EvalStr("DoubleVar") << endl; // Returns "DoubleVar value: 2.5";
cout << "StringVar value: " << uc.EvalStr("StringVar") << endl; // Returns "StringVar value: Test";
auto var = uc.DefineVariable("Var");
auto ByteVar = uc.DefineVariable("ByteVar As Int8");
auto Int16uVar = uc.DefineVariable("Int16uVar As Int16u");
auto Int32uVar = uc.DefineVariable("Int32uVar As Int32u");
auto Int64uVar = uc.DefineVariable("Int64uVar As Int64u");
auto SingleVar = uc.DefineVariable("SingleVar As Single");
auto DoubleVar = uc.DefineVariable("DoubleVar As Double");
auto StringVar = uc.DefineVariable("StringVar As String");
var.SetVariableValue(1.25);
ByteVar.SetVariableValueByte(255);
Int16uVar.SetVariableValueInt16(-1);
Int32uVar.SetVariableValueInt32(-1);
Int64uVar.SetVariableValueInt64(-1);
SingleVar.SetVariableValueSng((float)1.5);
DoubleVar.SetVariableValueDbl(2.5);
StringVar.SetVariableValueStr("Test");
Console::WriteLine("Var value: " + uc.EvalStr("Var")); // Returns "Var value: 1.25";
Console::WriteLine("ByteVar value: " + uc.EvalStr("ByteVar")); // Returns "ByteVar value: -1";
Console::WriteLine("Int16uVar value: " + uc.EvalStr("Int16uVar")); // Returns "Int16uVar value: 65535";
Console::WriteLine("Int32uVar value: " + uc.EvalStr("Int32uVar")); // Returns "Int32uVar value: 4294967295";
Console::WriteLine("Int64uVar value: " + uc.EvalStr("Int64uVar")); // Returns "Int64uVar value: 18446744073709551615";
Console::WriteLine("SingleVar value: " + uc.EvalStr("SingleVar")); // Returns "SingleVar value: 1.5";
Console::WriteLine("DoubleVar value: " + uc.EvalStr("DoubleVar")); // Returns "DoubleVar value: 2.5";
Console::WriteLine("StringVar value: " + uc.EvalStr("StringVar")); // Returns "StringVar value: Test";
Dim x = uc.DefineVariable("x As Int16 = -1")
Dim MyPointer = uc.DefineVariable("xPtr As Pointer")
MyPointer.SetVariableValuePtr(x.ValueAddr())
Console.WriteLine(uc.EvalStr("ValueAt(Int16u, xPtr)")) ' Returns 65535
var x = uc.DefineVariable("x As Int16 = -1");
var MyPointer = uc.DefineVariable("xPtr As Pointer");
MyPointer.SetVariableValuePtr(x.ValueAddr());
Console.WriteLine(uc.EvalStr("ValueAt(Int16u, xPtr)")); // Returns 65535;
//var x = uc.DefineVariable('x As Int16 = -1');
//var MyPointer = uc.DefineVariable('xPtr As Pointer');
MyPointer.SetVariableValuePtr(x.ValueAddr());
WriteLn(uc.EvalStr('ValueAt(Int16u, xPtr)')); // Returns 65535;
auto x = uc.DefineVariable("x As Int16 = -1");
auto MyPointer = uc.DefineVariable("xPtr As Pointer");
MyPointer.SetVariableValuePtr(x.ValueAddr());
cout << uc.EvalStr("ValueAt(Int16u, xPtr)") << endl; // Returns 65535;
auto x = uc.DefineVariable("x As Int16 = -1");
auto MyPointer = uc.DefineVariable("xPtr As Pointer");
MyPointer.SetVariableValuePtr(x.ValueAddr());
Console::WriteLine(uc.EvalStr("ValueAt(Int16u, xPtr)")); // Returns 65535;
Dim x = uc.DefineVariable("x = 123")
Dim y = uc.DefineVariable("y")
y.SetVariableValueByPtr(x.ValueAddr())
Console.WriteLine(uc.Eval("x")) ' Returns 123
var x = uc.DefineVariable("x = 123");
var y = uc.DefineVariable("y");
y.SetVariableValueByPtr(x.ValueAddr());
Console.WriteLine(uc.Eval("x")); // Returns 123;
//var x = uc.DefineVariable('x = 123');
//var y = uc.DefineVariable('y');
y.SetVariableValueByPtr(x.ValueAddr());
WriteLn(uc.Eval('x')); // Returns 123;
auto x = uc.DefineVariable("x = 123");
auto y = uc.DefineVariable("y");
y.SetVariableValueByPtr(x.ValueAddr());
cout << uc.Eval("x") << endl; // Returns 123;
auto x = uc.DefineVariable("x = 123");
auto y = uc.DefineVariable("y");
y.SetVariableValueByPtr(x.ValueAddr());
Console::WriteLine(uc.Eval("x")); // Returns 123;
Dim var = uc.DefineVariable("Var = 1.25")
Dim ByteVar = uc.DefineVariable("ByteVar As Byte = -1")
Dim Int16Var = uc.DefineVariable("Int16Var As Int16 = 456")
Dim Int32Var = uc.DefineVariable("Int32Var As Int32 = Int16u(-1)")
Dim Int64Var = uc.DefineVariable("Int64Var = Int64(55.2)")
Dim SingleVar = uc.DefineVariable("SingleVar As Single = Single(1.0000000001)-1")
Dim DoubleVar = uc.DefineVariable("DoubleVar As Double = Double(1.0000000001)-1")
Dim StringVar = uc.DefineVariable("StringVar = 'Just a test'"): ' Defaults to string when there are quotes
Dim PointerVar = uc.DefineVariable("PtrVar As Double Ptr = AddressOf(DoubleVar)")
Console.WriteLine("Var value: " + var.Value()) ' Returns "Var value: 1.25"
Console.WriteLine("ByteVar value: " + CInt(ByteVar.ValueByte())) ' Returns "ByteVar value: 255"
Console.WriteLine("Int16Var value: " + Int16Var.ValueInt16()) ' Returns "Int16Var value: 456"
Console.WriteLine("Int32Var value: " + Int32Var.ValueInt32()) ' Returns "Int32Var value: 65535"
Console.WriteLine("Int64Var value: " + Int64Var.ValueInt64()) ' Returns "Int64Var value: 55"
Console.WriteLine("SingleVar value: " + SingleVar.ValueSng()) ' Returns "SingleVar value: 0"
Console.WriteLine("DoubleVar value: " + DoubleVar.ValueDbl()) ' Returns "DoubleVar value: 1e-10"
Console.WriteLine("StringVar value: " + StringVar.ValueStr()) ' Returns "StringVar value: Just a test"
' The values in the two lines below should match although their specific value is not known beforehand
Console.Write("PointerVar value: "): Console.WriteLine(PointerVar.ValuePtr())
Console.Write("DoubleVar address: "): Console.WriteLine(DoubleVar.ValueAddr())
Console.WriteLine(PointerVar.ValuePtr())
var var = uc.DefineVariable("Var = 1.25");
var ByteVar = uc.DefineVariable("ByteVar As Byte = -1");
var Int16Var = uc.DefineVariable("Int16Var As Int16 = 456");
var Int32Var = uc.DefineVariable("Int32Var As Int32 = Int16u(-1)");
var Int64Var = uc.DefineVariable("Int64Var = Int64(55.2)");
var SingleVar = uc.DefineVariable("SingleVar As Single = Single(1.0000000001)-1");
var DoubleVar = uc.DefineVariable("DoubleVar As Double = Double(1.0000000001)-1");
var StringVar = uc.DefineVariable("StringVar = 'Just a test'"); // Defaults to string when there are quotes
var PointerVar = uc.DefineVariable("PtrVar As Double Ptr = AddressOf(DoubleVar)");
Console.WriteLine("Var value: " + var.Value()); // Returns "Var value: 1.25";
Console.WriteLine("ByteVar value: " + (int)ByteVar.ValueByte()); // Returns "ByteVar value: 255";
Console.WriteLine("Int16Var value: " + Int16Var.ValueInt16()); // Returns "Int16Var value: 456";
Console.WriteLine("Int32Var value: " + Int32Var.ValueInt32()); // Returns "Int32Var value: 65535";
Console.WriteLine("Int64Var value: " + Int64Var.ValueInt64()); // Returns "Int64Var value: 55";
Console.WriteLine("SingleVar value: " + SingleVar.ValueSng()); // Returns "SingleVar value: 0";
Console.WriteLine("DoubleVar value: " + DoubleVar.ValueDbl()); // Returns "DoubleVar value: 1e-10";
Console.WriteLine("StringVar value: " + StringVar.ValueStr()); // Returns "StringVar value: Just a test";
// The values in the two lines below should match although their specific value is not known beforehand
Console.Write("PointerVar value: "); Console.WriteLine(PointerVar.ValuePtr());
Console.Write("DoubleVar address: "); Console.WriteLine(DoubleVar.ValueAddr());
Console.WriteLine(PointerVar.ValuePtr());
//var Var = uc.DefineVariable('Var = 1.25');
//var ByteVar = uc.DefineVariable('ByteVar As Byte = -1');
//var Int16Var = uc.DefineVariable('Int16Var As Int16 = 456');
//var Int32Var = uc.DefineVariable('Int32Var As Int32 = Int16u(-1)');
//var Int64Var = uc.DefineVariable('Int64Var = Int64(55.2)');
//var SingleVar = uc.DefineVariable('SingleVar As Single = Single(1.0000000001)-1');
//var DoubleVar = uc.DefineVariable('DoubleVar As Double = Double(1.0000000001)-1');
//var StringVar = uc.DefineVariable('StringVar = "Just a test"'); // Defaults to string when there are quotes
//var PointerVar = uc.DefineVariable('PtrVar As Double Ptr = AddressOf(DoubleVar)');
WriteLn('Var value: ' + var.Value()); // Returns 'Var value: 1.25';
WriteLn('ByteVar value: ' + CInt(ByteVar.ValueByte())); // Returns 'ByteVar value: 255';
WriteLn('Int16Var value: ' + Int16Var.ValueInt16()); // Returns 'Int16Var value: 456';
WriteLn('Int32Var value: ' + Int32Var.ValueInt32()); // Returns 'Int32Var value: 65535';
WriteLn('Int64Var value: ' + Int64Var.ValueInt64()); // Returns 'Int64Var value: 55';
WriteLn('SingleVar value: ' + SingleVar.ValueSng()); // Returns 'SingleVar value: 0';
WriteLn('DoubleVar value: ' + DoubleVar.ValueDbl()); // Returns 'DoubleVar value: 1e-10';
WriteLn('StringVar value: ' + StringVar.ValueStr()); // Returns 'StringVar value: Just a test';
// The values in the two lines below should match although their specific value is not known beforehand
Write('PointerVar value: '); WriteLn(PointerVar.ValuePtr());
Write('DoubleVar address: '); WriteLn(DoubleVar.ValueAddr());
WriteLn(PointerVar.ValuePtr());
auto var = uc.DefineVariable("Var = 1.25");
auto ByteVar = uc.DefineVariable("ByteVar As Byte = -1");
auto Int16Var = uc.DefineVariable("Int16Var As Int16 = 456");
auto Int32Var = uc.DefineVariable("Int32Var As Int32 = Int16u(-1)");
auto Int64Var = uc.DefineVariable("Int64Var = Int64(55.2)");
auto SingleVar = uc.DefineVariable("SingleVar As Single = Single(1.0000000001)-1");
auto DoubleVar = uc.DefineVariable("DoubleVar As Double = Double(1.0000000001)-1");
auto StringVar = uc.DefineVariable("StringVar = 'Just a test'"); // Defaults to string when there are quotes
auto PointerVar = uc.DefineVariable("PtrVar As Double Ptr = AddressOf(DoubleVar)");
cout << "Var value: " << var.Value() << endl; // Returns "Var value: 1.25";
cout << "ByteVar value: " << (int)ByteVar.ValueByte() << endl; // Returns "ByteVar value: 255";
cout << "Int16Var value: " << Int16Var.ValueInt16() << endl; // Returns "Int16Var value: 456";
cout << "Int32Var value: " << Int32Var.ValueInt32() << endl; // Returns "Int32Var value: 65535";
cout << "Int64Var value: " << Int64Var.ValueInt64() << endl; // Returns "Int64Var value: 55";
cout << "SingleVar value: " << SingleVar.ValueSng() << endl; // Returns "SingleVar value: 0";
cout << "DoubleVar value: " << DoubleVar.ValueDbl() << endl; // Returns "DoubleVar value: 1e-10";
cout << "StringVar value: " << StringVar.ValueStr() << endl; // Returns "StringVar value: Just a test";
// The values in the two lines below should match although their specific value is not known beforehand
cout << "PointerVar value: "; cout << PointerVar.ValuePtr() << endl;
cout << "DoubleVar address: "; cout << DoubleVar.ValueAddr() << endl;
cout << PointerVar.ValuePtr() << endl;
auto var = uc.DefineVariable("Var = 1.25");
auto ByteVar = uc.DefineVariable("ByteVar As Byte = -1");
auto Int16Var = uc.DefineVariable("Int16Var As Int16 = 456");
auto Int32Var = uc.DefineVariable("Int32Var As Int32 = Int16u(-1)");
auto Int64Var = uc.DefineVariable("Int64Var = Int64(55.2)");
auto SingleVar = uc.DefineVariable("SingleVar As Single = Single(1.0000000001)-1");
auto DoubleVar = uc.DefineVariable("DoubleVar As Double = Double(1.0000000001)-1");
auto StringVar = uc.DefineVariable("StringVar = 'Just a test'"); // Defaults to string when there are quotes
auto PointerVar = uc.DefineVariable("PtrVar As Double Ptr = AddressOf(DoubleVar)");
Console::WriteLine("Var value: " + var.Value()); // Returns "Var value: 1.25";
Console::WriteLine("ByteVar value: " + (int)ByteVar.ValueByte()); // Returns "ByteVar value: 255";
Console::WriteLine("Int16Var value: " + Int16Var.ValueInt16()); // Returns "Int16Var value: 456";
Console::WriteLine("Int32Var value: " + Int32Var.ValueInt32()); // Returns "Int32Var value: 65535";
Console::WriteLine("Int64Var value: " + Int64Var.ValueInt64()); // Returns "Int64Var value: 55";
Console::WriteLine("SingleVar value: " + SingleVar.ValueSng()); // Returns "SingleVar value: 0";
Console::WriteLine("DoubleVar value: " + DoubleVar.ValueDbl()); // Returns "DoubleVar value: 1e-10";
Console::WriteLine("StringVar value: " + StringVar.ValueStr()); // Returns "StringVar value: Just a test";
// The values in the two lines below should match although their specific value is not known beforehand
Console::Write("PointerVar value: "); Console::WriteLine(PointerVar.ValuePtr());
Console::Write("DoubleVar address: "); Console::WriteLine(DoubleVar.ValueAddr());
Console::WriteLine(PointerVar.ValuePtr());
<DllImport(uCalcDLL, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="DefineVariable")> _
Private Function DefineVariable__(ByVal uCalcHandle As IntPtr,ByVal Definition As String , ByVal VariableAddress As IntPtr ) As IntPtr
End Function
[DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="DefineVariable")]
protected static extern IntPtr DefineVariable_(IntPtr uCalcHandle, string Definition , IntPtr VariableAddress );
{DLLImport}function DefineVariable__(uCalcHandle: System.Pointer;Definition: AnsiString ; VariableAddress: System.Pointer): System.Pointer; cdecl; external uCalcDLL name 'DefineVariable';
typedef uCalcPtr (* __DefineVariable)(void *uCalcHandle, CONSTCHAR Definition , void * VariableAddress );
[DllImport(uCalcLib, CharSet=CharSet::Ansi, CallingConvention=CallingConvention::Cdecl, EntryPoint = "DefineVariable")]
static uCalcPtr DefineVariable_(void * uCalcHandle, MARSHALSTR Definition , void * VariableAddress);