Format DCL
Function Syntax | FormatDCL |
Current Version | 1.0 |
Download | FormatDCLV1-0.lsp |
View HTML Version | FormatDCLV1-0.html |
Program Description
This program will read a selected DCL file and create a formatted version of the DCL code in the same directory as the selected file (not overwriting the original file).
The inspiration for the program stems from a discussion with Michael Puckett at TheSwamp forum; and a modified version of his _PrinDcl function is utilised in this program as noted in the source code. The original _PrinDcl function and discussion surrounding this program may be found here.
Note: As a result of the way the DCL code is formatted, DCL comments found in the selected file will not appear in the output file.
Example of Output
As an example to demonstrate the output generated by this program, I have used the DCL code from my Steal program:
lbox : list_box { width = 30; height = 20; fixed_width = true; fixed_height = true; alignment = centered; } butt : button { width = 15; height = 2.5; fixed_width = true; fixed_height = true; } steal : dialog { key = "dctitle"; spacer; : text { label = "Copyright (c) Lee Mac 2011"; alignment = right; } spacer; : row { : lbox { key = "l1"; } : lbox { key = "l2"; multiple_select = true; allow_accept = true; } } : row { alignment = centered; : edit_box { key = "search1"; } : button { width = 12; fixed_width = true; height = 1.7; fixed_height = true; key = "search2"; label = "Search"; } } spacer; : row { spacer; : butt { key = "accept"; is_default = true; label = "Import"; } : butt { key = "cancel"; is_cancel = true; label = "Done"; } spacer; } }
The program will output a file containing the same code as above, formatted in the following style:
lbox : list_box { width = 30; height = 20; fixed_width = true; fixed_height = true; alignment = centered; } butt : button { width = 15; height = 2.5; fixed_width = true; fixed_height = true; } steal : dialog { key = "dctitle"; spacer; : text { label = "Copyright (c) Lee Mac 2011"; alignment = right; } spacer; : row { : lbox { key = "l1"; } : lbox { key = "l2"; multiple_select = true; allow_accept = true; } } : row { alignment = centered; : edit_box { key = "search1"; } : button { width = 12; fixed_width = true; height = 1.7; fixed_height = true; key = "search2"; label = "Search"; } } spacer; : row { spacer; : butt { key = "accept"; is_default = true; label = "Import"; } : butt { key = "cancel"; is_cancel = true; label = "Done"; } spacer; } }
Instructions for Running
Please refer to How to Run an AutoLISP Program.