#include <iostream>
#include "uCalc.h"

using namespace std;
using namespace uCalcSoftware;

void ucalc_call DescribeArg(uCalcBase::Callback cb) {
   // Retrieve the Item object for the first argument.
   auto item = cb.ArgItem(1);

   // Inspect the item's metadata.
   auto name = item.Name();
   if (name == "") {
      name = "(literal)";
   }

   cout << "  - Name: " << name << ", Type: " << item.DataType().Name() << endl;
}
int main() {
   uCalc uc;
   uc.DefineFunction("Describe(ByHandle arg As AnyType)", DescribeArg);
   uc.DefineVariable("my_var = 100");

   cout << "Inspecting a variable:" << endl;
   uc.Eval("Describe(my_var)");

   cout << "Inspecting a literal value:" << endl;
   uc.Eval("Describe(123.45)");

   cout << "Inspecting a string value:" << endl;
   uc.EvalStr("Describe('abc xyz')");
}