[a405bc1] | 1 | /* img_hosted.c |
---|
| 2 | * Build img for use in Survex code |
---|
| 3 | * Copyright (C) 1997,1999,2000,2001,2011,2013 Olly Betts |
---|
| 4 | * |
---|
| 5 | * This program is free software; you can redistribute it and/or modify |
---|
| 6 | * it under the terms of the GNU General Public License as published by |
---|
| 7 | * the Free Software Foundation; either version 2 of the License, or |
---|
| 8 | * (at your option) any later version. |
---|
| 9 | * |
---|
| 10 | * This program is distributed in the hope that it will be useful, |
---|
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 13 | * GNU General Public License for more details. |
---|
| 14 | * |
---|
| 15 | * You should have received a copy of the GNU General Public License |
---|
| 16 | * along with this program; if not, write to the Free Software |
---|
| 17 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
---|
| 18 | */ |
---|
| 19 | |
---|
| 20 | #include <config.h> |
---|
| 21 | |
---|
| 22 | #include "img_hosted.h" |
---|
| 23 | |
---|
| 24 | #define IMG_HOSTED 1 |
---|
| 25 | |
---|
| 26 | #include "img.c" |
---|
| 27 | |
---|
| 28 | static const int img_error2msg_map[] = { |
---|
| 29 | /* IMG_NONE */ 0, |
---|
| 30 | /* IMG_FILENOTFOUND */ /*Couldn’t open data file “%s”*/24, |
---|
| 31 | /* IMG_OUTOFMEMORY */ /*Out of memory %.0s*/38, |
---|
| 32 | /* IMG_DIRECTORY */ /*Filename “%s” refers to directory*/44, |
---|
| 33 | /* IMG_CANTOPENOUT */ /*Failed to open output file “%s”*/47, |
---|
| 34 | /* IMG_BADFORMAT */ /*Bad 3d image file “%s”*/106, |
---|
| 35 | /* IMG_READERROR */ /*Error reading from file “%s”*/109, |
---|
| 36 | /* IMG_WRITEERROR */ /*Error writing to file “%s”*/110, |
---|
| 37 | /* IMG_TOONEW */ /*File “%s” has a newer format than this program can understand*/114 |
---|
| 38 | }; |
---|
| 39 | |
---|
| 40 | int |
---|
| 41 | img_error2msg(img_errcode err) |
---|
| 42 | { |
---|
| 43 | int err_int = (int)err; |
---|
| 44 | if (err_int < 0 || err_int > IMG_TOONEW) return 0; |
---|
| 45 | return img_error2msg_map[err_int]; |
---|
| 46 | } |
---|