[svn:parrot] r39195 - branches/io_rewiring/src/pmc
whiteknight at svn.parrot.org
whiteknight at svn.parrot.org
Wed May 27 13:28:58 UTC 2009
Author: whiteknight
Date: Wed May 27 13:28:57 2009
New Revision: 39195
URL: https://trac.parrot.org/parrot/changeset/39195
Log:
[io_rewiring] Create Handle PMC type, start abstracting stuff into it.
Added:
branches/io_rewiring/src/pmc/handle.pmc
Modified:
branches/io_rewiring/src/pmc/filehandle.pmc
branches/io_rewiring/src/pmc/socket.pmc
Modified: branches/io_rewiring/src/pmc/filehandle.pmc
==============================================================================
--- branches/io_rewiring/src/pmc/filehandle.pmc Wed May 27 12:59:13 2009 (r39194)
+++ branches/io_rewiring/src/pmc/filehandle.pmc Wed May 27 13:28:57 2009 (r39195)
@@ -43,12 +43,11 @@
# define PIO_INVALID_HANDLE NULL
#endif
-pmclass FileHandle need_ext {
+pmclass FileHandle extends Handle need_ext {
ATTR INTVAL flags; /* Filehandle flags */
ATTR STRING *filename; /* The opened path and filename */
ATTR STRING *mode; /* The mode string used in open */
ATTR STRING *encoding; /* The encoding for read/write */
- ATTR PIOHANDLE os_handle; /* Low level OS descriptor */
ATTR INTVAL process_id; /* Child process on pipes */
ATTR PIOOFF_T file_size; /* Current file size */
ATTR PIOOFF_T file_pos; /* Current real file pointer */
Added: branches/io_rewiring/src/pmc/handle.pmc
==============================================================================
--- /dev/null 00:00:00 1970 (empty, because file is newly added)
+++ branches/io_rewiring/src/pmc/handle.pmc Wed May 27 13:28:57 2009 (r39195)
@@ -0,0 +1,48 @@
+/*
+Copyright (C) 2008, Parrot Foundation.
+$Id: socket.pmc 38794 2009-05-15 16:12:33Z coke $
+
+=head1 NAME
+
+src/pmc/handle.pmc - IO Handle PMC
+
+=head1 DESCRIPTION
+
+This is the base-class for all IO-related PMCs.
+
+=head2 Vtable Functions
+
+=over 4
+
+=cut
+
+*/
+
+#include "../src/io/io_private.h"
+
+pmclass Handle provides Handle need_ext {
+ /* TODO: Consider encapsulating PIOHANDLE as a PMC type, for subclassing */
+ ATTR PIOHANDLE os_handle; /* Low level OS descriptor */
+
+ VTABLE void init() {
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
+ "Handle cannot be instantiated directly.");
+ }
+
+ VTABLE void init_pmc(PMC * init) {
+ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_INVALID_OPERATION,
+ "Handle cannot be instantiated directly.");
+ }
+
+ VTABLE INTVAL does(STRING * role) {
+ /* TODO: Handle should does "IO" */
+ return 0;
+ }
+}
+
+/*
+ * Local variables:
+ * c-file-style: "parrot"
+ * End:
+ * vim: expandtab shiftwidth=4:
+ */
Modified: branches/io_rewiring/src/pmc/socket.pmc
==============================================================================
--- branches/io_rewiring/src/pmc/socket.pmc Wed May 27 12:59:13 2009 (r39194)
+++ branches/io_rewiring/src/pmc/socket.pmc Wed May 27 13:28:57 2009 (r39195)
@@ -20,7 +20,7 @@
#include "../src/io/io_private.h"
-pmclass Socket extends FileHandle need_ext {
+pmclass Socket extends Handle need_ext {
ATTR PMC *local; /* Local addr */
ATTR PMC *remote; /* Remote addr */
More information about the parrot-commits
mailing list