Lines Matching refs:vc

258 static unsigned char get_attributes(struct vc_data *vc, u16 *pos)
260 pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, true);
261 return (scr_readw(pos) & ~vc->vc_hi_font_mask) >> 8;
264 static void speakup_date(struct vc_data *vc)
266 spk_x = spk_cx = vc->state.x;
267 spk_y = spk_cy = vc->state.y;
268 spk_pos = spk_cp = vc->vc_pos;
270 spk_attr = get_attributes(vc, (u_short *)spk_pos);
290 static void speakup_shut_up(struct vc_data *vc)
296 speakup_date(vc);
301 static void speech_kill(struct vc_data *vc)
319 static void speakup_off(struct vc_data *vc)
328 speakup_date(vc);
331 static void speakup_parked(struct vc_data *vc)
342 static void speakup_cut(struct vc_data *vc)
351 spk_sel_cons = vc;
377 static void speakup_paste(struct vc_data *vc)
388 static void say_attributes(struct vc_data *vc)
415 static void announce_edge(struct vc_data *vc, int msg_id)
459 static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs)
463 if (vc && pos) {
467 pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, true);
471 if (w & vc->vc_hi_font_mask) {
472 w &= ~vc->vc_hi_font_mask;
476 ch = inverse_translate(vc, c, 1);
482 static void say_char(struct vc_data *vc)
487 ch = get_char(vc, (u_short *)spk_pos, &spk_attr);
492 say_attributes(vc);
497 static void say_phonetic_char(struct vc_data *vc)
502 ch = get_char(vc, (u_short *)spk_pos, &spk_attr);
513 static void say_prev_char(struct vc_data *vc)
517 announce_edge(vc, edge_left);
522 say_char(vc);
525 static void say_next_char(struct vc_data *vc)
528 if (spk_x == vc->vc_cols - 1) {
529 announce_edge(vc, edge_right);
534 say_char(vc);
546 static u_long get_word(struct vc_data *vc)
554 ch = get_char(vc, (u_short *)tmp_pos, &temp);
561 } else if (tmpx < vc->vc_cols - 2 &&
563 get_char(vc, (u_short *)tmp_pos + 1, &temp) > SPACE) {
568 ch = get_char(vc, (u_short *)tmp_pos - 1, &temp);
571 get_char(vc, (u_short *)tmp_pos, &temp) > SPACE)
577 attr_ch = get_char(vc, (u_short *)tmp_pos, &spk_attr);
579 while (tmpx < vc->vc_cols - 1) {
582 ch = get_char(vc, (u_short *)tmp_pos, &temp);
593 static void say_word(struct vc_data *vc)
595 u_long cnt = get_word(vc);
606 static void say_prev_word(struct vc_data *vc)
616 announce_edge(vc, edge_top);
620 spk_x = vc->vc_cols;
634 spk_x = vc->vc_cols - 1;
639 ch = get_char(vc, (u_short *)spk_pos, &temp);
656 announce_edge(vc, edge_said);
657 say_word(vc);
660 static void say_next_word(struct vc_data *vc)
667 if (spk_x == vc->vc_cols - 1 && spk_y == vc->vc_rows - 1) {
668 announce_edge(vc, edge_bottom);
672 ch = get_char(vc, (u_short *)spk_pos, &temp);
681 if (spk_x >= vc->vc_cols - 1) {
682 if (spk_y == vc->vc_rows - 1) {
697 announce_edge(vc, edge_said);
698 say_word(vc);
701 static void spell_word(struct vc_data *vc)
711 if (!get_word(vc))
751 static int get_line(struct vc_data *vc)
758 spk_attr = get_attributes(vc, (u_short *)spk_pos);
759 for (i = 0; i < vc->vc_cols; i++) {
760 buf[i] = get_char(vc, (u_short *)tmp, &tmp2);
769 static void say_line(struct vc_data *vc)
771 int i = get_line(vc);
791 static void say_prev_line(struct vc_data *vc)
795 announce_edge(vc, edge_top);
799 spk_pos -= vc->vc_size_row;
800 say_line(vc);
803 static void say_next_line(struct vc_data *vc)
806 if (spk_y == vc->vc_rows - 1) {
807 announce_edge(vc, edge_bottom);
811 spk_pos += vc->vc_size_row;
812 say_line(vc);
815 static int say_from_to(struct vc_data *vc, u_long from, u_long to,
823 spk_attr = get_attributes(vc, (u_short *)from);
825 buf[i++] = get_char(vc, (u_short *)from, &tmp);
827 if (i >= vc->vc_size_row)
845 static void say_line_from_to(struct vc_data *vc, u_long from, u_long to,
848 u_long start = vc->vc_origin + (spk_y * vc->vc_size_row);
852 if (say_from_to(vc, start, end, read_punc) <= 0)
881 static int get_sentence_buf(struct vc_data *vc, int read_punc)
891 start = vc->vc_origin + ((spk_y) * vc->vc_size_row);
892 end = vc->vc_origin + ((spk_y) * vc->vc_size_row) + vc->vc_cols * 2;
898 spk_attr = get_attributes(vc, (u_short *)start);
901 sentbuf[bn][i] = get_char(vc, (u_short *)start, &tmp);
914 if (i >= vc->vc_size_row)
932 static void say_screen_from_to(struct vc_data *vc, u_long from, u_long to)
934 u_long start = vc->vc_origin, end;
937 start += from * vc->vc_size_row;
938 if (to > vc->vc_rows)
939 to = vc->vc_rows;
940 end = vc->vc_origin + (to * vc->vc_size_row);
942 to = from + vc->vc_size_row;
943 say_from_to(vc, from, to, 1);
947 static void say_screen(struct vc_data *vc)
949 say_screen_from_to(vc, 0, vc->vc_rows);
952 static void speakup_win_say(struct vc_data *vc)
960 start = vc->vc_origin + (win_top * vc->vc_size_row);
961 end = vc->vc_origin + (win_bottom * vc->vc_size_row);
965 say_from_to(vc, from, to, 1);
966 start += vc->vc_size_row;
970 static void top_edge(struct vc_data *vc)
973 spk_pos = vc->vc_origin + 2 * spk_x;
975 say_line(vc);
978 static void bottom_edge(struct vc_data *vc)
981 spk_pos += (vc->vc_rows - spk_y - 1) * vc->vc_size_row;
982 spk_y = vc->vc_rows - 1;
983 say_line(vc);
986 static void left_edge(struct vc_data *vc)
991 say_char(vc);
994 static void right_edge(struct vc_data *vc)
997 spk_pos += (vc->vc_cols - spk_x - 1) * 2;
998 spk_x = vc->vc_cols - 1;
999 say_char(vc);
1002 static void say_first_char(struct vc_data *vc)
1004 int i, len = get_line(vc);
1022 static void say_last_char(struct vc_data *vc)
1024 int len = get_line(vc);
1039 static void say_position(struct vc_data *vc)
1042 vc->vc_num + 1);
1047 static void say_char_num(struct vc_data *vc)
1050 u16 ch = get_char(vc, (u_short *)spk_pos, &tmp);
1057 static void say_from_top(struct vc_data *vc)
1059 say_screen_from_to(vc, 0, spk_y);
1062 static void say_to_bottom(struct vc_data *vc)
1064 say_screen_from_to(vc, spk_y, vc->vc_rows);
1067 static void say_from_left(struct vc_data *vc)
1069 say_line_from_to(vc, 0, spk_x, 1);
1072 static void say_to_right(struct vc_data *vc)
1074 say_line_from_to(vc, spk_x, vc->vc_cols, 1);
1161 static void read_all_doc(struct vc_data *vc);
1165 static void do_handle_shift(struct vc_data *vc, u_char value, char up_flag)
1178 read_all_doc(vc);
1196 static void do_handle_latin(struct vc_data *vc, u_char value, char up_flag)
1289 static void toggle_cursoring(struct vc_data *vc)
1319 static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key)
1341 static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
1345 vc_num = vc->vc_num;
1351 speakup_date(vc);
1353 speakup_date(vc);
1359 static void speakup_deallocate(struct vc_data *vc)
1363 vc_num = vc->vc_num;
1378 static void start_read_all_timer(struct vc_data *vc, int command);
1392 static void kbd_fakekey2(struct vc_data *vc, int command)
1396 start_read_all_timer(vc, command);
1399 static void read_all_doc(struct vc_data *vc)
1401 if ((vc->vc_num != fg_console) || !synth || spk_shut_up)
1409 if (get_sentence_buf(vc, 0) == -1) {
1413 start_read_all_timer(vc, RA_DOWN_ARROW);
1417 start_read_all_timer(vc, RA_TIMER);
1421 static void stop_read_all(struct vc_data *vc)
1429 static void start_read_all_timer(struct vc_data *vc, int command)
1433 cursor_con = vc->vc_num;
1440 static void handle_cursor_read_all(struct vc_data *vc, int command)
1452 kbd_fakekey2(vc, RA_FIND_NEXT_SENT);
1465 kbd_fakekey2(vc, RA_FIND_NEXT_SENT);
1470 start_read_all_timer(vc, RA_TIMER);
1475 read_all_doc(vc);
1480 if (get_sentence_buf(vc, 0) == -1) {
1481 kbd_fakekey2(vc, RA_DOWN_ARROW);
1485 start_read_all_timer(vc, RA_TIMER);
1489 rv = get_sentence_buf(vc, 0);
1491 read_all_doc(vc);
1493 kbd_fakekey2(vc, RA_FIND_NEXT_SENT);
1497 start_read_all_timer(vc, RA_TIMER);
1505 kbd_fakekey2(vc, RA_DOWN_ARROW);
1507 start_read_all_timer(vc, RA_TIMER);
1512 static int pre_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
1526 start_read_all_timer(vc, value + 1);
1534 static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
1552 old_cursor_pos = vc->vc_pos;
1553 old_cursor_x = vc->state.x;
1554 old_cursor_y = vc->state.y;
1555 speakup_console[vc->vc_num]->ht.cy = vc->state.y;
1556 cursor_con = vc->vc_num;
1558 reset_highlight_buffers(vc);
1565 static void update_color_buffer(struct vc_data *vc, const u16 *ic, int len)
1568 int vc_num = vc->vc_num;
1570 bi = (vc->vc_attr & 0x70) >> 4;
1575 speakup_console[vc_num]->ht.rpos[bi] = vc->vc_pos;
1576 speakup_console[vc_num]->ht.rx[bi] = vc->state.x;
1577 speakup_console[vc_num]->ht.ry[bi] = vc->state.y;
1596 static void reset_highlight_buffers(struct vc_data *vc)
1599 int vc_num = vc->vc_num;
1605 static int count_highlight_color(struct vc_data *vc)
1609 int vc_num = vc->vc_num;
1611 u16 *start = (u16 *)vc->vc_origin;
1616 for (i = 0; i < vc->vc_rows; i++) {
1617 u16 *end = start + vc->vc_cols * 2;
1621 ch = get_attributes(vc, ptr);
1625 start += vc->vc_size_row;
1635 static int get_highlight_color(struct vc_data *vc)
1639 int vc_num = vc->vc_num;
1657 static int speak_highlight(struct vc_data *vc)
1660 int vc_num = vc->vc_num;
1662 if (count_highlight_color(vc) == 1)
1664 hc = get_highlight_color(vc);
1666 d = vc->state.y - speakup_console[vc_num]->ht.cy;
1668 if (speakup_console[vc_num]->ht.ry[hc] != vc->state.y)
1684 struct vc_data *vc = vc_cons[cursor_con].d;
1693 speakup_date(vc);
1695 if (vc->state.x >= win_left && vc->state.x <= win_right &&
1696 vc->state.y >= win_top && vc->state.y <= win_bottom) {
1703 handle_cursor_read_all(vc, read_all_key);
1707 if (speak_highlight(vc)) {
1714 speakup_win_say(vc);
1716 say_line_from_to(vc, 0, vc->vc_cols, 0);
1718 say_char(vc);
1726 static void speakup_bs(struct vc_data *vc)
1730 if (!speakup_console[vc->vc_num])
1736 speakup_date(vc);
1741 if (vc->vc_num == fg_console && spk_keydown) {
1744 say_char(vc);
1750 static void speakup_con_write(struct vc_data *vc, u16 *str, int len)
1754 if ((vc->vc_num != fg_console) || spk_shut_up || !synth)
1759 if (spk_bell_pos && spk_keydown && (vc->state.x == spk_bell_pos - 1))
1763 update_color_buffer(vc, str, len);
1768 if (vc->state.x >= win_left && vc->state.x <= win_right &&
1769 vc->state.y >= win_top && vc->state.y <= win_bottom) {
1779 static void speakup_con_update(struct vc_data *vc)
1783 if (!speakup_console[vc->vc_num] || spk_parked || !synth)
1788 speakup_date(vc);
1789 if (vc->vc_mode == KD_GRAPHICS && !spk_paused && spk_str_pause[0]) {
1796 static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag)
1820 if (speakup_console[vc->vc_num])
1821 speakup_console[vc->vc_num]->tty_stopped = on_off;
1867 static void speakup_win_set(struct vc_data *vc)
1881 win_right = vc->vc_cols - 1;
1902 static void speakup_win_clear(struct vc_data *vc)
1912 static void speakup_win_enable(struct vc_data *vc)
1925 static void speakup_bits(struct vc_data *vc)
1938 static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
1993 if (goto_pos >= vc->vc_cols)
1994 goto_pos = vc->vc_cols - 1;
2002 if (goto_pos >= vc->vc_rows)
2003 goto_pos = vc->vc_rows - 1;
2014 say_word(vc);
2017 spk_pos = vc->vc_origin + (goto_pos * vc->vc_size_row);
2018 say_line(vc);
2023 static void speakup_goto(struct vc_data *vc)
2033 static void speakup_help(struct vc_data *vc)
2035 spk_handle_help(vc, KT_SPKUP, SPEAKUP_HELP, 0);
2038 static void do_nothing(struct vc_data *vc)
2045 static void speakup_lock(struct vc_data *vc)
2076 static void do_spkup(struct vc_data *vc, u_char value)
2086 (*spkup_handler[value]) (vc);
2096 speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
2110 tty = vc->port.tty;
2141 stop_read_all(vc);
2178 do_spkup(vc, new_key);
2202 ret = (*spk_special_handler) (vc, type, value, keycode);
2218 struct vc_data *vc = param->vc;
2225 if (vc->vc_mode == KD_GRAPHICS)
2252 if (speakup_key(vc, param->shift, keycode, param->value, up))
2255 ret = pre_handle_cursor(vc, KVAL(param->value), up);
2263 do_handle_shift(vc, val, up);
2267 do_handle_latin(vc, val, up);
2270 do_handle_cursor(vc, val, up);
2273 do_handle_spec(vc, val, up);
2288 struct vc_data *vc = param->vc;
2292 if (vc->vc_mode == KD_TEXT)
2293 speakup_allocate(vc, GFP_ATOMIC);
2296 speakup_deallocate(vc);
2300 speakup_bs(vc);
2304 speakup_con_write(vc, &d, 1);
2308 speakup_con_update(vc);
2355 struct vc_data *vc = vc_cons[fg_console].d;
2363 spk_vars[0].u.n.high = vc->vc_cols;