Skip to content

foresight_readout ​

foresight_readout, seven-segment readouts: the glass a printf format defines and the segments a value lights on it.

A readout shows one number (the last finite value of a series) on a fixed-segment display, as the digital clusters of 1980s cars: every cell of the glass is always there, the value only lights some of its segments. The glass is therefore decided by the format, never by the value: %9.2e makes 8 cells (the decimal point is a segment of the cell before it, as on real displays), and it keeps that width whatever the value, so a watched readout never jumps.

A cell is a bit mask: bits 0 to 6 the segments a (top), b (top right), c (bottom right), d (bottom), e (bottom left), f (top left), g (middle), bit 7 (SEGMENT_DP) the decimal point. A value with no finite reading, or wider than the glass (printf would widen the field), lights the middle segment of every cell: dashes, never truncated digits. The text around the conversion ('%5.2f h') is not on the glass: it is the printed unit beside it.

Source: src/lib/foresight_readout.F90

Dependencies

Contents ​

Variables ​

NameTypeAttributesDescription
DEFAULT_READOUT_FORMATcharacter(len=*)parameterFormat of a readout without one: any magnitude.
SEGMENT_DPinteger(kind=I4P)parameterBit of the decimal point.
SEGMENT_MIDDLEinteger(kind=I4P)parameterMask of the middle segment g alone: a dash.
DIGITSinteger(kind=I4P)parameterMasks of the digits 0..9.
LETTER_Einteger(kind=I4P)parameterMask of E: segments a, d, e, f, g.

Subroutines ​

readout_glass ​

Cells of the glass of the readout format (see readout_check), lit by value; prefix and suffix are the text around the conversion, printed beside the glass.

Attributes: pure

fortran
subroutine readout_glass(format, value, masks, prefix, suffix)

Arguments

NameTypeIntentAttributesDescription
formatcharacter(len=*)inReadout format.
valuereal(kind=R8P)inValue shown; not finite for none.
masksinteger(kind=I4P)outallocatableSegments of each cell, left to right.
prefixcharacter(len=:)outallocatableText before the glass.
suffixcharacter(len=:)outallocatableText after the glass.

Call graph

Functions ​

readout_check ​

Empty if format is a readout format: a tick format (see foresight_format format_check) with a field width, which fixes the glass, and not %h, whose superscript has no seven-segment form.

Attributes: pure

Returns: character(len=:)

fortran
function readout_check(format) result(message)

Arguments

NameTypeIntentAttributesDescription
formatcharacter(len=*)inFormat.

Call graph

last_finite ​

Last finite element of y, NaN if none: the reading of a readout.

Attributes: pure

Returns: real(kind=R8P)

fortran
function last_finite(y) result(value)

Arguments

NameTypeIntentAttributesDescription
yreal(kind=R8P)inSeries ordinates.

Call graph

glass_cells ​

Cells of the glass of a conversion: its field width, less the decimal point that f and e always print with a non-zero precision (it lights a segment of a cell); g may print one or not, the spare cell stays blank.

Attributes: pure

Returns: integer(kind=I4P)

fortran
function glass_cells(width, prec, type) result(cells)

Arguments

NameTypeIntentAttributesDescription
widthinteger(kind=I4P)inField width.
precinteger(kind=I4P)inPrecision, -1 if absent (6).
typecharacter(len=1)inConversion type.

Call graph

glyph ​

Segments lit by the character c of a formatted number: a digit, - (the middle segment), e or E; blanks and + (an exponent sign) light none, keeping e+02 and e-02 on the same cells.

Attributes: elemental

Returns: integer(kind=I4P)

fortran
function glyph(c) result(mask)

Arguments

NameTypeIntentAttributesDescription
ccharacter(len=1)inCharacter.

Call graph