Main Neurospaces logo neurospaces 0.1675 Thu, 27 Dec 2007 15:58:18 -0600 hugo

Index of group ./specifications/code/symboltypes


Index
Up

C code symbol types

1. Consistency of symbol type definitions

1. Consistency of symbol type definitions

01: $VAR1 = sub {
02:             use strict 'refs';
03:             my $self = shift @_;
04:             my $config = shift @_;
05:             my $directory = $$config{'c_code'}{'directory'};
06:             my $definitions_header = `cat "$directory/hierarchy/output/symbols/type_defines.h"`;
07:             if (not $definitions_header) {
08:                 $definitions_header = `cat "$directory/_build/hierarchy/output/symbols/type_defines.h"`;
09:             }
10:             my $types = [grep({/#define HIERARCHY_TYPE_symbols_/;} split(/\n/, $definitions_header, 0))];
11:             print "Found $#$types + 1 symbol types\n";
12:             my $type_count = [grep({/^#define COUNT_HIERARCHY_TYPE_symbols/;} split(/\n/, $definitions_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:             {
23:                 my $definitions_impl = `cat "$directory/hierarchy/output/symbols/long_descriptions.c"`;
24:                 if (not $definitions_impl) {
25:                     $definitions_impl = `cat "$directory/_build/hierarchy/output/symbols/long_descriptions.c"`;
26:                 }
27:                 $definitions_impl =~ /char \*ppc_symbols_long_descriptions\[COUNT_HIERARCHY_TYPE_symbols \+ 2\] =.*?\{(.*?)\}/s;
28:                 my $descriptions_long = $1;
29:                 $descriptions_long = [split(/,/, $descriptions_long, 0)];
30:                 my $descriptions_long_count = scalar(@$descriptions_long) - 1 - 1;
31:                 print "Found $descriptions_long_count long descriptions\n";
32:                 if ($descriptions_long_count != $type_count) {
33:                     return "Mismatch of count for long symbol type descriptions ($descriptions_long_count vs $type_count)";
34:                 }
35:             }
36:             {
37:                 my $definitions_impl = `cat "$directory/hierarchy/output/symbols/textual_descriptions.c"`;
38:                 if (not $definitions_impl) {
39:                     $definitions_impl = `cat "$directory/_build/hierarchy/output/symbols/textual_descriptions.c"`;
40:                 }
41:                 $definitions_impl =~ /char \*ppc_symbols_textual_descriptions\[COUNT_HIERARCHY_TYPE_symbols \+ 2\] =.*?\{(.*?)\}/s;
42:                 my $descriptions_textual = $1;
43:                 $descriptions_textual = [split(/,/, $descriptions_textual, 0)];
44:                 my $descriptions_textual_count = scalar(@$descriptions_textual) - 1 - 1;
45:                 print "Found $descriptions_textual_count textual descriptions\n";
46:                 if ($descriptions_textual_count != $type_count) {
47:                     return "Mismatch of count for textual symbol type descriptions ($descriptions_textual_count vs $type_count)";
48:                 }
49:             }
50:             {
51:                 my $definitions_impl_short = `cat "$directory/hierarchy/output/symbols/short_descriptions.c"`;
52:                 if (not $definitions_impl_short) {
53:                     $definitions_impl_short = `cat "$directory/_build/hierarchy/output/symbols/short_descriptions.c"`;
54:                 }
55:                 $definitions_impl_short =~ /char \*ppc_symbols_short_descriptions\[COUNT_HIERARCHY_TYPE_symbols \+ 2\] =.*?\{(.*?)\}/s;
56:                 my $descriptions_short = $1;
57:                 $descriptions_short = [split(/,/, $descriptions_short, 0)];
58:                 my $descriptions_short_count = scalar(@$descriptions_short) - 1 - 1;
59:                 print "Found $descriptions_short_count short descriptions\n";
60:                 if ($descriptions_short_count != $type_count) {
61:                     return "Mismatch of count for short symbol type descriptions ($descriptions_short_count vs $type_count)";
62:                 }
63:             }
64:             return undef;
65:         };
66: 

1.1. count match for symbol types

1. Part of expected output