Index: src/ops/ops.num =================================================================== --- src/ops/ops.num (révision 38872) +++ src/ops/ops.num (copie de travail) @@ -1270,3 +1270,4 @@ find_name_p_sc 1246 find_sub_not_null_p_s 1247 find_sub_not_null_p_sc 1248 +setstdin_p 1249 Index: src/ops/io.ops =================================================================== --- src/ops/io.ops (révision 38872) +++ src/ops/io.ops (copie de travail) @@ -46,7 +46,7 @@ =item B(out PMC, in INT, in STR) -Create ParrotIO object in $1 as a copy of file descriptor $2. +Create FileHandle object in $1 as a copy of file descriptor $2. RT#42373: integral file descriptors might not exist outside of the UNIX platform. This op needs work. @@ -61,17 +61,17 @@ =item B(out PMC) -Create a new ParrotIO object for the stdin file descriptor and +Create a new FileHandle object for the stdin file descriptor and store it in $1 =item B(out PMC) -Create a new ParrotIO object for the stdout file descriptor and +Create a new FileHandle object for the stdout file descriptor and store it in $1 =item B(out PMC) -Create a new ParrotIO object for the stderr file descriptor and +Create a new FileHandle object for the stderr file descriptor and store it in $1 =cut @@ -90,19 +90,29 @@ ######################################### +=item B(invar PMC) + +Sets the standard input for a bare C op to go to the supplied FileHandle +PMC. Call C first if you care about retaining the previous PMC. + =item B(invar PMC) -Sets the standard output for a bare C op to go to the supplied ParrotIO +Sets the standard output for a bare C op to go to the supplied FileHandle PMC. Call C first if you care about retaining the previous PMC. =item B(invar PMC) Sets the standard error for a bare C op to go to the supplied -ParrotIO PMC. Call C first if you care about retaining the previous +FileHandle PMC. Call C first if you care about retaining the +previous PMC. =cut +inline op setstdin(invar PMC) :base_io { + _PIO_STDIN(interp) = $1; +} + inline op setstdout(invar PMC) :base_io { _PIO_STDOUT(interp) = $1; } Index: docs/book/ch10_opcode_reference.pod =================================================================== --- docs/book/ch10_opcode_reference.pod (révision 38872) +++ docs/book/ch10_opcode_reference.pod (copie de travail) @@ -846,7 +846,7 @@ fdopen R, R, R -Get a ParrotIO object for handle R with open mode R. +Get a FileHandle object for handle R with open mode R. I @@ -1124,7 +1124,7 @@ getstdin R getstdout R -Get a ParrotIO object for the given standard handle. +Get a FileHandle object for the given standard handle. I @@ -1787,7 +1787,7 @@ peek R peek R, R -Read the next byte from the given ParrotIO object or from C but +Read the next byte from the given FileHandle object or from C but don't remove it. I @@ -2235,11 +2235,13 @@ X X +X setstderr R setstdout R + setstdin R -Set a ParrotIO object for the given standard handle. +Set a FileHandle object for the given standard handle. I @@ -2714,7 +2716,7 @@ tell R, R tell R, R, R -Return the file position of the given ParrotIO object. +Return the file position of the given FileHandle object. I