Grupos de Google ya no admite publicaciones ni suscripciones nuevas de Usenet. El contenido anterior sigue visible.

[COMMIT] new IO op 'pioctl'

8 vistas
Ir al primer mensaje no leído

Melvin Smith

no leída,
9 oct 2003, 9:47:25 p.m.9/10/03
para 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

no leída,
10 oct 2003, 8:31:18 a.m.10/10/03
para 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

no leída,
10 oct 2003, 9:00:10 a.m.10/10/03
para Dan Sugalski,perl6-i...@perl.org

:)

I also considered iocmd, ioattr and ioset.

IPop your favorite into the suggestion box...

-Melvin


Steve Fink

no leída,
11 oct 2003, 12:19:51 p.m.11/10/03
para 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

no leída,
11 oct 2003, 12:34:39 p.m.11/10/03
para 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

no leída,
11 oct 2003, 12:45:22 p.m.11/10/03
para 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

no leída,
11 oct 2003, 2:57:38 p.m.11/10/03
para 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 mensajes nuevos