[原创]用LISP去除VC的注释
<p>这段代码是LISP程序。不知发在哪个版上合适,选发到这里。</p><p>功能是:删除VC里面的注释。</p>
<p><font face="Verdana">(defun c:ezx(/)<br/> (if(SETQ SG(GETFILED "选择Cpp文件" "C:\\" "cpp" 8))(progn<br/> (SETQ NB(strcat(vl-filename-directory sg)(STRCAT"\\"(vl-filename-base SG)"-New")(vl-filename-extension sg)))<br/> (setq file1 (open SG "R"))<br/> (setq file2 (open NB "W"))<br/> (while(setq re1(read-line file1))<br/> (if(not(equal re1 ""))<br/> (progn<br/> (setq n(vl-string-search "//"re1))<br/> (cond<br/> ((> n 0)<br/> (setq re1(strcat "\n"(substr re1 1 (vl-string-search "//"re1))))<br/> ;(setq re1"asdfas/*123*/pijl/*8965*/")<br/> (while(and(setq a1 (vl-string-search "/*"re1))<br/> (setq a2 (vl-string-search "*/"re1))<br/> )<br/> (setq re1(strcat(substr re1 1 a1)(substr re1 (+ a2 3)(strlen re1))))<br/> )<br/> (princ re1 file2)<br/> )<br/> ((not n)<br/> (setq re1(strcat "\n"re1))<br/> (while(and(setq a1 (vl-string-search "/*"re1))<br/> (setq a2 (vl-string-search "*/"re1))<br/> )<br/> (setq re1(strcat(substr re1 1 a1)(substr re1 (+ a2 3)(strlen re1))))<br/> )<br/> (princ re1 file2)<br/> )<br/> )<br/> ))<br/> )<br/> (close file1)<br/> (close file2)<br/> (setq file1 (open NB"R"))<br/> (setq file2 (open SG "W"))<br/> (while(setq re1(read-line file1))<br/> (setq re1(strcat "\n"re1))<br/> (princ re1 file2))<br/> (close file1)<br/> (close file2)<br/> (vl-file-delete NB)<br/> ))<br/> )</font></p> 有创意哦
但是注释也是有用的
某些时候还是可用这程序
页:
[1]