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

📄 modify.pl

📁 有限元学习研究用源代码(老外的),供科研人员参考
💻 PL
字号:
#! /usr/local/bin/perl
#
#  To use this script, put all files you want to modify into
#  a subdirectory modify/  and edit the replacement commands below.
#  The modified files will be written into the subdirectory modified/
#

$|=1;     # immediate output without buffering;
$files =  `find modify`;       # the list of all files
@file  = split('\n',$files);                      # splitted into an array
print "\n loop over ".$#file." file(s):";
$i=0;
while($file[0]){                                  # loop over the files
       # search for dangerous things:
    $tmp = $file[0];
    $tmp =~s/modify\//modified\//;
    if($file[0]=~/\//){

#
# to see which files will be used without doing it, 
# uncomment the following:
#
#	print "\nfile ".$file[0]."->".$tmp."\n";  shift @file; next;
#

	open(TMP,">$tmp");
	open(FILE,$file[0]);
	while(<FILE>){             # loop over the lines of the file

# these are some patterns left from old replacement operations:
#
# typical swap command:   Edge <-> Line
#	    s/Edge/qwert/g; 
#	    s/Line/Edge/g; 
#	    s/qwert/Line/g; 
# typical more complex replacement:    cnd(x) -> nData[x]
#	    s/cnd\(([^\)]*)\)/nData\[$1\]/g;

# now this is what I want to do in the next big replacement operation:

	    s/ogenBasic/ogenOctree/g;
	    s/addRegion/addBox/g;
	    s/setBox/setBorder/g;
	    s/setFaceOfRegion/setFaceOfBox/g;

#	    s/wz/cog/g;


# what remains can be left unchanged:

	    print TMP;
	}
	close(TMP); close(FILE); 
	print "\b"; #print $('-','\\','|','/')[$i]; $i++; $i=0 if ($i==4);
	if   ($i==0) {print '-'; $i=1;}
	elsif($i==1) {print '\\';$i=2;}
	elsif($i==2) {print '|'; $i=3;}
	elsif($i==3) {print '/'; $i=0;}
    }
    shift @file;
}
print "\n";
 

⌨️ 快捷键说明

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