Parrot::Pmc2c - PMC to C Code Generation
use Parrot::Pmc2c;
Parrot::Pmc2c is used by tools/build/pmc2c.pl to generate C code from PMC files.
Parrot::Pmc2c
new($self, $opt)
Returns $self as a new instance.
$self
$self is a hash reference eval-ed from a *.dump file generated by tools/build/pmc2c.pl from a *.pmc file. It is bless-ed either into Parrot::Pmc2c::Standard, or into one of the other special PMCs: default, delegate, Null, Ref or SharedRef.
eval
bless
Parrot::Pmc2c::Standard
delegate
Null
Ref
SharedRef
$opt is a hash reference.
$opt
does_write($method)
Returns true if the vtable method $method writes our value.
$method
line_directive($self,$line,$file)
Generates the C pre processor string for a #line directive, or an empty string if $self-{opt}{nolines}> is true.
$self-
line_directive_here($self,$output,$file)
Generates the C pre processor string for a #line directive to reset the compiler's line number to the next physical line in the output.
make_constlike($type, $is_variant)
Create a variant for Const or RO.
make_const()
If the PMC had its const_too flag set then this method is called in init() to to create the read-only set methods.
const_too
init()
make_ro()
If the PMC doesn't have const_too set (FIXME?) then this method is called to create the read-only set methods and vtable variant.
Initializes the instance.
decl($classname, $method, $for_header, $unused)
Returns the C code for the PMC method declaration. $for_header indicates whether the code is for a header or implementation file. $unused indicates if the args should be all unsued.
$for_header
$unused
includes()
Returns the C #include for the header file of each of the PMC's superclasses.
#include
full_arguments($args)
Prepends INTERP, SELF to $args.
INTERP, SELF
$args
proto($type,$parameters)
Determines the prototype (argument signature) for a method body (see src/call_list).
rewrite_nci_method($self, $class, $method, $super, $super_table)
Rewrites the method body performing the various macro substitutions for nci method bodies (see tools/build/pmc2c.pl).
rewrite_vtable_method($self, $class, $method, $super, $super_table)
Rewrites the method body performing the various macro substitutions for vtable method bodies (see tools/build/pmc2c.pl).
body($method, $line, $out_name)
Returns the C code for the method body. $line is used to accumulate the number of lines, $out_name is the name of the output file we are generating.
$line
$out_name
methods($line, $out_name)
Returns the C code for the vtable methods. $line is used to accumulate the number of lines, $out_name is the name of the output file we are generating.
pmc_is_dynpmc
Determines if a given PMC type is dynamically loaded or not.
find_mmd_methods()
Returns three values:
The first is an arrayref of <[ mmd_number, left_type, right_type, implementation_func]> suitable for initializing the MMD list.
The second is a arrayref listing dynamic PMCs which will need to be looked up.
The third is a list of [index, dynamic PMC] pairs of right_type entries in the MMD table that will need to be resolved at runtime.
[index, dynamic PMC]
find_vtable_methods()
Returns an arrayref containing the vtable methods in the order they appear in the vtable.
vtable_decl($name)
Returns the C code for the declaration of a vtable temporary named $name with the functions for this class.
$name
init_func()
Returns the C code for the PMC's initialization method, or an empty string if the PMC has a no_init flag.
no_init
gen_c($out_name)
Generates the C implementation file code for the PMC. $out_name is the name of the output file we are generating.
hdecls()
Returns the C code function declarations for all the methods for inclusion in the PMC's C header file.
TODO include MMD variants.
gen_h($out_name)
Generates the C header file code for the PMC. $out_name is the name of the output file we are generating.
implements($method)
True if this class generates code for the method $method.
implements_vtable($method)
True if this class generates code for VTABLE method $method.
To install Parrot::Op, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Parrot::Op
CPAN shell
perl -MCPAN -e shell install Parrot::Op
For more information on module installation, please visit the detailed CPAN module installation guide.