Various utilities, useful when programming with GLib/GTK+ in C.
Some scripts are more general and can be useful for other tasks.
Required:
- GLib/GIO
Optional:
- GTK+
- GtkSourceView
- Tepl
If the optional dependencies are not found, the programs depending on them won't be built.
$ cd build/
$ meson
$ ninja
[ Become root if necessary ]
$ ninja install
There are sample files in the tests/
directory.
It is recommended to use e.g. GNU Parallel to run the scripts on several files at once. In a previous version of gnome-c-utils it was possible to directly pass several file arguments to some gcu scripts, but this possibility has been removed to simplify the code, and with GNU Parallel it is anyway almost as convenient to use, with the benefit that it runs in parallel.
For example:
$ find . -name "*.c" | parallel gcu-lineup-parameters
Line up parameters of function declarations.
Example:
gboolean
frobnitz (Frobnitz *frobnitz,
gint magic_number,
GError **error)
{
...
}
Becomes:
gboolean
frobnitz (Frobnitz *frobnitz,
gint magic_number,
GError **error)
{
...
}
Read the top of gcu-lineup-parameters.c
for more details.
Do a substitution and at the same time keep a good alignment of parameters on the parenthesis.
Example:
function_call (param1,
param2,
param3);
Rename function_call
to another_beautiful_name
:
another_beautiful_name (param1,
param2,
param3);
gcu-lineup-substitution can be useful to rename a GObject class, or to change the namespace of a group of GObjects, while still keeping a good indentation/alignment of the code (in combination with gcu-lineup-parameters).
Read the top of gcu-lineup-substitution.c
for more details.
Align parameters on the opening parenthesis, made to be integrated in a text editor.
Example:
function_call (param1,
param2,
param3);
Read the top of gcu-align-params-on-parenthesis.c
for more details.
Converts a word to lower_case
, UPPER_CASE
or CamelCase
.
Read the top of gcu-case-converter.c
for more details.
Does a multi-line substitution. Or, in other words, a multi-line search and replace.
Read the top of gcu-multi-line-substitution.c
for more details.
Smart substitution (or, search and replace) in C comments. Can be useful to change license headers. The script ignores spacing differences and ignores the positions of newlines (where a sentence is split).
Read the top of gcu-smart-c-comment-substitution.c
for more details.
Basic check of GObject virtual function chain-ups.
Read the top of gcu-check-chain-ups.c
for more details.
Ensures that config.h
is #included
in *.c
files.
Read the top of gcu-include-config-h.c
for more details.