Commit 16d35515 authored by William Hubbs's avatar William Hubbs Committed by Greg Kroah-Hartman

staging: speakup: main.c style fixes

- fix issues reported by checkpatch.pl
- run code through Lindent
- move some prototypes to speakup.h
Signed-off-by: default avatarWilliam Hubbs <w.d.hubbs@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent f976520b
/* speakup.c /* speakup.c
review functions for the speakup screen review package. * review functions for the speakup screen review package.
originally written by: Kirk Reiser and Andy Berdan. * originally written by: Kirk Reiser and Andy Berdan.
*
extensively modified by David Borowski. * extensively modified by David Borowski.
*
Copyright (C) 1998 Kirk Reiser. ** Copyright (C) 1998 Kirk Reiser.
Copyright (C) 2003 David Borowski. * Copyright (C) 2003 David Borowski.
*
This program is free software; you can redistribute it and/or modify * 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 * it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or * the Free Software Foundation; either version 2 of the License, or
(at your option) any later version. * (at your option) any later version.
*
This program is distributed in the hope that it will be useful, * This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. * GNU General Public License for more details.
*
You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software * along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/ */
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/version.h> #include <linux/version.h>
#include <linux/vt.h> #include <linux/vt.h>
#include <linux/tty.h> #include <linux/tty.h>
#include <linux/mm.h> /* __get_free_page() and friends */ #include <linux/mm.h> /* __get_free_page() and friends */
#include <linux/vt_kern.h> #include <linux/vt_kern.h>
#include <linux/ctype.h> #include <linux/ctype.h>
#include <linux/selection.h> #include <linux/selection.h>
...@@ -34,7 +34,7 @@ ...@@ -34,7 +34,7 @@
#include <linux/jiffies.h> #include <linux/jiffies.h>
#include <linux/kthread.h> #include <linux/kthread.h>
#include <linux/keyboard.h> /* for KT_SHIFT */ #include <linux/keyboard.h> /* for KT_SHIFT */
#include <linux/kbd_kern.h> /* for vc_kbd_* and friends */ #include <linux/kbd_kern.h> /* for vc_kbd_* and friends */
#include <linux/input.h> #include <linux/input.h>
#include <linux/kmod.h> #include <linux/kmod.h>
...@@ -50,7 +50,7 @@ ...@@ -50,7 +50,7 @@
#include <linux/spinlock.h> #include <linux/spinlock.h>
#include <linux/notifier.h> #include <linux/notifier.h>
#include <linux/uaccess.h> /* copy_from|to|user() and others */ #include <linux/uaccess.h> /* copy_from|to|user() and others */
#include "spk_priv.h" #include "spk_priv.h"
#include "speakup.h" #include "speakup.h"
...@@ -81,18 +81,19 @@ int key_echo, say_word_ctl; ...@@ -81,18 +81,19 @@ int key_echo, say_word_ctl;
int say_ctrl, bell_pos; int say_ctrl, bell_pos;
short punc_mask; short punc_mask;
int punc_level, reading_punc; int punc_level, reading_punc;
char str_caps_start[MAXVARLEN+1] = "\0", str_caps_stop[MAXVARLEN+1] = "\0"; char str_caps_start[MAXVARLEN + 1] = "\0", str_caps_stop[MAXVARLEN + 1] = "\0";
const struct st_bits_data punc_info[] = { const struct st_bits_data punc_info[] = {
{ "none", "", 0 }, {"none", "", 0},
{ "some", "/$%&@", SOME }, {"some", "/$%&@", SOME},
{ "most", "$%&#()=+*/@^<>|\\", MOST }, {"most", "$%&#()=+*/@^<>|\\", MOST},
{ "all", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", PUNC }, {"all", "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~", PUNC},
{ "delimiters", "", B_WDLM }, {"delimiters", "", B_WDLM},
{ "repeats", "()", CH_RPT }, {"repeats", "()", CH_RPT},
{ "extended numeric", "", B_EXNUM }, {"extended numeric", "", B_EXNUM},
{ "symbols", "", B_SYM }, {"symbols", "", B_SYM},
{ 0, 0 } {0, 0}
}; };
static char mark_cut_flag; static char mark_cut_flag;
#define MAX_KEY 160 #define MAX_KEY 160
u_char *our_keys[MAX_KEY], *shift_table; u_char *our_keys[MAX_KEY], *shift_table;
...@@ -118,10 +119,10 @@ static struct tty_struct *tty; ...@@ -118,10 +119,10 @@ static struct tty_struct *tty;
static void spkup_write(const char *in_buf, int count); static void spkup_write(const char *in_buf, int count);
static char *phonetic[] = { static char *phonetic[] = {
"alfa", "bravo", "charlie", "delta", "echo", "foxtrot", "golf", "hotel", "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", "keh beck", "romeo", "sierra", "tango", "uniform", "victer", "whiskey",
"x ray", "yankee", "zulu" "x ray", "yankee", "zulu"
}; };
...@@ -132,12 +133,15 @@ static char *phonetic[] = { ...@@ -132,12 +133,15 @@ static char *phonetic[] = {
char *characters[256]; char *characters[256];
char *default_chars[256] = { char *default_chars[256] = {
/*000*/ "null", "^a", "^b", "^c", "^d", "^e", "^f", "^g", /*000*/ "null", "^a", "^b", "^c", "^d", "^e", "^f", "^g",
/*008*/ "^h", "^i", "^j", "^k", "^l", "^m", "^n", "^o", /*008*/ "^h", "^i", "^j", "^k", "^l", "^m", "^n", "^o",
/*016*/ "^p", "^q", "^r", "^s", "^t", "^u", "^v", "^w", /*016*/ "^p", "^q", "^r", "^s", "^t", "^u", "^v", "^w",
/*024*/ "^x", "^y", "^z", "control", "control", "control", "control", "control", /*024*/ "^x", "^y", "^z", "control", "control", "control", "control",
/*032*/ "space", "bang!", "quote", "number", "dollar", "percent", "and", "tick", "control",
/*040*/ "left paren", "right paren", "star", "plus", "comma", "dash", "dot", /*032*/ "space", "bang!", "quote", "number", "dollar", "percent", "and",
"tick",
/*040*/ "left paren", "right paren", "star", "plus", "comma", "dash",
"dot",
"slash", "slash",
/*048*/ "zero", "one", "two", "three", "four", "five", "six", "seven", /*048*/ "zero", "one", "two", "three", "four", "five", "six", "seven",
"eight", "nine", "eight", "nine",
...@@ -145,34 +149,47 @@ char *default_chars[256] = { ...@@ -145,34 +149,47 @@ char *default_chars[256] = {
/*065*/ "EIGH", "B", "C", "D", "E", "F", "G", /*065*/ "EIGH", "B", "C", "D", "E", "F", "G",
/*072*/ "H", "I", "J", "K", "L", "M", "N", "O", /*072*/ "H", "I", "J", "K", "L", "M", "N", "O",
/*080*/ "P", "Q", "R", "S", "T", "U", "V", "W", "X", /*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", "line",
/*096*/ "accent", "a", "b", "c", "d", "e", "f", "g", /*096*/ "accent", "a", "b", "c", "d", "e", "f", "g",
/*104*/ "h", "i", "j", "k", "l", "m", "n", "o", /*104*/ "h", "i", "j", "k", "l", "m", "n", "o",
/*112*/ "p", "q", "r", "s", "t", "u", "v", "w", /*112*/ "p", "q", "r", "s", "t", "u", "v", "w",
/*120*/ "x", "y", "zed", "left brace", "bar", "right brace", "tihlduh", /*120*/ "x", "y", "zed", "left brace", "bar", "right brace", "tihlduh",
/*127*/ "del", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", /*127*/ "del", "control", "control", "control", "control", "control",
/*138*/ "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control", "control",
/*150*/ "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", /*160*/ "nbsp", "inverted bang",
/*162*/ "cents", "pounds", "currency", "yen", "broken bar", "section", /*162*/ "cents", "pounds", "currency", "yen", "broken bar", "section",
/*168*/ "diaeresis", "copyright", "female ordinal", "double left angle", /*168*/ "diaeresis", "copyright", "female ordinal", "double left angle",
/*172*/ "not", "soft hyphen", "registered", "macron", /*172*/ "not", "soft hyphen", "registered", "macron",
/*176*/ "degrees", "plus or minus", "super two", "super three", /*176*/ "degrees", "plus or minus", "super two", "super three",
/*180*/ "acute accent", "micro", "pilcrow", "middle dot", /*180*/ "acute accent", "micro", "pilcrow", "middle dot",
/*184*/ "cedilla", "super one", "male ordinal", "double right angle", /*184*/ "cedilla", "super one", "male ordinal", "double right angle",
/*188*/ "one quarter", "one half", "three quarters", "inverted question", /*188*/ "one quarter", "one half", "three quarters",
/*192*/ "A GRAVE", "A ACUTE", "A CIRCUMFLEX", "A TILDE", "A OOMLAUT", "A RING", "inverted question",
/*198*/ "AE", "C CIDELLA", "E GRAVE", "E ACUTE", "E CIRCUMFLEX", "E OOMLAUT", /*192*/ "A GRAVE", "A ACUTE", "A CIRCUMFLEX", "A TILDE", "A OOMLAUT",
/*204*/ "I GRAVE", "I ACUTE", "I CIRCUMFLEX", "I OOMLAUT", "ETH", "N TILDE", "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", /*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", /*220*/ "U OOMLAUT", "Y ACUTE", "THORN", "sharp s", "a grave",
/*225*/ "a acute", "a circumflex", "a tilde", "a oomlaut", "a ring", /*225*/ "a acute", "a circumflex", "a tilde", "a oomlaut", "a ring",
/*230*/ "ae", "c cidella", "e grave", "e acute", /*230*/ "ae", "c cidella", "e grave", "e acute",
/*234*/ "e circumflex", "e oomlaut", "i grave", "i acute", "i circumflex", /*234*/ "e circumflex", "e oomlaut", "i grave", "i acute",
/*239*/ "i oomlaut", "eth", "n tilde","o grave", "o acute", "o circumflex", "i circumflex",
/*245*/"o tilde", "o oomlaut", "divided by", "o stroke", "u grave", "u acute", /*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" /* 251 */ "u circumflex", "u oomlaut", "y acute", "thorn", "y oomlaut"
}; };
...@@ -182,38 +199,43 @@ char *default_chars[256] = { ...@@ -182,38 +199,43 @@ char *default_chars[256] = {
u_short spk_chartab[256]; u_short spk_chartab[256];
static u_short default_chartab[256] = { static u_short default_chartab[256] = {
B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /* 0-7 */ B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /* 0-7 */
B_CTL, B_CTL, A_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /* 8-15 */ B_CTL, B_CTL, A_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /* 8-15 */
B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /*16-23 */ B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /*16-23 */
B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /* 24-31 */ B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, B_CTL, /* 24-31 */
WDLM, A_PUNC, PUNC, PUNC, PUNC, PUNC, PUNC, A_PUNC, /* !"#$%&' */ WDLM, A_PUNC, PUNC, PUNC, PUNC, PUNC, PUNC, A_PUNC, /* !"#$%&' */
PUNC, PUNC, PUNC, PUNC, A_PUNC, A_PUNC, A_PUNC, PUNC, /* ()*+, -./ */ PUNC, PUNC, PUNC, PUNC, A_PUNC, A_PUNC, A_PUNC, PUNC, /* ()*+, -./ */
NUM, NUM, NUM, NUM, NUM, NUM, NUM, NUM, /* 01234567 */ NUM, NUM, NUM, NUM, NUM, NUM, NUM, NUM, /* 01234567 */
NUM, NUM, A_PUNC, PUNC, PUNC, PUNC, PUNC, A_PUNC, /* 89:;<=>? */ NUM, NUM, A_PUNC, PUNC, PUNC, PUNC, PUNC, A_PUNC, /* 89:;<=>? */
PUNC, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* @ABCDEFG */ PUNC, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* @ABCDEFG */
A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* HIJKLMNO */ A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* HIJKLMNO */
A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* PQRSTUVW */ A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* PQRSTUVW */
A_CAP, A_CAP, A_CAP, PUNC, PUNC, PUNC, PUNC, PUNC, /* XYZ[\]^_ */ A_CAP, A_CAP, A_CAP, PUNC, PUNC, PUNC, PUNC, PUNC, /* XYZ[\]^_ */
PUNC, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* `abcdefg */ 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, /* hijklmno */
ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* pqrstuvw */ ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* pqrstuvw */
ALPHA, ALPHA, ALPHA, PUNC, PUNC, PUNC, PUNC, 0, /* xyz{|}~ */ 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_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 128-134 */
B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, /* 136-143 */ B_SYM, /* 135 */
B_CAPSYM, B_CAPSYM, B_SYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 144-151 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 136-142 */
B_SYM, B_SYM, B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 152-159 */ B_CAPSYM, /* 143 */
WDLM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, B_SYM, /* 160-167 */ B_CAPSYM, B_CAPSYM, B_SYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, /* 144-150 */
B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 168-175 */ B_SYM, /* 151 */
B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 176-183 */ B_SYM, B_SYM, B_CAPSYM, B_CAPSYM, B_SYM, B_SYM, B_SYM, /*152-158 */
B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 184-191 */ B_SYM, /* 159 */
A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* 192-199 */ WDLM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_CAPSYM, /* 160-166 */
A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* 200-207 */ B_SYM, /* 167 */
A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, B_SYM, /* 208-215 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 168-175 */
A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, ALPHA, /* 216-223 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 176-183 */
ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* 224-231 */ B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, B_SYM, /* 184-191 */
ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* 232-239 */ A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* 192-199 */
ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, B_SYM, /* 240-247 */ A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, /* 200-207 */
ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA /* 248-255 */ A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, B_SYM, /* 208-215 */
A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, A_CAP, ALPHA, /* 216-223 */
ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* 224-231 */
ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, /* 232-239 */
ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, B_SYM, /* 240-247 */
ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA, ALPHA /* 248-255 */
}; };
struct task_struct *speakup_task; struct task_struct *speakup_task;
...@@ -243,7 +265,7 @@ struct notifier_block vt_notifier_block = { ...@@ -243,7 +265,7 @@ struct notifier_block vt_notifier_block = {
static unsigned char get_attributes(u16 *pos) static unsigned char get_attributes(u16 *pos)
{ {
return (u_char)(scr_readw(pos) >> 8); return (u_char) (scr_readw(pos) >> 8);
} }
static void speakup_date(struct vc_data *vc) static void speakup_date(struct vc_data *vc)
...@@ -262,9 +284,9 @@ static void bleep(u_short val) ...@@ -262,9 +284,9 @@ static void bleep(u_short val)
}; };
short freq; short freq;
int time = bleep_time; int time = bleep_time;
freq = vals[val%12]; freq = vals[val % 12];
if (val > 11) if (val > 11)
freq *= (1 << (val/12)); freq *= (1 << (val / 12));
unprocessed_sound.freq = freq; unprocessed_sound.freq = freq;
unprocessed_sound.jiffies = msecs_to_jiffies(time); unprocessed_sound.jiffies = msecs_to_jiffies(time);
unprocessed_sound.active = 1; unprocessed_sound.active = 1;
...@@ -345,14 +367,14 @@ static void speakup_cut(struct vc_data *vc) ...@@ -345,14 +367,14 @@ static void speakup_cut(struct vc_data *vc)
switch (ret) { switch (ret) {
case 0: case 0:
break; /* no error */ break; /* no error */
case -EFAULT : case -EFAULT:
pr_warn("%sEFAULT\n", err_buf); pr_warn("%sEFAULT\n", err_buf);
break; break;
case -EINVAL : case -EINVAL:
pr_warn("%sEINVAL\n", err_buf); pr_warn("%sEINVAL\n", err_buf);
break; break;
case -ENOMEM : case -ENOMEM:
pr_warn("%sENOMEM\n", err_buf); pr_warn("%sENOMEM\n", err_buf);
break; break;
} }
...@@ -436,7 +458,7 @@ static void speak_char(u_char ch) ...@@ -436,7 +458,7 @@ static void speak_char(u_char ch)
synth_buffer_add(SPACE); synth_buffer_add(SPACE);
} }
static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs) static u16 get_char(struct vc_data *vc, u16 * pos, u_char * attribs)
{ {
u16 ch = ' '; u16 ch = ' ';
if (vc && pos) { if (vc && pos) {
...@@ -506,12 +528,12 @@ static void say_next_char(struct vc_data *vc) ...@@ -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 /* 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 * 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 * 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 * 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 * 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 * move left to the beginning of any previous word on the line or the
beginning off the line whichever comes first.. */ * beginning off the line whichever comes first.. */
static u_long get_word(struct vc_data *vc) static u_long get_word(struct vc_data *vc)
{ {
...@@ -520,7 +542,7 @@ static u_long get_word(struct vc_data *vc) ...@@ -520,7 +542,7 @@ static u_long get_word(struct vc_data *vc)
u_short attr_ch; u_short attr_ch;
u_char temp; u_char temp;
spk_old_attr = spk_attr; spk_old_attr = spk_attr;
ch = (char) get_char(vc, (u_short *) tmp_pos, &temp); ch = (char)get_char(vc, (u_short *) tmp_pos, &temp);
/* decided to take out the sayword if on a space (mis-information */ /* decided to take out the sayword if on a space (mis-information */
if (say_word_ctl && ch == SPACE) { if (say_word_ctl && ch == SPACE) {
...@@ -529,15 +551,16 @@ static u_long get_word(struct vc_data *vc) ...@@ -529,15 +551,16 @@ static u_long get_word(struct vc_data *vc)
return 0; return 0;
} else if ((tmpx < vc->vc_cols - 2) } else if ((tmpx < vc->vc_cols - 2)
&& (ch == SPACE || ch == 0 || IS_WDLM(ch)) && (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; tmp_pos += 2;
tmpx++; tmpx++;
} else } else
while (tmpx > 0) { while (tmpx > 0) {
ch = (char) get_char(vc, (u_short *) tmp_pos - 1, &temp); ch = (char)get_char(vc, (u_short *) tmp_pos - 1, &temp);
if ((ch == SPACE || ch == 0 || IS_WDLM(ch)) if ((ch == SPACE || ch == 0 || IS_WDLM(ch))
&& ((char) get_char(vc, (u_short *) tmp_pos, &temp) > && ((char)get_char(vc, (u_short *) tmp_pos, &temp) >
SPACE)) SPACE))
break; break;
tmp_pos -= 2; tmp_pos -= 2;
tmpx--; tmpx--;
...@@ -547,8 +570,9 @@ static u_long get_word(struct vc_data *vc) ...@@ -547,8 +570,9 @@ static u_long get_word(struct vc_data *vc)
while (tmpx < vc->vc_cols - 1) { while (tmpx < vc->vc_cols - 1) {
tmp_pos += 2; tmp_pos += 2;
tmpx++; tmpx++;
ch = (char) get_char(vc, (u_short *) tmp_pos, &temp); 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; break;
buf[cnt++] = ch; buf[cnt++] = ch;
} }
...@@ -598,8 +622,8 @@ static void say_prev_word(struct vc_data *vc) ...@@ -598,8 +622,8 @@ static void say_prev_word(struct vc_data *vc)
spk_x = vc->vc_cols - 1; spk_x = vc->vc_cols - 1;
} else } else
spk_x--; spk_x--;
spk_pos -= 2; spk_pos -= 2;
ch = (char) get_char(vc, (u_short *) spk_pos, &temp); ch = (char)get_char(vc, (u_short *) spk_pos, &temp);
if (ch == SPACE || ch == 0) if (ch == SPACE || ch == 0)
state = 0; state = 0;
else if (IS_WDLM(ch)) else if (IS_WDLM(ch))
...@@ -632,7 +656,7 @@ static void say_next_word(struct vc_data *vc) ...@@ -632,7 +656,7 @@ static void say_next_word(struct vc_data *vc)
return; return;
} }
while (1) { while (1) {
ch = (char) get_char(vc, (u_short *) spk_pos, &temp); ch = (char)get_char(vc, (u_short *) spk_pos, &temp);
if (ch == SPACE || ch == 0) if (ch == SPACE || ch == 0)
state = 0; state = 0;
else if (IS_WDLM(ch)) else if (IS_WDLM(ch))
...@@ -675,7 +699,7 @@ static void spell_word(struct vc_data *vc) ...@@ -675,7 +699,7 @@ static void spell_word(struct vc_data *vc)
str_cap = str_caps_start; str_cap = str_caps_start;
if (*str_caps_stop) if (*str_caps_stop)
pitch_shift++; pitch_shift++;
else /* synth has no pitch */ else /* synth has no pitch */
last_cap = str_caps_stop; last_cap = str_caps_stop;
} else } else
str_cap = str_caps_stop; str_cap = str_caps_stop;
...@@ -730,8 +754,9 @@ static void say_line(struct vc_data *vc) ...@@ -730,8 +754,9 @@ static void say_line(struct vc_data *vc)
} }
buf[i++] = '\n'; buf[i++] = '\n';
if (this_speakup_key == SAY_LINE_INDENT) { 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); synth_printf("%d, ", (cp - buf) + 1);
} }
punc_mask = punc_masks[reading_punc]; punc_mask = punc_masks[reading_punc];
...@@ -772,7 +797,7 @@ static int say_from_to(struct vc_data *vc, u_long from, u_long to, ...@@ -772,7 +797,7 @@ static int say_from_to(struct vc_data *vc, u_long from, u_long to,
spk_old_attr = spk_attr; spk_old_attr = spk_attr;
spk_attr = get_attributes((u_short *) from); spk_attr = get_attributes((u_short *) from);
while (from < to) { while (from < to) {
buf[i++] = (char) get_char(vc, (u_short *) from, &tmp); buf[i++] = (char)get_char(vc, (u_short *) from, &tmp);
from += 2; from += 2;
if (i >= vc->vc_size_row) if (i >= vc->vc_size_row)
break; break;
...@@ -805,8 +830,6 @@ static void say_line_from_to(struct vc_data *vc, u_long from, u_long to, ...@@ -805,8 +830,6 @@ static void say_line_from_to(struct vc_data *vc, u_long from, u_long to,
/* Sentence Reading Commands */ /* Sentence Reading Commands */
void synth_insert_next_index(int);
static int currsentence; static int currsentence;
static int numsentences[2]; static int numsentences[2];
static char *sentbufend[2]; static char *sentbufend[2];
...@@ -815,7 +838,7 @@ static int currbuf; ...@@ -815,7 +838,7 @@ static int currbuf;
static int bn; static int bn;
static char sentbuf[2][256]; static char sentbuf[2][256];
static int say_sentence_num(int num , int prev) static int say_sentence_num(int num, int prev)
{ {
bn = currbuf; bn = currbuf;
currsentence = num + 1; currsentence = num + 1;
...@@ -840,7 +863,7 @@ static int get_sentence_buf(struct vc_data *vc, int read_punc) ...@@ -840,7 +863,7 @@ static int get_sentence_buf(struct vc_data *vc, int read_punc)
currbuf = 0; currbuf = 0;
bn = currbuf; bn = currbuf;
start = vc->vc_origin + ((spk_y) * vc->vc_size_row); start = vc->vc_origin + ((spk_y) * vc->vc_size_row);
end = vc->vc_origin+((spk_y) * vc->vc_size_row) + vc->vc_cols * 2; end = vc->vc_origin + ((spk_y) * vc->vc_size_row) + vc->vc_cols * 2;
numsentences[bn] = 0; numsentences[bn] = 0;
sentmarks[bn][0] = &sentbuf[bn][0]; sentmarks[bn][0] = &sentbuf[bn][0];
...@@ -849,14 +872,14 @@ static int get_sentence_buf(struct vc_data *vc, int read_punc) ...@@ -849,14 +872,14 @@ static int get_sentence_buf(struct vc_data *vc, int read_punc)
spk_attr = get_attributes((u_short *) start); spk_attr = get_attributes((u_short *) start);
while (start < end) { while (start < end) {
sentbuf[bn][i] = (char) get_char(vc, (u_short *) start, &tmp); sentbuf[bn][i] = (char)get_char(vc, (u_short *) start, &tmp);
if (i > 0) { if (i > 0) {
if (sentbuf[bn][i] == SPACE && sentbuf[bn][i-1] == '.' if (sentbuf[bn][i] == SPACE && sentbuf[bn][i - 1] == '.'
&& numsentences[bn] < 9) { && numsentences[bn] < 9) {
/* Sentence Marker */ /* Sentence Marker */
numsentences[bn]++; numsentences[bn]++;
sentmarks[bn][numsentences[bn]] = sentmarks[bn][numsentences[bn]] =
&sentbuf[bn][i]; &sentbuf[bn][i];
} }
} }
i++; i++;
...@@ -985,7 +1008,7 @@ static void say_last_char(struct vc_data *vc) ...@@ -985,7 +1008,7 @@ static void say_last_char(struct vc_data *vc)
static void say_position(struct vc_data *vc) static void say_position(struct vc_data *vc)
{ {
synth_printf(msg_get(MSG_POS_INFO), spk_y + 1, spk_x + 1, synth_printf(msg_get(MSG_POS_INFO), spk_y + 1, spk_x + 1,
vc->vc_num + 1); vc->vc_num + 1);
synth_printf("\n"); synth_printf("\n");
} }
...@@ -1024,27 +1047,28 @@ static void say_to_right(struct vc_data *vc) ...@@ -1024,27 +1047,28 @@ static void say_to_right(struct vc_data *vc)
static void spkup_write(const char *in_buf, int count) 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_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; int in_count = count;
spk_keydown = 0; spk_keydown = 0;
while (count--) { while (count--) {
if (cursor_track == read_all_mode) { if (cursor_track == read_all_mode) {
/* Insert Sentence Index */ /* Insert Sentence Index */
if ((in_buf == sentmarks[bn][currsentence]) && if ((in_buf == sentmarks[bn][currsentence]) &&
(currsentence <= numsentences[bn])) (currsentence <= numsentences[bn]))
synth_insert_next_index(currsentence++); synth_insert_next_index(currsentence++);
} }
ch = (u_char)*in_buf++; ch = (u_char) *in_buf++;
char_type = spk_chartab[ch]; char_type = spk_chartab[ch];
if (ch == old_ch && !(char_type&B_NUM)) { if (ch == old_ch && !(char_type & B_NUM)) {
if (++rep_count > 2) if (++rep_count > 2)
continue; continue;
} else { } else {
if ((last_type&CH_RPT) && rep_count > 2) { if ((last_type & CH_RPT) && rep_count > 2) {
synth_printf(" "); synth_printf(" ");
synth_printf(msg_get(MSG_REPEAT_DESC), ++rep_count); synth_printf(msg_get(MSG_REPEAT_DESC),
++rep_count);
synth_printf(" "); synth_printf(" ");
} }
rep_count = 0; rep_count = 0;
...@@ -1060,13 +1084,16 @@ static void spkup_write(const char *in_buf, int count) ...@@ -1060,13 +1084,16 @@ static void spkup_write(const char *in_buf, int count)
} else if (char_type & B_NUM) { } else if (char_type & B_NUM) {
rep_count = 0; rep_count = 0;
synth_printf("%c", ch); synth_printf("%c", ch);
} else if (char_type&punc_mask) { } else if (char_type & punc_mask) {
speak_char(ch); speak_char(ch);
char_type &= ~PUNC; /* for dec nospell processing */ char_type &= ~PUNC; /* for dec nospell processing */
} else if (char_type&SYNTH_OK) { } else if (char_type & SYNTH_OK) {
/* these are usually puncts like . and , which synth needs for expression. /* these are usually puncts like . and , which synth
* suppress multiple to get rid of long pausesand clear repeat count so if * needs for expression.
*someone has repeats on you don't get nothing repeated count */ * 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) if (ch != old_ch)
synth_printf("%c", ch); synth_printf("%c", ch);
else else
...@@ -1083,7 +1110,7 @@ static void spkup_write(const char *in_buf, int count) ...@@ -1083,7 +1110,7 @@ static void spkup_write(const char *in_buf, int count)
} }
spk_lastkey = 0; spk_lastkey = 0;
if (in_count > 2 && rep_count > 2) { if (in_count > 2 && rep_count > 2) {
if (last_type&CH_RPT) { if (last_type & CH_RPT) {
synth_printf(" "); synth_printf(" ");
synth_printf(msg_get(MSG_REPEAT_DESC2), ++rep_count); synth_printf(msg_get(MSG_REPEAT_DESC2), ++rep_count);
synth_printf(" "); synth_printf(" ");
...@@ -1160,7 +1187,7 @@ int set_key_info(const u_char *key_info, u_char *k_buffer) ...@@ -1160,7 +1187,7 @@ int set_key_info(const u_char *key_info, u_char *k_buffer)
if (version != KEY_MAP_VER) if (version != KEY_MAP_VER)
return -1; return -1;
num_keys = *cp; num_keys = *cp;
states = (int) cp[1]; states = (int)cp[1];
key_data_len = (states + 1) * (num_keys + 1); key_data_len = (states + 1) * (num_keys + 1);
if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(key_buf)) if (key_data_len + SHIFT_TBL_SIZE + 4 >= sizeof(key_buf))
return -2; return -2;
...@@ -1170,8 +1197,8 @@ int set_key_info(const u_char *key_info, u_char *k_buffer) ...@@ -1170,8 +1197,8 @@ int set_key_info(const u_char *key_info, u_char *k_buffer)
our_keys[0] = shift_table; our_keys[0] = shift_table;
cp1 += SHIFT_TBL_SIZE; cp1 += SHIFT_TBL_SIZE;
memcpy(cp1, cp, key_data_len + 3); memcpy(cp1, cp, key_data_len + 3);
/* get num_keys, states and data*/ /* get num_keys, states and data */
cp1 += 2; /* now pointing at shift states */ cp1 += 2; /* now pointing at shift states */
for (i = 1; i <= states; i++) { for (i = 1; i <= states; i++) {
ch = *cp1++; ch = *cp1++;
if (ch >= SHIFT_TBL_SIZE) if (ch >= SHIFT_TBL_SIZE)
...@@ -1190,22 +1217,21 @@ int set_key_info(const u_char *key_info, u_char *k_buffer) ...@@ -1190,22 +1217,21 @@ int set_key_info(const u_char *key_info, u_char *k_buffer)
static struct var_t spk_vars[] = { static struct var_t spk_vars[] = {
/* bell must be first to set high limit */ /* bell must be first to set high limit */
{ BELL_POS, .u.n = {NULL, 0, 0, 0, 0, 0, NULL }}, {BELL_POS, .u.n = {NULL, 0, 0, 0, 0, 0, NULL} },
{ SPELL_DELAY, .u.n = {NULL, 0, 0, 4, 0, 0, NULL }}, {SPELL_DELAY, .u.n = {NULL, 0, 0, 4, 0, 0, NULL} },
{ ATTRIB_BLEEP, .u.n = {NULL, 1, 0, 3, 0, 0, NULL }}, {ATTRIB_BLEEP, .u.n = {NULL, 1, 0, 3, 0, 0, NULL} },
{ BLEEPS, .u.n = {NULL, 3, 0, 3, 0, 0, NULL }}, {BLEEPS, .u.n = {NULL, 3, 0, 3, 0, 0, NULL} },
{ BLEEP_TIME, .u.n = {NULL, 30, 1, 200, 0, 0, NULL }}, {BLEEP_TIME, .u.n = {NULL, 30, 1, 200, 0, 0, NULL} },
{ PUNC_LEVEL, .u.n = {NULL, 1, 0, 4, 0, 0, NULL }}, {PUNC_LEVEL, .u.n = {NULL, 1, 0, 4, 0, 0, NULL} },
{ READING_PUNC, .u.n = {NULL, 1, 0, 4, 0, 0, NULL }}, {READING_PUNC, .u.n = {NULL, 1, 0, 4, 0, 0, NULL} },
{ CURSOR_TIME, .u.n = {NULL, 120, 50, 600, 0, 0, NULL }}, {CURSOR_TIME, .u.n = {NULL, 120, 50, 600, 0, 0, NULL} },
{ SAY_CONTROL, TOGGLE_0 }, {SAY_CONTROL, TOGGLE_0},
{ SAY_WORD_CTL, TOGGLE_0 }, {SAY_WORD_CTL, TOGGLE_0},
{ NO_INTERRUPT, TOGGLE_0 }, {NO_INTERRUPT, TOGGLE_0},
{ KEY_ECHO, .u.n = {NULL, 1, 0, 2, 0, 0, NULL }}, {KEY_ECHO, .u.n = {NULL, 1, 0, 2, 0, 0, NULL} },
V_LAST_VAR V_LAST_VAR
}; };
static void toggle_cursoring(struct vc_data *vc) static void toggle_cursoring(struct vc_data *vc)
{ {
if (cursor_track == read_all_mode) if (cursor_track == read_all_mode)
...@@ -1234,24 +1260,25 @@ void reset_default_chartab(void) ...@@ -1234,24 +1260,25 @@ void reset_default_chartab(void)
memcpy(spk_chartab, default_chartab, sizeof(default_chartab)); 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) static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key)
{ {
short mask = pb_edit->mask, ch_type = spk_chartab[ch]; short mask = pb_edit->mask, ch_type = spk_chartab[ch];
if (type != KT_LATIN || (ch_type&B_NUM) || ch < SPACE) if (type != KT_LATIN || (ch_type & B_NUM) || ch < SPACE)
return -1; return -1;
if (ch == SPACE) { if (ch == SPACE) {
synth_printf("%s\n", msg_get(MSG_EDIT_DONE)); synth_printf("%s\n", msg_get(MSG_EDIT_DONE));
special_handler = NULL; special_handler = NULL;
return 1; return 1;
} }
if (mask < PUNC && !(ch_type&PUNC)) if (mask < PUNC && !(ch_type & PUNC))
return -1; return -1;
spk_chartab[ch] ^= mask; spk_chartab[ch] ^= mask;
speak_char(ch); speak_char(ch);
synth_printf(" %s\n", 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; return 1;
} }
...@@ -1263,7 +1290,7 @@ void speakup_allocate(struct vc_data *vc) ...@@ -1263,7 +1290,7 @@ void speakup_allocate(struct vc_data *vc)
vc_num = vc->vc_num; vc_num = vc->vc_num;
if (speakup_console[vc_num] == NULL) { if (speakup_console[vc_num] == NULL) {
speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]), speakup_console[vc_num] = kzalloc(sizeof(*speakup_console[0]),
GFP_ATOMIC); GFP_ATOMIC);
if (speakup_console[vc_num] == NULL) if (speakup_console[vc_num] == NULL)
return; return;
speakup_date(vc); speakup_date(vc);
...@@ -1290,9 +1317,6 @@ static void reset_highlight_buffers(struct vc_data *); ...@@ -1290,9 +1317,6 @@ static void reset_highlight_buffers(struct vc_data *);
static int read_all_key; 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); static void start_read_all_timer(struct vc_data *vc, int command);
enum { enum {
...@@ -1307,16 +1331,14 @@ enum { ...@@ -1307,16 +1331,14 @@ enum {
RA_FIND_PREV_SENT, RA_FIND_PREV_SENT,
}; };
static void static void kbd_fakekey2(struct vc_data *vc, int command)
kbd_fakekey2(struct vc_data *vc, int command)
{ {
del_timer(&cursor_timer); del_timer(&cursor_timer);
speakup_fake_down_arrow(); speakup_fake_down_arrow();
start_read_all_timer(vc, command); start_read_all_timer(vc, command);
} }
static void static void read_all_doc(struct vc_data *vc)
read_all_doc(struct vc_data *vc)
{ {
if ((vc->vc_num != fg_console) || synth == NULL || spk_shut_up) if ((vc->vc_num != fg_console) || synth == NULL || spk_shut_up)
return; return;
...@@ -1335,8 +1357,7 @@ read_all_doc(struct vc_data *vc) ...@@ -1335,8 +1357,7 @@ read_all_doc(struct vc_data *vc)
} }
} }
static void static void stop_read_all(struct vc_data *vc)
stop_read_all(struct vc_data *vc)
{ {
del_timer(&cursor_timer); del_timer(&cursor_timer);
cursor_track = prev_cursor_track; cursor_track = prev_cursor_track;
...@@ -1344,19 +1365,18 @@ stop_read_all(struct vc_data *vc) ...@@ -1344,19 +1365,18 @@ stop_read_all(struct vc_data *vc)
do_flush(); do_flush();
} }
static void static void start_read_all_timer(struct vc_data *vc, int command)
start_read_all_timer(struct vc_data *vc, int command)
{ {
struct var_t *cursor_timeout; struct var_t *cursor_timeout;
cursor_con = vc->vc_num; cursor_con = vc->vc_num;
read_all_key = command; read_all_key = command;
cursor_timeout = get_var(CURSOR_TIME); 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 static void handle_cursor_read_all(struct vc_data *vc, int command)
handle_cursor_read_all(struct vc_data *vc, int command)
{ {
int indcount, sentcount, rv, sn; int indcount, sentcount, rv, sn;
...@@ -1365,16 +1385,16 @@ handle_cursor_read_all(struct vc_data *vc, int command) ...@@ -1365,16 +1385,16 @@ handle_cursor_read_all(struct vc_data *vc, int command)
/* Get Current Sentence */ /* Get Current Sentence */
get_index_count(&indcount, &sentcount); get_index_count(&indcount, &sentcount);
/*printk("%d %d ", indcount, sentcount); */ /*printk("%d %d ", indcount, sentcount); */
reset_index_count(sentcount+1); reset_index_count(sentcount + 1);
if (indcount == 1) { if (indcount == 1) {
if (!say_sentence_num(sentcount+1, 0)) { if (!say_sentence_num(sentcount + 1, 0)) {
kbd_fakekey2(vc, RA_FIND_NEXT_SENT); kbd_fakekey2(vc, RA_FIND_NEXT_SENT);
return; return;
} }
synth_insert_next_index(0); synth_insert_next_index(0);
} else { } else {
sn = 0; sn = 0;
if (!say_sentence_num(sentcount+1, 1)) { if (!say_sentence_num(sentcount + 1, 1)) {
sn = 1; sn = 1;
reset_index_count(sn); reset_index_count(sn);
} else } else
...@@ -1440,7 +1460,7 @@ static int pre_handle_cursor(struct vc_data *vc, u_char value, char up_flag) ...@@ -1440,7 +1460,7 @@ static int pre_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
del_timer(&cursor_timer); del_timer(&cursor_timer);
spk_shut_up &= 0xfe; spk_shut_up &= 0xfe;
do_flush(); do_flush();
start_read_all_timer(vc, value+1); start_read_all_timer(vc, value + 1);
spk_unlock(flags); spk_unlock(flags);
return NOTIFY_STOP; return NOTIFY_STOP;
} }
...@@ -1473,17 +1493,17 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag) ...@@ -1473,17 +1493,17 @@ static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
if (cursor_track == CT_Highlight) if (cursor_track == CT_Highlight)
reset_highlight_buffers(vc); reset_highlight_buffers(vc);
cursor_timeout = get_var(CURSOR_TIME); 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); spk_unlock(flags);
} }
static void static void update_color_buffer(struct vc_data *vc, const char *ic, int len)
update_color_buffer(struct vc_data *vc , const char *ic , int len)
{ {
int i, bi, hi; int i, bi, hi;
int vc_num = vc->vc_num; int vc_num = vc->vc_num;
bi = ((vc->vc_attr & 0x70) >> 4) ; bi = ((vc->vc_attr & 0x70) >> 4);
hi = speakup_console[vc_num]->ht.highsize[bi]; hi = speakup_console[vc_num]->ht.highsize[bi];
i = 0; i = 0;
...@@ -1497,10 +1517,10 @@ update_color_buffer(struct vc_data *vc , const char *ic , int len) ...@@ -1497,10 +1517,10 @@ update_color_buffer(struct vc_data *vc , const char *ic , int len)
speakup_console[vc_num]->ht.highbuf[bi][hi] = ic[i]; speakup_console[vc_num]->ht.highbuf[bi][hi] = ic[i];
hi++; hi++;
} else if ((ic[i] == 32) && (hi != 0)) { } else if ((ic[i] == 32) && (hi != 0)) {
if (speakup_console[vc_num]->ht.highbuf[bi][hi-1] != if (speakup_console[vc_num]->ht.highbuf[bi][hi - 1] !=
32) { 32) {
speakup_console[vc_num]->ht.highbuf[bi][hi] = speakup_console[vc_num]->ht.highbuf[bi][hi] =
ic[i]; ic[i];
hi++; hi++;
} }
} }
...@@ -1509,17 +1529,15 @@ update_color_buffer(struct vc_data *vc , const char *ic , int len) ...@@ -1509,17 +1529,15 @@ update_color_buffer(struct vc_data *vc , const char *ic , int len)
speakup_console[vc_num]->ht.highsize[bi] = hi; speakup_console[vc_num]->ht.highsize[bi] = hi;
} }
static void static void reset_highlight_buffers(struct vc_data *vc)
reset_highlight_buffers(struct vc_data *vc)
{ {
int i; int i;
int vc_num = vc->vc_num; int vc_num = vc->vc_num;
for (i = 0 ; i < 8 ; i++) for (i = 0; i < 8; i++)
speakup_console[vc_num]->ht.highsize[i] = 0; speakup_console[vc_num]->ht.highsize[i] = 0;
} }
static int static int count_highlight_color(struct vc_data *vc)
count_highlight_color(struct vc_data *vc)
{ {
int i, bg; int i, bg;
int cc; int cc;
...@@ -1531,7 +1549,7 @@ count_highlight_color(struct vc_data *vc) ...@@ -1531,7 +1549,7 @@ count_highlight_color(struct vc_data *vc)
speakup_console[vc_num]->ht.bgcount[i] = 0; speakup_console[vc_num]->ht.bgcount[i] = 0;
for (i = 0; i < vc->vc_rows; i++) { for (i = 0; i < vc->vc_rows; i++) {
u16 *end = start + vc->vc_cols*2; u16 *end = start + vc->vc_cols * 2;
u16 *ptr; u16 *ptr;
for (ptr = start; ptr < end; ptr++) { for (ptr = start; ptr < end; ptr++) {
ch = get_attributes(ptr); ch = get_attributes(ptr);
...@@ -1548,8 +1566,7 @@ count_highlight_color(struct vc_data *vc) ...@@ -1548,8 +1566,7 @@ count_highlight_color(struct vc_data *vc)
return cc; return cc;
} }
static int static int get_highlight_color(struct vc_data *vc)
get_highlight_color(struct vc_data *vc)
{ {
int i, j; int i, j;
unsigned int cptr[8], tmp; unsigned int cptr[8], tmp;
...@@ -1561,7 +1578,7 @@ get_highlight_color(struct vc_data *vc) ...@@ -1561,7 +1578,7 @@ get_highlight_color(struct vc_data *vc)
for (i = 0; i < 7; i++) for (i = 0; i < 7; i++)
for (j = i + 1; j < 8; j++) for (j = i + 1; j < 8; j++)
if (speakup_console[vc_num]->ht.bgcount[cptr[i]] > if (speakup_console[vc_num]->ht.bgcount[cptr[i]] >
speakup_console[vc_num]->ht.bgcount[cptr[j]]) { speakup_console[vc_num]->ht.bgcount[cptr[j]]) {
tmp = cptr[i]; tmp = cptr[i];
cptr[i] = cptr[j]; cptr[i] = cptr[j];
cptr[j] = tmp; cptr[j] = tmp;
...@@ -1574,8 +1591,7 @@ get_highlight_color(struct vc_data *vc) ...@@ -1574,8 +1591,7 @@ get_highlight_color(struct vc_data *vc)
return -1; return -1;
} }
static int static int speak_highlight(struct vc_data *vc)
speak_highlight(struct vc_data *vc)
{ {
int hc, d; int hc, d;
int vc_num = vc->vc_num; int vc_num = vc->vc_num;
...@@ -1583,14 +1599,14 @@ speak_highlight(struct vc_data *vc) ...@@ -1583,14 +1599,14 @@ speak_highlight(struct vc_data *vc)
return 0; return 0;
hc = get_highlight_color(vc); hc = get_highlight_color(vc);
if (hc != -1) { if (hc != -1) {
d = vc->vc_y-speakup_console[vc_num]->ht.cy; d = vc->vc_y - speakup_console[vc_num]->ht.cy;
if ((d == 1) || (d == -1)) if ((d == 1) || (d == -1))
if (speakup_console[vc_num]->ht.ry[hc] != vc->vc_y) if (speakup_console[vc_num]->ht.ry[hc] != vc->vc_y)
return 0; return 0;
spk_parked |= 0x01; spk_parked |= 0x01;
do_flush(); do_flush();
spkup_write(speakup_console[vc_num]->ht.highbuf[hc], spkup_write(speakup_console[vc_num]->ht.highbuf[hc],
speakup_console[vc_num]->ht.highsize[hc]); speakup_console[vc_num]->ht.highsize[hc]);
spk_pos = spk_cp = speakup_console[vc_num]->ht.rpos[hc]; spk_pos = spk_cp = speakup_console[vc_num]->ht.rpos[hc];
spk_x = spk_cx = speakup_console[vc_num]->ht.rx[hc]; spk_x = spk_cx = speakup_console[vc_num]->ht.rx[hc];
spk_y = spk_cy = speakup_console[vc_num]->ht.ry[hc]; spk_y = spk_cy = speakup_console[vc_num]->ht.ry[hc];
...@@ -1599,8 +1615,7 @@ speak_highlight(struct vc_data *vc) ...@@ -1599,8 +1615,7 @@ speak_highlight(struct vc_data *vc)
return 0; return 0;
} }
static void static void cursor_done(u_long data)
cursor_done(u_long data)
{ {
struct vc_data *vc = vc_cons[cursor_con].d; struct vc_data *vc = vc_cons[cursor_con].d;
unsigned long flags; unsigned long flags;
...@@ -1613,7 +1628,7 @@ cursor_done(u_long data) ...@@ -1613,7 +1628,7 @@ cursor_done(u_long data)
speakup_date(vc); speakup_date(vc);
if (win_enabled) { if (win_enabled) {
if (vc->vc_x >= win_left && vc->vc_x <= win_right && if (vc->vc_x >= win_left && vc->vc_x <= win_right &&
vc->vc_y >= win_top && vc->vc_y <= win_bottom) { vc->vc_y >= win_top && vc->vc_y <= win_bottom) {
spk_keydown = is_cursor = 0; spk_keydown = is_cursor = 0;
goto out; goto out;
} }
...@@ -1681,7 +1696,7 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len) ...@@ -1681,7 +1696,7 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len)
} }
if (win_enabled) { if (win_enabled) {
if (vc->vc_x >= win_left && vc->vc_x <= win_right && if (vc->vc_x >= win_left && vc->vc_x <= win_right &&
vc->vc_y >= win_top && vc->vc_y <= win_bottom) { vc->vc_y >= win_top && vc->vc_y <= win_bottom) {
spk_unlock(flags); spk_unlock(flags);
return; return;
} }
...@@ -1691,8 +1706,7 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len) ...@@ -1691,8 +1706,7 @@ static void speakup_con_write(struct vc_data *vc, const char *str, int len)
spk_unlock(flags); spk_unlock(flags);
} }
void void speakup_con_update(struct vc_data *vc)
speakup_con_update(struct vc_data *vc)
{ {
unsigned long flags; unsigned long flags;
if (speakup_console[vc->vc_num] == NULL || spk_parked) if (speakup_console[vc->vc_num] == NULL || spk_parked)
...@@ -1741,8 +1755,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag) ...@@ -1741,8 +1755,7 @@ static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag)
spk_unlock(flags); spk_unlock(flags);
} }
static int static int inc_dec_var(u_char value)
inc_dec_var(u_char value)
{ {
struct st_var_header *p_header; struct st_var_header *p_header;
struct var_t *var_data; struct var_t *var_data;
...@@ -1750,8 +1763,8 @@ inc_dec_var(u_char value) ...@@ -1750,8 +1763,8 @@ inc_dec_var(u_char value)
char *cp = num_buf; char *cp = num_buf;
char *pn; char *pn;
int var_id = (int)value - VAR_START; int var_id = (int)value - VAR_START;
int how = (var_id&1) ? E_INC : E_DEC; int how = (var_id & 1) ? E_INC : E_DEC;
var_id = var_id/2+FIRST_SET_VAR; var_id = var_id / 2 + FIRST_SET_VAR;
p_header = get_var_header(var_id); p_header = get_var_header(var_id);
if (p_header == NULL) if (p_header == NULL)
return -1; return -1;
...@@ -1769,13 +1782,12 @@ inc_dec_var(u_char value) ...@@ -1769,13 +1782,12 @@ inc_dec_var(u_char value)
} }
} }
snprintf(cp, sizeof(num_buf) - (cp - num_buf), " %d ", snprintf(cp, sizeof(num_buf) - (cp - num_buf), " %d ",
var_data->u.n.value); var_data->u.n.value);
synth_printf("%s", num_buf); synth_printf("%s", num_buf);
return 0; return 0;
} }
static void static void speakup_win_set(struct vc_data *vc)
speakup_win_set(struct vc_data *vc)
{ {
char info[40]; char info[40];
if (win_start > 1) { if (win_start > 1) {
...@@ -1788,10 +1800,10 @@ speakup_win_set(struct vc_data *vc) ...@@ -1788,10 +1800,10 @@ speakup_win_set(struct vc_data *vc)
} }
if (win_start && spk_x == win_left && spk_y == win_top) { if (win_start && spk_x == win_left && spk_y == win_top) {
win_left = 0; win_left = 0;
win_right = vc->vc_cols-1; win_right = vc->vc_cols - 1;
win_bottom = spk_y; win_bottom = spk_y;
snprintf(info, sizeof(info), msg_get(MSG_WINDOW_LINE), snprintf(info, sizeof(info), msg_get(MSG_WINDOW_LINE),
(int)win_top+1); (int)win_top + 1);
} else { } else {
if (!win_start) { if (!win_start) {
win_top = spk_y; win_top = spk_y;
...@@ -1801,15 +1813,14 @@ speakup_win_set(struct vc_data *vc) ...@@ -1801,15 +1813,14 @@ speakup_win_set(struct vc_data *vc)
win_right = spk_x; win_right = spk_x;
} }
snprintf(info, sizeof(info), msg_get(MSG_WINDOW_BOUNDARY), snprintf(info, sizeof(info), msg_get(MSG_WINDOW_BOUNDARY),
(win_start) ? msg_get(MSG_END) : msg_get(MSG_START), (win_start) ? msg_get(MSG_END) : msg_get(MSG_START),
(int)spk_y+1, (int)spk_x+1); (int)spk_y + 1, (int)spk_x + 1);
} }
synth_printf("%s\n", info); synth_printf("%s\n", info);
win_start++; win_start++;
} }
static void static void speakup_win_clear(struct vc_data *vc)
speakup_win_clear(struct vc_data *vc)
{ {
win_top = win_bottom = 0; win_top = win_bottom = 0;
win_left = win_right = 0; win_left = win_right = 0;
...@@ -1817,8 +1828,7 @@ speakup_win_clear(struct vc_data *vc) ...@@ -1817,8 +1828,7 @@ speakup_win_clear(struct vc_data *vc)
synth_printf("%s\n", msg_get(MSG_WINDOW_CLEARED)); synth_printf("%s\n", msg_get(MSG_WINDOW_CLEARED));
} }
static void static void speakup_win_enable(struct vc_data *vc)
speakup_win_enable(struct vc_data *vc)
{ {
if (win_start < 2) { if (win_start < 2) {
synth_printf("%s\n", msg_get(MSG_NO_WINDOW)); synth_printf("%s\n", msg_get(MSG_NO_WINDOW));
...@@ -1831,8 +1841,7 @@ speakup_win_enable(struct vc_data *vc) ...@@ -1831,8 +1841,7 @@ speakup_win_enable(struct vc_data *vc)
synth_printf("%s\n", msg_get(MSG_WINDOW_SILENCE_DISABLED)); synth_printf("%s\n", msg_get(MSG_WINDOW_SILENCE_DISABLED));
} }
static void static void speakup_bits(struct vc_data *vc)
speakup_bits(struct vc_data *vc)
{ {
int val = this_speakup_key - (FIRST_EDIT_BITS - 1); int val = this_speakup_key - (FIRST_EDIT_BITS - 1);
if (special_handler != NULL || val < 1 || val > 6) { if (special_handler != NULL || val < 1 || val > 6) {
...@@ -1847,7 +1856,7 @@ speakup_bits(struct vc_data *vc) ...@@ -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 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 u_char *goto_buf = "\0\0\0\0\0\0";
static int num = 0; static int num;
int maxlen, go_pos; int maxlen, go_pos;
char *cp; char *cp;
if (type == KT_SPKUP && ch == SPEAKUP_GOTO) if (type == KT_SPKUP && ch == SPEAKUP_GOTO)
...@@ -1874,7 +1883,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) ...@@ -1874,7 +1883,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
return 1; return 1;
if (ch >= '0' && ch <= '9' && num < maxlen) if (ch >= '0' && ch <= '9' && num < maxlen)
return 1; return 1;
if (num < maxlen-1 || num > maxlen) if (num < maxlen - 1 || num > maxlen)
goto oops; goto oops;
if (ch < 'x' || ch > 'y') { if (ch < 'x' || ch > 'y') {
oops: oops:
...@@ -1885,7 +1894,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) ...@@ -1885,7 +1894,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
return 1; return 1;
} }
cp = speakup_s2i(goto_buf, &go_pos); cp = speakup_s2i(goto_buf, &go_pos);
goto_pos = (u_long)go_pos; goto_pos = (u_long) go_pos;
if (*cp == 'x') { if (*cp == 'x') {
if (*goto_buf < '0') if (*goto_buf < '0')
goto_pos += spk_x; goto_pos += spk_x;
...@@ -1894,7 +1903,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) ...@@ -1894,7 +1903,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
if (goto_pos < 0) if (goto_pos < 0)
goto_pos = 0; goto_pos = 0;
if (goto_pos >= vc->vc_cols) if (goto_pos >= vc->vc_cols)
goto_pos = vc->vc_cols-1; goto_pos = vc->vc_cols - 1;
goto_x = 1; goto_x = 1;
} else { } else {
if (*goto_buf < '0') if (*goto_buf < '0')
...@@ -1904,10 +1913,10 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) ...@@ -1904,10 +1913,10 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
if (goto_pos < 0) if (goto_pos < 0)
goto_pos = 0; goto_pos = 0;
if (goto_pos >= vc->vc_rows) if (goto_pos >= vc->vc_rows)
goto_pos = vc->vc_rows-1; goto_pos = vc->vc_rows - 1;
goto_x = 0; goto_x = 0;
} }
goto_buf[num = 0] = '\0'; goto_buf[num = 0] = '\0';
do_goto: do_goto:
special_handler = NULL; special_handler = NULL;
spk_parked |= 0x01; spk_parked |= 0x01;
...@@ -1924,8 +1933,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key) ...@@ -1924,8 +1933,7 @@ static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
return 1; return 1;
} }
static void static void speakup_goto(struct vc_data *vc)
speakup_goto(struct vc_data *vc)
{ {
if (special_handler != NULL) { if (special_handler != NULL) {
synth_printf("%s\n", msg_get(MSG_ERROR)); synth_printf("%s\n", msg_get(MSG_ERROR));
...@@ -1941,15 +1949,14 @@ static void speakup_help(struct vc_data *vc) ...@@ -1941,15 +1949,14 @@ static void speakup_help(struct vc_data *vc)
handle_help(vc, KT_SPKUP, SPEAKUP_HELP, 0); handle_help(vc, KT_SPKUP, SPEAKUP_HELP, 0);
} }
static void static void do_nothing(struct vc_data *vc)
do_nothing(struct vc_data *vc)
{ {
return; /* flush done in do_spkup */ return; /* flush done in do_spkup */
} }
static u_char key_speakup, spk_key_locked; static u_char key_speakup, spk_key_locked;
static void static void speakup_lock(struct vc_data *vc)
speakup_lock(struct vc_data *vc)
{ {
if (!spk_key_locked) if (!spk_key_locked)
spk_key_locked = key_speakup = 16; spk_key_locked = key_speakup = 16;
...@@ -1957,7 +1964,7 @@ speakup_lock(struct vc_data *vc) ...@@ -1957,7 +1964,7 @@ speakup_lock(struct vc_data *vc)
spk_key_locked = key_speakup = 0; spk_key_locked = key_speakup = 0;
} }
typedef void(*spkup_hand)(struct vc_data *); typedef void (*spkup_hand) (struct vc_data *);
spkup_hand spkup_handler[] = { spkup_hand spkup_handler[] = {
/* must be ordered same as defines in speakup.h */ /* must be ordered same as defines in speakup.h */
do_nothing, speakup_goto, speech_kill, speakup_shut_up, do_nothing, speakup_goto, speech_kill, speakup_shut_up,
...@@ -1968,7 +1975,7 @@ spkup_hand spkup_handler[] = { ...@@ -1968,7 +1975,7 @@ spkup_hand spkup_handler[] = {
top_edge, bottom_edge, left_edge, right_edge, top_edge, bottom_edge, left_edge, right_edge,
spell_word, spell_word, say_screen, spell_word, spell_word, say_screen,
say_position, say_attributes, say_position, say_attributes,
speakup_off, speakup_parked, say_line, /* this is for indent */ speakup_off, speakup_parked, say_line, /* this is for indent */
say_from_top, say_to_bottom, say_from_top, say_to_bottom,
say_from_left, say_to_right, say_from_left, say_to_right,
say_char_num, speakup_bits, speakup_bits, say_phonetic_char, say_char_num, speakup_bits, speakup_bits, say_phonetic_char,
...@@ -1987,7 +1994,7 @@ static void do_spkup(struct vc_data *vc, u_char value) ...@@ -1987,7 +1994,7 @@ static void do_spkup(struct vc_data *vc, u_char value)
this_speakup_key = value; this_speakup_key = value;
if (value < SPKUP_MAX_FUNC && spkup_handler[value]) { if (value < SPKUP_MAX_FUNC && spkup_handler[value]) {
do_flush(); do_flush();
(*spkup_handler[value])(vc); (*spkup_handler[value]) (vc);
} else { } else {
if (inc_dec_var(value) < 0) if (inc_dec_var(value) < 0)
bleep(9); bleep(9);
...@@ -1998,7 +2005,7 @@ static const char *pad_chars = "0123456789+-*/\015,.?()"; ...@@ -1998,7 +2005,7 @@ static const char *pad_chars = "0123456789+-*/\015,.?()";
int int
speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
int up_flag) int up_flag)
{ {
unsigned long flags; unsigned long flags;
int kh; int kh;
...@@ -2013,8 +2020,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, ...@@ -2013,8 +2020,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
tty = vc->port.tty; tty = vc->port.tty;
if (type >= 0xf0) if (type >= 0xf0)
type -= 0xf0; type -= 0xf0;
if (type == KT_PAD && if (type == KT_PAD
(vc_kbd_led(kbd_table + fg_console, VC_NUMLOCK))) { && (vc_kbd_led(kbd_table + fg_console, VC_NUMLOCK))) {
if (up_flag) { if (up_flag) {
spk_keydown = 0; spk_keydown = 0;
goto out; goto out;
...@@ -2044,7 +2051,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, ...@@ -2044,7 +2051,7 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
break; break;
} }
} }
shift_info = (shift_state&0x0f) + key_speakup; shift_info = (shift_state & 0x0f) + key_speakup;
offset = shift_table[shift_info]; offset = shift_table[shift_info];
if (offset) { if (offset) {
new_key = key_info[offset]; new_key = key_info[offset];
...@@ -2062,10 +2069,10 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, ...@@ -2062,10 +2069,10 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
if (up_flag) if (up_flag)
goto out; goto out;
if (last_keycode == keycode && if (last_keycode == keycode &&
last_spk_jiffy+MAX_DELAY > jiffies) { last_spk_jiffy + MAX_DELAY > jiffies) {
spk_close_press = 1; spk_close_press = 1;
offset = shift_table[shift_info+32]; offset = shift_table[shift_info + 32];
/* double press? */ /* double press? */
if (offset && key_info[offset]) if (offset && key_info[offset])
new_key = key_info[offset]; new_key = key_info[offset];
} }
...@@ -2086,9 +2093,9 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, ...@@ -2086,9 +2093,9 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
goto out; goto out;
spk_shut_up &= 0xfe; spk_shut_up &= 0xfe;
kh = (value == KVAL(K_DOWN)) kh = (value == KVAL(K_DOWN))
|| (value == KVAL(K_UP)) || (value == KVAL(K_UP))
|| (value == KVAL(K_LEFT)) || (value == KVAL(K_LEFT))
|| (value == KVAL(K_RIGHT)); || (value == KVAL(K_RIGHT));
if ((cursor_track != read_all_mode) || !kh) if ((cursor_track != read_all_mode) || !kh)
if (!no_intr) if (!no_intr)
do_flush(); do_flush();
...@@ -2099,8 +2106,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, ...@@ -2099,8 +2106,8 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
} else if (type == KT_LETTER) } else if (type == KT_LETTER)
type = KT_LATIN; type = KT_LATIN;
else if (value == 0x7f) else if (value == 0x7f)
value = 8; /* make del = backspace */ value = 8; /* make del = backspace */
ret = (*special_handler)(vc, type, value, keycode); ret = (*special_handler) (vc, type, value, keycode);
spk_close_press = 0; spk_close_press = 0;
if (ret < 0) if (ret < 0)
bleep(9); bleep(9);
...@@ -2113,13 +2120,13 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym, ...@@ -2113,13 +2120,13 @@ speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
} }
static int keyboard_notifier_call(struct notifier_block *nb, static int keyboard_notifier_call(struct notifier_block *nb,
unsigned long code, void *_param) unsigned long code, void *_param)
{ {
struct keyboard_notifier_param *param = _param; struct keyboard_notifier_param *param = _param;
struct vc_data *vc = param->vc; struct vc_data *vc = param->vc;
int up = !param->down; int up = !param->down;
int ret = NOTIFY_OK; int ret = NOTIFY_OK;
static int keycode; /* to hold the current keycode */ static int keycode; /* to hold the current keycode */
if (vc->vc_mode == KD_GRAPHICS) if (vc->vc_mode == KD_GRAPHICS)
return ret; return ret;
...@@ -2150,37 +2157,35 @@ static int keyboard_notifier_call(struct notifier_block *nb, ...@@ -2150,37 +2157,35 @@ static int keyboard_notifier_call(struct notifier_block *nb,
case KBD_KEYSYM: case KBD_KEYSYM:
if (speakup_key(vc, param->shift, keycode, param->value, up)) if (speakup_key(vc, param->shift, keycode, param->value, up))
ret = NOTIFY_STOP; ret = NOTIFY_STOP;
else else if (KTYP(param->value) == KT_CUR)
if (KTYP(param->value) == KT_CUR) ret = pre_handle_cursor(vc, KVAL(param->value), up);
ret = pre_handle_cursor(vc,
KVAL(param->value), up);
break; break;
case KBD_POST_KEYSYM: { case KBD_POST_KEYSYM:{
unsigned char type = KTYP(param->value) - 0xf0; unsigned char type = KTYP(param->value) - 0xf0;
unsigned char val = KVAL(param->value); unsigned char val = KVAL(param->value);
switch (type) { switch (type) {
case KT_SHIFT: case KT_SHIFT:
do_handle_shift(vc, val, up); do_handle_shift(vc, val, up);
break; break;
case KT_LATIN: case KT_LATIN:
case KT_LETTER: case KT_LETTER:
do_handle_latin(vc, val, up); do_handle_latin(vc, val, up);
break; break;
case KT_CUR: case KT_CUR:
do_handle_cursor(vc, val, up); do_handle_cursor(vc, val, up);
break; break;
case KT_SPEC: case KT_SPEC:
do_handle_spec(vc, val, up); do_handle_spec(vc, val, up);
break;
}
break; break;
} }
break;
}
} }
return ret; return ret;
} }
static int vt_notifier_call(struct notifier_block *nb, static int vt_notifier_call(struct notifier_block *nb,
unsigned long code, void *_param) unsigned long code, void *_param)
{ {
struct vt_notifier_param *param = _param; struct vt_notifier_param *param = _param;
struct vc_data *vc = param->vc; struct vc_data *vc = param->vc;
...@@ -2195,11 +2200,10 @@ static int vt_notifier_call(struct notifier_block *nb, ...@@ -2195,11 +2200,10 @@ static int vt_notifier_call(struct notifier_block *nb,
case VT_WRITE: case VT_WRITE:
if (param->c == '\b') if (param->c == '\b')
speakup_bs(vc); speakup_bs(vc);
else else if (param->c < 0x100) {
if (param->c < 0x100) { char d = param->c;
char d = param->c; speakup_con_write(vc, &d, 1);
speakup_con_write(vc, &d, 1); }
}
break; break;
case VT_UPDATE: case VT_UPDATE:
speakup_con_update(vc); speakup_con_update(vc);
...@@ -2251,11 +2255,11 @@ static int __init speakup_init(void) ...@@ -2251,11 +2255,11 @@ static int __init speakup_init(void)
if (err) if (err)
return err; return err;
initialize_msgs(); /* Initialize arrays for i18n. */ initialize_msgs(); /* Initialize arrays for i18n. */
first_console = kzalloc(sizeof(*first_console), GFP_KERNEL); first_console = kzalloc(sizeof(*first_console), GFP_KERNEL);
if (!first_console) if (!first_console)
return -ENOMEM; return -ENOMEM;
if (speakup_kobj_init() < 0) if (speakup_kobj_init() < 0)
return -ENOMEM; return -ENOMEM;
reset_default_chars(); reset_default_chars();
...@@ -2267,9 +2271,10 @@ static int __init speakup_init(void) ...@@ -2267,9 +2271,10 @@ static int __init speakup_init(void)
strlwr(synth_name); strlwr(synth_name);
spk_vars[0].u.n.high = vc->vc_cols; spk_vars[0].u.n.high = vc->vc_cols;
for (var = spk_vars; var->var_id !=MAXVARS; var++) for (var = spk_vars; var->var_id != MAXVARS; var++)
speakup_register_var(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); speakup_register_var(var);
for (i = 1; punc_info[i].mask != 0; i++) for (i = 1; punc_info[i].mask != 0; i++)
set_mask_bits(0, i, 2); set_mask_bits(0, i, 2);
...@@ -2291,14 +2296,12 @@ static int __init speakup_init(void) ...@@ -2291,14 +2296,12 @@ static int __init speakup_init(void)
speakup_task = kthread_create(speakup_thread, NULL, "speakup"); speakup_task = kthread_create(speakup_thread, NULL, "speakup");
set_user_nice(speakup_task, 10); set_user_nice(speakup_task, 10);
if ( ! IS_ERR(speakup_task)) if (!IS_ERR(speakup_task))
wake_up_process(speakup_task); wake_up_process(speakup_task);
else else
return -ENOMEM; return -ENOMEM;
return 0; return 0;
} }
module_init(speakup_init); module_init(speakup_init);
module_exit(speakup_exit); module_exit(speakup_exit);
...@@ -54,6 +54,9 @@ extern int speakup_thread(void *data); ...@@ -54,6 +54,9 @@ extern int speakup_thread(void *data);
extern void reset_default_chars(void); extern void reset_default_chars(void);
extern void reset_default_chartab(void); extern void reset_default_chartab(void);
extern void synth_start(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 int set_key_info(const u_char *key_info, u_char *k_buffer);
extern char *strlwr(char *s); extern char *strlwr(char *s);
extern char *speakup_s2i(char *start, int *dest); extern char *speakup_s2i(char *start, int *dest);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment