annotate lib/unicodeio.h @ 9258:bee5960c276a

Rename search_.h to search.in.h.
author Bruno Haible <bruno@clisp.org>
date Tue, 02 Oct 2007 00:24:48 +0200
parents 197ea7971323
children bbbbbf4cd1c5
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
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
3 Copyright (C) 2000-2003, 2005 Free Software Foundation, Inc.
3727
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
4
4435
d4efdb886b2a Switch from LGPL to GPL.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4401
diff changeset
5 This program is free software; you can redistribute it and/or modify
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
d4efdb886b2a Switch from LGPL to GPL.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4401
diff changeset
7 the Free Software Foundation; either version 2, or (at your option)
3727
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
8 any later version.
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
4435
d4efdb886b2a Switch from LGPL to GPL.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4401
diff changeset
15 You should have received a copy of the GNU General Public License along
d4efdb886b2a Switch from LGPL to GPL.
Paul Eggert <eggert@cs.ucla.edu>
parents: 4401
diff changeset
16 with this program; if not, write to the Free Software Foundation,
5848
a48fb0e98c8c *** empty log message ***
Paul Eggert <eggert@cs.ucla.edu>
parents: 4435
diff changeset
17 Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */
3727
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
18
2306
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
19 #ifndef UNICODEIO_H
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
20 # define UNICODEIO_H
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
21
4101
cf248975b9d3 Make getline.h and unicodeio.h self-contained.
Bruno Haible <bruno@clisp.org>
parents: 3727
diff changeset
22 # include <stddef.h>
2306
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
23 # include <stdio.h>
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
24
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
25 /* 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
26 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
27 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
28 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
29 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
30 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
31 extern long unicode_to_mb (unsigned int code,
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
32 long (*success) (const char *buf, size_t buflen,
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
33 void *callback_arg),
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
34 long (*failure) (unsigned int code, const char *msg,
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
35 void *callback_arg),
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 void *callback_arg);
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
37
3727
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
38 /* 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
39 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
40 notation. */
4401
493e0f7fc4f7 Assume ANSI C.
Bruno Haible <bruno@clisp.org>
parents: 4101
diff changeset
41 extern void print_unicode_char (FILE *stream, unsigned int code,
493e0f7fc4f7 Assume ANSI C.
Bruno Haible <bruno@clisp.org>
parents: 4101
diff changeset
42 int exit_on_error);
3727
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
43
f80e972daf0f 2002-02-02 Paul Eggert <eggert@twinsun.com>
Jim Meyering <jim@meyering.net>
parents: 2336
diff changeset
44 /* 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
45 The STREAM is passed as callback_arg. */
4401
493e0f7fc4f7 Assume ANSI C.
Bruno Haible <bruno@clisp.org>
parents: 4101
diff changeset
46 extern long fwrite_success_callback (const char *buf, size_t buflen,
493e0f7fc4f7 Assume ANSI C.
Bruno Haible <bruno@clisp.org>
parents: 4101
diff changeset
47 void *callback_arg);
2306
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
48
8818a3f18fb7 New file from Bruno.
Jim Meyering <jim@meyering.net>
parents:
diff changeset
49 #endif