![]() |
Telelogic Rhapsody (steve huntington) | ![]() |
Topic Title: Code beautifier script for Rhapsody-generated C++ Topic Summary: Created On: 15-Jun-2006 19:55 Status: Read Only |
Linear : Threading : Single : Branch |
![]() |
![]()
|
![]() |
|||
I've created a basic GC script that cleans up Rhapsody's C++ code somewhat. Usage instructions:
1. Download the GC GreatCode application from [url]http://sourceforge.net/projects/gcgreatcode/[/url], and the GC configuration file. 2. Copy the two files into any convenient location, such as C:\Rhapsody6.2. 3. Rename GC.txt to GC.cfg (unfortunately, the forum doesn't allow you to attach files with a "cfg" extension). 4. In your Rhapsody model, set the appropriate InvokePostProcessor property or properties to c:\Rhapsody6.2\gc.exe -file-$file, modifying the path if you put the GC files somewhere else. 5. Regenerate your code (Code | ReGenerate | [configuration]). If anyone would like to improve the script, please do so - I haven't put a great deal of effort into this so far. In particular, something that would be nice is to get it to insert file and function header comments (see the -file_insert-<file> option) without screwing up Rhapsody's magic comments. Aaron Sher, Vanteon Corporation
|
|||
![]() |
|||
![]() |
|||
To add on to what Aaron has said...
For those of you who want to see what effect a code beautifier has on their code in real time via a GUI, the UniversalIndentGUI is a free tool that supports the following free code beautifiers: Artistic Style BCPP CSSTidy GNU Indent GreatCode HTML Tidy PHP Code Beautifier Uncrustify It is found here: [url]http://sourceforge.net/projects/universalindent[/url] It allows you to load in any text file you want and see how one of the above code beautifiers changes it as you adjust each code beautifier feature (accessible via a point and click gui). When your satisfied with how it looks, use the "save indenter config file" to save your settings for that program into a file, and then use it with the chosen code beautifier to "beautify" Rhapsody's generated code. In my case, I used Artistic Style and adjusted its settings to my satisfaction and then saved its config file, ".astylerc". I then configured my Rhapsody workspace as follows: Artistic Style executable: c:\Workspace\project\codebeautifier\astyle\bin\astyle.exe Artistic Style config file: c:\Workspace\project\codebeautifier\astyle\.astylerc My Rhapsody InvokePostProcessor settings (found in Features->Properties->CG->File->InvokePostProcessor): $projectPath\codebeautifier\astyle\bin\astyle.exe $file --options=$projectPath\codebeautifier\astyle\.astylerc where: $projectPath gives the project directory (ie. c:\workspace\project) $file gives file name being beautified (Rhapsody supplies this) Using $projectPath instead of a set directory allows my co-coders in my group to have their workspace in whatever directory they desire. The above command line is set for Artistic Style. Using any of the other free code beautifiers will require some modification to this line depending on the argument options each code beautifier requires. Also check that the code beautifier you go with is up to date as the UniversalIndentGUI may not have the most up to date version. Darren Hunt NovAtel Inc. |
|||
![]() |
FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.