Mercurial > hg > GearsTemplate
view src/parallel_execution/lib/Gears.pm @ 567:9adcf0da19b3
tweak
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Sat, 23 Nov 2019 16:43:24 +0900 |
parents | dada17cba91d |
children | 840597c5d242 |
line wrap: on
line source
package Gears; use strict; use warnings; use Gears::Util; use DDP {deparse => 1}; sub new { my ($class, %args) = @_; p %args; my $self = { interfaces => [], data_gears_with_count => {}, }; if ($args{compile_sources}) { $self->{compile_sources} = $args{compile_sources}; map { Gears::Util->file_checking($_); } @{$self->{compile_sources}}; } return bless $self, $class; } sub extraction_dg_compile_sources { my $self = shift; map { $self->extraction_data_gears($_) } @{$self->{compile_sources}}; } sub extraction_data_gears { my ($self, $cbc_file) = @_; open my $fh , '<', $cbc_file; while (my $line = <$fh>) { if ($line =~ /#interface\s*"(.*)\.h"/) { $self->{data_gears_with_count}->{$1}->{caller}->{$cbc_file}++; push(@{$self->{interfaces}}, "$1.h"); next; } if ($line =~ /__code/) { while ($line =~ /struct (\w+)*/g) { $self->{data_gears_with_count}->{$1}->{caller}->{$cbc_file}++; } } } close $fh; } 1;