5 .param pmc argv :slurpy
9 if argc == 0 goto bad_args
11 .local pmc compileTcl, getCallLevel
12 compileTcl = get_root_global ['_tcl'], 'compileTcl'
13 getCallLevel = get_root_global ['_tcl'], 'getCallLevel'
15 # save the old call level
18 call_chain = get_root_global ['_tcl'], 'call_chain'
19 call_level = elements call_chain
21 .local pmc new_call_level
22 new_call_level = argv[0]
25 (new_call_level,defaulted) = getCallLevel(new_call_level)
26 if defaulted == 1 goto skip
28 # if we only have a level, then we don't have a command to run!
29 if argc == 1 goto bad_args
30 # pop the call level argument
36 difference = call_level - $I0
38 .local pmc saved_call_chain
39 saved_call_chain = new 'TclList'
42 if $I0 == difference goto save_chain_end
44 push saved_call_chain, $P0
50 # if we get an exception, we have to reset the environment
52 push_eh restore_and_rethrow
66 # restore the old level
69 if $I0 == difference goto restore_chain_end
70 $P0 = pop saved_call_chain
73 goto restore_chain_loop
78 die 'wrong # args: should be "uplevel ?level? command ?arg ...?"'
85 # vim: expandtab shiftwidth=4 ft=pir: