Refactor handling of relocatable installs
[survex.git] / src / message.h
blob278e72bf0c5a302fc761c1ae26e61d747beaa31e
1 /* message.h
2 * Function prototypes for message.c
3 * Copyright (C) 1998-2003,2005,2010,2015,2017 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
20 #ifndef MESSAGE_H /* only include once */
21 #define MESSAGE_H
23 #ifdef __cplusplus
24 extern "C" {
25 #endif
27 #include <stdarg.h>
29 #include "osdepend.h"
30 #include "osalloc.h"
32 /* Define MSG_SETUP_PROJ_SERACH_PATH before including this header to enable the
33 * hooks to setup proj4's search path to be relative to the executable if this
34 * is a relocatable install.
36 #ifdef MSG_SETUP_PROJ_SERACH_PATH
37 /* We only support relocatable builds on these platforms. */
38 # if OS_WIN32 || OS_UNIX_MACOSX
39 # include <proj_api.h>
40 # define msg_init(ARGV) do {\
41 if (msg_init_(ARGV)) pj_set_finder(msg_proj_finder_);\
42 } while (0)
43 # endif
44 #endif
46 #ifndef msg_init
47 # define msg_init(ARGV) msg_init_(ARGV)
48 #endif
50 #define STDERR stdout
52 #define CHARSET_BAD -1
53 #define CHARSET_USASCII 0
54 #define CHARSET_ISO_8859_1 1
55 #define CHARSET_DOSCP850 2
56 #define CHARSET_UTF8 4
57 #define CHARSET_WINCP1252 5
58 #define CHARSET_ISO_8859_15 6
59 #define CHARSET_ISO_8859_2 8
60 #define CHARSET_WINCP1250 9
62 extern int msg_warnings; /* keep track of how many warnings we've given */
63 extern int msg_errors; /* and how many (non-fatal) errors */
65 /* The language code - e.g. "en_GB" */
66 extern const char *msg_lang;
67 /* If the language code has a country specific qualification, then this will
68 * be just the language code. Otherwise it's NULL. e.g. "en" */
69 extern const char *msg_lang2;
71 /* Not intended for direct use - use msg_init() instead, optionally defining
72 * MSG_SETUP_PROJ_SERACH_PATH.
74 int msg_init_(char *const *argv);
76 /* Not intended for direct use - use msg_init() instead, optionally defining
77 * MSG_SETUP_PROJ_SERACH_PATH.
79 const char * msg_proj_finder_(const char * file);
81 const char *msg_cfgpth(void);
82 const char *msg_exepth(void);
83 const char *msg_appname(void);
85 /* Return the message string corresponding to number en */
86 const char *msg(int en);
88 void v_report(int severity, const char *fnm, int line, int col, int en, va_list ap);
90 void warning(int en, ...);
91 void error(int en, ...);
92 void fatalerror(int en, ...);
94 void warning_in_file(const char *fnm, int line, int en, ...);
95 void error_in_file(const char *fnm, int line, int en, ...);
96 void fatalerror_in_file(const char *fnm, int line, int en, ...);
98 int select_charset(int charset_code);
100 #ifdef __cplusplus
102 #endif
104 #endif /* MESSAGE_H */