| 1 | /* $Id: kErrName.c 3579 2007-09-02 21:40:41Z bird $ */
|
|---|
| 2 | /** @file
|
|---|
| 3 | * kErr - Status Code API, kErrName.
|
|---|
| 4 | */
|
|---|
| 5 |
|
|---|
| 6 | /*
|
|---|
| 7 | * Copyright (c) 2006-2007 knut st. osmundsen <bird-src-spam@anduin.net>
|
|---|
| 8 | *
|
|---|
| 9 | * This file is part of kStuff.
|
|---|
| 10 | *
|
|---|
| 11 | * kStuff is free software; you can redistribute it and/or
|
|---|
| 12 | * modify it under the terms of the GNU Lesser General Public
|
|---|
| 13 | * License as published by the Free Software Foundation; either
|
|---|
| 14 | * version 2.1 of the License, or (at your option) any later version.
|
|---|
| 15 | *
|
|---|
| 16 | * kStuff is distributed in the hope that it will be useful,
|
|---|
| 17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|---|
| 19 | * Lesser General Public License for more details.
|
|---|
| 20 | *
|
|---|
| 21 | * You should have received a copy of the GNU Lesser General Public
|
|---|
| 22 | * License along with kStuff; if not, write to the Free Software
|
|---|
| 23 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
|---|
| 24 | *
|
|---|
| 25 | */
|
|---|
| 26 |
|
|---|
| 27 | /*******************************************************************************
|
|---|
| 28 | * Header Files *
|
|---|
| 29 | *******************************************************************************/
|
|---|
| 30 | #include <k/kErr.h>
|
|---|
| 31 | #include <k/kErrors.h>
|
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 | /**
|
|---|
| 35 | * Translate the error code into a string containing
|
|---|
| 36 | * the error constant.
|
|---|
| 37 | *
|
|---|
| 38 | * @returns Read only string with the constant name.
|
|---|
| 39 | * @param rc The kErrors status code.
|
|---|
| 40 | */
|
|---|
| 41 | KERR_DECL(const char *) kErrName(int rc)
|
|---|
| 42 | {
|
|---|
| 43 | switch (rc)
|
|---|
| 44 | {
|
|---|
| 45 | case 0: return "SUCCESS";
|
|---|
| 46 | #define ERR_CONST(c) case c: return #c;
|
|---|
| 47 | #include "kErrNameConsts.h"
|
|---|
| 48 | #undef ERR_CONST
|
|---|
| 49 | default:
|
|---|
| 50 | return "KERR_UNKNOWN_ERROR";
|
|---|
| 51 | }
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|