Author: allison
Date: Fri Oct 5 19:43:39 2007
New Revision: 21904
Modified:
branches/pdd15oo/runtime/parrot/library/Stream/Base.pir
branches/pdd15oo/runtime/parrot/library/Stream/Combiner.pir
branches/pdd15oo/runtime/parrot/library/Stream/Coroutine.pir
branches/pdd15oo/runtime/parrot/library/Stream/Filter.pir
branches/pdd15oo/runtime/parrot/library/Stream/Lines.pir
branches/pdd15oo/runtime/parrot/library/Stream/ParrotIO.pir
branches/pdd15oo/runtime/parrot/library/Stream/Replay.pir
branches/pdd15oo/runtime/parrot/library/Stream/Sub.pir
branches/pdd15oo/runtime/parrot/library/Stream/Writer.pir
Log:
[pdd15oo] Update Stream:: libraries to use new object model.
Modified: branches/pdd15oo/runtime/parrot/library/Stream/Base.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/Stream/Base.pir (original)
+++ branches/pdd15oo/runtime/parrot/library/Stream/Base.pir Fri Oct 5
19:43:39 2007
@@ -24,10 +24,6 @@
.namespace ["Stream::Base"]
-.const int aSource = 0
-.const int aIncludes = 1
-.const int aBuffer = 2
-
.sub onload :load :anon
$P0 = get_class 'Stream::Base'
unless null $P0 goto END
@@ -55,16 +51,14 @@
.sub set_pmc :vtable :method
.param pmc source
- classoffset $I0, self, "Stream::Base"
- setattribute self, $I0, source
+ setattribute self, 'source', source
null source
.end
.sub setSource :method
.param pmc source
- classoffset $I0, self, "Stream::Base"
- setattribute self, $I0, source
+ setattribute self, 'source', source
null source
.end
@@ -76,14 +70,12 @@
.local pmc temp
# reset source
- classoffset $I0, self, "Stream::Base"
new temp, .Undef
- setattribute self, $I0, temp
+ setattribute self, 'source', temp
# reset includes
- inc $I0
new temp, .ResizablePMCArray
- setattribute self, $I0, temp
+ setattribute self, 'includes', temp
.end
=item stream."dump"() (debug aid)
@@ -141,9 +133,7 @@
.sub source :method
.local pmc ret
- classoffset $I0, self, "Stream::Base"
- add $I0, aSource
- getattribute ret, self, $I0
+ getattribute ret, self, 'source'
.return(ret)
ERROR:
@@ -162,9 +152,7 @@
.sub connected :method
.local pmc stream
- classoffset $I0, self, "Stream::Base"
- add $I0, aSource
- getattribute $P0, self, $I0
+ getattribute $P0, self, 'source'
typeof $I0, $P0
if $I0 == .Undef goto NOT
@@ -188,19 +176,15 @@
.local string ret
.local pmc includes
- classoffset $I0, self, "Stream::Base"
- add $I0, aBuffer
- getattribute $P0, self, $I0
+ getattribute $P0, self, 'buffer'
if_null $P0, NO_BUFFER
ret = $P0
null $P0
- setattribute self, $I0, $P0
+ setattribute self, 'buffer', $P0
branch DONE
NO_BUFFER:
- classoffset $I0, self, "Stream::Base"
- add $I0, aIncludes
- getattribute includes, self, $I0
+ getattribute includes, self, 'includes'
if_null includes, SELF
$I0 = includes
@@ -249,9 +233,7 @@
.param pmc stream
.local pmc includes
- classoffset $I0, self, "Stream::Base"
- add $I0, aIncludes
- getattribute includes, self, $I0
+ getattribute includes, self, 'includes'
push includes, stream
self."flush"()
@@ -271,9 +253,7 @@
can i, self, "write"
unless i goto CANT
- classoffset $I0, self, "Stream::Base"
- add $I0, aIncludes
- getattribute includes, self, $I0
+ getattribute includes, self, 'includes'
i = includes
if i == 0 goto CANT
@@ -296,18 +276,15 @@
.local string ret
.local pmc buffer
- classoffset $I0, self, "Stream::Base"
- add $I0, aBuffer
-
# get buffer
- getattribute buffer, self, $I0
+ getattribute buffer, self, 'buffer'
# no buffer set?
if_null buffer, CREATE
# unset buffer
null $P0
- setattribute self, $I0, $P0
+ setattribute self, 'buffer', $P0
branch OK
CREATE:
@@ -336,9 +313,7 @@
unless $I0 goto END
assign buffer, $S0
- classoffset $I0, self, "Stream::Base"
- add $I0, aBuffer
- setattribute self, $I0, buffer
+ setattribute self, 'buffer', buffer
END:
.return(ret)
@@ -354,17 +329,14 @@
.param pmc buf :optional
.param int has_buf :opt_flag
- classoffset $I0, self, "Stream::Base"
- add $I0, aBuffer
-
if has_buf goto SET
- getattribute $P0, self, $I0
+ getattribute $P0, self, 'buffer'
if_null $P0, END
branch END
SET:
- setattribute self, $I0, buf
+ setattribute self, 'buffer', buf
END:
.return($P0)
.end
Modified: branches/pdd15oo/runtime/parrot/library/Stream/Combiner.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/Stream/Combiner.pir (original)
+++ branches/pdd15oo/runtime/parrot/library/Stream/Combiner.pir Fri Oct 5
19:43:39 2007
@@ -34,7 +34,7 @@
load_bytecode "library/Stream/Base.pir"
- getclass base, "Stream::Base"
+ get_class base, "Stream::Base"
subclass comb, base, "Stream::Combiner"
addattribute comb, "combiner"
@@ -74,13 +74,12 @@
.param int has_combiner :opt_flag
.local pmc ret
- classoffset $I0, self, "Stream::Combiner"
unless has_combiner goto GET
- setattribute self, $I0, _combiner
+ setattribute self, 'combiner', _combiner
ret = _combiner
branch END
GET:
- getattribute ret, self, $I0
+ getattribute ret, self, 'combiner'
END:
.return(ret)
.end
@@ -184,8 +183,7 @@
branch READ_LOOP
CALL:
- classoffset i, self, "Stream::Combiner"
- getattribute combiner, self, i
+ getattribute combiner, self, 'combiner'
ret = combiner( args )
.return(ret)
Modified: branches/pdd15oo/runtime/parrot/library/Stream/Coroutine.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/Stream/Coroutine.pir
(original)
+++ branches/pdd15oo/runtime/parrot/library/Stream/Coroutine.pir Fri Oct
5 19:43:39 2007
@@ -25,12 +25,12 @@
.local pmc coro
.local int i
- $P0 = getclass "Stream::Coroutine"
+ $P0 = get_class "Stream::Coroutine"
unless null $P0 goto END
load_bytecode "library/Stream/Base.pir"
- getclass base, "Stream::Base"
+ get_class base, "Stream::Base"
subclass coro, base, "Stream::Coroutine"
END:
.end
Modified: branches/pdd15oo/runtime/parrot/library/Stream/Filter.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/Stream/Filter.pir (original)
+++ branches/pdd15oo/runtime/parrot/library/Stream/Filter.pir Fri Oct 5
19:43:39 2007
@@ -32,7 +32,7 @@
load_bytecode "library/Stream/Base.pir"
- getclass base, "Stream::Base"
+ get_class base, "Stream::Base"
subclass filter, base, "Stream::Filter"
addattribute filter, "filter"
@@ -52,13 +52,12 @@
.param int has_filter :opt_flag
.local pmc ret
- classoffset $I0, self, "Stream::Filter"
unless has_filter goto GET
ret = _filter
- setattribute self, $I0, _filter
+ setattribute self, 'filter', _filter
branch END
GET:
- getattribute ret, self, $I0
+ getattribute ret, self, 'filter'
END:
.return(ret)
.end
Modified: branches/pdd15oo/runtime/parrot/library/Stream/Lines.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/Stream/Lines.pir (original)
+++ branches/pdd15oo/runtime/parrot/library/Stream/Lines.pir Fri Oct 5
19:43:39 2007
@@ -34,10 +34,10 @@
load_bytecode "library/Stream/Base.pir"
- getclass base, "Stream::Base"
+ get_class base, "Stream::Base"
subclass lines, base, "Stream::Lines"
- addattribute lines, "buffer"
+ addattribute lines, "line_buffer"
END:
.end
@@ -46,9 +46,8 @@
.sub init :vtable :method
.local pmc temp
- classoffset $I0, self, "Stream::Lines"
temp = new 'String'
- setattribute self, $I0, temp
+ setattribute self, 'line_buffer', temp
.end
=item is = stream."connected"()
@@ -59,8 +58,7 @@
.sub connected :method
# XXX: check if the buffer is empty if the source stream is not connected
- classoffset $I0, self, "Stream::Base"
- getattribute $P0, self, $I0
+ getattribute $P0, self, 'source'
if_null $P0, NOT_CONNECTED
typeof $I0, $P0
if $I0 == .Undef goto NOT_CONNECTED
@@ -118,8 +116,7 @@
.local pmc temp
.local string _buffer
- classoffset $I0, self, "Stream::Lines"
- getattribute temp, self, $I0
+ getattribute temp, self, 'line_buffer'
_buffer = temp
.return(temp,_buffer)
@@ -137,8 +134,7 @@
new temp, .String
temp = buffer
- classoffset $I0, self, "Stream::Lines"
- setattribute self, $I0, temp
+ setattribute self, 'line_buffer', temp
.end
=item stream."fillBuffer"() (B<internal>)
@@ -157,8 +153,7 @@
temp = self."source"()
str = temp."read"()
- classoffset $I0, self, "Stream::Lines"
- getattribute temp, self, $I0
+ getattribute temp, self, 'line_buffer'
buffer = temp
code = 0
@@ -167,7 +162,7 @@
# concat to the buffer
concat buffer, str
temp = buffer
- setattribute self, $I0, temp
+ setattribute self, 'line_buffer', temp
code = 1
END:
Modified: branches/pdd15oo/runtime/parrot/library/Stream/ParrotIO.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/Stream/ParrotIO.pir (original)
+++ branches/pdd15oo/runtime/parrot/library/Stream/ParrotIO.pir Fri Oct 5
19:43:39 2007
@@ -32,7 +32,7 @@
load_bytecode "library/Stream/Base.pir"
- getclass base, "Stream::Base"
+ get_class base, "Stream::Base"
subclass io, base, "Stream::ParrotIO"
addattribute io, "blocksize"
@@ -73,15 +73,14 @@
.local pmc temp
.local int ret
- classoffset $I0, self, "Stream::ParrotIO"
unless has_bs goto GET
temp = new 'Integer'
temp = bs
- setattribute self, $I0, temp
+ setattribute self, 'blocksize', temp
branch RET
GET:
- getattribute temp, self, $I0
+ getattribute temp, self, 'blocksize'
RET:
ret = temp
Modified: branches/pdd15oo/runtime/parrot/library/Stream/Replay.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/Stream/Replay.pir (original)
+++ branches/pdd15oo/runtime/parrot/library/Stream/Replay.pir Fri Oct 5
19:43:39 2007
@@ -43,7 +43,7 @@
load_bytecode "library/Stream/Base.pir"
# Stream::Replay
- getclass $P0, "Stream::Base"
+ get_class $P0, "Stream::Base"
subclass $P0, $P0, "Stream::Replay"
addattribute $P0, "buffer"
addattribute $P0, "pos"
@@ -64,11 +64,8 @@
.sub init :vtable :method
.local pmc temp
- classoffset $I0, self, "Stream::Replay"
-
- inc $I0
temp = new 'Integer'
- setattribute self, $I0, temp
+ setattribute self, 'pos', temp
.end
=item assign stream, source
@@ -85,35 +82,28 @@
unless $I0 goto NOTA
# get the buffer
- classoffset $I0, val, "Stream::Replay"
- getattribute buffer, val, $I0
+ getattribute buffer, val, 'buffer'
# add us to the buffer
buffer."add"( self )
# store the buffer
- classoffset $I0, self, "Stream::Replay"
- setattribute self, $I0, buffer
+ setattribute self, 'buffer', buffer
# get the position
- classoffset $I0, val, "Stream::Replay"
- inc $I0
- getattribute $P0, val, $I0
+ getattribute $P0, val, 'pos'
$P0 = clone $P0
# set the position
- classoffset $I0, val, "Stream::Replay"
- inc $I0
- setattribute val, $I0, $P0
+ setattribute val, 'pos', $P0
# assign the source
val = val."source"()
branch ASSIGN
NOTA:
$P0 = new "Stream::Replay::Buffer"
- classoffset $I0, self, "Stream::Replay"
- setattribute self, $I0, buffer
+ setattribute self, 'buffer', buffer
ASSIGN:
self."setSource"( val )
.end
@@ -133,8 +123,7 @@
null ret
source = self."source"()
if_null source, END
- classoffset $I0, self, "Stream::Replay"
- getattribute buffer, self, $I0
+ getattribute buffer, self, 'buffer'
if_null buffer, END
inc $I0
getattribute pos, self, $I0
@@ -172,14 +161,11 @@
.sub init :vtable :method
.local pmc temp
- classoffset $I0, self, "Stream::Replay::Buffer"
-
temp = new ResizableStringArray
- setattribute self, $I0, temp
+ setattribute self, 'strings', temp
- inc $I0
temp = new ResizablePMCArray
- setattribute self, $I0, temp
+ setattribute self, 'clones', temp
.end
.sub compact :method
@@ -198,10 +184,8 @@
typeof $I0, source
if $I0==.Undef goto END
- classoffset $I0, self, "Stream::Replay::Buffer"
- getattribute strings, self, $I0
- inc $I0
- getattribute clones, self, $I0
+ getattribute strings, self, 'strings'
+ getattribute clones, self, 'clones'
$I0 = clones
if $I0 <= 1 goto READ_SOURCE
@@ -231,9 +215,7 @@
.param pmc stream
.local pmc clones
- classoffset $I0, self, "Stream::Replay::Buffer"
- inc $I0
- getattribute clones, self, $I0
+ getattribute clones, self, 'clones'
push clones, stream
.end
@@ -244,9 +226,7 @@
.local int i
.local int j
- classoffset i, self, "Stream::Replay::Buffer"
- inc i
- getattribute clones, self, i
+ getattribute clones, self, 'clones'
i = 0
j = clones
Modified: branches/pdd15oo/runtime/parrot/library/Stream/Sub.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/Stream/Sub.pir (original)
+++ branches/pdd15oo/runtime/parrot/library/Stream/Sub.pir Fri Oct 5
19:43:39 2007
@@ -63,7 +63,7 @@
load_bytecode "library/Stream/Base.pir"
- getclass base, "Stream::Base"
+ get_class base, "Stream::Base"
subclass sub, base, "Stream::Sub"
addattribute sub, "write_cont"
@@ -89,8 +89,7 @@
.local pmc _write
.local pmc ret
- classoffset $I0, self, "Stream::Sub"
- getattribute _write, self, $I0
+ getattribute _write, self, 'write_cont'
$P0 =self."_call_writer"(_write, str)
.end
@@ -118,10 +117,9 @@
temp = self."source"()
typeof $I0, temp
if $I0 == .Undef goto END
- classoffset $I0, self, "Stream::Sub"
.include "interpinfo.pasm"
$P0 = interpinfo .INTERPINFO_CURRENT_CONT
- setattribute self, $I0, $P0
+ setattribute self, 'write_cont', $P0
str = temp( self )
Modified: branches/pdd15oo/runtime/parrot/library/Stream/Writer.pir
==============================================================================
--- branches/pdd15oo/runtime/parrot/library/Stream/Writer.pir (original)
+++ branches/pdd15oo/runtime/parrot/library/Stream/Writer.pir Fri Oct 5
19:43:39 2007
@@ -39,7 +39,7 @@
load_bytecode "library/Stream/Base.pir"
- getclass $P0, "Stream::Base"
+ get_class $P0, "Stream::Base"
subclass $P1, $P0, "Stream::Writer"
addattribute $P1, "writer"
@@ -68,11 +68,9 @@
self."setSource"()
# mark it as closed
- classoffset $I0, self, "Stream::Writer"
- inc $I0
.local pmc status
interpinfo self, .INTERPINFO_CURRENT_OBJECT
- getattribute status, self, $I0
+ getattribute status, self, 'status'
status = 0
.end
@@ -81,9 +79,7 @@
new status, .Integer
set status, 0
- classoffset $I0, self, "Stream::Writer"
- inc $I0
- setattribute self, $I0, status
+ setattribute self, 'status', status
.end
.sub set_pmc :vtable :method
@@ -94,9 +90,7 @@
setprop stub, "CALL", source
self."setSource"( stub )
- classoffset $I0, self, "Stream::Writer"
- inc $I0
- getattribute status, self, $I0
+ getattribute status, self, 'status'
status = 1
.end
@@ -116,9 +110,7 @@
.local pmc status
.local int ret
- classoffset $I0, self, "Stream::Writer"
- inc $I0
- getattribute status, self, $I0
+ getattribute status, self, 'status'
ret = status
.return(ret)
.end
@@ -134,12 +126,10 @@
.local pmc source
.local pmc status
- classoffset $I0, self, "Stream::Writer"
.include "interpinfo.pasm"
$P0 = interpinfo .INTERPINFO_CURRENT_CONT
- setattribute self, $I0, $P0
- inc $I0
- getattribute status, self, $I0
+ setattribute self, 'writer', $P0
+ getattribute status, self, 'status'
if status == 0 goto END
if status == 2 goto WRITE
@@ -147,10 +137,9 @@
self."write"( "" )
WRITE:
- classoffset $I0, self, "Stream::Writer"
.include "interpinfo.pasm"
$P0 = interpinfo .INTERPINFO_CURRENT_CONT
- setattribute self, $I0, $P0
+ setattribute self, 'writer', $P0
source = self."source"()
if_null source, END
@@ -177,14 +166,12 @@
cont = self."source"()
if_null cont, END_OF_STREAM
- classoffset $I0, self, "Stream::Writer"
- getattribute writer, self, $I0
+ getattribute writer, self, 'writer'
str = self."_call_writer"(writer)
.return(str)
END_OF_STREAM:
null writer
- classoffset $I0, self, "Stream::Writer"
- setattribute self, $I0, writer
+ setattribute self, 'writer', writer
null str
.return(str)