NAME
Parrot::H2inc - Subroutines used in tools/build/h2inc.pl
DESCRIPTION
This package exports on demand only four subroutines used in tools/build/h2inc.pl.
SUBROUTINES
parse_file()
Arguments
$directive = parse_file($in_file, $out_file);
List of 2 elements: string holding name of incoming file; string holding name of outgoing file.
Return Value
If successful, returns a hash reference.
perform_directive()
Arguments
$defs_ref = perform_directive($directive);
Single hash reference (which is the return value from a successful run of
parse_file()
.Return Value
Array reference.
const_to_parrot()
Arguments
$gen = join "\n", const_to_parrot(@defs);
List.
Return Value
String.
const_to_perl()
Arguments
$gen = join "\n", const_to_perl(@defs);
List.
Return Value
String.
transform_name()
Arguments
transform_name( sub { $prefix . $_[0] }, @_ );
List of two or more elements, the first element of which is a subroutine reference.
Return Value
List which is a mapping of the transformations executed by the first argument upon the remaining arguments.
prepend_prefix()
Arguments
@defs = prepend_prefix $d->{prefix}, @{ $d->{defs} };
List of two or more elements, the first element of which is a string.
Return Value
List.
generate_text()
Argument
$generated_text = generate_text($directive, \@defs);
List of two arguments: Directive hashref; reference to array of definitions.
Return Value
String holding main text to be printed to new file.
print_generated_file()
Argument
print_generated_file( { in => $in_file, out => $out_file, script => $0, gen => $generated_text, } );
Hash reference. Elements pertain to file being read, file being created, calling program (typically, tools/build/h2inc.pl) and string of text to be printed to file.
Return Value
Implicitly returns true upon success.