To better keep track with the LiMaL coding guidelines, there are some tools
which help you to reformat you code according to the guidelines.
Thereby you have to always keep in mind that there nowadays exists no tool
which can prevent every syntax mistake towards the guidelines. So you have to
deal with a number of tools in extreme cases.
In generall the new Code should be verified, because despite the programs have
been tested it can't be guaranteed that errors can't happen.
To do so simply rename all objekt files to an extension .old, then do a
make, after the code formatting process is done. The object files created from
the original code- files should be identical to those created from the new code-
files. If not something has gone wrong.

1. The Tools
============
In this document there will be 3 tools mentioned. Each of them can do a part of
the job. You can choose the one which best fits to your code based on the
description of the tools below.
1. astlye
2. gnu indent
3. replaceif.sh

1.1. astlye
-----------
This program is the one most likely everyone will use. But it does only a few
correction to the source code. Mainly it will deal with the indention of the
text. It will help you to indent the code with tabs instead of spaces and
it will set the right tab size of 4 spaces. Furthermore it will indent the text
at the parts where it should be, e.g. no classes are indented.
astyle thereby doesn't keep track of the syntax, so it won't insert spaces to
convert if(true) to if (true).

Unfortunately there is no rpm from astyle available for suse at the moment. So
you have to download it from http://sourceforge.net/projects/astyle/ and
compile it yourself. Afterwards the astylerc file (see link on the main
page) must be copied to our home directory and renamed to ".astylerc". It
contains the rules for astyle.

1.2. gnu indent
---------------
indent is the most popular code formatter, but it has one main disadvantage:
It understands only c not c++. That's no problem as far as you don't give him a
complete c++- file. If you only let him work on a "normal" part of the source-
code without c++ extensions it will work, and deals in contrast to astyle also
with syntax issue, so it will reformat mistyped if constructions. It will set
the return value of a function in a separate line before the function itself.
To use indent you have to install indent from your distribution. Afterwards you
have to copy the indent.pro- file to you home directory and rename it to
".indent.pro". The file can be found under the link on the main page. Similar to
the .astylerc file it contains the LiMaL coding rules converted to indent.

1.3. replaceif.sh
-----------------
replaceif is a short BASH- Skript which adds a space in an if- clause. So
if(true) will become if (true). This part is separated because this seems to be
a main mistake in the sourcecodes. Also astyle doesn't deal with that problem
and so can't correct it. You find this file in the same location as the other
config files.

After introducing all those tools, there may be one question. How can I use
indent with parts of the sourcecode? The only practical way I found was to use
a plugin for eclipse. You can get it here:
http://softwitch.net/blog/index.php/simple-indent-code-formatter-for-cdt/ it
requires the installation of cdt for eclipse which is the c and c++ development
part of eclipse.
In this plugin you have to choose "Custom GNU indent option" and keep the field
below empty. Then it will format you code right, if you copied the indent.pro
file to the right directory.

2. What the tools can't do for you
==================================
There are, of course, several code guidelines the tools can't realize for you.
In this paragraph I will try to sum them up. This are the critical points which
you have to correct by hand.

1. According to the coding guidelines after every if, while, switch
   construction there have to be brackets on a new line. If there are brackets
   astyle and indent will put them on a new line, but if there aren't brackets
   this won't be corrected, especially not in the case one argument is followed.
   In this case according to the c and c++ standard it is allowed to omit
   the brackets. And so they won't be inserted, despite they have to be there
   according to the guidelines.

3. Editors
==========
Finally some preferences for famous editors should be mentioned:

1. Vim
------
First of all there should exist either a ~/.vimrc- file with "set modelines=4"
or the adequate section in /etc/vimrc has to be changed. This is because
modelines are set to 0 on SuSE Linux by default. Afterwards you can use a
modeline at the end of the code- file, which sets some defaults of the Coding
Guide described here. The modeline to be added is:

/* vim:set ts=4 sts=4 ai noet cin sw=4
cinoptions=>s,e0,n0,f0,{0,}0,^0,:s,=s,l0,g0,hs,ps,t0,+s,cs,C0,(2s,us,\U0,w0,m0,
j0,)20,*30: tw=80 */

The whole line has to be written in one line in the code- file, otherwise vim
won't accept it.

2. Xemacs
---------
For Xemacs there exists a new package called limal-cc-mode. This package is
developed out of the normal cc-mode package and contains the rules used by the
LiMaL- Code- Guide. Especially they deal with the right indention of the code.
The main difference between the original cc-mode package and the limal-cc-mode
package is that now the code in continued argument lists of functions will be
indented right with tabs AND spaces.
Example:
	newfunction(int testarg,
	            string teststring
	           );
^^^^^^^^
 Tab    ^^^^^^^^^^^
	Spaces
The tabs and spaces in this example are automatically inserted by Xemacs if you
install the limal-cc-mode package and autoindent the line (normally with the
tab- key).

To install the new package you have to do the following:
1. Copy the limal-cc-mode directory (see link on the main page) to the place
   where the xemacs packages are installed (normally
   /usr/share/xemacs/xemacs-packages/lisp)
2. Copy the custom-c-mode.el file from the directory to your .xemacs
   directory and activate it in the init.el Script.
   Therefore the following lines have to be added:
   (load "~/.xemacs/custom-c-mode.el" t t)
3. Now the extensions should run. You can control it with M-x c-version. This
   command has to output "Using CC Mode version 5.25-limal".

Known Issues
At the moment there is one known issue when using limal-cc-mode. If you try to
auto-indent the access indentifiers like private, public and protected, it will
not work right. The workaround is to make the indention by hand.

3. Emacs
--------
The modification described above should also work with Emacs. But for Emacs
only a compiled version of limal-cc-mode will be available (see known link), not
the settings file (see custom-c-mode.el) itself. Feel free to try it out. Maybe
you can add a settings file here later.