/* 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 #include #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); }