On 07/10/02 12:58 +0200, Jerome Quelin wrote:
> > $IX = find_type "ClassName"
> > $PX = new $IX
> >
> > to:
> >
> > $PX = new "ClassName"
here's a patch for examples/streams.
if you ack it, i'll apply it (i should still have the commit bit).
regards,
jérôme
--
[EMAIL PROTECTED]
Index: examples/streams/Bytes.pir
===================================================================
--- examples/streams/Bytes.pir (révision 21742)
+++ examples/streams/Bytes.pir (copie de travail)
@@ -17,14 +17,12 @@
load_bytecode "library/Stream/Sub.pir"
load_bytecode "library/Stream/Replay.pir"
- find_type $I0, "Stream::Sub"
- new $P0, $I0
+ $P0 = new "Stream::Sub"
# set the stream's source sub
.const .Sub temp = "_hello"
assign $P0, $P1
- find_type $I0,"Stream::Replay"
- stream = new $I0
+ stream = new "Stream::Replay"
assign stream, $P0
$S0 = stream."read_bytes"( 3 )
Index: examples/streams/Coroutine.pir
===================================================================
--- examples/streams/Coroutine.pir (révision 21742)
+++ examples/streams/Coroutine.pir (copie de travail)
@@ -28,8 +28,7 @@
load_bytecode "library/Stream/Coroutine.pir"
# create the coroutine stream
- find_type $I0, "Stream::Coroutine"
- new stream, $I0
+ stream = new "Stream::Coroutine"
# set the stream's source coroutine
# A .Sub is a coroutine when there is a yield?
Index: examples/streams/SubCounter.pir
===================================================================
--- examples/streams/SubCounter.pir (révision 21742)
+++ examples/streams/SubCounter.pir (copie de travail)
@@ -18,8 +18,7 @@
load_bytecode "library/Stream/Base.pir"
load_bytecode "library/Stream/Sub.pir"
- find_type $I0, "Stream::Sub"
- new stream, $I0
+ stream = new "Stream::Sub"
# set the stream's source sub
.const .Sub temp = "_counter"
Index: examples/streams/FileLines.pir
===================================================================
--- examples/streams/FileLines.pir (révision 21742)
+++ examples/streams/FileLines.pir (copie de travail)
@@ -39,24 +39,20 @@
load_bytecode "library/Stream/Combiner.pir"
# create a file stream
- find_type $I0, "Stream::ParrotIO"
- new file, $I0
+ file = new "Stream::ParrotIO"
file."open"( name, "<" )
# process it one line per read
- find_type $I0, "Stream::Lines"
- new lines, $I0
+ lines = new "Stream::Lines"
assign lines, file
# endless counter
- find_type $I0, "Stream::Sub"
- new counter, $I0
+ counter = new "Stream::Sub"
.const .Sub temp = "_counter"
assign counter, temp
# combine the counter and the file's lines
- find_type $I0, "Stream::Combiner"
- new combiner, $I0
+ combiner = new "Stream::Combiner"
assign combiner, counter
assign combiner, lines
Index: examples/streams/Lines.pir
===================================================================
--- examples/streams/Lines.pir (révision 21742)
+++ examples/streams/Lines.pir (copie de travail)
@@ -20,15 +20,13 @@
load_bytecode "library/Stream/Lines.pir"
# create a text stream
- find_type $I0, "Stream::Sub"
- new stream, $I0
+ stream = new "Stream::Sub"
# set the source
.const .Sub temp = "_text"
assign stream, temp
# create a lines stream
- find_type $I0, "Stream::Lines"
- new lines, $I0
+ lines = new "Stream::Lines"
# set the source
assign lines, stream
Index: examples/streams/Replay.pir
===================================================================
--- examples/streams/Replay.pir (révision 21742)
+++ examples/streams/Replay.pir (copie de travail)
@@ -4,8 +4,7 @@
load_bytecode "library/Stream/Writer.pir"
load_bytecode "library/Stream/Replay.pir"
- find_type $I0, "Stream::Writer"
- new stream, $I0
+ stream = new "Stream::Writer"
$P0 = global "_reader"
assign stream, $P0
@@ -26,8 +25,7 @@
.local pmc stream3
.local string str
- find_type $I0, "Stream::Replay"
- new stream1, $I0
+ stream1 = new "Stream::Replay"
assign stream1, self
print "reader start\n"
Index: examples/streams/Writer.pir
===================================================================
--- examples/streams/Writer.pir (révision 21742)
+++ examples/streams/Writer.pir (copie de travail)
@@ -17,8 +17,7 @@
load_bytecode "library/Stream/Writer.pir"
- find_type $I0, "Stream::Writer"
- new stream, $I0
+ stream = new "Stream::Writer"
# set the stream's source sub
.const .Sub temp = "_reader"
Index: examples/streams/SubHello.pir
===================================================================
--- examples/streams/SubHello.pir (révision 21742)
+++ examples/streams/SubHello.pir (copie de travail)
@@ -17,8 +17,7 @@
load_bytecode "library/Stream/Sub.pir"
- find_type $I0, "Stream::Sub"
- new stream, $I0
+ stream = new "Stream::Sub"
# set the stream's source sub
.const .Sub temp = "_hello"
Index: examples/streams/Combiner.pir
===================================================================
--- examples/streams/Combiner.pir (révision 21742)
+++ examples/streams/Combiner.pir (copie de travail)
@@ -34,21 +34,18 @@
load_bytecode "library/Stream/Sub.pir"
# create the counter stream
- find_type $I0, "Stream::Sub"
- new counter, $I0
+ counter = new "Stream::Sub"
.const .Sub temp = "_counter"
assign counter, temp
# create the text stream
- find_type $I0, "Stream::Sub"
- new text, $I0
+ text = new "Stream::Sub"
# set its source
.const .Sub temp = "_text"
assign text, temp
# create a combiner stream
- find_type $I0, "Stream::Combiner"
- new combined, $I0
+ combined = new "Stream::Combiner"
# add the streams
assign combined, counter
assign combined, text
Index: examples/streams/ParrotIO.pir
===================================================================
--- examples/streams/ParrotIO.pir (révision 21742)
+++ examples/streams/ParrotIO.pir (copie de travail)
@@ -22,8 +22,7 @@
load_bytecode "library/Stream/ParrotIO.pir"
# create the ParrotIO stream
- find_type $I0, "Stream::ParrotIO"
- new stream, $I0
+ stream = new "Stream::ParrotIO"
# open this file
stream."open"( "examples/streams/ParrotIO.pir", "<" )
Index: examples/streams/Include.pir
===================================================================
--- examples/streams/Include.pir (révision 21742)
+++ examples/streams/Include.pir (copie de travail)
@@ -17,8 +17,7 @@
load_bytecode "library/Stream/Sub.pir"
- find_type $I0, "Stream::Sub"
- new stream, $I0
+ stream = new "Stream::Sub"
# set the stream's source sub
.const .Sub temp = "_counter"
@@ -55,8 +54,7 @@
if i != 4 goto SKIP
.local pmc temp
- find_type $I0, "Stream::Sub"
- new temp, $I0
+ temp = new "Stream::Sub"
.const .Sub func = "_included"
assign temp, func
@@ -85,8 +83,7 @@
self."write"( "hello" )
# create another stream
- find_type $I0, "Stream::Sub"
- new temp, $I0
+ temp = new "Stream::Sub"
.const .Sub func = "_counter2"
assign temp, func
Index: examples/streams/Filter.pir
===================================================================
--- examples/streams/Filter.pir (révision 21742)
+++ examples/streams/Filter.pir (copie de travail)
@@ -25,15 +25,13 @@
load_bytecode "library/Stream/Filter.pir"
# create the counter stream
- find_type $I0, "Stream::Sub"
- new stream, $I0
+ stream = new "Stream::Sub"
# assign its source
.const .Sub temp = "_counter"
assign stream, temp
# create the filter stream
- find_type $I0, "Stream::Filter"
- new filter, $I0
+ filter = new "Stream::Filter"
# assign its source
assign filter, stream
# set the filter sub