4
0

unicodeio.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. /* Unicode character output to streams with locale dependent encoding.
  2. Copyright (C) 2000, 2001 Free Software Foundation, Inc.
  3. This program is free software; you can redistribute it and/or modify
  4. it under the terms of the GNU General Public License as published by
  5. the Free Software Foundation; either version 2, or (at your option)
  6. any later version.
  7. This program is distributed in the hope that it will be useful,
  8. but WITHOUT ANY WARRANTY; without even the implied warranty of
  9. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  10. GNU General Public License for more details.
  11. You should have received a copy of the GNU General Public License
  12. along with this program; if not, write to the Free Software Foundation,
  13. Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
  14. #ifndef UNICODEIO_H
  15. # define UNICODEIO_H
  16. # include <stdio.h>
  17. # ifndef PARAMS
  18. # if defined PROTOTYPES || (defined __STDC__ && __STDC__)
  19. # define PARAMS(Args) Args
  20. # else
  21. # define PARAMS(Args) ()
  22. # endif
  23. # endif
  24. /* Converts the Unicode character CODE to its multibyte representation
  25. in the current locale and calls the CALLBACK on the resulting byte
  26. sequence. If an error occurs, invokes ERROR_CALLBACK instead,
  27. passing it CODE with errno set appropriately. Returns whatever the
  28. callback returns. */
  29. extern int unicode_to_mb
  30. PARAMS ((unsigned int code,
  31. int (*callback) PARAMS ((const char *buf, size_t buflen,
  32. void *callback_arg)),
  33. int (*error_callback) PARAMS ((unsigned int code,
  34. void * callback_arg)),
  35. void *callback_arg));
  36. /* Success callback that outputs the conversion of the character. */
  37. extern int print_unicode_success PARAMS((const char *buf, size_t buflen,
  38. void *callback_arg));
  39. /* Failure callback that outputs an ASCII representation. */
  40. extern int print_unicode_failure PARAMS((unsigned int code,
  41. void *callback_arg));
  42. /* Outputs the Unicode character CODE to the output stream STREAM.
  43. Returns -1 (setting errno) if unsuccessful. */
  44. extern int print_unicode_char PARAMS((FILE *stream, unsigned int code));
  45. #endif