[svn:parrot] r49079 - branches/stdhandle_meths/src/pmc

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Fri Sep 17 13:11:00 UTC 2010


Author: whiteknight
Date: Fri Sep 17 13:10:59 2010
New Revision: 49079
URL: https://trac.parrot.org/parrot/changeset/49079

Log:
delete the stdhandles method and add new stdin_handle, stdout_handle, stderr_handle methods

Modified:
   branches/stdhandle_meths/src/pmc/parrotinterpreter.pmc

Modified: branches/stdhandle_meths/src/pmc/parrotinterpreter.pmc
==============================================================================
--- branches/stdhandle_meths/src/pmc/parrotinterpreter.pmc	Fri Sep 17 12:47:35 2010	(r49078)
+++ branches/stdhandle_meths/src/pmc/parrotinterpreter.pmc	Fri Sep 17 13:10:59 2010	(r49079)
@@ -828,23 +828,55 @@
 
 /*
 
-=item METHOD stdhandle(INTVAL fileno, PMC *newhandle :optional)
+=item METHOD stdin_handle(PMC *newhandle :optional)
 
-Returns the standard parrot handler associated with the interpreter.
-The valid values for fileno are listed in include/stdio.pasm
+If a PMC object is provided, the standard input handle for this interpreter
+is set to that PMC, and the new PMC handle is returned.
 
-Optionally sets the parrot handler passed as second argument
-as the specified standard handler.
+If no PMC object is provided, the current standard input handle is returned.
 
-This method is experimental. See TT #264.
+=cut
+
+*/
+
+    METHOD stdin_handle(PMC *newhandle :optional) {
+        PMC * const handle = Parrot_io_stdhandle(INTERP, PIO_STDIN_FILENO, newhandle);
+        RETURN(PMC *handle);
+    }
+
+/*
+
+=item METHOD stdout_handle(PMC *newhandle :optional)
+
+If a PMC object is provided, the standard output handle for this interpreter
+is set to that PMC, and the new PMC handle is returned.
+
+If no PMC object is provided, the current standard output handle is returned.
+
+=cut
+
+*/
+
+    METHOD stdout_handle(PMC *newhandle :optional) {
+        PMC * const handle = Parrot_io_stdhandle(INTERP, PIO_STDOUT_FILENO, newhandle);
+        RETURN(PMC *handle);
+    }
+
+/*
+
+=item METHOD stderr_handle(PMC *newhandle :optional)
+
+If a PMC object is provided, the standard error handle for this interpreter
+is set to that PMC, and the new PMC handle is returned.
+
+If no PMC object is provided, the current standard error handle is returned.
 
 =cut
 
 */
 
-    METHOD stdhandle(INTVAL fileno, PMC *newhandle :optional) {
-        PMC * const handle = Parrot_io_stdhandle(INTERP, fileno, newhandle);
-        Parrot_warn_deprecated(INTERP, "stdhandle method is experimental");
+    METHOD stderr_handle(PMC *newhandle :optional) {
+        PMC * const handle = Parrot_io_stdhandle(INTERP, PIO_STDERR_FILENO, newhandle);
         RETURN(PMC *handle);
     }
 


More information about the parrot-commits mailing list