/* ===========================================================================
*
*                            PUBLIC DOMAIN NOTICE
*               National Center for Biotechnology Information
*
*  This software/database is a "United States Government Work" under the
*  terms of the United States Copyright Act.  It was written as part of
*  the author's official duties as a United States Government employee and
*  thus cannot be copyrighted.  This software/database is freely available
*  to the public for use. The National Library of Medicine and the U.S.
*  Government have not placed any restriction on its use or reproduction.
*
*  Although all reasonable efforts have been taken to ensure the accuracy
*  and reliability of the software and data, the NLM and the U.S.
*  Government do not and cannot warrant the performance or results that
*  may be obtained by using this software or data. The NLM and the U.S.
*  Government disclaim all warranties, express or implied, including
*  warranties of performance, merchantability or fitness for any particular
*  purpose.
*
*  Please cite the author in any work or product based on this material.
*
* ===========================================================================*/

#include <ncbi.h>
#include <dfa.h>

/*************************************************************************
 * dfa_errstr(DFA_Error)
 *
 *	Return a pointer to a short error message that describes errnum
 *************************************************************************/
char * _cdecl
dfa_errstr(errnum)
	DFA_Error	errnum;
{
	switch (errnum) {
	case dfaErrNone:
		return "no DFA error";
	case dfaErrBadPtr:
		return "null DFA pointer";
	case dfaErrIncompat:
		return "function is incompatible with the type of DFA";
	case dfaErrBadParm:
		return "bad parameter passed";
	case dfaErrMemincrTooSml:
		return "memincr is too small";
	case dfaErrNoMem:
		return "insufficient memory";
	case dfaErrPatlen:
		return "pattern has zero-length";
	case dfaErrOpstate:
		return "DFA is in wrong operational state";
	case dfaErrNonAlpha:
		return "undefined letter in pattern";
	case dfaErrNullParm:
		return "required parameter is NULL";
	case dfaErrAlphaSize:
		return "size of alphabet is greater than available precision";
	case dfaErrFileIO:
		return "file I/O error";
	case dfaErrNotFound:
		return "pattern not found";
	case dfaErrReport:
		return "report() returned non-zero value";
	case dfaErrUnknown:
		return "non-specific DFA error";
	default:
		if (errnum >= dfaErrMax || errnum < dfaErrNone)
			return "DFA error appears invalid (no description available)";
		return "DFA error description is missing";
	}
	/*NOTREACHED*/
}
