Loading drivers/staging/speakup/main.c +288 −285 Original line number Diff line number Diff line /* speakup.c review functions for the speakup screen review package. originally written by: Kirk Reiser and Andy Berdan. extensively modified by David Borowski. Copyright (C) 1998 Kirk Reiser. Copyright (C) 2003 David Borowski. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * review functions for the speakup screen review package. * originally written by: Kirk Reiser and Andy Berdan. * * extensively modified by David Borowski. * ** Copyright (C) 1998 Kirk Reiser. * Copyright (C) 2003 David Borowski. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/kernel.h> Loading Loading @@ -93,6 +93,7 @@ const struct st_bits_data punc_info[] = { {"symbols", "", B_SYM}, {0, 0} }; static char mark_cut_flag; #define MAX_KEY 160 u_char *our_keys[MAX_KEY], *shift_table; Loading @@ -118,10 +119,10 @@ static struct tty_struct *tty; static void spkup_write(const char *in_buf, int count); static char *phonetic[] = { "alfa", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "india", "juliett", "keelo", "leema", "mike", "november", "oscar", "papa", "india", "juliett", "keelo", "leema", "mike", "november", "oscar", "papa", "keh beck", "romeo", "sierra", "tango", "uniform", "victer", "whiskey", "x ray", "yankee", "zulu" }; Loading @@ -135,9 +136,12 @@ char *default_chars[256] = { /*000*/ "null", "^a", "^b", "^c", "^d", "^e", "^f", "^g", /*008*/ "^h", "^i", "^j", "^k", "^l", "^m", "^n", "^o", /*016*/ "^p", "^q", "^r", "^s", "^t", "^u", "^v", "^w", /*024*/ "^x", "^y", "^z", "control", "control", "control", "control", "control", /*032*/ "space", "bang!", "quote", "number", "dollar", "percent", "and", "tick", /*040*/ "left paren", "right paren", "star", "plus", "comma", "dash", "dot", /*024*/ "^x", "^y", "^z", "control", "control", "control", "control", "control", /*032*/ "space", "bang!", "quote", "number", "dollar", "percent", "and", "tick", /*040*/ "left paren", "right paren", "star", "plus", "comma", "dash", "dot", "slash", /*048*/ "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", Loading @@ -145,15 +149,20 @@ char *default_chars[256] = { /*065*/ "EIGH", "B", "C", "D", "E", "F", "G", /*072*/ "H", "I", "J", "K", "L", "M", "N", "O", /*080*/ "P", "Q", "R", "S", "T", "U", "V", "W", "X", /*089*/ "Y", "ZED", "left bracket", "backslash", "right bracket", "caret", /*089*/ "Y", "ZED", "left bracket", "backslash", "right bracket", "caret", "line", /*096*/ "accent", "a", "b", "c", "d", "e", "f", "g", /*104*/ "h", "i", "j", "k", "l", "m", "n", "o", /*112*/ "p", "q", "r", "s", "t", "u", "v", "w", /*120*/ "x", "y", "zed", "left brace", "bar", "right brace", "tihlduh", /*127*/ "del", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*138*/ "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*150*/ "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*127*/ "del", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*138*/ "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*150*/ "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*160*/ "nbsp", "inverted bang", /*162*/ "cents", "pounds", "currency", "yen", "broken bar", "section", /*168*/ "diaeresis", "copyright", "female ordinal", "double left angle", Loading @@ -161,18 +170,26 @@ char *default_chars[256] = { /*176*/ "degrees", "plus or minus", "super two", "super three", /*180*/ "acute accent", "micro", "pilcrow", "middle dot", /*184*/ "cedilla", "super one", "male ordinal", "double right angle", /*188*/ "one quarter", "one half", "three quarters", "inverted question", /*192*/ "A GRAVE", "A ACUTE", "A CIRCUMFLEX", "A TILDE", "A OOMLAUT", "A RING", /*198*/ "AE", "C CIDELLA", "E GRAVE", "E ACUTE", "E CIRCUMFLEX", "E OOMLAUT", /*204*/ "I GRAVE", "I ACUTE", "I CIRCUMFLEX", "I OOMLAUT", "ETH", "N TILDE", /*188*/ "one quarter", "one half", "three quarters", "inverted question", /*192*/ "A GRAVE", "A ACUTE", "A CIRCUMFLEX", "A TILDE", "A OOMLAUT", "A RING", /*198*/ "AE", "C CIDELLA", "E GRAVE", "E ACUTE", "E CIRCUMFLEX", "E OOMLAUT", /*204*/ "I GRAVE", "I ACUTE", "I CIRCUMFLEX", "I OOMLAUT", "ETH", "N TILDE", /*210*/ "O GRAVE", "O ACUTE", "O CIRCUMFLEX", "O TILDE", "O OOMLAUT", /*215*/ "multiplied by", "O STROKE", "U GRAVE", "U ACUTE", "U CIRCUMFLEX", /*215*/ "multiplied by", "O STROKE", "U GRAVE", "U ACUTE", "U CIRCUMFLEX", /*220*/ "U OOMLAUT", "Y ACUTE", "THORN", "sharp s", "a grave", /*225*/ "a acute", "a circumflex", "a tilde", "a oomlaut", "a ring", /*230*/ "ae", "c cidella", "e grave", "e acute", /*234*/ "e circumflex", "e oomlaut", "i grave", "i acute", "i circumflex", /*239*/ "i oomlaut", "eth", "n tilde","o grave", "o acute", "o circumflex", /*245*/"o tilde", "o oomlaut", "divided by", "o stroke", "u grave", "u acute", /*234*/ "e circumflex", "e oomlaut", "i grave", "i acute", "i circumflex", /*239*/ "i oomlaut", "eth", "n tilde", "o grave", "o acute", "o circumflex", /*245*/ "o tilde", "o oomlaut", "divided by", "o stroke", "u grave", "u acute", /* 251 */ "u circumflex", "u oomlaut", "y acute", "thorn", "y oomlaut" }; Loading @@ -198,11 +215,16 @@ PUNC, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* `abcdefg */ ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* hijklmno */ ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* pqrstuvw */ ALPHA, ALPHA, ALPHA, PUNC, PUNC, PUNC, PUNC, 0, /* xyz{|}~ */ B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 128-135 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, /* 136-143 */ B_CAPSYM, B_CAPSYM, B_SYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 144-151 */ B_SYM, B_SYM, B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 152-159 */ WDLM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, B_SYM, /* 160-167 */ B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 128-134 */ B_SYM, /* 135 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 136-142 */ B_CAPSYM, /* 143 */ B_CAPSYM, B_CAPSYM, B_SYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, /* 144-150 */ B_SYM, /* 151 */ B_SYM, B_SYM, B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, /*152-158 */ B_SYM, /* 159 */ WDLM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, /* 160-166 */ B_SYM, /* 167 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 168-175 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 176-183 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 184-191 */ Loading Loading @@ -506,12 +528,12 @@ static void say_next_char(struct vc_data *vc) } /* get_word - will first check to see if the character under the reading cursor is a space and if say_word_ctl is true it will return the word space. If say_word_ctl is not set it will check to see if there is a word starting on the next position to the right and return that word if it exists. If it does not exist it will move left to the beginning of any previous word on the line or the beginning off the line whichever comes first.. */ * reading cursor is a space and if say_word_ctl is true it will * return the word space. If say_word_ctl is not set it will check to * see if there is a word starting on the next position to the right * and return that word if it exists. If it does not exist it will * move left to the beginning of any previous word on the line or the * beginning off the line whichever comes first.. */ static u_long get_word(struct vc_data *vc) { Loading @@ -529,7 +551,8 @@ static u_long get_word(struct vc_data *vc) return 0; } else if ((tmpx < vc->vc_cols - 2) && (ch == SPACE || ch == 0 || IS_WDLM(ch)) && ((char) get_char(vc, (u_short *) &tmp_pos+1, &temp) > SPACE)) { && ((char)get_char(vc, (u_short *) &tmp_pos + 1, &temp) > SPACE)) { tmp_pos += 2; tmpx++; } else Loading @@ -548,7 +571,8 @@ static u_long get_word(struct vc_data *vc) tmp_pos += 2; tmpx++; ch = (char)get_char(vc, (u_short *) tmp_pos, &temp); if ((ch == SPACE) || ch == 0 || (IS_WDLM(buf[cnt-1]) && (ch > SPACE))) if ((ch == SPACE) || ch == 0 || (IS_WDLM(buf[cnt - 1]) && (ch > SPACE))) break; buf[cnt++] = ch; } Loading Loading @@ -730,8 +754,9 @@ static void say_line(struct vc_data *vc) } buf[i++] = '\n'; if (this_speakup_key == SAY_LINE_INDENT) { for (cp = buf; *cp == SPACE; cp++) ; cp = buf; while (*cp == SPACE) cp++; synth_printf("%d, ", (cp - buf) + 1); } punc_mask = punc_masks[reading_punc]; Loading Loading @@ -805,8 +830,6 @@ static void say_line_from_to(struct vc_data *vc, u_long from, u_long to, /* Sentence Reading Commands */ void synth_insert_next_index(int); static int currsentence; static int numsentences[2]; static char *sentbufend[2]; Loading Loading @@ -1024,9 +1047,9 @@ static void say_to_right(struct vc_data *vc) static void spkup_write(const char *in_buf, int count) { static int rep_count = 0; static int rep_count; static u_char ch = '\0', old_ch = '\0'; static u_short char_type = 0, last_type = 0; static u_short char_type, last_type; int in_count = count; spk_keydown = 0; while (count--) { Loading @@ -1044,7 +1067,8 @@ static void spkup_write(const char *in_buf, int count) } else { if ((last_type & CH_RPT) && rep_count > 2) { synth_printf(" "); synth_printf(msg_get(MSG_REPEAT_DESC), ++rep_count); synth_printf(msg_get(MSG_REPEAT_DESC), ++rep_count); synth_printf(" "); } rep_count = 0; Loading @@ -1064,9 +1088,12 @@ static void spkup_write(const char *in_buf, int count) speak_char(ch); char_type &= ~PUNC; /* for dec nospell processing */ } else if (char_type & SYNTH_OK) { /* these are usually puncts like . and , which synth needs for expression. * suppress multiple to get rid of long pausesand clear repeat count so if *someone has repeats on you don't get nothing repeated count */ /* these are usually puncts like . and , which synth * needs for expression. * suppress multiple to get rid of long pauses and * clear repeat count * so if someone has * repeats on you don't get nothing repeated count */ if (ch != old_ch) synth_printf("%c", ch); else Loading Loading @@ -1205,7 +1232,6 @@ static struct var_t spk_vars[] = { V_LAST_VAR }; static void toggle_cursoring(struct vc_data *vc) { if (cursor_track == read_all_mode) Loading Loading @@ -1234,7 +1260,7 @@ void reset_default_chartab(void) memcpy(spk_chartab, default_chartab, sizeof(default_chartab)); } static const struct st_bits_data *pb_edit = NULL; static const struct st_bits_data *pb_edit; static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key) { Loading @@ -1251,7 +1277,8 @@ static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key) spk_chartab[ch] ^= mask; speak_char(ch); synth_printf(" %s\n", (spk_chartab[ch]&mask) ? msg_get(MSG_ON) : msg_get(MSG_OFF)); (spk_chartab[ch] & mask) ? msg_get(MSG_ON) : msg_get(MSG_OFF)); return 1; } Loading Loading @@ -1290,9 +1317,6 @@ static void reset_highlight_buffers(struct vc_data *); static int read_all_key; void reset_index_count(int); void get_index_count(int *, int *); /*int synth_supports_indexing(void); */ static void start_read_all_timer(struct vc_data *vc, int command); enum { Loading @@ -1307,16 +1331,14 @@ enum { RA_FIND_PREV_SENT, }; static void kbd_fakekey2(struct vc_data *vc, int command) static void kbd_fakekey2(struct vc_data *vc, int command) { del_timer(&cursor_timer); speakup_fake_down_arrow(); start_read_all_timer(vc, command); } static void read_all_doc(struct vc_data *vc) static void read_all_doc(struct vc_data *vc) { if ((vc->vc_num != fg_console) || synth == NULL || spk_shut_up) return; Loading @@ -1335,8 +1357,7 @@ read_all_doc(struct vc_data *vc) } } static void stop_read_all(struct vc_data *vc) static void stop_read_all(struct vc_data *vc) { del_timer(&cursor_timer); cursor_track = prev_cursor_track; Loading @@ -1344,19 +1365,18 @@ stop_read_all(struct vc_data *vc) do_flush(); } static void start_read_all_timer(struct vc_data *vc, int command) static void start_read_all_timer(struct vc_data *vc, int command) { struct var_t *cursor_timeout; cursor_con = vc->vc_num; read_all_key = command; cursor_timeout = get_var(CURSOR_TIME); mod_timer(&cursor_timer, jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); mod_timer(&cursor_timer, jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); } static void handle_cursor_read_all(struct vc_data *vc, int command) static void handle_cursor_read_all(struct vc_data *vc, int command) { int indcount, sentcount, rv, sn; Loading Loading @@ -1473,12 +1493,12 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag) if (cursor_track == CT_Highlight) reset_highlight_buffers(vc); cursor_timeout = get_var(CURSOR_TIME); mod_timer(&cursor_timer, jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); mod_timer(&cursor_timer, jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); spk_unlock(flags); } static void update_color_buffer(struct vc_data *vc , const char *ic , int len) static void update_color_buffer(struct vc_data *vc, const char *ic, int len) { int i, bi, hi; int vc_num = vc->vc_num; Loading Loading @@ -1509,8 +1529,7 @@ update_color_buffer(struct vc_data *vc , const char *ic , int len) speakup_console[vc_num]->ht.highsize[bi] = hi; } static void reset_highlight_buffers(struct vc_data *vc) static void reset_highlight_buffers(struct vc_data *vc) { int i; int vc_num = vc->vc_num; Loading @@ -1518,8 +1537,7 @@ reset_highlight_buffers(struct vc_data *vc) speakup_console[vc_num]->ht.highsize[i] = 0; } static int count_highlight_color(struct vc_data *vc) static int count_highlight_color(struct vc_data *vc) { int i, bg; int cc; Loading Loading @@ -1548,8 +1566,7 @@ count_highlight_color(struct vc_data *vc) return cc; } static int get_highlight_color(struct vc_data *vc) static int get_highlight_color(struct vc_data *vc) { int i, j; unsigned int cptr[8], tmp; Loading @@ -1574,8 +1591,7 @@ get_highlight_color(struct vc_data *vc) return -1; } static int speak_highlight(struct vc_data *vc) static int speak_highlight(struct vc_data *vc) { int hc, d; int vc_num = vc->vc_num; Loading @@ -1599,8 +1615,7 @@ speak_highlight(struct vc_data *vc) return 0; } static void cursor_done(u_long data) static void cursor_done(u_long data) { struct vc_data *vc = vc_cons[cursor_con].d; unsigned long flags; Loading Loading @@ -1691,8 +1706,7 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len) spk_unlock(flags); } void speakup_con_update(struct vc_data *vc) void speakup_con_update(struct vc_data *vc) { unsigned long flags; if (speakup_console[vc->vc_num] == NULL || spk_parked) Loading Loading @@ -1741,8 +1755,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag) spk_unlock(flags); } static int inc_dec_var(u_char value) static int inc_dec_var(u_char value) { struct st_var_header *p_header; struct var_t *var_data; Loading Loading @@ -1774,8 +1787,7 @@ inc_dec_var(u_char value) return 0; } static void speakup_win_set(struct vc_data *vc) static void speakup_win_set(struct vc_data *vc) { char info[40]; if (win_start > 1) { Loading Loading @@ -1808,8 +1820,7 @@ speakup_win_set(struct vc_data *vc) win_start++; } static void speakup_win_clear(struct vc_data *vc) static void speakup_win_clear(struct vc_data *vc) { win_top = win_bottom = 0; win_left = win_right = 0; Loading @@ -1817,8 +1828,7 @@ speakup_win_clear(struct vc_data *vc) synth_printf("%s\n", msg_get(MSG_WINDOW_CLEARED)); } static void speakup_win_enable(struct vc_data *vc) static void speakup_win_enable(struct vc_data *vc) { if (win_start < 2) { synth_printf("%s\n", msg_get(MSG_NO_WINDOW)); Loading @@ -1831,8 +1841,7 @@ speakup_win_enable(struct vc_data *vc) synth_printf("%s\n", msg_get(MSG_WINDOW_SILENCE_DISABLED)); } static void speakup_bits(struct vc_data *vc) static void speakup_bits(struct vc_data *vc) { int val = this_speakup_key - (FIRST_EDIT_BITS - 1); if (special_handler != NULL || val < 1 || val > 6) { Loading @@ -1847,7 +1856,7 @@ speakup_bits(struct vc_data *vc) static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) { static u_char *goto_buf = "\0\0\0\0\0\0"; static int num = 0; static int num; int maxlen, go_pos; char *cp; if (type == KT_SPKUP && ch == SPEAKUP_GOTO) Loading Loading @@ -1924,8 +1933,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) return 1; } static void speakup_goto(struct vc_data *vc) static void speakup_goto(struct vc_data *vc) { if (special_handler != NULL) { synth_printf("%s\n", msg_get(MSG_ERROR)); Loading @@ -1941,15 +1949,14 @@ static void speakup_help(struct vc_data *vc) handle_help(vc, KT_SPKUP, SPEAKUP_HELP, 0); } static void do_nothing(struct vc_data *vc) static void do_nothing(struct vc_data *vc) { return; /* flush done in do_spkup */ } static u_char key_speakup, spk_key_locked; static void speakup_lock(struct vc_data *vc) static void speakup_lock(struct vc_data *vc) { if (!spk_key_locked) spk_key_locked = key_speakup = 16; Loading Loading @@ -2013,8 +2020,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, tty = vc->port.tty; if (type >= 0xf0) type -= 0xf0; if (type == KT_PAD && (vc_kbd_led(kbd_table + fg_console, VC_NUMLOCK))) { if (type == KT_PAD && (vc_kbd_led(kbd_table + fg_console, VC_NUMLOCK))) { if (up_flag) { spk_keydown = 0; goto out; Loading Loading @@ -2150,10 +2157,8 @@ static int keyboard_notifier_call(struct notifier_block *nb, case KBD_KEYSYM: if (speakup_key(vc, param->shift, keycode, param->value, up)) ret = NOTIFY_STOP; else if (KTYP(param->value) == KT_CUR) ret = pre_handle_cursor(vc, KVAL(param->value), up); else if (KTYP(param->value) == KT_CUR) ret = pre_handle_cursor(vc, KVAL(param->value), up); break; case KBD_POST_KEYSYM:{ unsigned char type = KTYP(param->value) - 0xf0; Loading Loading @@ -2195,8 +2200,7 @@ static int vt_notifier_call(struct notifier_block *nb, case VT_WRITE: if (param->c == '\b') speakup_bs(vc); else if (param->c < 0x100) { else if (param->c < 0x100) { char d = param->c; speakup_con_write(vc, &d, 1); } Loading Loading @@ -2269,7 +2273,8 @@ static int __init speakup_init(void) spk_vars[0].u.n.high = vc->vc_cols; for (var = spk_vars; var->var_id != MAXVARS; var++) speakup_register_var(var); for (var = synth_time_vars; (var->var_id >= 0) && (var->var_id < MAXVARS); var++) for (var = synth_time_vars; (var->var_id >= 0) && (var->var_id < MAXVARS); var++) speakup_register_var(var); for (i = 1; punc_info[i].mask != 0; i++) set_mask_bits(0, i, 2); Loading Loading @@ -2298,7 +2303,5 @@ static int __init speakup_init(void) return 0; } module_init(speakup_init); module_exit(speakup_exit); drivers/staging/speakup/speakup.h +3 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,9 @@ extern int speakup_thread(void *data); extern void reset_default_chars(void); extern void reset_default_chartab(void); extern void synth_start(void); void synth_insert_next_index(int sent_num); void reset_index_count(int sc); void get_index_count(int *linecount, int *sentcount); extern int set_key_info(const u_char *key_info, u_char *k_buffer); extern char *strlwr(char *s); extern char *speakup_s2i(char *start, int *dest); Loading Loading
drivers/staging/speakup/main.c +288 −285 Original line number Diff line number Diff line /* speakup.c review functions for the speakup screen review package. originally written by: Kirk Reiser and Andy Berdan. extensively modified by David Borowski. Copyright (C) 1998 Kirk Reiser. Copyright (C) 2003 David Borowski. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * review functions for the speakup screen review package. * originally written by: Kirk Reiser and Andy Berdan. * * extensively modified by David Borowski. * ** Copyright (C) 1998 Kirk Reiser. * Copyright (C) 2003 David Borowski. * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #include <linux/kernel.h> Loading Loading @@ -93,6 +93,7 @@ const struct st_bits_data punc_info[] = { {"symbols", "", B_SYM}, {0, 0} }; static char mark_cut_flag; #define MAX_KEY 160 u_char *our_keys[MAX_KEY], *shift_table; Loading @@ -118,10 +119,10 @@ static struct tty_struct *tty; static void spkup_write(const char *in_buf, int count); static char *phonetic[] = { "alfa", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "india", "juliett", "keelo", "leema", "mike", "november", "oscar", "papa", "india", "juliett", "keelo", "leema", "mike", "november", "oscar", "papa", "keh beck", "romeo", "sierra", "tango", "uniform", "victer", "whiskey", "x ray", "yankee", "zulu" }; Loading @@ -135,9 +136,12 @@ char *default_chars[256] = { /*000*/ "null", "^a", "^b", "^c", "^d", "^e", "^f", "^g", /*008*/ "^h", "^i", "^j", "^k", "^l", "^m", "^n", "^o", /*016*/ "^p", "^q", "^r", "^s", "^t", "^u", "^v", "^w", /*024*/ "^x", "^y", "^z", "control", "control", "control", "control", "control", /*032*/ "space", "bang!", "quote", "number", "dollar", "percent", "and", "tick", /*040*/ "left paren", "right paren", "star", "plus", "comma", "dash", "dot", /*024*/ "^x", "^y", "^z", "control", "control", "control", "control", "control", /*032*/ "space", "bang!", "quote", "number", "dollar", "percent", "and", "tick", /*040*/ "left paren", "right paren", "star", "plus", "comma", "dash", "dot", "slash", /*048*/ "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", Loading @@ -145,15 +149,20 @@ char *default_chars[256] = { /*065*/ "EIGH", "B", "C", "D", "E", "F", "G", /*072*/ "H", "I", "J", "K", "L", "M", "N", "O", /*080*/ "P", "Q", "R", "S", "T", "U", "V", "W", "X", /*089*/ "Y", "ZED", "left bracket", "backslash", "right bracket", "caret", /*089*/ "Y", "ZED", "left bracket", "backslash", "right bracket", "caret", "line", /*096*/ "accent", "a", "b", "c", "d", "e", "f", "g", /*104*/ "h", "i", "j", "k", "l", "m", "n", "o", /*112*/ "p", "q", "r", "s", "t", "u", "v", "w", /*120*/ "x", "y", "zed", "left brace", "bar", "right brace", "tihlduh", /*127*/ "del", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*138*/ "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*150*/ "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*127*/ "del", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*138*/ "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*150*/ "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*160*/ "nbsp", "inverted bang", /*162*/ "cents", "pounds", "currency", "yen", "broken bar", "section", /*168*/ "diaeresis", "copyright", "female ordinal", "double left angle", Loading @@ -161,18 +170,26 @@ char *default_chars[256] = { /*176*/ "degrees", "plus or minus", "super two", "super three", /*180*/ "acute accent", "micro", "pilcrow", "middle dot", /*184*/ "cedilla", "super one", "male ordinal", "double right angle", /*188*/ "one quarter", "one half", "three quarters", "inverted question", /*192*/ "A GRAVE", "A ACUTE", "A CIRCUMFLEX", "A TILDE", "A OOMLAUT", "A RING", /*198*/ "AE", "C CIDELLA", "E GRAVE", "E ACUTE", "E CIRCUMFLEX", "E OOMLAUT", /*204*/ "I GRAVE", "I ACUTE", "I CIRCUMFLEX", "I OOMLAUT", "ETH", "N TILDE", /*188*/ "one quarter", "one half", "three quarters", "inverted question", /*192*/ "A GRAVE", "A ACUTE", "A CIRCUMFLEX", "A TILDE", "A OOMLAUT", "A RING", /*198*/ "AE", "C CIDELLA", "E GRAVE", "E ACUTE", "E CIRCUMFLEX", "E OOMLAUT", /*204*/ "I GRAVE", "I ACUTE", "I CIRCUMFLEX", "I OOMLAUT", "ETH", "N TILDE", /*210*/ "O GRAVE", "O ACUTE", "O CIRCUMFLEX", "O TILDE", "O OOMLAUT", /*215*/ "multiplied by", "O STROKE", "U GRAVE", "U ACUTE", "U CIRCUMFLEX", /*215*/ "multiplied by", "O STROKE", "U GRAVE", "U ACUTE", "U CIRCUMFLEX", /*220*/ "U OOMLAUT", "Y ACUTE", "THORN", "sharp s", "a grave", /*225*/ "a acute", "a circumflex", "a tilde", "a oomlaut", "a ring", /*230*/ "ae", "c cidella", "e grave", "e acute", /*234*/ "e circumflex", "e oomlaut", "i grave", "i acute", "i circumflex", /*239*/ "i oomlaut", "eth", "n tilde","o grave", "o acute", "o circumflex", /*245*/"o tilde", "o oomlaut", "divided by", "o stroke", "u grave", "u acute", /*234*/ "e circumflex", "e oomlaut", "i grave", "i acute", "i circumflex", /*239*/ "i oomlaut", "eth", "n tilde", "o grave", "o acute", "o circumflex", /*245*/ "o tilde", "o oomlaut", "divided by", "o stroke", "u grave", "u acute", /* 251 */ "u circumflex", "u oomlaut", "y acute", "thorn", "y oomlaut" }; Loading @@ -198,11 +215,16 @@ PUNC, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* `abcdefg */ ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* hijklmno */ ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* pqrstuvw */ ALPHA, ALPHA, ALPHA, PUNC, PUNC, PUNC, PUNC, 0, /* xyz{|}~ */ B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 128-135 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, /* 136-143 */ B_CAPSYM, B_CAPSYM, B_SYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 144-151 */ B_SYM, B_SYM, B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 152-159 */ WDLM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, B_SYM, /* 160-167 */ B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 128-134 */ B_SYM, /* 135 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 136-142 */ B_CAPSYM, /* 143 */ B_CAPSYM, B_CAPSYM, B_SYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, /* 144-150 */ B_SYM, /* 151 */ B_SYM, B_SYM, B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, /*152-158 */ B_SYM, /* 159 */ WDLM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, /* 160-166 */ B_SYM, /* 167 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 168-175 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 176-183 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 184-191 */ Loading Loading @@ -506,12 +528,12 @@ static void say_next_char(struct vc_data *vc) } /* get_word - will first check to see if the character under the reading cursor is a space and if say_word_ctl is true it will return the word space. If say_word_ctl is not set it will check to see if there is a word starting on the next position to the right and return that word if it exists. If it does not exist it will move left to the beginning of any previous word on the line or the beginning off the line whichever comes first.. */ * reading cursor is a space and if say_word_ctl is true it will * return the word space. If say_word_ctl is not set it will check to * see if there is a word starting on the next position to the right * and return that word if it exists. If it does not exist it will * move left to the beginning of any previous word on the line or the * beginning off the line whichever comes first.. */ static u_long get_word(struct vc_data *vc) { Loading @@ -529,7 +551,8 @@ static u_long get_word(struct vc_data *vc) return 0; } else if ((tmpx < vc->vc_cols - 2) && (ch == SPACE || ch == 0 || IS_WDLM(ch)) && ((char) get_char(vc, (u_short *) &tmp_pos+1, &temp) > SPACE)) { && ((char)get_char(vc, (u_short *) &tmp_pos + 1, &temp) > SPACE)) { tmp_pos += 2; tmpx++; } else Loading @@ -548,7 +571,8 @@ static u_long get_word(struct vc_data *vc) tmp_pos += 2; tmpx++; ch = (char)get_char(vc, (u_short *) tmp_pos, &temp); if ((ch == SPACE) || ch == 0 || (IS_WDLM(buf[cnt-1]) && (ch > SPACE))) if ((ch == SPACE) || ch == 0 || (IS_WDLM(buf[cnt - 1]) && (ch > SPACE))) break; buf[cnt++] = ch; } Loading Loading @@ -730,8 +754,9 @@ static void say_line(struct vc_data *vc) } buf[i++] = '\n'; if (this_speakup_key == SAY_LINE_INDENT) { for (cp = buf; *cp == SPACE; cp++) ; cp = buf; while (*cp == SPACE) cp++; synth_printf("%d, ", (cp - buf) + 1); } punc_mask = punc_masks[reading_punc]; Loading Loading @@ -805,8 +830,6 @@ static void say_line_from_to(struct vc_data *vc, u_long from, u_long to, /* Sentence Reading Commands */ void synth_insert_next_index(int); static int currsentence; static int numsentences[2]; static char *sentbufend[2]; Loading Loading @@ -1024,9 +1047,9 @@ static void say_to_right(struct vc_data *vc) static void spkup_write(const char *in_buf, int count) { static int rep_count = 0; static int rep_count; static u_char ch = '\0', old_ch = '\0'; static u_short char_type = 0, last_type = 0; static u_short char_type, last_type; int in_count = count; spk_keydown = 0; while (count--) { Loading @@ -1044,7 +1067,8 @@ static void spkup_write(const char *in_buf, int count) } else { if ((last_type & CH_RPT) && rep_count > 2) { synth_printf(" "); synth_printf(msg_get(MSG_REPEAT_DESC), ++rep_count); synth_printf(msg_get(MSG_REPEAT_DESC), ++rep_count); synth_printf(" "); } rep_count = 0; Loading @@ -1064,9 +1088,12 @@ static void spkup_write(const char *in_buf, int count) speak_char(ch); char_type &= ~PUNC; /* for dec nospell processing */ } else if (char_type & SYNTH_OK) { /* these are usually puncts like . and , which synth needs for expression. * suppress multiple to get rid of long pausesand clear repeat count so if *someone has repeats on you don't get nothing repeated count */ /* these are usually puncts like . and , which synth * needs for expression. * suppress multiple to get rid of long pauses and * clear repeat count * so if someone has * repeats on you don't get nothing repeated count */ if (ch != old_ch) synth_printf("%c", ch); else Loading Loading @@ -1205,7 +1232,6 @@ static struct var_t spk_vars[] = { V_LAST_VAR }; static void toggle_cursoring(struct vc_data *vc) { if (cursor_track == read_all_mode) Loading Loading @@ -1234,7 +1260,7 @@ void reset_default_chartab(void) memcpy(spk_chartab, default_chartab, sizeof(default_chartab)); } static const struct st_bits_data *pb_edit = NULL; static const struct st_bits_data *pb_edit; static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key) { Loading @@ -1251,7 +1277,8 @@ static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key) spk_chartab[ch] ^= mask; speak_char(ch); synth_printf(" %s\n", (spk_chartab[ch]&mask) ? msg_get(MSG_ON) : msg_get(MSG_OFF)); (spk_chartab[ch] & mask) ? msg_get(MSG_ON) : msg_get(MSG_OFF)); return 1; } Loading Loading @@ -1290,9 +1317,6 @@ static void reset_highlight_buffers(struct vc_data *); static int read_all_key; void reset_index_count(int); void get_index_count(int *, int *); /*int synth_supports_indexing(void); */ static void start_read_all_timer(struct vc_data *vc, int command); enum { Loading @@ -1307,16 +1331,14 @@ enum { RA_FIND_PREV_SENT, }; static void kbd_fakekey2(struct vc_data *vc, int command) static void kbd_fakekey2(struct vc_data *vc, int command) { del_timer(&cursor_timer); speakup_fake_down_arrow(); start_read_all_timer(vc, command); } static void read_all_doc(struct vc_data *vc) static void read_all_doc(struct vc_data *vc) { if ((vc->vc_num != fg_console) || synth == NULL || spk_shut_up) return; Loading @@ -1335,8 +1357,7 @@ read_all_doc(struct vc_data *vc) } } static void stop_read_all(struct vc_data *vc) static void stop_read_all(struct vc_data *vc) { del_timer(&cursor_timer); cursor_track = prev_cursor_track; Loading @@ -1344,19 +1365,18 @@ stop_read_all(struct vc_data *vc) do_flush(); } static void start_read_all_timer(struct vc_data *vc, int command) static void start_read_all_timer(struct vc_data *vc, int command) { struct var_t *cursor_timeout; cursor_con = vc->vc_num; read_all_key = command; cursor_timeout = get_var(CURSOR_TIME); mod_timer(&cursor_timer, jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); mod_timer(&cursor_timer, jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); } static void handle_cursor_read_all(struct vc_data *vc, int command) static void handle_cursor_read_all(struct vc_data *vc, int command) { int indcount, sentcount, rv, sn; Loading Loading @@ -1473,12 +1493,12 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag) if (cursor_track == CT_Highlight) reset_highlight_buffers(vc); cursor_timeout = get_var(CURSOR_TIME); mod_timer(&cursor_timer, jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); mod_timer(&cursor_timer, jiffies + msecs_to_jiffies(cursor_timeout->u.n.value)); spk_unlock(flags); } static void update_color_buffer(struct vc_data *vc , const char *ic , int len) static void update_color_buffer(struct vc_data *vc, const char *ic, int len) { int i, bi, hi; int vc_num = vc->vc_num; Loading Loading @@ -1509,8 +1529,7 @@ update_color_buffer(struct vc_data *vc , const char *ic , int len) speakup_console[vc_num]->ht.highsize[bi] = hi; } static void reset_highlight_buffers(struct vc_data *vc) static void reset_highlight_buffers(struct vc_data *vc) { int i; int vc_num = vc->vc_num; Loading @@ -1518,8 +1537,7 @@ reset_highlight_buffers(struct vc_data *vc) speakup_console[vc_num]->ht.highsize[i] = 0; } static int count_highlight_color(struct vc_data *vc) static int count_highlight_color(struct vc_data *vc) { int i, bg; int cc; Loading Loading @@ -1548,8 +1566,7 @@ count_highlight_color(struct vc_data *vc) return cc; } static int get_highlight_color(struct vc_data *vc) static int get_highlight_color(struct vc_data *vc) { int i, j; unsigned int cptr[8], tmp; Loading @@ -1574,8 +1591,7 @@ get_highlight_color(struct vc_data *vc) return -1; } static int speak_highlight(struct vc_data *vc) static int speak_highlight(struct vc_data *vc) { int hc, d; int vc_num = vc->vc_num; Loading @@ -1599,8 +1615,7 @@ speak_highlight(struct vc_data *vc) return 0; } static void cursor_done(u_long data) static void cursor_done(u_long data) { struct vc_data *vc = vc_cons[cursor_con].d; unsigned long flags; Loading Loading @@ -1691,8 +1706,7 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len) spk_unlock(flags); } void speakup_con_update(struct vc_data *vc) void speakup_con_update(struct vc_data *vc) { unsigned long flags; if (speakup_console[vc->vc_num] == NULL || spk_parked) Loading Loading @@ -1741,8 +1755,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag) spk_unlock(flags); } static int inc_dec_var(u_char value) static int inc_dec_var(u_char value) { struct st_var_header *p_header; struct var_t *var_data; Loading Loading @@ -1774,8 +1787,7 @@ inc_dec_var(u_char value) return 0; } static void speakup_win_set(struct vc_data *vc) static void speakup_win_set(struct vc_data *vc) { char info[40]; if (win_start > 1) { Loading Loading @@ -1808,8 +1820,7 @@ speakup_win_set(struct vc_data *vc) win_start++; } static void speakup_win_clear(struct vc_data *vc) static void speakup_win_clear(struct vc_data *vc) { win_top = win_bottom = 0; win_left = win_right = 0; Loading @@ -1817,8 +1828,7 @@ speakup_win_clear(struct vc_data *vc) synth_printf("%s\n", msg_get(MSG_WINDOW_CLEARED)); } static void speakup_win_enable(struct vc_data *vc) static void speakup_win_enable(struct vc_data *vc) { if (win_start < 2) { synth_printf("%s\n", msg_get(MSG_NO_WINDOW)); Loading @@ -1831,8 +1841,7 @@ speakup_win_enable(struct vc_data *vc) synth_printf("%s\n", msg_get(MSG_WINDOW_SILENCE_DISABLED)); } static void speakup_bits(struct vc_data *vc) static void speakup_bits(struct vc_data *vc) { int val = this_speakup_key - (FIRST_EDIT_BITS - 1); if (special_handler != NULL || val < 1 || val > 6) { Loading @@ -1847,7 +1856,7 @@ speakup_bits(struct vc_data *vc) static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) { static u_char *goto_buf = "\0\0\0\0\0\0"; static int num = 0; static int num; int maxlen, go_pos; char *cp; if (type == KT_SPKUP && ch == SPEAKUP_GOTO) Loading Loading @@ -1924,8 +1933,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) return 1; } static void speakup_goto(struct vc_data *vc) static void speakup_goto(struct vc_data *vc) { if (special_handler != NULL) { synth_printf("%s\n", msg_get(MSG_ERROR)); Loading @@ -1941,15 +1949,14 @@ static void speakup_help(struct vc_data *vc) handle_help(vc, KT_SPKUP, SPEAKUP_HELP, 0); } static void do_nothing(struct vc_data *vc) static void do_nothing(struct vc_data *vc) { return; /* flush done in do_spkup */ } static u_char key_speakup, spk_key_locked; static void speakup_lock(struct vc_data *vc) static void speakup_lock(struct vc_data *vc) { if (!spk_key_locked) spk_key_locked = key_speakup = 16; Loading Loading @@ -2013,8 +2020,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, tty = vc->port.tty; if (type >= 0xf0) type -= 0xf0; if (type == KT_PAD && (vc_kbd_led(kbd_table + fg_console, VC_NUMLOCK))) { if (type == KT_PAD && (vc_kbd_led(kbd_table + fg_console, VC_NUMLOCK))) { if (up_flag) { spk_keydown = 0; goto out; Loading Loading @@ -2150,10 +2157,8 @@ static int keyboard_notifier_call(struct notifier_block *nb, case KBD_KEYSYM: if (speakup_key(vc, param->shift, keycode, param->value, up)) ret = NOTIFY_STOP; else if (KTYP(param->value) == KT_CUR) ret = pre_handle_cursor(vc, KVAL(param->value), up); else if (KTYP(param->value) == KT_CUR) ret = pre_handle_cursor(vc, KVAL(param->value), up); break; case KBD_POST_KEYSYM:{ unsigned char type = KTYP(param->value) - 0xf0; Loading Loading @@ -2195,8 +2200,7 @@ static int vt_notifier_call(struct notifier_block *nb, case VT_WRITE: if (param->c == '\b') speakup_bs(vc); else if (param->c < 0x100) { else if (param->c < 0x100) { char d = param->c; speakup_con_write(vc, &d, 1); } Loading Loading @@ -2269,7 +2273,8 @@ static int __init speakup_init(void) spk_vars[0].u.n.high = vc->vc_cols; for (var = spk_vars; var->var_id != MAXVARS; var++) speakup_register_var(var); for (var = synth_time_vars; (var->var_id >= 0) && (var->var_id < MAXVARS); var++) for (var = synth_time_vars; (var->var_id >= 0) && (var->var_id < MAXVARS); var++) speakup_register_var(var); for (i = 1; punc_info[i].mask != 0; i++) set_mask_bits(0, i, 2); Loading Loading @@ -2298,7 +2303,5 @@ static int __init speakup_init(void) return 0; } module_init(speakup_init); module_exit(speakup_exit);
drivers/staging/speakup/speakup.h +3 −0 Original line number Diff line number Diff line Loading @@ -54,6 +54,9 @@ extern int speakup_thread(void *data); extern void reset_default_chars(void); extern void reset_default_chartab(void); extern void synth_start(void); void synth_insert_next_index(int sent_num); void reset_index_count(int sc); void get_index_count(int *linecount, int *sentcount); extern int set_key_info(const u_char *key_info, u_char *k_buffer); extern char *strlwr(char *s); extern char *speakup_s2i(char *start, int *dest); Loading