unroll.pl

来自「Linux Kernel 2.6.9 for OMAP1710」· PL 代码 · 共 25 行

PL
25
字号
#!/usr/bin/perl## Take a piece of C code and for each line which contains the sequence $$# repeat n times with $ replaced by 0...n-1; the sequence $# is replaced# by the unrolling factor, and $* with a single $#($n) = @ARGV;$n += 0;while ( defined($line = <STDIN>) ) {    if ( $line =~ /\$\$/ ) {	$rep = $n;    } else {	$rep = 1;    }    for ( $i = 0 ; $i < $rep ; $i++ ) {	$tmp = $line;	$tmp =~ s/\$\$/$i/g;	$tmp =~ s/\$\#/$n/g;	$tmp =~ s/\$\*/\$/g;	print $tmp;    }}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?