Skip to content

About forbear ​

forbear (the e is mute: say forbar) is a pure Fortran library that draws a progress bar for long-running programs: a line that is redrawn in place while the program runs, showing how far it has come and, if you ask, the progress in percent and in steps, the speed and the estimated time to the end, a message of the current step, the start and end times, a scale and a closing summary. Messages can be printed above a running bar, nested loops get one bar each, and when the output is not a terminal, as in the log of a batch job, the bar writes plain lines instead.

A bar is a bar_object: you initialize it (its look and its range), start it before the loop, and update it with the current value at every step. The bar is made of elements, each one a string with an optional colour and style: a prefix, the brackets, the filled and empty characters, a suffix, a spinner. forbear is Fortran 2008 and depends on one small library by the same author, FACE, for the ANSI colours.

This documentation reads in order, and each page links to the next one:

  1. Installation: get forbear into your project.
  2. The tutorial: eleven short chapters that grow the progress bar of one program.
  3. The cookbook: short recipes, one for each "how do I ...?".
  4. The reference, from the feature map on: every keyword, every default, every limitation.

The API documents the source itself.

Every code sample of this documentation is part of a program that is compiled and run to produce the outputs shown (see docs/examples). A bar redraws its line many times: the outputs show what the terminal displays at the end of the run, or in the middle of it when the page says so; the animations are recordings of the same programs in a real terminal.

Authors ​

Contributions are welcome — see the Contributing page.

Copyrights ​

forbear is distributed under a multi-licensing system:

Use caseLicense
FOSS projectsGPL v3
Closed source / commercialBSD 2-Clause
Closed source / commercialBSD 3-Clause
Closed source / commercialMIT

Released under the GPL v3, BSD 2-Clause, BSD 3-Clause or MIT License.