/* iffpstrings.c
 *
 *  centralized message routine for IFFP modules
 *  If you plan to add international language support to
 *  your iffparse application, all of the iffparse module
 *  strings are here and are accessed via the SI() macro in
 *  iffp/iff.h which calls GetString() 
 *
 *  There is some #ifdef'd out code here which will be useful if you
 *  decide to localize your application when locale.library is released.
 *
 *  37.9 4/92   - fixed IFFerr() error equivalence tests and null string
 *  37.10  7/92 - fixes to localization routine
 *  39.2   9/92 - modify for new CatComp, mroe consistent string ID names
 */


#include "iffp/iff.h"
#define CATCOMP_NUMBERS
#include "messages.h"

static UBYTE NULLSTRING[] = {""};

/*
 * IFFerr
 *
 * Returns pointer to IFF Error string or NULL string (no error)
 */
UBYTE *IFFerr(LONG error)
{
	/*
	 * English error messages for possible IFFERR_#? returns from various
	 * IFF routines.  To get the index into this array, take your IFFERR
	 * code, negate it, and subtract one.
	 *  idx = -error - 1;
	 *
	 * To index localized string, then add MSG_IFFP_STDFIRST
	 */

	static UBYTE unknown[48];
	UBYTE  *s = NULLSTRING;

	if((error < 0)&&(error >= -12))
		{
		s=SI(((-error) - 1) + MSG_IFFP_STDFIRST);
		}
	else if(error == CLIENT_ERROR)
		{
		s=SI(MSG_IFFP_CLIENTERR);
		}
	else if(error == NOFILE)
		{
		s=SI(MSG_IFFP_NOFILE);
		}
	else if(error)
		{
		sprintf(unknown,SI(MSG_IFFP_UNKNOWNERR_D),error);
		s=unknown;
		}
	return(s);
}
