[svn:parrot] r39789 - branches/io_cleanups/src/io

whiteknight at svn.parrot.org whiteknight at svn.parrot.org
Fri Jun 26 01:19:43 UTC 2009


Author: whiteknight
Date: Fri Jun 26 01:19:42 2009
New Revision: 39789
URL: https://trac.parrot.org/parrot/changeset/39789

Log:
[io_cleanups] fixup the filehandle API a little bit. use GETATTR/SETATTR for attributes which are currently overridable from PIR

Modified:
   branches/io_cleanups/src/io/filehandle.c
   branches/io_cleanups/src/io/io_private.h

Modified: branches/io_cleanups/src/io/filehandle.c
==============================================================================
--- branches/io_cleanups/src/io/filehandle.c	Fri Jun 26 00:44:14 2009	(r39788)
+++ branches/io_cleanups/src/io/filehandle.c	Fri Jun 26 01:19:42 2009	(r39789)
@@ -140,11 +140,6 @@
 Sets the C<os_handle> attribute of the FileHandle object, which stores the
 low-level filehandle for the OS.
 
-Currently, this pokes directly into the C struct of the FileHandle PMC. This
-needs to change to a general interface that can be used by all subclasses and
-polymorphic equivalents of FileHandle. For now, hiding it behind a function, so
-it can be cleanly changed later.
-
 Possibly, this function should reset some characteristics of the object (like
 buffer and file positions) to their default values.
 
@@ -154,10 +149,10 @@
 
 PARROT_EXPORT
 void
-Parrot_io_set_os_handle(SHIM_INTERP, ARGIN(PMC *filehandle), PIOHANDLE file_descriptor)
+Parrot_io_set_os_handle(PARROT_INTERP, ARGIN(PMC *filehandle), PIOHANDLE file_descriptor)
 {
     ASSERT_ARGS(Parrot_io_set_os_handle)
-    PARROT_FILEHANDLE(filehandle)->os_handle = file_descriptor;
+    SETATTR_FileHandle_os_handle(interp, filehandle, file_descriptor);
 }
 
 /*
@@ -167,21 +162,18 @@
 Retrieve the C<os_handle> attribute of the FileHandle object, which stores the
 low-level filehandle for the OS.
 
-Currently, this pokes directly into the C struct of the FileHandle PMC. This
-needs to change to a general interface that can be used by all subclasses and
-polymorphic equivalents of FileHandle. For now, hiding it behind a function, so
-it can be cleanly changed later.
-
 =cut
 
 */
 
 PARROT_EXPORT
 PIOHANDLE
-Parrot_io_get_os_handle(SHIM_INTERP, ARGIN(PMC *filehandle))
+Parrot_io_get_os_handle(PARROT_INTERP, ARGIN(PMC *filehandle))
 {
     ASSERT_ARGS(Parrot_io_get_os_handle)
-    return PARROT_FILEHANDLE(filehandle)->os_handle;
+    PIOHANDLE os_handle;
+    GETATTR_FileHandle_os_handle(interp, filehandle, os_handle);
+    return os_handle;
 }
 
 /*
@@ -191,11 +183,6 @@
 Set the C<flags> attribute of the FileHandle object, which stores bitwise flags
 marking filehandle characteristics.
 
-Currently, this pokes directly into the C struct of the FileHandle PMC. This
-needs to change to a general interface that can be used by all subclasses and
-polymorphic equivalents of FileHandle. For now, hiding it behind a function, so
-it can be cleanly changed later.
-
 =cut
 
 */
@@ -215,11 +202,6 @@
 Set the C<flags> attribute of the FileHandle object, which stores bitwise flags
 marking filehandle characteristics.
 
-Currently, this pokes directly into the C struct of the FileHandle PMC. This
-needs to change to a general interface that can be used by all subclasses and
-polymorphic equivalents of FileHandle. For now, hiding it behind a function, so
-it can be cleanly changed later.
-
 =cut
 
 */
@@ -394,21 +376,18 @@
 Get the C<buffer_flags> attribute of the FileHandle object, which stores
 a collection of flags specific to the buffer.
 
-Currently, this pokes directly into the C struct of the FileHandle PMC. This
-needs to change to a general interface that can be used by all subclasses and
-polymorphic equivalents of FileHandle. For now, hiding it behind a function, so
-it can be cleanly changed later.
-
 =cut
 
 */
 
 PARROT_CAN_RETURN_NULL
 INTVAL
-Parrot_io_get_buffer_flags(SHIM_INTERP, ARGIN(PMC *filehandle))
+Parrot_io_get_buffer_flags(PARROT_INTERP, ARGIN(PMC *filehandle))
 {
     ASSERT_ARGS(Parrot_io_get_buffer_flags)
-    return PARROT_FILEHANDLE(filehandle)->buffer_flags;
+    INTVAL buffer_flags;
+    GETATTR_FileHandle_buffer_flags(interp, filehandle, buffer_flags);
+    return buffer_flags;
 }
 
 /*
@@ -419,20 +398,15 @@
 Set the C<buffer_flags> attribute of the FileHandle object, which stores
 a collection of flags specific to the buffer.
 
-Currently, this pokes directly into the C struct of the FileHandle PMC. This
-needs to change to a general interface that can be used by all subclasses and
-polymorphic equivalents of FileHandle. For now, hiding it behind a function, so
-it can be cleanly changed later.
-
 =cut
 
 */
 
 void
-Parrot_io_set_buffer_flags(SHIM_INTERP, ARGIN(PMC *filehandle), INTVAL new_flags)
+Parrot_io_set_buffer_flags(PARROT_INTERP, ARGIN(PMC *filehandle), INTVAL new_flags)
 {
     ASSERT_ARGS(Parrot_io_set_buffer_flags)
-    PARROT_FILEHANDLE(filehandle)->buffer_flags = new_flags;
+    SETATTR_FileHandle_buffer_flags(interp, filehandle, new_flags);
 }
 
 /*

Modified: branches/io_cleanups/src/io/io_private.h
==============================================================================
--- branches/io_cleanups/src/io/io_private.h	Fri Jun 26 00:44:14 2009	(r39788)
+++ branches/io_cleanups/src/io/io_private.h	Fri Jun 26 01:19:42 2009	(r39789)
@@ -32,9 +32,7 @@
 #include <parrot/io.h>
 
 #if PARROT_NETWORKING_SUPPORT
-/* XXX: Parrot config is currently not probing for all headers so
- * I'm sticking here rather than parrot.h
- */
+
 #  ifdef UNIX
 #    include <sys/socket.h>
 #  endif
@@ -108,7 +106,6 @@
 
 */
 
-
 /*
  * Local variables:
  *   c-file-style: "parrot"


More information about the parrot-commits mailing list