home *** CD-ROM | disk | FTP | other *** search
/ RISC DISC 1 / RISC_DISC_1.iso / pd_share / code / pascal / !Pascal / h / msgs < prev    next >
Encoding:
Text File  |  1992-02-09  |  2.9 KB  |  70 lines

  1. (*
  2.  * Title:    msgs.h
  3.  * Purpose:  provide support for messages resource file
  4.  *           (Use this to make your applications "internationalisable!")
  5.  *
  6.  *)
  7.  
  8. #ifndef __msgs_h
  9. #define __msgs_h
  10.  
  11. const   msgs_TAG_MAX     =  10; (*max length of a tag in characters*)
  12.         msgs_MSG_MAX     = 255; (*max length of a message*)
  13.         msgs_VARIANT_MAX =   8; (*max no of tags for a single message*)
  14.  
  15. (* ---------------------------- msgs_init ----------------------------------
  16.  * Description:   Read in the messages file, and initialise msg system
  17.  * 
  18.  * Parameters:    void
  19.  * Returns:       void.
  20.  * Other Info:    the messages file is a resource of your application and
  21.  *                should be named "messages".  Each line of this file is a
  22.  *                message with the following format:
  23.  *                      <tags><colon><message text><newline>
  24.  *                where <tags> is a series of alphanumeric identifiers for
  25.  *                the message, separated by '/' characters. These are
  26.  *                used to search for the message, when using msgs_lookup().
  27.  *)
  28. procedure msgs_init; extern;
  29.  
  30.  
  31. (* ---------------------------- msgs_lookup --------------------------------
  32.  * Description:   Find the text message associated with a given tag.
  33.  *
  34.  * Parameters:    char * tag_and_default -- the tag of the message, and
  35.  *                                          an optional default message (to
  36.  *                                          be used if tagged message not
  37.  *                                          found).
  38.  * Returns:       pointer to the message text (if all is well)
  39.  * Other Info:    If the caller just supplies a tag, he will receive a 
  40.  *                pointer to its associated message (if found). A default
  41.  *                message can be given after the tag (separated by a colon)
  42.  *                Typical use would be:
  43.  *                      werr(1, msgs_lookup("error1"))
  44.  *                or    werr(1, msgs_lookup("error1:Not enough memory").
  45.  *
  46.  *)
  47. function msgs_lookup(tag_and_default : string) : string; extern;
  48.  
  49. (* ---------------------------- msgs_readfile ------------------------------
  50.  * Description:   Read in the messages file, and initialise msg system
  51.  * 
  52.  * Parameters:    char *name -- the name of the messages file to be read.
  53.  * Returns:       void.
  54.  * Other Info:    the messages file is a resource of your application and
  55.  *                should normally be named "Messages".  For non-standard
  56.  *                applications this call has been provided to enable
  57.  *                the messages file to be read from elsewhere.  Each line
  58.  *                of this file is a message with the following format:
  59.  *                      <tag><colon><message text><newline>
  60.  *                The tag is an alphanumeric identifier for the message, 
  61.  *                which will be used to search for the message, when using
  62.  *                msgs_lookup().
  63.  *
  64.  *)
  65. procedure msgs_readfile(name : string); extern;
  66.  
  67. #endif
  68.  
  69. (* end msgs.h *)
  70.