[a405bc1] | 1 | /* img_hosted.c |
---|
| 2 | * Build img for use in Survex code |
---|
[736f7df] | 3 | * Copyright (C) 1997,1999,2000,2001,2011,2013,2014 Olly Betts |
---|
[a405bc1] | 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, |
---|
[98cf5b5] | 30 | /* IMG_FILENOTFOUND */ /*Couldn’t open file “%s”*/24, |
---|
[736f7df] | 31 | /* TRANSLATORS: nasty hack - this message is for the .3d img code, and all |
---|
| 32 | * errors there take a filename parameter - we don’t really want it here, |
---|
| 33 | * so lose it with "%.0s" (which should display 0 characters from the |
---|
| 34 | * filename) FIXME: sort out this */ |
---|
[a405bc1] | 35 | /* IMG_OUTOFMEMORY */ /*Out of memory %.0s*/38, |
---|
| 36 | /* IMG_DIRECTORY */ /*Filename “%s” refers to directory*/44, |
---|
| 37 | /* IMG_CANTOPENOUT */ /*Failed to open output file “%s”*/47, |
---|
[736f7df] | 38 | /* TRANSLATORS: Perhaps the user tried to load a different type of file as |
---|
| 39 | * a Survex .3d file, or the .3d file was corrupted. */ |
---|
[a405bc1] | 40 | /* IMG_BADFORMAT */ /*Bad 3d image file “%s”*/106, |
---|
| 41 | /* IMG_READERROR */ /*Error reading from file “%s”*/109, |
---|
| 42 | /* IMG_WRITEERROR */ /*Error writing to file “%s”*/110, |
---|
| 43 | /* IMG_TOONEW */ /*File “%s” has a newer format than this program can understand*/114 |
---|
| 44 | }; |
---|
| 45 | |
---|
| 46 | int |
---|
| 47 | img_error2msg(img_errcode err) |
---|
| 48 | { |
---|
| 49 | int err_int = (int)err; |
---|
| 50 | if (err_int < 0 || err_int > IMG_TOONEW) return 0; |
---|
| 51 | return img_error2msg_map[err_int]; |
---|
| 52 | } |
---|