EvaluateVoidMethod

Applies to:Fast Math Parser
Class:uCalc.ParsedExpr
Rapidly evaluates an expression that was parsed with Parse or passed By Expression and returns a Pointer to the result
Syntax
EvaluateVoid()
Remarks
Use this when you are interested in a Pointer to the result instead of the result itself. For instance, given an integer result, you might use a Pointer in order to retrieve the hi byte and lo byte values.

Example 1: Displaying an expression of unsigned byte as a signed byte by using a Pointer

Dim VariableX = uc.DefineVariable("x As Int")
Dim Expression As string
Console.Write("Enter an expression (Ex: x + 125): ")
Expression = Console.ReadLine()
Dim ParsedExpr = uc.Parse(Expression, "Int8u")      

Dim x As Int32
for x = 1 To 10
   VariableX.SetVariableValueInt32(x)
   Console.WriteLine("x = " + x + "  Int8 result = " + uc.ValueAt(ParsedExpr.EvaluateVoid(), "Int8"))
Next
' Output
' x = 1  Int8 result = 126
' x = 2  Int8 result = 127
' x = 3  Int8 result = -128
' x = 4  Int8 result = -127
' x = 5  Int8 result = -126
' x = 6  Int8 result = -125
' x = 7  Int8 result = -124
' x = 8  Int8 result = -123
' x = 9  Int8 result = -122
' x = 10  Int8 result = -121

          

var VariableX = uc.DefineVariable("x As Int");
string Expression;
Console.Write("Enter an expression (Ex: x + 125): ");
Expression = Console.ReadLine();
var ParsedExpr = uc.Parse(Expression, "Int8u");      

for (Int32 x = 1; x <= 10; x++) {
   VariableX.SetVariableValueInt32(x);
   Console.WriteLine("x = " + x + "  Int8 result = " + uc.ValueAt(ParsedExpr.EvaluateVoid(), "Int8"));
}
// Output
// x = 1  Int8 result = 126
// x = 2  Int8 result = 127
// x = 3  Int8 result = -128
// x = 4  Int8 result = -127
// x = 5  Int8 result = -126
// x = 6  Int8 result = -125
// x = 7  Int8 result = -124
// x = 8  Int8 result = -123
// x = 9  Int8 result = -122
// x = 10  Int8 result = -121

ParsedExpr.Release();
VariableX.Release();

          

//var VariableX = uc.DefineVariable('x As Int');
      Write('Enter an expression (Ex: x + 125): ')
Expression = ReadLn();
//var ParsedExpr = uc.Parse(Expression, 'Int8u');      

      for x := 1 to 10 do
begin
   VariableX.SetVariableValueInt32(x);
         WriteLn('x = ' + x + '  Int8 result = ' + uc.ValueAt(ParsedExpr.EvaluateVoid(), 'Int8'));
End;
      // Output
// x = 1  Int8 result = 126
// x = 2  Int8 result = 127
// x = 3  Int8 result = -128
// x = 4  Int8 result = -127
// x = 5  Int8 result = -126
// x = 6  Int8 result = -125
// x = 7  Int8 result = -124
// x = 8  Int8 result = -123
// x = 9  Int8 result = -122
// x = 10  Int8 result = -121

          

auto VariableX = uc.DefineVariable("x As Int");
string Expression;      
cout << "Enter an expression (Ex: x + 125): " << endl;
cin >> Expression; // Ex: x + 125
auto ParsedExpr = uc.Parse(Expression, "Int8u");      

for (int x = 1; x <= 10; x++) {
   VariableX.SetVariableValueInt32(x);
   cout << "x = " << x << "  Int8 result = " << uc.ValueAt(ParsedExpr.EvaluateVoid(), "Int8") << endl;
}
// Output
// x = 1  Int8 result = 126
// x = 2  Int8 result = 127
// x = 3  Int8 result = -128
// x = 4  Int8 result = -127
// x = 5  Int8 result = -126
// x = 6  Int8 result = -125
// x = 7  Int8 result = -124
// x = 8  Int8 result = -123
// x = 9  Int8 result = -122
// x = 10  Int8 result = -121

ParsedExpr.Release();
VariableX.Release();

          

auto VariableX = uc.DefineVariable("x As Int");
string ^ Expression;
Console::Write("Enter an expression (Ex: x + 125): ");
Expression = Console::ReadLine();
auto ParsedExpr = uc.Parse(Expression, "Int8u");      

for (int x = 1; x <= 10; x++) {
   VariableX.SetVariableValueInt32(x);
   Console::WriteLine("x = " + x + "  Int8 result = " + uc.ValueAt(ParsedExpr.EvaluateVoid(), "Int8"));
}
// Output
// x = 1  Int8 result = 126
// x = 2  Int8 result = 127
// x = 3  Int8 result = -128
// x = 4  Int8 result = -127
// x = 5  Int8 result = -126
// x = 6  Int8 result = -125
// x = 7  Int8 result = -124
// x = 8  Int8 result = -123
// x = 9  Int8 result = -122
// x = 10  Int8 result = -121

ParsedExpr.Release();
VariableX.Release();

          
DLL import code
<DllImport(uCalcDLL, CharSet:=CharSet.Ansi, CallingConvention:=CallingConvention.Cdecl, EntryPoint:="EvaluateVoid")> _

Private Function EvaluateVoid__(ByVal ExprHandle As IntPtr) As  IntPtr
End Function
            
[DllImport(uCalcDLL, CharSet=CharSet.Ansi, CallingConvention=CallingConvention.Cdecl, EntryPoint="EvaluateVoid")]

protected static extern  IntPtr EvaluateVoid_(IntPtr ExprHandle);
            
{DLLImport}function EvaluateVoid__(ExprHandle: System.Pointer):  System.Pointer; cdecl; external uCalcDLL name 'EvaluateVoid';

            
typedef  void * (* __EvaluateVoid)(void *ExprHandle); 

            
[DllImport(uCalcLib, CharSet=CharSet::Ansi, CallingConvention=CallingConvention::Cdecl, EntryPoint = "EvaluateVoid")]

static void *   EvaluateVoid_(void *  ExprHandle);
            
See also
Prev | Next