Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Added nqp::seekfh, nqp::readfh on parrot backend.
  • Loading branch information
donaldh committed May 16, 2014
1 parent 0ea245b commit d4c8ae3
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/vm/parrot/QAST/Operations.nqp
Expand Up @@ -1660,6 +1660,15 @@ QAST::Operations.add_core_op('setencoding', -> $qastcomp, $op {
$op[0], $op[1]
))
});
QAST::Operations.add_core_op('seekfh', -> $qastcomp, $op {
if +@($op) != 3 {
nqp::die('seekfh requires 3 operands');
}
$qastcomp.as_post(QAST::Op.new(
:op('callmethod'), :name('seek'),
$op[0], $op[2], $op[1]
))
});
QAST::Operations.add_core_op('tellfh', -> $qastcomp, $op {
if +$op.list != 1 {
nqp::die("The 'tellfh' op expects one operand");
Expand Down Expand Up @@ -1747,6 +1756,18 @@ QAST::Operations.add_core_op('closefh', -> $qastcomp, $op {
$op[0]
))
});
QAST::Operations.add_core_op('readfh', -> $qastcomp, $op {
if +@($op) != 3 {
nqp::die('readfh requires 3 operands');
}
$qastcomp.as_post(QAST::VM.new(:pirop('nqp_encode__PssP'),
QAST::Op.new(:op('callmethod'), :name('get_string'), :returns(str),
QAST::Op.new(:op('callmethod'), :name('read_bytes'), $op[0], $op[2]),
QAST::SVal.new(:value('binary')) ),
QAST::SVal.new(:value('binary')),
$op[1]
))
});

QAST::Operations.add_core_op('chmod', -> $qastcomp, $op {
if +$op.list != 2 {
Expand Down

0 comments on commit d4c8ae3

Please sign in to comment.