1/* SPDX-License-Identifier: GPL-2.0 */
2#ifndef _SPEAKUP_H
3#define _SPEAKUP_H
4
5#include "spk_types.h"
6#include "i18n.h"
7
8#define SPEAKUP_VERSION "3.1.6"
9#define KEY_MAP_VER 119
10#define SHIFT_TBL_SIZE 64
11#define MAX_DESC_LEN 72
12
13#define TOGGLE_0 .u.n = {NULL, 0, 0, 1, 0, 0, NULL }
14#define TOGGLE_1 .u.n = {NULL, 1, 0, 1, 0, 0, NULL }
15#define MAXVARLEN 15
16
17#define SYNTH_OK 0x0001
18#define B_ALPHA 0x0002
19#define ALPHA 0x0003
20#define B_CAP 0x0004
21#define A_CAP 0x0007
22#define B_NUM 0x0008
23#define NUM 0x0009
24#define ALPHANUM (B_ALPHA | B_NUM)
25#define SOME 0x0010
26#define MOST 0x0020
27#define PUNC 0x0040
28#define A_PUNC 0x0041
29#define B_WDLM 0x0080
30#define WDLM 0x0081
31#define B_EXNUM 0x0100
32#define CH_RPT 0x0200
33#define B_CTL 0x0400
34#define A_CTL (B_CTL + SYNTH_OK)
35#define B_SYM 0x0800
36#define B_CAPSYM (B_CAP | B_SYM)
37
38/* FIXME: u16 */
39#define IS_WDLM(x) (spk_chartab[((u_char)x)] & B_WDLM)
40#define IS_CHAR(x, type) (spk_chartab[((u_char)x)] & type)
41#define IS_TYPE(x, type) ((spk_chartab[((u_char)x)] & type) == type)
42
43int speakup_thread(void *data);
44void spk_reset_default_chars(void);
45void spk_reset_default_chartab(void);
46void synth_start(void);
47void synth_insert_next_index(int sent_num);
48void spk_reset_index_count(int sc);
49void spk_get_index_count(int *linecount, int *sentcount);
50int spk_set_key_info(const u_char *key_info, u_char *k_buffer);
51char *spk_strlwr(char *s);
52char *spk_s2uchar(char *start, char *dest);
53int speakup_kobj_init(void);
54void speakup_kobj_exit(void);
55int spk_chartab_get_value(char *keyword);
56void speakup_register_var(struct var_t *var);
57void speakup_unregister_var(enum var_id_t var_id);
58struct st_var_header *spk_get_var_header(enum var_id_t var_id);
59struct st_var_header *spk_var_header_by_name(const char *name);
60struct punc_var_t *spk_get_punc_var(enum var_id_t var_id);
61int spk_set_num_var(int val, struct st_var_header *var, int how);
62int spk_set_string_var(const char *page, struct st_var_header *var, int len);
63int spk_set_mask_bits(const char *input, const int which, const int how);
64extern special_func spk_special_handler;
65int spk_handle_help(struct vc_data *vc, u_char type, u_char ch, u_short key);
66int synth_init(char *name);
67void synth_release(void);
68
69void spk_do_flush(void);
70void speakup_start_ttys(void);
71void synth_buffer_add(u16 ch);
72void synth_buffer_clear(void);
73int speakup_set_selection(struct tty_struct *tty);
74void speakup_cancel_selection(void);
75int speakup_paste_selection(struct tty_struct *tty);
76void speakup_cancel_paste(void);
77void speakup_register_devsynth(void);
78void speakup_unregister_devsynth(void);
79void synth_write(const char *buf, size_t count);
80int synth_supports_indexing(void);
81
82extern struct vc_data *spk_sel_cons;
83extern unsigned short spk_xs, spk_ys, spk_xe, spk_ye; /* our region points */
84
85extern wait_queue_head_t speakup_event;
86extern struct kobject *speakup_kobj;
87extern struct task_struct *speakup_task;
88extern const u_char spk_key_defaults[];
89
90/* Protect speakup synthesizer list */
91extern struct mutex spk_mutex;
92extern struct st_spk_t *speakup_console[];
93extern struct spk_synth *synth;
94extern char spk_pitch_buff[];
95extern u_char *spk_our_keys[];
96extern short spk_punc_masks[];
97extern char spk_str_caps_start[], spk_str_caps_stop[], spk_str_pause[];
98extern bool spk_paused;
99extern const struct st_bits_data spk_punc_info[];
100extern u_char spk_key_buf[600];
101extern char *spk_characters[];
102extern char *spk_default_chars[];
103extern u_short spk_chartab[];
104extern int spk_no_intr, spk_say_ctrl, spk_say_word_ctl, spk_punc_level;
105extern int spk_reading_punc, spk_attrib_bleep, spk_bleeps;
106extern int spk_bleep_time, spk_bell_pos;
107extern int spk_spell_delay, spk_key_echo;
108extern int spk_cur_phonetic;
109extern short spk_punc_mask;
110extern short spk_pitch_shift, synth_flags;
111extern bool spk_quiet_boot;
112extern char *synth_name;
113extern struct bleep spk_unprocessed_sound;
114
115/* Prototypes from fakekey.c. */
116int speakup_add_virtual_keyboard(void);
117void speakup_remove_virtual_keyboard(void);
118void speakup_fake_down_arrow(void);
119bool speakup_fake_key_pressed(void);
120
121#endif
122