campo-sirio/gfm/errname.c
alex ba237a9d91 Patch level : no patch
Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Aggiunti i sorgenti per Greenleaf Math Library (gfm.dll)


git-svn-id: svn://10.65.10.50/trunk@10079 c028cbd2-c16b-5b4b-a496-9718f37d4682
2002-02-26 12:19:02 +00:00

68 lines
1.2 KiB
C
Executable File

/* char *ErrorName(dst, num);
*
* ARGUMENT
* char *pDst;
* int num;
*
* DESCRIPTION
* This function copies the string name corresponding to a given
* error number into dst. dst must be character array allocated to have
* at least 15 characters.
*
* SIDE EFFECTS
* None.
*
* RETURNS
* dst if successful, otherwise NULL.
*
* POSSIBLE ERROR CODES
*
* GM_NULLSTRING
* GM_ARGVAL
*
* AUTHOR
* Don Killen 11-Jan-1988 19:29:08
* Copyright (C) 1988-1990 Greenleaf Software Inc. All rights reserved.
*
* MODIFICATIONS
*
*
*/
#include <stdio.h>
#include <string.h>
#include "gmsystem.h"
char *ErrorName(dst, num)
char *dst;
int num;
{
static char *codes[]={ "GM_SUCCESS","GM_NULLPOINTER",
"GM_NULLSTRING","GM_INIT",
"GM_OVERFLOW","GM_UNDERFLOW",
"GM_NAN","GM_CNVRE","GM_CNVRW","GM_DIV0","GM_PWR0","GM_IMAG",
"GM_NOMEMORY","GM_INVALIDID","GM_NOTFOUND","GM_ARGVAL",
"GM_EOF",""};
int err;
_MacStart(GM_ERRNAME);
if (!dst) {
_MacErr(GM_NULLSTRING);
_MacRet(NULL);
}
if (num == GM_SUCCESS) {
strcpy(dst, "GM_SUCCESS");
_MacRet(dst);
}
err = GM_BASE - num;
if (err<0 || err>16) {
_MacErr(GM_ARGVAL);
_MacRet(NULL);
}
strcpy(dst, codes[err]);
_MacRet(dst);
}