# HG changeset patch # User anatofuz # Date 1580189009 -32400 # Node ID 98aea649e37bc5da7de56e2d25f444f3cd1cfbd7 # Parent 0ea4d14c54bd526e1273229db907cdafcba04257 add gen_stub perl scripts diff -r 0ea4d14c54bd -r 98aea649e37b src/gearsTools/gen_Stub.pl --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gearsTools/gen_Stub.pl Tue Jan 28 14:23:29 2020 +0900 @@ -0,0 +1,18 @@ +#!/usr/bin/env perl +use strict; +use warnings; + +use FindBin; +use lib "$FindBin::Bin/lib"; +use Gears::Util; +use Gears::Stub; + +use Getopt::Std; +use File::Spec; + +use DDP {deparse => 1}; + +my $target_cbc_file = shift; +my $stubManager = Gears::Stub->new(file_name => File::Spec->rel2abs($target_cbc_file)); + +$stubManager->findInterfacewImpl($stubManager->slup()); diff -r 0ea4d14c54bd -r 98aea649e37b src/gearsTools/lib/Gears/Stub.pm --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/gearsTools/lib/Gears/Stub.pm Tue Jan 28 14:23:29 2020 +0900 @@ -0,0 +1,52 @@ +package Gears::Stub; +use strict; +use warnings; +use Carp qw/croak/; +use File::Find; +use Gears::Util; +use Gears::Context; + +use DDP {deparse => 1}; + +sub new { + my ($class, %args) = @_; + + my $self = {}; + $self->{file_name} = $args{file_name} || croak 'invalid file_name!'; + + return bless $self, $class; +} + + +sub slup { + my $self = shift; + my @contents = (); + open my $fh, '<', $self->{file_name}; + while (my $line = <$fh>) { + push(@contents,$line); + } + close $fh; + return \@contents; +} + + +sub findInterfacewImpl { + my ($self, $cbc_file_content) = @_; + my %findInterfaces; + + extraction_dg_compile_sources + #for my $i (0..$#{$cbc_file_content}) { + # my $line = $cbc_file_content->[$i]; + # if ($line =~ /#interface\s*"([\w.]+)"/) { + # push(@{$findInterfaces{$1}},[$i, $line]); + # next; + # } + + # if ($line =~ /data_gear\s*"([\w.]+)"/) { + # push(@{$findInterfaces{$1}},[$i, $line]); + # } + #} + p %findInterfaces; +} + +1;