cvsuser     03/11/17 09:22:06

  Modified:    include/parrot io.h
               io       io.c io_buf.c io_stdio.c io_unix.c io_win32.c
  Log:
  Move PIO_isatty from macro to function
  
  PIO_isatty is no longer a macro hardcoding a layer, but a function.
  The arguments of this function also changed: They take an interpreter as
  all Parrot functions and use an IO-PMC instead of a PIOHANDLE.
  
  The helperfunctions PIO_{unix,stdio,win32}_isatty are moved to the
  io_{unix,stdio,win32}.c files and are declared static.
  
  Revision  Changes    Path
  1.51      +4 -7      parrot/include/parrot/io.h
  
  Index: io.h
  ===================================================================
  RCS file: /cvs/public/parrot/include/parrot/io.h,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -w -r1.50 -r1.51
  --- io.h      7 Nov 2003 12:12:26 -0000       1.50
  +++ io.h      17 Nov 2003 17:22:02 -0000      1.51
  @@ -1,7 +1,7 @@
   /* io.h
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *     $Id: io.h,v 1.50 2003/11/07 12:12:26 boemmels Exp $
  + *     $Id: io.h,v 1.51 2003/11/17 17:22:02 boemmels Exp $
    *  Overview:
    *      Parrot IO subsystem
    *  Data Structure and Algorithms:
  @@ -288,27 +288,24 @@
   
   extern void Parrot_IOData_mark(theINTERP, ParrotIOData *piodata);
   
  +extern INTVAL PIO_isatty(theINTERP, PMC *io);
  +
   /* Put platform specific macros here if you must */
   #ifdef PIO_OS_WIN32
  -extern INTVAL           PIO_win32_isatty(PIOHANDLE fd);
   extern STRING          *PIO_sockaddr_in(theINTERP, unsigned short, STRING *);
   extern INTVAL           PIO_win32_getblksize(PIOHANDLE fd);
  -#  define PIO_isatty(x)   PIO_win32_isatty(x)
   #  define PIO_getblksize(x)   PIO_win32_getblksize(x)
   #endif
   
   #ifdef PIO_OS_UNIX
  -extern INTVAL           PIO_unix_isatty(PIOHANDLE fd);
   extern STRING          *PIO_sockaddr_in(theINTERP, unsigned short, STRING *);
   extern INTVAL           PIO_unix_getblksize(PIOHANDLE fd);
  -#  define PIO_isatty(x)   PIO_unix_isatty(x)
   #  define PIO_getblksize(x)   PIO_unix_getblksize(x)
   #endif
   
   #ifdef PIO_OS_STDIO
   extern INTVAL           PIO_stdio_isatty(PIOHANDLE fd);
   extern INTVAL           PIO_stdio_getblksize(PIOHANDLE fd);
  -#  define PIO_isatty(x)   PIO_stdio_isatty(x)
   #  define PIO_sockaddr_in(i,p,a)
   #  define PIO_getblksize(x)   PIO_stdio_getblksize(x)
   #endif
  
  
  
  1.73      +13 -2     parrot/io/io.c
  
  Index: io.c
  ===================================================================
  RCS file: /cvs/public/parrot/io/io.c,v
  retrieving revision 1.72
  retrieving revision 1.73
  diff -u -w -r1.72 -r1.73
  --- io.c      7 Nov 2003 12:12:30 -0000       1.72
  +++ io.c      17 Nov 2003 17:22:05 -0000      1.73
  @@ -1,7 +1,7 @@
   /* io.c
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *      $Id: io.c,v 1.72 2003/11/07 12:12:30 boemmels Exp $
  + *      $Id: io.c,v 1.73 2003/11/17 17:22:05 boemmels Exp $
    *  Overview:
    *      This is the Parrot IO subsystem API.  Generic IO stuff
    *      goes here, each specific layer goes in its own file...
  @@ -937,6 +937,17 @@
   }
   
   
  +INTVAL
  +PIO_isatty(theINTERP, PMC *pmc)
  +{
  +    ParrotIO *io = PMC_data(pmc);
  +    if (!io)
  +        return 0;
  +
  +    return (io->flags & PIO_F_CONSOLE) ? 1 : 0;
  +}
  +
  +
   /*
    * Local variables:
    * c-indentation-style: bsd
  
  
  
  1.19      +2 -2      parrot/io/io_buf.c
  
  Index: io_buf.c
  ===================================================================
  RCS file: /cvs/public/parrot/io/io_buf.c,v
  retrieving revision 1.18
  retrieving revision 1.19
  diff -u -w -r1.18 -r1.19
  --- io_buf.c  11 Oct 2003 13:15:30 -0000      1.18
  +++ io_buf.c  17 Nov 2003 17:22:05 -0000      1.19
  @@ -1,7 +1,7 @@
   /* io_buf.c
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *      $Id: io_buf.c,v 1.18 2003/10/11 13:15:30 boemmels Exp $
  + *      $Id: io_buf.c,v 1.19 2003/11/17 17:22:05 boemmels Exp $
    *  Overview:
    *      The "buf" layer of Parrot IO. Buffering and all the fun stuff.
    *
  @@ -185,7 +185,7 @@
           return NULL;
       }
   
  -    if (PIO_isatty(fd))
  +    if (io->flags & PIO_F_CONSOLE)
           PIO_buf_setlinebuf(interpreter, l, io);
       else
           PIO_buf_setbuf(interpreter, l, io, PIO_UNBOUND);
  
  
  
  1.35      +3 -4      parrot/io/io_stdio.c
  
  Index: io_stdio.c
  ===================================================================
  RCS file: /cvs/public/parrot/io/io_stdio.c,v
  retrieving revision 1.34
  retrieving revision 1.35
  diff -u -w -r1.34 -r1.35
  --- io_stdio.c        7 Nov 2003 12:12:30 -0000       1.34
  +++ io_stdio.c        17 Nov 2003 17:22:05 -0000      1.35
  @@ -1,7 +1,7 @@
   /* io_stdio.c
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *      $Id: io_stdio.c,v 1.34 2003/11/07 12:12:30 boemmels Exp $
  + *      $Id: io_stdio.c,v 1.35 2003/11/17 17:22:05 boemmels Exp $
    *  Overview:
    *      This is the Parrot IO STDIO layer. This may provide a subset of
    *      full functionality, but must compile on any system with the
  @@ -56,8 +56,7 @@
   static PIOOFF_T  PIO_stdio_seek(theINTERP, ParrotIOLayer *l, ParrotIO *io,
                                   PIOOFF_T offset, INTVAL whence);
   static PIOOFF_T  PIO_stdio_tell(theINTERP, ParrotIOLayer *l, ParrotIO *io);
  -
  -
  +static INTVAL    PIO_stdio_isatty(PIOHANDLE fd);
   
   
   static const char *
  @@ -160,7 +159,7 @@
       INTVAL mode;
       mode = 0;
   
  -    if (PIO_isatty(fptr))
  +    if (PIO_stdio_isatty(fptr))
           flags |= PIO_F_CONSOLE;
   
       /* fdopened files are always shared */
  
  
  
  1.42      +2 -1      parrot/io/io_unix.c
  
  Index: io_unix.c
  ===================================================================
  RCS file: /cvs/public/parrot/io/io_unix.c,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -w -r1.41 -r1.42
  --- io_unix.c 30 Oct 2003 08:49:14 -0000      1.41
  +++ io_unix.c 17 Nov 2003 17:22:05 -0000      1.42
  @@ -1,7 +1,7 @@
   /* io_unix.c
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *      $Id: io_unix.c,v 1.41 2003/10/30 08:49:14 leo Exp $
  + *      $Id: io_unix.c,v 1.42 2003/11/17 17:22:05 boemmels Exp $
    *  Overview:
    *      This is the Parrot IO UNIX layer. May be changed to
    *      include other platforms if that platform is similar
  @@ -53,6 +53,7 @@
   static PIOOFF_T  PIO_unix_seek(theINTERP, ParrotIOLayer *l, ParrotIO *io,
                                  PIOOFF_T offset, INTVAL whence);
   static PIOOFF_T  PIO_unix_tell(theINTERP, ParrotIOLayer *l, ParrotIO *io);
  +static INTVAL    PIO_unix_isatty(PIOHANDLE fd);
   
   
   static INTVAL
  
  
  
  1.37      +2 -1      parrot/io/io_win32.c
  
  Index: io_win32.c
  ===================================================================
  RCS file: /cvs/public/parrot/io/io_win32.c,v
  retrieving revision 1.36
  retrieving revision 1.37
  diff -u -w -r1.36 -r1.37
  --- io_win32.c        11 Oct 2003 13:15:30 -0000      1.36
  +++ io_win32.c        17 Nov 2003 17:22:05 -0000      1.37
  @@ -1,7 +1,7 @@
   /* io_win32.c
    *  Copyright: 2001-2003 The Perl Foundation.  All Rights Reserved.
    *  CVS Info
  - *      $Id: io_win32.c,v 1.36 2003/10/11 13:15:30 boemmels Exp $
  + *      $Id: io_win32.c,v 1.37 2003/11/17 17:22:05 boemmels Exp $
    *  Overview:
    *      This is the Parrot IO OS layer for Win32 platforms.
    *  Data Structure and Algorithms:
  @@ -56,6 +56,7 @@
   static PIOOFF_T  PIO_win32_seek(theINTERP, ParrotIOLayer *l, ParrotIO *io,
                                   PIOOFF_T off, INTVAL whence);
   static PIOOFF_T  PIO_win32_tell(theINTERP, ParrotIOLayer *l, ParrotIO *io);
  +static INTVAL    PIO_win32_isatty(PIOHANDLE fd);
   
   
   /* Convert to platform specific bit open flags */
  
  
  

Reply via email to