Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Substitute several more pir ops by their nqp op counterparts.

  • Loading branch information...
commit b54894d4b6d74ed893d2bb57553ae64fab5fde87 1 parent 9ccc8eb
kristof authored
View
4 src/Perl6/Actions.pm
@@ -2848,7 +2848,7 @@ class Perl6::Actions is HLL::Actions {
# steals spaces after a postfixish. Thus "$a $b" would get messed up.
# Here we take them back again. Hacky, better solutions welcome.
sub steal_back_spaces($/, $expr) {
- my $pos := pir::length__IS($/) - 1;
+ my $pos := nqp::chars($/) - 1;
while pir::is_cclass__IISI(32, $/, $pos) {
$pos--;
}
@@ -3320,7 +3320,7 @@ class Perl6::Actions is HLL::Actions {
# the $usage parameter to make it more helpful.
sub compile_time_value_str($past, $usage, $/) {
if $past<has_compile_time_value> {
- pir::repr_unbox_str__SP($past<compile_time_value>);
+ nqp::unbox_s($past<compile_time_value>);
}
else {
$/.CURSOR.panic("$usage must have a value known at compile time");
View
2  src/Perl6/Grammar.pm
@@ -1730,7 +1730,7 @@ grammar Perl6::Grammar is HLL::Grammar {
sub bracket_ending($matches) {
my $check := $matches[+$matches - 1];
my $str := $check.Str;
- my $last := pir::substr($str, pir::length__IS($check) - 1, 1);
+ my $last := pir::substr($str, nqp::chars($check) - 1, 1);
$last eq ')' || $last eq '}' || $last eq ']' || $last eq '>'
}
View
6 src/Perl6/Metamodel/BOOTSTRAP.pm
@@ -46,15 +46,15 @@ Mu.HOW.add_parrot_vtable_mapping(Mu, 'get_bool',
sub ($self) { $self.Bool() });
Mu.HOW.add_parrot_vtable_mapping(Mu, 'get_integer',
sub ($self) {
- pir::repr_unbox_int__IP($self.Int())
+ nqp::unbox_i($self.Int())
});
Mu.HOW.add_parrot_vtable_mapping(Mu, 'get_number',
sub ($self) {
- pir::repr_unbox_num__NP($self.Num())
+ nqp::unbox_n($self.Num())
});
Mu.HOW.add_parrot_vtable_mapping(Mu, 'get_string',
sub ($self) {
- pir::repr_unbox_str__SP($self.Str())
+ nqp::unbox_s($self.Str())
});
Mu.HOW.add_parrot_vtable_mapping(Mu, 'defined',
sub ($self) { pir::istrue__IP($self.defined()) });
View
2  src/Perl6/Module/Loader.pm
@@ -30,7 +30,7 @@ method need($name, %name_adverbs?) {
# Need not load file if we already did so.
unless %LOADED{$pm_file} {
# Is there a pre-compiled PIR version?
- my $pir_file := pir::substr__SSII($pm_file, 0, pir::index__ISSi($pm_file, '.', pir::length__IS($pm_file)-4)) ~ '.pir';
+ my $pir_file := pir::substr__SSII($pm_file, 0, pir::index__ISSi($pm_file, '.', nqp::chars($pm_file)-4)) ~ '.pir';
my $loaded_pir := 0;
# stat[7]: modifytime
if pir::stat__ISI($pir_file, 0)
View
16 src/Perl6/Module/Locator.pm
@@ -8,29 +8,29 @@ method find_candidates($lookfor, @inc) {
my @dirs := pir::split__PSS('::', $lookfor);
my $file := @dirs.pop();
my $localpath := +@dirs ?? pir::join__SSP('/', @dirs) ~ '/' !! '';
- # pir::say("\nlookfor: $lookfor\nlocalpath: $localpath\nfile: $file");
+ # nqp::say("\nlookfor: $lookfor\nlocalpath: $localpath\nfile: $file");
# within each @inc path look for "$localpath/$file.pm"
my @candidates;
for @inc {
my $path := "$_/$localpath";
- # pir::say(" path: $path");
- my $check_path := pir::substr__SSII($path, 0, pir::length__IS($path) - 1);
+ # nqp::say(" path: $path");
+ my $check_path := pir::substr__SSII($path, 0, nqp::chars($path) - 1);
if pir::stat__ISI($check_path, 0) && pir::stat__ISI($check_path, 2) {
my @dir := pir::new__PS('OS').readdir($path);
my $candidate := "";
for @dir {
- # pir::say(" readdir: $_");
- if pir::substr__SSII($_, 0, pir::length__IS($file) + 1) eq $file ~ '.' {
- if pir::substr__SSII($_, pir::length__IS($_) - 4, 4) eq '.pm6' ||
- !$candidate && pir::substr__SSII($_, pir::length__IS($_) - 3, 3) eq '.pm' {
+ # nqp::say(" readdir: $_");
+ if pir::substr__SSII($_, 0, nqp::chars($file) + 1) eq $file ~ '.' {
+ if pir::substr__SSII($_, nqp::chars($_) - 4, 4) eq '.pm6' ||
+ !$candidate && pir::substr__SSII($_, nqp::chars($_) - 3, 3) eq '.pm' {
$candidate := "$path$_";
}
}
}
if $candidate {
@candidates.push($candidate);
- # pir::say(" found: $candidate");
+ # nqp::say(" found: $candidate");
}
}
}
View
2  src/core/Array.pm
@@ -23,7 +23,7 @@ class Array {
method STORE(|$) {
# get arguments, shift off invocant
my $args := pir::perl6_current_args_rpa__P();
- pir::shift__PP($args);
+ nqp::shift($args);
# clear our current items, and create a flattening iterator
# that will bring in values from $args
pir::setattribute__vPPsP(self, List, '$!items', Mu);
View
10 src/core/Cool.pm
@@ -4,7 +4,7 @@ my class Cool {
}
method chars() {
- nqp::p6box_i(pir::length__IS(nqp::unbox_s(self.Str)));
+ nqp::p6box_i(nqp::chars(nqp::unbox_s(self.Str)));
}
method substr($start as Int, $length?) {
@@ -29,11 +29,11 @@ my class Cool {
}
method uc() {
- nqp::p6box_s(pir::upcase__SS(nqp::unbox_s(self.Str)))
+ nqp::p6box_s(nqp::uc(nqp::unbox_s(self.Str)))
}
method lc() {
- nqp::p6box_s(pir::downcase__SS(nqp::unbox_s(self.Str)))
+ nqp::p6box_s(nqp::lc(nqp::unbox_s(self.Str)))
}
method ucfirst() {
@@ -47,7 +47,7 @@ my class Cool {
}
method ord() {
- nqp::p6box_i(pir::ord__IS(nqp::unbox_s(self.Str)))
+ nqp::p6box_i(nqp::ord(nqp::unbox_s(self.Str)))
}
method flip() {
@@ -56,7 +56,7 @@ my class Cool {
proto method index(|$) {*}
multi method index(Cool \$needle, Cool $pos = 0) {
- my $result := nqp::p6box_i(pir::index__ISSI(
+ my $result := nqp::p6box_i(nqp::index(
nqp::unbox_s(self.Str),
nqp::unbox_s($needle.Str),
nqp::unbox_i($pos.Int)
View
6 src/core/EnumMap.pm
@@ -5,7 +5,7 @@ my class EnumMap {
method exists(Str \$key) {
nqp::p6bool(
pir::defined($!storage)
- && pir::exists__IQs($!storage, nqp::unbox_s($key))
+ && nqp::existskey($!storage, nqp::unbox_s($key))
)
}
@@ -20,7 +20,7 @@ my class EnumMap {
my Mu $iter := pir::iter__PP($!storage);
my Mu $pair;
while $iter {
- $pair := pir::shift__PP($iter);
+ $pair := nqp::shift($iter);
take Pair.new(:key($pair.key), :value($pair.value));
}
}
@@ -28,7 +28,7 @@ my class EnumMap {
method at_key(Str \$key) {
self.exists($key)
- ?? pir::set__PQs($!storage, nqp::unbox_s($key))
+ ?? nqp::atkey($!storage, nqp::unbox_s($key))
!! Any
}
View
2  src/core/IO.pm
@@ -1,7 +1,7 @@
# XXX Relatively cheaty, just to get us able to output something.
# But you should see what USED to be here! O.O
sub print(*@list) {
- pir::print(@list.shift) while @list.gimme(1);
+ nqp::print(@list.shift) while @list.gimme(1);
1.Bool
}
View
10 src/core/List.pm
@@ -16,7 +16,7 @@ class List {
method at_pos(\$pos) {
self.exists($pos)
- ?? pir::set__PQi($!items, nqp::unbox_i($pos))
+ ?? nqp::atpos($!items, nqp::unbox_i($pos))
!! Mu
}
@@ -31,7 +31,7 @@ class List {
method exists(\$pos) {
self.gimme($pos + 1);
- nqp::p6bool(pir::exists__IQI($!items, nqp::unbox_i($pos)))
+ nqp::p6bool(nqp::existspos($!items, nqp::unbox_i($pos)))
}
method flat() {
@@ -76,7 +76,7 @@ class List {
method munch($n is copy) {
self.gimme($n);
my Mu $rpa := pir::new__Ps('ResizablePMCArray');
- pir::push__vPP($rpa, pir::shift__PP($!items))
+ pir::push__vPP($rpa, nqp::shift($!items))
while $!items && $n-- > 0;
pir__perl6_box_rpa__PP($rpa)
}
@@ -89,7 +89,7 @@ class List {
method shift() {
# make sure we have at least one item, then shift+return it
- self.gimme(1) && pir::shift__PP($!items)
+ self.gimme(1) && nqp::shift($!items)
}
multi method perl(List:D \$self:) {
@@ -99,7 +99,7 @@ class List {
}
method STORE_AT_POS(\$pos, Mu \$v) {
- pir::set__1QiP($!items, nqp::unbox_i($pos), $v)
+ nqp::bindpos($!items, nqp::unbox_i($pos), $v)
}
method RPA() {
View
20 src/core/ListIter.pm
@@ -13,7 +13,7 @@ my class ListIter {
my $flattens = $!list.defined && $!list.flattens;
my $eager = Whatever.ACCEPTS($n);
while $!rest && ($eager || $n > 0) {
- $x := pir::set__PQi($!rest, 0);
+ $x := nqp::atpos($!rest, 0);
if pir::not__II(pir::is_container__IP($x)) && $x.defined
&& Iterable.ACCEPTS($x) {
last if $eager && $x.infinite;
@@ -29,9 +29,9 @@ my class ListIter {
pir__perl6_unbox_rpa__PP($x),
0, 1);
}
- elsif Nil.ACCEPTS($x) { pir::shift__PP($!rest) }
+ elsif Nil.ACCEPTS($x) { nqp::shift($!rest) }
else {
- pir::shift__PP($!rest);
+ nqp::shift($!rest);
$x := $!list.STORE_AT_POS($pos, $x) if $!list.defined;
pir::push__vPP($rpa, $x);
$eager or $n = $n - 1;
@@ -55,8 +55,8 @@ my class ListIter {
method infinite() {
$!rest
- ?? Iterable.ACCEPTS(pir::set__PQi($!rest,0))
- && pir::set__PQi($!rest,0).infinite
+ ?? Iterable.ACCEPTS(nqp::atpos($!rest,0))
+ && nqp::atpos($!rest,0).infinite
|| Mu
!! 0.Bool
}
@@ -79,9 +79,9 @@ my class ListIter {
# we leave these here for documentation purposes.
# sub pir::perl6_list_from_rpa__PPPP(|$) {
# my $args := pir::perl6_current_args_rpa__P();
-# my $type := pir::shift__PP($args);
-# my Mu $rpa := pir::shift__PP($args);
-# my $flattens := pir::shift__PP($args);
+# my $type := nqp::shift($args);
+# my Mu $rpa := nqp::shift($args);
+# my $flattens := nqp::shift($args);
#
# my $list := pir::repr_instance_of__PP($type);
# pir::setattribute__vPPsP($list, $type, '$!flattens', $flattens);
@@ -92,8 +92,8 @@ my class ListIter {
#
# sub pir::perl6_iter_from_rpa__PPP(|$) {
# my $args := pir::perl6_current_args_rpa__P();
-# my Mu $rpa := pir::shift__PP($args);
-# my $list := pir::shift__PP($args);
+# my Mu $rpa := nqp::shift($args);
+# my $list := nqp::shift($args);
#
# pir::setattribute__0PPsP(
# pir::setattribute__0PPsP(
View
4 src/core/Mu.pm
@@ -60,14 +60,14 @@ my class Mu {
sub DUMP(|$) {
my Mu $args := pir::perl6_current_args_rpa__P();
- my Mu $topic := pir::shift__PP($args);
+ my Mu $topic := nqp::shift($args);
if pir::isnull__IP($topic) { '(null)' }
elsif pir::isa__IPs($topic, 'ResizablePMCArray') {
my $s = 'RPA<' ~ nqp::p6box_s(pir::get_addr__IP($topic)) ~ '>(';
my $t = '';
$topic := pir::clone__PP($topic);
while $topic {
- my Mu $x := pir::shift__PP($topic);
+ my Mu $x := nqp::shift($topic);
$s = $s ~ $t ~ DUMP($x);
$t = ', ';
}
View
8 src/core/Parcel.pm
@@ -12,7 +12,7 @@ my class Parcel {
multi method gist(Parcel:D:) {
my @gist;
my Mu $rpa := pir::clone__PP($!storage);
- @gist.push( pir::shift__PP($rpa).gist ) while $rpa;
+ @gist.push( nqp::shift($rpa).gist ) while $rpa;
@gist;
}
@@ -20,9 +20,9 @@ my class Parcel {
my Mu $rpa := pir::clone($!storage);
my $perl = '(';
if $rpa {
- $perl = $perl ~ pir::shift__PP($rpa).perl;
+ $perl = $perl ~ nqp::shift($rpa).perl;
if $rpa {
- $perl = $perl ~ ', ' ~ pir::shift__PP($rpa).perl while $rpa;
+ $perl = $perl ~ ', ' ~ nqp::shift($rpa).perl while $rpa;
}
else {
$perl = $perl ~ ',';
@@ -65,7 +65,7 @@ sub pir__perl6_box_rpa__PP(|$) {
pir::repr_instance_of__PP(Parcel),
Parcel,
'$!storage',
- pir::shift__PP(pir::perl6_current_args_rpa__P()))
+ nqp::shift(pir::perl6_current_args_rpa__P()))
}
sub pir__perl6_unbox_rpa__PP(\$parcel) {
View
12 src/core/Str.pm
@@ -37,27 +37,27 @@ multi infix:<~>(Str \$a, Str \$b) {
}
multi infix:<eq>(Str \$a, Str \$b) {
- nqp::p6bool(pir::iseq__ISS(nqp::unbox_s($a), nqp::unbox_s($b)))
+ nqp::p6bool(nqp::iseq_s(nqp::unbox_s($a), nqp::unbox_s($b)))
}
multi infix:<ne>(Str \$a, Str \$b) {
- nqp::p6bool(pir::isne__ISS(nqp::unbox_s($a), nqp::unbox_s($b)))
+ nqp::p6bool(nqp::isne_s(nqp::unbox_s($a), nqp::unbox_s($b)))
}
multi infix:<lt>(Str \$a, Str \$b) {
- nqp::p6bool(pir::islt__ISS(nqp::unbox_s($a), nqp::unbox_s($b)))
+ nqp::p6bool(nqp::islt_s(nqp::unbox_s($a), nqp::unbox_s($b)))
}
multi infix:<le>(Str \$a, Str \$b) {
- nqp::p6bool(pir::isle__ISS(nqp::unbox_s($a), nqp::unbox_s($b)))
+ nqp::p6bool(nqp::isle_s(nqp::unbox_s($a), nqp::unbox_s($b)))
}
multi infix:<gt>(Str \$a, Str \$b) {
- nqp::p6bool(pir::isgt__ISS(nqp::unbox_s($a), nqp::unbox_s($b)))
+ nqp::p6bool(nqp::isgt_s(nqp::unbox_s($a), nqp::unbox_s($b)))
}
multi infix:<ge>(Str \$a, Str \$b) {
- nqp::p6bool(pir::isge__ISS(nqp::unbox_s($a), nqp::unbox_s($b)))
+ nqp::p6bool(nqp::isge_s(nqp::unbox_s($a), nqp::unbox_s($b)))
}
Please sign in to comment.
Something went wrong with that request. Please try again.