diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/AspectC/Repo.pm | 10 | ||||
-rw-r--r-- | lib/Kratos/DFADriver.pm | 4 | ||||
-rw-r--r-- | lib/Kratos/DFADriver/Model.pm | 24 |
3 files changed, 33 insertions, 5 deletions
diff --git a/lib/AspectC/Repo.pm b/lib/AspectC/Repo.pm index 2ddccfd..ec5bcd0 100644 --- a/lib/AspectC/Repo.pm +++ b/lib/AspectC/Repo.pm @@ -132,6 +132,16 @@ sub parse_xml { my $hash_key = sprintf( '%s(%s)', $name, join( q{, }, @args ) ); $class->{function}{$hash_key} = $fun; } + + for my $vnode ( $node->findnodes('./children/Variable') ) { + my $name = $vnode->getAttribute('name'); + my ($sig_node) = $vnode->findnodes('./type/Type'); + my $signature = $vnode->getAttribute('signature'); + $class->{variable}{$name} = { + type => $signature, + }; + } + $self->{class}{$class_name} = $class; } diff --git a/lib/Kratos/DFADriver.pm b/lib/Kratos/DFADriver.pm index c94101a..e06d577 100644 --- a/lib/Kratos/DFADriver.pm +++ b/lib/Kratos/DFADriver.pm @@ -928,8 +928,6 @@ DeclareThread(DriverEvalThread, driverEvalThread, 256); EOF - $buf .= $self->model->heap_code; - $buf .= <<"EOF"; void DriverEvalThread::action() { @@ -944,7 +942,6 @@ void DriverEvalThread::action() EOF - $buf .= $self->model->startup_code; $buf .= "${instance}.startIteration(${num_runs});\n"; for my $run (@runs) { @@ -980,7 +977,6 @@ EOF $buf .= "\t\t${instance}.dumpLog();\n\n"; } - $buf .= $self->model->shutdown_code; $buf .= "${instance}.stopIteration(); }}\n"; return $buf; diff --git a/lib/Kratos/DFADriver/Model.pm b/lib/Kratos/DFADriver/Model.pm index ba3855f..63d4dde 100644 --- a/lib/Kratos/DFADriver/Model.pm +++ b/lib/Kratos/DFADriver/Model.pm @@ -72,6 +72,7 @@ sub new_from_repo { my $class_base = $repo->{class}{$class_name}; for my $function ( values %{ $class_base->{function} } ) { + my %param_values; for my $attrib ( @{ $function->{attributes} // [] } ) { if ( $attrib =~ s{ ^ src _ }{}x ) { push( @states, $attrib ); @@ -92,6 +93,11 @@ sub new_from_repo { elsif ( $attrib =~ m{ ^ epilogue $ }x ) { $transition{ $function->{name} }{level} = 'epilogue'; } + elsif ( $attrib + =~ m{ ^ testarg _ (?<index> [^_]+ ) _ (?<value> [^_]+) $ }x ) + { + push( @{ $param_values{ $+{index} } }, $+{value} ); + } else { say "wat $attrib"; } @@ -104,7 +110,7 @@ sub new_from_repo { @{ $transition{ $function->{name} }{parameters} }, { name => $param_name, - values => [], + values => $param_values{$i}, } ); $self->{parameter}{$param_name} = { @@ -116,6 +122,22 @@ sub new_from_repo { } } + if ( exists $repo->{class}{DriverEvalThread} ) { + for my $var ( keys %{ $repo->{class}{DriverEvalThread}{variable} } ) { + if ( $var + =~ m{ ^ testVal __ (?<fun> [^_]+ ) __ arg (?<index> \d+ ) __ (?<descr> [^_]+ ) $ }x + ) + { + push( + @{ + $transition{ $+{fun} }{parameters}[ $+{index} ]{values} + }, + $var + ); + } + } + } + @states = uniq @states; @states = sort @states; |