File: ignore.pir

package info (click to toggle)
ack 2.24-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,704 kB
  • sloc: perl: 8,590; ansic: 21; fortran: 11; makefile: 5; sh: 5
file content (88 lines) | stat: -rw-r--r-- 1,461 bytes parent folder | download | duplicates (20)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
=head1 INFORMATION

This example shows the usage of C<Stream::read_bytes>.

=head1 FUNCTIONS

=over 4

=item _main


=cut

.sub _main :main
    .local pmc stream

    load_bytecode "library/Stream/Sub.pir"
    load_bytecode "library/Stream/Replay.pir"

    find_type $I0, "Stream::Sub"
    new $P0, $I0
    # set the stream's source sub
    .const .Sub temp = "_hello"
    assign $P0, $P1

    find_type $I0,"Stream::Replay"
    stream = new $I0
    assign stream, $P0

    $S0 = stream."read_bytes"( 3 )
    print "'hel': ["
    print $S0
    print "]\n"

    stream = clone stream
    $P0 = clone stream

    $S0 = stream."read_bytes"( 4 )
    print "'lowo': ["
    print $S0
    print "] = "

    $S0 = $P0."read_bytes"( 4 )
    print "["
    print $S0
    print "]\n"

    $S0 = stream."read"()
    print "'rld!': ["
    print $S0
    print "]\n"

    $S0 = stream."read_bytes"( 100 )
    print "'parrotis cool': ["
    print $S0
    print "]\n"

    end
.end

=item _hello

This sub is used as the source for the stream.

It just writes some text to the stream.

=cut

.sub _hello :method
    self."write"( "hello" )
    self."write"( "world!" )
    self."write"( "parrot" )
    self."write"( "is cool" )
.end

=back

=head1 AUTHOR

Jens Rieks E<lt>parrot at jensbeimsurfen dot deE<gt> is the author
and maintainer.
Please send patches and suggestions to the Perl 6 Internals mailing list.

=head1 COPYRIGHT

Copyright (C) 2004, The Perl Foundation.

=cut