Lines Matching refs:stream
1110 get_control_data (term_ostream_t stream) in get_control_data() argument
1112 return &stream->control_data; in get_control_data()
1117 simplify_attributes (term_ostream_t stream, attributes_t attr) in simplify_attributes() argument
1120 && stream->no_color_video > 0) in simplify_attributes()
1124 if (stream->no_color_video & 2) in simplify_attributes()
1127 if (stream->no_color_video & 32) in simplify_attributes()
1131 if (!stream->supports_foreground) in simplify_attributes()
1133 if (!stream->supports_background) in simplify_attributes()
1135 if (!stream->supports_weight) in simplify_attributes()
1137 if (!stream->supports_posture) in simplify_attributes()
1139 if (!stream->supports_underline) in simplify_attributes()
1141 if (!stream->supports_hyperlink) in simplify_attributes()
1148 generate_hyperlink_id (term_ostream_t stream) in generate_hyperlink_id() argument
1160 stream->hostname_hash, in generate_hyperlink_id()
1161 (uint32_t) (stream->start_time >> 32), in generate_hyperlink_id()
1162 (uint32_t) stream->start_time, in generate_hyperlink_id()
1163 stream->id_serial in generate_hyperlink_id()
1175 stream->id_serial++; in generate_hyperlink_id()
1223 out_color_change (term_ostream_t stream, term_color_t new_color, in out_color_change() argument
1226 assert (stream->supports_foreground); in out_color_change()
1228 switch (stream->colormodel) in out_color_change()
1233 if (stream->is_windows_console) in out_color_change()
1241 stream->current_console_attributes = in out_color_change()
1242 (stream->current_console_attributes & ~(7 << 0)) in out_color_change()
1244 SetConsoleTextAttribute (stream->handle, stream->current_console_attributes); in out_color_change()
1249 if (stream->set_a_foreground != NULL) in out_color_change()
1250 tputs (tparm (stream->set_a_foreground, color_bgr (new_color)), in out_color_change()
1253 tputs (tparm (stream->set_foreground, new_color), in out_color_change()
1370 out_bgcolor_change (term_ostream_t stream, term_color_t new_bgcolor, in out_bgcolor_change() argument
1373 assert (stream->supports_background); in out_bgcolor_change()
1375 switch (stream->colormodel) in out_bgcolor_change()
1380 if (stream->is_windows_console) in out_bgcolor_change()
1388 stream->current_console_attributes = in out_bgcolor_change()
1389 (stream->current_console_attributes & ~(7 << 4)) in out_bgcolor_change()
1391 SetConsoleTextAttribute (stream->handle, stream->current_console_attributes); in out_bgcolor_change()
1396 if (stream->set_a_background != NULL) in out_bgcolor_change()
1397 tputs (tparm (stream->set_a_background, color_bgr (new_bgcolor)), in out_bgcolor_change()
1400 tputs (tparm (stream->set_background, new_bgcolor), in out_bgcolor_change()
1521 out_weight_change (term_ostream_t stream, term_weight_t new_weight, in out_weight_change() argument
1524 assert (stream->supports_weight); in out_weight_change()
1528 tputs (stream->enter_bold_mode, in out_weight_change()
1534 out_posture_change (term_ostream_t stream, term_posture_t new_posture, in out_posture_change() argument
1537 assert (stream->supports_posture); in out_posture_change()
1541 tputs (stream->enter_italics_mode, in out_posture_change()
1547 out_underline_change (term_ostream_t stream, term_underline_t new_underline, in out_underline_change() argument
1550 assert (stream->supports_underline); in out_underline_change()
1555 if (stream->is_windows_console) in out_underline_change()
1563 stream->current_console_attributes = in out_underline_change()
1564 stream->current_console_attributes | COMMON_LVB_UNDERSCORE; in out_underline_change()
1565 SetConsoleTextAttribute (stream->handle, stream->current_console_attributes); in out_underline_change()
1570 tputs (stream->enter_underline_mode, in out_underline_change()
1577 out_hyperlink_change (term_ostream_t stream, hyperlink_t *new_hyperlink, in out_hyperlink_change() argument
1581 assert (stream->supports_hyperlink); in out_hyperlink_change()
1598 out_attr_change (term_ostream_t stream, attributes_t new_attr) in out_attr_change() argument
1600 attributes_t old_attr = stream->active_attr; in out_attr_change()
1605 stream->active_attr = new_attr; in out_attr_change()
1606 stream->active_attr_color = new_attr.color; in out_attr_change()
1607 stream->active_attr_bgcolor = new_attr.bgcolor; in out_attr_change()
1608 stream->active_attr_hyperlink = new_attr.hyperlink; in out_attr_change()
1611 if (stream->is_windows_console) in out_attr_change()
1619 stream->current_console_attributes = in out_attr_change()
1620 (stream->current_console_attributes in out_attr_change()
1623 ? stream->default_console_attributes & (7 << 0) in out_attr_change()
1626 ? stream->default_console_attributes & (7 << 4) in out_attr_change()
1629 SetConsoleTextAttribute (stream->handle, stream->current_console_attributes); in out_attr_change()
1637 out_stream = stream; in out_attr_change()
1638 out_fd = stream->fd; in out_attr_change()
1645 assert (stream->supports_foreground || stream->supports_background); in out_attr_change()
1646 tputs (stream->orig_pair, 1, out_char); in out_attr_change()
1675 && stream->exit_italics_mode != NULL) in out_attr_change()
1677 tputs (stream->exit_italics_mode, 1, out_char); in out_attr_change()
1683 && stream->exit_underline_mode != NULL) in out_attr_change()
1685 tputs (stream->exit_underline_mode, 1, out_char); in out_attr_change()
1698 tputs (stream->exit_attribute_mode, 1, out_char); in out_attr_change()
1702 if (stream->exit_italics_mode == NULL) in out_attr_change()
1704 if (stream->exit_underline_mode == NULL) in out_attr_change()
1713 out_color_change (stream, new_attr.color, false); in out_attr_change()
1718 out_bgcolor_change (stream, new_attr.bgcolor, false); in out_attr_change()
1723 out_weight_change (stream, new_attr.weight, false); in out_attr_change()
1728 out_posture_change (stream, new_attr.posture, false); in out_attr_change()
1733 out_underline_change (stream, new_attr.underline, false); in out_attr_change()
1737 out_hyperlink_change (stream, new_attr.hyperlink, false); in out_attr_change()
1743 restore (term_ostream_t stream) in restore() argument
1746 if (stream->is_windows_console) in restore()
1751 SetConsoleTextAttribute (stream->handle, stream->default_console_attributes); in restore()
1757 out_stream = stream; in restore()
1758 out_fd = stream->fd; in restore()
1760 if (stream->restore_colors != NULL) in restore()
1761 tputs (stream->restore_colors, 1, out_char_unchecked); in restore()
1762 if (stream->restore_weight != NULL) in restore()
1763 tputs (stream->restore_weight, 1, out_char_unchecked); in restore()
1764 if (stream->restore_posture != NULL) in restore()
1765 tputs (stream->restore_posture, 1, out_char_unchecked); in restore()
1766 if (stream->restore_underline != NULL) in restore()
1767 tputs (stream->restore_underline, 1, out_char_unchecked); in restore()
1768 if (stream->restore_hyperlink != NULL) in restore()
1769 tputs (stream->restore_hyperlink, 1, out_char_unchecked); in restore()
1774 async_restore (term_ostream_t stream) in async_restore() argument
1777 if (stream->is_windows_console) in async_restore()
1782 SetConsoleTextAttribute (stream->handle, stream->default_console_attributes); in async_restore()
1788 out_stream = stream; in async_restore()
1789 out_fd = stream->fd; in async_restore()
1791 if (stream->restore_colors != NULL) in async_restore()
1792 tputs (stream->restore_colors, 1, out_char_unchecked); in async_restore()
1793 if (stream->restore_weight != NULL) in async_restore()
1794 tputs (stream->restore_weight, 1, out_char_unchecked); in async_restore()
1795 if (stream->restore_posture != NULL) in async_restore()
1796 tputs (stream->restore_posture, 1, out_char_unchecked); in async_restore()
1797 if (stream->restore_underline != NULL) in async_restore()
1798 tputs (stream->restore_underline, 1, out_char_unchecked); in async_restore()
1799 if (stream->restore_hyperlink != NULL) in async_restore()
1800 tputs (stream->restore_hyperlink, 1, out_char_unchecked); in async_restore()
1805 async_set_attributes_from_default (term_ostream_t stream) in async_set_attributes_from_default() argument
1808 if (stream->is_windows_console) in async_set_attributes_from_default()
1813 SetConsoleTextAttribute (stream->handle, stream->current_console_attributes); in async_set_attributes_from_default()
1818 attributes_t new_attr = stream->active_attr; in async_set_attributes_from_default()
1822 new_attr.color = stream->active_attr_color; in async_set_attributes_from_default()
1823 new_attr.bgcolor = stream->active_attr_bgcolor; in async_set_attributes_from_default()
1824 new_attr.hyperlink = stream->active_attr_hyperlink; in async_set_attributes_from_default()
1827 out_stream = stream; in async_set_attributes_from_default()
1828 out_fd = stream->fd; in async_set_attributes_from_default()
1831 out_color_change (stream, new_attr.color, true); in async_set_attributes_from_default()
1833 out_bgcolor_change (stream, new_attr.bgcolor, true); in async_set_attributes_from_default()
1835 out_weight_change (stream, new_attr.weight, true); in async_set_attributes_from_default()
1837 out_posture_change (stream, new_attr.posture, true); in async_set_attributes_from_default()
1839 out_underline_change (stream, new_attr.underline, true); in async_set_attributes_from_default()
1841 out_hyperlink_change (stream, new_attr.hyperlink, true); in async_set_attributes_from_default()
1855 activate_default_attr (term_ostream_t stream) in activate_default_attr() argument
1858 out_attr_change (stream, stream->default_attr); in activate_default_attr()
1860 deactivate_term_non_default_mode (&controller, stream); in activate_default_attr()
1867 output_buffer (term_ostream_t stream, attributes_t goal_attr) in output_buffer() argument
1874 cp = stream->buffer; in output_buffer()
1875 ap = stream->attrbuffer; in output_buffer()
1876 len = stream->buflen; in output_buffer()
1879 for (n = 0; n < len && equal_attributes (ap[n], stream->active_attr); n++) in output_buffer()
1883 if (full_write (stream->fd, cp, n) < n) in output_buffer()
1889 if (!equal_attributes (stream->active_attr, stream->default_attr)) in output_buffer()
1890 activate_default_attr (stream); in output_buffer()
1892 stream->filename); in output_buffer()
1900 if (!equal_attributes (*ap, stream->default_attr)) in output_buffer()
1901 activate_term_non_default_mode (&controller, stream); in output_buffer()
1906 out_attr_change (stream, *ap); in output_buffer()
1909 for (n = 1; n < len && equal_attributes (ap[n], stream->active_attr); n++) in output_buffer()
1911 if (full_write (stream->fd, cp, n) < n) in output_buffer()
1917 if (!equal_attributes (stream->active_attr, stream->default_attr)) in output_buffer()
1918 activate_default_attr (stream); in output_buffer()
1920 stream->filename); in output_buffer()
1928 stream->buflen = 0; in output_buffer()
1932 if (!equal_attributes (goal_attr, stream->default_attr)) in output_buffer()
1933 activate_term_non_default_mode (&controller, stream); in output_buffer()
1935 if (!equal_attributes (goal_attr, stream->active_attr)) in output_buffer()
1936 out_attr_change (stream, goal_attr); in output_buffer()
1938 if (equal_attributes (goal_attr, stream->default_attr)) in output_buffer()
1939 deactivate_term_non_default_mode (&controller, stream); in output_buffer()
1944 size_t count = stream->hyperlinks_count; in output_buffer()
1950 hyperlink_t *hyperlink = stream->hyperlinks_array[i]; in output_buffer()
1955 if (hyperlink == stream->curr_attr.hyperlink in output_buffer()
1956 || hyperlink == stream->active_attr.hyperlink) in output_buffer()
1959 stream->hyperlinks_array[j] = hyperlink; in output_buffer()
1968 stream->hyperlinks_count = j; in output_buffer()
1975 term_ostream::rgb_to_color (term_ostream_t stream, int red, int green, int blue) in rgb_to_color() argument
1977 switch (stream->colormodel) in rgb_to_color()
1999 term_ostream::write_mem (term_ostream_t stream, const void *data, size_t len) in write_mem() argument
2009 if (n > stream->allocated - stream->buflen) in write_mem()
2012 xmax (xsum (stream->buflen, n), in write_mem()
2013 xsum (stream->allocated, stream->allocated)); in write_mem()
2018 stream->buffer = (char *) xrealloc (stream->buffer, new_allocated); in write_mem()
2019 stream->attrbuffer = in write_mem()
2021 xrealloc (stream->attrbuffer, in write_mem()
2023 stream->allocated = new_allocated; in write_mem()
2025 memcpy (stream->buffer + stream->buflen, cp, n); in write_mem()
2027 attributes_t attr = stream->simp_attr; in write_mem()
2028 attributes_t *ap = stream->attrbuffer + stream->buflen; in write_mem()
2033 stream->buflen += n; in write_mem()
2037 output_buffer (stream, stream->default_attr); in write_mem()
2038 if (full_write (stream->fd, "\n", 1) < 1) in write_mem()
2040 stream->filename); in write_mem()
2050 term_ostream::flush (term_ostream_t stream, ostream_flush_scope_t scope) in flush() argument
2052 output_buffer (stream, stream->default_attr); in flush()
2056 if (!stream->is_windows_console) in flush()
2060 fsync (stream->fd); in flush()
2063 nonintr_tcdrain (stream->fd); in flush()
2070 term_ostream::free (term_ostream_t stream) in free() argument
2072 term_ostream_flush (stream, FLUSH_THIS_STREAM); in free()
2074 deactivate_term_style_controller (&controller, stream); in free()
2076 free (stream->filename); in free()
2077 if (stream->set_a_foreground != NULL) in free()
2078 free (stream->set_a_foreground); in free()
2079 if (stream->set_foreground != NULL) in free()
2080 free (stream->set_foreground); in free()
2081 if (stream->set_a_background != NULL) in free()
2082 free (stream->set_a_background); in free()
2083 if (stream->set_background != NULL) in free()
2084 free (stream->set_background); in free()
2085 if (stream->orig_pair != NULL) in free()
2086 free (stream->orig_pair); in free()
2087 if (stream->enter_bold_mode != NULL) in free()
2088 free (stream->enter_bold_mode); in free()
2089 if (stream->enter_italics_mode != NULL) in free()
2090 free (stream->enter_italics_mode); in free()
2091 if (stream->exit_italics_mode != NULL) in free()
2092 free (stream->exit_italics_mode); in free()
2093 if (stream->enter_underline_mode != NULL) in free()
2094 free (stream->enter_underline_mode); in free()
2095 if (stream->exit_underline_mode != NULL) in free()
2096 free (stream->exit_underline_mode); in free()
2097 if (stream->exit_attribute_mode != NULL) in free()
2098 free (stream->exit_attribute_mode); in free()
2099 if (stream->hyperlinks_array != NULL) in free()
2101 size_t count = stream->hyperlinks_count; in free()
2104 free_hyperlink (stream->hyperlinks_array[i]); in free()
2105 free (stream->hyperlinks_array); in free()
2107 free (stream->buffer); in free()
2108 free (stream->attrbuffer); in free()
2109 free (stream); in free()
2115 term_ostream::get_color (term_ostream_t stream) in get_color() argument
2117 return stream->curr_attr.color; in get_color()
2121 term_ostream::set_color (term_ostream_t stream, term_color_t color) in set_color() argument
2123 stream->curr_attr.color = color; in set_color()
2124 stream->simp_attr = simplify_attributes (stream, stream->curr_attr); in set_color()
2128 term_ostream::get_bgcolor (term_ostream_t stream) in get_bgcolor() argument
2130 return stream->curr_attr.bgcolor; in get_bgcolor()
2134 term_ostream::set_bgcolor (term_ostream_t stream, term_color_t color) in set_bgcolor() argument
2136 stream->curr_attr.bgcolor = color; in set_bgcolor()
2137 stream->simp_attr = simplify_attributes (stream, stream->curr_attr); in set_bgcolor()
2141 term_ostream::get_weight (term_ostream_t stream) in get_weight() argument
2143 return stream->curr_attr.weight; in get_weight()
2147 term_ostream::set_weight (term_ostream_t stream, term_weight_t weight) in set_weight() argument
2149 stream->curr_attr.weight = weight; in set_weight()
2150 stream->simp_attr = simplify_attributes (stream, stream->curr_attr); in set_weight()
2154 term_ostream::get_posture (term_ostream_t stream) in get_posture() argument
2156 return stream->curr_attr.posture; in get_posture()
2160 term_ostream::set_posture (term_ostream_t stream, term_posture_t posture) in set_posture() argument
2162 stream->curr_attr.posture = posture; in set_posture()
2163 stream->simp_attr = simplify_attributes (stream, stream->curr_attr); in set_posture()
2167 term_ostream::get_underline (term_ostream_t stream) in get_underline() argument
2169 return stream->curr_attr.underline; in get_underline()
2173 term_ostream::set_underline (term_ostream_t stream, term_underline_t underline) in set_underline() argument
2175 stream->curr_attr.underline = underline; in set_underline()
2176 stream->simp_attr = simplify_attributes (stream, stream->curr_attr); in set_underline()
2180 term_ostream::get_hyperlink_ref (term_ostream_t stream) in get_hyperlink_ref() argument
2182 hyperlink_t *hyperlink = stream->curr_attr.hyperlink; in get_hyperlink_ref()
2187 term_ostream::get_hyperlink_id (term_ostream_t stream) in get_hyperlink_id() argument
2189 hyperlink_t *hyperlink = stream->curr_attr.hyperlink; in get_hyperlink_id()
2194 term_ostream::set_hyperlink (term_ostream_t stream, in set_hyperlink() argument
2198 stream->curr_attr.hyperlink = NULL; in set_hyperlink()
2213 if (stream->supports_hyperlink) in set_hyperlink()
2217 hyperlink->real_id = generate_hyperlink_id (stream); in set_hyperlink()
2224 if (stream->hyperlinks_count == stream->hyperlinks_allocated) in set_hyperlink()
2226 stream->hyperlinks_allocated = 2 * stream->hyperlinks_allocated + 10; in set_hyperlink()
2227 stream->hyperlinks_array = in set_hyperlink()
2229 xrealloc (stream->hyperlinks_array, in set_hyperlink()
2230 stream->hyperlinks_allocated * sizeof (hyperlink_t *)); in set_hyperlink()
2232 stream->hyperlinks_array[stream->hyperlinks_count++] = hyperlink; in set_hyperlink()
2235 stream->curr_attr.hyperlink = hyperlink; in set_hyperlink()
2237 stream->simp_attr = simplify_attributes (stream, stream->curr_attr); in set_hyperlink()
2241 term_ostream::flush_to_current_style (term_ostream_t stream) in flush_to_current_style() argument
2243 output_buffer (stream, stream->simp_attr); in flush_to_current_style()
2368 term_ostream_t stream = XMALLOC (struct term_ostream_representation); in term_ostream_create() local
2370 stream->base.vtable = &term_ostream_vtable; in term_ostream_create()
2371 stream->fd = fd; in term_ostream_create()
2373 stream->handle = (HANDLE) _get_osfhandle (fd); in term_ostream_create()
2377 if (stream->handle != INVALID_HANDLE_VALUE in term_ostream_create()
2380 && GetConsoleMode (stream->handle, &mode) != 0) in term_ostream_create()
2388 ok = GetConsoleScreenBufferInfo (stream->handle, &info); in term_ostream_create()
2407 stream->handle = handle; in term_ostream_create()
2412 stream->is_windows_console = true; in term_ostream_create()
2413 stream->default_console_attributes = info.wAttributes; in term_ostream_create()
2414 stream->current_console_attributes = stream->default_console_attributes; in term_ostream_create()
2418 stream->is_windows_console = false; in term_ostream_create()
2421 stream->is_windows_console = false; in term_ostream_create()
2424 stream->filename = xstrdup (filename); in term_ostream_create()
2427 stream->max_colors = -1; in term_ostream_create()
2428 stream->no_color_video = -1; in term_ostream_create()
2429 stream->set_a_foreground = NULL; in term_ostream_create()
2430 stream->set_foreground = NULL; in term_ostream_create()
2431 stream->set_a_background = NULL; in term_ostream_create()
2432 stream->set_background = NULL; in term_ostream_create()
2433 stream->orig_pair = NULL; in term_ostream_create()
2434 stream->enter_bold_mode = NULL; in term_ostream_create()
2435 stream->enter_italics_mode = NULL; in term_ostream_create()
2436 stream->exit_italics_mode = NULL; in term_ostream_create()
2437 stream->enter_underline_mode = NULL; in term_ostream_create()
2438 stream->exit_underline_mode = NULL; in term_ostream_create()
2439 stream->exit_attribute_mode = NULL; in term_ostream_create()
2442 if (stream->is_windows_console) in term_ostream_create()
2464 stream->max_colors = 8; in term_ostream_create()
2465 stream->no_color_video = 1 | 4; in term_ostream_create()
2466 stream->supports_foreground = true; in term_ostream_create()
2467 stream->supports_background = true; in term_ostream_create()
2468 stream->colormodel = cm_common8; in term_ostream_create()
2474 stream->supports_weight = false; in term_ostream_create()
2475 stream->supports_posture = false; in term_ostream_create()
2476 stream->supports_underline = true; in term_ostream_create()
2477 stream->supports_hyperlink = false; in term_ostream_create()
2478 stream->restore_colors = NULL; in term_ostream_create()
2479 stream->restore_weight = NULL; in term_ostream_create()
2480 stream->restore_posture = NULL; in term_ostream_create()
2481 stream->restore_underline = NULL; in term_ostream_create()
2482 stream->restore_hyperlink = NULL; in term_ostream_create()
2505 stream->max_colors = tigetnum ("colors"); in term_ostream_create()
2506 stream->no_color_video = tigetnum ("ncv"); in term_ostream_create()
2507 stream->set_a_foreground = xstrdup0 (tigetstr ("setaf")); in term_ostream_create()
2508 stream->set_foreground = xstrdup0 (tigetstr ("setf")); in term_ostream_create()
2509 stream->set_a_background = xstrdup0 (tigetstr ("setab")); in term_ostream_create()
2510 stream->set_background = xstrdup0 (tigetstr ("setb")); in term_ostream_create()
2511 stream->orig_pair = xstrdup0 (tigetstr ("op")); in term_ostream_create()
2512 stream->enter_bold_mode = xstrdup0 (tigetstr ("bold")); in term_ostream_create()
2513 stream->enter_italics_mode = xstrdup0 (tigetstr ("sitm")); in term_ostream_create()
2514 stream->exit_italics_mode = xstrdup0 (tigetstr ("ritm")); in term_ostream_create()
2515 stream->enter_underline_mode = xstrdup0 (tigetstr ("smul")); in term_ostream_create()
2516 stream->exit_underline_mode = xstrdup0 (tigetstr ("rmul")); in term_ostream_create()
2517 stream->exit_attribute_mode = xstrdup0 (tigetstr ("sgr0")); in term_ostream_create()
2542 stream->max_colors = tgetnum ("Co"); in term_ostream_create()
2543 stream->no_color_video = tgetnum ("NC"); in term_ostream_create()
2544 stream->set_a_foreground = xstrdup0 (tgetstr ("AF", TEBP)); in term_ostream_create()
2545 stream->set_foreground = xstrdup0 (tgetstr ("Sf", TEBP)); in term_ostream_create()
2546 stream->set_a_background = xstrdup0 (tgetstr ("AB", TEBP)); in term_ostream_create()
2547 stream->set_background = xstrdup0 (tgetstr ("Sb", TEBP)); in term_ostream_create()
2548 stream->orig_pair = xstrdup0 (tgetstr ("op", TEBP)); in term_ostream_create()
2549 stream->enter_bold_mode = xstrdup0 (tgetstr ("md", TEBP)); in term_ostream_create()
2550 stream->enter_italics_mode = xstrdup0 (tgetstr ("ZH", TEBP)); in term_ostream_create()
2551 stream->exit_italics_mode = xstrdup0 (tgetstr ("ZR", TEBP)); in term_ostream_create()
2552 stream->enter_underline_mode = xstrdup0 (tgetstr ("us", TEBP)); in term_ostream_create()
2553 stream->exit_underline_mode = xstrdup0 (tgetstr ("ue", TEBP)); in term_ostream_create()
2554 stream->exit_attribute_mode = xstrdup0 (tgetstr ("me", TEBP)); in term_ostream_create()
2560 if (stream->set_a_foreground != NULL in term_ostream_create()
2561 && strcmp (stream->set_a_foreground, "\033[3%p1%dm") == 0) in term_ostream_create()
2563 free (stream->set_a_foreground); in term_ostream_create()
2564 stream->set_a_foreground = xstrdup ("\033[3%dm"); in term_ostream_create()
2566 if (stream->set_a_background != NULL in term_ostream_create()
2567 && strcmp (stream->set_a_background, "\033[4%p1%dm") == 0) in term_ostream_create()
2569 free (stream->set_a_background); in term_ostream_create()
2570 stream->set_a_background = xstrdup ("\033[4%dm"); in term_ostream_create()
2577 stream->no_color_video |= 2 | 32; in term_ostream_create()
2590 stream->max_colors = 8; in term_ostream_create()
2591 stream->no_color_video = 3; in term_ostream_create()
2592 stream->set_a_foreground = xstrdup ("\033[3%p1%dm"); in term_ostream_create()
2593 stream->set_a_background = xstrdup ("\033[4%p1%dm"); in term_ostream_create()
2594 stream->orig_pair = xstrdup ("\033[39;49m"); in term_ostream_create()
2595 stream->enter_bold_mode = xstrdup ("\033[1m"); in term_ostream_create()
2596 stream->enter_underline_mode = xstrdup ("\033[4m"); in term_ostream_create()
2597 stream->exit_underline_mode = xstrdup ("\033[m"); in term_ostream_create()
2598 stream->exit_attribute_mode = xstrdup ("\033[0;10m"); in term_ostream_create()
2605 if (stream->max_colors <= 1 in term_ostream_create()
2608 stream->max_colors = 8; in term_ostream_create()
2609 stream->set_a_foreground = xstrdup ("\033[3%p1%dm"); in term_ostream_create()
2610 stream->set_a_background = xstrdup ("\033[4%p1%dm"); in term_ostream_create()
2611 stream->orig_pair = xstrdup ("\033[39;49m"); in term_ostream_create()
2616 stream->supports_foreground = in term_ostream_create()
2617 (stream->max_colors >= 8 in term_ostream_create()
2618 && (stream->set_a_foreground != NULL || stream->set_foreground != NULL) in term_ostream_create()
2619 && stream->orig_pair != NULL); in term_ostream_create()
2620 stream->supports_background = in term_ostream_create()
2621 (stream->max_colors >= 8 in term_ostream_create()
2622 && (stream->set_a_background != NULL || stream->set_background != NULL) in term_ostream_create()
2623 && stream->orig_pair != NULL); in term_ostream_create()
2624 stream->colormodel = in term_ostream_create()
2625 (stream->supports_foreground || stream->supports_background in term_ostream_create()
2638 ? (stream->max_colors >= 0x7fff ? cm_xtermrgb : in term_ostream_create()
2639 stream->max_colors == 256 ? cm_xterm256 : in term_ostream_create()
2640 stream->max_colors == 88 ? cm_xterm88 : in term_ostream_create()
2641 stream->max_colors == 16 ? cm_xterm16 : in term_ostream_create()
2645 stream->supports_weight = in term_ostream_create()
2646 (stream->enter_bold_mode != NULL in term_ostream_create()
2647 && stream->exit_attribute_mode != NULL); in term_ostream_create()
2648 stream->supports_posture = in term_ostream_create()
2649 (stream->enter_italics_mode != NULL in term_ostream_create()
2650 && (stream->exit_italics_mode != NULL in term_ostream_create()
2651 || stream->exit_attribute_mode != NULL)); in term_ostream_create()
2652 stream->supports_underline = in term_ostream_create()
2653 (stream->enter_underline_mode != NULL in term_ostream_create()
2654 && (stream->exit_underline_mode != NULL in term_ostream_create()
2655 || stream->exit_attribute_mode != NULL)); in term_ostream_create()
2657 stream->supports_hyperlink = should_enable_hyperlinks (term); in term_ostream_create()
2660 stream->restore_colors = in term_ostream_create()
2661 (stream->supports_foreground || stream->supports_background in term_ostream_create()
2662 ? stream->orig_pair in term_ostream_create()
2664 stream->restore_weight = in term_ostream_create()
2665 (stream->supports_weight ? stream->exit_attribute_mode : NULL); in term_ostream_create()
2666 stream->restore_posture = in term_ostream_create()
2667 (stream->supports_posture in term_ostream_create()
2668 ? (stream->exit_italics_mode != NULL in term_ostream_create()
2669 ? stream->exit_italics_mode in term_ostream_create()
2670 : stream->exit_attribute_mode) in term_ostream_create()
2672 stream->restore_underline = in term_ostream_create()
2673 (stream->supports_underline in term_ostream_create()
2674 ? (stream->exit_underline_mode != NULL in term_ostream_create()
2675 ? stream->exit_underline_mode in term_ostream_create()
2676 : stream->exit_attribute_mode) in term_ostream_create()
2678 stream->restore_hyperlink = in term_ostream_create()
2679 (stream->supports_hyperlink in term_ostream_create()
2685 if (stream->supports_hyperlink) in term_ostream_create()
2693 stream->hostname_hash = h; in term_ostream_create()
2700 stream->start_time = in term_ostream_create()
2704 stream->id_serial = 0; in term_ostream_create()
2708 stream->hyperlinks_array = NULL; in term_ostream_create()
2709 stream->hyperlinks_count = 0; in term_ostream_create()
2710 stream->hyperlinks_allocated = 0; in term_ostream_create()
2713 stream->allocated = 120; in term_ostream_create()
2714 stream->buffer = XNMALLOC (stream->allocated, char); in term_ostream_create()
2715 stream->attrbuffer = XNMALLOC (stream->allocated, attributes_t); in term_ostream_create()
2716 stream->buflen = 0; in term_ostream_create()
2730 simplified_default = simplify_attributes (stream, assumed_default); in term_ostream_create()
2732 stream->default_attr = simplified_default; in term_ostream_create()
2733 stream->active_attr = simplified_default; in term_ostream_create()
2734 stream->curr_attr = assumed_default; in term_ostream_create()
2735 stream->simp_attr = simplified_default; in term_ostream_create()
2739 activate_term_style_controller (&controller, stream, fd, tty_control); in term_ostream_create()
2741 return stream; in term_ostream_create()