1 /* Error handling during reading and writing of PO files.
2 Copyright (C) 2005, 2015 Free Software Foundation, Inc.
3 Written by Bruno Haible <bruno@clisp.org>, 2005.
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 3 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, see <http://www.gnu.org/licenses/>. */
30 /* A higher-level error handler than the one in po-error.h. */
32 /* These values must be the same as those in gettext-po.h. */
33 #define PO_SEVERITY_WARNING 0 /* just a warning, tell the user */
34 #define PO_SEVERITY_ERROR 1 /* an error, the operation cannot complete */
35 #define PO_SEVERITY_FATAL_ERROR 2 /* an error, the operation must be aborted */
37 /* Signal a problem of the given severity.
38 MESSAGE and/or FILENAME + LINENO indicate where the problem occurred.
39 If FILENAME is NULL, FILENAME and LINENO and COLUMN should be ignored.
40 If LINENO is (size_t)(-1), LINENO and COLUMN should be ignored.
41 If COLUMN is (size_t)(-1), it should be ignored.
42 MESSAGE_TEXT is the problem description (if MULTILINE_P is true,
43 multiple lines of text, each terminated with a newline, otherwise
44 usually a single line).
45 Must not return if SEVERITY is PO_SEVERITY_FATAL_ERROR. */
47 void (*po_xerror) (int severity,
48 const struct message_ty *message,
49 const char *filename, size_t lineno, size_t column,
50 int multiline_p, const char *message_text);
52 /* Signal a problem that refers to two messages.
53 Similar to two calls to po_xerror.
54 If possible, a "..." can be appended to MESSAGE_TEXT1 and prepended to
57 void (*po_xerror2) (int severity,
58 const struct message_ty *message1,
59 const char *filename1, size_t lineno1, size_t column1,
60 int multiline_p1, const char *message_text1,
61 const struct message_ty *message2,
62 const char *filename2, size_t lineno2, size_t column2,
63 int multiline_p2, const char *message_text2);
65 /* The default error handler. */
66 extern void textmode_xerror (int severity,
67 const struct message_ty *message,
68 const char *filename, size_t lineno, size_t column,
69 int multiline_p, const char *message_text);
70 extern void textmode_xerror2 (int severity,
71 const struct message_ty *message1,
72 const char *filename1, size_t lineno1, size_t column1,
73 int multiline_p1, const char *message_text1,
74 const struct message_ty *message2,
75 const char *filename2, size_t lineno2, size_t column2,
76 int multiline_p2, const char *message_text2);
82 #endif /* _PO_XERROR_H */