Front page | perl.cvs.parrot |
Postings from December 2008
[svn:parrot] r34407 - in branches/pdd22io_part3: include/parrot src/io src/pmc
From:
allison
Date:
December 26, 2008 21:52
Subject:
[svn:parrot] r34407 - in branches/pdd22io_part3: include/parrot src/io src/pmc
Message ID:
20081227055242.C9075CBA12@x12.develooper.com
Author: allison
Date: Fri Dec 26 21:52:41 2008
New Revision: 34407
Modified:
branches/pdd22io_part3/include/parrot/io.h
branches/pdd22io_part3/src/io/api.c
branches/pdd22io_part3/src/io/filehandle.c
branches/pdd22io_part3/src/pmc/filehandle.pmc
Log:
[pdd22io] Invert 'flush', so public interface calls method on filehandle
object, for clean polymorphic substitution.
Modified: branches/pdd22io_part3/include/parrot/io.h
==============================================================================
--- branches/pdd22io_part3/include/parrot/io.h (original)
+++ branches/pdd22io_part3/include/parrot/io.h Fri Dec 26 21:52:41 2008
@@ -435,6 +435,12 @@
FUNC_MODIFIES(*pmc);
PARROT_EXPORT
+void Parrot_io_flush_filehandle(PARROT_INTERP, ARGMOD(PMC *pmc))
+ __attribute__nonnull__(1)
+ __attribute__nonnull__(2)
+ FUNC_MODIFIES(*pmc);
+
+PARROT_EXPORT
PARROT_CAN_RETURN_NULL
unsigned char * Parrot_io_get_buffer_end(SHIM_INTERP,
ARGIN_NULLOK(PMC *filehandle));
Modified: branches/pdd22io_part3/src/io/api.c
==============================================================================
--- branches/pdd22io_part3/src/io/api.c (original)
+++ branches/pdd22io_part3/src/io/api.c Fri Dec 26 21:52:41 2008
@@ -197,14 +197,10 @@
void
Parrot_io_flush(PARROT_INTERP, ARGMOD(PMC *pmc))
{
- INTVAL ignored;
-
- if (Parrot_io_is_closed(interp, pmc))
+ if (PMC_IS_NULL(pmc))
return;
- Parrot_io_flush_buffer(interp, pmc);
- ignored = PIO_FLUSH(interp, pmc);
- UNUSED(ignored);
+ Parrot_PCCINVOKE(interp, pmc, CONST_STRING(interp, "flush"), "->");
}
/*
Modified: branches/pdd22io_part3/src/io/filehandle.c
==============================================================================
--- branches/pdd22io_part3/src/io/filehandle.c (original)
+++ branches/pdd22io_part3/src/io/filehandle.c Fri Dec 26 21:52:41 2008
@@ -726,6 +726,26 @@
return PIO_IS_CLOSED(interp, pmc);
}
+/*
+
+=item C<void Parrot_io_flush_filehandle>
+
+Flushes the C<FileHandle> PMC C<*pmc>.
+
+=cut
+
+*/
+
+PARROT_EXPORT
+void
+Parrot_io_flush_filehandle(PARROT_INTERP, ARGMOD(PMC *pmc))
+{
+ if (Parrot_io_is_closed(interp, pmc))
+ return;
+
+ Parrot_io_flush_buffer(interp, pmc);
+ PIO_FLUSH(interp, pmc);
+}
/*
Modified: branches/pdd22io_part3/src/pmc/filehandle.pmc
==============================================================================
--- branches/pdd22io_part3/src/pmc/filehandle.pmc (original)
+++ branches/pdd22io_part3/src/pmc/filehandle.pmc Fri Dec 26 21:52:41 2008
@@ -146,7 +146,7 @@
if (!Parrot_io_is_closed_filehandle(INTERP, SELF)) {
if (data_struct->flags & PIO_F_SHARED)
- Parrot_io_flush(INTERP, SELF);
+ Parrot_io_flush_filehandle(INTERP, SELF);
else
Parrot_io_close_filehandle(INTERP, SELF);
}
@@ -447,7 +447,7 @@
*/
METHOD flush() {
- Parrot_io_flush(interp, SELF);
+ Parrot_io_flush_filehandle(interp, SELF);
}
/*
-
[svn:parrot] r34407 - in branches/pdd22io_part3: include/parrot src/io src/pmc
by allison