Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic Rhapsody (steve huntington)
Decrease font size
Increase font size
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
Search Topic Search Topic
Topic Tools Topic Tools
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 15-Jun-2006 19:55
User is offline View Users Profile Print this message


Aaron Sher

Posts: 5
Joined: 14-Apr-2006

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

GC.txt
GC.txt  (4 KB)

Report this to a Moderator Report this to a Moderator
 1-Aug-2007 16:31
User is offline View Users Profile Print this message


Darren Hunt

Posts: 1
Joined: 20-Jul-2006

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.
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic Rhapsody forum.
There are currently 1 users logged in.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.