other versions
- wheezy 8.4.19-5
conflicting packages
Tcl_CreateMathFunc(3tcl) | Tcl Library Procedures | Tcl_CreateMathFunc(3tcl) |
NAME¶
Tcl_CreateMathFunc, Tcl_GetMathFuncInfo, Tcl_ListMathFuncs - Define, query and enumerate math functions for expressionsSYNOPSIS¶
#include <tcl.h>void Tcl_CreateMathFunc(interp, name, numArgs, argTypes, proc, clientData)int Tcl_GetMathFuncInfo(interp, name, numArgsPtr, argTypesPtr, procPtr, clientDataPtr)Tcl_Obj * Tcl_ListMathFuncs(interp, pattern)
ARGUMENTS¶
- Tcl_Interp *interp (in)
- Interpreter in which new function will be defined.
- CONST char *name (in)
- Name for new function.
- int numArgs (in)
- Number of arguments to new function; also gives size of argTypes array.
- Tcl_ValueType *argTypes (in)
- Points to an array giving the permissible types for each argument to function.
- Tcl_MathProc *proc (in)
- Procedure that implements the function.
- ClientData clientData (in)
- Arbitrary one-word value to pass to proc when it is invoked.
- int *numArgsPtr (out)
- Points to a variable that will be set to contain the number of arguments to the function.
- Tcl_ValueType **argTypesPtr (out)
- Points to a variable that will be set to contain a pointer to an array giving the permissible types for each argument to the function which will need to be freed up using Tcl_Free.
- Tcl_MathProc **procPtr (out)
- Points to a variable that will be set to contain a pointer to the implementation code for the function (or NULL if the function is implemented directly in bytecode.)
- ClientData *clientDataPtr (out)
- Points to a variable that will be set to contain the clientData argument passed to Tcl_CreateMathFunc when the function was created if the function is not implemented directly in bytecode.
- CONST char *pattern (in)
- Pattern to match against function names so as to filter
them (by passing to Tcl_StringMatch), or NULL to not apply any
filter.
DESCRIPTION¶
Tcl allows a number of mathematical functions to be used in expressions, such as sin, cos, and hypot. Tcl_CreateMathFunc allows applications to add additional functions to those already provided by Tcl or to replace existing functions. Name is the name of the function as it will appear in expressions. If name doesn't already exist as a function then a new function is created. If it does exist, then the existing function is replaced. NumArgs and argTypes describe the arguments to the function. Each entry in the argTypes array must be one of TCL_INT, TCL_DOUBLE, TCL_WIDE_INT, or TCL_EITHER to indicate whether the corresponding argument must be an integer, a double-precision floating value, a wide (64-bit) integer, or any, respectively. Whenever the function is invoked in an expression Tcl will invoke proc. Proc should have arguments and result that match the type Tcl_MathProc:typedef int Tcl_MathProc( ClientData clientData, Tcl_Interp * interp, Tcl_Value * args, Tcl_Value * resultPtr);
typedef struct Tcl_Value { Tcl_ValueType type; long intValue; double doubleValue; Tcl_WideInt wideValue; } Tcl_Value;
KEYWORDS¶
expression, mathematical functionSEE ALSO¶
expr(3tcl), info(3tcl), Tcl_Free(3tcl), Tcl_NewListObj(3tcl)8.4 | Tcl |