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

Index of group ./specifications/code/parametertypes


Index
Up

C code parameter types

1. Consistency of parameter type definitions

1. Consistency of parameter 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/neurospaces/parameters.h"`;
07:             my $types = [grep({/#define TYPE_PARA_/;} split(/\n/, $definitions_header, 0))];
08:             print "Found $#$types parameter types\n";
09:             my $definitions_impl = `cat "$directory/parameters.c"`;
10:             $definitions_impl =~ /char \*ppcParameterStruct\[\] =.*?\{(.*?)\}/s;
11:             my $descriptions_long = $1;
12:             $descriptions_long = [split(/,/, $descriptions_long, 0)];
13:             print "Found $#$descriptions_long long parameter descriptions\n";
14:             if ($#$descriptions_long - 1 != $#$types + 1) {
15:                 return "Mismatch of count for long parameter type descriptions ($#$descriptions_long - 1 vs $#$types + 1)";
16:             }
17:             my $definitions_impl_short = `cat "$directory/parameters.c"`;
18:             $definitions_impl =~ /char \*ppcParameterStructShort\[\] =.*?\{(.*?)\}/s;
19:             my $descriptions_short = $1;
20:             $descriptions_short = [split(/,/, $descriptions_short, 0)];
21:             print "Found $#$descriptions_short short descriptions\n";
22:             if ($#$descriptions_short - 1 != $#$types + 1) {
23:                 return "Mismatch of count for short parameter type descriptions ($#$descriptions_short - 1 vs $#$types + 1)";
24:             }
25:             return undef;
26:         };
27: 

1.1. count match for parameter types

1. Part of expected output