summaryrefslogtreecommitdiffstats
path: root/gettext-tools/src/po-xerror.h
blob: 0493de9e63b0b44cd720b7477bb4cabf28271870 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* Error handling during reading and writing of PO files.
   Copyright (C) 2005, 2015 Free Software Foundation, Inc.
   Written by Bruno Haible <bruno@clisp.org>, 2005.

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

#ifndef _PO_XERROR_H
#define _PO_XERROR_H

#ifdef __cplusplus
extern "C" {
#endif 

#include <stddef.h>

struct message_ty;


/* A higher-level error handler than the one in po-error.h.  */

/* These values must be the same as those in gettext-po.h.  */
#define PO_SEVERITY_WARNING     0 /* just a warning, tell the user */
#define PO_SEVERITY_ERROR       1 /* an error, the operation cannot complete */
#define PO_SEVERITY_FATAL_ERROR 2 /* an error, the operation must be aborted */

/* Signal a problem of the given severity.
   MESSAGE and/or FILENAME + LINENO indicate where the problem occurred.
   If FILENAME is NULL, FILENAME and LINENO and COLUMN should be ignored.
   If LINENO is (size_t)(-1), LINENO and COLUMN should be ignored.
   If COLUMN is (size_t)(-1), it should be ignored.
   MESSAGE_TEXT is the problem description (if MULTILINE_P is true,
   multiple lines of text, each terminated with a newline, otherwise
   usually a single line).
   Must not return if SEVERITY is PO_SEVERITY_FATAL_ERROR.  */
extern DLL_VARIABLE
       void (*po_xerror) (int severity,
                          const struct message_ty *message,
                          const char *filename, size_t lineno, size_t column,
                          int multiline_p, const char *message_text);

/* Signal a problem that refers to two messages.
   Similar to two calls to po_xerror.
   If possible, a "..." can be appended to MESSAGE_TEXT1 and prepended to
   MESSAGE_TEXT2.  */
extern DLL_VARIABLE
       void (*po_xerror2) (int severity,
                           const struct message_ty *message1,
                           const char *filename1, size_t lineno1, size_t column1,
                           int multiline_p1, const char *message_text1,
                           const struct message_ty *message2,
                           const char *filename2, size_t lineno2, size_t column2,
                           int multiline_p2, const char *message_text2);

/* The default error handler.  */
extern void textmode_xerror (int severity,
                             const struct message_ty *message,
                             const char *filename, size_t lineno, size_t column,
                             int multiline_p, const char *message_text);
extern void textmode_xerror2 (int severity,
                              const struct message_ty *message1,
                              const char *filename1, size_t lineno1, size_t column1,
                              int multiline_p1, const char *message_text1,
                              const struct message_ty *message2,
                              const char *filename2, size_t lineno2, size_t column2,
                              int multiline_p2, const char *message_text2);

#ifdef __cplusplus
}
#endif

#endif /* _PO_XERROR_H */