@@ -353,6 +353,7 @@ sub new {
353
353
$self -> {' escape_spaces' } = $self -> escape_spaces();
354
354
$self -> {' current_template' } = undef ;
355
355
$self -> {' make_coexistence' } = $makeco ;
356
+ $self -> {' forcount' } = 0;
356
357
357
358
$self -> add_default_matching_assignments();
358
359
$self -> reset_generating_types();
@@ -4679,8 +4680,13 @@ sub get_custom_value {
4679
4680
for my $tag (@{$self -> {' custom_multi_cmd' }-> {$based }}) {
4680
4681
my $command = $self -> get_custom_assign_or_override(' command' , $tag ,
4681
4682
$based , @params );
4682
- push (@$value , $command );
4683
- my $det = $self -> {' custom_multi_details' }-> {$command } = {};
4683
+
4684
+ # # Use $tag as the key for custom_multi_details and store the command as
4685
+ # # a data member that we can access later. $command shouldn't be used
4686
+ # # as the key because it is not guaranteed to be unique.
4687
+ my $det = $self -> {' custom_multi_details' }-> {$tag } = {' _cmd' => $command ,
4688
+ ' type' => $tag ,
4689
+ ' outfile' => ' ' };
4684
4690
for my $k (keys %details ) {
4685
4691
$det -> {$k } = $self -> get_custom_assign_or_override($details {$k }, $tag ,
4686
4692
$based , @params );
@@ -4702,11 +4708,16 @@ sub get_custom_value {
4702
4708
}
4703
4709
}
4704
4710
}
4705
- }
4706
- elsif ($cmd eq ' flags' || $cmd eq ' outopt' || $cmd eq ' outfile' ||
4707
- $cmd eq ' gdir' ) {
4708
- # only used with 'combined_custom'
4709
- $value = $self -> {' custom_multi_details' }-> {$based }-> {$cmd } || ' ' ;
4711
+
4712
+ # # Sort the list of types so that generated projects are reproducable.
4713
+ # # Additionally, we need them to be ordered (and numbered) so that we can
4714
+ # # match the command with the right tag when iterating in the template.
4715
+ my $det = $self -> {' custom_multi_details' };
4716
+ my $i = 0;
4717
+ foreach my $key (sort { $a cmp $b } keys %$det ) {
4718
+ $det -> {$key }-> {' _order' } = $i ++;
4719
+ push (@$value , $det -> {$key }-> {' _cmd' });
4720
+ }
4710
4721
}
4711
4722
elsif (defined $customDefined {$cmd }) {
4712
4723
$value = $self -> get_assignment($cmd ,
@@ -4715,6 +4726,30 @@ sub get_custom_value {
4715
4726
$value = $self -> convert_command_parameters($based , $value , @params );
4716
4727
}
4717
4728
}
4729
+ else {
4730
+ # # This is only used with 'combined_custom'.
4731
+ # #
4732
+ # # $based - The command for the original define custom.
4733
+ # # $cmd - The member after the arrow operator.
4734
+ # #
4735
+ # # We cannot use a direct lookup because the command is no longer the
4736
+ # # key for custom_multi_details. It is possible to have two or more custom
4737
+ # # types that use the same command. Therefore, we have to use the custom
4738
+ # # type name ($tag) as the key. Since this code can only be called within
4739
+ # # a foreach, we have to rely on the fact that the values created above
4740
+ # # (during the processing of 'commands') are sorted to correlate the
4741
+ # # command, stored in $base, with the correct tag in order to get the
4742
+ # # correct command flags and other associated values.
4743
+ foreach my $tag (keys %{$self -> {' custom_multi_details' }}) {
4744
+ my $det = $self -> {' custom_multi_details' }-> {$tag };
4745
+ if ($det -> {' _cmd' } eq $based && $det -> {' _order' } == $self -> {' forcount' }) {
4746
+ if (exists $det -> {$cmd }) {
4747
+ $value = $det -> {$cmd };
4748
+ }
4749
+ last ;
4750
+ }
4751
+ }
4752
+ }
4718
4753
4719
4754
return $value ;
4720
4755
}
@@ -5819,7 +5854,7 @@ sub combine_custom_types {
5819
5854
# synthetic type.
5820
5855
foreach my $in (keys %input ) {
5821
5856
next if scalar @{$input {$in }} < 2;
5822
- my $combo_tag = join (' _and_' , map {/ (.+)_files$ / ; $1 } @{$input {$in }})
5857
+ my $combo_tag = join (' _and_' , map {/ (.+)_files$ / ; $1 } sort ( @{$input {$in }}) )
5823
5858
. ' _files' ;
5824
5859
if (!$self -> {' combined_custom' }-> {$combo_tag }) {
5825
5860
$self -> {' combined_custom' }-> {$combo_tag } = $input {$in };
@@ -5883,6 +5918,10 @@ sub combine_custom_types {
5883
5918
return 1;
5884
5919
}
5885
5920
5921
+ sub set_forcount {
5922
+ my ($self , $count ) = @_ ;
5923
+ $self -> {' forcount' } = $count ;
5924
+ }
5886
5925
5887
5926
# ************************************************************
5888
5927
# Accessors used by support scripts
0 commit comments