00001 <?php 00002 00003 $files=scandir("."); 00004 00005 foreach($files as $k => $v) 00006 if(strcmp($v,'.')!=0 && strcmp($v,'..')!=0) 00007 if(!(strstr($v,'.cpp')==false && strstr($v,'.h')==false)) 00008 { 00009 $count=countsym($v,'"'); 00010 $mod=$count % 2; 00011 if($mod==1) print 'Warning! '.$v.' symbol " count '.$count."\n"; 00012 00013 00014 $c1=countsym($v,'('); 00015 $c2=countsym($v,')'); 00016 if($c1!=$c2) print 'Warning! '.$v.' symbol () not close! '.$c1.' '.$c2."\n"; 00017 00018 $c1=countsym($v,'{'); 00019 $c2=countsym($v,'}'); 00020 if($c1!=$c2) print 'Warning! '.$v.' symbol {} not close! '.$c1.' '.$c2."\n"; 00021 00022 $c1=countsym($v,'#if'); 00023 $c2=countsym($v,'#endif'); 00024 if($c1!=$c2) print 'Warning! '.$v.' symbol #if #endif not close! '.$c1.' '.$c2."\n"; 00025 } 00026 00027 00028 function countsym($file, $sym) 00029 { 00030 00031 $count=0; 00032 00033 $afile=file($file); 00034 $cfile=count($afile); 00035 for($n=0;$n<=$cfile-1;$n++) 00036 { 00037 $count=$count+substr_count($afile[$n],$sym); 00038 } 00039 00040 return $count; 00041 00042 } 00043 00044 function no1310($s) 00045 { 00046 $s=str_replace(chr(13),'',$s); 00047 $s=str_replace(chr(10),'',$s); 00048 return $s; 00049 } 00050 00051 ?>