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