NAME ^

experimental.ops - Experimental Operations

DESCRIPTION ^

This file contains operations that are in an experimental state. Do not rely upon the existence of the ops in this file when writing production code. No decision has yet been made as to whether they are accepted as regular Parrot ops or not. They are included here for testing purposes only!

Mathematical operations ^

Implementations of various mathematical operations

gcd(out INT, in NUM, in NUM)

Greatest Common divisor of $2 and $3.

gcd(out INT, out INT, out INT, in INT, in INT)

Given $4 and $5, it calculates $1, $2 and $3 so that

$1 = gcd($4, $5) = $2 * $4 + $3 * $5 (d = gcd(a,b) = x*a + y*b)

Misc other ops ^

set_eh(in PMC)

Install $1 as an exception handler.

die()

die(in INT)

Die. Hard. Calls _exit, and won't do any process cleanup

TODO encode in existing die_hard opcode.

new(out PMC, in INT, in KEY)

XXX

splice(in PMC, in PMC, in INT, in INT)

Replace $4 values at offset $3 in aggregate $1 with the PMCs in aggregate $2. The values are put into the aggregate by a shallow copy. If the values would be reused, they have to be cloned.

slice(out PMC, in PMC, in KEY)

Return a new Iterator PMC $1 for aggregate $2 and Slice PMC $3.

slice(out PMC, in PMC, in KEY, inconst INT)

Return a new list PMC $1 for aggregate $2 and Slice PMC $3.

This is a Python opcode. Range is i <= k < j. $4 must be 1. May change and move to python.ops.

iter(out PMC, in PMC)

Return a new Iterator PMC $1 for aggregate $2.

morph(in PMC, in INT)

Have $1 turn itself into a PMC of type $2.

exec(in STR)

Execute the passed-in command. Completely tosses the current process image and replaces it with the command. Doesn't exit (the program ends, after all), though it does throw an exception if something goes wrong.

is_cclass(out INT, in INT, in STR, in INT)

Set $1 to 1 if the codepoint of $3 at position $4 is in the character class(es) given by $2.

find_cclass(out INT, in INT, in STR, in INT, in INT)

Set $1 to the offset of the first codepoint matching the character class(es) given by $2 in string $3, starting at offset $4 for up to $5 codepoints. If no matching character is found, set $1 to -1.

find_not_cclass(out INT, in INT, in STR, in INT, in INT)

Set $1 to the offset of the first codepoint not matching the character class(es) given by $2 in string $3, starting at offset $4 for up to $5 codepoints. If the substring consists entirely of matching characters, set $1 to -1.

Function argument opcode ^

Implementations of function argument and params handling

set_args(inconst PMC /* , ... */)

Define arguments for the next function call.

get_results(inconst PMC /* , ... */)

Define return values for the next function call.

get_params(inconst PMC /* , ... */)

Define function parameters for this subroutine.

set_returns(inconst PMC /* , ... */)

Define return results for the subroutine return statement.

For all of these opcodes the passed in PMC constant is the string representation of a fixed integer array with one flag word per argument. The flags are documented currently in include/parrrot/enum.h only.

After this argument a variable amount of arguments must follow according to the elements of the signature array.

if_null(in PMC, labelconst INT)

Branch to $2 if $1 is a NULL PMC.

unless_null(in PMC, labelconst INT)

Branch to $2 if $1 is not a NULL PMC.

COPYRIGHT ^

Copyright (C) 2001-2004 The Perl Foundation. All rights reserved.

LICENSE ^

This program is free software. It is subject to the same license as the Parrot interpreter itself.


parrot