parrotcode: PMC to C Code Generation | |
Contents | Perl Modules |
Parrot::Pmc2c - PMC to C Code Generation
use Parrot::Pmc2c;
Parrot::Pmc2c
(and the subclasses defined in this file) is used by tools/build/pmc2c.pl to generate C code from PMC files.
count_newlines($string)
\n
) in $string
.dont_edit($pmcfile)
$pmcfile
is the name of the original source *.pmc file.gen_ret($method, $body)
return
statement, if the body is empty then make a cast if needed.class_name($self, $class)
Parrot::Pmc2c
subclass for the PMC ($self->{class}
). $self
is the hash reference passed to new()
, and $class
is Parrot::Pmc2c
.dynext_load_code($library_name, %classes)
$library_name
is the name of the dynamic library to be created.%classes
is a map from the PMC names for which code is to be generated, to dump info (PMC metadata).new($self, $opt)
$self
as a new instance.$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
.$opt
is a hash reference.does_write($method)
$method
writes our value.line_directive($self,$line,$file)
$self-
{opt}{nolines}> is true.line_directive_here($self,$output,$file)
get_vtable_section()
init()
.get_vtable_attrs()
init()
make_constlike($class, $type, $is_variant)
make_const($class)
const_too
flag set then this method is called in init()
to to create the read-only set methods.make_ro($class)
const_too
set (FIXME?) then this method is called to create the read-only set methods and vtable variant.init($class)
$class
is its class.decl($classname, $method, $for_header)
$for_header
indicates whether the code is for a header or implementation file.includes()
#include
for the header file of each of the PMC's superclasses.full_arguments($args)
INTERP, SELF
to $args
.proto($type,$parameters)
rewrite_nci_method($class, $method, $super, $super_table)
rewrite_vtable_method($class, $method, $super, $super_table)
body($method, $line, $out_name)
$line
is used to accumulate the number of lines, $out_name
is the name of the output file we are generating.methods($line, $out_name)
$line
is used to accumulate the number of lines, $out_name
is the name of the output file we are generating.lib_load_code()
pmc_is_dynpmc
find_mmd_methods()
[index, dynamic PMC]
pairs of right entries in the MMD table that will need to be resolved at runtime.find_vtable_methods()
vtable_decl($name)
$name
with the functions for this class.init_func()
no_init
flag.gen_c($out_name)
$out_name
is the name of the output file we are generating.hdecls()
gen_h($out_name)
$out_name
is the name of the output file we are generating.c_code_coda()
implements($method)
$method
.implements_vtable($method)
$method
.Standard behavior.
body($method, $line, $out_name)
$line
is used to accumulate the number of lines, $out_name
is the name of the output file we are generating.Returns the C code for the method body.
body($method, $line, $out_name)
$line
is used to accumulate the number of lines, $out_name
is the name of the output file we are generating.Returns the C code for the method body.
implements($method)
$method
. This is true in the special case of find_method
and for all read-only methods.body($method, $line, $out_name)
$line
is used to accumulate the number of lines, $out_name
is the name of the output file we are generating.implements($method)
prederef($method)
postderef($method)
raw_deref($method)
body($method, $line, $out_name)
$line
is used to accumulate the number of lines, $out_name
is the name of the output file we are generating.prederef($method)
postderef($method)
implements($method)
body($method, $line, $out_name)
$line
is used to accumulate the number of lines, $out_name
is the name of the output file we are generating.implements($method)
body($method, $line, $out_name)
$line
is used to accumulate the number of lines, $out_name
is the name of the output file we are generating.Null
PMC throws an execption for all methods.implements($method)
trans($type)
signature()
to normalize argument types.signature($params)
$params
.gen_ret($type)
return
statement.body($method, $line, $out_name)
$line
is used to accumulate the number of lines, $out_name
is the name of the output file we are generating.delegate
PMC redirects all methods to bytecode.implements($method)
body($method, $line, $out_name)
$line
is used to accumulate the number of lines, $out_name
is the name of the output file we are generating.
|