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)
413 static void announce_edge(struct vc_data *vc, enum edge msg_id)
457 static u16 get_char(struct vc_data *vc, u16 *pos, u_char *attribs)
461 if (vc && pos) {
465 pos = screen_pos(vc, pos - (u16 *)vc->vc_origin, true);
469 if (w & vc->vc_hi_font_mask) {
470 w &= ~vc->vc_hi_font_mask;
474 ch = inverse_translate(vc, c, true);
480 static void say_char(struct vc_data *vc)
485 ch = get_char(vc, (u_short *)spk_pos, &spk_attr);
490 say_attributes(vc);
495 static void say_phonetic_char(struct vc_data *vc)
500 ch = get_char(vc, (u_short *)spk_pos, &spk_attr);
511 static void say_prev_char(struct vc_data *vc)
515 announce_edge(vc, edge_left);
520 say_char(vc);
523 static void say_next_char(struct vc_data *vc)
526 if (spk_x == vc->vc_cols - 1) {
527 announce_edge(vc, edge_right);
532 say_char(vc);
544 static u_long get_word(struct vc_data *vc)
552 ch = get_char(vc, (u_short *)tmp_pos, &temp);
559 } else if (tmpx < vc->vc_cols - 2 &&
561 get_char(vc, (u_short *)tmp_pos + 1, &temp) > SPACE) {
566 ch = get_char(vc, (u_short *)tmp_pos - 1, &temp);
569 get_char(vc, (u_short *)tmp_pos, &temp) > SPACE)
575 attr_ch = get_char(vc, (u_short *)tmp_pos, &spk_attr);
577 while (tmpx < vc->vc_cols - 1 && cnt < sizeof(buf) - 1) {
580 ch = get_char(vc, (u_short *)tmp_pos, &temp);
591 static void say_word(struct vc_data *vc)
593 u_long cnt = get_word(vc);
604 static void say_prev_word(struct vc_data *vc)
615 announce_edge(vc, edge_top);
619 spk_x = vc->vc_cols;
633 spk_x = vc->vc_cols - 1;
638 ch = get_char(vc, (u_short *)spk_pos, &temp);
655 announce_edge(vc, edge_said);
656 say_word(vc);
659 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)
1298 static void toggle_cursoring(struct vc_data *vc)
1328 static int edit_bits(struct vc_data *vc, u_char type, u_char ch, u_short key)
1350 static int speakup_allocate(struct vc_data *vc, gfp_t gfp_flags)
1354 vc_num = vc->vc_num;
1360 speakup_date(vc);
1362 speakup_date(vc);
1368 static void speakup_deallocate(struct vc_data *vc)
1372 vc_num = vc->vc_num;
1398 static void start_read_all_timer(struct vc_data *vc, enum read_all_command command);
1400 static void kbd_fakekey2(struct vc_data *vc, enum read_all_command command)
1404 start_read_all_timer(vc, command);
1407 static void read_all_doc(struct vc_data *vc)
1409 if ((vc->vc_num != fg_console) || !synth || spk_shut_up)
1417 if (get_sentence_buf(vc, 0) == -1) {
1421 start_read_all_timer(vc, RA_DOWN_ARROW);
1425 start_read_all_timer(vc, RA_TIMER);
1429 static void stop_read_all(struct vc_data *vc)
1437 static void start_read_all_timer(struct vc_data *vc, enum read_all_command command)
1441 cursor_con = vc->vc_num;
1448 static void handle_cursor_read_all(struct vc_data *vc, enum read_all_command command)
1460 kbd_fakekey2(vc, RA_FIND_NEXT_SENT);
1473 kbd_fakekey2(vc, RA_FIND_NEXT_SENT);
1478 start_read_all_timer(vc, RA_TIMER);
1483 read_all_doc(vc);
1488 if (get_sentence_buf(vc, 0) == -1) {
1489 kbd_fakekey2(vc, RA_DOWN_ARROW);
1493 start_read_all_timer(vc, RA_TIMER);
1497 rv = get_sentence_buf(vc, 0);
1499 read_all_doc(vc);
1501 kbd_fakekey2(vc, RA_FIND_NEXT_SENT);
1505 start_read_all_timer(vc, RA_TIMER);
1513 kbd_fakekey2(vc, RA_DOWN_ARROW);
1515 start_read_all_timer(vc, RA_TIMER);
1520 static int pre_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
1534 start_read_all_timer(vc, value + 1);
1542 static void do_handle_cursor(struct vc_data *vc, u_char value, char up_flag)
1560 old_cursor_pos = vc->vc_pos;
1561 old_cursor_x = vc->state.x;
1562 old_cursor_y = vc->state.y;
1563 speakup_console[vc->vc_num]->ht.cy = vc->state.y;
1564 cursor_con = vc->vc_num;
1566 reset_highlight_buffers(vc);
1573 static void update_color_buffer(struct vc_data *vc, const u16 *ic, int len)
1576 int vc_num = vc->vc_num;
1578 bi = (vc->vc_attr & 0x70) >> 4;
1583 speakup_console[vc_num]->ht.rpos[bi] = vc->vc_pos;
1584 speakup_console[vc_num]->ht.rx[bi] = vc->state.x;
1585 speakup_console[vc_num]->ht.ry[bi] = vc->state.y;
1604 static void reset_highlight_buffers(struct vc_data *vc)
1607 int vc_num = vc->vc_num;
1613 static int count_highlight_color(struct vc_data *vc)
1617 int vc_num = vc->vc_num;
1619 u16 *start = (u16 *)vc->vc_origin;
1624 for (i = 0; i < vc->vc_rows; i++) {
1625 u16 *end = start + vc->vc_cols * 2;
1629 ch = get_attributes(vc, ptr);
1633 start += vc->vc_size_row;
1643 static int get_highlight_color(struct vc_data *vc)
1647 int vc_num = vc->vc_num;
1665 static int speak_highlight(struct vc_data *vc)
1668 int vc_num = vc->vc_num;
1670 if (count_highlight_color(vc) == 1)
1672 hc = get_highlight_color(vc);
1674 d = vc->state.y - speakup_console[vc_num]->ht.cy;
1676 if (speakup_console[vc_num]->ht.ry[hc] != vc->state.y)
1692 struct vc_data *vc = vc_cons[cursor_con].d;
1701 speakup_date(vc);
1703 if (vc->state.x >= win_left && vc->state.x <= win_right &&
1704 vc->state.y >= win_top && vc->state.y <= win_bottom) {
1711 handle_cursor_read_all(vc, read_all_key);
1715 if (speak_highlight(vc)) {
1722 speakup_win_say(vc);
1724 say_line_from_to(vc, 0, vc->vc_cols, 0);
1727 say_phonetic_char(vc);
1729 say_char(vc);
1738 static void speakup_bs(struct vc_data *vc)
1742 if (!speakup_console[vc->vc_num])
1748 speakup_date(vc);
1753 if (vc->vc_num == fg_console && spk_keydown) {
1756 say_char(vc);
1762 static void speakup_con_write(struct vc_data *vc, u16 *str, int len)
1766 if ((vc->vc_num != fg_console) || spk_shut_up || !synth)
1771 if (spk_bell_pos && spk_keydown && (vc->state.x == spk_bell_pos - 1))
1775 update_color_buffer(vc, str, len);
1780 if (vc->state.x >= win_left && vc->state.x <= win_right &&
1781 vc->state.y >= win_top && vc->state.y <= win_bottom) {
1791 static void speakup_con_update(struct vc_data *vc)
1795 if (!speakup_console[vc->vc_num] || spk_parked || !synth)
1800 speakup_date(vc);
1801 if (vc->vc_mode == KD_GRAPHICS && !spk_paused && spk_str_pause[0]) {
1808 static void do_handle_spec(struct vc_data *vc, u_char value, char up_flag)
1832 if (speakup_console[vc->vc_num])
1833 speakup_console[vc->vc_num]->tty_stopped = on_off;
1879 static void speakup_win_set(struct vc_data *vc)
1893 win_right = vc->vc_cols - 1;
1914 static void speakup_win_clear(struct vc_data *vc)
1924 static void speakup_win_enable(struct vc_data *vc)
1937 static void speakup_bits(struct vc_data *vc)
1950 static int handle_goto(struct vc_data *vc, u_char type, u_char ch, u_short key)
2005 if (goto_pos >= vc->vc_cols)
2006 goto_pos = vc->vc_cols - 1;
2014 if (goto_pos >= vc->vc_rows)
2015 goto_pos = vc->vc_rows - 1;
2026 say_word(vc);
2029 spk_pos = vc->vc_origin + (goto_pos * vc->vc_size_row);
2030 say_line(vc);
2035 static void speakup_goto(struct vc_data *vc)
2045 static void speakup_help(struct vc_data *vc)
2047 spk_handle_help(vc, KT_SPKUP, SPEAKUP_HELP, 0);
2050 static void do_nothing(struct vc_data *vc)
2057 static void speakup_lock(struct vc_data *vc)
2088 static void do_spkup(struct vc_data *vc, u_char value)
2098 (*spkup_handler[value]) (vc);
2108 speakup_key(struct vc_data *vc, int shift_state, int keycode, u_short keysym,
2122 tty = vc->port.tty;
2153 stop_read_all(vc);
2190 do_spkup(vc, new_key);
2214 ret = (*spk_special_handler) (vc, type, value, keycode);
2230 struct vc_data *vc = param->vc;
2237 if (vc->vc_mode == KD_GRAPHICS)
2264 if (speakup_key(vc, param->shift, keycode, param->value, up))
2267 ret = pre_handle_cursor(vc, KVAL(param->value), up);
2275 do_handle_shift(vc, val, up);
2279 do_handle_latin(vc, val, up);
2282 do_handle_cursor(vc, val, up);
2285 do_handle_spec(vc, val, up);
2300 struct vc_data *vc = param->vc;
2304 if (vc->vc_mode == KD_TEXT)
2305 speakup_allocate(vc, GFP_ATOMIC);
2308 speakup_deallocate(vc);
2312 speakup_bs(vc);
2316 speakup_con_write(vc, &d, 1);
2320 speakup_con_update(vc);
2367 struct vc_data *vc = vc_cons[fg_console].d;
2375 spk_vars[0].u.n.high = vc->vc_cols;