home *** CD-ROM | disk | FTP | other *** search
-
-
-
- TTTTccccllll____CCCCrrrreeeeaaaatttteeeeMMMMaaaatttthhhhFFFFuuuunnnncccc((((3333)))) TTTTccccllll ((((7777....0000)))) TTTTccccllll____CCCCrrrreeeeaaaatttteeeeMMMMaaaatttthhhhFFFFuuuunnnncccc((((3333))))
-
-
-
- _________________________________________________________________
-
- NNNNAAAAMMMMEEEE
- Tcl_CreateMathFunc - Define a new math function for
- expressions
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- ####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>>
-
- TTTTccccllll____CCCCrrrreeeeaaaatttteeeeMMMMaaaatttthhhhFFFFuuuunnnncccc(_i_n_t_e_r_p, _n_a_m_e, _n_u_m_A_r_g_s, _a_r_g_T_y_p_e_s, _p_r_o_c, _c_l_i_e_n_t_D_a_t_a)
-
- AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
- Tcl_Interp *_i_n_t_e_r_p (in) Interpreter in which
- new function will be
- defined.
-
- char *_n_a_m_e (in) Name for new
- function.
-
- int _n_u_m_A_r_g_s (in) Number of arguments
- to new function;
- also gives size of
- _a_r_g_T_y_p_e_s array.
-
- Tcl_ValueType *_a_r_g_T_y_p_e_s (in) Points to an array
- giving the
- permissible types for
- each argument to
- function.
-
- Tcl_MathProc *_p_r_o_c (in) Procedure that
- implements the
- function.
-
- ClientData _c_l_i_e_n_t_D_a_t_a (in) Arbitrary one-word
- value to pass to _p_r_o_c
- when it is invoked.
- _________________________________________________________________
-
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- Tcl allows a number of mathematical functions to be used in
- expressions, such as ssssiiiinnnn, ccccoooossss, and hhhhyyyyppppooootttt.
- TTTTccccllll____CCCCrrrreeeeaaaatttteeeeMMMMaaaatttthhhhFFFFuuuunnnncccc allows applications to add additional
- functions to those already provided by Tcl or to replace
- existing functions. _N_a_m_e is the name of the function as it
- will appear in expressions. If _n_a_m_e doesn't already exist
- as a function then a new function is created. If it does
- exist, then the existing function is replaced. _N_u_m_A_r_g_s and
- _a_r_g_T_y_p_e_s describe the arguments to the function. Each entry
- in the _a_r_g_T_y_p_e_s array must be either TCL_INT, TCL_DOUBLE, or
- TCL_EITHER to indicate whether the corresponding argument
-
-
-
- Page 1 (printed 7/10/95)
-
-
-
-
-
-
- TTTTccccllll____CCCCrrrreeeeaaaatttteeeeMMMMaaaatttthhhhFFFFuuuunnnncccc((((3333)))) TTTTccccllll ((((7777....0000)))) TTTTccccllll____CCCCrrrreeeeaaaatttteeeeMMMMaaaatttthhhhFFFFuuuunnnncccc((((3333))))
-
-
-
- must be an integer, a double-precision floating value, or
- either, respectively.
-
- Whenever the function is invoked in an expression Tcl will
- invoke _p_r_o_c. _P_r_o_c should have arguments and result that
- match the type TTTTccccllll____MMMMaaaatttthhhhPPPPrrrroooocccc:
- typedef int Tcl_MathProc(
- ClientData _c_l_i_e_n_t_D_a_t_a,
- Tcl_Interp *_i_n_t_e_r_p,
- Tcl_Value *_a_r_g_s,
- Tcl_Value *resultPtr);
-
- When _p_r_o_c is invoked the _c_l_i_e_n_t_D_a_t_a and _i_n_t_e_r_p arguments
- will be the same as those passed to TTTTccccllll____CCCCrrrreeeeaaaatttteeeeMMMMaaaatttthhhhFFFFuuuunnnncccc.
- _A_r_g_s will point to an array of _n_u_m_A_r_g_s Tcl_Value structures,
- which describe the actual arguments to the function:
- typedef struct Tcl_Value {
- Tcl_ValueType _t_y_p_e;
- int _i_n_t_V_a_l_u_e;
- double _d_o_u_b_l_e_V_a_l_u_e;
- } Tcl_Value;
-
- The _t_y_p_e field indicates the type of the argument and is
- either TCL_INT or TCL_DOUBLE. It will match the _a_r_g_T_y_p_e_s
- value specified for the function unless the _a_r_g_T_y_p_e_s value
- was TCL_EITHER. Tcl converts the argument supplied in the
- expression to the type requested in _a_r_g_T_y_p_e_s, if that is
- necessary. Depending on the value of the _t_y_p_e field, the
- _i_n_t_V_a_l_u_e or _d_o_u_b_l_e_V_a_l_u_e field will contain the actual value
- of the argument.
-
- _P_r_o_c should compute its result and store it either as an
- integer in _r_e_s_u_l_t_P_t_r->_i_n_t_V_a_l_u_e or as a floating value in
- _r_e_s_u_l_t_P_t_r->_d_o_u_b_l_e_V_a_l_u_e. It should set also _r_e_s_u_l_t_P_t_r->_t_y_p_e
- to either TCL_INT or TCL_DOUBLE to indicate which value was
- set. Under normal circumstances _p_r_o_c should return TCL_OK.
- If an error occurs while executing the function, _p_r_o_c should
- return TCL_ERROR and leave an error message in _i_n_t_e_r_p-
- >_r_e_s_u_l_t.
-
-
- KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
- expression, mathematical function
-
-
-
-
-
-
-
-
-
-
-
-
- Page 2 (printed 7/10/95)
-
-
-
-