Skip to content

__whos_line_format__

builtin · libnexusinterp/parse-tree/pt-eval-proprietary.cc

: val = __whos_line_format__ ()
: old_val = __whos_line_format__ (new_val)
: old_val = __whos_line_format__ (new_val, "local")

Query or change the template that whos uses to lay out each line of its variable listing.

With no argument the current template is returned; supplying new_val installs a new one and returns the previous value.

A template is made of literal text interspersed with field specifications. Each field has the form

%[modifier]<command>[:width[:left-min[:balance]]];

and is closed by a semicolon. The command letter chooses which property of a variable the field prints:

%a

A fixed row of attribute flags, one character per property: c when the value is complex, s when it is sparse, f when it is a formal parameter, g when it is global, and p when it is persistent. An inactive flag shows as a blank.

%b

The number of bytes the variable occupies.

%c

The class name of the variable.

%e

The number of elements the variable holds.

%n

The variable name.

%s

The size, that is, the dimensions of the variable.

%t

The type name of the variable.

The optional leading modifier selects how the text sits in the field:

l

Align to the left.

r

Align to the right (the default).

c

Center within a column; meaningful only for the %s command.

width is the least number of columns the field may use. There is no upper bound: a field that needs more room grows to fit.

left-min and balance apply only to the column-aligned form of %s. balance names the column, counted from 0 at the left edge, that is lined up across successive entries, and left-min is the smallest number of columns held to the left of that balance point.

The template active by default is:

"  %la:5; %ln:6; %cs:16:6:1;  %rb:12;  %lc:-1;\n"

Used with the "local" keyword inside a function, the template is changed only for that function and the routines it calls, and the earlier value is restored when the function returns.