Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[COMMIT] new IO op 'pioctl'

9 views
Skip to first unread message

Melvin Smith

unread,
Oct 9, 2003, 9:47:25 PM10/9/03
to perl6-i...@perl.org
Added pioctl op and PIO_pioctl API call. General purpose op for IO manipulation
in tradition of UNIX ioctl call.

This will be the interface for doing all sorts of IO layer stuff such as
buffering, blocking, async, etc. At least until someone has a better
way to do it.

Also added record separator field to ParrotIO object and allow changing
from default \n. Needs finishing so we can support setting recsep to
NULL for slurp mode. Currently tests fail if I set to linebuf by default.

-Melvin


Dan Sugalski

unread,
Oct 10, 2003, 8:31:18 AM10/10/03
to Melvin Smith, perl6-i...@perl.org
On Thu, 9 Oct 2003, Melvin Smith wrote:

> Added pioctl op and PIO_pioctl API call. General purpose op for IO manipulation
> in tradition of UNIX ioctl call.
>
> This will be the interface for doing all sorts of IO layer stuff such as
> buffering, blocking, async, etc. At least until someone has a better
> way to do it.

I think it's time to start thinking about it. (And I think we need a new
name, but that's because I've always hated 'ioctl' :)

Dan

Melvin Smith

unread,
Oct 10, 2003, 9:00:10 AM10/10/03
to Dan Sugalski, perl6-i...@perl.org

:)

I also considered iocmd, ioattr and ioset.

IPop your favorite into the suggestion box...

-Melvin


Steve Fink

unread,
Oct 11, 2003, 12:19:51 PM10/11/03
to Melvin Smith, Dan Sugalski, perl6-i...@perl.org

How about keyed access to the IO PMC?

set I0, P0[.CMDGETBUFSIZE]
set P0[.CMDSETBUFSIZE], I0

Melvin Smith

unread,
Oct 11, 2003, 12:34:39 PM10/11/03
to Steve Fink, Dan Sugalski, perl6-i...@perl.org

I like that.

Actually it could look even simpler since we have separate setkeyed
and getkeyed support:

set IO, P0[.BUFSIZE]
set P0[.BUFSIZE], 8192

-Melvin

Steve Fink

unread,
Oct 11, 2003, 12:45:22 PM10/11/03
to Melvin Smith, Dan Sugalski, perl6-i...@perl.org

Actually, looking at that suggests that perhaps this should be done
through the setprop/getprop interface instead, since that seems like a
closer semantic fit to what you're doing.

Leopold Toetsch

unread,
Oct 11, 2003, 2:57:38 PM10/11/03
to Steve Fink, perl6-i...@perl.org

IMHO is the keyed access clearly denoting what's goin on. The property
stuff is AFAIK for different things. You could attach e.g. an utf8 layer
via setting a property.

Either above or via method calls:

set S0, "bufsize" # method currently "setbuf"
set P5, P0 # first param = PIO
set I5, 8192
callmeth
# P0 is the method now

or

find_method P1, "bufsize" # "setbuf"
set I5, 8192
invoke P1

s. t/pmc/io.t, t/classes/parrotio.pmc:enter_nci_method

OTOH, the property interface can have hints for creating a buffered PIO
object with a specific buffer size, e.g.

new P1, .PerlHash
new P2, .PerlInt
set P2, 8192
set P1["bufsize"], P2 # create property hash

null P3
new P0, .ParrotIO, P3, P1 # init_pmc_props
assign P0, "< the_file" # use existing handle for open TODO
# or combine above 3 lines to an extended open opcode

Properies are probably more the static side of the moon, while method
calls are dynamic.

leo

0 new messages