⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ihvtestcopy.pl

📁 hl2 source code. Do not use it illegal.
💻 PL
字号:
sub BackSlashToForwardSlash
{
	local( $in ) = shift;
	local( $out ) = $in;
	$out =~ s,\\,/,g;
	return $out;
}

sub RemoveFileName
{
	local( $in ) = shift;
	$in = &BackSlashToForwardSlash( $in );
	$in =~ s,/[^/]*$,,;
	return $in;
}

sub RemovePath
{
	local( $in ) = shift;
	$in = &BackSlashToForwardSlash( $in );
	$in =~ s,^(.*)/([^/]*)$,$2,;
	return $in;
}


$infile = shift;
$outfile = shift;

open INFILE, "<$infile" || die;
@infile = <INFILE>;
close INFILE;

$basename = &RemovePath( $infile );

$outfile = &BackSlashToForwardSlash( $outfile );
if( !( $outfile =~ m/\/$/ ) )
{
	$outfile .= "/";
}

$outfile = $outfile . $basename;
print "$infile -> $outfile\n";

$inRemoveBlock = 0;
$inKeepBlock = 0;

open OUTFILE, ">$outfile" || die;
while( $line = shift @infile )
{
	if( $line =~ m/\#ifndef\s+IHVTEST/ )
	{
		$inRemoveBlock = 1;
	}
	elsif( $line =~ m/\#ifdef\s+IHVTEST/ )
	{
		$inKeepBlock = 1;
	}
	elsif( $line =~ m/\#endif.*IHVTEST/ )
	{
		$inRemoveBlock = 0;
		$inKeepBlock = 0;
	}
	elsif( !$inRemoveBlock )
	{
		print OUTFILE $line;	
	}
}
close OUTFILE;

⌨️ 快捷键说明

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