[perl #42286] [CAGE]: Parrot::Pmc2c::PCCMETHOD constants should be autogenerated

1 view
Skip to first unread message

Jerry Gay

unread,
Apr 3, 2007, 1:37:14 PM4/3/07
to bugs-bi...@rt.perl.org
# New Ticket Created by Jerry Gay
# Please include the string: [perl #42286]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=42286 >


lib/Parrot/Pmc2c/PCCMETHOD.pm contains a number of constants, defined
for use in the package. these constants should be generated during the
configure process and included, following the DRY principle (don't
repeat yourself.)

~jerry


use constant REGNO_INT => 0;
use constant REGNO_NUM => 1;
use constant REGNO_STR => 2;
use constant REGNO_PMC => 3;

#/* 4 low bits are argument types */
use constant PARROT_ARG_INTVAL => 0x000;
use constant PARROT_ARG_STRING => 0x001;
use constant PARROT_ARG_PMC => 0x002;
use constant PARROT_ARG_FLOATVAL => 0x003;
use constant PARROT_ARG_TYPE_MASK => 0x00f;

#/* argument meaning and conversion bits */
use constant PARROT_ARG_CONSTANT => 0x010;

#/* bits a user has to define */
use constant PARROT_ARG_FLATTEN => 0x020; # /*
.flatten_arg */
use constant PARROT_ARG_SLURPY_ARRAY => PARROT_ARG_FLATTEN; # /*
i.e. foldup */

use constant PARROT_ARG_OPTIONAL => 0x080;
use constant PARROT_ARG_OPT_FLAG => 0x100; # /*
prev optional was set */
use constant PARROT_ARG_NAME => 0x200; # /*
this String is an arg name */

Allison Randal via RT

unread,
Aug 29, 2007, 12:16:25 PM8/29/07
to perl6-i...@perl.org
On Tue Apr 03 10:37:13 2007, particle wrote:
> lib/Parrot/Pmc2c/PCCMETHOD.pm contains a number of constants, defined
> for use in the package. these constants should be generated during the
> configure process and included, following the DRY principle (don't
> repeat yourself.)

In r20917, I committed a patch from Lukas Mai at the YAPC::EU hackathon,
to solve this. It refactors config/gen/parrot_include.pm, to generate
not just the .pasm versions of the constants files, but also Perl versions.

I would like to see this refactored further, so it generates .pm files
in lib/Parrot/Constants, and so lib/Parrot/Pmc2c/PCCMETHOD.pm uses the
constants as standard modules with a standard import.

The patch is a huge improvement over the existing code in modularity and
maintainability.

Allison

Reply all
Reply to author
Forward
0 new messages