xref: /netbsd-src/external/gpl2/gettext/dist/gettext-tools/src/po-error.h (revision 946379e7b37692fc43f68eb0d1c10daa0a7f3b6c)
1 /* Error handling during reading and writing of PO files.
2    Copyright (C) 2004, 2006 Free Software Foundation, Inc.
3    Written by Bruno Haible <bruno@clisp.org>, 2004.
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_ERROR_H
20 #define _PO_ERROR_H
21 
22 #ifndef __attribute__
23 /* This feature is available in gcc versions 2.5 and later.  */
24 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 5) || __STRICT_ANSI__
25 #  define __attribute__(Spec) /* empty */
26 # endif
27 /* The __-protected variants of `format' and `printf' attributes
28    are accepted by gcc versions 2.6.4 (effectively 2.7) and later.  */
29 # if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 7)
30 #  define __format__ format
31 #  define __printf__ printf
32 # endif
33 #endif
34 
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38 
39 
40 /* Both functions must work like the GNU error(), error_at_line() functions.
41    In particular,
42      - The functions must not return if the status code is nonzero.
43      - The functions must increment the error_message_count variable declared
44        in error.h.  */
45 
46 extern DLL_VARIABLE
47        void (*po_error) (int status, int errnum,
48 			 const char *format, ...)
49 #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3
50        __attribute__ ((__format__ (__printf__, 3, 4)))
51 #endif
52        ;
53 extern DLL_VARIABLE
54        void (*po_error_at_line) (int status, int errnum,
55 				 const char *filename, unsigned int lineno,
56 				 const char *format, ...)
57 #if (__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3
58        __attribute__ ((__format__ (__printf__, 5, 6)))
59 #endif
60        ;
61 
62 /* Both functions must work like the xerror.h multiline_warning(),
63    multiline_error() functions.  In particular,
64      - multiline_error must increment the error_message_count variable declared
65        in error.h if prefix != NULL.  */
66 
67 extern DLL_VARIABLE
68        void (*po_multiline_warning) (char *prefix, char *message);
69 extern DLL_VARIABLE
70        void (*po_multiline_error) (char *prefix, char *message);
71 
72 
73 #ifdef __cplusplus
74 }
75 #endif
76 
77 #endif /* _PO_ERROR_H */
78