Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libterminfo Ensure there is a terminal to return capabil...
details: https://anonhg.NetBSD.org/src/rev/881b3ba55d42
branches: trunk
changeset: 352194:881b3ba55d42
user: roy <roy%NetBSD.org@localhost>
date: Mon Mar 20 14:46:28 2017 +0000
description:
Ensure there is a terminal to return capabilities from.
diffstat:
lib/libterminfo/term.h | 935 ++++++++++++++++++++++++------------------------
1 files changed, 470 insertions(+), 465 deletions(-)
diffs (truncated from 970 to 300 lines):
diff -r 2eb26b7b65bf -r 881b3ba55d42 lib/libterminfo/term.h
--- a/lib/libterminfo/term.h Mon Mar 20 14:06:43 2017 +0000
+++ b/lib/libterminfo/term.h Mon Mar 20 14:46:28 2017 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: term.h,v 1.17 2017/01/12 13:53:11 roy Exp $ */
+/* $NetBSD: term.h,v 1.18 2017/03/20 14:46:28 roy Exp $ */
/*
* Copyright (c) 2009, 2010, 2011, 2013 The NetBSD Foundation, Inc.
@@ -35,6 +35,11 @@
#define OK (0) /* Success return */
#endif
+/* Ensure we have a terminal to return capabilities from */
+#define TIFLAG(t, c) ((t) != NULL ? (t)->flags[c] : 0)
+#define TINUM(t, c) ((t) != NULL ? (t)->nums[c] : -1)
+#define TISTR(t, c) ((t) != NULL ? (t)->strs[c] : NULL)
+
/* Define available terminfo flags */
enum TIFLAGS {
TICODE_bw,
@@ -77,43 +82,43 @@
};
#define TIFLAGMAX TICODE_xon
-#define t_auto_left_margin(t) (t)->flags[TICODE_bw]
-#define t_auto_right_margin(t) (t)->flags[TICODE_am]
-#define t_back_color_erase(t) (t)->flags[TICODE_bce]
-#define t_can_change(t) (t)->flags[TICODE_ccc]
-#define t_ceol_standout_glitch(t) (t)->flags[TICODE_xhp]
-#define t_col_addr_glitch(t) (t)->flags[TICODE_xhpa]
-#define t_cpi_changes_res(t) (t)->flags[TICODE_cpix]
-#define t_cr_cancels_micro_mode(t) (t)->flags[TICODE_crxm]
-#define t_dest_tabs_magic_smso(t) (t)->flags[TICODE_xt]
-#define t_eat_newline_glitch(t) (t)->flags[TICODE_xenl]
-#define t_erase_overstrike(t) (t)->flags[TICODE_eo]
-#define t_generic_type(t) (t)->flags[TICODE_gn]
-#define t_hard_copy(t) (t)->flags[TICODE_hc]
-#define t_hard_cursor(t) (t)->flags[TICODE_chts]
-#define t_has_meta_key(t) (t)->flags[TICODE_km]
-#define t_has_print_wheel(t) (t)->flags[TICODE_daisy]
-#define t_has_status_line(t) (t)->flags[TICODE_hs]
-#define t_hue_light_saturation(t) (t)->flags[TICODE_hls]
-#define t_insert_null_glitch(t) (t)->flags[TICODE_in]
-#define t_lpi_changes_yes(t) (t)->flags[TICODE_lpix]
-#define t_memory_above(t) (t)->flags[TICODE_da]
-#define t_memory_below(t) (t)->flags[TICODE_db]
-#define t_move_insert_mode(t) (t)->flags[TICODE_mir]
-#define t_move_standout_mode(t) (t)->flags[TICODE_msgr]
-#define t_needs_xon_xoff(t) (t)->flags[TICODE_nxon]
-#define t_no_esc_ctlc(t) (t)->flags[TICODE_xsb]
-#define t_no_pad_char(t) (t)->flags[TICODE_npc]
-#define t_non_dest_scroll_region(t) (t)->flags[TICODE_ndscr]
-#define t_non_rev_rmcup(t) (t)->flags[TICODE_nrrmc]
-#define t_over_strike(t) (t)->flags[TICODE_os]
-#define t_prtr_silent(t) (t)->flags[TICODE_mc5i]
-#define t_row_addr_glitch(t) (t)->flags[TICODE_xvpa]
-#define t_semi_auto_right_margin(t) (t)->flags[TICODE_sam]
-#define t_status_line_esc_ok(t) (t)->flags[TICODE_eslok]
-#define t_tilde_glitch(t) (t)->flags[TICODE_hz]
-#define t_transparent_underline(t) (t)->flags[TICODE_ul]
-#define t_xon_xoff(t) (t)->flags[TICODE_xon]
+#define t_auto_left_margin(t) TIFLAG((t), TICODE_bw)
+#define t_auto_right_margin(t) TIFLAG((t), TICODE_am)
+#define t_back_color_erase(t) TIFLAG((t), TICODE_bce)
+#define t_can_change(t) TIFLAG((t), TICODE_ccc)
+#define t_ceol_standout_glitch(t) TIFLAG((t), TICODE_xhp)
+#define t_col_addr_glitch(t) TIFLAG((t), TICODE_xhpa)
+#define t_cpi_changes_res(t) TIFLAG((t), TICODE_cpix)
+#define t_cr_cancels_micro_mode(t) TIFLAG((t), TICODE_crxm)
+#define t_dest_tabs_magic_smso(t) TIFLAG((t), TICODE_xt)
+#define t_eat_newline_glitch(t) TIFLAG((t), TICODE_xenl)
+#define t_erase_overstrike(t) TIFLAG((t), TICODE_eo)
+#define t_generic_type(t) TIFLAG((t), TICODE_gn)
+#define t_hard_copy(t) TIFLAG((t), TICODE_hc)
+#define t_hard_cursor(t) TIFLAG((t), TICODE_chts)
+#define t_has_meta_key(t) TIFLAG((t), TICODE_km)
+#define t_has_print_wheel(t) TIFLAG((t), TICODE_daisy)
+#define t_has_status_line(t) TIFLAG((t), TICODE_hs)
+#define t_hue_light_saturation(t) TIFLAG((t), TICODE_hls)
+#define t_insert_null_glitch(t) TIFLAG((t), TICODE_in)
+#define t_lpi_changes_yes(t) TIFLAG((t), TICODE_lpix)
+#define t_memory_above(t) TIFLAG((t), TICODE_da)
+#define t_memory_below(t) TIFLAG((t), TICODE_db)
+#define t_move_insert_mode(t) TIFLAG((t), TICODE_mir)
+#define t_move_standout_mode(t) TIFLAG((t), TICODE_msgr)
+#define t_needs_xon_xoff(t) TIFLAG((t), TICODE_nxon)
+#define t_no_esc_ctlc(t) TIFLAG((t), TICODE_xsb)
+#define t_no_pad_char(t) TIFLAG((t), TICODE_npc)
+#define t_non_dest_scroll_region(t) TIFLAG((t), TICODE_ndscr)
+#define t_non_rev_rmcup(t) TIFLAG((t), TICODE_nrrmc)
+#define t_over_strike(t) TIFLAG((t), TICODE_os)
+#define t_prtr_silent(t) TIFLAG((t), TICODE_mc5i)
+#define t_row_addr_glitch(t) TIFLAG((t), TICODE_xvpa)
+#define t_semi_auto_right_margin(t) TIFLAG((t), TICODE_sam)
+#define t_status_line_esc_ok(t) TIFLAG((t), TICODE_eslok)
+#define t_tilde_glitch(t) TIFLAG((t), TICODE_hz)
+#define t_transparent_underline(t) TIFLAG((t), TICODE_ul)
+#define t_xon_xoff(t) TIFLAG((t), TICODE_xon)
#define auto_left_margin t_auto_left_margin(cur_term)
#define auto_right_margin t_auto_right_margin(cur_term)
@@ -233,39 +238,39 @@
};
#define TINUMMAX TICODE_wsl
-#define t_bit_image_entwining(t) (t)->nums[TICODE_bitwin]
-#define t_bit_image_type(t) (t)->nums[TICODE_bitype]
-#define t_buffer_capacity(t) (t)->nums[TICODE_bufsz]
-#define t_buttons(t) (t)->nums[TICODE_btns]
-#define t_columns(t) (t)->nums[TICODE_cols]
-#define t_dot_horz_spacing(t) (t)->nums[TICODE_spinh]
-#define t_dot_vert_spacing(t) (t)->nums[TICODE_spinv]
-#define t_init_tabs(t) (t)->nums[TICODE_it]
-#define t_label_height(t) (t)->nums[TICODE_lh]
-#define t_label_width(t) (t)->nums[TICODE_lw]
-#define t_lines(t) (t)->nums[TICODE_lines]
-#define t_lines_of_memory(t) (t)->nums[TICODE_lm]
-#define t_max_attributes(t) (t)->nums[TICODE_ma]
-#define t_magic_cookie_glitch(t) (t)->nums[TICODE_xmc]
-#define t_max_colors(t) (t)->nums[TICODE_colors]
-#define t_max_micro_address(t) (t)->nums[TICODE_maddr]
-#define t_max_micro_jump(t) (t)->nums[TICODE_mjump]
-#define t_max_pairs(t) (t)->nums[TICODE_pairs]
-#define t_maximum_windows(t) (t)->nums[TICODE_wnum]
-#define t_micro_col_size(t) (t)->nums[TICODE_mcs]
-#define t_micro_line_size(t) (t)->nums[TICODE_mls]
-#define t_no_color_video(t) (t)->nums[TICODE_ncv]
-#define t_num_labels(t) (t)->nums[TICODE_nlab]
-#define t_number_of_pins(t) (t)->nums[TICODE_npins]
-#define t_output_res_char(t) (t)->nums[TICODE_orc]
-#define t_output_res_line(t) (t)->nums[TICODE_orl]
-#define t_output_res_horz_inch(t) (t)->nums[TICODE_orhi]
-#define t_output_res_vert_inch(t) (t)->nums[TICODE_orvi]
-#define t_padding_baud_rate(t) (t)->nums[TICODE_pb]
-#define t_print_rate(t) (t)->nums[TICODE_cps]
-#define t_virtual_terminal(t) (t)->nums[TICODE_vt]
-#define t_wide_char_size(t) (t)->nums[TICODE_widcs]
-#define t_width_status_line(t) (t)->nums[TICODE_wsl]
+#define t_bit_image_entwining(t) TINUM((t), TICODE_bitwin)
+#define t_bit_image_type(t) TINUM((t), TICODE_bitype)
+#define t_buffer_capacity(t) TINUM((t), TICODE_bufsz)
+#define t_buttons(t) TINUM((t), TICODE_btns)
+#define t_columns(t) TINUM((t), TICODE_cols)
+#define t_dot_horz_spacing(t) TINUM((t), TICODE_spinh)
+#define t_dot_vert_spacing(t) TINUM((t), TICODE_spinv)
+#define t_init_tabs(t) TINUM((t), TICODE_it)
+#define t_label_height(t) TINUM((t), TICODE_lh)
+#define t_label_width(t) TINUM((t), TICODE_lw)
+#define t_lines(t) TINUM((t), TICODE_lines)
+#define t_lines_of_memory(t) TINUM((t), TICODE_lm)
+#define t_max_attributes(t) TINUM((t), TICODE_ma)
+#define t_magic_cookie_glitch(t) TINUM((t), TICODE_xmc)
+#define t_max_colors(t) TINUM((t), TICODE_colors)
+#define t_max_micro_address(t) TINUM((t), TICODE_maddr)
+#define t_max_micro_jump(t) TINUM((t), TICODE_mjump)
+#define t_max_pairs(t) TINUM((t), TICODE_pairs)
+#define t_maximum_windows(t) TINUM((t), TICODE_wnum)
+#define t_micro_col_size(t) TINUM((t), TICODE_mcs)
+#define t_micro_line_size(t) TINUM((t), TICODE_mls)
+#define t_no_color_video(t) TINUM((t), TICODE_ncv)
+#define t_num_labels(t) TINUM((t), TICODE_nlab)
+#define t_number_of_pins(t) TINUM((t), TICODE_npins)
+#define t_output_res_char(t) TINUM((t), TICODE_orc)
+#define t_output_res_line(t) TINUM((t), TICODE_orl)
+#define t_output_res_horz_inch(t) TINUM((t), TICODE_orhi)
+#define t_output_res_vert_inch(t) TINUM((t), TICODE_orvi)
+#define t_padding_baud_rate(t) TINUM((t), TICODE_pb)
+#define t_print_rate(t) TINUM((t), TICODE_cps)
+#define t_virtual_terminal(t) TINUM((t), TICODE_vt)
+#define t_wide_char_size(t) TINUM((t), TICODE_widcs)
+#define t_width_status_line(t) TINUM((t), TICODE_wsl)
#define bit_image_entwining t_bit_image_entwining(cur_term)
#define bit_image_type t_bit_image_type(cur_term)
@@ -738,400 +743,400 @@
};
#define TISTRMAX TICODE_zerom
-#define t_acs_chars(t) (t)->strs[TICODE_acsc]
-#define t_alt_scancode_esc(t) (t)->strs[TICODE_scesa]
-#define t_back_tab(t) (t)->strs[TICODE_cbt]
-#define t_bell(t) (t)->strs[TICODE_bel]
-#define t_bit_image_carriage_return(t) (t)->strs[TICODE_bicr]
-#define t_bit_image_newline(t) (t)->strs[TICODE_binel]
-#define t_bit_image_repeat(t) (t)->strs[TICODE_birep]
-#define t_carriage_return(t) (t)->strs[TICODE_cr]
-#define t_change_char_pitch(t) (t)->strs[TICODE_cpi]
-#define t_change_line_pitch(t) (t)->strs[TICODE_lpi]
-#define t_change_res_horz(t) (t)->strs[TICODE_chr]
-#define t_change_res_vert(t) (t)->strs[TICODE_cvr]
-#define t_change_scroll_region(t) (t)->strs[TICODE_csr]
-#define t_char_padding(t) (t)->strs[TICODE_rmp]
-#define t_char_set_names(t) (t)->strs[TICODE_csnm]
-#define t_clear_all_tabs(t) (t)->strs[TICODE_tbc]
-#define t_clear_margins(t) (t)->strs[TICODE_mgc]
-#define t_clear_screen(t) (t)->strs[TICODE_clear]
-#define t_clr_bol(t) (t)->strs[TICODE_el1]
-#define t_clr_eol(t) (t)->strs[TICODE_el]
-#define t_clr_eos(t) (t)->strs[TICODE_ed]
-#define t_code_set_init(t) (t)->strs[TICODE_csin]
-#define t_color_names(t) (t)->strs[TICODE_colornm]
-#define t_column_address(t) (t)->strs[TICODE_hpa]
-#define t_command_character(t) (t)->strs[TICODE_cmdch]
-#define t_create_window(t) (t)->strs[TICODE_cwin]
-#define t_cursor_address(t) (t)->strs[TICODE_cup]
-#define t_cursor_down(t) (t)->strs[TICODE_cud1]
-#define t_cursor_home(t) (t)->strs[TICODE_home]
-#define t_cursor_invisible(t) (t)->strs[TICODE_civis]
-#define t_cursor_left(t) (t)->strs[TICODE_cub1]
-#define t_cursor_mem_address(t) (t)->strs[TICODE_mrcup]
-#define t_cursor_normal(t) (t)->strs[TICODE_cnorm]
-#define t_cursor_right(t) (t)->strs[TICODE_cuf1]
-#define t_cursor_to_ll(t) (t)->strs[TICODE_ll]
-#define t_cursor_up(t) (t)->strs[TICODE_cuu1]
-#define t_cursor_visible(t) (t)->strs[TICODE_cvvis]
-#define t_define_bit_image_region(t) (t)->strs[TICODE_defbi]
-#define t_define_char(t) (t)->strs[TICODE_defc]
-#define t_delete_character(t) (t)->strs[TICODE_dch1]
-#define t_delete_line(t) (t)->strs[TICODE_dl1]
-#define t_device_type(t) (t)->strs[TICODE_devt]
-#define t_dial_phone(t) (t)->strs[TICODE_dial]
-#define t_dis_status_line(t) (t)->strs[TICODE_dsl]
-#define t_display_clock(t) (t)->strs[TICODE_dclk]
-#define t_display_pc_char(t) (t)->strs[TICODE_dispc]
-#define t_down_half_time(t) (t)->strs[TICODE_hd]
-#define t_ena_acs(t) (t)->strs[TICODE_enacs]
-#define t_end_bit_image_region(t) (t)->strs[TICODE_endbi]
-#define t_enter_alt_charset_mode(t) (t)->strs[TICODE_smacs]
-#define t_enter_am_mode(t) (t)->strs[TICODE_smam]
-#define t_enter_blink_mode(t) (t)->strs[TICODE_blink]
-#define t_enter_bold_mode(t) (t)->strs[TICODE_bold]
-#define t_enter_ca_mode(t) (t)->strs[TICODE_smcup]
-#define t_enter_delete_mode(t) (t)->strs[TICODE_smdc]
-#define t_enter_dim_mode(t) (t)->strs[TICODE_dim]
-#define t_enter_doublewide_mode(t) (t)->strs[TICODE_swidm]
-#define t_enter_draft_quality(t) (t)->strs[TICODE_sdrfq]
-#define t_enter_horizontal_hl_mode(t) (t)->strs[TICODE_ehhlm]
-#define t_enter_insert_mode(t) (t)->strs[TICODE_smir]
-#define t_enter_italics_mode(t) (t)->strs[TICODE_sitm]
-#define t_enter_left_hl_mode(t) (t)->strs[TICODE_elhlm]
-#define t_enter_leftward_mode(t) (t)->strs[TICODE_slm]
-#define t_enter_low_hl_mode(t) (t)->strs[TICODE_elohlm]
-#define t_enter_micro_mode(t) (t)->strs[TICODE_smicm]
-#define t_enter_near_quality_letter(t) (t)->strs[TICODE_snlq]
-#define t_enter_normal_quality(t) (t)->strs[TICODE_snrmq]
-#define t_enter_pc_charset_mode(t) (t)->strs[TICODE_smpch]
-#define t_enter_protected_mode(t) (t)->strs[TICODE_prot]
-#define t_enter_reverse_mode(t) (t)->strs[TICODE_rev]
-#define t_enter_right_hl_mode(t) (t)->strs[TICODE_erhlm]
-#define t_enter_scancode_mode(t) (t)->strs[TICODE_smsc]
-#define t_enter_secure_mode(t) (t)->strs[TICODE_invis]
-#define t_enter_shadow_mode(t) (t)->strs[TICODE_sshm]
-#define t_enter_standout_mode(t) (t)->strs[TICODE_smso]
-#define t_enter_subscript_mode(t) (t)->strs[TICODE_ssubm]
-#define t_enter_superscript_mode(t) (t)->strs[TICODE_ssupm]
-#define t_enter_top_hl_mode(t) (t)->strs[TICODE_ethlm]
-#define t_enter_underline_mode(t) (t)->strs[TICODE_smul]
-#define t_enter_upward_mode(t) (t)->strs[TICODE_sum]
-#define t_enter_vertical_hl_mode(t) (t)->strs[TICODE_evhlm]
-#define t_enter_xon_mode(t) (t)->strs[TICODE_smxon]
-#define t_erase_chars(t) (t)->strs[TICODE_ech]
-#define t_exit_alt_charset_mode(t) (t)->strs[TICODE_rmacs]
-#define t_exit_am_mode(t) (t)->strs[TICODE_rmam]
-#define t_exit_attribute_mode(t) (t)->strs[TICODE_sgr0]
-#define t_exit_ca_mode(t) (t)->strs[TICODE_rmcup]
-#define t_exit_delete_mode(t) (t)->strs[TICODE_rmdc]
-#define t_exit_doublewide_mode(t) (t)->strs[TICODE_rwidm]
-#define t_exit_insert_mode(t) (t)->strs[TICODE_rmir]
-#define t_exit_italics_mode(t) (t)->strs[TICODE_ritm]
-#define t_exit_leftward_mode(t) (t)->strs[TICODE_rlm]
-#define t_exit_micro_mode(t) (t)->strs[TICODE_rmicm]
-#define t_exit_pc_charset_mode(t) (t)->strs[TICODE_rmpch]
-#define t_exit_scancode_mode(t) (t)->strs[TICODE_rmsc]
-#define t_exit_shadow_mode(t) (t)->strs[TICODE_rshm]
-#define t_exit_standout_mode(t) (t)->strs[TICODE_rmso]
-#define t_exit_subscript_mode(t) (t)->strs[TICODE_rsubm]
-#define t_exit_superscript_mode(t) (t)->strs[TICODE_rsupm]
-#define t_exit_underline_mode(t) (t)->strs[TICODE_rmul]
-#define t_exit_upward_mode(t) (t)->strs[TICODE_rum]
-#define t_exit_xon_mode(t) (t)->strs[TICODE_rmxon]
-#define t_fixed_pause(t) (t)->strs[TICODE_pause]
-#define t_flash_hook(t) (t)->strs[TICODE_hook]
-#define t_flash_screen(t) (t)->strs[TICODE_flash]
-#define t_form_feed(t) (t)->strs[TICODE_ff]
-#define t_from_status_line(t) (t)->strs[TICODE_fsl]
-#define t_get_mouse(t) (t)->strs[TICODE_getm]
-#define t_goto_window(t) (t)->strs[TICODE_wingo]
-#define t_hangup(t) (t)->strs[TICODE_hup]
-#define t_init_1string(t) (t)->strs[TICODE_is1]
-#define t_init_2string(t) (t)->strs[TICODE_is2]
-#define t_init_3string(t) (t)->strs[TICODE_is3]
-#define t_init_file(t) (t)->strs[TICODE_if]
-#define t_init_prog(t) (t)->strs[TICODE_iprog]
-#define t_initialize_color(t) (t)->strs[TICODE_initc]
-#define t_initialize_pair(t) (t)->strs[TICODE_initp]
-#define t_insert_character(t) (t)->strs[TICODE_ich1]
-#define t_insert_line(t) (t)->strs[TICODE_il1]
-#define t_insert_padding(t) (t)->strs[TICODE_ip]
-#define t_key_a1(t) (t)->strs[TICODE_ka1]
Home |
Main Index |
Thread Index |
Old Index