[svn:parrot] r47421 - in trunk: compilers/pct/src/PAST compilers/pct/src/POST examples/pir examples/shootout examples/tge/branch runtime/parrot/library/Archive runtime/parrot/library/CGI runtime/parrot/library/Configure runtime/parrot/library/PGE runtime/parrot/library/TAP runtime/parrot/library/Test/Builder t/op t/pmc tools/dev tools/util

plobsing at svn.parrot.org plobsing at svn.parrot.org
Sun Jun 6 04:41:48 UTC 2010


Author: plobsing
Date: Sun Jun  6 04:41:48 2010
New Revision: 47421
URL: https://trac.parrot.org/parrot/changeset/47421

Log:
change instances of Interp.stdhandle to make use of stdio.pasm macro constants

Modified:
   trunk/compilers/pct/src/PAST/Compiler.pir
   trunk/compilers/pct/src/POST/Node.pir
   trunk/examples/pir/life.pir
   trunk/examples/shootout/fasta.pir
   trunk/examples/shootout/regexdna.pir
   trunk/examples/shootout/revcomp.pir
   trunk/examples/shootout/sumcol.pir
   trunk/examples/tge/branch/transform.pir
   trunk/runtime/parrot/library/Archive/Tar.pir
   trunk/runtime/parrot/library/Archive/Zip.pir
   trunk/runtime/parrot/library/CGI/QueryHash.pir
   trunk/runtime/parrot/library/Configure/genfile.pir
   trunk/runtime/parrot/library/PGE/Util.pir
   trunk/runtime/parrot/library/TAP/Parser.pir
   trunk/runtime/parrot/library/Test/Builder/Output.pir
   trunk/t/op/stringu.t
   trunk/t/pmc/io.t
   trunk/tools/dev/nci_thunk_gen.pir
   trunk/tools/util/parrot-config.pir

Modified: trunk/compilers/pct/src/PAST/Compiler.pir
==============================================================================
--- trunk/compilers/pct/src/PAST/Compiler.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/compilers/pct/src/PAST/Compiler.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -2454,7 +2454,7 @@
     .local string valflags
     $P0 = get_global '%valflags'
     valflags = $P0[returns]
-  
+
     $I0 = index valflags, 'e'
     if $I0 < 0 goto escape_done
     value = self.'escape'(value)

Modified: trunk/compilers/pct/src/POST/Node.pir
==============================================================================
--- trunk/compilers/pct/src/POST/Node.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/compilers/pct/src/POST/Node.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -304,7 +304,7 @@
   done:
     .return ()
 .end
-    
+
 
 =back
 

Modified: trunk/examples/pir/life.pir
==============================================================================
--- trunk/examples/pir/life.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/examples/pir/life.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -87,7 +87,8 @@
 	mod $I31,$I0,100
 	if $I31, skip
         $P0 = getinterp
-        $P1 = $P0.'stdhandle'(2)
+        .include 'stdio.pasm'
+        $P1 = $P0.'stdhandle'(.PIO_STDERR_FILENO)
 	print $P1, "."
 skip:
 

Modified: trunk/examples/shootout/fasta.pir
==============================================================================
--- trunk/examples/shootout/fasta.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/examples/shootout/fasta.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -163,8 +163,9 @@
 	.local pmc interp, stdout
 	.local int n
 	# stdout is linebuffered per default - make it block buffered
+        .include 'stdio.pasm'
         interp = getinterp
-	stdout = interp.'stdhandle'(1)
+	stdout = interp.'stdhandle'(.PIO_STDOUT_FILENO)
 	stdout.'buffer_size'(40960)
 	$I0 = argv
 	if $I0 > 1 goto argsok

Modified: trunk/examples/shootout/regexdna.pir
==============================================================================
--- trunk/examples/shootout/regexdna.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/examples/shootout/regexdna.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -62,7 +62,8 @@
 	# Read in the file
 beginwhile:
         $P0      = getinterp
-        $P1      = $P0.'stdhandle'(0) # stdin
+        .include 'stdio.pasm'
+        $P1      = $P0.'stdhandle'(.PIO_STDIN_FILENO)
         chunk    = $P1.'read'(65535)
         chunklen = length chunk
 	unless chunklen goto endwhile

Modified: trunk/examples/shootout/revcomp.pir
==============================================================================
--- trunk/examples/shootout/revcomp.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/examples/shootout/revcomp.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -36,8 +36,9 @@
 	.local pmc stdin, stdout
 	.local string line, seq
         $P0    = getinterp
