Next Previous Contents

6. _apropos

Synopsis

Generate a list of functions and variable

Usage

Integer_Type _apropos (String_Type s, Integer_Type flags)

Description

The _apropos function may be used to get a list of all defined objects whose name consists of the substring s and whose type matches those specified by flags. It returns the number of matches. If the number returned is non-zero, that number of strings which represent the names of the matched objects will also be present on the stack.

The second parameter flags is a bit mapped value whose bits are defined according to the following table

     1          Intrinsic Function
     2          User-defined Function
     4          Intrinsic Variable
     8          User-defined Variable
Example

    define apropos (s)
    {
      variable n, name;
      n = _apropos (s, 0xF);
      if (n) vmessage ("Found %d matches:", n);
      else message ("No matches.");
      loop (n)
        {
           name = ();
           message (name);
        }
    }
prints a list of all matches.
Notes

Since the function returns the matches to the stack, it is possible that a stack overfow error could result if there are two many matches. If this happens, the interpreter should be recompiled to use a larger stack size.

See Also

is_defined, sprintf


Next Previous Contents