changeset 553:e9b1f533e587

tweak update_context.pl
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Thu, 14 Nov 2019 15:08:08 +0900
parents 3ef66c1568be
children bb0c841aeb8f
files src/parallel_execution/update_context.pl
diffstat 1 files changed, 13 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/src/parallel_execution/update_context.pl	Wed Nov 13 18:40:23 2019 +0900
+++ b/src/parallel_execution/update_context.pl	Thu Nov 14 15:08:08 2019 +0900
@@ -3,13 +3,19 @@
 use warnings;
 use Getopt::Std;
 
+my %opt;
+getopts("wc" => \%opt);
+
 my $interface_file = shift or die "require itnerface file";
 my $h2context = parse_interface($interface_file);
 my $context = dump_h2context($h2context);
-my ($first,$last) = slup_context_h($h2context->{name});
 
-my %opt;
-getopts("w" => \%opt);
+if ($opt{c}) {
+  print "$context";
+  exit 0;
+}
+
+my ($first,$last) = slup_context_h($h2context->{name});
 
 if ($opt{w}) {
   context_write(@{$first},$context,@{$last});
@@ -27,7 +33,7 @@
   my @last_context_headers = ();
   
   while (my $line = <$fh>) {
-    if ( $line =~ /this is necessary for context generator/) {
+    if ( $line =~ /union Data end/) {
       push(@last_context_headers, $line);
       push(@last_context_headers, <$fh>);
       last;
@@ -41,8 +47,8 @@
   
   close $fh;
   
-  print "@first_context_headers\n";
-  print "@last_context_headers\n";
+  #print "@first_context_headers\n";
+  #print "@last_context_headers\n";
   return (\@first_context_headers,\@last_context_headers);
 }
 
@@ -86,7 +92,7 @@
   $context =  "${space}struct $h2context->{name} {\n";
   for my $datum (@{$h2context->{data}}) {
     #print "${space}${space}$datum; \n";
-    $context .= "${space}${space}$datum; \n";
+    $context .= "${space}${space}$datum;\n";
   }
   for my $code (@{$h2context->{codes}}) {
     #print "${space}${space}enum Code $code;\n";