2 * Build img for use in Survex code
3 * Copyright (C) 1997-2024 Olly Betts
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.
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.
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
22 #include "img_hosted.h"
26 // We now require C99 which standardised lround(), snprintf(), <stdint.h>.
28 #define HAVE_DECL_LROUND 1
31 # define HAVE_STDINT_H // Defined by AC_INCLUDES_DEFAULT as a side-effect.
36 static const int img_error2msg_map
[] = {
38 /* IMG_FILENOTFOUND */ /*Couldn’t open file “%s”*/24,
39 /* TRANSLATORS: %s will be replaced by the filename that we were trying
40 * to read when we ran out of memory.
42 /* IMG_OUTOFMEMORY */ /*Out of memory trying to read file “%s”*/38,
43 /* IMG_CANTOPENOUT */ /*Failed to open output file “%s”*/47,
44 /* TRANSLATORS: Perhaps the user tried to load a different type of file as
45 * a Survex .3d file, or the .3d file was corrupted. */
46 /* IMG_BADFORMAT */ /*Bad 3d image file “%s”*/106,
47 /* IMG_DIRECTORY */ /*Filename “%s” refers to directory*/44,
48 /* IMG_READERROR */ /*Error reading from file “%s”*/109,
49 /* IMG_WRITEERROR */ /*Error writing to file “%s”*/110,
50 /* IMG_TOONEW */ /*File “%s” has a newer format than this program can understand*/114
54 img_error2msg(img_errcode err
)
56 int err_int
= (int)err
;
57 if (err_int
< 0 || err_int
> IMG_TOONEW
) return 0;
58 return img_error2msg_map
[err_int
];