comparison src/parallel_execution/generate_stub.pl @ 393:99c50356d917

fix generate_stub.pl
author mir3636
date Tue, 01 Aug 2017 18:49:56 +0900
parents 2d9c500f263e
children bba401f93dcd
comparison
equal deleted inserted replaced
392:36964b9ac5fd 393:99c50356d917
1 #!/usr/bin/perl 1 #!/usr/bin/perl
2 2
3 use strict; 3 use strict;
4 use Getopt::Std; 4 use Getopt::Std;
5 use File::Path qw(make_path);
5 6
6 # interface.cbc 7 # interface.cbc
7 # typedef struct Worker { 8 # typedef struct Worker {
8 # int id; 9 # int id;
9 # struct Context* contexts; 10 # struct Context* contexts;
19 20
20 my $dir = "."; 21 my $dir = ".";
21 if ($opt_d) { 22 if ($opt_d) {
22 $dir = $opt_d; 23 $dir = $opt_d;
23 if (! -d $dir) { 24 if (! -d $dir) {
24 mkdir $dir; 25 make_path $dir;
25 } 26 }
26 } 27 }
27 28
28 for my $fn (@ARGV) { 29 for my $fn (@ARGV) {
29 next if ($fn !~ /\.cbc$/); 30 next if ($fn !~ /\.cbc$/);
98 $interface = $1; 99 $interface = $1;
99 $implementation = $3; 100 $implementation = $3;
100 if ( -f "$interface.cbc") { 101 if ( -f "$interface.cbc") {
101 &getDataGear("$interface.cbc"); 102 &getDataGear("$interface.cbc");
102 } 103 }
103 } elsif (/^(\s)*(\w+)\-\>(\w+)\s\=\s\((.*)\)create(\w+)\((\w+)\);$/) { 104 } elsif (/^(\s)*(\w+)\-\>(\w+)\s\=\s\((.*)\)create(\w+)\((.*)\);$/) {
104 #my $intfn = ucfirst($2); 105 #my $intfn = ucfirst($2);
105 my $impln = $5; 106 my $impln = $5;
106 if ( -f "$impln.cbc") { 107 if ( -f "$impln.cbc") {
107 &getCodeGear("$impln.cbc"); 108 &getCodeGear("$impln.cbc");
108 } 109 }
233 $i++; 234 $i++;
234 } 235 }
235 } 236 }
236 if ( $fn =~ m=(.*)/[^/]+$= ) { 237 if ( $fn =~ m=(.*)/[^/]+$= ) {
237 if (! -d $1) { 238 if (! -d $1) {
238 mkdir $1; 239 make_path $1;
239 } 240 }
240 } 241 }
241 open my $fd,">",$fn or die("can't write $fn $!"); 242 open my $fd,">",$fn or die("can't write $fn $!");
242 243
243 my $prevCodeGearName; 244 my $prevCodeGearName;