]> Dogcows Code - chaz/tar/blob - lib/unicodeio.h
(unicode_to_mb): Return int, not void. New arg for failure callback.
[chaz/tar] / lib / unicodeio.h
1 /* Unicode character output to streams with locale dependent encoding.
2
3 Copyright (C) 2000, 2001 Free Software Foundation, Inc.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
18
19 #ifndef UNICODEIO_H
20 # define UNICODEIO_H
21
22 # include <stdio.h>
23
24 # ifndef PARAMS
25 # if defined PROTOTYPES || (defined __STDC__ && __STDC__)
26 # define PARAMS(Args) Args
27 # else
28 # define PARAMS(Args) ()
29 # endif
30 # endif
31
32 /* Converts the Unicode character CODE to its multibyte representation
33 in the current locale and calls the CALLBACK on the resulting byte
34 sequence. If an error occurs, invokes ERROR_CALLBACK instead,
35 passing it CODE with errno set appropriately. Returns whatever the
36 callback returns. */
37 extern int unicode_to_mb
38 PARAMS ((unsigned int code,
39 int (*callback) PARAMS ((const char *buf, size_t buflen,
40 void *callback_arg)),
41 int (*error_callback) PARAMS ((unsigned int code,
42 void * callback_arg)),
43 void *callback_arg));
44
45 /* Success callback that outputs the conversion of the character. */
46 extern int print_unicode_success PARAMS((const char *buf, size_t buflen,
47 void *callback_arg));
48
49 /* Failure callback that outputs an ASCII representation. */
50 extern int print_unicode_failure PARAMS((unsigned int code,
51 void *callback_arg));
52
53 /* Outputs the Unicode character CODE to the output stream STREAM.
54 Returns -1 (setting errno) if unsuccessful. */
55 extern int print_unicode_char PARAMS((FILE *stream, unsigned int code));
56
57 #endif
This page took 0.036007 seconds and 5 git commands to generate.