/*
 * msgs.h
 *
 * [Generated from msgs, 25 September 1996]
 */

#if !defined(__CC_NORCROFT) || !defined(__arm)
  #error You must use the Norcroft ARM Compiler for Sapphire programs
#endif

#pragma include_only_once
#pragma force_top_level

#ifndef __msgs_h
#define __msgs_h

#ifndef __sapphire_h
  #include "sapphire.h"
#endif

/*----- Overview ----------------------------------------------------------*
 *
 * Functions provided:
 *
 *  msgs_load
 *  msgs_build
 *  msgs_error
 *  msgs_lookup
 *  msgs_init
 */

/* --- msgs_load --- *
 *
 * On entry:	R0 == pointer to filename
 *
 * On exit:	May return an error
 *
 * Use:		Reads in the given messages file.
 */

extern routine msgs_load;

/* --- msgs_build --- *
 *
 * On entry:	R0 == pointer to a message string
 *		R1 == pointer to output buffer
 *
 * On exit:	R0 == pointer to buffer (R1 on entry)
 *		R1 == pointer to terminating null
 *
 * Use:		Builds a message string, by substituting message references
 *		by their values.  Each reference of the form `$tag' (or
 *		optionally `$(tag)', to avoid having to have a trailing)
 *		space is replaced by the actual message.  A literal `$' sign
 *		may be represented as `$$'.
 */

extern routine msgs_build;

/* --- msgs_error --- *
 *
 * On entry:	R0 == pointer to an error skeleton string:
 *		        R0+0 == error number
 *		        R0+4 == message tag-and-default (null-terminated)
 *		R2-R11 == filler strings (not message tags)
 *
 * On exit:	R0 == pointer to translated error message (in error buffer)
 *		R1 == pointer to null terminator of message
 *
 * Use:		Performs string sustitution on an error message (as done by
 *		str_subst), but translating the error string.
 */

extern routine msgs_error;

/* --- msgs_lookup --- *
 *
 * On entry:	R0 == message tag (and default message)
 *
 * On exit:	R0 == pointer to located message
 *
 * Use:		Returns the real message from its tag. If the tag does not
 *		exist, then the default message is used. If that is not
 *		supplied, then the tag name itself is returned (ie. R0
 *		is preserved).
 */

extern routine msgs_lookup;

/* --- msgs_init --- *
 *
 * On entry:	--
 *
 * On exit:	--
 *
 * Use:		Initialises the message system.
 */

extern routine msgs_init;

/*----- That's all, folks -------------------------------------------------*/

#endif
