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

[svn:parrot] r34609 - branches/pdd22io_part3/src/pmc

From:
allison
Date:
December 29, 2008 19:43
Subject:
[svn:parrot] r34609 - branches/pdd22io_part3/src/pmc
Message ID:
20081230034346.11357CB9FA@x12.develooper.com
Author: allison
Date: Mon Dec 29 19:43:45 2008
New Revision: 34609

Modified:
   branches/pdd22io_part3/src/pmc/stringhandle.pmc

Log:
[pdd22io] StringHandle check for end-of-file needs to take offset into account.


Modified: branches/pdd22io_part3/src/pmc/stringhandle.pmc
==============================================================================
--- branches/pdd22io_part3/src/pmc/stringhandle.pmc	(original)
+++ branches/pdd22io_part3/src/pmc/stringhandle.pmc	Mon Dec 29 19:43:45 2008
@@ -500,14 +500,22 @@
 
 =item C<METHOD eof()>
 
-StringHandles are never at the end-of-file, they always read the entire string
-from the beginning. Returns false.
+Check if the StringHandle is at end-of-file (if it has read to the end of the
+string data).
 
 =cut
 
 */
 
     METHOD eof() {
+        STRING *stringhandle;
+        INTVAL offset;
+        GET_ATTR_stringhandle(INTERP, SELF, stringhandle);
+        GET_ATTR_read_offset(INTERP, SELF, offset);
+
+        if (offset >= string_length(INTERP, stringhandle))
+            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