01: $VAR1 = sub {
02: use strict 'refs';
03: my $self = shift @_;
04: my $config = shift @_;
05: my $directory = $$config{'c_code'}{'directory'};
06: my $symboltypes_header = `cat "$directory/hierarchy/output/symbols/type_defines.h"`;
07: if (not $symboltypes_header) {
08: $symboltypes_header = `cat "$directory/_build/hierarchy/output/symbols/type_defines.h"`;
09: }
10: my $types = [grep({/#define HIERARCHY_TYPE_/;} split(/\n/, $symboltypes_header, 0))];
11: print "Found $#$types + 1 symbol types\n";
12: my $type_count = [grep({/^#define COUNT_HIERARCHY_TYPE/;} split(/\n/, $symboltypes_header, 0))];
13: if ($#$type_count != 0) {
14: return 'Found more than one symbol type count';
15: }
16: $$type_count[0] =~ /([0-9]+)/;
17: $type_count = $1;
18: print "Found count of $type_count symbol types\n";
19: if ($#$types + 1 != $type_count) {
20: return "Mismatch of type count ($#$types + 1 vs $type_count)";
21: }
22: my $definitions_impl = `cat $directory/hierarchy/output/symbols/annotations/piSymbolType2Biolevel`;
23: if (not $definitions_impl) {
24: $definitions_impl = `cat "$directory/_build/hierarchy/output/symbols/annotations/piSymbolType2Biolevel"`;
25: }
26: my $biolevelmapping = $definitions_impl;
27: $biolevelmapping = [split(m[, //], $biolevelmapping, 0)];
28: my $biolevelmapping_count = scalar(@$biolevelmapping) - 1 - 1;
29: print "Found $biolevelmapping_count entries in the biolevelmapping.\n";
30: if ($biolevelmapping_count != $type_count) {
31: return "Mismatch of count for symbol types and their biolevel mapping ($biolevelmapping_count vs $type_count)";
32: }
33: return undef;
34: };
35: