annotate tools/mc-h-renum.pl @ 640:04211a2cf227

*** empty log message ***
author kono
date Wed, 01 Nov 2006 01:27:11 +0900
parents e055df7c1082
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
466
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
1 #!/usr/local/bin/perl
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
2
607
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
3 # /************************************************************************
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
4 # ** Copyright (C) 2006 Shinji Kono
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
5 # ** 連絡先: 琉球大学情報工学科 河野 真治
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
6 # ** (E-Mail Address: kono@ie.u-ryukyu.ac.jp)
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
7 # **
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
8 # ** このソースのいかなる複写,改変,修正も許諾します。ただし、
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
9 # ** その際には、誰が貢献したを示すこの部分を残すこと。
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
10 # ** 再配布や雑誌の付録などの問い合わせも必要ありません。
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
11 # ** 営利利用も上記に反しない範囲で許可します。
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
12 # ** バイナリの配布の際にはversion messageを保存することを条件とします。
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
13 # ** このプログラムについては特に何の保証もしない、悪しからず。
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
14 # **
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
15 # ** Everyone is permitted to do anything on this program
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
16 # ** including copying, modifying, improving,
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
17 # ** as long as you don't try to pretend that you wrote it.
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
18 # ** i.e., the above copyright notice has to appear in all copies.
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
19 # ** Binary distribution requires original version messages.
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
20 # ** You don't have to ask before copying, redistribution or publishing.
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
21 # ** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
e055df7c1082 *** empty log message ***
kono
parents: 466
diff changeset
22 # ***********************************************************************/
466
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
23 my $mode = 0;
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
24
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
25 my $reserve = -1;
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
26 my $tags = 1;
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
27 my $error = 1;
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
28 my $modnum = 0;
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
29
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
30 while(<>) {
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
31 if(m+/\* reserved word start \*/+) { $mode = 1; }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
32 elsif(m+/\* reserved word end \*/+) { $mode = 0; }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
33 elsif(m+/\* tree node tags start \*/+) { $mode = 2; }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
34 elsif(m+/\* tree node tags end \*/+) { $mode = 0; }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
35 elsif(m+/\* error number start \*/+) { $mode = 3; }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
36 elsif(m+/\* error number end \*/+) { $mode = 0; }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
37 elsif(m+/\* mode start \*/+) { $mode = 4; }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
38 elsif(m+/\* mode end \*/+) { $mode = 0; }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
39 elsif(m+/\* statement start \*/+) { $mode = 5; }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
40 elsif(m+/\* statement end \*/+) { $mode = 0; }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
41 else {
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
42 if ($mode==0) { ; }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
43 elsif ($mode==1) {
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
44 s/-(\d+)/$reserve--/e;
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
45 } elsif ($mode==2) {
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
46 s/\s(\d+)/"\t".$tags++/e;
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
47 } elsif ($mode==3) {
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
48 s/(\d+)/$error++/e;
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
49 } elsif ($mode==4) {
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
50 s/(\d+)/$modenum++/e;
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
51 } elsif ($mode==5) {
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
52 s/(\d+)/$tags++/e;
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
53 }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
54 }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
55 print;
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
56 }
7c3d8237b625 *** empty log message ***
kono
parents:
diff changeset
57