GithubHelp home page GithubHelp logo

gnome-c-utils's Introduction

gnome-c-utils

Various utilities, useful when programming with GLib/GTK+ in C.

Some scripts are more general and can be useful for other tasks.

Dependencies

Required:

  • GLib/GIO

Optional:

  • GTK+
  • GtkSourceView
  • Tepl

If the optional dependencies are not found, the programs depending on them won't be built.

Installation

$ cd build/
$ meson
$ ninja
[ Become root if necessary ]
$ ninja install

Tests/sample files

There are sample files in the tests/ directory.

Running the scripts on several files at once

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

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.

gcu-lineup-substitution

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.

gcu-align-params-on-parenthesis

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.

gcu-case-converter

Converts a word to lower_case, UPPER_CASE or CamelCase.

Read the top of gcu-case-converter.c for more details.

gcu-multi-line-substitution

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.

gcu-smart-c-comment-substitution

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.

gcu-check-chain-ups

Basic check of GObject virtual function chain-ups.

Read the top of gcu-check-chain-ups.c for more details.

gcu-include-config-h

Ensures that config.h is #included in *.c files.

Read the top of gcu-include-config-h.c for more details.

gnome-c-utils's People

Contributors

dimstar77 avatar geoffjay avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.