# HG changeset patch # User anatofuz # Date 1597957164 -32400 # Node ID 04df4583de360c5eb08cd6346e7468cee24a67db # Parent ce8dadfb7043761566ec72042829676e2ba4ec4e ... diff -r ce8dadfb7043 -r 04df4583de36 src/parallel_execution/generate_stub.pl --- a/src/parallel_execution/generate_stub.pl Thu Aug 20 20:21:44 2020 +0900 +++ b/src/parallel_execution/generate_stub.pl Fri Aug 21 05:59:24 2020 +0900 @@ -193,6 +193,7 @@ for my $localVar (keys %{$codeGearInfo->{$currentCodeGear}->{localVar}}) { if ($localVar eq $instance) { $typeName = $codeGearInfo->{$currentCodeGear}->{localVar}->{$localVar}; + last; } } unless ($typeName){ @@ -201,7 +202,7 @@ } } - print "[INFO] found instance $instance, typeName $typeName\n"; + print "[INFO] found instance $instance, typeName $typeName, cuurentCodeGear: $currentCodeGear, method: $method\n"; } elsif (/^}$/) { $currentCodeGear = undef; diff -r ce8dadfb7043 -r 04df4583de36 src/parallel_execution/lib/Gears/Util.pm --- a/src/parallel_execution/lib/Gears/Util.pm Thu Aug 20 20:21:44 2020 +0900 +++ b/src/parallel_execution/lib/Gears/Util.pm Fri Aug 21 05:59:24 2020 +0900 @@ -17,12 +17,43 @@ unless ($ir->{name}) { croak "invalid struct name $file_name"; - } - return $ir; } sub _parse_base { + + # create this data structure + # \ { + # content [ + # [0] "union Data* stack; + #", + # [1] "union Data* data; + #", + # [2] "union Data* data1; + #", + # [3] "enum Code whenEmpty; + #", + # [4] "enum Code clear; + #", + # [5] "enum Code push; + #", + # [6] "enum Code pop; + #", + # [7] "enum Code pop2; + #", + # [8] "enum Code isEmpty; + #", + # [9] "enum Code get; + #", + # [10] "enum Code get2; + #", + # [11] "enum Code next; + #" + # ], + # file_name "/Users/anatofuz/src/firefly/hg/Gears/Gears/src/parallel_execution/tools/../Stack.h", + # name "Stack" + #} + my ($file,$code_verbose) = @_; my $ir = {}; $ir->{file_name} = $file; @@ -180,6 +211,8 @@ my ($class, $file) = @_; my $ir = _parse_base($file); + $ir->{hasOutputArgs} = {}; + my @data_gears; my @code_gears; map { push (@data_gears, $_) unless ($_ =~ /enum Code/);} @{$ir->{content}}; @@ -187,16 +220,28 @@ open my $fh , '<', $file; my $i = 0; + my @have_output_data; while (($i < scalar @code_gears) && (my $line = <$fh>)) { - my $cg = $code_gears[$i]; - if ($line =~ m|__code $cg\(([()\.\*\s\w,_]+)\)|) { + my $codeGearName = $code_gears[$i]; + if ($line =~ m|__code $codeGearName\(([()\.\*\s\w,_]+)\)|) { + my $arg = $1; $code_gears[$i] = { - name => $cg, - args => $1, + name => $codeGearName, + args => $arg, }; + # args "Impl* stack, __code next(Type* data, Type* data1, ...)", + if ($arg =~ /__code \w+\((.+),\s*\.\.\.\s*\)/) { + my $outputArgs = $1; + while ($outputArgs =~ /([\w*]+)\s(\w+),?/g) { + my $ttype = $1; + my $tname = $2; + $ir->{hasOutputArgs}->{$codeGearName}->{$tname} = $ttype; + } + } $i++; } } + $ir->{codes} = \@code_gears; $ir->{data} = \@data_gears; return $ir;