source: git/src/message.h @ f96897b

faster-cavernlogwalls-datawalls-data-hanging-as-warning
Last change on this file since f96897b was 7dbc68f, checked in by Olly Betts <olly@…>, 4 weeks ago

Revert "Merge osdepend.c and .h into filename.c and .h"

This change breaks the win32 build. Not seeing why currently but
it was just a code cleanup so revert for now.

This reverts commit ed04c55304f1fd95c126daf9612665b517eab4e7.

  • Property mode set to 100644
File size: 3.3 KB
Line 
1/* message.h
2 * Function prototypes for message.c
3 * Copyright (C) 1998-2024 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#ifndef MESSAGE_H /* only include once */
21#define MESSAGE_H
22
23#ifdef __cplusplus
24extern "C" {
25#endif
26
27#include <stdarg.h>
28
29#include "osdepend.h"
30#include "osalloc.h"
31#include "filename.h"
32
33#define STDERR stdout
34
35#define CHARSET_BAD        -1
36#define CHARSET_USASCII     0
37#define CHARSET_ISO_8859_1  1
38#define CHARSET_DOSCP850    2
39#define CHARSET_UTF8        4
40#define CHARSET_WINCP1252   5
41#define CHARSET_ISO_8859_15 6
42#define CHARSET_ISO_8859_2  8
43#define CHARSET_WINCP1250   9
44
45extern int msg_warnings; /* keep track of how many warnings we've given */
46extern int msg_errors;   /* and how many (non-fatal) errors */
47
48/* The language code - e.g. "en_GB" */
49extern const char *msg_lang;
50/* If the language code has a country specific qualification, then this will
51 * be just the language code.  Otherwise it's NULL.  e.g. "en" */
52extern const char *msg_lang2;
53
54void msg_init(char *const *argv);
55
56const char *msg_cfgpth(void);
57const char *msg_exepth(void);
58const char *msg_appname(void);
59
60/* Return the message string corresponding to number en */
61const char *msg(int en);
62
63/* These need to fit within DIAG_SEVERITY_MASK defined in datain.h. */
64#define DIAG_INFO       0x00
65#define DIAG_WARN       0x01
66#define DIAG_ERR        0x02
67#define DIAG_FATAL      0x03
68
69void v_report(int severity, const char *fnm, int line, int col, int en, va_list ap);
70
71void diag(int severity, int en, ...);
72
73#define information(...) diag(DIAG_INFO, __VA_ARGS__)
74#define warning(...) diag(DIAG_WARN, __VA_ARGS__)
75#define error(...) diag(DIAG_ERR, __VA_ARGS__)
76#define fatalerror(...) diag(DIAG_FATAL, __VA_ARGS__)
77
78void diag_in_file(int severity, const char *fnm, int line, int en, ...);
79
80#define information_in_file(...) diag_in_file(DIAG_INFO, __VA_ARGS__)
81#define warning_in_file(...) diag_in_file(DIAG_WARN, __VA_ARGS__)
82#define error_in_file(...) diag_in_file(DIAG_ERR, __VA_ARGS__)
83#define fatalerror_in_file(...) diag_in_file(DIAG_FATAL, __VA_ARGS__)
84
85int select_charset(int charset_code);
86
87#ifdef __cplusplus
88}
89#endif
90
91/* Define MSG_SETUP_PROJ_SEARCH_PATH before including this header to enable the
92 * hooks to setup proj's search path to be relative to the executable if this
93 * is a relocatable install.
94 */
95#ifdef MSG_SETUP_PROJ_SEARCH_PATH
96/* We only need this on these platforms. */
97# if OS_WIN32
98#  include <proj.h>
99#  define msg_init(ARGV) do {\
100        (msg_init)(ARGV); \
101        const char* msg_init_proj_path = use_path(msg_cfgpth(), "proj");\
102        proj_context_set_search_paths(PJ_DEFAULT_CTX, 1, &msg_init_proj_path);\
103    } while (0)
104# endif
105#endif
106
107#endif /* MESSAGE_H */
Note: See TracBrowser for help on using the repository browser.