Parrot::Pmc2c::Pmc2cMain

Parrot::Pmc2c::Pmc2cMain is a Perl module that contains functions called within tools/build/pmc2c.pl.
Download

Parrot::Pmc2c::Pmc2cMain Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • James E Keenan
  • Publisher web site:
  • http://search.cpan.org/~particle/parrot-0.6.1/lib/Parrot/Pmc2c/Pmc2cMain.pm

Parrot::Pmc2c::Pmc2cMain Tags


Parrot::Pmc2c::Pmc2cMain Description

Parrot::Pmc2c::Pmc2cMain is a Perl module that contains functions called within tools/build/pmc2c.pl. Parrot::Pmc2c::Pmc2cMain is a Perl module that contains functions called within tools/build/pmc2c.pl.SYNOPSIS use Parrot::Pmc2c::Pmc2cMain;Purpose: Parrot::Pmc2c::Pmc2cMain constructor.Arguments: Reference to a hash holding 3 required keys: * include Array reference. Array passed holds list of paths in which various methods should try to locate files. * opt Hash reference. Holds results of processing of options to pmc2c.pl(). * args Array reference. In most cases, the array passed will hold the elements of @ARGV remaining after options processing.Return Values: Parrot::Pmc2c::Pmc2cMain object. Will die with error message if arguments are defective.dump_vtable() $self->dump_vtable("$Bin/../../src/vtable.tbl");Purpose: Create a .dump file for the default vtable (from which all PMCs inherit).Arguments: Scalar holding filename of vtable.Return Values: Scalar holding path to .dump file.Comments: In earlier version of pmc2c.pl, this subroutine returned undef upon success. This was changed to more Perl-ish 1.If the caller of this subroutine has chdir-ed to a tempdir before this subroutine is called -- as ought to be the case during testing of build tools -- then vtable.dump will be created within that tempdir. Otherwise, vtable.dump is created in the caller's working directory. When the caller is make, that directory is the top-level Parrot directory.dump_pmc()see lib/Parrot/Pmc2c/Dumper.print_tree() $self->print_tree( { depth => 0, files => , # optional } );Purpose: Print the inheritance tree for each of the files, using the given directories to search for all of correct PMCs.Arguments: Reference to hash holding key-value pairs. * depth Number holding the display depth. Used for the recursive definition of this function. Defaults to 0 if not specified. * files Optional. Reference to an array holding a list of files. If not supplied, the value of the args key in Parrot::Pmc2c::Pmc2cMain::new() will be used. (This is used for the recursive call.)Return Values: 1 upon successful printing.Comment: In earlier version of pmc2c.pl, this subroutine returned undef upon success. This was changed to more Perl-ish 1.The purpose of this method is unclear. (1) It is not called by Makefile. (2) Since internally calls read_dump(), a .dump file must already exist for this method to generate meaningful output. But since .dump files do not exist prior to calling make, this can only be viewed as an attempt at a utility method to be called after make has run. That might be useful. It would be responding to a request such as, "Given these .dump files, reconstruct the inheritance trees of their ancestral .pmc files." But that's a very different purpose from the other methods in this program, whose point is to go from .pmc to .c files.read_dump() $self->read_dump('filename');Purpose: A .dump file is the result of a call to dump_pmc() and consists of a binary dump of a hash reference, Storable-style. read_dump() reads in the .dump file, recreates the data structure and returns a new hash reference holding the data structure.Arguments: Scalar holding name of file whose structure is to be dumped. The method will only process foo.dump files, but you can also pass 'foo.c' or 'foo.pmc' as the argument and it will analyze the corresponding foo.dump file.Return Values: Reference to hash holding recreated data structure.Comment: If the appropriate .dump file cannot be located, program will die with error message (see find_file() above). Called internally by print_tree(), gen_c(), gen_parent_list(), dump_pmc().gen_c() $return_value = $self->gen_c();Purpose: Generate the C source code file for each of the files passed in, using the directories passed in to search for the PMC dump files.Arguments: None.Return Values: Returns 1 upon success.Comment: Internally calls Parrot::Pmc2c::Library::new() and write_all_files(). In earlier version of pmc2c.pl, this subroutine returned undef upon success. This was changed to more Perl-ish 1.SubroutinesThese are auxiliary subroutines called inside the methods described above.find_file() $path = $self->find_file($file, $die_unless_found_flag);Purpose: Return the full path to $file. (Search in the directories listed in the include key in the hash passed by reference to the constructor). Optionally, die with an error message if that file cannot be found.Arguments: Two arguments. Required: string holding name of the file sought. Optional: a flag variable which, if set to a true value, will cause program to die if file is not located.Return Values: Upon success, string holding a path. Upon failure, undef (unless $die_unless_found_flag is set to a true value, in which case program dies).Comment: Called inside read_dump() and dump_pmc(). Requirements: · Perl


Parrot::Pmc2c::Pmc2cMain Related Software