Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

eof opcode

8 views
Skip to first unread message

Brian Wheeler

unread,
Nov 24, 2004, 4:33:26 PM11/24/04
to perl6-i...@perl.org
I noticed a hole in the io.ops where the PIO stuff wasn't covered. This
patch creates an eof opcode which checks for end of file.

Brian Wheeler
bdwh...@indiana.edu


cvs diff: Diffing .
cvs diff: Diffing ops
Index: ops/io.ops
===================================================================
RCS file: /cvs/public/parrot/ops/io.ops,v
retrieving revision 1.51
diff -u -r1.51 io.ops
--- ops/io.ops 29 Sep 2004 15:44:29 -0000 1.51
+++ ops/io.ops 24 Nov 2004 21:28:57 -0000
@@ -42,6 +42,19 @@

########################################

+=item B<eof>(out INT, in PMC)
+
+Check for end-of-file condition in IO object $2 and return the status
in $1
+
+=cut
+
+inline op eof(out INT, in PMC) :base_io {
+ $1 = PIO_eof(interpreter,$2);
+ goto NEXT();
+}
+
+########################################
+
=item B<fdopen>(out PMC, in INT, in STR)

Create ParrotIO object in $1 as a copy of file descriptor $2.

--
brian wheeler <bdwh...@indiana.edu>

Leopold Toetsch

unread,
Nov 25, 2004, 2:00:25 AM11/25/04
to Brian Wheeler, perl6-i...@perl.org
Brian Wheeler <bdwh...@indiana.edu> wrote:
> I noticed a hole in the io.ops where the PIO stuff wasn't covered. This
> patch creates an eof opcode which checks for end of file.

Please just use the "eof" method of the PIO object:

$I0 = $P0."eof"()

leo

Brian Wheeler

unread,
Nov 29, 2004, 12:23:51 PM11/29/04
to l...@toetsch.at, perl6-i...@perl.org
Fair enough. However, shouldn't the rest of the opcodes with an IO
object as their parameter be methods as well? Its not a lot of ops, but
it would trim down the core a bit.

Brian

--
brian wheeler <bdwh...@indiana.edu>

Dan Sugalski

unread,
Nov 29, 2004, 8:21:29 PM11/29/04
to brian wheeler, l...@toetsch.at, perl6-i...@perl.org
At 12:23 PM -0500 11/29/04, brian wheeler wrote:
>Fair enough. However, shouldn't the rest of the opcodes with an IO
>object as their parameter be methods as well? Its not a lot of ops, but
>it would trim down the core a bit.

They should -- it'll make it easier to abstract things out later when
people start wanting to do bizarre things with pseudo-filehandles.

>On Thu, 2004-11-25 at 08:00 +0100, Leopold Toetsch wrote:
>> Brian Wheeler <bdwh...@indiana.edu> wrote:
>> > I noticed a hole in the io.ops where the PIO stuff wasn't covered. This
>> > patch creates an eof opcode which checks for end of file.
>>
>> Please just use the "eof" method of the PIO object:
>>
> > $I0 = $P0."eof"()

--
Dan

--------------------------------------it's like this-------------------
Dan Sugalski even samurai
d...@sidhe.org have teddy bears and even
teddy bears get drunk

0 new messages