有这样的插件可以格式化
有这样的插件可以将Dcl格式化为Lisp吗?这样地:
格式化之前
DCL文件
roughness
:dialog{ label="Roughness ";
spacer;
:row{
:column{
:image_button{ key = "RM"; aspect_ratio = 1; width = 8; fixed_width = true; color = -2; allow_accept = true; }
:image_button{ key = "UN"; aspect_ratio = 1; width = 8; fixed_width = true; color = -2; allow_accept = true; }
:image_button{ key = "BS"; aspect_ratio = 1; width = 8; fixed_width = true; color = -2; allow_accept = true; }
}
:list_box{ key="RV"; value=8; width=16; height=14; allow_accept=true; }
}
:row{
:errtile{ width= 14; }
:edit_box{ label = "Scale:"; key = "SC"; edit_width = 3; }
}
ok_cancel;
}
格式化后
Lisp文件
strl '("roughness:dialog{ "
"label=\"Roughness \"; "
"spacer; "
":row{ "
":column{ "
" :image_button{ key = \"RM\";"
" aspect_ratio = 1; "
" width = 8; "
" fixed_width = true; "
" color = -2; "
" allow_accept = true; "
" } "
" :image_button{ "
" key = \"UN\"; "
" aspect_ratio = 1; "
" width = 8; "
" fixed_width = true; "
" color = -2; "
" allow_accept = true; "
" } "
" :image_button{ key = \"BS\";"
" aspect_ratio = 1; "
" width = 8; "
" fixed_width = true; "
" color = -2; "
" allow_accept = true; "
" } "
" } "
" :list_box{ "
" key=\"RV\"; "
" value=8; "
" width=16; "
" height=14; "
" allow_accept=true; "
" } "
"} "
":row{ "
" :errtile{ "
" width= 14; "
" } "
" :edit_box{ "
" label = \"Scale:\"; "
" key = \"SC\"; "
" edit_width = 3; "
" } "
" } "
" ok_cancel; "
"} "
)
) ;_DCL 你好,阿尔贝托。
您的dcl代码格式正确。
嗨Tharwat
很高兴认识你!
这是手动格式化,太累了!!!我的意思是,有一个工具可以自动格式化???
非常感谢。
没有什么是容易的
假设您正在使用代码编辑器编写代码(如果没有,为什么不?!),使用大多数代码编辑器提供的标准编辑实用程序添加必要的引号。
例如,查找/替换“为”
所有行的前缀均为“
将所有行追加为“
工作完成。
读取DCL文件字符串并将其重写为txt文件或列表将完成此过程。 我过去的做法与塔尔瓦类似
(defun dcl->lst ( fn / str fn f l)
(if (and fn (setq f (open fn "r")))
(while (setq str (read-line f)) (setq l (cons str l)))
) ;_ end of if
(close f)
(reverse l)
) ;_ end of defun
使用控制台或vlide负载选择
(setq tmp (dcl->lst (getfiled "" "" "dcl" ))
从控制台复制列表,然后将其粘贴到编辑器,然后格式化选择
仍然有点手动,而不是完全自动化。
但是没有必要-这意味着将代码保存到一个单独的文件中,加载并运行程序来处理文件,选择要处理的保存文件,打开处理过的文件并将结果复制回编辑器。在我看来,在编辑器中简单地选择代码并直接对选择执行必要的操作要容易得多——我可能比运行单独的程序更快。 我过去常常以Dcl格式写入,然后将属性检索到Vlide的列表中,然后将它们复制并粘贴到目标程序中,但现在我能够在我的程序中写入Dcl属性,而无需直接执行所有上述过程。 hanhphuc,建议在程序中具有progn功能,以避免在用户最初未到达正确文件时出现错误消息。
页:
[1]
2