Permalink
Browse files

Resolve ticket #38168 ([TODO] - Tcl - :slurpy HLL mappings)

Allow pmc2c to handle multiple HLL mappings in the specification of a PMC.

[tcl]

Take advantage of this; simplify some code that no longer has to
re-box the passed in array of args.




git-svn-id: https://svn.parrot.org/parrot/trunk@23272 d31e2699-5ff4-0310-a27c-f18f2fbe73fe
  • Loading branch information...
1 parent 5528e9f commit b6641b08050605165fa81a2e848c7a60730a0ae2 @coke coke committed Nov 30, 2007
Showing with 14 additions and 8 deletions.
  1. +4 −2 docs/pmc2c.pod
  2. +1 −4 languages/tcl/runtime/builtin/list.pir
  3. +1 −0 languages/tcl/src/pmc/tcllist.pmc
  4. +8 −2 lib/Parrot/Pmc2c/PMCEmitter.pm
View
6 docs/pmc2c.pod
@@ -126,11 +126,13 @@ The High level language this PMC corresponds to.
The basic parrot PMC type that this PMC correspond to for C<.HLL>
usage. For example:
- pmcclass TclInt hll Tcl maps Integer
+ pmclass TclInt hll Tcl maps Integer
allows this PMC to automatically be used when autoboxing C<I> registers to PMCs.
-Requires the C<hll> flag.
+Requires the C<hll> flag. Note that multiple mappings can be specified:
+
+ pmclass myOrderedHash hll frob maps Hash maps Array
=back
View
5 languages/tcl/runtime/builtin/list.pir
@@ -7,10 +7,7 @@
.sub '&list'
.param pmc argv :slurpy
- $P0 = new 'TclList'
- assign $P0, argv
-
- .return($P0)
+ .return(argv)
.end
# Local Variables:
View
1 languages/tcl/src/pmc/tcllist.pmc
@@ -30,6 +30,7 @@ pmclass TclList
group tcl_group
hll Tcl
maps Array
+ maps ResizablePMCArray
{
/*
View
10 lib/Parrot/Pmc2c/PMCEmitter.pm
@@ -569,15 +569,21 @@ EOC
if ( $self->{flags}{hll} && $self->{flags}{maps} ) {
my $hll = $self->{flags}{hll};
- my $maps = ( keys %{ $self->{flags}{maps} } )[0];
$cout .= <<"EOC";
{
/* Register this PMC as a HLL mapping */
INTVAL pmc_id = Parrot_get_HLL_id( interp, const_string(interp, "$hll")
);
- if (pmc_id > 0)
+ if (pmc_id > 0) {
+EOC
+ foreach my $maps ( keys %{ $self->{flags}{maps} } ) {
+ $cout .= <<"EOC";
Parrot_register_HLL_type( interp, pmc_id, enum_class_$maps, entry);
+EOC
+ }
+ $cout .= <<"EOC";
+ }
} /* Register */
EOC
}

0 comments on commit b6641b0

Please sign in to comment.