Mercurial > hg > GearsTemplate
diff src/parallel_execution/trans_impl.pl @ 557:1eb2a22ec1e3
tweak
author | anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp> |
---|---|
date | Mon, 18 Nov 2019 21:22:34 +0900 |
parents | a0b7eb5e58c0 |
children | 8a825fc15817 |
line wrap: on
line diff
--- a/src/parallel_execution/trans_impl.pl Mon Nov 18 21:00:11 2019 +0900 +++ b/src/parallel_execution/trans_impl.pl Mon Nov 18 21:22:34 2019 +0900 @@ -1,65 +1,14 @@ #!/usr/bin/env perl use strict; use warnings; -use DDP { deparse => 1}; -use CbC::Util; -#my $impl_file = shift or die 'require impl file'; -#my $impl = parse_impl($impl_file); - -my $hoge = CbC::Util->parse_impl(shift); -p $hoge; - -sub slup { - my $file = shift; - open my $fh, '<', $file; - local $/; - my $f = <$fh>; - return $f; -} - - -sub parse_impl { - my $file = shift; - - unless (-f $file) { - die "invlid file path: $file\n"; - } +use FindBin; +use lib "$FindBin::Bin/lib"; +use Gears::Util; - open my $fh, '<', $file; - my $impl = { - impl => undef, - isa => undef, - codes => [], - deta => [], - }; - - while (my $line = <$fh>) { - if ($line =~ m|^/\*|) { - while ( $line !~ m|\*/|) { - $line = <$fh>; - next; - } - next; - } +use DDP { deparse => 1}; - if ($line =~ m|typedef struct ([\w]+)\s*<Type,\s*Isa>\s*impl\s*([\w+]+)\s*{|) { - $impl->{impl} = $1; - $impl->{isa} = $2; - next; - } - - next if ($line =~ /^\s+$/); - next if ($line =~ m[//|}]); - - if ($line =~ /__code (\w+)\(.*/) { - push(@{$impl->{codes}},$1); - next; - } - - $line =~ s/\s*([\w\s\*]+);\s*/$1/; - push(@{$impl->{deta}},$1); - } - return $impl; -} - +my $impl_file = shift or die 'require impl file'; +my $ir = Gears::Util->parse_impl($impl_file); +my $hoge = Gears::Util->find_interface($ir->{isa}); +my $foo = Gears::Util->slup($hoge);