1 | /* img_hosted.c |
---|
2 | * Build img for use in Survex code |
---|
3 | * Copyright (C) 1997,1999,2000,2001,2011,2013,2014,2015,2016 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 file “%s”*/24, |
---|
31 | /* TRANSLATORS: %s will be replaced by the filename that we were trying |
---|
32 | * to read when we ran out of memory. |
---|
33 | */ |
---|
34 | /* IMG_OUTOFMEMORY */ /*Out of memory trying to read file “%s”*/38, |
---|
35 | /* IMG_CANTOPENOUT */ /*Failed to open output file “%s”*/47, |
---|
36 | /* TRANSLATORS: Perhaps the user tried to load a different type of file as |
---|
37 | * a Survex .3d file, or the .3d file was corrupted. */ |
---|
38 | /* IMG_BADFORMAT */ /*Bad 3d image file “%s”*/106, |
---|
39 | /* IMG_DIRECTORY */ /*Filename “%s” refers to directory*/44, |
---|
40 | /* IMG_READERROR */ /*Error reading from file “%s”*/109, |
---|
41 | /* IMG_WRITEERROR */ /*Error writing to file “%s”*/110, |
---|
42 | /* IMG_TOONEW */ /*File “%s” has a newer format than this program can understand*/114 |
---|
43 | }; |
---|
44 | |
---|
45 | int |
---|
46 | img_error2msg(img_errcode err) |
---|
47 | { |
---|
48 | int err_int = (int)err; |
---|
49 | if (err_int < 0 || err_int > IMG_TOONEW) return 0; |
---|
50 | return img_error2msg_map[err_int]; |
---|
51 | } |
---|