tagged release 0.7.1
[parrot.git] / languages / tcl / runtime / builtin / inline.pir
blobca1151c33e3ce5bc598bc87bc59ff5365ee7b249
1 .HLL 'Tcl', ''
2 .namespace []
4 .sub '&inline'
5   .param pmc argv :slurpy
7   .local int argc
8   argc = elements argv
10   if argc != 2 goto bad_args
12   .local string language,code
14   language = argv[0]
15   code     = argv[1]
17   $P1 = compreg language
18   if null $P1 goto fail
19   push_eh compiler_error
20     $P0 = $P1(code)
21   pop_eh
22   push_eh runtime_error
23     $P0()
24   pop_eh
25   .return ('')
28 # First pass at RT#40748
29 compiler_error:
30   get_results '0,0', $P1, $S1
31   $S1 = 'compile error: ' . $S1
32   die $S1
34 runtime_error:
35   get_results '0,0', $P1, $S1
36   $S1 = 'runtime error: ' . $S1
37   die $S1
39 bad_args:
40   die 'wrong # args: should be "inline language code"'
42 fail:
43   $S0 = 'invalid language "'
44   $S0 .= language
45   $S0 .= '" specified'
46   die $S0
47 .end
49 # Local Variables:
50 #   mode: pir
51 #   fill-column: 100
52 # End:
53 # vim: expandtab shiftwidth=4 ft=pir: