AIberto Posted November 7, 2014 Share Posted November 7, 2014 Have such a plugin can formatting Dcl to Lisp ? Like this: Before formatting DCL file 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; } After the formatting Lisp file 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 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 7, 2014 Share Posted November 7, 2014 Hi Alberto . Your formatting of the dcl codes is correct . Quote Link to comment Share on other sites More sharing options...
AIberto Posted November 7, 2014 Author Share Posted November 7, 2014 Hi Alberto . Your formatting of the dcl codes is correct . Hi Tharwat Nice to meet you ! This is formatting by manual , So tired !!! I means, Have a tool can formatting automatically ??? Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 7, 2014 Share Posted November 7, 2014 Hi TharwatNice to meet you ! Thank you This is formatting by manual , So tired !!! I means, Have a tool can formatting automatically ??? Nothing comes easily Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 7, 2014 Share Posted November 7, 2014 This is formatting by manual , So tired !!! I means, Have a tool can formatting automatically ??? Assuming you are writing the code using a code editor (and if not, why not?!), use the standard editing utilities offered by most code editors to add the necessary quotation marks. For example, find/replace " with \" Prefix all lines with " Append all lines with " Job done. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 7, 2014 Share Posted November 7, 2014 For example, find/replace " with \" Prefix all lines with " Append all lines with " Reading and rewriting the DCL file strings into a txt file or a list would take care of this process . Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted November 7, 2014 Share Posted November 7, 2014 what i use to do is similar with Tharwat (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 using console or vlide Load Selection (setq tmp (dcl->lst (getfiled "" "" "dcl" )) copy the list from console then paste it to editor, then Format Selection still a bit manually not fully automated. Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 7, 2014 Share Posted November 7, 2014 Reading and rewriting the DCL file strings into a txt file or a list would take care of this process . But there is no need - this means saving the code to a separate file, loading & running the program to process the file, selecting the saved file to be processed, opening the processed file & copying the results back to the editor. In my opinion it is far easier to simply select the code in the editor and perform the necessary operations directly to the selection - I could probably do this quicker than running a separate program. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 7, 2014 Share Posted November 7, 2014 I used to write in Dcl format then retrieve the attributes to a list into the Vlide then copy & paste them into the target program , but nowadays I am able to write the dcl attributes in my program without the need of all these previous said process directly . Quote Link to comment Share on other sites More sharing options...
Tharwat Posted November 7, 2014 Share Posted November 7, 2014 hanhphuc , it is recommended to have the progn function in your program to avoid the error message if the user did not reach correct file at first . Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted November 7, 2014 Share Posted November 7, 2014 hanhphuc , it is recommended to have the progn function in your program to avoid the error message if the user did not reach correct file at first . Thank you for the advise, noted But there is no need - this means saving the code to a separate file, loading & running the program to process the file, selecting the saved file to be processed, opening the processed file & copying the results back to the editor. In my opinion it is far easier to simply select the code in the editor and perform the necessary operations directly to the selection - I could probably do this quicker than running a separate program. normally save as dcl, syntax & color for me easier in dcl editor. In lisp editor, semi-colon ";" is comment, or string " " is pink color so double handling job however noted your advise, i should direct practise in lisp editor Thank you. Quote Link to comment Share on other sites More sharing options...
AIberto Posted November 7, 2014 Author Share Posted November 7, 2014 what i use to do is similar with Tharwat (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 using console or vlide Load Selection (setq tmp (dcl->lst (getfiled "" "" "dcl" )) copy the list from console then paste it to editor, then Format Selection still a bit manually not fully automated. Many Thanks , my friend hanhphuc. My idea is the same, but , I think You can also improve. 1.Reading dcl file 2.Writing the "formatting code" into a txt file. not in command bar Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted November 7, 2014 Share Posted November 7, 2014 normally save as dcl, syntax & color for me easier in dcl editor.In lisp editor, semi-colon ";" is comment, or string " " is pink color so double handling job Assuming you are using the Visual LISP IDE, simply change the language to DCL: Tools > Window Attributes > Syntax Coloring > DCL No need to save to a separate file, but each to their own I suppose Quote Link to comment Share on other sites More sharing options...
hanhphuc Posted November 7, 2014 Share Posted November 7, 2014 Assuming you are using the Visual LISP IDE, simply change the language to DCL: Tools > Window Attributes > Syntax Coloring > DCL No need to save to a separate file, but each to their own I suppose oh!! silly me! Good tips Thank you Lee !! Quote Link to comment Share on other sites More sharing options...
marko_ribar Posted November 7, 2014 Share Posted November 7, 2014 Hi there, maybe this topic can help you... http://www.theswamp.org/index.php?topic=40611.msg459214#msg459214 HTH, M.R. BTW., IICR, CAB posted in one of his post on the swamp the whole bunch of links with such examples and from other authors, this is just my humble contribution... Quote Link to comment Share on other sites More sharing options...
AIberto Posted November 7, 2014 Author Share Posted November 7, 2014 Hi there, maybe this topic can help you... http://www.theswamp.org/index.php?topic=40611.msg459214#msg459214 HTH, M.R. BTW., IICR, CAB posted in one of his post on the swamp the whole bunch of links with such examples and from other authors, this is just my humble contribution... Marko , Many thanks! I will try! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.