setuserinfo
-- set an
information levelsetuserinfo(
f, n)
sets the information
level for the function f
to n
, thus
activating or deactivating userinfo
commands built into
f
.
setuserinfo(f, n <, style>)
setuserinfo(f)
setuserinfo(n)
setuserinfo(NIL)
setuserinfo()
f |
- | a procedure, the name of a domain or Any |
n |
- | the ``information level'': a nonnegative integer |
style |
- | either Name or Quiet |
Name |
- | causes userinfo to append the name of the
calling procedure to the printed message |
Quiet |
- | causes userinfo to suppress the prefix
``Info: '' at the beginning of a line |
the previously set information level.
userinfo
.
This function is built into various library routines to display
progress information during the execution of algorithms.setuserinfo(
f, n <, style>)
sets
the information level of f
to the value n
and
returns the previously set value. Setting an information level for a
domain does not change previously set information levels of the methods
of this domain.setuserinfo(
f)
returns the current
information level of f
without changing it.setuserinfo(
Any, n <,
style>)
sets the global information level to the value
n
and returns the previously set value. Note, that this
does not change previously set information levels of domains and
procedures.setuserinfo(
n)
is equivalent to
setuserinfo(
Any,
n)
.setuserinfo(
Any)
returns the global information level without changing it.setuserinfo(
NIL)
resets the information
level of all functions and domains to the default value
0
. Usually, with this value, no information is printed by
userinfo
.setuserinfo(
)
returns a table of all
previously set information levels. This table is cleared by the call
setuserinfo(
NIL)
.We define a procedure f
that prints
information via userinfo
:
>> f := proc(x) begin userinfo(1, "enter 'f'"); userinfo(2, "the argument is " . expr2text(x)); x^2 end_proc:
After activating the userinfo
commands inside
f
via setuserinfo
, any call to f
prints status information:
>> setuserinfo(f, 1, Name): f(5)
Info: enter 'f' [f] 25
The information level of f
is
increased:
>> setuserinfo(f, 2): f(4)
Info: enter 'f' Info: the argument is 4 16
The prefix ``Info:
'' shall not be
printed:
>> setuserinfo(f, 2, Quiet): f(3)
enter 'f' the argument is 3 9
The userinfo
commands are deactivated
by clearing all information levels globally:
>> setuserinfo(NIL): f(2)
4
>> delete f: