ucDefine

 

See Also: ucDefineVariable, ucDefineFunction, ucDefineOperator, and ucDefineSyntax.

 

Defines an item.

 

ucDefine(Definition [, Misc1, [, Misc2 [, Misc3 [, tHandle]]]])

 

Parameters

Definition

Required.Definition is a string argument that starts with a keyword corresponding with the kind of item you want to define, followed by one or two colons, and the definition itself.Some of the possible definition "keywords" include:Var, Func, Op, and Syntax, corresponding respectively with definitions for variables, functions, operators, and syntax constructs.These overlap with the functionality of ucDefineVariable, ucDefineFunction, ucDefineOperator, and ucDefineSyntax.Additional keywords include: Const (for constants), DataType, Macro, and Token.

 

Misc1, Misc2, Misc3

Optional.These are numeric arguments that may correspond with properties or memory addresses, depending on how the particular definition is set up.

 

tHandle

Optional.See Thread Handling.

 

Remarks

 

ucDefineFunction "Native: f(x)", AddressOf MyFunction

 

is the equivalent of:

 

ucDefine "Func:: f(x)", AddressOf MyFunction

 

 

Note to C++ users

 

In the uCalc header file for Visual C++ and Borland C++ Builder, ucDefine is overloaded with two slightly different routines.If ucDefine will have more than two arguments, and the second argument is 0, then you should pass either (DWORD)0 or empty quotes "" for that argument, especially in VC++, otherwise ambiguity between the two definitions will cause it not to compile.�� So for instance in VC++, assuming tHandle is defined already, you should use the second or third line below instead of the first (and in C#, you can only use the third line):

 

ucDefine("Syntax: a ::= b", 0, 0, 0, tHandle); // This line will not compile in C++

ucDefine("Syntax: a ::= b", (DWORD)0, 0, 0, tHandle); // This line will compile in C++

ucDefine("Syntax: a ::= b", "", 0, 0, tHandle); // This line will compile in C++

 

 

Example:

 

In this example, the first line defines a variable named x, which stores an initial numeric value of 123.The second line defines a constant named Pi, which stores the computed value of 3.14159... .The third line defines an end-user function.The fourth line defines an infix operator named ShiftLeft.The line after that defines a VB-like syntax construct that accepts binary numbers such as &b1011001.The last line defines a macro.

 

Visual Basic

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)"

ucDefine "Macro: Plus(x) = x + x"

 

 

New or enhanced in version 3.0

         Keywords: RightToLeft and Overwrite.

 

Note: ucDefine() is no longer available to the end user in version 3.0 (it is still available at the source code level though).

 

New or enhanced in version 2.96

 

New or enhanced in version 2.9+