changeset 282:40b1b7476e77

modify_script_name
author anatofuz
date Tue, 28 Jan 2020 17:14:44 +0900
parents 4d76280758db
children 875ad11af596
files src/gearsTools/check_convert_context_struct.pl src/gearsTools/update_context.pl
diffstat 2 files changed, 15 insertions(+), 71 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/gearsTools/check_convert_context_struct.pl	Tue Jan 28 17:14:44 2020 +0900
@@ -0,0 +1,15 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+
+use FindBin;
+use lib "$FindBin::Bin/lib";
+use Gears::Util;
+
+
+my $interface_file = shift or die "require itnerface file";
+my $h2context = Gears::Util->parse_interface($interface_file);
+my $context = Gears::Util->h2context_str($h2context);
+
+print "$context";
+
--- a/src/gearsTools/update_context.pl	Tue Jan 28 16:50:07 2020 +0900
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-#!/usr/bin/env perl
-use strict;
-use warnings;
-use Getopt::Std;
-
-use FindBin;
-use lib "$FindBin::Bin/lib";
-use Gears::Util;
-
-my %opt;
-getopts("wc" => \%opt);
-
-my $interface_file = shift or die "require itnerface file";
-my $h2context = Gears::Util->parse_interface($interface_file);
-my $context = Gears::Util->h2context_str($h2context);
-
-if ($opt{c}) {
-  print "$context";
-  exit 0;
-}
-
-my ($first,$last) = slup_context_h($h2context->{name});
-
-if ($opt{w}) {
-  context_write(@{$first},$context,@{$last});
-} else {
-  context_dump(@{$first},$context,@{$last});
-}
-
-
-sub slup_context_h {
-  open my $fh, '<', 'context.h';
-  
-  my $data_gear_name = shift;
-
-  my @first_context_headers = ();
-  my @last_context_headers = ();
-  
-  while (my $line = <$fh>) {
-    if ( $line =~ /union Data end/) {
-      push(@last_context_headers, $line);
-      push(@last_context_headers, <$fh>);
-      last;
-    }
-    if ( $line =~ /struct $data_gear_name/) {
-      print "WARN! $data_gear_name struct already exists\n";
-      exit 1;
-    }
-    push(@first_context_headers, $line);
-  }
-
-  close $fh;
-  
-  #print "@first_context_headers\n";
-  #print "@last_context_headers\n";
-  return (\@first_context_headers,\@last_context_headers);
-}
-
-sub context_dump {
-  for my $line (@_) {
-    print "$line";
-  }
-}
-
-sub context_write {
-  open my $fh, '>', "context.h";
-  for my $line (@_) {
-    print $fh "$line";
-  }
-  close $fh;
-}