ucDefine
See Also: uCalc
Defines an item.
ucDefine(Definition [, Misc1, [, Misc2
[, Misc3 [, tHandle]]]])
Parameters
Definition
Required. Definition is a string argument that starts with a keyword corresponding to the kind of item you want to define, followed by one or two colons, and the definition itself. Possible definition keywords include: Var, Const, Func, Op, and Syntax, corresponding respectively to definitions for variables, constants, functions, operators, and syntaxes. These overlap with the functionality of ucDefineVariable, ucDefineFunction, ucDefineOperator, and ucDefineSyntax. Other keywords include: Pattern, and DataType. One advantage of using ucDefine instead of one of the other definition functions is that this allows you to create your application in a way that lets the end-user directly define any of the above. Another advantage is that ucDefine allows additional variations to the way things can be defined.
Misc1, Misc2, Misc3
Optional. These are numeric arguments that may correspond to properties or memory addresses, depending on how the particular definition is set up.
tHandle
Optional. You may define a group of items in a given thread. Later, you can release them altogether by releasing the thread itself, instead of explicitly releasing each individual item. See Thread Handling.
Remarks
Some of the functionality associated with ucDefine is beyond the scope of uCalc FMP, and can be found in the uCalc Language Builder instead.
Neither the the Var, Const, Func, Op, or Syntax keywords are "built-into" uCalc. These are all actually defined in the include files. After consulting the uCalc Language Builder, advanced users may modify any of these, or add to the list of items that can be defined.
Most definitions consist of a given keyword, followed by one colon, and then the definition. Two colons are used for NativeCall callbacks (an advanced Language Builder feature), or for callbacks that rely on ucParamDbl or ucParamStr. See the include files for examples of the former, and the MyAverage() function in the demo for an example of the latter.
Examples:
ucDefine("Var: x = 123")
ucDefine("Const: Pi = Atan(1) * 4")
ucDefine("Func: f(x) = x^2")
ucDefine("Op: 20 {x} ShiftLeft {y} := x *
2^y")
ucDefine("Syntax: {'&b'}{Number:'[0-1]+'} ::= BaseConvert('{Number}', 2)")
See the include files, as well as the demo files for more advanced examples.
New or Enhanced