lib(notify_ports)


    This library implements a nonlogical feature, called notification
    ports.  They are a form of messaging, i.e. there is are send ports
    and attached receive ports, and messages in the form of general terms
    can be passed through these ports.  Both send and receive ports have
    unique handles, which is the nonlogical bit.
    
    There are two variants of this feature, one-to-many and many-to-many
    ports.
    

    One-To-Many
    
    In the one-to-many variant, messages sent from a single send port
    can be received independently by several receivers. In this setting,
    the message stream is essentially an infinite list, with the sender
    extending the list at the tail and the receivers each individually
    progressing through the list.
    
    Straightforward interface:
    
	open_sender(-Sender)
	close_sender(+Sender)
	send_notification(+Sender, +Message)
	open_receiver(+Sender, -Receiver)
	open_receiver_init(+Sender, +InitMsgs, -InitMsgsTail, -Receiver)
	receive_notifications(+Receiver, -Messages, -Status)
	foreachnotification(+BaseName, -Message, +Params, +Receiver, -Status, +Goals)
    
    There is also a slightly more memory efficient API where sender and
    receiver can be fields of larger structures rather than separate
    substructures. These  larger structures must always be created
    by the caller (in the case of the sender this is often an attribute
    structure, in the case of the receiver it is sometimes advantageous
    to package a suspension together with the receiver in order to kill
    it at the end of all messages):
    
	open_sender(+SendPos, +SendStruct)
	close_sender(+SendPos, +SendStruct)
	send_notification(+SendPos, +SendStruct, +Message)
	open_receiver(+SendPos, +SendStruct, +ReceivePos, +ReceiveStruct)
	open_receiver_init(+SendPos, +SendStruct, +InitMsgs, -InitMsgsTail,
				+ReceivePos, +ReceiveStruct)
	receive_notifications(+ReceivePos, +ReceiveStruct, -Messages, -Status)
	foreachnotification(+BaseName, -Message, +Params, +ReceivePos, +ReceiveStruct, -Status, +Goals)
    

    Many-To-Many
    
    In the many-to-many variant, several send ports can be connected
    to several receive ports in an arbitray manner.
    To enable a receiver to distinguish messages from multiple senders,
    the messages get tagged with a sender- and receiver-specific id as
    they are received.
    
    The corresponding predicates are the following. Note that sender and
    receiver are opened with different predicates, but the send and receive
    predicates are the same as for one-to-many ports:
    
	open_tagging_sender(-Sender)
	open_tagged_receiver(+Tag, +Sender, -Receiver)

	send_notification(+Sender, +Message)
	receive_notifications(+Receiver, -Messages, -Status)
	foreachnotification(+BaseName, -Message, +Params, +Receiver, -Status, +Goals)
    
    Note that closing of tagging senders is currently not implemented.
    

