Message printing primitives

Author(s): Daniel Cabeza, Edison Mera (improvements), Jose F. Morales.

This module provides predicates for printing in a unified way informational messages. It is designed to be small and do not have (strict) dependencies with other larger printing and formatting libraries in the system.

Usage and interface

Documentation on exports

PREDICATEmessage/2

Usage:message(Type,Message)

Output to standard error Message, which is of type Type. The quiet prolog flag (see Changing system behaviour and various flags) controls which messages are actually output, depending on its type. Also, for error, warning and note messages, a prefix is output which denotes the severity of the message.

  • The following properties should hold at call time:
    (messages_basic:message_type/1)Specifies the different types of messages.
    (messages_basic:lformat_text/1)Message is an item or a list of items from this list:

    $$(String)
    String is a string, which is output with write_string/1.

    ”(Term)
    Term is output quoted. If the module write is loaded, the term is output with writeq/1, else with displayq/1.

    ~~(Term)
    Term is output unquoted. If the module write is loaded, the term is output with write/1, else with display/1.

    ”({Term})
    Term is output quoted. If the module write is loaded, the term is output with printq/1, else with displayq/1.
    {Term}
    Term is output unquoted. If the module write is loaded, the term is output with print/1, else with display/1.

    [](Term)
    Term is recursively output as a message, can be an item or a list of items from this list.

    Term
    Any other term is output with display/1.

PREDICATEmessage_lns/4

Usage:message_lns(Type,L0,L1,Message)

Output to standard error Message, which is of type Type, and occurs between lines L0 and L1. This is the same as message/2, but printing the lines where the message occurs in a unified way (this is useful because automatic tools such as the emacs mode know how to parse them).

PREDICATEmessages/1

Usage:messages(Messages)

Print each element in Messages using message/2 or message_lns/4 predicates.

  • The following properties should hold at call time:
    (basic_props:list/2)Messages is a list of message_infos.

PREDICATElformat/1

Usage:lformat(T)

Output a formatted text T. See lformat_text/1 for a description of the text formatting.

  • The following properties should hold at call time:
    (messages_basic:lformat_text/1)T is an item or a list of items from this list:

    $$(String)
    String is a string, which is output with write_string/1.

    ”(Term)
    Term is output quoted. If the module write is loaded, the term is output with writeq/1, else with displayq/1.

    ~~(Term)
    Term is output unquoted. If the module write is loaded, the term is output with write/1, else with display/1.

    ”({Term})
    Term is output quoted. If the module write is loaded, the term is output with printq/1, else with displayq/1.
    {Term}
    Term is output unquoted. If the module write is loaded, the term is output with print/1, else with display/1.

    [](Term)
    Term is recursively output as a message, can be an item or a list of items from this list.

    Term
    Any other term is output with display/1.

display_list(List)

Outputs List. If List is a list, do display/1 on each of its elements, else do display/1 on List.

Usage:

The type of the elements to be printed using the messages/1 predicate. Defined as

message_info(message_lns(Source,Ln0,Ln1,Type,Text)) :-
        atm(Source),
        nnegint(Ln0),
        nnegint(Ln1),
        message_type(Type),
        lformat_text(Text).
message_info(message(Type,Text)) :-
        atm(Type),
        lformat_text(Text).
message_info(error(Text)) :-
        lformat_text(Text).
message_info(warning(Text)) :-
        lformat_text(Text).
message_info(note(Text)) :-
        lformat_text(Text).
message_info(message(Text)) :-
        lformat_text(Text).
message_info(debug(Text)) :-
        lformat_text(Text).
.

    Usage:

    Specifies the different types of messages.

      PREDICATEadd_lines/4
      No further documentation available for this predicate.

      Documentation on internals

      Usage:lformat_text(Message)

      Message is an item or a list of items from this list:

      $$(String)
      String is a string, which is output with write_string/1.

      ”(Term)
      Term is output quoted. If the module write is loaded, the term is output with writeq/1, else with displayq/1.

      ~~(Term)
      Term is output unquoted. If the module write is loaded, the term is output with write/1, else with display/1.

      ”({Term})
      Term is output quoted. If the module write is loaded, the term is output with printq/1, else with displayq/1.
      {Term}
      Term is output unquoted. If the module write is loaded, the term is output with print/1, else with display/1.

      [](Term)
      Term is recursively output as a message, can be an item or a list of items from this list.

      Term
      Any other term is output with display/1.

        Documentation on imports

        This module has the following direct dependencies:

        Known bugs and planned improvements

        • message/2 assumes that a module with name 'write' is library(write).