• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Error handling during reading and writing of PO files.
2    Copyright (C) 2005 Free Software Foundation, Inc.
3    Written by Bruno Haible <bruno@clisp.org>, 2005.
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 3 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, see <https://www.gnu.org/licenses/>.  */
17 
18 #ifndef _PO_XERROR_H
19 #define _PO_XERROR_H
20 
21 #ifdef __cplusplus
22 extern "C" {
23 #endif
24 
25 #include <stddef.h>
26 
27 struct message_ty;
28 
29 
30 /* A higher-level error handler than the one in po-error.h.  */
31 
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 */
36 
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.  */
46 extern DLL_VARIABLE
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);
51 
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
55    MESSAGE_TEXT2.  */
56 extern DLL_VARIABLE
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);
64 
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);
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif /* _PO_XERROR_H */
83