home *** CD-ROM | disk | FTP | other *** search
Wrap
/*--------- -------------------------------------------------------------------- * @(#) Eval.3 26.1 93/10/22 SCOINC * * Copyright (C) The Santa Cruz Operation, 1992-1993. * This Module contains Proprietary Information of * The Santa Cruz Operation, and should be treated as Confidential. *--------- -------------------------------------------------------------------- */ Page 1 (printed 7/10/95) TTTTccccllll____EEEEvvvvaaaallll((((3333)))) TTTTccccllll ((((7777....0000)))) TTTTccccllll____EEEEvvvvaaaallll((((3333)))) _________________________________________________________________ NNNNAAAAMMMMEEEE Tcl_Eval, Tcl_VarEval, Tcl_EvalFile, Tcl_GlobalEval - execute Tcl commands SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS ####iiiinnnncccclllluuuuddddeeee <<<<ttttccccllll....hhhh>>>> int TTTTccccllll____EEEEvvvvaaaallll(_i_n_t_e_r_p, _c_m_d) | int TTTTccccllll____VVVVaaaarrrrEEEEvvvvaaaallll(_i_n_t_e_r_p, _s_t_r_i_n_g, _s_t_r_i_n_g, ... ((((cccchhhhaaaarrrr ****)))) NNNNUUUULLLLLLLL) int TTTTccccllll____EEEEvvvvaaaallllFFFFiiiilllleeee(_i_n_t_e_r_p, _f_i_l_e_N_a_m_e) int TTTTccccllll____GGGGlllloooobbbbaaaallllEEEEvvvvaaaallll(_i_n_t_e_r_p, _c_m_d) AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS Tcl_Interp *_i_n_t_e_r_p (in) Interpreter in which to execute the command. String result will be stored in _i_n_t_e_r_p- >_r_e_s_u_l_t. char *_c_m_d (in) Command (or sequence of commands) to execute. Must be in writable memory (TTTTccccllll____EEEEvvvvaaaallll makes temporary modifications to the command). char *_s_t_r_i_n_g (in) String forming part of Tcl command. char *_f_i_l_e_N_a_m_e (in) Name of file containing Tcl command string. _________________________________________________________________ DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN All four of these procedures execute Tcl commands. TTTTccccllll____EEEEvvvvaaaallll is the core procedure: it parses commands from _c_m_d and executes them in order until either an error occurs or it | reaches the end of the string. The return value from TTTTccccllll____EEEEvvvvaaaallll is one of the Tcl return codes TTTTCCCCLLLL____OOOOKKKK, TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR, TTTTCCCCLLLL____RRRREEEETTTTUUUURRRRNNNN, TTTTCCCCLLLL____BBBBRRRREEEEAAAAKKKK, or TTTTCCCCLLLL____CCCCOOOONNNNTTTTIIIINNNNUUUUEEEE, and _i_n_t_e_r_p->_r_e_s_u_l_t will point to a string with additional information (result value or error message). This return information Page 1 (printed 7/10/95) TTTTccccllll____EEEEvvvvaaaallll((((3333)))) TTTTccccllll ((((7777....0000)))) TTTTccccllll____EEEEvvvvaaaallll((((3333)))) corresponds to the last command executed from _c_m_d. TTTTccccllll____VVVVaaaarrrrEEEEvvvvaaaallll takes any number of string arguments of any length, concatenates them into a single string, then calls TTTTccccllll____EEEEvvvvaaaallll to execute that string as a Tcl command. It returns the result of the command and also modifies _i_n_t_e_r_p- >_r_e_s_u_l_t in the usual fashion for Tcl commands. The last argument to TTTTccccllll____VVVVaaaarrrrEEEEvvvvaaaallll must be NULL to indicate the end of arguments. TTTTccccllll____EEEEvvvvaaaallllFFFFiiiilllleeee reads the file given by _f_i_l_e_N_a_m_e and evaluates its contents as a Tcl command by calling TTTTccccllll____EEEEvvvvaaaallll. It returns a standard Tcl result that reflects the result of evaluating the file. If the file couldn't be read then a Tcl error is returned to describe why the file couldn't be read. TTTTccccllll____GGGGlllloooobbbbaaaallllEEEEvvvvaaaallll is similar to TTTTccccllll____EEEEvvvvaaaallll except that it processes the command at global level. This means that the variable context for the command consists of global variables only (it ignores any Tcl procedure that is active). This produces an effect similar to the Tcl command ``uuuupppplllleeeevvvveeeellll 0000''. During the processing of a Tcl command it is legal to make nested calls to evaluate other commands (this is how conditionals, loops, and procedures are implemented). If a code other than TTTTCCCCLLLL____OOOOKKKK is returned from a nested TTTTccccllll____EEEEvvvvaaaallll invocation, then the caller should normally return immediately, passing that same return code back to its caller, and so on until the top-level application is reached. A few commands, like ffffoooorrrr, will check for certain return codes, like TTTTCCCCLLLL____BBBBRRRREEEEAAAAKKKK and TTTTCCCCLLLL____CCCCOOOONNNNTTTTIIIINNNNUUUUEEEE, and process them specially without returning. TTTTccccllll____EEEEvvvvaaaallll keeps track of how many nested Tcl_Eval invocations are in progress for _i_n_t_e_r_p. If a code of TTTTCCCCLLLL____RRRREEEETTTTUUUURRRRNNNN, TTTTCCCCLLLL____BBBBRRRREEEEAAAAKKKK, or TTTTCCCCLLLL____CCCCOOOONNNNTTTTIIIINNNNUUUUEEEE is about to be returned from the topmost TTTTccccllll____EEEEvvvvaaaallll invocation for _i_n_t_e_r_p, then TTTTccccllll____EEEEvvvvaaaallll converts the return code to TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR and sets _i_n_t_e_r_p- >_r_e_s_u_l_t to point to an error message indicating that the rrrreeeettttuuuurrrrnnnn, bbbbrrrreeeeaaaakkkk, or ccccoooonnnnttttiiiinnnnuuuueeee command was invoked in an inappropriate place. This means that top-level applications should never see a return code from TTTTccccllll____EEEEvvvvaaaallll other then TTTTCCCCLLLL____OOOOKKKK or TTTTCCCCLLLL____EEEERRRRRRRROOOORRRR. KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS command, execute, file, global, interpreter, variable Page 2 (printed 7/10/95)