1
1
/* Public API for GNU gettext PO files - contained in libgettextpo.
2
Copyright (C) 2003-2007 Free Software Foundation, Inc.
2
Copyright (C) 2003-2008, 2010 Free Software Foundation, Inc.
3
3
Written by Bruno Haible <bruno@clisp.org>, 2003.
5
5
This program is free software: you can redistribute it and/or modify
28
28
/* =========================== Meta Information ============================ */
30
30
/* Version number: (major<<16) + (minor<<8) + subminor */
31
#define LIBGETTEXTPO_VERSION 0x001100
31
#define LIBGETTEXTPO_VERSION 0x001201
32
32
extern int libgettextpo_version;
34
34
/* ================================= Types ================================= */
54
54
Must increment the error_message_count variable declared in error.h.
55
55
Must not return if STATUS is nonzero. */
56
56
void (*error) (int status, int errnum,
57
const char *format, ...)
57
const char *format, ...)
58
58
#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__
59
59
__attribute__ ((__format__ (__printf__, 3, 4)))
66
66
Must increment the error_message_count variable declared in error.h.
67
67
Must not return if STATUS is nonzero. */
68
68
void (*error_at_line) (int status, int errnum,
69
const char *filename, unsigned int lineno,
70
const char *format, ...)
69
const char *filename, unsigned int lineno,
70
const char *format, ...)
71
71
#if ((__GNUC__ == 3 && __GNUC_MINOR__ >= 1) || __GNUC__ > 3) && !__STRICT_ANSI__
72
72
__attribute__ ((__format__ (__printf__, 5, 6)))
86
86
typedef const struct po_error_handler *po_error_handler_t;
88
88
/* A po_xerror_handler handles warnings, error and fatal error situations. */
89
#define PO_SEVERITY_WARNING 0 /* just a warning, tell the user */
90
#define PO_SEVERITY_ERROR 1 /* an error, the operation cannot complete */
91
#define PO_SEVERITY_FATAL_ERROR 2 /* an error, the operation must be aborted */
89
#define PO_SEVERITY_WARNING 0 /* just a warning, tell the user */
90
#define PO_SEVERITY_ERROR 1 /* an error, the operation cannot complete */
91
#define PO_SEVERITY_FATAL_ERROR 2 /* an error, the operation must be aborted */
92
92
struct po_xerror_handler
94
94
/* Signal a problem of the given severity.
101
101
usually a single line).
102
102
Must not return if SEVERITY is PO_SEVERITY_FATAL_ERROR. */
103
103
void (*xerror) (int severity,
104
po_message_t message,
105
const char *filename, size_t lineno, size_t column,
106
int multiline_p, const char *message_text);
104
po_message_t message,
105
const char *filename, size_t lineno, size_t column,
106
int multiline_p, const char *message_text);
107
107
/* Signal a problem that refers to two messages.
108
108
Similar to two calls to xerror.
109
109
If possible, a "..." can be appended to MESSAGE_TEXT1 and prepended to
110
110
MESSAGE_TEXT2. */
111
111
void (*xerror2) (int severity,
112
po_message_t message1,
113
const char *filename1, size_t lineno1, size_t column1,
114
int multiline_p1, const char *message_text1,
115
po_message_t message2,
116
const char *filename2, size_t lineno2, size_t column2,
117
int multiline_p2, const char *message_text2);
112
po_message_t message1,
113
const char *filename1, size_t lineno1, size_t column1,
114
int multiline_p1, const char *message_text1,
115
po_message_t message2,
116
const char *filename2, size_t lineno2, size_t column2,
117
int multiline_p2, const char *message_text2);
119
119
typedef const struct po_xerror_handler *po_xerror_handler_t;
134
134
Return its contents. Upon failure, return NULL and set errno. */
135
135
#define po_file_read po_file_read_v3
136
136
extern po_file_t po_file_read (const char *filename,
137
po_xerror_handler_t handler);
137
po_xerror_handler_t handler);
139
139
/* Write an in-memory PO file to a file.
140
140
Upon failure, return NULL and set errno. */
141
141
#define po_file_write po_file_write_v2
142
142
extern po_file_t po_file_write (po_file_t file, const char *filename,
143
po_xerror_handler_t handler);
143
po_xerror_handler_t handler);
145
145
/* Free a PO file from memory. */
146
146
extern void po_file_free (po_file_t file);
301
301
/* Change the format string mark for a given type of a message. */
302
302
extern void po_message_set_format (po_message_t message, const char *format_type, /*bool*/int value);
304
/* If a numeric range of a message is set, return true and store the minimum
305
and maximum value in *MINP and *MAXP. */
306
extern int po_message_is_range (po_message_t message, int *minp, int *maxp);
308
/* Change the numeric range of a message. MIN and MAX must be non-negative,
309
with MIN < MAX. Use MIN = MAX = -1 to remove the numeric range of a
311
extern void po_message_set_range (po_message_t message, int min, int max);
305
314
/* =========================== po_filepos_t API ============================ */