Permalink
Browse files

Update several more libraries

  • Loading branch information...
1 parent 1336403 commit 43889496dac8bbd4a879cfcc7451520770392193 @Whiteknight Whiteknight committed Mar 11, 2012
View
@@ -12,9 +12,28 @@ standard Parrot Compiler Toolkit.
.namespace [ 'PCT' ]
+.sub 'load_bytecode' :anon
+ .param string libname
+ $P0 = load_bytecode libname
+ $I0 = $P0.'is_initialized'('load')
+ if $I0 goto done_initialization
+
+ $P1 = $P0.'subs_by_tag'('load')
+ $P2 = iter $P1
+ loop_top:
+ unless $P2 goto loop_bottom
+ $P3 = shift $P2
+ $P3()
+ goto loop_top
+ loop_bottom:
+
+ $P0.'mark_initialized'('load')
+ done_initialization:
+.end
+
.sub '__onload' :tag('load') :tag('init')
- load_bytecode 'PCT/Grammar.pbc'
- load_bytecode 'PCT/PAST.pbc'
+ 'load_bytecode'('PCT/Grammar.pbc')
+ 'load_bytecode'('PCT/PAST.pbc')
# we don't need to explicitly load HLLCompiler, because
# it's already loaded by PAST.pbc
.return ()
@@ -36,9 +36,28 @@ also included.
.namespace [ 'PCT';'Grammar' ]
+.sub 'load_bytecode' :anon
+ .param string libname
+ $P0 = load_bytecode libname
+ $I0 = $P0.'is_initialized'('load')
+ if $I0 goto done_initialization
+
+ $P1 = $P0.'subs_by_tag'('load')
+ $P2 = iter $P1
+ loop_top:
+ unless $P2 goto loop_bottom
+ $P3 = shift $P2
+ $P3()
+ goto loop_top
+ loop_bottom:
+
+ $P0.'mark_initialized'('load')
+ done_initialization:
+.end
+
.sub 'onload' :anon :tag('init') :tag('load')
- load_bytecode 'PGE.pbc'
- load_bytecode 'PGE/Util.pbc'
+ 'load_bytecode'('PGE.pbc')
+ 'load_bytecode'('PGE/Util.pbc')
.local pmc p6meta
p6meta = new 'P6metaclass'
p6meta.'new_class'('PCT::Grammar', 'parent'=>'PGE::Grammar')
@@ -47,7 +47,23 @@ See L<http://search.cpan.org/dist/Archive-Tar/>
.namespace ['Archive';'Tar';'File']
.sub '' :tag('init') :tag('load') :anon
- load_bytecode 'osutils.pbc' # splitpath
+
+ $P0 = load_bytecode 'osutils.pbc' # splitpath
+ $I0 = $P0.'is_initialized'('load')
+ if $I0 goto done_initialization
+
+ $P1 = $P0.'subs_by_tag'('load')
+ $P2 = iter $P1
+ loop_top:
+ unless $P2 goto loop_bottom
+ $P3 = shift $P2
+ $P3()
+ goto loop_top
+ loop_bottom:
+
+ $P0.'mark_initialized'('load')
+ done_initialization:
+
$P0 = newclass ['Archive';'Tar';'File']
$P0.'add_attribute'('name')
$P0.'add_attribute'('mode')
@@ -38,7 +38,20 @@ If the data is not valid, an exception will be thrown.
# Convert the text to an object and return it.
.local pmc json, code
- load_language 'data_json'
+ $P0 = load_language 'data_json'
+ $I0 = $P0.'is_initialized'('load')
+ if $I0 goto done_initialization
+
+ $P1 = $P0.'subs_by_tag'('load')
+ $P2 = iter $P1
+ loop_top:
+ unless $P2 goto loop_bottom
+ $P3 = shift $P2
+ $P3()
+ goto loop_top
+ loop_bottom:
+ $P0.'mark_initialized'('load')
+ done_initialization:
json = compreg 'data_json'
code = json.'compile'(text)
.tailcall code()
@@ -71,7 +84,21 @@ the rendered JSON will not be formatted. The default is false.
expanded = not compact
# render the object as a string.
- load_bytecode 'JSON.pbc'
+ $P0 = load_bytecode 'JSON.pbc'
+ $I0 = $P0.'is_initialized'('load')
+ if $I0 goto done_initialization
+
+ $P1 = $P0.'subs_by_tag'('load')
+ $P2 = iter $P1
+ loop_top:
+ unless $P2 goto loop_bottom
+ $P3 = shift $P2
+ $P3()
+ goto loop_top
+ loop_bottom:
+ $P0.'mark_initialized'('load')
+ done_initialization:
+
.local string output
output = _json( config, expanded )
@@ -8,7 +8,21 @@
.local string prog
prog = shift args
- load_bytecode 'Getopt/Obj.pbc'
+ $P0 = load_bytecode 'Getopt/Obj.pbc'
+ $I0 = $P0.'is_initialized'('load')
+ if $I0 goto done_initialization
+
+ $P1 = $P0.'subs_by_tag'('load')
+ $P2 = iter $P1
+ loop_top:
+ unless $P2 goto loop_bottom
+ $P3 = shift $P2
+ $P3()
+ goto loop_top
+ loop_bottom:
+ $P0.'mark_initialized'('load')
+ done_initialization:
+
.local pmc getopts
getopts = new ['Getopt';'Obj']
@@ -8,7 +8,20 @@
goto END
load_library:
- load_bytecode "Data/Dumper/Default.pbc"
+ $P0 = load_bytecode 'Data/Dumper/Default.pbc'
+ $I0 = $P0.'is_initialized'('load')
+ if $I0 goto done_initialization
+
+ $P1 = $P0.'subs_by_tag'('load')
+ $P2 = iter $P1
+ loop_top:
+ unless $P2 goto loop_bottom
+ $P3 = shift $P2
+ $P3()
+ goto loop_top
+ loop_bottom:
+ $P0.'mark_initialized'('load')
+ done_initialization:
newclass $P0, ['Data'; 'Dumper']
END:
.return ()
@@ -24,7 +24,22 @@ This module provides the default output style of C<Data::Dumper>.
goto END
create_ddb:
- load_bytecode 'Data/Dumper/Base.pbc'
+
+ $P0 = load_bytecode 'Data/Dumper/Base.pbc'
+ $I0 = $P0.'is_initialized'('load')
+ if $I0 goto done_initialization
+
+ $P1 = $P0.'subs_by_tag'('load')
+ $P2 = iter $P1
+ loop_top:
+ unless $P2 goto loop_bottom
+ $P3 = shift $P2
+ $P3()
+ goto loop_top
+ loop_bottom:
+ $P0.'mark_initialized'('load')
+ done_initialization:
+
get_class $P0, ['Data'; 'Dumper'; 'Base']
subclass $P0, $P0, ['Data'; 'Dumper'; 'Default']
END:
@@ -410,8 +410,10 @@ sub debug($message, *@params) {
sub length($s) { pir::length($s) }
INIT {
- pir::load_bytecode("nqp-setting.pbc");
- pir::load_bytecode("dumper.pbc");
+ my $pbc := pir::load_bytecode__ps("nqp-setting.pbc");
+ for $pbc.subs_by_tag('load') -> $sub { $sub(); }
+ $pbc := pir::load_bytecode__ps("dumper.pbc");
+ for $pbc.subs_by_tag('load') -> $sub { $sub(); }
}
# vim: ft=perl6
@@ -152,7 +152,20 @@ Returns the global dumper instance used by the non object interface.
goto TYPE_OK
load_yd_pir:
- load_bytecode "YAML/Dumper.pbc"
+ $P0 = load_bytecode 'YAML/Dumper.pbc'
+ $I0 = $P0.'is_initialized'('load')
+ if $I0 goto done_initialization
+
+ $P1 = $P0.'subs_by_tag'('load')
+ $P2 = iter $P1
+ loop_top:
+ unless $P2 goto loop_bottom
+ $P3 = shift $P2
+ $P3()
+ goto loop_top
+ loop_bottom:
+ $P0.'mark_initialized'('load')
+ done_initialization:
get_class yd_class, ['YAML'; 'Dumper']
if null yd_class goto no_class
goto TYPE_OK

0 comments on commit 4388949

Please sign in to comment.