home *** CD-ROM | disk | FTP | other *** search
-
-
-
- sssswwwwiiiittttcccchhhh((((nnnn)))) TTTTccccllll ((((7777....0000)))) sssswwwwiiiittttcccchhhh((((nnnn))))
-
-
-
- _________________________________________________________________
-
- NNNNAAAAMMMMEEEE
- switch - Evaluate one of several scripts, depending on a
- given value
-
- SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
- sssswwwwiiiittttcccchhhh ?_o_p_t_i_o_n_s? _s_t_r_i_n_g _p_a_t_t_e_r_n _b_o_d_y ?_p_a_t_t_e_r_n _b_o_d_y ...?
- sssswwwwiiiittttcccchhhh ?_o_p_t_i_o_n_s? _s_t_r_i_n_g {_p_a_t_t_e_r_n _b_o_d_y ?_p_a_t_t_e_r_n _b_o_d_y ...?}
- _________________________________________________________________
-
-
- DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
- The sssswwwwiiiittttcccchhhh command matches its _s_t_r_i_n_g argument against each
- of the _p_a_t_t_e_r_n arguments in order. As soon as it finds a
- _p_a_t_t_e_r_n that matches _s_t_r_i_n_g it evaluates the following _b_o_d_y
- argument by passing it recursively to the Tcl interpreter
- and returns the result of that evaluation. If the last
- _p_a_t_t_e_r_n argument is ddddeeeeffffaaaauuuulllltttt then it matches anything. If no
- _p_a_t_t_e_r_n argument matches _s_t_r_i_n_g and no default is given,
- then the sssswwwwiiiittttcccchhhh command returns an empty string.
-
- If the initial arguments to sssswwwwiiiittttcccchhhh start with ---- then they
- are treated as options. The following options are currently
- supported:
-
- ----eeeexxxxaaaacccctttt Use exact matching when comparing _s_t_r_i_n_g to a
- pattern. This is the default.
-
- ----gggglllloooobbbb When matching _s_t_r_i_n_g to the patterns, use glob-
- style matching (i.e. the same as implemented by
- the ssssttttrrrriiiinnnngggg mmmmaaaattttcccchhhh command).
-
- ----rrrreeeeggggeeeexxxxpppp When matching _s_t_r_i_n_g to the patterns, use regular
- expression matching (i.e. the same as implemented
- by the rrrreeeeggggeeeexxxxpppp command).
-
- -------- Marks the end of options. The argument following
- this one will be treated as _s_t_r_i_n_g even if it
- starts with a ----....
-
- Two syntaxes are provided for the _p_a_t_t_e_r_n and _b_o_d_y
- arguments. The first uses a separate argument for each of
- the patterns and commands; this form is convenient if
- substitutions are desired on some of the patterns or
- commands. The second form places all of the patterns and
- commands together into a single argument; the argument must
- have proper list structure, with the elements of the list
- being the patterns and commands. The second form makes it
- easy to construct multi-line switch commands, since the
- braces around the whole list make it unnecessary to include
- a backslash at the end of each line. Since the _p_a_t_t_e_r_n
-
-
-
- Page 1 (printed 7/17/95)
-
-
-
-
-
-
- sssswwwwiiiittttcccchhhh((((nnnn)))) TTTTccccllll ((((7777....0000)))) sssswwwwiiiittttcccchhhh((((nnnn))))
-
-
-
- arguments are in braces in the second form, no command or
- variable substitutions are performed on them; this makes
- the behavior of the second form different than the first
- form in some cases.
-
- If a _b_o_d_y is specified as ``----'' it means that the _b_o_d_y for
- the next pattern should also be used as the body for this
- pattern (if the next pattern also has a body of ``----'' then
- the body after that is used, and so on). This feature makes
- it possible to share a single _b_o_d_y among several patterns.
-
- Below are some examples of sssswwwwiiiittttcccchhhh commands:
-
- sssswwwwiiiittttcccchhhh aaaabbbbcccc aaaa ---- bbbb {{{{ffffoooorrrrmmmmaaaatttt 1111}}}} aaaabbbbcccc {{{{ffffoooorrrrmmmmaaaatttt 2222}}}} ddddeeeeffffaaaauuuulllltttt {{{{ffffoooorrrrmmmmaaaatttt 3333}}}}
- will return 2222,
-
- sssswwwwiiiittttcccchhhh ----rrrreeeeggggeeeexxxxpppp aaaaaaaaaaaabbbb {{{{
- ^^^^aaaa....****bbbb$$$$ ----
- bbbb {{{{ffffoooorrrrmmmmaaaatttt 1111}}}}
- aaaa**** {{{{ffffoooorrrrmmmmaaaatttt 2222}}}}
- ddddeeeeffffaaaauuuulllltttt {{{{ffffoooorrrrmmmmaaaatttt 3333}}}}
- }}}}
- will return 1111, and
-
- sssswwwwiiiittttcccchhhh xxxxyyyyzzzz {{{{
- aaaa
- ----
- bbbb
- {{{{ffffoooorrrrmmmmaaaatttt 1111}}}}
- aaaa****
- {{{{ffffoooorrrrmmmmaaaatttt 2222}}}}
- ddddeeeeffffaaaauuuulllltttt
- {{{{ffffoooorrrrmmmmaaaatttt 3333}}}}
- }}}}
- will return 3333.
-
-
- KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
- switch, match, regular expression
-
-
-
-
-
-
-
-
-
-
-
-
-
- Page 2 (printed 7/17/95)
-
-
-
-