Previous Page Next Page Contents

setuserinfo -- set an information level

Introduction

setuserinfo(f, n) sets the information level for the function f to n, thus activating or deactivating userinfo commands built into f.

Call(s)

setuserinfo(f, n <, style>)
setuserinfo(f)
setuserinfo(n)
setuserinfo(NIL)
setuserinfo()

Parameters

f - a procedure, the name of a domain or Any
n - the ``information level'': a nonnegative integer
style - either Name or Quiet

Options

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

Returns

the previously set information level.

Related Functions

print, userinfo, warning

Details

Example 1

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:

Changes




Do you have questions or comments?


Copyright © SciFace Software GmbH & Co. KG 2000