-        stdin  = $P0.'stdhandle'(0)
-        stdout = $P0.'stdhandle'(1)
+        .include 'stdio.pasm'
+        stdin  = $P0.'stdhandle'(.PIO_STDIN_FILENO)
+        stdout = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
 	# stdout is linebuffered per default - make it block buffered
 	stdout.'buffer_size'(8192)
 

Modified: trunk/examples/shootout/sumcol.pir
==============================================================================
--- trunk/examples/shootout/sumcol.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/examples/shootout/sumcol.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -12,7 +12,8 @@
 	.local int count, tmp, linelen
 	count  = 0
 	interp = getinterp
-	stdin  = interp.'stdhandle'(0)
+        .include 'stdio.pasm'
+	stdin  = interp.'stdhandle'(.PIO_STDIN_FILENO)
 beginwhile:
 	line    = stdin.'readline'()
 	linelen = length line

Modified: trunk/examples/tge/branch/transform.pir
==============================================================================
--- trunk/examples/tge/branch/transform.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/examples/tge/branch/transform.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -106,7 +106,8 @@
     if $I0 == 2 goto fromfile
 
     $P0 = getinterp
-    filehandle = $P0.'stdhandle'(0)
+    .include 'stdio.pasm'
+    filehandle = $P0.'stdhandle'(.PIO_STDIN_FILENO)
     goto grabline
 
   fromfile:

Modified: trunk/runtime/parrot/library/Archive/Tar.pir
==============================================================================
--- trunk/runtime/parrot/library/Archive/Tar.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/runtime/parrot/library/Archive/Tar.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -440,7 +440,8 @@
     .param pmc args :slurpy
     $S0 = join '', args
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(2)
+    .include 'stdio.pasm'
+    $P1 = $P0.'stdhandle'(.PIO_STDERR_FILENO)
     $P1.'print'($S0)
     $P1.'print'("\n")
 .end

Modified: trunk/runtime/parrot/library/Archive/Zip.pir
==============================================================================
--- trunk/runtime/parrot/library/Archive/Zip.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/runtime/parrot/library/Archive/Zip.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -46,7 +46,8 @@
     .param pmc args :slurpy
     $S0 = join '', args
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(2)
+    .include 'stdio.pasm'
+    $P1 = $P0.'stdhandle'(.PIO_STDERR_FILENO)
     $P1.'print'($S0)
     $P1.'print'("\n")
 .end

Modified: trunk/runtime/parrot/library/CGI/QueryHash.pir
==============================================================================
--- trunk/runtime/parrot/library/CGI/QueryHash.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/runtime/parrot/library/CGI/QueryHash.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -70,7 +70,8 @@
         content_length  = my_env['CONTENT_LENGTH']
         len             = content_length
         $P0             = getinterp
-        in              = $P0.'stdhandle'(0)
+        .include 'stdio.pasm'
+        in              = $P0.'stdhandle'(.PIO_STDIN_FILENO)
         query           = in.'read'(len)
         in.'close'()
         #_dumper( query, 'queryPOST:' )

Modified: trunk/runtime/parrot/library/Configure/genfile.pir
==============================================================================
--- trunk/runtime/parrot/library/Configure/genfile.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/runtime/parrot/library/Configure/genfile.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -358,7 +358,8 @@
     .param int pos
     .param string msg
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(2)
+    .include 'stdio.pasm'
+    $P1 = $P0.'stdhandle'(.PIO_STDERR_FILENO)
     $P1.'print'("in '")
     $P1.'print'(str)
     $P1.'print'("' at ")
@@ -405,7 +406,8 @@
     goto L8
   L7:
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(2)
+    .include 'stdio.pasm'
+    $P1 = $P0.'stdhandle'(.PIO_STDERR_FILENO)
     $P1.'print'("\tunknown config: ")
     $P1.'print'($S1)
     $P1.'print'("\n")

Modified: trunk/runtime/parrot/library/PGE/Util.pir
==============================================================================
--- trunk/runtime/parrot/library/PGE/Util.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/runtime/parrot/library/PGE/Util.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -133,7 +133,8 @@
     message .= "\n"
   emit_message:
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(2)
+    .include 'stdio.pasm'
+    $P1 = $P0.'stdhandle'(.PIO_STDERR_FILENO)
     $P1.'print'(message)
 
     mob.'to'(pos)

Modified: trunk/runtime/parrot/library/TAP/Parser.pir
==============================================================================
--- trunk/runtime/parrot/library/TAP/Parser.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/runtime/parrot/library/TAP/Parser.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -1086,7 +1086,8 @@
     goto L5
   L2:
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(2)
+    .include 'stdio.pasm'
+    $P1 = $P0.'stdhandle'(.PIO_STDERR_FILENO)
     $P1.'print'("Unhandled token type: ")
     $P1.'print'(type)
     $P1.'print'("\n")

Modified: trunk/runtime/parrot/library/Test/Builder/Output.pir
==============================================================================
--- trunk/runtime/parrot/library/Test/Builder/Output.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/runtime/parrot/library/Test/Builder/Output.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -57,16 +57,18 @@
 	.local pmc output
 	.local pmc diag_output
 
+        .include 'stdio.pasm'
+
 	output = args['output']
 	unless null output goto CHECK_ERROR_OUTPUT
         $P0 = getinterp
-        output = $P0.'stdhandle'(1)
+        output = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
 
   CHECK_ERROR_OUTPUT:
 	diag_output = args['diag_output']
 	unless null diag_output goto SET_OUTPUT
         $P0 = getinterp
-        diag_output = $P0.'stdhandle'(1)
+        diag_output = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
 
   SET_OUTPUT:
 	setattribute self, "output", output

Modified: trunk/t/op/stringu.t
==============================================================================
--- trunk/t/op/stringu.t	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/t/op/stringu.t	Sun Jun  6 04:41:48 2010	(r47421)
@@ -24,9 +24,10 @@
 =cut
 
 pir_output_is( <<'CODE', <<OUTPUT, "angstrom" );
+.include 'stdio.pasm'
 .sub main :main
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(1)
+    $P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
     $P1.'encoding'("utf8")
     chr $S0, 0x212B
     print $S0
@@ -38,9 +39,10 @@
 OUTPUT
 
 pir_output_is( <<'CODE', <<OUTPUT, "escaped angstrom" );
+.include 'stdio.pasm'
 .sub main :main
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(1)
+    $P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
     $P1.'encoding'("utf8")
     set $S0, unicode:"\x{212b}"
     print $S0
@@ -52,9 +54,10 @@
 OUTPUT
 
 pir_output_is( <<'CODE', <<OUTPUT, "escaped angstrom 2" );
+.include 'stdio.pasm'
 .sub main :main
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(1)
+    $P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
     $P1.'encoding'("utf8")
     set $S0, unicode:"aaaaaa\x{212b}"
     print $S0
@@ -66,9 +69,10 @@
 OUTPUT
 
 pir_output_is( <<'CODE', <<OUTPUT, "escaped angstrom 3" );
+.include 'stdio.pasm'
 .sub main :main
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(1)
+    $P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
     $P1.'encoding'("utf8")
     set $S0, unicode:"aaaaaa\x{212b}-aaaaaa"
     print $S0
@@ -80,9 +84,10 @@
 OUTPUT
 
 pir_output_is( <<'CODE', <<OUTPUT, 'escaped angstrom 3 \uhhhh' );
+.include 'stdio.pasm'
 .sub main :main
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(1)
+    $P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
     $P1.'encoding'("utf8")
     set $S0, unicode:"aaaaaa\u212b-aaaaaa"
     print $S0
@@ -94,9 +99,10 @@
 OUTPUT
 
 pir_output_is( <<'CODE', <<OUTPUT, "MATHEMATICAL BOLD CAPITAL A" );
+.include 'stdio.pasm'
 .sub main :main
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(1)
+    $P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
     $P1.'encoding'("utf8")
     set $S0, unicode:"aaaaaa\x{1d400}-aaaaaa"
     print $S0
@@ -108,9 +114,10 @@
 OUTPUT
 
 pir_output_is( <<'CODE', <<OUTPUT, 'MATHEMATICAL BOLD CAPITAL A \U' );
+.include 'stdio.pasm'
 .sub main :main
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(1)
+    $P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
     $P1.'encoding'("utf8")
     set $S0, unicode:"aaaaaa\U0001d400-aaaaaa"
     print $S0
@@ -122,9 +129,10 @@
 OUTPUT
 
 pir_output_is( <<'CODE', <<OUTPUT, "two upscales" );
+.include 'stdio.pasm'
 .sub main :main
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(1)
+    $P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
     $P1.'encoding'("utf8")
     set $S0, unicode:"aaaaaa\x{212b}-bbbbbb\x{1d400}-cccccc"
     print $S0
@@ -140,9 +148,10 @@
 OUTPUT
 
 pir_output_is( <<'CODE', <<OUTPUT, "two upscales - don't downscale" );
+.include 'stdio.pasm'
 .sub main :main
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(1)
+    $P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
     $P1.'encoding'("utf8")
     set $S0, unicode:"aaaaaa\x{1d400}-bbbbbb\x{212b}-cccccc"
     print $S0
