annotate src/gearsTools/lib/Gears/Stub.pm @ 281:4d76280758db

move context.pm to util.pm ...
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Tue, 28 Jan 2020 16:50:07 +0900
parents 21a5761e3e7a
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
278
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
1 package Gears::Stub;
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
2 use strict;
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
3 use warnings;
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
4 use Carp qw/croak/;
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
5 use File::Find;
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
6 use Gears::Util;
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
7
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
8 use DDP {deparse => 1};
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
9
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
10 sub new {
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
11 my ($class, %args) = @_;
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
12
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
13 my $self = {};
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
14 $self->{file_name} = $args{file_name} || croak 'invalid file_name!';
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
15
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
16 return bless $self, $class;
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
17 }
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
18
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
19
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
20
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
21 sub findInterfacewImpl {
279
0a74a7bbe765 tweak...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
22 my $self = shift;
0a74a7bbe765 tweak...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 278
diff changeset
23 my $cbc_file = shift // $self->{file_name};
280
21a5761e3e7a mv_extraction_dg_compile_sources Context2Util
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 279
diff changeset
24 my $findInterfaces = Gears::Util->extraction_dg_compile_sources([$cbc_file]);
281
4d76280758db move context.pm to util.pm ...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
25 my $edgcs = Gears::Util->extraction_dg_compile_sources([$cbc_file]);
4d76280758db move context.pm to util.pm ...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
26 my $findInterfaces = {};
4d76280758db move context.pm to util.pm ...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
27
4d76280758db move context.pm to util.pm ...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
28 my %ifs = ();
4d76280758db move context.pm to util.pm ...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
29 map { $ifs{$_}++ } keys %{$edgcs->{interfaces}};
4d76280758db move context.pm to util.pm ...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
30 delete $ifs{Meta};
4d76280758db move context.pm to util.pm ...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
31 delete $ifs{TaskManager};
4d76280758db move context.pm to util.pm ...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
32
4d76280758db move context.pm to util.pm ...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
33 push(@{$findInterfaces->{interfaces}}, keys %ifs);
4d76280758db move context.pm to util.pm ...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
34 push(@{$findInterfaces->{impls}}, keys %{$edgcs->{impl}});
4d76280758db move context.pm to util.pm ...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
35
4d76280758db move context.pm to util.pm ...
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents: 280
diff changeset
36 return $findInterfaces;
278
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
37 }
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
38
98aea649e37b add gen_stub perl scripts
anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
parents:
diff changeset
39 1;