[svn:parrot] r47784 - trunk/src/pmc
NotFound at svn.parrot.org
NotFound at svn.parrot.org
Wed Jun 23 15:19:57 UTC 2010
Author: NotFound
Date: Wed Jun 23 15:19:57 2010
New Revision: 47784
URL: https://trac.parrot.org/parrot/changeset/47784
Log:
implement isatty method in Handle, fix it in FileHandle and improve Handle POD
Modified:
trunk/src/pmc/filehandle.pmc
trunk/src/pmc/handle.pmc
Modified: trunk/src/pmc/filehandle.pmc
==============================================================================
--- trunk/src/pmc/filehandle.pmc Wed Jun 23 13:01:31 2010 (r47783)
+++ trunk/src/pmc/filehandle.pmc Wed Jun 23 15:19:57 2010 (r47784)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2008-2009, Parrot Foundation.
+Copyright (C) 2008-2010, Parrot Foundation.
$Id$
=head1 NAME
@@ -281,12 +281,14 @@
=item C<METHOD isatty()>
+Returns a boolean value indicating whether C<SELF> is a console/tty.
+
=cut
*/
+
METHOD isatty() {
- const INTVAL isatty =
- (PARROT_FILEHANDLE(SELF)->flags & PIO_F_CONSOLE) == PIO_F_CONSOLE;
+ const INTVAL isatty = Parrot_io_is_tty(INTERP, SELF);
RETURN(INTVAL isatty);
}
Modified: trunk/src/pmc/handle.pmc
==============================================================================
--- trunk/src/pmc/handle.pmc Wed Jun 23 13:01:31 2010 (r47783)
+++ trunk/src/pmc/handle.pmc Wed Jun 23 15:19:57 2010 (r47784)
@@ -1,5 +1,5 @@
/*
-Copyright (C) 2008, Parrot Foundation.
+Copyright (C) 2008-2010, Parrot Foundation.
$Id$
=head1 NAME
@@ -14,9 +14,12 @@
=over 4
-=item * [to come]
+=item C<init>
-=back
+=item C<init_pmc>
+
+Handle shouldn't be directly instantiated, init and init_pmc throws
+EXCEPTION_INVALID_OPERATION.
=cut
@@ -42,6 +45,30 @@
Parrot_ex_throw_from_c_args(INTERP, NULL, EXCEPTION_INVALID_OPERATION,
"Handle cannot be instantiated directly.");
}
+
+/*
+
+=back
+
+=head2 Methods
+
+=over 4
+
+=item C<METHOD isatty()>
+
+Returns a boolean value indicating whether C<SELF> is a console/tty.
+This default implementation always return false. Override it in
+subtypes that are or can be tty.
+
+=cut
+
+*/
+
+ METHOD isatty() {
+ const INTVAL isatty = Parrot_io_is_tty(INTERP, SELF);
+ RETURN(INTVAL isatty);
+ }
+
}
/*
More information about the parrot-commits
mailing list