develooper Front page | perl.cvs.parrot | Postings from November 2008

[svn:parrot] r32632 - branches/pdd22io/src/pmc

From:
allison
Date:
November 13, 2008 20:28
Subject:
[svn:parrot] r32632 - branches/pdd22io/src/pmc
Message ID:
20081114042847.119CDCB9AF@x12.develooper.com
Author: allison
Date: Thu Nov 13 20:28:46 2008
New Revision: 32632

Modified:
   branches/pdd22io/src/pmc/filehandle.pmc

Log:
[pdd22io] Implement 'readline' method on FileHandle PMC.


Modified: branches/pdd22io/src/pmc/filehandle.pmc
==============================================================================
--- branches/pdd22io/src/pmc/filehandle.pmc	(original)
+++ branches/pdd22io/src/pmc/filehandle.pmc	Thu Nov 13 20:28:46 2008
@@ -19,6 +19,7 @@
 */
 
 #include "parrot/parrot.h"
+#include "../src/io/io_private.h"
 
 
 pmclass FileHandle need_ext {
@@ -223,6 +224,26 @@
 
 /*
 
+=item C<METHOD readline()>
+
+Read a line from the filehandle and return it in a string.
+
+=cut
+
+*/
+
+    METHOD readline() {
+        STRING *string_result;
+        if (!(PARROT_FILEHANDLE(SELF)->flags & PIO_F_LINEBUF))
+            Parrot_io_setlinebuf(INTERP, SELF);
+
+        string_result = Parrot_io_reads(INTERP, SELF, 0);
+
+        RETURN(STRING *string_result);
+    }
+
+/*
+
 =item C<METHOD print([INTVAL|FLOATVAL|STRING *|PMC*] value)>
 
 Print the passed in integer, number, string, or PMC to the filehandle.



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About