18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0 */ 28c2ecf20Sopenharmony_ci#ifndef _SPEAKUP_H 38c2ecf20Sopenharmony_ci#define _SPEAKUP_H 48c2ecf20Sopenharmony_ci 58c2ecf20Sopenharmony_ci#include "spk_types.h" 68c2ecf20Sopenharmony_ci#include "i18n.h" 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#define SPEAKUP_VERSION "3.1.6" 98c2ecf20Sopenharmony_ci#define KEY_MAP_VER 119 108c2ecf20Sopenharmony_ci#define SHIFT_TBL_SIZE 64 118c2ecf20Sopenharmony_ci#define MAX_DESC_LEN 72 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#define TOGGLE_0 .u.n = {NULL, 0, 0, 1, 0, 0, NULL } 148c2ecf20Sopenharmony_ci#define TOGGLE_1 .u.n = {NULL, 1, 0, 1, 0, 0, NULL } 158c2ecf20Sopenharmony_ci#define MAXVARLEN 15 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_ci#define SYNTH_OK 0x0001 188c2ecf20Sopenharmony_ci#define B_ALPHA 0x0002 198c2ecf20Sopenharmony_ci#define ALPHA 0x0003 208c2ecf20Sopenharmony_ci#define B_CAP 0x0004 218c2ecf20Sopenharmony_ci#define A_CAP 0x0007 228c2ecf20Sopenharmony_ci#define B_NUM 0x0008 238c2ecf20Sopenharmony_ci#define NUM 0x0009 248c2ecf20Sopenharmony_ci#define ALPHANUM (B_ALPHA | B_NUM) 258c2ecf20Sopenharmony_ci#define SOME 0x0010 268c2ecf20Sopenharmony_ci#define MOST 0x0020 278c2ecf20Sopenharmony_ci#define PUNC 0x0040 288c2ecf20Sopenharmony_ci#define A_PUNC 0x0041 298c2ecf20Sopenharmony_ci#define B_WDLM 0x0080 308c2ecf20Sopenharmony_ci#define WDLM 0x0081 318c2ecf20Sopenharmony_ci#define B_EXNUM 0x0100 328c2ecf20Sopenharmony_ci#define CH_RPT 0x0200 338c2ecf20Sopenharmony_ci#define B_CTL 0x0400 348c2ecf20Sopenharmony_ci#define A_CTL (B_CTL + SYNTH_OK) 358c2ecf20Sopenharmony_ci#define B_SYM 0x0800 368c2ecf20Sopenharmony_ci#define B_CAPSYM (B_CAP | B_SYM) 378c2ecf20Sopenharmony_ci 388c2ecf20Sopenharmony_ci/* FIXME: u16 */ 398c2ecf20Sopenharmony_ci#define IS_WDLM(x) (spk_chartab[((u_char)x)] & B_WDLM) 408c2ecf20Sopenharmony_ci#define IS_CHAR(x, type) (spk_chartab[((u_char)x)] & type) 418c2ecf20Sopenharmony_ci#define IS_TYPE(x, type) ((spk_chartab[((u_char)x)] & type) == type) 428c2ecf20Sopenharmony_ci 438c2ecf20Sopenharmony_ciint speakup_thread(void *data); 448c2ecf20Sopenharmony_civoid spk_reset_default_chars(void); 458c2ecf20Sopenharmony_civoid spk_reset_default_chartab(void); 468c2ecf20Sopenharmony_civoid synth_start(void); 478c2ecf20Sopenharmony_civoid synth_insert_next_index(int sent_num); 488c2ecf20Sopenharmony_civoid spk_reset_index_count(int sc); 498c2ecf20Sopenharmony_civoid spk_get_index_count(int *linecount, int *sentcount); 508c2ecf20Sopenharmony_ciint spk_set_key_info(const u_char *key_info, u_char *k_buffer); 518c2ecf20Sopenharmony_cichar *spk_strlwr(char *s); 528c2ecf20Sopenharmony_cichar *spk_s2uchar(char *start, char *dest); 538c2ecf20Sopenharmony_ciint speakup_kobj_init(void); 548c2ecf20Sopenharmony_civoid speakup_kobj_exit(void); 558c2ecf20Sopenharmony_ciint spk_chartab_get_value(char *keyword); 568c2ecf20Sopenharmony_civoid speakup_register_var(struct var_t *var); 578c2ecf20Sopenharmony_civoid speakup_unregister_var(enum var_id_t var_id); 588c2ecf20Sopenharmony_cistruct st_var_header *spk_get_var_header(enum var_id_t var_id); 598c2ecf20Sopenharmony_cistruct st_var_header *spk_var_header_by_name(const char *name); 608c2ecf20Sopenharmony_cistruct punc_var_t *spk_get_punc_var(enum var_id_t var_id); 618c2ecf20Sopenharmony_ciint spk_set_num_var(int val, struct st_var_header *var, int how); 628c2ecf20Sopenharmony_ciint spk_set_string_var(const char *page, struct st_var_header *var, int len); 638c2ecf20Sopenharmony_ciint spk_set_mask_bits(const char *input, const int which, const int how); 648c2ecf20Sopenharmony_ciextern special_func spk_special_handler; 658c2ecf20Sopenharmony_ciint spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key); 668c2ecf20Sopenharmony_ciint synth_init(char *name); 678c2ecf20Sopenharmony_civoid synth_release(void); 688c2ecf20Sopenharmony_ci 698c2ecf20Sopenharmony_civoid spk_do_flush(void); 708c2ecf20Sopenharmony_civoid speakup_start_ttys(void); 718c2ecf20Sopenharmony_civoid synth_buffer_add(u16 ch); 728c2ecf20Sopenharmony_civoid synth_buffer_clear(void); 738c2ecf20Sopenharmony_ciint speakup_set_selection(struct tty_struct *tty); 748c2ecf20Sopenharmony_civoid speakup_cancel_selection(void); 758c2ecf20Sopenharmony_ciint speakup_paste_selection(struct tty_struct *tty); 768c2ecf20Sopenharmony_civoid speakup_cancel_paste(void); 778c2ecf20Sopenharmony_civoid speakup_register_devsynth(void); 788c2ecf20Sopenharmony_civoid speakup_unregister_devsynth(void); 798c2ecf20Sopenharmony_civoid synth_write(const char *buf, size_t count); 808c2ecf20Sopenharmony_ciint synth_supports_indexing(void); 818c2ecf20Sopenharmony_ci 828c2ecf20Sopenharmony_ciextern struct vc_data *spk_sel_cons; 838c2ecf20Sopenharmony_ciextern unsigned short spk_xs, spk_ys, spk_xe, spk_ye; /* our region points */ 848c2ecf20Sopenharmony_ci 858c2ecf20Sopenharmony_ciextern wait_queue_head_t speakup_event; 868c2ecf20Sopenharmony_ciextern struct kobject *speakup_kobj; 878c2ecf20Sopenharmony_ciextern struct task_struct *speakup_task; 888c2ecf20Sopenharmony_ciextern const u_char spk_key_defaults[]; 898c2ecf20Sopenharmony_ci 908c2ecf20Sopenharmony_ci/* Protect speakup synthesizer list */ 918c2ecf20Sopenharmony_ciextern struct mutex spk_mutex; 928c2ecf20Sopenharmony_ciextern struct st_spk_t *speakup_console[]; 938c2ecf20Sopenharmony_ciextern struct spk_synth *synth; 948c2ecf20Sopenharmony_ciextern char spk_pitch_buff[]; 958c2ecf20Sopenharmony_ciextern u_char *spk_our_keys[]; 968c2ecf20Sopenharmony_ciextern short spk_punc_masks[]; 978c2ecf20Sopenharmony_ciextern char spk_str_caps_start[], spk_str_caps_stop[], spk_str_pause[]; 988c2ecf20Sopenharmony_ciextern bool spk_paused; 998c2ecf20Sopenharmony_ciextern const struct st_bits_data spk_punc_info[]; 1008c2ecf20Sopenharmony_ciextern u_char spk_key_buf[600]; 1018c2ecf20Sopenharmony_ciextern char *spk_characters[]; 1028c2ecf20Sopenharmony_ciextern char *spk_default_chars[]; 1038c2ecf20Sopenharmony_ciextern u_short spk_chartab[]; 1048c2ecf20Sopenharmony_ciextern int spk_no_intr, spk_say_ctrl, spk_say_word_ctl, spk_punc_level; 1058c2ecf20Sopenharmony_ciextern int spk_reading_punc, spk_attrib_bleep, spk_bleeps; 1068c2ecf20Sopenharmony_ciextern int spk_bleep_time, spk_bell_pos; 1078c2ecf20Sopenharmony_ciextern int spk_spell_delay, spk_key_echo; 1088c2ecf20Sopenharmony_ciextern short spk_punc_mask; 1098c2ecf20Sopenharmony_ciextern short spk_pitch_shift, synth_flags; 1108c2ecf20Sopenharmony_ciextern bool spk_quiet_boot; 1118c2ecf20Sopenharmony_ciextern char *synth_name; 1128c2ecf20Sopenharmony_ciextern struct bleep spk_unprocessed_sound; 1138c2ecf20Sopenharmony_ci 1148c2ecf20Sopenharmony_ci/* Prototypes from fakekey.c. */ 1158c2ecf20Sopenharmony_ciint speakup_add_virtual_keyboard(void); 1168c2ecf20Sopenharmony_civoid speakup_remove_virtual_keyboard(void); 1178c2ecf20Sopenharmony_civoid speakup_fake_down_arrow(void); 1188c2ecf20Sopenharmony_cibool speakup_fake_key_pressed(void); 1198c2ecf20Sopenharmony_ci 1208c2ecf20Sopenharmony_ci#endif 121