(*
 * Title:    msgs.h
 * Purpose:  provide support for messages resource file
 *           (Use this to make your applications "internationalisable!")
 *
 *)

#ifndef __msgs_h
#define __msgs_h

const   msgs_TAG_MAX     =  10; (*max length of a tag in characters*)
        msgs_MSG_MAX     = 255; (*max length of a message*)
        msgs_VARIANT_MAX =   8; (*max no of tags for a single message*)

(* ---------------------------- msgs_init ----------------------------------
 * Description:   Read in the messages file, and initialise msg system
 * 
 * Parameters:    void
 * Returns:       void.
 * Other Info:    the messages file is a resource of your application and
 *                should be named "messages".  Each line of this file is a
 *                message with the following format:
 *                      <tags><colon><message text><newline>
 *                where <tags> is a series of alphanumeric identifiers for
 *                the message, separated by '/' characters. These are
 *                used to search for the message, when using msgs_lookup().
 *)
procedure msgs_init; extern;


(* ---------------------------- msgs_lookup --------------------------------
 * Description:   Find the text message associated with a given tag.
 *
 * Parameters:    char * tag_and_default -- the tag of the message, and
 *                                          an optional default message (to
 *                                          be used if tagged message not
 *                                          found).
 * Returns:       pointer to the message text (if all is well)
 * Other Info:    If the caller just supplies a tag, he will receive a 
 *                pointer to its associated message (if found). A default
 *                message can be given after the tag (separated by a colon)
 *                Typical use would be:
 *                      werr(1, msgs_lookup("error1"))
 *                or    werr(1, msgs_lookup("error1:Not enough memory").
 *
 *)
function msgs_lookup(tag_and_default : string) : string; extern;

(* ---------------------------- msgs_readfile ------------------------------
 * Description:   Read in the messages file, and initialise msg system
 * 
 * Parameters:    char *name -- the name of the messages file to be read.
 * Returns:       void.
 * Other Info:    the messages file is a resource of your application and
 *                should normally be named "Messages".  For non-standard
 *                applications this call has been provided to enable
 *                the messages file to be read from elsewhere.  Each line
 *                of this file is a message with the following format:
 *                      <tag><colon><message text><newline>
 *                The tag is an alphanumeric identifier for the message, 
 *                which will be used to search for the message, when using
 *                msgs_lookup().
 *
 *)
procedure msgs_readfile(name : string); extern;

#endif

(* end msgs.h *)