@@ -158,9 +167,10 @@
 OUTPUT
 
 pir_output_is( <<'CODE', <<OUTPUT, '\cX, \ooo' );
+.include 'stdio.pasm'
 .sub main :main
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(1)
+    $P1 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
     $P1.'encoding'("utf8")
     set $S0, "ok 1\cJ"
     print $S0

Modified: trunk/t/pmc/io.t
==============================================================================
--- trunk/t/pmc/io.t	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/t/pmc/io.t	Sun Jun  6 04:41:48 2010	(r47421)
@@ -399,20 +399,21 @@
 
 # TT #1178
 pir_output_is( <<'CODE', <<'OUT', 'standard file descriptors' );
+.include 'stdio.pasm'
 .sub main :main
     $P99 = getinterp
-    $P0  = $P99.'stdhandle'(0)
+    $P0  = $P99.'stdhandle'(.PIO_STDIN_FILENO)
     $I0  = $P0.'get_fd'()
     # I0 is 0 on Unix and non-Null on stdio and win32
     print "ok 1\n"
 
-    $P1 = $P99.'stdhandle'(1)
+    $P1 = $P99.'stdhandle'(.PIO_STDOUT_FILENO)
     $I1 = $P1.'get_fd'()
     if $I1, OK_2
     print "not "
 OK_2:
     say "ok 2"
-    $P2 = $P99.'stdhandle'(2)
+    $P2 = $P99.'stdhandle'(.PIO_STDERR_FILENO)
     $I2 = $P2.'get_fd'()
     if $I2, OK_3
     print "not "
@@ -445,9 +446,10 @@
 OUTPUT
 
 pir_output_is( <<'CODE', <<'OUTPUT', 'puts method' );
+.include 'stdio.pasm'
 .sub main :main
     $P0 = getinterp
-    $P2 = $P0.'stdhandle'(1)
+    $P2 = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
     can $I0, $P2, "puts"
     if $I0, ok1
     print "not "
@@ -461,13 +463,13 @@
 OUTPUT
 
 pir_output_is( <<'CODE', <<'OUTPUT', 'puts method - PIR' );
-
+.include 'stdio.pasm'
 .sub main :main
    .local string s
    s = "ok 2\n"
    .local pmc io
    $P0 = getinterp
-   io = $P0.'stdhandle'(1)
+   io = $P0.'stdhandle'(.PIO_STDOUT_FILENO)
    $I0 = can io, "puts"
    if $I0 goto ok1
    print "not "

Modified: trunk/tools/dev/nci_thunk_gen.pir
==============================================================================
--- trunk/tools/dev/nci_thunk_gen.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/tools/dev/nci_thunk_gen.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -48,7 +48,8 @@
     $P0 = new ['FileHandle']
     $P0.'open'($S0, 'w')
     $P1 = getinterp
-    $P1.'stdhandle'(1, $P0)
+    .include 'stdio.pasm'
+    $P1.'stdhandle'(.PIO_STDOUT_FILENO, $P0)
 
     if targ == 'head'          goto get_targ
     if targ == 'thunks'        goto get_targ
@@ -711,7 +712,8 @@
 .sub 'read_sigs'
     .local pmc stdin, seen, sigs
     $P0 = getinterp
-    stdin = $P0.'stdhandle'(0)
+    .include 'stdio.pasm'
+    stdin = $P0.'stdhandle'(.PIO_STDIN_FILENO)
     seen  = new ['Hash']
     sigs  = new ['ResizablePMCArray']
 
@@ -739,7 +741,8 @@
 Ignored signature '%s' on line %d (previously seen on line %d)
 ERROR
                 $P0 = getinterp
-                $P1 = $P0.'stdhandle'(2)
+                .include 'stdio.pasm'
+                $P1 = $P0.'stdhandle'(.PIO_STDERR_FILENO)
                 $P1.'print'($S0)
             end_dup_warn:
             goto read_loop

Modified: trunk/tools/util/parrot-config.pir
==============================================================================
--- trunk/tools/util/parrot-config.pir	Sun Jun  6 04:04:09 2010	(r47420)
+++ trunk/tools/util/parrot-config.pir	Sun Jun  6 04:41:48 2010	(r47421)
@@ -89,7 +89,8 @@
 usage:
     $S0 = argv[0]
     $P0 = getinterp
-    $P1 = $P0.'stdhandle'(2)
+    .include 'stdio.pasm'
+    $P1 = $P0.'stdhandle'(.PIO_STDERR_FILENO)
     $P1.'print'($S0)
     $P1.'print'(" [ <config-key> | --dump | --help ]\n")
     exit 1


More information about the parrot-commits mailing list