Game Development Community

Code Beauty - Identer : Torquescript : Torsion

by Javier Canon · 01/01/2009 (12:43 pm) · 4 comments

I want to read my torquescript code, so the best way is "beauty the code"

Torsion is a very good IDE for torquescript so, i will try to make the code more readable... good for the next update of Torsion...

1. Download the IDE for many free beauty - identers, you can test the many options:
sourceforge.net/project/showfiles.php?group_id=167482&package_id=190449&release_...

1.1 ok, i will use Artistic Style, so you can update to the last version (1.22) reemplacing it in the "UniversalIndentGUI_1.0.1_win32\UniversalIndentGUI_win32\indenters" folder
sourceforge.net/project/showfiles.php?group_id=2319&package_id=2282&release_id=5...

2. Setup Torsion:
Menu: Tools -> External tools...

Title: Code Beauty :D
Command: C:\UniversalIndentGUI_1.0.1_win32\UniversalIndentGUI_win32\indenters\astyle.exe
Arguments: --style=kr --mode=c --suffix=.bak $(FilePath)
note: if you dont want backup files: --style=kr --mode=c --suffix=none $(FilePath)
Initial Directory: $(FileDir)

Links:
Inline Tool:www.gnu.org/software/indent/

Many Indenters tools in one download:
sourceforge.net/project/showfiles.php?group_id=167482&package_id=293094&release_...

Happy Coding :D !!!

About the author

God blessed me with a brilliant mind... so im a genius...


#1
01/01/2009 (1:18 pm)
Thanks for the information, never thought to use something like that. I find the following parameters for astyle to be more clean looking:

--style=ansi --mode=c --suffix=.bak $(FilePath) --indent=spaces=5
#2
01/01/2009 (7:37 pm)
I'm seeing a problem with the formatting that causes a parse error in code.

case$ ()

gets changed to:

case $()

Any ways to fix that? It's the only issue I've come across so far.
#3
01/02/2009 (4:58 am)
Hi Javier,
thanks very much for this resource... It works excellent...

I just found out that if you're using spaced directories for your game then you have to use double quotes on the $(FilePath) and $(FileDir) parameters.

ie:
Arguments: --style=kr --mode=c --suffix=.bak "$(FilePath)"
Initial Directory: "$(FileDir)"

Happy New Year!
#4
01/02/2009 (9:10 am)
@Peter

I dont know, but you can try with one of this settings:

--pad=paren / -P
Insert space padding around parenthesis on both the outside and the inside.

if (isFoo(a, b))
    bar(a, b);
becomes:

if ( isFoo ( a, b ) )
    bar ( a, b );
 

--pad=paren-out / -d
Insert space padding around parenthesis on the outside only. This can be used with unpad=paren below to remove unwanted spaces.

if (isFoo(a, b))
    bar(a, b);
becomes:

if (isFoo (a, b) )
    bar (a, b);
 

--pad=paren-in / -D
Insert space padding around parenthesis on the inside only. This can be used with unpad=paren below to remove unwanted spaces.

if (isFoo(a, b))
    bar(a, b);
becomes:

if ( isFoo( a, b ) )
    bar( a, b );
 

--unpad=paren / -U
Remove extra space padding around parenthesis on the inside and outside. Can be used in combination with the paren padding options pad=paren-out and pad=paren-in above. Only padding that has not been requested by other options will be removed.

For example, if a source has parens padded on both the inside and outside, and you want inside only. You need to use unpad=paren to remove the outside padding, and pad=paren-in to retain the inside padding. Using only pad=paren-in would not remove the outside padding.

if ( isFoo( a, b ) )
    bar ( a, b );
becomes (with no padding option requested):

if (isFoo(a, b))
    bar(a, b);