changeset 8:41b6e5ac652f

fix change_OP_to_cbc.pl
author Takahiro SHIMIZU <anatofuz@cr.ie.u-ryukyu.ac.jp>
date Fri, 05 Oct 2018 21:03:37 +0900
parents b545249e9b62
children 6c4ba0dc43e8
files cbctools/change_OP_to_cbc.pl
diffstat 1 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/cbctools/change_OP_to_cbc.pl	Fri Oct 05 20:49:46 2018 +0900
+++ b/cbctools/change_OP_to_cbc.pl	Fri Oct 05 21:03:37 2018 +0900
@@ -11,8 +11,16 @@
 my $indent = " " x 12;
 my $none_left_blanket = 0;
 
-for (my $i=0; $i < scalar(@cbc_lines); $i++){
+my $i = 0;
+for (;$i < scalar(@cbc_lines); $i++){
+    push @rewritec,$cbc_lines[$i];
+    if ($cbc_lines[$i] =~ /DISPATCH\(NEXT_OP\)/){ # DISPATCHの中身を書き換えるのでそこまで飛ばす
+        $i++;
+        last;
+    }
+}
 
+for (;$i < scalar(@cbc_lines); $i++){
     # check OP(.*) {  codes
     if ($cbc_lines[$i] =~ /^\s+OP\((.*)\):/ ){
         my $opcode = $1;
@@ -45,8 +53,10 @@
         }
     }
 
+    # 普通の行は変換してinsertする
     push @rewritec,change_i($cbc_lines[$i]);
 
+
    if ($i != scalar(@cbc_lines)-1 && $cbc_lines[$i+1] =~ /OP/ && $none_left_blanket){
         insert_right_blanket();
         $none_left_blanket = 0;