source: git/src/message.h @ c8fcf66

RELEASE/1.2debug-cidebug-ci-sanitisersstereowalls-data
Last change on this file since c8fcf66 was c8fcf66, checked in by Olly Betts <olly@…>, 9 years ago

src/avenprcore.cc,src/message.c,src/message.h: msg() has returned a
persistent copy of the message for decades, so the code's bound to
rely on that in some places. And there's no real reason it
shouldn't continue to as the messages are under 20KB of UTF-8 text
for any language, so lazy loading isn't worth the complication. So
remove msgPerm() and the unused msgFree() macro, and document that
msg() returns a persistent copy.

  • Property mode set to 100644
File size: 2.3 KB
Line 
1/* message.h
2 * Function prototypes for message.c
3 * Copyright (C) 1998-2003,2005,2010,2015 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
32#define STDERR stdout
33
34#define CHARSET_BAD        -1
35#define CHARSET_USASCII     0
36#define CHARSET_ISO_8859_1  1
37#define CHARSET_DOSCP850    2
38#define CHARSET_UTF8        4
39#define CHARSET_WINCP1252   5
40#define CHARSET_ISO_8859_15 6
41#define CHARSET_ISO_8859_2  8
42#define CHARSET_WINCP1250   9
43
44extern int msg_warnings; /* keep track of how many warnings we've given */
45extern int msg_errors;   /* and how many (non-fatal) errors */
46
47/* The language code - e.g. "en_GB" */
48extern const char *msg_lang;
49/* If the language code has a country specific qualification, then this will
50 * be just the language code.  Otherwise it's NULL.  e.g. "en" */
51extern const char *msg_lang2;
52
53void msg_init(char *const *argv);
54
55const char *msg_cfgpth(void);
56const char *msg_exepth(void);
57const char *msg_appname(void);
58
59/* Return the message string corresponding to number en */
60const char *msg(int en);
61
62void v_report(int severity, const char *fnm, int line, int col, int en, va_list ap);
63
64void warning(int en, ...);
65void error(int en, ...);
66void fatalerror(int en, ...);
67
68void warning_in_file(const char *fnm, int line, int en, ...);
69void error_in_file(const char *fnm, int line, int en, ...);
70void fatalerror_in_file(const char *fnm, int line, int en, ...);
71
72int select_charset(int charset_code);
73
74#ifdef __cplusplus
75}
76#endif
77
78#endif /* MESSAGE_H */
Note: See TracBrowser for help on using the repository browser.