/*
  ArtToSpr Artworks/Draw to Sprite convertor
  Copyright (c) 1998 Tony Houghton

  This source is distributed under the GPL. Please see the file
  "COPYING" for details.
*/

/* msgtrans.h */
/* MessageTrans handling */

#ifndef __msgtrans_h
#define __msgtrans_h

#ifndef __toolbox_h
#include "toolbox.h"
#endif

#ifdef __cplusplus
extern "C" {
#endif

/* Default descriptor for Toolbox */
extern MessagesFD msgs_descriptor;

/* Looks up a token, result won't necessarily be zero-terminated,
   no parameter substitution available here
   Returns NULL if not found
*/
extern const char *msgtrans_qlookup(const MessagesFD *, const char *token);

/* Uses internal static buffer
   Zero terminated and parameters substitued
*/
extern const char *msgtrans_plookup(const MessagesFD *, const char *token,
	const char *p0, const char *p1, const char *p2, const char *p3);

#define msgtrans_lookup(fd, t) \
	msgtrans_plookup((fd), (t), NULL, NULL, NULL, NULL)

#define msgs_qlookup(t) msgtrans_qlookup(&msgs_descriptor, (t))
#define msgs_plookup(t, p0, p1, p2, p3) \
	msgtrans_plookup(&msgs_descriptor, (t), (p0), (p1), (p2), (p3))
#define msgs_lookup(t) msgtrans_lookup(&msgs_descriptor, (t))

extern _kernel_oserror *msgtrans_load(const char *filename,
	MessagesFD *descriptor, char **buffer);
extern _kernel_oserror *msgtrans_close(MessagesFD *descriptor);

/* Returns pointer to static error block */
extern _kernel_oserror *msgtrans_error(MessagesFD *descriptor,
	const char *token);
#define msgs_error(t) msgtrans_error(&msgs_descriptor, (t))
/* Out of memory message */
#define msgs_nomem() msgtrans_error(0, "NoStore")

#ifdef __cplusplus
}
#endif

#endif
