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 2, or (at your option) 8 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 Foundation, 17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ 18 19 #ifndef _PO_XERROR_H 20 #define _PO_XERROR_H 21 22 #ifdef __cplusplus 23 extern "C" { 24 #endif 25 26 #include <stddef.h> 27 28 struct message_ty; 29 30 31 /* A higher-level error handler than the one in po-error.h. */ 32 33 /* These values must be the same as those in gettext-po.h. */ 34 #define PO_SEVERITY_WARNING 0 /* just a warning, tell the user */ 35 #define PO_SEVERITY_ERROR 1 /* an error, the operation cannot complete */ 36 #define PO_SEVERITY_FATAL_ERROR 2 /* an error, the operation must be aborted */ 37 38 /* Signal a problem of the given severity. 39 MESSAGE and/or FILENAME + LINENO indicate where the problem occurred. 40 If FILENAME is NULL, FILENAME and LINENO and COLUMN should be ignored. 41 If LINENO is (size_t)(-1), LINENO and COLUMN should be ignored. 42 If COLUMN is (size_t)(-1), it should be ignored. 43 MESSAGE_TEXT is the problem description (if MULTILINE_P is true, 44 multiple lines of text, each terminated with a newline, otherwise 45 usually a single line). 46 Must not return if SEVERITY is PO_SEVERITY_FATAL_ERROR. */ 47 extern DLL_VARIABLE 48 void (*po_xerror) (int severity, 49 const struct message_ty *message, 50 const char *filename, size_t lineno, size_t column, 51 int multiline_p, const char *message_text); 52 53 /* Signal a problem that refers to two messages. 54 Similar to two calls to po_xerror. 55 If possible, a "..." can be appended to MESSAGE_TEXT1 and prepended to 56 MESSAGE_TEXT2. */ 57 extern DLL_VARIABLE 58 void (*po_xerror2) (int severity, 59 const struct message_ty *message1, 60 const char *filename1, size_t lineno1, size_t column1, 61 int multiline_p1, const char *message_text1, 62 const struct message_ty *message2, 63 const char *filename2, size_t lineno2, size_t column2, 64 int multiline_p2, const char *message_text2); 65 66 /* The default error handler. */ 67 extern void textmode_xerror (int severity, 68 const struct message_ty *message, 69 const char *filename, size_t lineno, size_t column, 70 int multiline_p, const char *message_text); 71 extern void textmode_xerror2 (int severity, 72 const struct message_ty *message1, 73 const char *filename1, size_t lineno1, size_t column1, 74 int multiline_p1, const char *message_text1, 75 const struct message_ty *message2, 76 const char *filename2, size_t lineno2, size_t column2, 77 int multiline_p2, const char *message_text2); 78 79 #ifdef __cplusplus 80 } 81 #endif 82 83 #endif /* _PO_XERROR_H */ 84