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

[svn:parrot] r34469 - in branches/pdd22io_part3/src: io pmc

From:
allison
Date:
December 27, 2008 23:01
Subject:
[svn:parrot] r34469 - in branches/pdd22io_part3/src: io pmc
Message ID:
20081228070150.E3DF1CB9B0@x12.develooper.com
Author: allison
Date: Sat Dec 27 23:01:50 2008
New Revision: 34469

Modified:
   branches/pdd22io_part3/src/io/api.c
   branches/pdd22io_part3/src/pmc/filehandle.pmc

Log:
[pdd22io] Invert the test for 'eof' so public interface calls a method on the
filehandle object.


Modified: branches/pdd22io_part3/src/io/api.c
==============================================================================
--- branches/pdd22io_part3/src/io/api.c	(original)
+++ branches/pdd22io_part3/src/io/api.c	Sat Dec 27 23:01:50 2008
@@ -339,13 +339,18 @@
 INTVAL
 Parrot_io_eof(PARROT_INTERP, ARGMOD(PMC *pmc))
 {
+    INTVAL result;
+
     /* io could be null here, but rather than return a negative error
      * we just fake EOF since eof test is usually in a boolean context.
      */
-    if (PMC_IS_NULL(pmc) || Parrot_io_is_closed(interp, pmc))
+    if (PMC_IS_NULL(pmc))
             return 1;
 
-    return (Parrot_io_get_flags(interp, pmc) & (PIO_F_EOF)) ? 1 : 0;
+    Parrot_PCCINVOKE(interp, pmc, CONST_STRING(interp, "eof"), "->I",
+            &result);
+
+    return result;
 
 }
 

Modified: branches/pdd22io_part3/src/pmc/filehandle.pmc
==============================================================================
--- branches/pdd22io_part3/src/pmc/filehandle.pmc	(original)
+++ branches/pdd22io_part3/src/pmc/filehandle.pmc	Sat Dec 27 23:01:50 2008
@@ -654,7 +654,12 @@
 */
 
     METHOD eof() {
-        if (Parrot_io_eof(INTERP, SELF))
+        INTVAL flags;
+        if (Parrot_io_is_closed_filehandle(interp, SELF))
+            RETURN(INTVAL 1);
+
+        GET_ATTR_flags(INTERP, SELF, flags);
+        if (flags & PIO_F_EOF)
             RETURN(INTVAL 1);
 
         RETURN(INTVAL 0);



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