Ticket #680: setstdin.patch
File setstdin.patch, 3.7 KB (added by flh, 13 years ago) |
---|
-
src/ops/ops.num
1270 1270 find_name_p_sc 1246 1271 1271 find_sub_not_null_p_s 1247 1272 1272 find_sub_not_null_p_sc 1248 1273 setstdin_p 1249 -
src/ops/io.ops
46 46 47 47 =item B<fdopen>(out PMC, in INT, in STR) 48 48 49 Create ParrotIOobject in $1 as a copy of file descriptor $2.49 Create FileHandle object in $1 as a copy of file descriptor $2. 50 50 51 51 RT#42373: integral file descriptors might not exist outside of the UNIX 52 52 platform. This op needs work. … … 61 61 62 62 =item B<getstdin>(out PMC) 63 63 64 Create a new ParrotIOobject for the stdin file descriptor and64 Create a new FileHandle object for the stdin file descriptor and 65 65 store it in $1 66 66 67 67 =item B<getstdout>(out PMC) 68 68 69 Create a new ParrotIOobject for the stdout file descriptor and69 Create a new FileHandle object for the stdout file descriptor and 70 70 store it in $1 71 71 72 72 =item B<getstderr>(out PMC) 73 73 74 Create a new ParrotIOobject for the stderr file descriptor and74 Create a new FileHandle object for the stderr file descriptor and 75 75 store it in $1 76 76 77 77 =cut … … 90 90 91 91 ######################################### 92 92 93 =item B<setstdin>(invar PMC) 94 95 Sets the standard input for a bare C<read> op to go to the supplied FileHandle 96 PMC. Call C<getstdin> first if you care about retaining the previous PMC. 97 93 98 =item B<setstdout>(invar PMC) 94 99 95 Sets the standard output for a bare C<print> op to go to the supplied ParrotIO100 Sets the standard output for a bare C<print> op to go to the supplied FileHandle 96 101 PMC. Call C<getstdout> first if you care about retaining the previous PMC. 97 102 98 103 =item B<setstderr>(invar PMC) 99 104 100 105 Sets the standard error for a bare C<printerr> op to go to the supplied 101 ParrotIO PMC. Call C<getstderr> first if you care about retaining the previous 106 FileHandle PMC. Call C<getstderr> first if you care about retaining the 107 previous 102 108 PMC. 103 109 104 110 =cut 105 111 112 inline op setstdin(invar PMC) :base_io { 113 _PIO_STDIN(interp) = $1; 114 } 115 106 116 inline op setstdout(invar PMC) :base_io { 107 117 _PIO_STDOUT(interp) = $1; 108 118 } -
docs/book/ch10_opcode_reference.pod
846 846 847 847 fdopen R<DEST>, R<INT>, R<MODE> 848 848 849 Get a ParrotIOobject for handle R<INT> with open mode R<MODE>.849 Get a FileHandle object for handle R<INT> with open mode R<MODE>. 850 850 851 851 I<Arguments: P, I, S> 852 852 … … 1124 1124 getstdin R<DEST> 1125 1125 getstdout R<DEST> 1126 1126 1127 Get a ParrotIOobject for the given standard handle.1127 Get a FileHandle object for the given standard handle. 1128 1128 1129 1129 I<Arguments: P> 1130 1130 … … 1787 1787 peek R<DEST> 1788 1788 peek R<DEST>, R<PIO> 1789 1789 1790 Read the next byte from the given ParrotIOobject or from C<stdin> but1790 Read the next byte from the given FileHandle object or from C<stdin> but 1791 1791 don't remove it. 1792 1792 1793 1793 I<Arguments: SR or SR, P> … … 2235 2235 2236 2236 X<setstderr opcode (PASM)> 2237 2237 X<setstdout opcode (PASM)> 2238 X<setstdin opcode (PASM)> 2238 2239 2239 2240 setstderr R<DEST> 2240 2241 setstdout R<DEST> 2242 setstdin R<DEST> 2241 2243 2242 Set a ParrotIOobject for the given standard handle.2244 Set a FileHandle object for the given standard handle. 2243 2245 2244 2246 I<Arguments: P> 2245 2247 … … 2714 2716 tell R<DEST>, R<PIO> 2715 2717 tell R<UPPER32>, R<LOWER32>, R<PIO> 2716 2718 2717 Return the file position of the given ParrotIOobject.2719 Return the file position of the given FileHandle object. 2718 2720 2719 2721 I<Arguments: IR, P or IR, I, P> 2720 2722