This file is indexed.

/usr/lib/parrot/6.6.0/library/dumper.pir is in parrot 6.6.0-1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  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
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# Copyright (C) 2004-2012, Parrot Foundation.

=head1 NAME

dumper.pir - PIR version of Perl 5's Data::Dumper module

=head1 VERSION

version 0.10

=head1 SYNOPSIS

    load_bytecode "dumper.pbc"

    # dump the $P0 register
    _dumper( $P0 )

    # dump the $P0 register, with "name"
    _dumper( $P0, "name" )


=head1 DESCRIPTION

PIR implementation of Perl 5's Data::Dumper module.

=cut

# first method prints usage information
.sub __library_dumper_print_usage
    say "# usage:"
    say ".sub main"
    say "    load_bytecode 'Data/Dumper.pbc'"
    say ''
    say "    .local pmc foo, dumper"
    say "    foo    = new 'ResizablePMCArray'"
    say "    dumper = new ['Data'; 'Dumper']"
    say ''
    say "    dumper.'dumper'( foo, 'foo' )"
    say ".end"
    say ''
.end

.include "errors.pasm"

=head1 FUNCTIONS

This library provides the following functions:

=over 4

=item _dumper( pmc, ?name, ?indent] )

This is the public (non object) interface to the dumper library.

=over 4

=item pmc

Required. The PMC to dump.

=item name

Optional. The name of the PMC.

=item indent

Optional. The indent used at the start of each line printed.

=back

B<Note:> This function currently returns nothing. It should return
the dumped data as a string, like Perl's Data::Dumper. Instead,
everything is printed out using C<print>.

B<Note: #2> Hash keys are now sorted using C<_sort()> (sort.pir)

=cut

.sub _dumper
    .param pmc p
    .param string name    :optional
    .param int has_name   :opt_flag
    .param string ident   :optional
    .param int has_ident  :opt_flag

    $P2 = _global_dumper()
    if has_ident goto w_ident
    unless has_name goto wo_name        # XXX argument order, opt 1st
    $P2."dumper"(p, name)
    goto ex
wo_name:
    $P2."dumper"(p)
    goto ex
w_ident:
    $P2."dumper"(p, name, ident)
ex:
.end

=item _register_dumper( id, sub )

Registers a dumper for new PMC type. B<EXCEPTION_UNIMPLEMENTED>
But see B<method __dump> below.

=over 4

=item id

the PMC id, as returned by the C<typeof> op.

=item sub

a Sub pmc, that gets called in order to dump the content of the given PMC

=back

For example:

    sub = find_name "_dump_PerlArray"
    _register_dumper( .PerlArray, sub )

This function returns nothing.

=cut

.sub _register_dumper
    .param int id
    .param pmc s
    $P2 = _global_dumper()
    $P2."registerDumper"(id, s)
.end

=item __dump(pmc dumper, str label) method

If a method C<__dump> exists in the namespace of the class, it will be
called with the current dumper object and the label of the PMC.

=item dumper =_global_dumper() B<(internal)>

Internal helper function.

Returns the global dumper instance used by the non object interface.

=cut

.sub _global_dumper
    .local pmc self
    .local pmc dd_class
    .local int is_defined

    get_class dd_class, ['Data'; 'Dumper']
    if null dd_class goto load_dd_pir
    goto TYPE_OK

  load_dd_pir:
    load_bytecode "Data/Dumper.pbc"
    get_class dd_class, ['Data'; 'Dumper']
    if null dd_class goto no_class
    goto TYPE_OK

  no_class:
    print "fatal error: failure while loading Data/Dumper.pbc\n"
    end
TYPE_OK:

    self = get_hll_global ['Data'; 'Dumper'], 'global'
    if null self goto create_type

create_type:
    new self, ['Data'; 'Dumper']
    set_hll_global ['Data'; 'Dumper'], 'global', self

END:
    .return( self )
.end

=back

=head1 AUTHOR

Jens Rieks E<lt>parrot at jensbeimsurfen dot deE<gt> is the author
and maintainer.

=cut


# Local Variables:
#   mode: pir
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4 ft=pir: