Jump to content

Have such a plugin can formatting Dcl to Lisp ?


AIberto

Recommended Posts

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

Link to comment
Share on other sites

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 ???

Link to comment
Share on other sites

Hi Tharwat

Nice to meet you !

 

Thank you :)

 

This is formatting by manual , So tired !!! :( I means, Have a tool can formatting automatically ???

 

Nothing comes easily ;)

Link to comment
Share on other sites

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. :)

Link to comment
Share on other sites

 

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 ;) .

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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 . :)

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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!!:D silly me! Good tips Thank you Lee :thumbsup:!!

Link to comment
Share on other sites

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! :thumbsup: I will try!

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...