Update for 2.6.12 internal vt API changes diff -urpX dontdiff speakup/speakup.c speakup-dsd/speakup.c --- speakup/speakup.c 2005-03-02 22:40:51.000000000 +0000 +++ speakup-dsd/speakup.c 2005-06-22 00:24:53.000000000 +0100 @@ -58,7 +58,6 @@ #include #include #include -#include "../console_macros.h" /* for x, y, attr and pos macros */ #ifndef MIN #define MIN(a,b) ((a) < (b) ? (a) : (b)) @@ -70,7 +69,7 @@ #define MINECHOCHAR SPACE /* these are globals from the kernel code */ -extern void *kmalloc (size_t, int ); +extern void *kmalloc (size_t, unsigned int ); extern void kfree (const void * ); extern struct kbd_struct * kbd; extern int fg_console; @@ -129,7 +128,7 @@ EXPORT_SYMBOL( help_handler ); EXPORT_SYMBOL( special_handler ); EXPORT_SYMBOL( our_keys ); -static void speakup_date (int currcons ); +static void speakup_date (struct vc_data *vc ); static void spkup_write (const char *in_buf, int count ); int set_mask_bits( const char *input, const int which, const int how ); @@ -311,18 +310,18 @@ bleep (u_short val ) } void -speakup_shut_up (int currcons ) +speakup_shut_up (struct vc_data *vc ) { if (spk_killed ) return; spk_shut_up |= 0x01; spk_parked &= 0xfe; - speakup_date (currcons ); + speakup_date (vc ); if (synth == NULL ) return; do_flush( ); } void -speech_kill (int currcons ) +speech_kill (struct vc_data *vc ) { char val = synth->is_alive ( ); if (val == 0 ) return; @@ -337,7 +336,7 @@ speech_kill (int currcons ) } static void -speakup_off (int currcons ) +speakup_off (struct vc_data *vc ) { if (spk_shut_up & 0x80 ) { spk_shut_up &= 0x7f; @@ -346,11 +345,11 @@ speakup_off (int currcons ) spk_shut_up |= 0x80; synth_write_msg ("You turned me off!" ); } - speakup_date (currcons ); + speakup_date (vc ); } static void -speakup_parked (int currcons ) +speakup_parked (struct vc_data *vc ) { if (spk_parked & 0x80 ) { spk_parked = 0; @@ -404,8 +403,7 @@ speakup_set_selection( struct tty_struct int new_sel_start, new_sel_end; char *bp, *obp; int i, ps, pe; - unsigned int currcons = fg_console; - struct vc_data *vc = vc_cons[currcons].d; + struct vc_data *vc = vc_cons[fg_console].d; xs = limit(xs, vc->vc_cols - 1); ys = limit(ys, vc->vc_rows - 1); @@ -480,10 +478,10 @@ speakup_set_selection( struct tty_struct static int speakup_paste_selection(struct tty_struct *tty) { - struct vt_struct *vt = (struct vt_struct *) tty->driver_data; + struct vc_data *vc = (struct vc_data *) tty->driver_data; int pasted = 0, count; DECLARE_WAITQUEUE(wait, current); - add_wait_queue(&vt->paste_wait, &wait); + add_wait_queue(&vc->paste_wait, &wait); while (sel_buffer && sel_buffer_lth > pasted) { set_current_state(TASK_INTERRUPTIBLE); if (test_bit(TTY_THROTTLED, &tty->flags)) { @@ -495,13 +493,13 @@ speakup_paste_selection(struct tty_struc tty->ldisc.receive_buf(tty, sel_buffer + pasted, 0, count); pasted += count; } - remove_wait_queue(&vt->paste_wait, &wait); + remove_wait_queue(&vc->paste_wait, &wait); current->state = TASK_RUNNING; return 0; } static void -speakup_cut (int currcons ) +speakup_cut (struct vc_data *vc ) { static const char err_buf[] = "set selection failed"; int ret; @@ -510,7 +508,7 @@ speakup_cut (int currcons ) mark_cut_flag = 1; xs = spk_x; ys = spk_y; - spk_sel_cons = vc_cons[currcons].d; + spk_sel_cons = vc; synth_write_msg ("mark" ); return; } @@ -538,7 +536,7 @@ speakup_cut (int currcons ) } static void -speakup_paste (int currcons ) +speakup_paste (struct vc_data *vc ) { if (mark_cut_flag ) { mark_cut_flag = 0; @@ -550,7 +548,7 @@ speakup_paste (int currcons ) } static void -say_attributes (int currcons ) +say_attributes (struct vc_data *vc ) { int fg= spk_attr&0x0f, bg = spk_attr>>4; if (fg > 8 ) { @@ -571,7 +569,7 @@ static char *edges[] = { "top, ", "botto enum { edge_top = 1, edge_bottom, edge_left, edge_right, edge_quiet }; static void -announce_edge (int currcons, int msg_id ) +announce_edge (struct vc_data *vc, int msg_id ) { if (bleeps&1 ) bleep (spk_y ); @@ -600,7 +598,7 @@ speak_char( u_char ch ) } static void -say_char (int currcons ) +say_char (struct vc_data *vc ) { u_short ch; spk_old_attr = spk_attr; @@ -608,13 +606,13 @@ say_char (int currcons ) spk_attr = ((ch & 0xff00 ) >> 8 ); if (spk_attr != spk_old_attr ) { if ( attrib_bleep&1 ) bleep (spk_y ); - if ( attrib_bleep&2 ) say_attributes( currcons ); + if ( attrib_bleep&2 ) say_attributes( vc ); } speak_char( ch&0xff ); } static void -say_phonetic_char (int currcons ) +say_phonetic_char (struct vc_data *vc ) { u_short ch; spk_old_attr = spk_attr; @@ -631,29 +629,29 @@ say_phonetic_char (int currcons ) } static void -say_prev_char (int currcons ) +say_prev_char (struct vc_data *vc ) { spk_parked |= 0x01; if (spk_x == 0 ) { - announce_edge(currcons, edge_left ); + announce_edge(vc, edge_left ); return; } spk_x--; spk_pos -= 2; - say_char (currcons ); + say_char (vc ); } static void -say_next_char (int currcons ) +say_next_char (struct vc_data *vc ) { spk_parked |= 0x01; - if (spk_x == vc_cons[currcons].d->vc_cols - 1 ) { - announce_edge(currcons, edge_right ); + if (spk_x == vc->vc_cols - 1 ) { + announce_edge(vc, edge_right ); return; } spk_x++; spk_pos += 2; - say_char (currcons ); + say_char (vc ); } /* get_word - will first check to see if the character under the @@ -665,7 +663,7 @@ say_next_char (int currcons ) beginning off the line whichever comes first.. */ static u_long -get_word (int currcons ) +get_word (struct vc_data *vc ) { u_long cnt = 0, tmpx = spk_x, tmp_pos = spk_pos; char ch; @@ -678,7 +676,7 @@ get_word (int currcons ) *buf = '\0'; synth_write_msg( "space" ); return 0; - } else if ((tmpx < vc_cons[currcons].d->vc_cols-2 ) + } else if ((tmpx < vc->vc_cols-2 ) && (ch == SPACE || IS_WDLM(ch )) && ((char) scr_readw ((u_short * ) tmp_pos+1 ) > SPACE)) { tmp_pos += 2; @@ -695,7 +693,7 @@ get_word (int currcons ) attr_ch = scr_readw ((u_short * ) tmp_pos ); spk_attr = attr_ch >> 8; buf[cnt++] = attr_ch&0xff; - while (tmpx < vc_cons[currcons].d->vc_cols-1 ) { + while (tmpx < vc->vc_cols-1 ) { tmp_pos += 2; tmpx++; ch = (char ) scr_readw ((u_short * ) tmp_pos ); @@ -709,9 +707,9 @@ get_word (int currcons ) } static void -say_word (int currcons ) +say_word (struct vc_data *vc ) { - u_long cnt = get_word(currcons ); + u_long cnt = get_word(vc ); u_short saved_punc_mask = punc_mask; if ( cnt == 0 ) return; punc_mask = PUNC; @@ -721,18 +719,18 @@ say_word (int currcons ) } static void -say_prev_word (int currcons ) +say_prev_word (struct vc_data *vc ) { char ch; u_short edge_said = 0, last_state = 0, state = 0; spk_parked |= 0x01; if (spk_x == 0 ) { if ( spk_y == 0 ) { - announce_edge(currcons, edge_top ); + announce_edge(vc, edge_top ); return; } spk_y--; - spk_x = vc_cons[currcons].d->vc_cols; + spk_x = vc->vc_cols; edge_said = edge_quiet; } while ( 1 ) { @@ -744,7 +742,7 @@ say_prev_word (int currcons ) if ( edge_said != edge_quiet ) edge_said = edge_left; if ( state > 0 ) break; spk_y--; - spk_x = vc_cons[currcons].d->vc_cols-1; + spk_x = vc->vc_cols-1; } else spk_x--; spk_pos -= 2; ch = (char ) scr_readw ((u_short * ) spk_pos ); @@ -761,18 +759,18 @@ say_prev_word (int currcons ) if ( spk_x == 0 && edge_said == edge_quiet ) edge_said = edge_left; if ( edge_said > 0 && edge_said < edge_quiet ) - announce_edge( currcons, edge_said ); - say_word (currcons ); + announce_edge( vc, edge_said ); + say_word (vc ); } static void -say_next_word (int currcons ) +say_next_word (struct vc_data *vc ) { char ch; u_short edge_said = 0, last_state = 2, state = 0; spk_parked |= 0x01; - if ( spk_x == vc_cons[currcons].d->vc_cols - 1 && spk_y == vc_cons[currcons].d->vc_rows-1 ) { - announce_edge(currcons, edge_bottom ); + if ( spk_x == vc->vc_cols - 1 && spk_y == vc->vc_rows-1 ) { + announce_edge(vc, edge_bottom ); return; } while ( 1 ) { @@ -781,8 +779,8 @@ say_next_word (int currcons ) else if (IS_WDLM(ch ) ) state = 1; else state = 2; if ( state > last_state ) break; - if (spk_x >= vc_cons[currcons].d->vc_cols-1 ) { - if (spk_y == vc_cons[currcons].d->vc_rows-1 ) { + if (spk_x >= vc->vc_cols-1 ) { + if (spk_y == vc->vc_rows-1 ) { edge_said = edge_bottom; break; } @@ -795,18 +793,18 @@ say_next_word (int currcons ) last_state = state; } if ( edge_said > 0 ) - announce_edge( currcons, edge_said ); - say_word (currcons ); + announce_edge( vc, edge_said ); + say_word (vc ); } static void -spell_word (int currcons ) +spell_word (struct vc_data *vc ) { static char *delay_str[] = { " ", ", ", ". ", ". . ", ". . . " }; char *cp = buf, *str_cap= str_caps_stop; char *cp1, *last_cap = str_caps_stop; u_char ch; - if ( !get_word(currcons ) ) return; + if ( !get_word(vc ) ) return; while ((ch = (u_char )*cp ) ) { if ( cp != buf ) synth_write_string (delay_str[spell_delay] ); @@ -837,13 +835,13 @@ spell_word (int currcons ) } static int -get_line (int currcons ) +get_line (struct vc_data *vc ) { u_long tmp = spk_pos - (spk_x * 2 ); int i = 0; spk_old_attr = spk_attr; spk_attr = (u_char ) (scr_readw ((u_short * ) spk_pos ) >> 8 ); - for (i = 0; i < vc_cons[currcons].d->vc_cols; i++ ) { + for (i = 0; i < vc->vc_cols; i++ ) { buf[i] = (u_char ) scr_readw ((u_short * ) tmp ); tmp += 2; } @@ -853,9 +851,9 @@ get_line (int currcons ) } static void -say_line (int currcons ) +say_line (struct vc_data *vc ) { - int i = get_line( currcons ); + int i = get_line( vc ); char *cp; char num_buf[8]; u_short saved_punc_mask = punc_mask; @@ -875,33 +873,33 @@ say_line (int currcons ) } static void -say_prev_line (int currcons ) +say_prev_line (struct vc_data *vc ) { spk_parked |= 0x01; if (spk_y == 0 ) { - announce_edge (currcons, edge_top ); + announce_edge (vc, edge_top ); return; } spk_y--; - spk_pos -= vc_cons[currcons].d->vc_size_row; - say_line (currcons ); + spk_pos -= vc->vc_size_row; + say_line (vc ); } static void -say_next_line (int currcons ) +say_next_line (struct vc_data *vc ) { spk_parked |= 0x01; - if (spk_y == vc_cons[currcons].d->vc_rows - 1 ) { - announce_edge (currcons, edge_bottom ); + if (spk_y == vc->vc_rows - 1 ) { + announce_edge (vc, edge_bottom ); return; } spk_y++; - spk_pos += vc_cons[currcons].d->vc_size_row; - say_line (currcons ); + spk_pos += vc->vc_size_row; + say_line (vc ); } static int -say_from_to (int currcons, u_long from, u_long to, int read_punc ) +say_from_to (struct vc_data *vc, u_long from, u_long to, int read_punc ) { int i = 0; u_short saved_punc_mask = punc_mask; @@ -910,7 +908,7 @@ say_from_to (int currcons, u_long from, while (from < to ) { buf[i++] = (char ) scr_readw ((u_short * ) from ); from += 2; - if ( i >= vc_cons[currcons].d->vc_size_row ) break; + if ( i >= vc->vc_size_row ) break; } for (--i; i >= 0; i-- ) if (buf[i] != SPACE ) break; @@ -924,95 +922,92 @@ say_from_to (int currcons, u_long from, } static void -say_line_from_to (int currcons, u_long from, u_long to, int read_punc ) +say_line_from_to (struct vc_data *vc, u_long from, u_long to, int read_punc ) { - u_long start = origin+(spk_y*vc_cons[currcons].d->vc_size_row ); + u_long start = vc->vc_origin+(spk_y*vc->vc_size_row ); u_long end = start+( to * 2 ); start += from*2; - if ( say_from_to( currcons, start, end, read_punc ) <= 0 ) + if ( say_from_to( vc, start, end, read_punc ) <= 0 ) synth_write_msg (blank_msg ); } static void -say_screen_from_to (int currcons, u_long from, u_long to ) +say_screen_from_to (struct vc_data *vc, u_long from, u_long to ) { - struct vc_data *vc = vc_cons[currcons].d; - u_long start = origin, end; + u_long start = vc->vc_origin, end; if ( from > 0 ) start += from * vc->vc_size_row; - if ( to > vc->vc_rows ) to = vc_cons[currcons].d->vc_rows; - end = origin + ( to * vc->vc_size_row); + if ( to > vc->vc_rows ) to = vc->vc_rows; + end = vc->vc_origin + ( to * vc->vc_size_row); for ( from = start; from < end; from = to ) { to = from + vc->vc_size_row; - say_from_to( currcons, from, to, 1 ); + say_from_to( vc, from, to, 1 ); } } static void -say_screen (int currcons ) +say_screen (struct vc_data *vc ) { - say_screen_from_to( currcons, 0, vc_cons[currcons].d->vc_rows ); + say_screen_from_to( vc, 0, vc->vc_rows ); } static void -speakup_win_say (int currcons ) +speakup_win_say (struct vc_data *vc ) { - struct vc_data *vc = vc_cons[currcons].d; u_long start, end, from, to; if ( win_start < 2 ) { synth_write_msg( "no window" ); return; } - start = origin + ( win_top * vc->vc_size_row ); - end = origin + ( win_bottom * vc->vc_size_row ); + start = vc->vc_origin + ( win_top * vc->vc_size_row ); + end = vc->vc_origin + ( win_bottom * vc->vc_size_row ); while ( start <= end ) { from = start + ( win_left * 2 ); to = start + ( win_right * 2 ); - say_from_to( currcons, from, to, 1 ); + say_from_to( vc, from, to, 1 ); start += vc->vc_size_row; } } static void -top_edge (int currcons ) +top_edge (struct vc_data *vc ) { spk_parked |= 0x01; - spk_pos = origin + 2 * spk_x; + spk_pos = vc->vc_origin + 2 * spk_x; spk_y = 0; - say_line (currcons ); + say_line (vc ); } static void -bottom_edge (int currcons ) +bottom_edge (struct vc_data *vc ) { - struct vc_data *vc = vc_cons[currcons].d; spk_parked |= 0x01; spk_pos += (vc->vc_rows - spk_y - 1 ) * vc->vc_size_row; spk_y = vc->vc_rows - 1; - say_line (currcons ); + say_line (vc ); } static void -left_edge (int currcons ) +left_edge (struct vc_data *vc ) { spk_parked |= 0x01; spk_pos -= spk_x * 2; spk_x = 0; - say_char (currcons ); + say_char (vc ); } static void -right_edge (int currcons ) +right_edge (struct vc_data *vc ) { spk_parked |= 0x01; - spk_pos += (vc_cons[currcons].d->vc_cols - spk_x - 1 ) * 2; - spk_x = vc_cons[currcons].d->vc_cols - 1; - say_char (currcons ); + spk_pos += (vc->vc_cols - spk_x - 1 ) * 2; + spk_x = vc->vc_cols - 1; + say_char (vc ); } static void -say_first_char (int currcons ) +say_first_char (struct vc_data *vc ) { - int i, len = get_line( currcons ); + int i, len = get_line( vc ); u_char ch; spk_parked |= 0x01; if ( len == 0 ) { @@ -1029,9 +1024,9 @@ say_first_char (int currcons ) } static void -say_last_char (int currcons ) +say_last_char (struct vc_data *vc ) { - int len = get_line( currcons ); + int len = get_line( vc ); u_char ch; spk_parked |= 0x01; if ( len == 0 ) { @@ -1047,16 +1042,16 @@ say_last_char (int currcons ) } static void -say_position (int currcons ) +say_position (struct vc_data *vc ) { sprintf (buf, "line %ld, col %ld, t t y %d\n", spk_y + 1, - spk_x + 1, currcons + 1 ); + spk_x + 1, vc->vc_num + 1 ); synth_write_string (buf ); } // Added by brianb static void -say_char_num (int currcons ) +say_char_num (struct vc_data *vc ) { u_short ch = scr_readw ((u_short * ) spk_pos ); ch &= 0x0ff; @@ -1067,27 +1062,27 @@ say_char_num (int currcons ) /* these are stub functions to keep keyboard.c happy. */ static void -say_from_top (int currcons ) +say_from_top (struct vc_data *vc ) { - say_screen_from_to (currcons, 0, spk_y ); + say_screen_from_to (vc, 0, spk_y ); } static void -say_to_bottom (int currcons ) +say_to_bottom (struct vc_data *vc ) { - say_screen_from_to (currcons, spk_y, vc_cons[currcons].d->vc_rows ); + say_screen_from_to (vc, spk_y, vc->vc_rows ); } static void -say_from_left (int currcons ) +say_from_left (struct vc_data *vc ) { - say_line_from_to (currcons, 0, spk_x, 1 ); + say_line_from_to (vc, 0, spk_x, 1 ); } static void -say_to_right (int currcons ) +say_to_right (struct vc_data *vc ) { - say_line_from_to (currcons, spk_x, vc_cons[currcons].d->vc_cols, 1 ); + say_line_from_to (vc, spk_x, vc->vc_cols, 1 ); } /* end of stub functions. */ @@ -1171,7 +1166,6 @@ static char *ctl_key_ids[] = { static void handle_shift( KBD_PROTO ) { - int currcons = fg_console; (*do_shift)( KBD_ARGS ); if ( synth == NULL || up_flag || spk_killed ) return; spk_shut_up &= 0xfe; @@ -1183,7 +1177,6 @@ handle_shift( KBD_PROTO ) static void handle_latin( KBD_PROTO ) { - int currcons = fg_console; (*do_latin)( KBD_ARGS ); if ( up_flag ) { spk_lastkey = spk_keydown = 0; @@ -1256,7 +1249,7 @@ static char *cursor_msgs[] = { "cursorin /* attribute cursor code coming soon */ static void -toggle_cursoring( int currcons ) +toggle_cursoring( struct vc_data *vc ) { cursor_track++; if ( cursor_track > MAXCURSORTRACK ) @@ -1288,7 +1281,7 @@ static void cursor_done(u_long data ); declare_timer( cursor_timer ); -void __init speakup_open (int currcons, spk_t *first_console ) +void __init speakup_open (struct vc_data *vc, spk_t *first_console ) { int i; num_var *n_var; @@ -1296,8 +1289,8 @@ void __init speakup_open (int currcons, memset( speakup_console, 0, sizeof( speakup_console ) ); if ( first_console == NULL ) return; memset( first_console, 0, spk_size ); - speakup_console[currcons] = first_console; - speakup_date( currcons); + speakup_console[vc->vc_num] = first_console; + speakup_date( vc); pr_info ("%s: initialized\n", SPEAKUP_VERSION ); init_timer (&cursor_timer ); #if (LINUX_VERSION_CODE >= 132419) @@ -1307,7 +1300,7 @@ void __init speakup_open (int currcons, init_sleeper ( synth_sleeping_list ); strlwr (synth_name ); synth_init ( synth_name ); - spk_num_vars[0].high = vc_cons[currcons].d->vc_cols; + spk_num_vars[0].high = vc->vc_cols; for ( n_var = spk_num_vars; n_var->var_id >= 0; n_var++ ) speakup_register_var( n_var ); for (i = 1; punc_info[i].mask != 0; i++ ) @@ -1508,7 +1501,7 @@ show_char_results (u_long data ) static int silent_write_proc (PROC_WRITE_PROTOTYPE ) { - int currcons = fg_console; + struct vc_data *vc = vc_cons[fg_console].d; char ch = 0, shut; if (count > 0 || count < 3 ) { get_user (ch, buffer ); @@ -1662,7 +1655,7 @@ set_mask_bits( const char *input, const static bits_data *pb_edit = NULL; -static int edit_bits (int currcons, 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]; if ( type != KT_LATIN || (ch_type&B_NUM ) || ch < SPACE ) return -1; @@ -1757,32 +1750,33 @@ proc_var spk_proc_vars[] = { #ifdef CONFIG_SPEAKUP void __init -speakup_init (int currcons ) +speakup_init (struct vc_data *vc ) { spk_t *first_console = (spk_t *) alloc_bootmem (spk_size+1 ); - speakup_open( currcons, first_console ); + speakup_open( vc, first_console ); } #endif void -speakup_allocate (int currcons ) +speakup_allocate (struct vc_data *vc ) { - if ( speakup_console[currcons] == NULL ) { - speakup_console[currcons] = (spk_t *) kmalloc (spk_size + 1, + int vc_num = vc->vc_num; + if ( speakup_console[vc_num] == NULL ) { + speakup_console[vc_num] = (spk_t *) kmalloc (spk_size + 1, GFP_KERNEL ); - if ( speakup_console[currcons] == NULL ) return; - memset( speakup_console[currcons], 0, spk_size ); - speakup_date( currcons); - } else if ( !spk_parked ) speakup_date( currcons); + if ( speakup_console[vc_num] == NULL ) return; + memset( speakup_console[vc_num], 0, spk_size ); + speakup_date( vc); + } else if ( !spk_parked ) speakup_date( vc); } static void -speakup_date (int currcons ) +speakup_date (struct vc_data *vc ) { - spk_x = spk_cx = x; - spk_y = spk_cy = y; - spk_pos = spk_cp = pos; + spk_x = spk_cx = vc->vc_x; + spk_y = spk_cy = vc->vc_y; + spk_pos = spk_cp = vc->vc_pos; spk_old_attr = spk_attr; spk_attr = ((scr_readw ((u_short * ) spk_pos ) & 0xff00 ) >> 8 ); } @@ -1803,7 +1797,6 @@ cursor_stop_timer(void ) static void handle_cursor( KBD_PROTO ) { - int currcons = fg_console; (*do_cursor)( KBD_ARGS ); spk_parked &= 0xfe; if ( synth == NULL || up_flag || spk_shut_up || cursor_track == 0 ) @@ -1813,10 +1806,10 @@ handle_cursor( KBD_PROTO ) /* the key press flushes if !no_inter but we want to flush on cursor * moves regardless of no_inter state */ is_cursor = value+1; - old_cursor_pos = pos; - old_cursor_x = x; - old_cursor_y = y; - cursor_con = currcons; + old_cursor_pos = vc->vc_pos; + old_cursor_x = vc->vc_x; + old_cursor_y = vc->vc_y; + cursor_con = vc->vc_num; cursor_stop_timer( ); cursor_timer.expires = jiffies + cursor_timeout; start_timer (cursor_timer ); @@ -1826,67 +1819,67 @@ handle_cursor( KBD_PROTO ) static void cursor_done (u_long data ) { - int currcons = cursor_con; + struct vc_data *vc = vc_cons[cursor_con].d; cursor_stop_timer( ); if (cursor_con != fg_console ) { is_cursor = 0; return; } - speakup_date (currcons ); + speakup_date (vc ); if ( win_enabled ) { - if ( x >= win_left && x <= win_right && - y >= win_top && y <= win_bottom ) { + if ( vc->vc_x >= win_left && vc->vc_x <= win_right && + vc->vc_y >= win_top && vc->vc_y <= win_bottom ) { spk_keydown = is_cursor = 0; return; } } if ( is_cursor == 1 || is_cursor == 4 ) - say_line_from_to (currcons, 0, vc_cons[currcons].d->vc_cols, 0 ); - else say_char ( currcons ); + say_line_from_to (vc, 0, vc->vc_cols, 0 ); + else say_char ( vc ); spk_keydown = is_cursor = 0; } /* These functions are the interface to speakup from the actual kernel code. */ void -speakup_bs (int currcons ) +speakup_bs (struct vc_data *vc ) { if (!spk_parked ) - speakup_date (currcons ); + speakup_date (vc ); if ( spk_shut_up || synth == NULL ) return; - if ( currcons == fg_console && spk_keydown ) { + if ( vc->vc_num == fg_console && spk_keydown ) { spk_keydown = 0; - if (!is_cursor ) say_char (currcons ); + if (!is_cursor ) say_char (vc ); } } void -speakup_con_write (int currcons, const char *str, int len ) +speakup_con_write (struct vc_data *vc, const char *str, int len ) { - if (spk_shut_up || (currcons != fg_console ) ) + if (spk_shut_up || (vc->vc_num != fg_console ) ) return; - if (bell_pos && spk_keydown && (x == bell_pos - 1 ) ) + if (bell_pos && spk_keydown && (vc->vc_x == bell_pos - 1 ) ) bleep(3 ); if (synth == NULL || is_cursor ) return; if ( win_enabled ) { - if ( x >= win_left && x <= win_right && - y >= win_top && y <= win_bottom ) return; + if ( vc->vc_x >= win_left && vc->vc_x <= win_right && + vc->vc_y >= win_top && vc->vc_y <= win_bottom ) return; } spkup_write (str, len ); } void -speakup_con_update (int currcons ) +speakup_con_update (struct vc_data *vc ) { - if ( speakup_console[currcons] == NULL || spk_parked ) + if ( speakup_console[vc->vc_num] == NULL || spk_parked ) return; - speakup_date (currcons ); + speakup_date (vc ); } static void handle_spec( KBD_PROTO ) { - int currcons = fg_console, on_off = 2; + int on_off = 2; char *label; static const char *lock_status[] = { " off", " on", "" }; (*do_spec)( KBD_ARGS ); @@ -1942,7 +1935,7 @@ inc_dec_var( u_char value ) } static void -speakup_win_set (int currcons ) +speakup_win_set (struct vc_data *vc ) { char info[40]; if ( win_start > 1 ) { @@ -1955,7 +1948,7 @@ speakup_win_set (int currcons ) } if ( win_start && spk_x == win_left && spk_y == win_top ) { win_left = 0; - win_right = vc_cons[currcons].d->vc_cols-1; + win_right = vc->vc_cols-1; win_bottom = spk_y; sprintf( info, "window is line %d", (int)win_top+1 ); } else { @@ -1975,7 +1968,7 @@ speakup_win_set (int currcons ) } static void -speakup_win_clear (int currcons ) +speakup_win_clear (struct vc_data *vc ) { win_top = win_bottom = 0; win_left = win_right = 0; @@ -1984,7 +1977,7 @@ speakup_win_clear (int currcons ) } static void -speakup_win_enable (int currcons ) +speakup_win_enable (struct vc_data *vc ) { if ( win_start < 2 ) { synth_write_msg( "no window" ); @@ -1996,7 +1989,7 @@ speakup_win_enable (int currcons ) } static void -speakup_bits (int currcons ) +speakup_bits (struct vc_data *vc ) { int val = this_speakup_key - ( FIRST_EDIT_BITS - 1 ); if ( special_handler != NULL || val < 1 || val > 6 ) { @@ -2009,13 +2002,12 @@ speakup_bits (int currcons ) special_handler = edit_bits; } -static int handle_goto (int currcons, 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 int num = 0; short maxlen, go_pos; char *cp; - struct vc_data *vc = vc_cons[currcons].d; if ( type == KT_SPKUP && ch == SPEAKUP_GOTO ) goto do_goto; if ( type == KT_LATIN && ch == '\n' ) goto do_goto; if ( type != 0 ) goto oops; @@ -2066,17 +2058,17 @@ do_goto: spk_pos -= spk_x * 2; spk_x = goto_pos; spk_pos += goto_pos * 2; - say_word( currcons ); + say_word( vc ); } else { spk_y = goto_pos; - spk_pos = origin + ( goto_pos * vc->vc_size_row ); - say_line( currcons ); + spk_pos = vc->vc_origin + ( goto_pos * vc->vc_size_row ); + say_line( vc ); } return 1; } static void -speakup_goto (int currcons ) +speakup_goto (struct vc_data *vc ) { if ( special_handler != NULL ) { synth_write_msg( "error" ); @@ -2105,7 +2097,7 @@ static struct tq_struct ld_help = { rout #endif static void -speakup_help (int currcons ) +speakup_help (struct vc_data *vc ) { if ( help_handler == NULL ) { /* we can't call request_module from this context so schedule it*/ @@ -2113,25 +2105,25 @@ speakup_help (int currcons ) schedule_help (&ld_help); return; } - (*help_handler)(currcons, KT_SPKUP, SPEAKUP_HELP, 0 ); + (*help_handler)(vc, KT_SPKUP, SPEAKUP_HELP, 0 ); } static void -do_nothing (int currcons ) +do_nothing (struct vc_data *vc ) { return; /* flush done in do_spkup */ } static u_char key_speakup = 0, spk_key_locked = 0; static void -speakup_lock (int currcons ) +speakup_lock (struct vc_data *vc ) { if ( !spk_key_locked ) spk_key_locked = key_speakup = 16; else spk_key_locked = key_speakup = 0; } -typedef void (*spkup_hand )(int ); +typedef void (*spkup_hand )(struct vc_data * ); spkup_hand spkup_handler[] = { /* must be ordered same as defines in speakup.h */ do_nothing, speakup_goto, speech_kill, speakup_shut_up, speakup_cut, speakup_paste, say_first_char, say_last_char, @@ -2150,7 +2142,7 @@ spkup_hand spkup_handler[] = { /* must b speakup_lock, speakup_help, toggle_cursoring, NULL }; -void do_spkup( int currcons,u_char value ) +void do_spkup( struct vc_data *vc,u_char value ) { if (spk_killed && value != SPEECH_KILL ) return; spk_keydown = 0; @@ -2159,7 +2151,7 @@ void do_spkup( int currcons,u_char value this_speakup_key = value; if (value < SPKUP_MAX_FUNC && spkup_handler[value] ) { do_flush( ); - (*spkup_handler[value] )(currcons ); + (*spkup_handler[value] )(vc ); } else { if ( inc_dec_var( value ) < 0 ) bleep( 9 ); @@ -2175,12 +2167,11 @@ speakup_key ( int shift_state, u_char ke speakup_key (struct vc_data *vc, int shift_state, int keycode, u_short keysym, int up_flag, struct pt_regs *regs ) #endif { - int currcons = fg_console; u_char *key_info; u_char type = KTYP( keysym ), value = KVAL( keysym ), new_key = 0; u_char shift_info, offset; #if (LINUX_VERSION_CODE >= 132419) - tty = vc_cons[currcons].d->vc_tty; + tty = vc->vc_tty; #endif if ( synth == NULL ) return 0; if ( type >= 0xf0 ) type -= 0xf0; @@ -2222,7 +2213,7 @@ speakup_key (struct vc_data *vc, int shi } no_map: if ( type == KT_SPKUP && special_handler == NULL ) { - do_spkup( currcons, new_key ); + do_spkup( vc, new_key ); spk_close_press = 0; return 1; } @@ -2236,7 +2227,7 @@ no_map: type = KT_LATIN; } else if ( type == KT_LETTER ) type = KT_LATIN; else if ( value == 0x7f ) value = 8; /* make del = backspace */ - status = (*special_handler)(currcons, type, value, keycode ); + status = (*special_handler)(vc, type, value, keycode ); spk_close_press = 0; if ( status < 0 ) bleep( 9 ); return status; Only in speakup-dsd: speakup_drvcommon.o Only in speakup-dsd: .speakup_drvcommon.o.cmd Only in speakup-dsd: speakup_keyhelp.ko Only in speakup-dsd: .speakup_keyhelp.ko.cmd Only in speakup-dsd: speakup_keyhelp.mod.c Only in speakup-dsd: speakup_keyhelp.mod.o Only in speakup-dsd: .speakup_keyhelp.mod.o.cmd Only in speakup-dsd: speakup_keyhelp.o Only in speakup-dsd: .speakup_keyhelp.o.cmd Only in speakup-dsd: speakupmain.o Only in speakup-dsd: .speakupmain.o.cmd Only in speakup-dsd: speakup.o Only in speakup-dsd: .speakup.o.cmd diff -urpX dontdiff speakup/spk_priv.h speakup-dsd/spk_priv.h --- speakup/spk_priv.h 2003-10-10 21:08:42.000000000 +0100 +++ speakup-dsd/spk_priv.h 2005-06-22 00:22:47.000000000 +0100 @@ -95,7 +95,7 @@ enum { E_DEFAULT = 0, E_SET, E_INC, E_DE #define MIN( a, b ) ( ( ( a ) < ( b ) ) ? ( a ) : ( b ) ) #endif -typedef int (*special_func)( int currcons, u_char type, u_char ch, u_short key ); +typedef int (*special_func)( struct vc_data *vc, u_char type, u_char ch, u_short key ); typedef struct st_var_header var_header; typedef struct st_num_var num_var; typedef struct st_string_var string_var; @@ -160,25 +160,25 @@ struct st_spk_t { }; /* now some defines to make these easier to use. */ -#define spk_shut_up speakup_console[currcons]->shut_up -#define spk_killed ( speakup_console[currcons]->shut_up & 0x40 ) -#define spk_x speakup_console[currcons]->reading_x -#define spk_cx speakup_console[currcons]->cursor_x -#define spk_y speakup_console[currcons]->reading_y -#define spk_cy speakup_console[currcons]->cursor_y -#define spk_pos ( speakup_console[currcons]->reading_pos ) -#define spk_cp speakup_console[currcons]->cursor_pos -#define goto_pos ( speakup_console[currcons]->go_pos ) -#define goto_x ( speakup_console[currcons]->go_x ) -#define win_top ( speakup_console[currcons]->w_top ) -#define win_bottom ( speakup_console[currcons]->w_bottom ) -#define win_left ( speakup_console[currcons]->w_left ) -#define win_right ( speakup_console[currcons]->w_right ) -#define win_start ( speakup_console[currcons]->w_start ) -#define win_enabled ( speakup_console[currcons]->w_enabled ) -#define spk_attr speakup_console[currcons]->reading_attr -#define spk_old_attr speakup_console[currcons]->old_attr -#define spk_parked speakup_console[currcons]->parked +#define spk_shut_up speakup_console[vc->vc_num]->shut_up +#define spk_killed ( speakup_console[vc->vc_num]->shut_up & 0x40 ) +#define spk_x speakup_console[vc->vc_num]->reading_x +#define spk_cx speakup_console[vc->vc_num]->cursor_x +#define spk_y speakup_console[vc->vc_num]->reading_y +#define spk_cy speakup_console[vc->vc_num]->cursor_y +#define spk_pos ( speakup_console[vc->vc_num]->reading_pos ) +#define spk_cp speakup_console[vc->vc_num]->cursor_pos +#define goto_pos ( speakup_console[vc->vc_num]->go_pos ) +#define goto_x ( speakup_console[vc->vc_num]->go_x ) +#define win_top ( speakup_console[vc->vc_num]->w_top ) +#define win_bottom ( speakup_console[vc->vc_num]->w_bottom ) +#define win_left ( speakup_console[vc->vc_num]->w_left ) +#define win_right ( speakup_console[vc->vc_num]->w_right ) +#define win_start ( speakup_console[vc->vc_num]->w_start ) +#define win_enabled ( speakup_console[vc->vc_num]->w_enabled ) +#define spk_attr speakup_console[vc->vc_num]->reading_attr +#define spk_old_attr speakup_console[vc->vc_num]->old_attr +#define spk_parked speakup_console[vc->vc_num]->parked #define SYNTH_CHECK 20030716 /* today's date ought to do for check value */ /* synth flags, for odd synths */ #define SF_DEC 1 /* to fiddle puncs in alpha strings so it doesn't spell */ --- speakup/speakup_keyhelp.c 2003-10-08 16:02:11.000000000 +0100 +++ speakup-dsd/speakup_keyhelp.c 2005-06-22 16:42:12.000000000 +0100 @@ -192,7 +192,7 @@ static void say_key( int key ) synth_write_msg( keynames[--key] ); } -static int handle_help ( int currcons, u_char type, u_char ch, u_short key ) +static int handle_help ( struct vc_data *vc, u_char type, u_char ch, u_short key ) { int i, n; char *name;