cvsuser 03/10/09 19:43:10
Modified: io io.c io_buf.c
Log:
Fill in stubs for PIOCTL commands
Revision Changes Path
1.57 +26 -4 parrot/io/io.c
Index: io.c
===================================================================
RCS file: /cvs/public/parrot/io/io.c,v
retrieving revision 1.56
retrieving revision 1.57
diff -u -w -r1.56 -r1.57
--- io.c 10 Oct 2003 01:38:57 -0000 1.56
+++ io.c 10 Oct 2003 02:43:10 -0000 1.57
@@ -1,7 +1,7 @@
/* io.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: io.c,v 1.56 2003/10/10 01:38:57 mrjoltcola Exp $
+ * $Id: io.c,v 1.57 2003/10/10 02:43:10 mrjoltcola Exp $
* Overview:
* This is the Parrot IO subsystem API. Generic IO stuff
* goes here, each specific layer goes in its own file...
@@ -489,10 +489,32 @@
switch(cmd) {
case PIOCTL_CMDSETRECSEP: io->recsep = arg;
+
case PIOCTL_CMDGETRECSEP: return io->recsep;
- case PIOCTL_CMDSETBUFTYPE: return -3; /* XXX FIXME */
- case PIOCTL_CMDGETBUFTYPE: return -4; /* XXX FIXME */
- case PIOCTL_CMDSETBUFSIZE: return -5; /* XXX FIXME */
+
+ case PIOCTL_CMDSETBUFTYPE:
+ if(arg == PIOCTL_NONBUF) {
+ PIO_setbuf(interpreter, pmc, 0);
+ return 0;
+ }
+ else if(arg == PIOCTL_LINEBUF) {
+ PIO_setlinebuf(interpreter, pmc);
+ return 0;
+ }
+ else if(arg == PIOCTL_BLKBUF) {
+ PIO_setbuf(interpreter, pmc, PIO_UNBOUND);
+ return 0;
+ }
+ else return -3;
+
+ case PIOCTL_CMDGETBUFTYPE:
+ if(io->flags & PIO_F_LINEBUF) return PIOCTL_LINEBUF;
+ if(io->flags & PIO_F_BLKBUF) return PIOCTL_BLKBUF;
+ return PIOCTL_NONBUF;
+
+ case PIOCTL_CMDSETBUFSIZE:
+ return PIO_setbuf(interpreter, pmc, arg);
+
case PIOCTL_CMDGETBUFSIZE:
if(b) return b->size;
else return -6;
1.15 +9 -2 parrot/io/io_buf.c
Index: io_buf.c
===================================================================
RCS file: /cvs/public/parrot/io/io_buf.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -w -r1.14 -r1.15
--- io_buf.c 10 Oct 2003 02:19:05 -0000 1.14
+++ io_buf.c 10 Oct 2003 02:43:10 -0000 1.15
@@ -1,7 +1,7 @@
/* io_buf.c
* Copyright: 2001-2003 The Perl Foundation. All Rights Reserved.
* CVS Info
- * $Id: io_buf.c,v 1.14 2003/10/10 02:19:05 mrjoltcola Exp $
+ * $Id: io_buf.c,v 1.15 2003/10/10 02:43:10 mrjoltcola Exp $
* Overview:
* The "buf" layer of Parrot IO. Buffering and all the fun stuff.
*
@@ -112,6 +112,8 @@
{
ParrotIOLayer *l = layer;
ParrotIOBuf *b = &io->b;
+ if(!l)
+ l = io->stack;
/* If there is a buffer, make sure we flush before
* dinking around with the buffer.
*/
@@ -146,9 +148,14 @@
static INTVAL
-PIO_buf_setlinebuf(theINTERP, ParrotIOLayer *l, ParrotIO *io)
+PIO_buf_setlinebuf(theINTERP, ParrotIOLayer *layer, ParrotIO *io)
{
int err;
+ ParrotIOLayer * l;
+
+ l = layer;
+ if(!l)
+ l = io->stack;
/* already linebuffering */
if (io->flags & PIO_F_LINEBUF)