466
|
1 #!/usr/bin/perl
|
491
|
2
|
607
|
3 # /************************************************************************
|
|
4 # ** Copyright (C) 2006 Shinji Kono
|
|
5 # ** 連絡先: 琉球大学情報工学科 河野 真治
|
|
6 # ** (E-Mail Address: kono@ie.u-ryukyu.ac.jp)
|
|
7 # **
|
|
8 # ** このソースのいかなる複写,改変,修正も許諾します。ただし、
|
|
9 # ** その際には、誰が貢献したを示すこの部分を残すこと。
|
|
10 # ** 再配布や雑誌の付録などの問い合わせも必要ありません。
|
|
11 # ** 営利利用も上記に反しない範囲で許可します。
|
|
12 # ** バイナリの配布の際にはversion messageを保存することを条件とします。
|
|
13 # ** このプログラムについては特に何の保証もしない、悪しからず。
|
|
14 # **
|
|
15 # ** Everyone is permitted to do anything on this program
|
|
16 # ** including copying, modifying, improving,
|
|
17 # ** as long as you don't try to pretend that you wrote it.
|
|
18 # ** i.e., the above copyright notice has to appear in all copies.
|
|
19 # ** Binary distribution requires original version messages.
|
|
20 # ** You don't have to ask before copying, redistribution or publishing.
|
|
21 # ** THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE.
|
|
22 # ***********************************************************************/
|
491
|
23 for(@ARGV) {
|
|
24 my $filename = $_;
|
|
25 rename($filename,$filename.".bak");
|
|
26 open(IN,"<$filename.bak");
|
|
27 open(OUT,">$filename");
|
|
28 $d = "0000";
|
|
29 while(<IN>) {
|
685
|
30 s/fprintf\(([^,]+,)\"\#\d+\:/fprintf\($1\"\#$d\:/;
|
|
31 s/fprintf\(([^,]+,)\"([^#])/fprintf\($1\"\#$d\:$2/;
|
491
|
32 s/printf\(\"\#\d+\:/printf\(\"\#$d\:/;
|
|
33 s/printf\(\"([^#])/printf\(\"\#$d\:$1/;
|
|
34 $d++;
|
|
35 print OUT;
|
|
36 }
|
466
|
37 }
|