;;; 使用自定义PGP文件 ;;; 2008.04.12完成 (vl-load-com) (defun c ionel_PGP ( / fil Lionel:PGP ShortFun FullFun interCmdList StrDef ) (setq fil (open (findfile "Lionel_PGP.pgp") "r");路径待修改 Lionel:PGP (ReadPGP fil) ShortFun T FullFun T StrDef "" n 0 interCmdList (atoms-family 1) );setq (while (< n (length Lionel:PGP)) (setq ShortFun (car (nth n Lionel:PGP)) FullFun (cadr (nth n Lionel:PGP)) );setq (if (member FullFun interCmdList) (setq StrDef (strcat "(defun c:" ShortFun "() (princ \" " (strcase FullFun) " \") (command \"" FullFun "\") (princ) )")); 内部命令 (setq StrDef (strcat "(defun c:" ShortFun "() (princ \" " (strcase FullFun) " \") (c:" FullFun ") (princ) )")); 外部命令 );if (eval (read StrDef)) ;;(princ StrDef) (setq n (1+ n)) );while (princ "\n自定义PGP文件加载完成!") (princ) );defun (defun ReadPGP (fil / strline return i n separator ShortFun FullFun) ;(open fil r) ;(open fil_temp w) (setq strline (read-line fil) return () i 1 ; 行计数器 ) (while (/= strline nil) ;;(princ (vl-string->list strline)) (setq strline (substr strline 1 (vl-string-search ";" strline)) ) (mapcar '(lambda (ch) (setq oldstr "") (while (/= oldstr strline) (setq oldstr strline strline (vl-string-subst "" ch strline) ) );while ) '(" " "\t" " ") ); mapcar ;; 清理半角空格,全角空格,制表符 (setq separator (vl-string-search ",*" strline)) (if (= "" strline) nil (if (null separator) (progn (Alert (strcat "PGP文件第" (itoa i) "行格式错误,请核实!")) (princ (strcat "\nPGP文件第" (itoa i) "行格式错误,请核实!")) );progn (progn (setq ShortFun (substr strline 1 separator) FullFun (substr strline (+ separator 3)) return (cons (list ShortFun FullFun) return) );setq );progn );if );if (setq strline (read-line fil) i (1+ i)) );while (reverse return) );defun (princ);; 静默退出加载
|