annotate lib/unicodeio.h @ 17605:23cb5b2fd95b

relocatable-perl: like relocatable-script, but for Perl scripts * build-aux/relocatable.pl.in: Add. * doc/relocatable-maint.texi: Add documentation. * modules/relocatable-perl: Add.
author Reuben Thomas <rrt@sc3d.org>
date Thu, 09 Jan 2014 22:31:42 +0000
parents 344018b6e5d7
children ab58d4870664
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3727
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
1 /* Unicode character output to streams with locale dependent encoding.
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
2
17587
344018b6e5d7 maint: update copyright
Eric Blake <eblake@redhat.com>
parents: 17249
diff changeset
3 Copyright (C) 2000-2003, 2005, 2008-2014 Free Software Foundation, Inc.
3727
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
4
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 6266
diff changeset
5 This program is free software: you can redistribute it and/or modify
4435
d4efdb886b2a Switch from LGPL to GPL.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4401
diff changeset
6 it under the terms of the GNU General Public License as published by
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 6266
diff changeset
7 the Free Software Foundation; either version 3 of the License, or
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 6266
diff changeset
8 (at your option) any later version.
3727
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
9
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
10 This program is distributed in the hope that it will be useful,
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
4435
d4efdb886b2a Switch from LGPL to GPL.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4401
diff changeset
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
d4efdb886b2a Switch from LGPL to GPL.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4401
diff changeset
13 GNU General Public License for more details.
3727
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
14
9309
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 6266
diff changeset
15 You should have received a copy of the GNU General Public License
bbbbbf4cd1c5 Change copyright notice from GPLv2+ to GPLv3+.
Bruno Haible <bruno@clisp.org>
parents: 6266
diff changeset
16 along with this program. If not, see <http://www.gnu.org/licenses/>. */
3727
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
17
2306
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
18 #ifndef UNICODEIO_H
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
19 # define UNICODEIO_H
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
20
4101
cf248975b9d3 Make getline.h and unicodeio.h self-contained.
Bruno Haible <bruno@clisp.org>
parents: 3727
diff changeset
21 # include <stddef.h>
2306
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
22 # include <stdio.h>
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
23
6266
197ea7971323 Add back unicode_to_mb declaration that was lost on the way from GNU tar to
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
24 /* Converts the Unicode character CODE to its multibyte representation
197ea7971323 Add back unicode_to_mb declaration that was lost on the way from GNU tar to
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
25 in the current locale and calls the SUCCESS callback on the resulting
197ea7971323 Add back unicode_to_mb declaration that was lost on the way from GNU tar to
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
26 byte sequence. If an error occurs, invokes the FAILURE callback instead,
197ea7971323 Add back unicode_to_mb declaration that was lost on the way from GNU tar to
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
27 passing it CODE and an English error string.
197ea7971323 Add back unicode_to_mb declaration that was lost on the way from GNU tar to
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
28 Returns whatever the callback returned.
197ea7971323 Add back unicode_to_mb declaration that was lost on the way from GNU tar to
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
29 Assumes that the locale doesn't change between two calls. */
197ea7971323 Add back unicode_to_mb declaration that was lost on the way from GNU tar to
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
30 extern long unicode_to_mb (unsigned int code,
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10799
diff changeset
31 long (*success) (const char *buf, size_t buflen,
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10799
diff changeset
32 void *callback_arg),
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10799
diff changeset
33 long (*failure) (unsigned int code, const char *msg,
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10799
diff changeset
34 void *callback_arg),
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10799
diff changeset
35 void *callback_arg);
6266
197ea7971323 Add back unicode_to_mb declaration that was lost on the way from GNU tar to
Bruno Haible <bruno@clisp.org>
parents: 5848
diff changeset
36
3727
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
37 /* Outputs the Unicode character CODE to the output stream STREAM.
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
38 Upon failure, exit if exit_on_error is true, otherwise output a fallback
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
39 notation. */
4401
493e0f7fc4f7 Assume ANSI C.
Bruno Haible <bruno@clisp.org>
parents: 4101
diff changeset
40 extern void print_unicode_char (FILE *stream, unsigned int code,
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10799
diff changeset
41 int exit_on_error);
3727
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
42
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
43 /* Simple success callback that outputs the converted string.
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
44 The STREAM is passed as callback_arg. */
4401
493e0f7fc4f7 Assume ANSI C.
Bruno Haible <bruno@clisp.org>
parents: 4101
diff changeset
45 extern long fwrite_success_callback (const char *buf, size_t buflen,
12421
e8d2c6fc33ad Use spaces for indentation, not tabs.
Bruno Haible <bruno@clisp.org>
parents: 10799
diff changeset
46 void *callback_arg);
2306
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
47
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
48 #endif