fribidi-char-sets.h 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. /* FriBidi
  2. * fribidi-char-sets.h - character set conversion routines
  3. *
  4. * Authors:
  5. * Behdad Esfahbod, 2001, 2002, 2004
  6. * Dov Grobgeld, 1999, 2000
  7. *
  8. * Copyright (C) 2004 Sharif FarsiWeb, Inc
  9. * Copyright (C) 2001,2002 Behdad Esfahbod
  10. * Copyright (C) 1999,2000 Dov Grobgeld
  11. *
  12. * This library is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU Lesser General Public
  14. * License as published by the Free Software Foundation; either
  15. * version 2.1 of the License, or (at your option) any later version.
  16. *
  17. * This library is distributed in the hope that it will be useful,
  18. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  19. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  20. * Lesser General Public License for more details.
  21. *
  22. * You should have received a copy of the GNU Lesser General Public License
  23. * along with this library, in a file named COPYING; if not, write to the
  24. * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
  25. * Boston, MA 02110-1301, USA
  26. *
  27. * For licensing issues, contact <fribidi.license@gmail.com>.
  28. */
  29. #ifndef _FRIBIDI_CHAR_SETS_H
  30. #define _FRIBIDI_CHAR_SETS_H
  31. #include "fribidi-common.h"
  32. #include "fribidi-types.h"
  33. #include "fribidi-begindecls.h"
  34. typedef enum
  35. {
  36. _FRIBIDI_CHAR_SET_NOT_FOUND,
  37. # define _FRIBIDI_ADD_CHAR_SET(CHAR_SET, char_set) FRIBIDI_CHAR_SET_##CHAR_SET,
  38. # include "fribidi-char-sets-list.h"
  39. # undef _FRIBIDI_ADD_CHAR_SET
  40. _FRIBIDI_CHAR_SETS_NUM_PLUS_ONE
  41. }
  42. FriBidiCharSet;
  43. #define FRIBIDI_CHAR_SET_NOT_FOUND _FRIBIDI_CHAR_SET_NOT_FOUND
  44. #define FRIBIDI_CHAR_SETS_NUM (_FRIBIDI_CHAR_SETS_NUM_PLUS_ONE - 1)
  45. /* fribidi_charset_to_unicode - convert string to Unicode
  46. *
  47. * This function converts an string from a character set, to a Unicode string.
  48. *
  49. * Returns: The length of the new string.
  50. */
  51. FRIBIDI_ENTRY FriBidiStrIndex fribidi_charset_to_unicode (
  52. FriBidiCharSet char_set, /* character set to convert from */
  53. const char *s, /* input string encoded in char_set */
  54. FriBidiStrIndex len, /* input string length */
  55. FriBidiChar *us /* output Unicode string */
  56. );
  57. /* fribidi_unicode_to_charset - convert string from Unicode
  58. *
  59. * This function converts a Unicode string to an string in another character
  60. * set. It also null-terminates the output string.
  61. *
  62. * Returns: The length of the new string.
  63. */
  64. FRIBIDI_ENTRY FriBidiStrIndex fribidi_unicode_to_charset (
  65. FriBidiCharSet char_set, /* character set to convert to */
  66. const FriBidiChar *us, /* input Unicode string */
  67. FriBidiStrIndex len, /* input string length */
  68. char *s /* output string encoded in char_set */
  69. );
  70. /* fribidi_parse_charset - parse character set name
  71. *
  72. * Returns: The character set named s, or FRIBIDI_CHAR_SET_NOT_FOUND if the
  73. * character set is not available.
  74. */
  75. FRIBIDI_ENTRY FriBidiCharSet fribidi_parse_charset (
  76. const char *s /* input name of the character set */
  77. );
  78. FRIBIDI_ENTRY const char *fribidi_char_set_name (
  79. FriBidiCharSet char_set
  80. );
  81. FRIBIDI_ENTRY const char *fribidi_char_set_title (
  82. FriBidiCharSet char_set
  83. );
  84. FRIBIDI_ENTRY const char *fribidi_char_set_desc (
  85. FriBidiCharSet char_set
  86. );
  87. #include "fribidi-enddecls.h"
  88. #endif /* !_FRIBIDI_CHAR_SETS_H */
  89. /* Editor directions:
  90. * vim:textwidth=78:tabstop=8:shiftwidth=2:autoindent:cindent
  91. */