Warning
uCalc API Preview Release Notice:The uCalc engine has successfully transitioned to modern cross-platform environments. The next phase envolvessome structural changes, performance optimizations, and API refinements. The API is subject to breaking changesprior to the stable release. Please evaluate the preview version thoroughly before production use.
| Function | Description |
|---|---|
Error(int) As Int | Triggers an error using a numeric code. Returns an ErrorHandlerResponse enum value (0, 1, or 2). |
Error(string) As Int | Triggers an error with a custom message. Returns an ErrorHandlerResponse enum value. |
Swap(ByHandle AnyType, ByHandle AnyType) | Swaps the values of two variables by reference. No return value. |
Reset(ByHandle AnyType) | Resets a variable to its default value (0 for numeric types, empty for strings, etc.). No return value. |
| Function | Description |
|---|---|
AddressOf(ByHandle AnyType) As SameTypeAs:0 Ptr | Returns a pointer to the variable’s storage location. |
ValueAt(ByHandle AnyType Ptr, size_t = 0) As SameTypeAs:0 | Dereferences a typed pointer at the given index (pointer + index). |
ValueAtType(ByHandle AnyType, Pointer, size_t = 0) As SameTypeAs:0 | Dereferences a raw pointer using a specified data type. |
AddPtr(ByHandle AnyType, size_t = 1) As SameTypeAs:0 | Performs pointer arithmetic and returns the resulting pointer. |
SubtractPtr(ByHandle AnyType, size_t = 1) As SameTypeAs:0 | Same as AddPtr but subtracts the offset. |
SetVar(ByRef AnyType, SameTypeAs:0) As SameTypeAs:0 | Assigns a value to a variable by reference and returns the assigned value. |
| Function | Description |
|---|---|
IIf(bool, ByExpr AnyType, ByExpr SameTypeAs:1) As SameTypeAs:1 | Immediate‑if expression; evaluates only the selected branch. |
IIf(bool, ByExpr string, ByExpr string = …) As String | String‑specific overload. |
IIf(bool, ByExpr Complex, ByExpr Complex) As Complex | Complex‑number overload. |
| Function | Description |
|---|---|
Arg(size_t) | Returns the nth argument passed to the current function or expression. |
ArgCount() As Size_t | Returns the number of arguments passed. |
Parse(string, string = "") | Parses an expression using an optional data‑type string. Returns a pointer to the parsed expression. |
Eval(string) | Evaluates an expression and returns a numeric result. |
EvalStr(string, bool = True) As String | Evaluates an expression and returns a formatted string. |
Evaluate(Pointer) As Double | Evaluates a previously parsed expression via pointer. |
EvaluateInt(Pointer) As Int | Evaluates a parsed expression and returns an integer. |
EvaluateStr(Pointer, bool = True) As String | Evaluates a parsed expression and returns a formatted string. |
| Function | Description |
|---|---|
FromTo(string, string, bool = True) | Defines a rewrite rule using uCalc’s pattern‑based transformer. Can be temporary or permanent. |
ExprPtr(AnyType) As Pointer | Returns a pointer to the internal representation of an expression or value. |
Define(string, Pointer = 0, Pointer = 0) | Defines a variable, operator, or function. Parameters: definition string, optional address, optional datatype handle. |
uCalcInstance() As Pointer | Returns a pointer/handle to the current uCalc engine instance. |
Precedence(string, int64_t) As size_t | Returns the precedence level of an operator. |
| Function | Description |
|---|---|
DoLoop(ByExpr bool, ByExpr AnyType, ByExpr bool = True) As Void | Executes a do/loop construct inside an expression. |
ForLoop(ByHandle Counter, Start, Finish, Step, ByExpr AnyType) | Executes a for‑loop with a counter variable and an expression body. |
| Function | Description |
|---|---|
BaseConvert(string, int) | Converts a number string from one base to another. |
Sgn(Number) | Returns −1, 0, or +1 depending on the sign of the number. |
Inf() = 1/0 | Returns positive infinity. |
NaN() = 0/0 | Returns a NaN value. |
| Function | Description |
|---|---|
File(string) As String | Reads the entire contents of a file into a string. |
FileSize(string) As Size_t | Returns the size of a file in bytes. |
This page last modified on: