changeset 100:37a0df8b1889

tweak update_context.pl
author anatofuz <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Thu, 14 Nov 2019 15:10:43 +0900
parents e960539c003d
children 195cea4bb9c9
files src/gearsTools/update_context.pl
diffstat 1 files changed, 10 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/gearsTools/update_context.pl	Thu Nov 14 11:33:13 2019 +0900
+++ b/src/gearsTools/update_context.pl	Thu Nov 14 15:10:43 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});
@@ -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";