NAME

Parrot::Ops2pm::Base - Methods inherited by Parrot::Ops2pm and Parrot::OpsRenumber.

SYNOPSIS

use base qw( Parrot::Ops2pm::Base );

$self = Parrot::Ops2pm->new( {
    argv            => [ @ARGV ],
    nolines         => $nolines_flag,
    moddir          => "lib/Parrot/OpLib",
    module          => "core.pm",
    inc_dir         => "include/parrot/oplib",
    inc_f           => "ops.h",
    script          => "tools/build/ops2pm.pl",
} );

$self->prepare_ops();

DESCRIPTION

Parrot::Ops2pm::Base provides a constructor and other method(s) to be inherited by Parrot::Ops2pm and Parrot::OpsRenumber. The former provides methods called by tools/build/ops2pm.pl, a program which is called at the very beginning of the Parrot make process. The latter is called by tools/dev/opsrenumber.pl.

METHODS

new()

  • Purpose

    Process files provided as command-line arguments to tools/build/ops2pm.pl and construct a Parrot::Ops2pm object.

  • Arguments

    Hash reference with the following elements:

    argv        :   reference to @ARGV
    nolines     :   set to true value to eliminate #line
                    directives in output
    moddir      :   directory where output module is created
                    (generally, lib/Parrot/OpLib)
    module      :   name of output module
                    (generally, core.pm)
    inc_dir     :   directory where C-header file is created
                    (generally, include/parrot/oplib)
    inc_f       :   name of output C-header file
                    (generally, ops.h)
    script      :   name of the script to be executed by 'make'
                    (generally, either tools/build/ops2pm.pl
                    or tools/dev/opsrenumber.pl)
  • Return Value

    Object of the invoking class (Parrot::Ops2pm or Parrot::OpsRenumber, as the case may be).

  • Comment

    Arguments for the constructor have been selected so as to provide subsequent methods with all information needed to execute properly and to be testable. A Parrot::Ops2pm object can be constructed lacking some of these arguments and still suffice for the execution of particular methods -- this is done during the test suite -- but such an object would not suffice for make's call to tools/build/ops2pm.pl.

prepare_ops()

  • Purpose

    Call Parrot::OpsFile::new(), then populate the resulting $opts hash reference with information from each of the .ops files provided as command-line arguments to tools/build/ops2pm.pl.

  • Arguments

    None. (Implicitly requires that at least the argv and script elements were provided to the constructor.)

  • Return Value

    None. Internally, sets the ops key in the object's data structure.

  • Comment

    This method calls Parrot::OpsFile::new() on the first .ops file found in @ARGV, then copies the ops from the remaining .ops files to the object just created. Experimental ops are marked as such.