| 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 classes/pmc2c2.pl to generate C code from PMC files.

does_write($method, $section)count_newlines($string)\n) in $string.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 classes/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.
get_vtable_section()init().make_const($class)const_too flag set then this method is called in init() to to create the read-only set methods.init($class)$class is its class.dont_edit($pmcfile)$pmcfile is the name of the original source *.pmc file.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.rewrite_method($class, $method, $super, $super_table)body($method)methods($line)$line is used to accumulate the number of lines.lib_load_code()pmc_is_dynpmcinit_func()no_init flag.gen_c($file)$file is the name of the original source *.pmc file.hdecls()gen_h($file)$file is the name of the original source *.pmc file.implements($method)$method.

Standard behavior.
body($method)
Returns the C code for the method body.
body($method)
implements($method)body($method, $line)
SharedRef is like Ref but with locking.
implements($method)gen_ret($type)return statement.body($method, $line)
implements($method)body($method, $line)
implements($method)body($method, $line)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)delegate PMC redirects all methods to bytecode.implements($method)body($method, $line)
This class is a wrapper around a collection of PMCs linked in the same dynamic library. A degenerate case is having an unnamed library with just ne PMC, which is the case used by the Parrot core.

new($opt, $vtable_dump, %pmcs) $library = Parrot::Pmc2c::Library->new
( $options, # hash refernce, the same passet to other constructors
$vtable_dump, # vtable.dump
pmc1 => $pmc1_dump,
pmc2 => $pmc2_dump,
... );
$options hash contains a library key its value will be used for the library name.write_all_files()gen_hgen_c

Hey! The above document had some coding errors, which are explained below:
|
|
|