Skip to content

Commit

Permalink
Make various built-ins that should use $*OUT and $*ERR actually use t…
Browse files Browse the repository at this point in the history
…hem.
  • Loading branch information
jnthn committed Apr 2, 2009
1 parent ef59b9d commit db0264d
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
4 changes: 3 additions & 1 deletion src/builtins/control.pir
Expand Up @@ -401,7 +401,9 @@ on error.
throw ex
.return ()
no_eh:
printerr message
.local pmc err
err = get_hll_global "$ERR"
err.'print'(message)
.return ()
.end

Expand Down
13 changes: 9 additions & 4 deletions src/builtins/io.pir
Expand Up @@ -14,7 +14,8 @@ src/builtins/io.pir - Perl6 builtins for I/O

.sub 'print'
.param pmc args :slurpy
.local pmc it
.local pmc it, out
out = get_hll_global '$OUT'
args.'!flatten'()
it = iter args
iter_loop:
Expand All @@ -23,7 +24,7 @@ src/builtins/io.pir - Perl6 builtins for I/O
unless null $P0 goto iter_nonull
$P0 = new 'Failure'
iter_nonull:
print $P0
out.'print'($P0)
goto iter_loop
iter_end:
.return (1)
Expand All @@ -32,8 +33,10 @@ src/builtins/io.pir - Perl6 builtins for I/O

.sub 'say'
.param pmc list :slurpy
.local pmc it, out
out = get_hll_global '$OUT'
'print'(list :flat)
print "\n"
out.'print'("\n")
.return (1)
.end

Expand All @@ -46,8 +49,10 @@ Parses a format string and prints formatted output according to it.

.sub 'printf'
.param pmc args :slurpy
.local pmc it, out
out = get_hll_global '$OUT'
$S0 = 'sprintf'(args :flat)
print $S0
out.'print'($S0)
.return (1)
.end

Expand Down
4 changes: 3 additions & 1 deletion src/classes/Failure.pir
Expand Up @@ -89,7 +89,9 @@
$P0 = self.'!exception'()
$S0 = $P0['message']
$S0 = concat $S0, "\n"
printerr $S0
.local pmc err
err = get_hll_global "$ERR"
err.'print'($S0)
done:
.end

Expand Down

0 comments on commit db0264d

Please sign in to comment.