Skip to content
Snippets Groups Projects

Adding check for duplicate non-case-sensitive part names that could cause...

2 unresolved threads
1 file
+ 34
9
Compare changes
  • Side-by-side
  • Inline
@@ -727,16 +727,41 @@ for($ii=0;$ii<$nonSubCnt;$ii++)
}
}
#// - Remove all parts which will not require further processing in the code for the part
#// total. \n
#// - Remove all parts which will not require further processing in the code for the part
#// total, also do a part check for blocks with diffrent capitalization that are going to
#// emit c code that will be lowercased (causing collisions)
$ftotal = $partCnt;
for($kk=0;$kk<$partCnt;$kk++)
{
if(($partType[$kk] eq "INPUT") || ($partType[$kk] eq "OUTPUT") || ($partType[$kk] eq "BUSC") || ($partType[$kk] eq "BUSS") || ($partType[$kk] eq "EpicsIn") || ($partType[$kk] eq "TERM") || ($partType[$kk] eq "FROM") || ($partType[$kk] eq "GOTO") || ($partType[$kk] eq "GROUND") || ($partType[$kk] eq "CONSTANT") || ($partType[$kk] eq "Adc") || ($partType[$kk] eq "Gps") || ($partType[$kk] eq "StateWord") || ($partType[$kk] eq "ModelRate") || ($partType[$kk] eq "EXC"))
{
$ftotal --;
}
}
my %seen;
my %noCode = map {$_ => 1} qw(INPUT OUTPUT BUSC BUSS FROM GOTO); #List of non-generating parts
for($kk=0;$kk<$partCnt;$kk++)
{
if(($partType[$kk] eq "INPUT") || ($partType[$kk] eq "OUTPUT") || ($partType[$kk] eq "BUSC")
|| ($partType[$kk] eq "BUSS") || ($partType[$kk] eq "EpicsIn") || ($partType[$kk] eq "TERM")
|| ($partType[$kk] eq "FROM") || ($partType[$kk] eq "GOTO") || ($partType[$kk] eq "GROUND")
|| ($partType[$kk] eq "CONSTANT") || ($partType[$kk] eq "Adc") || ($partType[$kk] eq "Gps")
|| ($partType[$kk] eq "StateWord") || ($partType[$kk] eq "ModelRate") || ($partType[$kk] eq "EXC"))
{
$ftotal --;
}
# Check to see if we have a part with the same lower case name,
# and neither parts are of a no code generating type
if ( exists $seen{ lc $xpartName[$kk] }
and not exists $noCode{$partType[$kk]}
and not exists $noCode{ $seen{ lc $xpartName[$kk] }[1] } )
{
die "ERROR - Part name is: $xpartName[$kk], other part is $seen{ lc $xpartName[$kk]}[0]\n" .
"Two parts, that generate code, with the same name (but diffrent capitalization) were found. " .
"This can cause an issue with code generation.\nPlease rename one of the parts.\n";
}
else
{
my @val = ($xpartName[$kk], $partType[$kk]);
$seen{ lc $xpartName[$kk] } = \@val;
}
}
print "Total parts to process $ftotal\n";
Loading