From 89fc2ae80bb1eeca1d967723c1918c0b156508a0 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sat, 4 Mar 2017 15:01:55 +0100 Subject: speakup: extend synth buffer to 16bit unicode characters This extends the synth buffer slots to 16bit, so as to hold 16bit unicode characters. synth_buffer_getc and synth_buffer_peek now return 16bit characters. Speech synthesizers which do not support characters beyond latin1 can use the synth_buffer_skip_nonlatin1() helper to skip the non-latin1 characters before getting or peeking. All synthesizers are made to use it for now. This makes synth_buffer_add take a 16bit character. For simplicity for now, synth_printf is left to using latin1 formats and strings. synth_putwc, synth_putwc_s, synth_putws and synth_putws_s helpers are however added to put 16bit characters and strings. Signed-off-by: Samuel Thibault Reviewed-by: Chris Brannon Signed-off-by: Greg Kroah-Hartman --- drivers/staging/speakup/spk_priv.h | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'drivers/staging/speakup/spk_priv.h') diff --git a/drivers/staging/speakup/spk_priv.h b/drivers/staging/speakup/spk_priv.h index c78c2b6a2fc9..b8015d817cdd 100644 --- a/drivers/staging/speakup/spk_priv.h +++ b/drivers/staging/speakup/spk_priv.h @@ -48,8 +48,9 @@ unsigned char spk_serial_in_nowait(void); int spk_serial_out(const char ch); void spk_serial_release(void); -char synth_buffer_getc(void); -char synth_buffer_peek(void); +void synth_buffer_skip_nonlatin1(void); +u16 synth_buffer_getc(void); +u16 synth_buffer_peek(void); int synth_buffer_empty(void); struct var_t *spk_get_var(enum var_id_t var_id); ssize_t spk_var_show(struct kobject *kobj, struct kobj_attribute *attr, @@ -65,6 +66,10 @@ int spk_synth_is_alive_nop(struct spk_synth *synth); int spk_synth_is_alive_restart(struct spk_synth *synth); __printf(1, 2) void synth_printf(const char *buf, ...); +void synth_putwc(u16 wc); +void synth_putwc_s(u16 wc); +void synth_putws(const u16 *buf); +void synth_putws_s(const u16 *buf); int synth_request_region(unsigned long start, unsigned long n); int synth_release_region(unsigned long start, unsigned long n); int synth_add(struct spk_synth *in_synth); -- cgit