mltext.texi 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. @node Working with Multilingual Text
  2. @chapter Working with Multilingual Text
  3. @node Guile Character Properties, Exchanging Text With The Outside World, Multibyte String Functions, Functions for Operating on Multibyte Text
  4. @section Guile Character Properties
  5. These functions give information about the nature of a given Guile
  6. character. These are defined for any @code{scm_mb_char_t} value.
  7. @deftypefn {Libguile Function} int scm_mb_isalnum (scm_mb_char_t @var{c})
  8. Return non-zero iff @var{c} is an alphabetic or numeric character.
  9. @end deftypefn
  10. @deftypefn {Libguile Function} int scm_mb_is_alpha (scm_mb_char_t @var{c})
  11. Return non-zero iff @var{c} is an alphabetic character.
  12. @end deftypefn
  13. @deftypefn {Libguile Function} int scm_mb_iscntrl (scm_mb_char_t @var{c})
  14. Return non-zero iff @var{c} is a control character.
  15. @end deftypefn
  16. @deftypefn {Libguile Function} int scm_mb_isdigit (scm_mb_char_t @var{c})
  17. Return non-zero iff @var{c} is a digit.
  18. @end deftypefn
  19. @deftypefn {Libguile Function} int scm_mb_isgraph (scm_mb_char_t @var{c})
  20. Return non-zero iff @var{c} is a visible character.
  21. @end deftypefn
  22. @deftypefn {Libguile Function} int scm_mb_isupper (scm_mb_char_t @var{c})
  23. Return non-zero iff @var{c} is an upper-case character.
  24. @end deftypefn
  25. @deftypefn {Libguile Function} int scm_mb_islower (scm_mb_char_t @var{c})
  26. Return non-zero iff @var{c} is a lower-case character.
  27. @end deftypefn
  28. @deftypefn {Libguile Function} int scm_mb_istitle (scm_mb_char_t @var{c})
  29. Return non-zero iff @var{c} is a title-case character. See the Unicode
  30. standard for an explanation of title case.
  31. @end deftypefn
  32. @deftypefn {Libguile Function} int scm_mb_isprint (scm_mb_char_t @var{c})
  33. Return non-zero iff @var{c} is a printable character.
  34. @end deftypefn
  35. @deftypefn {Libguile Function} int scm_mb_ispunct (scm_mb_char_t @var{c})
  36. Return non-zero iff @var{c} is a punctuation character.
  37. @end deftypefn
  38. @deftypefn {Libguile Function} int scm_mb_isspace (scm_mb_char_t @var{c})
  39. Return non-zero iff @var{c} is a whitespace character.
  40. @end deftypefn
  41. @deftypefn {Libguile Function} int scm_mb_isxdigit (scm_mb_char_t @var{c})
  42. Return non-zero iff @var{c} is a hexadecimal digit.
  43. @end deftypefn
  44. @deftypefn {Libguile Function} int scm_mb_isdefined (scm_mb_char_t @var{c})
  45. Return non-zero iff @var{c} is a valid character.
  46. @end deftypefn
  47. @deftypefn {Libguile Function} scm_mb_char_t scm_mb_char_toupper (scm_mb_char_t @var{c})
  48. @deftypefnx {Libguile Function} scm_mb_char_t scm_mb_char_tolower (scm_mb_char_t @var{c})
  49. @deftypefnx {Libguile Function} scm_mb_char_t scm_mb_char_totitle (scm_mb_char_t @var{c})
  50. Convert @var{c} to upper, lower, or title case. If @var{c} has no
  51. equivalent in the requested case, or is already in that case, return it
  52. unchanged.
  53. @end deftypefn
  54. @deftypefn {Libguile Function} in scm_mb_digit_value (scm_mb_char_t @var{c})
  55. If @var{c} is a hexadecimal digit (according to
  56. @code{scm_mb_isxdigit}), then return its numeric value. Otherwise
  57. return -1.
  58. @end deftypefn
  59. @deftypefn {Libguile Function} in scm_mb_digit_value (scm_mb_char_t @var{c})
  60. If @var{c} is a digit (according to @code{scm_mb_isdigit}), then
  61. return its numeric value. Otherwise return -1.
  62. @end deftypefn
  63. @node Multibyte Character Tables, Multibyte Character Categories, Exchanging Text With The Outside World, Functions for Operating on Multibyte Text
  64. @section Multibyte Character Tables
  65. A @dfn{character table} is a table mapping @code{scm_mb_char_t} values
  66. onto Guile objects. Guile provides functions for creating character
  67. tables, setting entries, and looking up characters. Character tables
  68. are Guile objects, so they are managed by Guile's garbage collector.
  69. A character table can have a ``parent'' table, from which it inherits
  70. values for characters. If a character table @var{child}, with a parent
  71. table @var{parent} maps some character @var{c} to the value
  72. @code{SCM_UNDEFINED}, then @code{scm_c_char_table_ref (@var{child},
  73. @var{c})} will look up @var{c} in @var{parent}, and return the value it
  74. finds there.
  75. This section describes only the C API for working with character tables.
  76. For the Scheme-level API, see @ref{some other section}.
  77. @deftypefn {Libguile Function} scm_make_char_table (SCM @var{init}, SCM @var{parent})
  78. Return a new character table object which maps every character to
  79. @var{init}. If @var{parent} is a character table, then @var{parent} is
  80. the new table's parent. If @var{parent} table is @code{SCM_UNDEFINED},
  81. then the new table has no parent. Otherwise, signal a type error.
  82. @end deffn
  83. @deftypefn {Libguile Function} SCM scm_c_char_table_ref (SCM @var{table}, scm_mb_char_t @var{c})
  84. Look up the character @var{c} in the character table @var{table}, and
  85. return the value found there. If @var{table} maps @var{c} to
  86. @code{SCM_UNDEFINED}, and @var{table} has a parent, then look up @var{c}
  87. in the parent.
  88. If @var{table} is not a character table, signal an error.
  89. @end deftypefn
  90. @deftypefn {Libguile Function} SCM scm_c_char_table_set_x (SCM @var{table}, scm_mb_char_t @var{c}, SCM @var{value})
  91. Set @var{table}'s value for the character @var{c} to @var{value}.
  92. If @var{value} is @code{SCM_UNDEFINED}, then @var{table}'s parent's
  93. value will show through for @var{c}.
  94. If @var{table} is not a character table, signal an error.
  95. This function changes only @var{table} itself, never @var{table}'s
  96. parent.
  97. @end deftypefn
  98. [[this is all wrong. what about default values?]]
  99. @node Multibyte Character Categories, , Multibyte Character Tables, Functions for Operating on Multibyte Text
  100. @section Multibyte Character Categories
  101. [[This will describe an ADT representing subsets of the Guile character
  102. set.]]
  103. @node Exchanging Guile Text With the Outside World
  104. @subsection Exchanging Guile Text With the Outside World
  105. [[Scheme-level functions for converting between encodings]]