#include #include "uCalc.h" using namespace std; using namespace uCalcSoftware; void ucalc_call GetTypeOf(uCalcBase::Callback cb) { // Get the Item object for the argument auto item = cb.ArgItem(1); // Get the item's DataType, then its name, and return it as a string cb.ReturnStr(item.DataType().Name()); } int main() { uCalc uc; // The ByHandle modifier passes the argument's metadata (Item) instead of its value uc.DefineFunction("TypeOf(ByHandle arg As AnyType) As String", GetTypeOf); uc.DefineVariable("myInt As Int = 10"); uc.DefineVariable("myStr As String = 'hello'"); uc.DefineVariable("myDbl = 3.14"); // Type is inferred as double cout << "Type of myInt: " << uc.EvalStr("TypeOf(myInt)") << endl; cout << "Type of myStr: " << uc.EvalStr("TypeOf(myStr)") << endl; cout << "Type of myDbl: " << uc.EvalStr("TypeOf(myDbl)") << endl; }