Tool to rename a GObject written in C?



Hi,

Renaming a GObject written in C can be done with some sed substitutions,
but after that the indentation is broken.

Do you know a tool to rename a GObject while still keeping a good
indentation and coding style?

I'm interested more specifically about aligning parameters on the
parenthesis for function calls, e.g. to fix things like that:

function_call (param1,
                  param2,
                  param3);

I know Vim can do it with the = command. But gg=G (to apply the =
command to the whole file) doesn't indent correctly some parts of the
code.

Maybe Emacs can do it?

In any case, it should be scriptable, to re-indent a list of files in
one command, for example after changing the namespace of a group of
GObjects.

For function definitions, I've already written a script:
https://github.com/swilmet/gnome-c-utils

For function calls, a script could be written to do the substitutions.
When the script detects that (1) an opening parenthesis is present
further on the same line and (2) the following lines are aligned on the
parenthesis, then adujst the alignment. A script that needs to fix
broken alignment is harder to write, so it's simpler if the re-alignment
is done at the same time as the substitution (assuming that the code is
initially well indented).

Writing such a script would not be hard, I just want to know what tools
you use when renaming several GObjects at once, to not reinvent the
wheel. It's really hard to believe that such tool doesn't exist, doing
the work manually is quite painful.

Thanks in advance,
Sébastien


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]