From 55ccd2b959766810cf7db8d1c4462f338ce0afc8 Mon Sep 17 00:00:00 2001 From: "Thomas E. Dickey" Date: Sun, 9 Oct 2005 14:41:57 -0400 Subject: [PATCH] ncurses 5.5 --- ANNOUNCE | 392 +- Ada95/gen/Makefile.in | 17 +- Ada95/gen/gen.c | 1075 +-- .../terminal_interface-curses-mouse.ads.m4 | 6 +- Ada95/gen/terminal_interface-curses.ads.m4 | 10 +- Ada95/samples/Makefile.in | 21 +- Ada95/samples/ncurses2-acs_and_scroll.adb | 15 +- Ada95/samples/ncurses2-acs_display.adb | 21 +- Ada95/samples/ncurses2-attr_test.adb | 11 +- Ada95/samples/ncurses2-color_edit.adb | 7 +- Ada95/samples/ncurses2-demo_forms.adb | 11 +- Ada95/samples/ncurses2-demo_pad.adb | 40 +- Ada95/samples/ncurses2-demo_panels.adb | 31 +- Ada95/samples/ncurses2-getch_test.adb | 12 +- Ada95/samples/ncurses2-getopt.adb | 9 +- Ada95/samples/ncurses2-m.adb | 5 +- Ada95/samples/ncurses2-menu_test.adb | 8 +- Ada95/samples/ncurses2-overlap_test.adb | 9 +- Ada95/samples/ncurses2-slk_test.adb | 12 +- Ada95/samples/ncurses2-util.adb | 10 +- Ada95/samples/sample-curses_demo.adb | 7 +- Ada95/samples/sample-explanation.adb | 9 +- Ada95/samples/sample-form_demo-aux.adb | 12 +- Ada95/samples/sample-form_demo-handler.adb | 7 +- Ada95/samples/sample-form_demo.adb | 10 +- Ada95/samples/sample-function_key_setting.adb | 7 +- Ada95/samples/sample-header_handler.adb | 17 +- Ada95/samples/sample-keyboard_handler.adb | 10 +- Ada95/samples/sample-menu_demo-handler.adb | 7 +- Ada95/samples/sample-menu_demo.adb | 15 +- Ada95/samples/sample-my_field_type.adb | 10 +- Ada95/samples/sample-text_io_demo.adb | 11 +- Ada95/src/Makefile.in | 13 +- ...rses-forms-field_types-enumeration-ada.adb | 7 +- ...e-curses-forms-field_types-user-choice.adb | 9 +- ...nterface-curses-forms-field_types-user.adb | 12 +- ...nal_interface-curses-forms-field_types.adb | 7 +- Ada95/src/terminal_interface-curses-forms.adb | 21 +- Ada95/src/terminal_interface-curses-menus.adb | 25 +- Ada95/src/terminal_interface-curses-mouse.adb | 12 +- .../src/terminal_interface-curses-panels.adb | 7 +- .../src/terminal_interface-curses-termcap.adb | 9 +- .../src/terminal_interface-curses-text_io.adb | 29 +- .../src/terminal_interface-curses-trace.adb_p | 10 +- Ada95/src/terminal_interface-curses.adb | 33 +- INSTALL | 296 +- MANIFEST | 14 +- Makefile.in | 8 +- NEWS | 782 +- README | 4 +- README.emx | 6 +- TO-DO | 83 +- aclocal.m4 | 1085 ++- announce.html.in | 454 +- c++/Makefile.in | 15 +- c++/cursesapp.cc | 41 +- c++/cursesapp.h | 21 +- c++/cursesf.cc | 150 +- c++/cursesf.h | 351 +- c++/cursesm.cc | 121 +- c++/cursesm.h | 272 +- c++/cursesp.cc | 47 +- c++/cursesp.h | 136 +- c++/cursespad.cc | 63 +- c++/cursesw.cc | 55 +- c++/cursesw.h | 106 +- c++/cursslk.cc | 30 +- c++/cursslk.h | 71 +- c++/demo.cc | 95 +- c++/edit_cfg.sh | 5 +- c++/etip.h.in | 97 +- c++/internal.h | 10 +- config.guess | 613 +- config.sub | 152 +- configure | 6958 +++++++++++------ configure.in | 411 +- dist.mk | 46 +- doc/hackguide.doc | 1 - doc/html/NCURSES-Programming-HOWTO.html | 6413 +++++++++++++++ doc/html/ada/files.htm | 3 +- doc/html/ada/files/T.htm | 1 + doc/html/ada/funcs.htm | 4 +- doc/html/ada/funcs/A.htm | 5 +- doc/html/ada/funcs/B.htm | 9 +- doc/html/ada/funcs/C.htm | 55 +- doc/html/ada/funcs/D.htm | 31 +- doc/html/ada/funcs/E.htm | 7 +- doc/html/ada/funcs/F.htm | 73 +- doc/html/ada/funcs/G.htm | 53 +- doc/html/ada/funcs/H.htm | 15 +- doc/html/ada/funcs/I.htm | 45 +- doc/html/ada/funcs/K.htm | 9 +- doc/html/ada/funcs/L.htm | 17 +- doc/html/ada/funcs/M.htm | 74 +- doc/html/ada/funcs/N.htm | 43 +- doc/html/ada/funcs/O.htm | 7 +- doc/html/ada/funcs/P.htm | 75 +- doc/html/ada/funcs/Q.htm | 3 +- doc/html/ada/funcs/R.htm | 27 +- doc/html/ada/funcs/S.htm | 183 +- doc/html/ada/funcs/T.htm | 49 +- doc/html/ada/funcs/U.htm | 11 +- doc/html/ada/funcs/V.htm | 3 +- doc/html/ada/funcs/W.htm | 99 +- doc/html/ada/index.htm | 12 +- doc/html/ada/main.htm | 7 +- .../terminal_interface-curses-aux__adb.htm | 85 +- .../terminal_interface-curses-aux__ads.htm | 69 +- ...ce-curses-forms-field_types-alpha__adb.htm | 39 +- ...ce-curses-forms-field_types-alpha__ads.htm | 15 +- ...es-forms-field_types-alphanumeric__adb.htm | 39 +- ...es-forms-field_types-alphanumeric__ads.htm | 15 +- ...forms-field_types-enumeration-ada__adb.htm | 54 +- ...forms-field_types-enumeration-ada__ads.htm | 21 +- ...ses-forms-field_types-enumeration__adb.htm | 115 +- ...ses-forms-field_types-enumeration__ads.htm | 57 +- ...curses-forms-field_types-intfield__adb.htm | 47 +- ...curses-forms-field_types-intfield__ads.htm | 19 +- ...es-forms-field_types-ipv4_address__adb.htm | 39 +- ...es-forms-field_types-ipv4_address__ads.htm | 13 +- ...-curses-forms-field_types-numeric__adb.htm | 49 +- ...-curses-forms-field_types-numeric__ads.htm | 19 +- ...e-curses-forms-field_types-regexp__adb.htm | 45 +- ...e-curses-forms-field_types-regexp__ads.htm | 17 +- ...ses-forms-field_types-user-choice__adb.htm | 102 +- ...ses-forms-field_types-user-choice__ads.htm | 49 +- ...ace-curses-forms-field_types-user__adb.htm | 131 +- ...ace-curses-forms-field_types-user__ads.htm | 51 +- ...nterface-curses-forms-field_types__adb.htm | 302 +- ...nterface-curses-forms-field_types__ads.htm | 77 +- ...face-curses-forms-field_user_data__adb.htm | 45 +- ...face-curses-forms-field_user_data__ads.htm | 9 +- ...rface-curses-forms-form_user_data__adb.htm | 45 +- ...rface-curses-forms-form_user_data__ads.htm | 9 +- .../terminal_interface-curses-forms__adb.htm | 1254 +-- .../terminal_interface-curses-forms__ads.htm | 391 +- ...rface-curses-menus-item_user_data__adb.htm | 47 +- ...rface-curses-menus-item_user_data__ads.htm | 9 +- ...rface-curses-menus-menu_user_data__adb.htm | 45 +- ...rface-curses-menus-menu_user_data__ads.htm | 9 +- .../terminal_interface-curses-menus__adb.htm | 1328 ++-- .../terminal_interface-curses-menus__ads.htm | 221 +- .../terminal_interface-curses-mouse__adb.htm | 231 +- .../terminal_interface-curses-mouse__ads.htm | 129 +- ...interface-curses-panels-user_data__adb.htm | 51 +- ...interface-curses-panels-user_data__ads.htm | 11 +- .../terminal_interface-curses-panels__adb.htm | 158 +- .../terminal_interface-curses-panels__ads.htm | 7 +- .../terminal_interface-curses-putwin__adb.htm | 49 +- .../terminal_interface-curses-putwin__ads.htm | 11 +- ...terminal_interface-curses-termcap__adb.htm | 174 +- ...terminal_interface-curses-termcap__ads.htm | 33 +- ...erminal_interface-curses-terminfo__adb.htm | 157 +- ...erminal_interface-curses-terminfo__ads.htm | 35 +- ...inal_interface-curses-text_io-aux__adb.htm | 107 +- ...inal_interface-curses-text_io-aux__ads.htm | 17 +- ...terface-curses-text_io-complex_io__adb.htm | 49 +- ...terface-curses-text_io-complex_io__ads.htm | 37 +- ...terface-curses-text_io-decimal_io__adb.htm | 51 +- ...terface-curses-text_io-decimal_io__ads.htm | 35 +- ...ace-curses-text_io-enumeration_io__adb.htm | 53 +- ...ace-curses-text_io-enumeration_io__ads.htm | 29 +- ...interface-curses-text_io-fixed_io__adb.htm | 51 +- ...interface-curses-text_io-fixed_io__ads.htm | 35 +- ...interface-curses-text_io-float_io__adb.htm | 51 +- ...interface-curses-text_io-float_io__ads.htm | 35 +- ...terface-curses-text_io-integer_io__adb.htm | 41 +- ...terface-curses-text_io-integer_io__ads.htm | 29 +- ...terface-curses-text_io-modular_io__adb.htm | 41 +- ...terface-curses-text_io-modular_io__ads.htm | 29 +- ...terminal_interface-curses-text_io__adb.htm | 346 +- ...terminal_interface-curses-text_io__ads.htm | 89 +- .../terminal_interface-curses-trace__adb.htm | 17 +- .../terminal_interface-curses-trace__ads.htm | 30 +- .../ada/terminal_interface-curses__adb.htm | 3542 ++++----- .../ada/terminal_interface-curses__ads.htm | 974 +-- doc/html/ada/terminal_interface__ads.htm | 7 +- doc/html/announce.html | 458 +- doc/html/man/captoinfo.1m.html | 14 +- doc/html/man/clear.1.html | 4 +- doc/html/man/curs_add_wch.3x.html | 4 +- doc/html/man/curs_add_wchstr.3x.html | 12 +- doc/html/man/curs_addch.3x.html | 13 +- doc/html/man/curs_addchstr.3x.html | 31 +- doc/html/man/curs_addstr.3x.html | 29 +- doc/html/man/curs_addwstr.3x.html | 18 +- doc/html/man/curs_attr.3x.html | 108 +- doc/html/man/curs_beep.3x.html | 10 +- doc/html/man/curs_bkgd.3x.html | 4 +- doc/html/man/curs_bkgrnd.3x.html | 8 +- doc/html/man/curs_border.3x.html | 17 +- doc/html/man/curs_border_set.3x.html | 15 +- doc/html/man/curs_clear.3x.html | 52 +- doc/html/man/curs_color.3x.html | 238 +- doc/html/man/curs_delch.3x.html | 4 +- doc/html/man/curs_deleteln.3x.html | 12 +- doc/html/man/curs_extend.3x.html | 8 +- doc/html/man/curs_get_wch.3x.html | 4 +- doc/html/man/curs_get_wstr.3x.html | 27 +- doc/html/man/curs_getcchar.3x.html | 4 +- doc/html/man/curs_getch.3x.html | 105 +- doc/html/man/curs_getstr.3x.html | 42 +- doc/html/man/curs_getyx.3x.html | 4 +- doc/html/man/curs_in_wch.3x.html | 4 +- doc/html/man/curs_in_wchstr.3x.html | 18 +- doc/html/man/curs_inch.3x.html | 5 +- doc/html/man/curs_inchstr.3x.html | 16 +- doc/html/man/curs_initscr.3x.html | 34 +- doc/html/man/curs_inopts.3x.html | 105 +- doc/html/man/curs_ins_wch.3x.html | 4 +- doc/html/man/curs_ins_wstr.3x.html | 12 +- doc/html/man/curs_insch.3x.html | 4 +- doc/html/man/curs_insstr.3x.html | 48 +- doc/html/man/curs_instr.3x.html | 25 +- doc/html/man/curs_inwstr.3x.html | 12 +- doc/html/man/curs_kernel.3x.html | 71 +- doc/html/man/curs_mouse.3x.html | 124 +- doc/html/man/curs_move.3x.html | 19 +- doc/html/man/curs_outopts.3x.html | 62 +- doc/html/man/curs_overlay.3x.html | 17 +- doc/html/man/curs_pad.3x.html | 62 +- doc/html/man/curs_print.3x.html | 10 +- doc/html/man/curs_printw.3x.html | 31 +- doc/html/man/curs_refresh.3x.html | 79 +- doc/html/man/curs_scanw.3x.html | 4 +- doc/html/man/curs_scr_dump.3x.html | 34 +- doc/html/man/curs_scroll.3x.html | 22 +- doc/html/man/curs_slk.3x.html | 80 +- doc/html/man/curs_termattrs.3x.html | 4 +- doc/html/man/curs_termcap.3x.html | 10 +- doc/html/man/curs_terminfo.3x.html | 59 +- doc/html/man/curs_touch.3x.html | 31 +- doc/html/man/curs_trace.3x.html | 35 +- doc/html/man/curs_util.3x.html | 59 +- doc/html/man/curs_window.3x.html | 83 +- doc/html/man/default_colors.3x.html | 41 +- doc/html/man/define_key.3x.html | 10 +- doc/html/man/form.3x.html | 7 +- doc/html/man/form_cursor.3x.html | 4 +- doc/html/man/form_data.3x.html | 4 +- doc/html/man/form_driver.3x.html | 4 +- doc/html/man/form_field.3x.html | 4 +- doc/html/man/form_field_attributes.3x.html | 4 +- doc/html/man/form_field_buffer.3x.html | 18 +- doc/html/man/form_field_info.3x.html | 12 +- doc/html/man/form_field_just.3x.html | 4 +- doc/html/man/form_field_new.3x.html | 4 +- doc/html/man/form_field_opts.3x.html | 19 +- doc/html/man/form_field_userptr.3x.html | 4 +- doc/html/man/form_field_validation.3x.html | 4 +- doc/html/man/form_fieldtype.3x.html | 4 +- doc/html/man/form_hook.3x.html | 4 +- doc/html/man/form_new.3x.html | 4 +- doc/html/man/form_new_page.3x.html | 4 +- doc/html/man/form_opts.3x.html | 4 +- doc/html/man/form_page.3x.html | 4 +- doc/html/man/form_post.3x.html | 4 +- doc/html/man/form_requestname.3x.html | 8 +- doc/html/man/form_userptr.3x.html | 4 +- doc/html/man/form_win.3x.html | 4 +- doc/html/man/index.html | 40 + doc/html/man/infocmp.1m.html | 26 +- doc/html/man/infotocap.1m.html | 8 +- doc/html/man/key_defined.3x.html | 10 +- doc/html/man/keybound.3x.html | 4 +- doc/html/man/keyok.3x.html | 4 +- doc/html/man/menu.3x.html | 7 +- doc/html/man/menu_attributes.3x.html | 4 +- doc/html/man/menu_cursor.3x.html | 4 +- doc/html/man/menu_driver.3x.html | 4 +- doc/html/man/menu_format.3x.html | 4 +- doc/html/man/menu_hook.3x.html | 4 +- doc/html/man/menu_items.3x.html | 3 +- doc/html/man/menu_mark.3x.html | 4 +- doc/html/man/menu_new.3x.html | 4 +- doc/html/man/menu_opts.3x.html | 4 +- doc/html/man/menu_pattern.3x.html | 4 +- doc/html/man/menu_post.3x.html | 4 +- doc/html/man/menu_requestname.3x.html | 8 +- doc/html/man/menu_spacing.3x.html | 10 +- doc/html/man/menu_userptr.3x.html | 4 +- doc/html/man/menu_win.3x.html | 4 +- doc/html/man/mitem_current.3x.html | 4 +- doc/html/man/mitem_name.3x.html | 4 +- doc/html/man/mitem_new.3x.html | 4 +- doc/html/man/mitem_opts.3x.html | 4 +- doc/html/man/mitem_userptr.3x.html | 4 +- doc/html/man/mitem_value.3x.html | 4 +- doc/html/man/mitem_visible.3x.html | 4 +- doc/html/man/ncurses.3x.html | 363 +- doc/html/man/panel.3x.html | 4 +- doc/html/man/resizeterm.3x.html | 17 +- doc/html/man/term.5.html | 8 +- doc/html/man/term.7.html | 4 +- doc/html/man/terminfo.5.html | 1154 +-- doc/html/man/tic.1m.html | 24 +- doc/html/man/toe.1m.html | 8 +- doc/html/man/tput.1.html | 84 +- doc/html/man/tset.1.html | 186 +- doc/html/man/wresize.3x.html | 4 +- doc/html/ncurses-intro.html | 22 +- doc/ncurses-intro.doc | 32 +- form/Makefile.in | 9 +- form/f_trace.c | 70 + form/fld_arg.c | 44 +- form/fld_attr.c | 51 +- form/fld_current.c | 77 +- form/fld_def.c | 349 +- form/fld_dup.c | 66 +- form/fld_ftchoice.c | 15 +- form/fld_ftlink.c | 25 +- form/fld_info.c | 55 +- form/fld_just.c | 25 +- form/fld_link.c | 62 +- form/fld_max.c | 20 +- form/fld_move.c | 13 +- form/fld_newftyp.c | 75 +- form/fld_opts.c | 35 +- form/fld_pad.c | 20 +- form/fld_page.c | 18 +- form/fld_stat.c | 18 +- form/fld_type.c | 23 +- form/fld_user.c | 15 +- form/form.h | 204 +- form/form.priv.h | 179 +- form/frm_cursor.c | 12 +- form/frm_data.c | 110 +- form/frm_def.c | 235 +- form/frm_driver.c | 3036 ++++--- form/frm_hook.c | 58 +- form/frm_opts.c | 25 +- form/frm_page.c | 32 +- form/frm_post.c | 34 +- form/frm_req_name.c | 169 +- form/frm_scale.c | 20 +- form/frm_sub.c | 24 +- form/frm_user.c | 13 +- form/frm_win.c | 25 +- form/fty_alnum.c | 134 +- form/fty_alpha.c | 147 +- form/fty_enum.c | 202 +- form/fty_int.c | 166 +- form/fty_ipv4.c | 31 +- form/fty_num.c | 243 +- form/fty_regex.c | 135 +- form/llib-lform | 108 +- form/llib-lformw | 116 +- form/modules | 7 +- include/curses.h.in | 72 +- include/curses.tail | 106 +- include/curses.wide | 4 +- include/nc_alloc.h | 17 +- include/ncurses_cfg.hin | 14 +- include/ncurses_defs | 10 +- include/term_entry.h | 16 +- include/tic.h | 24 +- install-sh | 49 +- man/Makefile.in | 15 +- man/captoinfo.1m | 20 +- man/curs_add_wchstr.3x | 9 +- man/curs_addchstr.3x | 29 +- man/curs_addstr.3x | 14 +- man/curs_addwstr.3x | 11 +- man/curs_attr.3x | 63 +- man/curs_beep.3x | 8 +- man/curs_bkgrnd.3x | 5 +- man/curs_border.3x | 28 +- man/curs_border_set.3x | 11 +- man/curs_clear.3x | 43 +- man/curs_color.3x | 68 +- man/curs_deleteln.3x | 8 +- man/curs_extend.3x | 6 +- man/curs_get_wstr.3x | 15 +- man/curs_getch.3x | 31 +- man/curs_getstr.3x | 15 +- man/curs_in_wchstr.3x | 12 +- man/curs_inchstr.3x | 13 +- man/curs_initscr.3x | 30 +- man/curs_inopts.3x | 40 +- man/curs_ins_wstr.3x | 14 +- man/curs_insstr.3x | 50 +- man/curs_instr.3x | 13 +- man/curs_inwstr.3x | 7 +- man/curs_kernel.3x | 67 +- man/curs_mouse.3x | 62 +- man/curs_move.3x | 20 +- man/curs_outopts.3x | 69 +- man/curs_overlay.3x | 15 +- man/curs_pad.3x | 37 +- man/curs_print.3x | 6 +- man/curs_printw.3x | 14 +- man/curs_refresh.3x | 34 +- man/curs_scr_dump.3x | 14 +- man/curs_scroll.3x | 18 +- man/curs_slk.3x | 78 +- man/curs_terminfo.3x | 27 +- man/curs_touch.3x | 24 +- man/curs_trace.3x | 16 +- man/curs_util.3x | 27 +- man/curs_window.3x | 41 +- man/default_colors.3x | 26 +- man/define_key.3x | 7 +- man/form_field_buffer.3x | 12 +- man/form_field_info.3x | 11 +- man/form_field_opts.3x | 7 +- man/infocmp.1m | 150 +- man/infotocap.1m | 18 +- man/key_defined.3x | 6 +- man/make_sed.sh | 16 +- man/man_db.renames | 5 +- man/menu_spacing.3x | 6 +- man/ncurses.3x | 48 +- man/resizeterm.3x | 20 +- man/term.5 | 10 +- man/terminfo.head | 14 +- man/terminfo.tail | 91 +- man/tic.1m | 104 +- man/toe.1m | 16 +- man/tput.1 | 94 +- man/tset.1 | 108 +- menu/Makefile.in | 4 +- menu/llib-lmenu | 41 +- menu/llib-lmenuw | 43 +- menu/m_attribs.c | 20 +- menu/m_cursor.c | 33 +- menu/m_driver.c | 666 +- menu/m_format.c | 68 +- menu/m_global.c | 401 +- menu/m_hook.c | 24 +- menu/m_item_cur.c | 30 +- menu/m_item_nam.c | 16 +- menu/m_item_new.c | 127 +- menu/m_item_opt.c | 57 +- menu/m_item_top.c | 39 +- menu/m_item_use.c | 14 +- menu/m_item_val.c | 24 +- menu/m_item_vis.c | 23 +- menu/m_items.c | 32 +- menu/m_new.c | 30 +- menu/m_opts.c | 49 +- menu/m_pad.c | 25 +- menu/m_pattern.c | 53 +- menu/m_post.c | 269 +- menu/m_req_name.c | 74 +- menu/m_scale.c | 17 +- menu/m_spacing.c | 37 +- menu/m_sub.c | 20 +- menu/m_trace.c | 77 + menu/m_userptr.c | 14 +- menu/m_win.c | 20 +- menu/menu.priv.h | 38 +- menu/mf_common.h | 19 +- menu/modules | 5 +- misc/Makefile.in | 22 +- misc/gen_edit.sh | 58 + misc/indent.pro | 35 - misc/jpf-indent | 87 + misc/ncu-indent | 98 + misc/run_tic.in | 59 +- misc/shlib | 82 +- misc/terminfo.src | 1138 ++- mk-0th.awk | 36 +- mk-1st.awk | 30 +- mk-2nd.awk | 45 +- ncurses/Makefile.in | 15 +- ncurses/SigAction.h | 6 +- ncurses/base/MKkeyname.awk | 98 +- ncurses/base/MKlib_gen.sh | 33 +- ncurses/base/MKunctrl.awk | 9 +- ncurses/base/define_key.c | 8 +- ncurses/base/keybound.c | 11 +- ncurses/base/lib_addch.c | 332 +- ncurses/base/lib_addstr.c | 73 +- ncurses/base/lib_beep.c | 9 +- ncurses/base/lib_bkgd.c | 30 +- ncurses/base/lib_chgat.c | 13 +- ncurses/base/lib_color.c | 134 +- ncurses/base/lib_colorset.c | 13 +- ncurses/base/lib_dft_fgbg.c | 20 +- ncurses/base/lib_freeall.c | 21 +- ncurses/base/lib_getch.c | 9 +- ncurses/base/lib_insch.c | 98 +- ncurses/base/lib_insnstr.c | 68 + ncurses/base/lib_instr.c | 45 +- ncurses/base/lib_mouse.c | 376 +- ncurses/base/lib_move.c | 9 +- ncurses/base/lib_newterm.c | 15 +- ncurses/base/lib_newwin.c | 11 +- ncurses/base/lib_pad.c | 6 +- ncurses/base/lib_printw.c | 7 +- ncurses/base/lib_refresh.c | 9 +- ncurses/base/lib_scroll.c | 27 +- ncurses/base/lib_set_term.c | 30 +- ncurses/base/lib_slk.c | 25 +- ncurses/base/lib_slkatr_set.c | 18 +- ncurses/base/lib_slkatrof.c | 15 +- ncurses/base/lib_slkatron.c | 15 +- ncurses/base/lib_slkatrset.c | 10 +- ncurses/base/lib_slkattr.c | 12 +- ncurses/base/lib_slkcolor.c | 12 +- ncurses/base/lib_slkrefr.c | 14 +- ncurses/base/lib_slkset.c | 85 +- ncurses/base/lib_wattroff.c | 11 +- ncurses/base/lib_wattron.c | 13 +- ncurses/base/resizeterm.c | 43 +- ncurses/base/tries.c | 6 +- ncurses/base/version.c | 6 +- ncurses/base/vsscanf.c | 6 +- ncurses/curses.priv.h | 316 +- ncurses/llib-lncurses | 1115 +-- ncurses/llib-lncursesw | 1505 ++-- ncurses/modules | 18 +- ncurses/tinfo/alloc_entry.c | 46 +- ncurses/tinfo/captoinfo.c | 19 +- ncurses/tinfo/comp_error.c | 20 +- ncurses/tinfo/comp_hash.c | 20 +- ncurses/tinfo/comp_parse.c | 101 +- ncurses/tinfo/comp_scan.c | 423 +- ncurses/tinfo/free_ttype.c | 7 +- ncurses/tinfo/home_terminfo.c | 11 +- ncurses/tinfo/init_keytry.c | 50 +- ncurses/tinfo/lib_acs.c | 15 +- ncurses/tinfo/lib_data.c | 20 +- ncurses/tinfo/lib_kernel.c | 6 +- ncurses/tinfo/lib_napms.c | 7 +- ncurses/tinfo/lib_options.c | 85 +- ncurses/tinfo/lib_setup.c | 108 +- ncurses/tinfo/lib_termcap.c | 128 +- ncurses/tinfo/make_keys.c | 10 +- ncurses/tinfo/name_match.c | 15 +- ncurses/tinfo/parse_entry.c | 33 +- ncurses/tinfo/read_entry.c | 44 +- ncurses/tinfo/read_termcap.c | 33 +- ncurses/tinfo/trim_sgr0.c | 328 + ncurses/trace/lib_trace.c | 35 +- ncurses/trace/lib_traceatr.c | 46 +- ncurses/trace/lib_tracechr.c | 11 +- ncurses/trace/lib_tracedmp.c | 31 +- ncurses/trace/lib_tracemse.c | 42 +- ncurses/trace/visbuf.c | 60 +- ncurses/tty/MKexpanded.sh | 6 +- ncurses/tty/hashmap.c | 6 +- ncurses/tty/lib_mvcur.c | 35 +- ncurses/tty/lib_twait.c | 6 +- ncurses/tty/lib_vidattr.c | 32 +- ncurses/tty/tty_display.h | 8 +- ncurses/tty/tty_update.c | 150 +- ncurses/widechar/charable.c | 11 +- ncurses/widechar/lib_add_wch.c | 14 +- ncurses/widechar/lib_cchar.c | 36 +- ncurses/widechar/lib_get_wch.c | 26 +- ncurses/widechar/lib_get_wstr.c | 45 +- ncurses/widechar/lib_in_wch.c | 9 +- ncurses/widechar/lib_in_wchnstr.c | 18 +- ncurses/widechar/lib_ins_wch.c | 40 +- ncurses/widechar/lib_inwstr.c | 12 +- ncurses/widechar/lib_slk_wset.c | 119 +- ncurses/widechar/lib_unget_wch.c | 29 +- ncurses/widechar/lib_vid_attr.c | 252 +- ncurses/widechar/lib_wunctrl.c | 11 +- panel/llib-lpanel | 9 +- panel/llib-lpanelw | 9 +- panel/p_above.c | 15 +- panel/p_below.c | 15 +- panel/p_bottom.c | 48 +- panel/p_delete.c | 15 +- panel/p_hidden.c | 15 +- panel/p_hide.c | 19 +- panel/p_move.c | 24 +- panel/p_new.c | 58 +- panel/p_replace.c | 27 +- panel/p_show.c | 30 +- panel/p_top.c | 9 +- panel/p_update.c | 13 +- panel/p_user.c | 22 +- panel/p_win.c | 13 +- panel/panel.c | 89 +- panel/panel.priv.h | 14 +- progs/Makefile.in | 15 +- progs/clear.c | 6 +- progs/dump_entry.c | 142 +- progs/dump_entry.h | 20 +- progs/infocmp.c | 209 +- progs/modules | 18 +- progs/progs.priv.h | 21 +- progs/tic.c | 327 +- progs/toe.c | 10 +- progs/tput.c | 9 +- progs/tset.c | 151 +- tack/COPYING | 8 +- tack/Makefile.in | 12 +- tack/ansi.c | 6 +- tack/charset.c | 54 +- tack/color.c | 6 +- tack/control.c | 33 +- tack/crum.c | 6 +- tack/edit.c | 12 +- tack/fun.c | 12 +- tack/init.c | 12 +- tack/menu.c | 6 +- tack/modes.c | 6 +- tack/output.c | 8 +- tack/pad.c | 14 +- tack/scan.c | 37 +- tack/sync.c | 26 +- tack/sysdep.c | 19 +- tack/tack.1 | 2 +- tack/tack.c | 39 +- tack/tack.h | 200 +- test/Makefile.in | 85 +- test/README | 241 +- test/aclocal.m4 | 391 +- test/blue.c | 6 +- test/bs.c | 8 +- test/cardfile.c | 131 +- test/color_set.c | 12 +- test/configure | 977 ++- test/configure.in | 20 +- test/demo_forms.c | 234 +- test/demo_menus.c | 643 +- test/demo_termcap.c | 157 + test/ditto.c | 20 +- test/dots.c | 20 +- test/edit_field.c | 38 +- test/edit_field.h | 7 +- test/filter.c | 4 +- test/firework.c | 6 +- test/firstlast.c | 9 +- test/gdc.c | 43 +- test/hashtest.c | 8 +- test/ins_wide.c | 398 +- test/inserts.c | 295 +- test/keynames.c | 14 +- test/linux-color.dat | 21 + test/lrtest.c | 8 +- test/modules | 77 +- test/ncurses.c | 1744 ++++- test/newdemo.c | 14 +- test/tclock.c | 4 +- test/test.priv.h | 10 +- test/testcurs.c | 17 +- test/tracemunch | 48 +- test/view.c | 48 +- test/worm.c | 6 +- test/xmas.c | 4 +- test/xterm-16color.dat | 26 + test/xterm-88color.dat | 98 + 647 files changed, 43609 insertions(+), 22762 deletions(-) create mode 100644 doc/html/NCURSES-Programming-HOWTO.html create mode 100644 doc/html/man/index.html create mode 100644 form/f_trace.c create mode 100644 menu/m_trace.c create mode 100755 misc/gen_edit.sh delete mode 100644 misc/indent.pro create mode 100755 misc/jpf-indent create mode 100755 misc/ncu-indent create mode 100644 ncurses/base/lib_insnstr.c create mode 100644 ncurses/tinfo/trim_sgr0.c create mode 100644 test/demo_termcap.c create mode 100644 test/linux-color.dat create mode 100644 test/xterm-16color.dat create mode 100644 test/xterm-88color.dat diff --git a/ANNOUNCE b/ANNOUNCE index 513234e3..5a2a1398 100644 --- a/ANNOUNCE +++ b/ANNOUNCE @@ -1,5 +1,4 @@ - - Announcing ncurses 5.4 + Announcing ncurses 5.5 The ncurses (new curses) library is a free software emulation of curses in System V Release 4.0, and more. It uses terminfo format, @@ -8,9 +7,8 @@ enhancements over BSD curses. In mid-June 1995, the maintainer of 4.4BSD curses declared that he - considered 4.4BSD curses obsolete, and is encouraging the keepers of - Unix releases such as BSD/OS, freeBSD and netBSD to switch over to - ncurses. + considered 4.4BSD curses obsolete, and encouraged the keepers of Unix + releases such as BSD/OS, FreeBSD and NetBSD to switch over to ncurses. The ncurses code was developed under GNU/Linux. It has been in use for some time with OpenBSD as the system curses library, and on FreeBSD @@ -28,233 +26,193 @@ Release Notes - This release is designed to be upward compatible from ncurses 5.0 and - 5.3; very few applications will require recompilation, depending on - the platform. These are the highlights from the change-log since - ncurses 5.3 release. + This release is designed to be upward compatible from ncurses 5.0 + through 5.4; very few applications will require recompilation, + depending on the platform. These are the highlights from the + change-log since ncurses 5.4 release. Interface changes: - * add the remaining functions for X/Open curses wide-character - support. - + pecho_wchar() - + slk_wset() - These are only available if the library is configured using the - --enable-widec option. - * write getyx() and related 2-return macros in terms of getcury(), - getcurx(), etc. - * simplify ifdef for bool declaration in curses.h - * modify ifdef's in curses.h that disabled use of __attribute__() - for g++, since recent versions implement the cases which ncurses - uses. - * add key_defined() function, to tell which keycode a string is - bound to. + * terminfo installs "xterm-new" as "xterm" entry rather than + "xterm-old" (aka xterm-r6). + * terminfo data is installed using the tic -x option (few systems + still use ncurses 4.2). + * modify C++ binding to work with newer C++ compilers by providing + initializers and using modern casts. Old-style header names are + still used in this release to allow compiling with not-so-old + compilers. + * modify parameter type in c++ binding for insch() and mvwinsch() to + be consistent with underlying ncurses library (was char, is + chtype). + * change NCursesWindow::err_handler() to a virtual function. + * form and menu libraries now work with wide-character data. + Applications which bypassed the form library and manipulated the + FIELD.buf data directly will not work properly with libformw, + since that no longer points to an array of char. The + set_field_buffer() and field_buffer() functions translate to/from + the actual field data. + * add symbol to curses.h which can be used to suppress include of + stdbool.h, e.g., + #define NCURSES_ENABLE_STDBOOL_H 0 + #include + + * change SP->_current_attr to a pointer, adjust ifdef's to ensure + that libtinfo.so and libtinfow.so have the same ABI. The reason + for this is that the corresponding data which belongs to the + upper-level ncurses library has a different size in each model. + * winnstr() now returns multibyte character strings for the + wide-character configuration. + * assume_default_colors() no longer requires that + use_default_colors() be called first. + * data_ahead() now works with wide-characters. + * slk_set() and slk_wset() now accept and store multibyte or + multicolumn characters. + * start_color() now returns OK if colors have already been started. + start_color() also returns ERR if it cannot allocate memory. + * pair_content() now returns -1 for consistency with init_pair() if + it corresponds to the default-color. + * unctrl() now returns null if its parameter does not correspond to + an unsigned char. New features and improvements: * library - + implement logic in lib_mouse.c to handle position reports - which are generated when XFree86 xterm is initialized with - private modes 1002 or 1003. These are returned to the - application as the REPORT_MOUSE_POSITION mask, which was not - implemented. - + modify soft-key initialization to use A_REVERSE if A_STANDOUT - would not be shown when colors are used, i.e., if ncv#1 is - set in the terminfo as is done in "screen". - + add configure option for FreeBSD sysmouse, --with-sysmouse, - and implement library support for that. + + environment variable NCURSES_NO_UTF8_ACS supports + miscellaneous terminal emulators which ignore alternate + character set escape sequences when in UTF-8 mode. + + modify initialization of key lookup table so that if an + extended capability (tic -x) string is defined, and its name + begins with 'k', ncurses will automatically treat it as a + key. + + change GPM initialization, using dl library to load it + dynamically at runtime. + + form, menu and panel libraries support debug-tracing. + * add NCURSES-Programming-HOWTO.html by Pradeep Padala (see + http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/). * programs: - + tack: - o allow it to run from fallback terminfo data. - o reset colors after each color test, correct a place - where exit_standout_mode was used instead of - exit_attribute_mode. - o improve bce test by making it set colors other than - black on white. - + tic: - o handle a case where an entry has no description, and - capabilities begin on the same line as the entry name. - o allow a terminfo entry with a leading 2-character name. - o improved warnings when suppressing items to fit in - termcap's 1023-byte limit. - o add check for multiple "tc=" clauses in a termcap. - o correct logic for resolving "use=" clauses allow infocmp - and tic to show cancelled capabilities. - o check for incomplete line-drawing character mapping. - o check for missing/empty/illegal terminfo name. - + tput: - o modify tput to use the same parameter analysis as - tparm() does, to provide for user-defined strings, e.g., - for xterm title, a corresponding capability might be - title=\E]2;%p1%s^G, - + tset: - o use the system's default values for CKILL and other - default control characters. - o correct interchanged defaults for kill and interrupt - characters, which caused it to report unnecessarily. + * infocmp: + + The -i option now matches 8-bit controls against its table + entries, e.g., so it can analyze the xterm-8bit entry. + + add "-x" option to infocmp like tic's "-x", for use in "-F" + comparisons. This modifies infocmp to only report extended + capabilities if the -x option is given, making this more + consistent with tic. Some scripts may break, since infocmp + previous gave this information without an option. + * tic: + + modify termcap-parsing to retain 2-character aliases at the + beginning of an entry if the "-x" option is used in tic. + + filter out long extended names when translating to termcap + format. Only two characters are permissible for termcap + capability names. + + correct translation of "%%" in terminfo format to termcap, + e.g., using "tic -C". + + modify the "-c -v" options to ignore delays when comparing + strings. Also modify it to ignore a canceled sgr string, + e.g., for terminals which cannot properly combine attributes + in one control sequence. + + add a check for improperly ended strings, i.e., where a + following line begins in column 1. + + add a check in tic for terminfo entries having an sgr0 but no + sgr string. This confuses Tru64 and HPUX curses when combined + with color, e.g., making them leave line-drawing characters + in odd places. + + add check (with debug configuration) that provides about the + runtime changes that would be made to sgr0 for termcap + applications. + * tset: + + add -c and -w options to allow user to suppress ncurses' + resizing of the terminal emulator window in the special case + where it is not able to detect the true size. Major bug fixes: - * prevent recursion in wgetch() via wgetnstr() if the connection - cannot be switched between cooked/raw modes because it is not a - TTY. - * correct a case in _nc_remove_string(), used by define_key(), to - avoid infinite loop if the given string happens to be a substring - of other strings which are assigned to keys. - * modify logic of acsc to use the original character if no mapping - is defined, rather than a null. - * several improvements for handling multi-cell display of wide - characters. - + modify setcchar() to allow converting control characters to - complex characters. - + correct handling of multibyte characters in waddch_literal() - which force wrapping because they are started too late on the - line. - + modify setcchar() to allow for wchar_t input strings that - have more than one spacing character. - * other fixes for wide-character support: - + rewrote lib_acs.c to allow PutAttrChar() to decide how to - render alternate-characters, i.e., to work with Linux console - and UTF-8 locale. - + implement a workaround so that line-drawing works with - screen's crippled UTF-8 support (tested with 3.9.13). This - only works with the wide-character support (--enable-widec); - the normal library will simply suppress line-drawing when - running in a UTF-8 locale in screen. - + corrections to lib_get_wstr.c: - o null-terminate buffer passed to setcchar(), which - occasionally failed. - o map special characters such as erase- and - kill-characters into key-codes so those will work as - expected even if they are not mentioned in the terminfo. - * modify setupterm() to check if the terminfo and terminal-modes - have already been read. This ensures that it does not reinvoke - def_prog_mode() when an application calls more than one function, - such as tgetent() and initscr(). - * fix form_driver() cases for REQ_CLR_EOF, REQ_CLR_EOL, - REQ_DEL_CHAR, REQ_DEL_PREV and REQ_NEW_LINE, which did not ensure - the cursor was at the editing position before making - modifications. - * correct keybound(), which reported definitions in the wrong table, - i.e., the list of definitions which are disabled by keyok(). - * fixes related to safe_sprintf.c: - + correct an allocation size in safe_sprintf.c for the "*" - format code. - + correct safe_sprintf.c to not return a null pointer if the - format happens to be an empty string. - + make return value from _nc_printf_string() consistent. - Before, depending on whether --enable-safe-sprintf was used, - it might not be cached for reallocating. - * other low-level improvements to the optimization code include: - + if the output is a socket or other non-tty device, use 1 - millisecond for the cost in mvcur; previously it was 9 - milliseconds because the baudrate was not known. - + modify lib_getch.c to avoid recursion via wgetnstr() when the - input is not a tty and consequently mode-changes do not work. - + fix several places in tack/pad.c which tested and used the - parameter- and parameterless strings inconsistently. - + change several tputs() calls in scrolling code to use putp(), - to enable padding which may be needed for some terminals. - + improve mvcur() by checking if it is safe to move when video - attributes are set (msgr), and if not, reset/restore - attributes within that function rather than doing it - separately in the GoTo() function in tty_update.c. - + use tputs() rather than putp() in a few cases in tty_update.c - since the corresponding delays are proportional to the number - of lines affected: repeat_char, clr_eos, - change_scroll_region. - * correct line/column reference in adjust_window(), needed to make - special windows such as curscr track properly when resizing. - * fix a potential recursion between napms() and _nc_timed_wait() - * rewrote lib_insch.c, combining it with lib_insstr.c so both handle - tab and other control characters consistently. - * do not try to open gpm mouse driver if standard output is not a - tty; the gpm library does not make this check. + * improve logic in tgetent() which adjusts the termcap "me" string + to work with ISO-2022 string used in xterm-new. This is a feature + that was incompletely implemented in ncurses 5.3. ncurses attempts + to provide termcap clients with the portion of the sgr0 (termcap + "me") string that does not reset line-drawing. + * cells in the WINDOW which are continuations of a multicolumn + character are encoded differently, making repainting more + reliable. + * amend change to setupterm() in ncurses 5.4 (20030405) which would + reuse the value of cur_term if the same output was selected. This + now reuses it only when setupterm() is called from tgetent(), + which has no notion of separate SCREENs. Note that tgetent() must + be called after initscr() or newterm() to use this feature. + * make setcchar() now works when its wchar_t* parameter is pointing + to a string which contains more data than can be converted. + * win_wchnstr() now works for more than one cell. + * resizeterm() now processes all levels of window hierarchy. + * disable GPM mouse support when $TERM happens to be prefixed with + "xterm". Gpm_Open() would otherwise assert that it can deal with + mouse events in this case. + * add SP->_screen_acs_map[], used to ensure that mapping of missing + line-drawing characters is handled properly. For example, + ACS_DARROW is absent from xterm-new, and it was coincidentally + displayed the same as ACS_BTEE. Portability: * configure script: + new options: - --with-abi-version option. - addresses platforms where packagers have diverged - from ncurses ABI numbering. - - --with-manpage-format=catonly - addresses behavior of BSDI, allow install of - man+cat files on NetBSD, whose behavior has - diverged by requiring both to be present. - - --with-manpage-aliases - extends "--with-manpage-aliases" to provide the - option of generating ".so" files rather than - symbolic links for manpage aliases. - - --with-rel-version - workaround to force libtool on Darwin generate the - "same" library names as with the "--with-shared" - option. The Darwin ld program does not work well - with a zero as the minor-version value. - - --with-trace - simplifies defining TRACE to incorporate trace() in - libraries. - + --enable-largefile + set compiler and linker flags to use largefile + support. + + --enable-ext-colors + Allow encoding of 256 foreground and background + colors, e.g., with the xterm-256color or + xterm-88color terminfo entries. This requires ABI 6 + because it changes the size of cchar_t. + + --enable-ext-mouse + This defines NCURSES_MOUSE_VERSION 2, and modifies + the encoding of mouse events to support wheel mice, + which may transmit buttons 4 and 5. This works with + xterm and similar terminal emulators. This requires + ABI 6 because it changes the encoding of mouse + events. + + --with-chtype + overriding of the non-LP64 model's use of chtype + + --with-mmask-t + overriding of the non-LP64 model's use of mmask_t + + --without-xterm-new + Installs "xterm-old" as the "xterm" entry of the + terminfo database. + + + The --with-termlib option now accepts a value which sets the + name of the terminfo library. This would allow a packager to + build libtinfow.so renamed to coincide with libtinfo.so + fixes/improvements for cross-compiling: - o allow BUILD_CC and related configure script variables to - be overridden from the environment. - o use AC_CHECK_TOOL to get proper values for AR and LD for - cross compiling. - o use $cross_compiling variable in configure script rather - than comparing $host_alias and $target alias, since - "host" is traditionally misused in autoconf to refer to - the target platform. - o modify run_tic.in to avoid using wrong shared libraries - when cross-compiling. - + fixes for Mac OS X: - o fix a redefinition of $RANLIB in the configure script - when libtool is used. - o modify MKlib_gen.sh to avoid passing "#" tokens through - the C preprocessor. This works around Mac OS X's - preprocessor, which insists on adding a blank on each - side of the token. - + workarounds for broken tools: - o add configure check for wchar_t and wint_t types, rather - than rely on preprocessor definitions. Also work around - for gcc fixinclude bug which creates a shadow copy of - curses.h if it sees these symbols apparently typedef'd. - o modify configure script to omit -Winline for gcc 3.3, - since that feature is broken. - o several script fixes to work around the ironically named - POSIXLY_CORRECT feature of GNU sed 4.0. - o modify configure script to avoid using "head -1", which - does not work if POSIXLY_CORRECT (sic) is set. - o update configure script to reflect fix for - AC_PROG_GCC_TRADITIONAL, which is broken in autoconf - 2.5x for Mac OS X 10.2.3. - o repair check for missing C++ compiler, which is broken - in autoconf 2.5x by hardcoding it to g++. - + corrected ifdef's relating to configure check for wchar_t, - etc. - + remove configure script check to allow -Wconversion for older - versions of gcc - + modify configure script to accommodate libtool 1.5, as well - as add an parameter to the "--with-libtool" option which can - specify the pathname of libtool. - + change several sed scripts to avoid using "\+" since it is - not a BRE (basic regular expression). One instance caused - terminfo.5 to be misformatted on FreeBSD. - + use '%' as sed substitute delimiter in run_tic script to - avoid problems with pathname delimiters such as ':' and '@'. - + add -D_XOPEN_SOURCE=500 if needed when configuring with - "--enable-widec", to get mbstate_t declaration on HPUX 11.11. + o suppress $suffix in misc/run_tic.sh when + cross-compiling. This allows cross-compiles to use the + host's tic program to handle the "make install.data" + step. + o correct BUILD_CPPFLAGS substitution in + ncurses/Makefile.in, to allow cross-compiling from a + separate directory tree. * library: - + adjust include-options in CF_ETIP_DEFINES to avoid missing - ncurses_dll.h, fixing special definitions that may be needed - for etip.h. - + modify CF_LIB_SUFFIX for Itanium releases of HP-UX, which use - a ".so" suffix. - + improve ifdef's to guard against redefinition of wchar_t and - wint_t in curses.h. - + remove an #undef for KEY_EVENT from curses.tail used in the - experimental NCURSES_WGETCH_EVENTS feature. The #undef - confuses Debian dpkg's build script. + + add ifdef's for _LP64 in curses.h to avoid using wasteful + 64-bits for chtype and mmask_t, but add configure option + --disable-lp64 in case anyone used that configuration. + + modify C++ binding to use some C internal functions to make + it compile properly on Solaris (and other platforms). + + remove check in newwin() that prevents allocating windows + that extend beyond the screen (Solaris does this). + + check for nl_langinfo(CODESET), use it if available. This + replaces ad hoc tests of environment variables to check if + the terminal is setup for UTF-8 encoding. Applications which + do not call setlocale() should be corrected, to make them + work properly with UTF-8 encoding. + In particular, applications which assume (and do not call + setlocale()) that Latin-1 codes are printable will no longer + work in a UTF-8 locale since the ad hoc check of environment + variables to see if the locale was UTF-8 is not used when + nl_langinfo(CODESET) is available. + + use setlocale() to query the program's current locale rather + than using getenv(). This supports applications which rely + upon legacy treatment of 8-bit characters when the locale is + not initialized. Features of Ncurses diff --git a/Ada95/gen/Makefile.in b/Ada95/gen/Makefile.in index aea7fdd7..fd79d8ba 100644 --- a/Ada95/gen/Makefile.in +++ b/Ada95/gen/Makefile.in @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -28,8 +28,7 @@ # # Author: Juergen Pfeifer, 1996 # -# Version Control -# $Revision: 1.44 $ +# $Id: Makefile.in,v 1.49 2005/05/14 13:57:14 tom Exp $ # .SUFFIXES: @@ -68,12 +67,10 @@ CFLAGS_SHARED = $(CCFLAGS) @CC_SHARED_OPTS@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) LINK = $(HOST_CC) -LD_FLAGS = @LD_MODEL@ $(LOCAL_LIBS) @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) +LD_FLAGS = @LD_MODEL@ $(LOCAL_LIBS) @LDFLAGS@ @LIBS@ @LOCAL_LDFLAGS2@ $(LDFLAGS) @TINFO_ARGS2@ RANLIB = @RANLIB@ -LIB_CURSES = -L../../lib -lncurses@LIB_SUFFIX@ - M4 = m4 M4FLAGS = @@ -152,7 +149,7 @@ GEN_SRC = $(srcdir)/$(ABASE).ads.m4 \ all \ libs : $(GEN_TARGETS) - @ + @echo made $@ sources: @@ -184,7 +181,7 @@ uninstall.libs :: -@cd $(ADA_OBJECTS) && rm -f $(ALIB)[-.]* gen$x: gen.o - @ECHO_LINK@ $(LINK) $(CFLAGS_NORMAL) gen.o $(LD_FLAGS) -o $@ $(LIB_CURSES) + @ECHO_LINK@ $(LINK) $(CFLAGS_NORMAL) gen.o $(LD_FLAGS) -o $@ gen.o: $(srcdir)/gen.c $(HOST_CC) $(CFLAGS_NORMAL) -c -o $@ $(srcdir)/gen.c @@ -400,7 +397,7 @@ $(HTML_DIR)/table.html : instab.tmp @rm -f instab.tmp adahtml: - @rm -rf $(HTML_DIR)/ + @find $(HTML_DIR) -type f -exec rm -f {} \; @mkdir -p $(HTML_DIR) cp -p ../src/*.ad[sb] . && chmod +w *.ad[sb] ln -sf ../src/*.ali . @@ -431,7 +428,7 @@ adahtml: @rm -rf html html : adahtml $(HTML_DIR)/table.html - @ + @echo made $@ ############################################################################### # The remainder of this file is automatically generated during configuration diff --git a/Ada95/gen/gen.c b/Ada95/gen/gen.c index 7a5bbedf..b7842a64 100644 --- a/Ada95/gen/gen.c +++ b/Ada95/gen/gen.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998,2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ /* Version Control - $Revision: 1.36 $ + $Id: gen.c,v 1.40 2005/01/22 17:03:48 tom Exp $ --------------------------------------------------------------------------*/ /* This program generates various record structures and constants from the @@ -55,27 +55,31 @@ static const char *model = ""; static int little_endian = 0; -typedef struct { - const char *name; - unsigned long attr; -} name_attribute_pair; +typedef struct + { + const char *name; + unsigned long attr; + } +name_attribute_pair; -static int find_pos (char *s, unsigned len, int *low, int *high) +static int +find_pos(char *s, unsigned len, int *low, int *high) { - unsigned int i,j; + unsigned int i, j; int l = 0; *high = -1; - *low = 8*len; + *low = 8 * len; - for(i=0; i < len; i++,s++) + for (i = 0; i < len; i++, s++) { if (*s) { - for(j=0;j<8*sizeof(char);j++) + for (j = 0; j < 8 * sizeof(char); j++) + { - if ((( little_endian && ((*s)&0x01)) || - (!little_endian && ((*s)&0x80))) ) + if (((little_endian && ((*s) & 0x01)) || + (!little_endian && ((*s) & 0x80)))) { if (l > *high) *high = l; @@ -102,212 +106,229 @@ static int find_pos (char *s, unsigned len, int *low, int *high) * bit size, i.e. they fit into an (u)int or a (u)short. */ static void -gen_reps -(const name_attribute_pair *nap, /* array of name_attribute_pair records */ - const char *name, /* name of the represented record type */ - int len, /* size of the record in bytes */ - int bias) + gen_reps + (const name_attribute_pair * nap, /* array of name_attribute_pair records */ + const char *name, /* name of the represented record type */ + int len, /* size of the record in bytes */ + int bias) { - int i,n,l,cnt = 0,low,high; + int i, n, l, cnt = 0, low, high; int width = strlen(RES_NAME) + 3; unsigned long a; unsigned long mask = 0; - assert (nap!=NULL); + assert(nap != NULL); - for (i=0; nap[i].name != (char *)0; i++) + for (i = 0; nap[i].name != (char *)0; i++) { cnt++; l = strlen(nap[i].name); - if (l>width) + if (l > width) width = l; } - assert (width > 0); + assert(width > 0); - printf(" type %s is\n",name); + printf(" type %s is\n", name); printf(" record\n"); - for (i=0; nap[i].name != (char *)0; i++) + for (i = 0; nap[i].name != (char *)0; i++) { - printf(" %-*s : Boolean;\n",width,nap[i].name); + printf(" %-*s : Boolean;\n", width, nap[i].name); } printf(" end record;\n"); - printf(" pragma Pack (%s);\n",name); - printf(" pragma Convention (C, %s);\n\n",name); + printf(" pragma Convention (C, %s);\n\n", name); - printf(" for %s use\n",name); + printf(" for %s use\n", name); printf(" record\n"); - for (i=0; nap[i].name != (char *)0; i++) + for (i = 0; nap[i].name != (char *)0; i++) { a = nap[i].attr; mask |= a; - l = find_pos( (char *)&a,sizeof(a),&low,&high ); - if (l>=0) - printf(" %-*s at 0 range %2d .. %2d;\n",width,nap[i].name, - low-bias,high-bias); + l = find_pos((char *)&a, sizeof(a), &low, &high); + if (l >= 0) + printf(" %-*s at 0 range %2d .. %2d;\n", width, nap[i].name, + low - bias, high - bias); } - i = 1; n = cnt; + i = 1; + n = cnt; printf(" end record;\n"); - printf(" for %s'Size use %d;\n", name, 8*len); + printf(" for %s'Size use %d;\n", name, 8 * len); printf(" -- Please note: this rep. clause is generated and may be\n"); printf(" -- different on your system."); } - -static void chtype_rep (const char *name, attr_t mask) +static void +chtype_rep(const char *name, attr_t mask) { attr_t x = -1; attr_t t = x & mask; int low, high; - int l = find_pos ((char *)&t, sizeof(t), &low, &high); - if (l>=0) - printf(" %-5s at 0 range %2d .. %2d;\n",name,low,high); + int l = find_pos((char *)&t, sizeof(t), &low, &high); + + if (l >= 0) + printf(" %-5s at 0 range %2d .. %2d;\n", name, low, high); } -static void gen_chtype_rep(const char *name) +static void +gen_chtype_rep(const char *name) { - printf(" for %s use\n record\n",name); - chtype_rep("Ch",A_CHARTEXT); - chtype_rep("Color",A_COLOR); - chtype_rep("Attr",(A_ATTRIBUTES&~A_COLOR)); - printf(" end record;\n for %s'Size use %ld;\n", name, (long)(8*sizeof(chtype))); + printf(" for %s use\n record\n", name); + chtype_rep("Ch", A_CHARTEXT); + chtype_rep("Color", A_COLOR); + chtype_rep("Attr", (A_ATTRIBUTES & ~A_COLOR)); + printf(" end record;\n for %s'Size use %ld;\n", + name, (long)(8 * sizeof(chtype))); + printf(" -- Please note: this rep. clause is generated and may be\n"); printf(" -- different on your system.\n"); } - -static void mrep_rep (const char *name, void *rec) +static void +mrep_rep(const char *name, void *rec) { int low, high; int l = find_pos((char *)rec, sizeof(MEVENT), &low, &high); - if (l>=0) - printf(" %-7s at 0 range %3d .. %3d;\n",name,low,high); -} + if (l >= 0) + printf(" %-7s at 0 range %3d .. %3d;\n", name, low, high); +} -static void gen_mrep_rep(const char *name) +static void +gen_mrep_rep(const char *name) { MEVENT x; - printf(" for %s use\n record\n",name); + printf(" for %s use\n record\n", name); - memset(&x,0,sizeof(x)); + memset(&x, 0, sizeof(x)); x.id = -1; - mrep_rep("Id",&x); + mrep_rep("Id", &x); - memset(&x,0,sizeof(x)); + memset(&x, 0, sizeof(x)); x.x = -1; - mrep_rep("X",&x); + mrep_rep("X", &x); - memset(&x,0,sizeof(x)); + memset(&x, 0, sizeof(x)); x.y = -1; - mrep_rep("Y",&x); + mrep_rep("Y", &x); - memset(&x,0,sizeof(x)); + memset(&x, 0, sizeof(x)); x.z = -1; - mrep_rep("Z",&x); + mrep_rep("Z", &x); - memset(&x,0,sizeof(x)); + memset(&x, 0, sizeof(x)); x.bstate = -1; - mrep_rep("Bstate",&x); + mrep_rep("Bstate", &x); printf(" end record;\n"); printf(" -- Please note: this rep. clause is generated and may be\n"); printf(" -- different on your system.\n"); } -static void gen_attr_set( const char *name ) +static void +gen_attr_set(const char *name) { /* All of the A_xxx symbols are defined in ncurses, but not all are nonzero * if "configure --enable-widec" is specified. */ - static const name_attribute_pair nap[] = { + static const name_attribute_pair nap[] = + { #if A_STANDOUT - {"Stand_Out", A_STANDOUT}, + {"Stand_Out", A_STANDOUT}, #endif #if A_UNDERLINE - {"Under_Line", A_UNDERLINE}, + {"Under_Line", A_UNDERLINE}, #endif #if A_REVERSE - {"Reverse_Video", A_REVERSE}, + {"Reverse_Video", A_REVERSE}, #endif #if A_BLINK - {"Blink", A_BLINK}, + {"Blink", A_BLINK}, #endif #if A_DIM - {"Dim_Character", A_DIM}, + {"Dim_Character", A_DIM}, #endif #if A_BOLD - {"Bold_Character", A_BOLD}, + {"Bold_Character", A_BOLD}, #endif #if A_ALTCHARSET {"Alternate_Character_Set", A_ALTCHARSET}, #endif #if A_INVIS - {"Invisible_Character", A_INVIS}, + {"Invisible_Character", A_INVIS}, #endif #if A_PROTECT - {"Protected_Character", A_PROTECT}, + {"Protected_Character", A_PROTECT}, #endif #if A_HORIZONTAL - {"Horizontal", A_HORIZONTAL}, + {"Horizontal", A_HORIZONTAL}, #endif #if A_LEFT - {"Left", A_LEFT}, + {"Left", A_LEFT}, #endif #if A_LOW - {"Low", A_LOW}, + {"Low", A_LOW}, #endif #if A_RIGHT - {"Right", A_RIGHT}, + {"Right", A_RIGHT}, #endif #if A_TOP - {"Top", A_TOP}, + {"Top", A_TOP}, #endif #if A_VERTICAL - {"Vertical", A_VERTICAL}, + {"Vertical", A_VERTICAL}, #endif - {(char *)0, 0} + {(char *)0, 0} }; chtype attr = A_ATTRIBUTES & ~A_COLOR; - int start=-1, len=0, i, set; - for(i=0;i<(int)(8*sizeof(chtype));i++) { - set = attr&1; - if (set) { - if (start<0) - start = i; - if (start>=0) { - len++; - } + int start = -1; + int len = 0; + int i, set; + for (i = 0; i < (int)(8 * sizeof(chtype)); i++) + + { + set = attr & 1; + if (set) + { + if (start < 0) + start = i; + if (start >= 0) + { + len++; + } + } + attr = attr >> 1; } - attr = attr >> 1; - } - gen_reps (nap, name, (len+7)/8, little_endian?start:0); + gen_reps(nap, name, (len + 7) / 8, little_endian ? start : 0); } -static void gen_trace(const char *name) -{ - static const name_attribute_pair nap[] = { - {"Times", TRACE_TIMES}, - {"Tputs", TRACE_TPUTS}, - {"Update", TRACE_UPDATE}, - {"Cursor_Move", TRACE_MOVE}, - {"Character_Output", TRACE_CHARPUT}, - {"Calls", TRACE_CALLS}, - {"Virtual_Puts", TRACE_VIRTPUT}, - {"Input_Events", TRACE_IEVENT}, - {"TTY_State", TRACE_BITS}, - {"Internal_Calls", TRACE_ICALLS}, - {"Character_Calls", TRACE_CCALLS}, - {"Termcap_TermInfo", TRACE_DATABASE}, - {(char *)0, 0} +static void +gen_trace(const char *name) +{ + static const name_attribute_pair nap[] = + { + {"Times", TRACE_TIMES}, + {"Tputs", TRACE_TPUTS}, + {"Update", TRACE_UPDATE}, + {"Cursor_Move", TRACE_MOVE}, + {"Character_Output", TRACE_CHARPUT}, + {"Calls", TRACE_CALLS}, + {"Virtual_Puts", TRACE_VIRTPUT}, + {"Input_Events", TRACE_IEVENT}, + {"TTY_State", TRACE_BITS}, + {"Internal_Calls", TRACE_ICALLS}, + {"Character_Calls", TRACE_CCALLS}, + {"Termcap_TermInfo", TRACE_DATABASE}, + {(char *)0, 0} }; - gen_reps(nap,name,sizeof(int),0); + gen_reps(nap, name, sizeof(int), 0); } -static void gen_menu_opt_rep(const char *name) +static void +gen_menu_opt_rep(const char *name) { - static const name_attribute_pair nap[] = { + static const name_attribute_pair nap[] = + { #ifdef O_ONEVALUE {"One_Valued", O_ONEVALUE}, #endif @@ -328,90 +349,99 @@ static void gen_menu_opt_rep(const char *name) #endif {(char *)0, 0} }; - gen_reps (nap, name, sizeof(int),0); + gen_reps(nap, name, sizeof(int), 0); } -static void gen_item_opt_rep(const char *name) +static void +gen_item_opt_rep(const char *name) { - static const name_attribute_pair nap[] = { + static const name_attribute_pair nap[] = + { #ifdef O_SELECTABLE {"Selectable", O_SELECTABLE}, #endif - {(char *)0 , 0} + {(char *)0, 0} }; - gen_reps (nap, name, sizeof(int),0); + gen_reps(nap, name, sizeof(int), 0); } -static void gen_form_opt_rep(const char *name) +static void +gen_form_opt_rep(const char *name) { - static const name_attribute_pair nap[] = { + static const name_attribute_pair nap[] = + { #ifdef O_NL_OVERLOAD {"NL_Overload", O_NL_OVERLOAD}, #endif #ifdef O_BS_OVERLOAD {"BS_Overload", O_BS_OVERLOAD}, #endif - {(char *)0 , 0} + {(char *)0, 0} }; - gen_reps (nap, name, sizeof(int),0); + gen_reps(nap, name, sizeof(int), 0); } /* * Generate the representation clause for the Field_Option_Set record */ -static void gen_field_opt_rep(const char *name) +static void +gen_field_opt_rep(const char *name) { - static const name_attribute_pair nap[] = { + static const name_attribute_pair nap[] = + { #ifdef O_VISIBLE - {"Visible",O_VISIBLE}, + {"Visible", O_VISIBLE}, #endif #ifdef O_ACTIVE - {"Active",O_ACTIVE}, + {"Active", O_ACTIVE}, #endif #ifdef O_PUBLIC - {"Public",O_PUBLIC}, + {"Public", O_PUBLIC}, #endif #ifdef O_EDIT - {"Edit",O_EDIT}, + {"Edit", O_EDIT}, #endif #ifdef O_WRAP - {"Wrap",O_WRAP}, + {"Wrap", O_WRAP}, #endif #ifdef O_BLANK - {"Blank",O_BLANK}, + {"Blank", O_BLANK}, #endif #ifdef O_AUTOSKIP - {"Auto_Skip",O_AUTOSKIP}, + {"Auto_Skip", O_AUTOSKIP}, #endif #ifdef O_NULLOK - {"Null_Ok",O_NULLOK}, + {"Null_Ok", O_NULLOK}, #endif #ifdef O_PASSOK - {"Pass_Ok",O_PASSOK}, + {"Pass_Ok", O_PASSOK}, #endif #ifdef O_STATIC - {"Static",O_STATIC}, + {"Static", O_STATIC}, #endif {(char *)0, 0} }; - gen_reps (nap, name, sizeof(int),0); + gen_reps(nap, name, sizeof(int), 0); } /* * Generate a single key code constant definition. */ -static void keydef(const char *name, const char *old_name, int value, int mode) +static void +keydef(const char *name, const char *old_name, int value, int mode) { - if (mode==0) /* Generate the new name */ - printf(" %-30s : constant Special_Key_Code := 8#%3o#;\n",name,value); + if (mode == 0) /* Generate the new name */ + printf(" %-30s : constant Special_Key_Code := 8#%3o#;\n", name, value); else - { /* generate the old name, but only if it doesn't conflict with the old - * name (Ada95 isn't case sensitive!) - */ - const char *s = old_name; const char *t = name; - while ( *s && *t && (toupper(*s++) == toupper(*t++))); + { /* generate the old name, but only if it doesn't conflict with the old + * name (Ada95 isn't case sensitive!) + */ + const char *s = old_name; + const char *t = name; + + while (*s && *t && (toupper(*s++) == toupper(*t++))); if (*s || *t) - printf(" %-16s : Special_Key_Code renames %s;\n",old_name,name); + printf(" %-16s : Special_Key_Code renames %s;\n", old_name, name); } } @@ -422,298 +452,299 @@ static void keydef(const char *name, const char *old_name, int value, int mode) * generated, given that the name wasn't already defined in the "nice" * list. */ -static void gen_keydefs (int mode) +static void +gen_keydefs(int mode) { char buf[16]; char obuf[16]; int i; #ifdef KEY_CODE_YES - keydef("Key_Code_Yes","KEY_CODE_YES",KEY_CODE_YES,mode); + keydef("Key_Code_Yes", "KEY_CODE_YES", KEY_CODE_YES, mode); #endif #ifdef KEY_MIN - keydef("Key_Min","KEY_MIN",KEY_MIN,mode); + keydef("Key_Min", "KEY_MIN", KEY_MIN, mode); #endif #ifdef KEY_BREAK - keydef("Key_Break","KEY_BREAK",KEY_BREAK,mode); + keydef("Key_Break", "KEY_BREAK", KEY_BREAK, mode); #endif #ifdef KEY_DOWN - keydef("Key_Cursor_Down","KEY_DOWN",KEY_DOWN,mode); + keydef("Key_Cursor_Down", "KEY_DOWN", KEY_DOWN, mode); #endif #ifdef KEY_UP - keydef("Key_Cursor_Up","KEY_UP",KEY_UP,mode); + keydef("Key_Cursor_Up", "KEY_UP", KEY_UP, mode); #endif #ifdef KEY_LEFT - keydef("Key_Cursor_Left","KEY_LEFT",KEY_LEFT,mode); + keydef("Key_Cursor_Left", "KEY_LEFT", KEY_LEFT, mode); #endif #ifdef KEY_RIGHT - keydef("Key_Cursor_Right","KEY_RIGHT",KEY_RIGHT,mode); + keydef("Key_Cursor_Right", "KEY_RIGHT", KEY_RIGHT, mode); #endif #ifdef KEY_HOME - keydef("Key_Home","KEY_HOME",KEY_HOME,mode); + keydef("Key_Home", "KEY_HOME", KEY_HOME, mode); #endif #ifdef KEY_BACKSPACE - keydef("Key_Backspace","KEY_BACKSPACE",KEY_BACKSPACE,mode); + keydef("Key_Backspace", "KEY_BACKSPACE", KEY_BACKSPACE, mode); #endif #ifdef KEY_F0 - keydef("Key_F0","KEY_F0",KEY_F0,mode); + keydef("Key_F0", "KEY_F0", KEY_F0, mode); #endif #ifdef KEY_F - for(i=1;i<=24;i++) + for (i = 1; i <= 24; i++) { - sprintf(buf ,"Key_F%d",i); - sprintf(obuf,"KEY_F%d",i); - keydef(buf,obuf,KEY_F(i),mode); + sprintf(buf, "Key_F%d", i); + sprintf(obuf, "KEY_F%d", i); + keydef(buf, obuf, KEY_F(i), mode); } #endif #ifdef KEY_DL - keydef("Key_Delete_Line","KEY_DL",KEY_DL,mode); + keydef("Key_Delete_Line", "KEY_DL", KEY_DL, mode); #endif #ifdef KEY_IL - keydef("Key_Insert_Line","KEY_IL",KEY_IL,mode); + keydef("Key_Insert_Line", "KEY_IL", KEY_IL, mode); #endif #ifdef KEY_DC - keydef("Key_Delete_Char","KEY_DC",KEY_DC,mode); + keydef("Key_Delete_Char", "KEY_DC", KEY_DC, mode); #endif #ifdef KEY_IC - keydef("Key_Insert_Char","KEY_IC",KEY_IC,mode); + keydef("Key_Insert_Char", "KEY_IC", KEY_IC, mode); #endif #ifdef KEY_EIC - keydef("Key_Exit_Insert_Mode","KEY_EIC",KEY_EIC,mode); + keydef("Key_Exit_Insert_Mode", "KEY_EIC", KEY_EIC, mode); #endif #ifdef KEY_CLEAR - keydef("Key_Clear_Screen","KEY_CLEAR",KEY_CLEAR,mode); + keydef("Key_Clear_Screen", "KEY_CLEAR", KEY_CLEAR, mode); #endif #ifdef KEY_EOS - keydef("Key_Clear_End_Of_Screen","KEY_EOS",KEY_EOS,mode); + keydef("Key_Clear_End_Of_Screen", "KEY_EOS", KEY_EOS, mode); #endif #ifdef KEY_EOL - keydef("Key_Clear_End_Of_Line","KEY_EOL",KEY_EOL,mode); + keydef("Key_Clear_End_Of_Line", "KEY_EOL", KEY_EOL, mode); #endif #ifdef KEY_SF - keydef("Key_Scroll_1_Forward","KEY_SF",KEY_SF,mode); + keydef("Key_Scroll_1_Forward", "KEY_SF", KEY_SF, mode); #endif #ifdef KEY_SR - keydef("Key_Scroll_1_Backward","KEY_SR",KEY_SR,mode); + keydef("Key_Scroll_1_Backward", "KEY_SR", KEY_SR, mode); #endif #ifdef KEY_NPAGE - keydef("Key_Next_Page","KEY_NPAGE",KEY_NPAGE,mode); + keydef("Key_Next_Page", "KEY_NPAGE", KEY_NPAGE, mode); #endif #ifdef KEY_PPAGE - keydef("Key_Previous_Page","KEY_PPAGE",KEY_PPAGE,mode); + keydef("Key_Previous_Page", "KEY_PPAGE", KEY_PPAGE, mode); #endif #ifdef KEY_STAB - keydef("Key_Set_Tab","KEY_STAB",KEY_STAB,mode); + keydef("Key_Set_Tab", "KEY_STAB", KEY_STAB, mode); #endif #ifdef KEY_CTAB - keydef("Key_Clear_Tab","KEY_CTAB",KEY_CTAB,mode); + keydef("Key_Clear_Tab", "KEY_CTAB", KEY_CTAB, mode); #endif #ifdef KEY_CATAB - keydef("Key_Clear_All_Tabs","KEY_CATAB",KEY_CATAB,mode); + keydef("Key_Clear_All_Tabs", "KEY_CATAB", KEY_CATAB, mode); #endif #ifdef KEY_ENTER - keydef("Key_Enter_Or_Send","KEY_ENTER",KEY_ENTER,mode); + keydef("Key_Enter_Or_Send", "KEY_ENTER", KEY_ENTER, mode); #endif #ifdef KEY_SRESET - keydef("Key_Soft_Reset","KEY_SRESET",KEY_SRESET,mode); + keydef("Key_Soft_Reset", "KEY_SRESET", KEY_SRESET, mode); #endif #ifdef KEY_RESET - keydef("Key_Reset","KEY_RESET",KEY_RESET,mode); + keydef("Key_Reset", "KEY_RESET", KEY_RESET, mode); #endif #ifdef KEY_PRINT - keydef("Key_Print","KEY_PRINT",KEY_PRINT,mode); + keydef("Key_Print", "KEY_PRINT", KEY_PRINT, mode); #endif #ifdef KEY_LL - keydef("Key_Bottom","KEY_LL",KEY_LL,mode); + keydef("Key_Bottom", "KEY_LL", KEY_LL, mode); #endif #ifdef KEY_A1 - keydef("Key_Upper_Left_Of_Keypad","KEY_A1",KEY_A1,mode); + keydef("Key_Upper_Left_Of_Keypad", "KEY_A1", KEY_A1, mode); #endif #ifdef KEY_A3 - keydef("Key_Upper_Right_Of_Keypad","KEY_A3",KEY_A3,mode); + keydef("Key_Upper_Right_Of_Keypad", "KEY_A3", KEY_A3, mode); #endif #ifdef KEY_B2 - keydef("Key_Center_Of_Keypad","KEY_B2",KEY_B2,mode); + keydef("Key_Center_Of_Keypad", "KEY_B2", KEY_B2, mode); #endif #ifdef KEY_C1 - keydef("Key_Lower_Left_Of_Keypad","KEY_C1",KEY_C1,mode); + keydef("Key_Lower_Left_Of_Keypad", "KEY_C1", KEY_C1, mode); #endif #ifdef KEY_C3 - keydef("Key_Lower_Right_Of_Keypad","KEY_C3",KEY_C3,mode); + keydef("Key_Lower_Right_Of_Keypad", "KEY_C3", KEY_C3, mode); #endif #ifdef KEY_BTAB - keydef("Key_Back_Tab","KEY_BTAB",KEY_BTAB,mode); + keydef("Key_Back_Tab", "KEY_BTAB", KEY_BTAB, mode); #endif #ifdef KEY_BEG - keydef("Key_Beginning","KEY_BEG",KEY_BEG,mode); + keydef("Key_Beginning", "KEY_BEG", KEY_BEG, mode); #endif #ifdef KEY_CANCEL - keydef("Key_Cancel","KEY_CANCEL",KEY_CANCEL,mode); + keydef("Key_Cancel", "KEY_CANCEL", KEY_CANCEL, mode); #endif #ifdef KEY_CLOSE - keydef("Key_Close","KEY_CLOSE",KEY_CLOSE,mode); + keydef("Key_Close", "KEY_CLOSE", KEY_CLOSE, mode); #endif #ifdef KEY_COMMAND - keydef("Key_Command","KEY_COMMAND",KEY_COMMAND,mode); + keydef("Key_Command", "KEY_COMMAND", KEY_COMMAND, mode); #endif #ifdef KEY_COPY - keydef("Key_Copy","KEY_COPY",KEY_COPY,mode); + keydef("Key_Copy", "KEY_COPY", KEY_COPY, mode); #endif #ifdef KEY_CREATE - keydef("Key_Create","KEY_CREATE",KEY_CREATE,mode); + keydef("Key_Create", "KEY_CREATE", KEY_CREATE, mode); #endif #ifdef KEY_END - keydef("Key_End","KEY_END",KEY_END,mode); + keydef("Key_End", "KEY_END", KEY_END, mode); #endif #ifdef KEY_EXIT - keydef("Key_Exit","KEY_EXIT",KEY_EXIT,mode); + keydef("Key_Exit", "KEY_EXIT", KEY_EXIT, mode); #endif #ifdef KEY_FIND - keydef("Key_Find","KEY_FIND",KEY_FIND,mode); + keydef("Key_Find", "KEY_FIND", KEY_FIND, mode); #endif #ifdef KEY_HELP - keydef("Key_Help","KEY_HELP",KEY_HELP,mode); + keydef("Key_Help", "KEY_HELP", KEY_HELP, mode); #endif #ifdef KEY_MARK - keydef("Key_Mark","KEY_MARK",KEY_MARK,mode); + keydef("Key_Mark", "KEY_MARK", KEY_MARK, mode); #endif #ifdef KEY_MESSAGE - keydef("Key_Message","KEY_MESSAGE",KEY_MESSAGE,mode); + keydef("Key_Message", "KEY_MESSAGE", KEY_MESSAGE, mode); #endif #ifdef KEY_MOVE - keydef("Key_Move","KEY_MOVE",KEY_MOVE,mode); + keydef("Key_Move", "KEY_MOVE", KEY_MOVE, mode); #endif #ifdef KEY_NEXT - keydef("Key_Next","KEY_NEXT",KEY_NEXT,mode); + keydef("Key_Next", "KEY_NEXT", KEY_NEXT, mode); #endif #ifdef KEY_OPEN - keydef("Key_Open","KEY_OPEN",KEY_OPEN,mode); + keydef("Key_Open", "KEY_OPEN", KEY_OPEN, mode); #endif #ifdef KEY_OPTIONS - keydef("Key_Options","KEY_OPTIONS",KEY_OPTIONS,mode); + keydef("Key_Options", "KEY_OPTIONS", KEY_OPTIONS, mode); #endif #ifdef KEY_PREVIOUS - keydef("Key_Previous","KEY_PREVIOUS",KEY_PREVIOUS,mode); + keydef("Key_Previous", "KEY_PREVIOUS", KEY_PREVIOUS, mode); #endif #ifdef KEY_REDO - keydef("Key_Redo","KEY_REDO",KEY_REDO,mode); + keydef("Key_Redo", "KEY_REDO", KEY_REDO, mode); #endif #ifdef KEY_REFERENCE - keydef("Key_Reference","KEY_REFERENCE",KEY_REFERENCE,mode); + keydef("Key_Reference", "KEY_REFERENCE", KEY_REFERENCE, mode); #endif #ifdef KEY_REFRESH - keydef("Key_Refresh","KEY_REFRESH",KEY_REFRESH,mode); + keydef("Key_Refresh", "KEY_REFRESH", KEY_REFRESH, mode); #endif #ifdef KEY_REPLACE - keydef("Key_Replace","KEY_REPLACE",KEY_REPLACE,mode); + keydef("Key_Replace", "KEY_REPLACE", KEY_REPLACE, mode); #endif #ifdef KEY_RESTART - keydef("Key_Restart","KEY_RESTART",KEY_RESTART,mode); + keydef("Key_Restart", "KEY_RESTART", KEY_RESTART, mode); #endif #ifdef KEY_RESUME - keydef("Key_Resume","KEY_RESUME",KEY_RESUME,mode); + keydef("Key_Resume", "KEY_RESUME", KEY_RESUME, mode); #endif #ifdef KEY_SAVE - keydef("Key_Save","KEY_SAVE",KEY_SAVE,mode); + keydef("Key_Save", "KEY_SAVE", KEY_SAVE, mode); #endif #ifdef KEY_SBEG - keydef("Key_Shift_Begin","KEY_SBEG",KEY_SBEG,mode); + keydef("Key_Shift_Begin", "KEY_SBEG", KEY_SBEG, mode); #endif #ifdef KEY_SCANCEL - keydef("Key_Shift_Cancel","KEY_SCANCEL",KEY_SCANCEL,mode); + keydef("Key_Shift_Cancel", "KEY_SCANCEL", KEY_SCANCEL, mode); #endif #ifdef KEY_SCOMMAND - keydef("Key_Shift_Command","KEY_SCOMMAND",KEY_SCOMMAND,mode); + keydef("Key_Shift_Command", "KEY_SCOMMAND", KEY_SCOMMAND, mode); #endif #ifdef KEY_SCOPY - keydef("Key_Shift_Copy","KEY_SCOPY",KEY_SCOPY,mode); + keydef("Key_Shift_Copy", "KEY_SCOPY", KEY_SCOPY, mode); #endif #ifdef KEY_SCREATE - keydef("Key_Shift_Create","KEY_SCREATE",KEY_SCREATE,mode); + keydef("Key_Shift_Create", "KEY_SCREATE", KEY_SCREATE, mode); #endif #ifdef KEY_SDC - keydef("Key_Shift_Delete_Char","KEY_SDC",KEY_SDC,mode); + keydef("Key_Shift_Delete_Char", "KEY_SDC", KEY_SDC, mode); #endif #ifdef KEY_SDL - keydef("Key_Shift_Delete_Line","KEY_SDL",KEY_SDL,mode); + keydef("Key_Shift_Delete_Line", "KEY_SDL", KEY_SDL, mode); #endif #ifdef KEY_SELECT - keydef("Key_Select","KEY_SELECT",KEY_SELECT,mode); + keydef("Key_Select", "KEY_SELECT", KEY_SELECT, mode); #endif #ifdef KEY_SEND - keydef("Key_Shift_End","KEY_SEND",KEY_SEND,mode); + keydef("Key_Shift_End", "KEY_SEND", KEY_SEND, mode); #endif #ifdef KEY_SEOL - keydef("Key_Shift_Clear_End_Of_Line","KEY_SEOL",KEY_SEOL,mode); + keydef("Key_Shift_Clear_End_Of_Line", "KEY_SEOL", KEY_SEOL, mode); #endif #ifdef KEY_SEXIT - keydef("Key_Shift_Exit","KEY_SEXIT",KEY_SEXIT,mode); + keydef("Key_Shift_Exit", "KEY_SEXIT", KEY_SEXIT, mode); #endif #ifdef KEY_SFIND - keydef("Key_Shift_Find","KEY_SFIND",KEY_SFIND,mode); + keydef("Key_Shift_Find", "KEY_SFIND", KEY_SFIND, mode); #endif #ifdef KEY_SHELP - keydef("Key_Shift_Help","KEY_SHELP",KEY_SHELP,mode); + keydef("Key_Shift_Help", "KEY_SHELP", KEY_SHELP, mode); #endif #ifdef KEY_SHOME - keydef("Key_Shift_Home","KEY_SHOME",KEY_SHOME,mode); + keydef("Key_Shift_Home", "KEY_SHOME", KEY_SHOME, mode); #endif #ifdef KEY_SIC - keydef("Key_Shift_Insert_Char","KEY_SIC",KEY_SIC,mode); + keydef("Key_Shift_Insert_Char", "KEY_SIC", KEY_SIC, mode); #endif #ifdef KEY_SLEFT - keydef("Key_Shift_Cursor_Left","KEY_SLEFT",KEY_SLEFT,mode); + keydef("Key_Shift_Cursor_Left", "KEY_SLEFT", KEY_SLEFT, mode); #endif #ifdef KEY_SMESSAGE - keydef("Key_Shift_Message","KEY_SMESSAGE",KEY_SMESSAGE,mode); + keydef("Key_Shift_Message", "KEY_SMESSAGE", KEY_SMESSAGE, mode); #endif #ifdef KEY_SMOVE - keydef("Key_Shift_Move","KEY_SMOVE",KEY_SMOVE,mode); + keydef("Key_Shift_Move", "KEY_SMOVE", KEY_SMOVE, mode); #endif #ifdef KEY_SNEXT - keydef("Key_Shift_Next_Page","KEY_SNEXT",KEY_SNEXT,mode); + keydef("Key_Shift_Next_Page", "KEY_SNEXT", KEY_SNEXT, mode); #endif #ifdef KEY_SOPTIONS - keydef("Key_Shift_Options","KEY_SOPTIONS",KEY_SOPTIONS,mode); + keydef("Key_Shift_Options", "KEY_SOPTIONS", KEY_SOPTIONS, mode); #endif #ifdef KEY_SPREVIOUS - keydef("Key_Shift_Previous_Page","KEY_SPREVIOUS",KEY_SPREVIOUS,mode); + keydef("Key_Shift_Previous_Page", "KEY_SPREVIOUS", KEY_SPREVIOUS, mode); #endif #ifdef KEY_SPRINT - keydef("Key_Shift_Print","KEY_SPRINT",KEY_SPRINT,mode); + keydef("Key_Shift_Print", "KEY_SPRINT", KEY_SPRINT, mode); #endif #ifdef KEY_SREDO - keydef("Key_Shift_Redo","KEY_SREDO",KEY_SREDO,mode); + keydef("Key_Shift_Redo", "KEY_SREDO", KEY_SREDO, mode); #endif #ifdef KEY_SREPLACE - keydef("Key_Shift_Replace","KEY_SREPLACE",KEY_SREPLACE,mode); + keydef("Key_Shift_Replace", "KEY_SREPLACE", KEY_SREPLACE, mode); #endif #ifdef KEY_SRIGHT - keydef("Key_Shift_Cursor_Right","KEY_SRIGHT",KEY_SRIGHT,mode); + keydef("Key_Shift_Cursor_Right", "KEY_SRIGHT", KEY_SRIGHT, mode); #endif #ifdef KEY_SRSUME - keydef("Key_Shift_Resume","KEY_SRSUME",KEY_SRSUME,mode); + keydef("Key_Shift_Resume", "KEY_SRSUME", KEY_SRSUME, mode); #endif #ifdef KEY_SSAVE - keydef("Key_Shift_Save","KEY_SSAVE",KEY_SSAVE,mode); + keydef("Key_Shift_Save", "KEY_SSAVE", KEY_SSAVE, mode); #endif #ifdef KEY_SSUSPEND - keydef("Key_Shift_Suspend","KEY_SSUSPEND",KEY_SSUSPEND,mode); + keydef("Key_Shift_Suspend", "KEY_SSUSPEND", KEY_SSUSPEND, mode); #endif #ifdef KEY_SUNDO - keydef("Key_Shift_Undo","KEY_SUNDO",KEY_SUNDO,mode); + keydef("Key_Shift_Undo", "KEY_SUNDO", KEY_SUNDO, mode); #endif #ifdef KEY_SUSPEND - keydef("Key_Suspend","KEY_SUSPEND",KEY_SUSPEND,mode); + keydef("Key_Suspend", "KEY_SUSPEND", KEY_SUSPEND, mode); #endif #ifdef KEY_UNDO - keydef("Key_Undo","KEY_UNDO",KEY_UNDO,mode); + keydef("Key_Undo", "KEY_UNDO", KEY_UNDO, mode); #endif #ifdef KEY_MOUSE - keydef("Key_Mouse","KEY_MOUSE",KEY_MOUSE,mode); + keydef("Key_Mouse", "KEY_MOUSE", KEY_MOUSE, mode); #endif #ifdef KEY_RESIZE - keydef("Key_Resize","KEY_RESIZE",KEY_RESIZE,mode); + keydef("Key_Resize", "KEY_RESIZE", KEY_RESIZE, mode); #endif } @@ -722,120 +753,122 @@ static void gen_keydefs (int mode) * is a reference to the ACS character in the acs_map[] array and * will be translated into an index. */ -static void acs_def (const char *name, chtype *a) +static void +acs_def(const char *name, chtype *a) { int c = a - &acs_map[0]; - printf(" %-24s : constant Character := ",name); - if (isprint(c) && (c!='`')) - printf("'%c';\n",c); + + printf(" %-24s : constant Character := ", name); + if (isprint(c) && (c != '`')) + printf("'%c';\n", c); else - printf("Character'Val (%d);\n",c); + printf("Character'Val (%d);\n", c); } /* * Generate the constants for the ACS characters */ -static void gen_acs (void) +static void +gen_acs(void) { #ifdef ACS_ULCORNER - acs_def("ACS_Upper_Left_Corner",&ACS_ULCORNER); + acs_def("ACS_Upper_Left_Corner", &ACS_ULCORNER); #endif #ifdef ACS_LLCORNER - acs_def("ACS_Lower_Left_Corner",&ACS_LLCORNER); + acs_def("ACS_Lower_Left_Corner", &ACS_LLCORNER); #endif #ifdef ACS_URCORNER - acs_def("ACS_Upper_Right_Corner",&ACS_URCORNER); + acs_def("ACS_Upper_Right_Corner", &ACS_URCORNER); #endif #ifdef ACS_LRCORNER - acs_def("ACS_Lower_Right_Corner",&ACS_LRCORNER); + acs_def("ACS_Lower_Right_Corner", &ACS_LRCORNER); #endif #ifdef ACS_LTEE - acs_def("ACS_Left_Tee",&ACS_LTEE); + acs_def("ACS_Left_Tee", &ACS_LTEE); #endif #ifdef ACS_RTEE - acs_def("ACS_Right_Tee",&ACS_RTEE); + acs_def("ACS_Right_Tee", &ACS_RTEE); #endif #ifdef ACS_BTEE - acs_def("ACS_Bottom_Tee",&ACS_BTEE); + acs_def("ACS_Bottom_Tee", &ACS_BTEE); #endif #ifdef ACS_TTEE - acs_def("ACS_Top_Tee",&ACS_TTEE); + acs_def("ACS_Top_Tee", &ACS_TTEE); #endif #ifdef ACS_HLINE - acs_def("ACS_Horizontal_Line",&ACS_HLINE); + acs_def("ACS_Horizontal_Line", &ACS_HLINE); #endif #ifdef ACS_VLINE - acs_def("ACS_Vertical_Line",&ACS_VLINE); + acs_def("ACS_Vertical_Line", &ACS_VLINE); #endif #ifdef ACS_PLUS - acs_def("ACS_Plus_Symbol",&ACS_PLUS); + acs_def("ACS_Plus_Symbol", &ACS_PLUS); #endif #ifdef ACS_S1 - acs_def("ACS_Scan_Line_1",&ACS_S1); + acs_def("ACS_Scan_Line_1", &ACS_S1); #endif #ifdef ACS_S9 - acs_def("ACS_Scan_Line_9",&ACS_S9); + acs_def("ACS_Scan_Line_9", &ACS_S9); #endif #ifdef ACS_DIAMOND - acs_def("ACS_Diamond",&ACS_DIAMOND); + acs_def("ACS_Diamond", &ACS_DIAMOND); #endif #ifdef ACS_CKBOARD - acs_def("ACS_Checker_Board",&ACS_CKBOARD); + acs_def("ACS_Checker_Board", &ACS_CKBOARD); #endif #ifdef ACS_DEGREE - acs_def("ACS_Degree",&ACS_DEGREE); + acs_def("ACS_Degree", &ACS_DEGREE); #endif #ifdef ACS_PLMINUS - acs_def("ACS_Plus_Minus",&ACS_PLMINUS); + acs_def("ACS_Plus_Minus", &ACS_PLMINUS); #endif #ifdef ACS_BULLET - acs_def("ACS_Bullet",&ACS_BULLET); + acs_def("ACS_Bullet", &ACS_BULLET); #endif #ifdef ACS_LARROW - acs_def("ACS_Left_Arrow",&ACS_LARROW); + acs_def("ACS_Left_Arrow", &ACS_LARROW); #endif #ifdef ACS_RARROW - acs_def("ACS_Right_Arrow",&ACS_RARROW); + acs_def("ACS_Right_Arrow", &ACS_RARROW); #endif #ifdef ACS_DARROW - acs_def("ACS_Down_Arrow",&ACS_DARROW); + acs_def("ACS_Down_Arrow", &ACS_DARROW); #endif #ifdef ACS_UARROW - acs_def("ACS_Up_Arrow",&ACS_UARROW); + acs_def("ACS_Up_Arrow", &ACS_UARROW); #endif #ifdef ACS_BOARD - acs_def("ACS_Board_Of_Squares",&ACS_BOARD); + acs_def("ACS_Board_Of_Squares", &ACS_BOARD); #endif #ifdef ACS_LANTERN - acs_def("ACS_Lantern",&ACS_LANTERN); + acs_def("ACS_Lantern", &ACS_LANTERN); #endif #ifdef ACS_BLOCK - acs_def("ACS_Solid_Block",&ACS_BLOCK); + acs_def("ACS_Solid_Block", &ACS_BLOCK); #endif #ifdef ACS_S3 - acs_def("ACS_Scan_Line_3",&ACS_S3); + acs_def("ACS_Scan_Line_3", &ACS_S3); #endif #ifdef ACS_S7 - acs_def("ACS_Scan_Line_7",&ACS_S7); + acs_def("ACS_Scan_Line_7", &ACS_S7); #endif #ifdef ACS_LEQUAL - acs_def("ACS_Less_Or_Equal",&ACS_LEQUAL); + acs_def("ACS_Less_Or_Equal", &ACS_LEQUAL); #endif #ifdef ACS_GEQUAL - acs_def("ACS_Greater_Or_Equal",&ACS_GEQUAL); + acs_def("ACS_Greater_Or_Equal", &ACS_GEQUAL); #endif #ifdef ACS_PI - acs_def("ACS_PI",&ACS_PI); + acs_def("ACS_PI", &ACS_PI); #endif #ifdef ACS_NEQUAL - acs_def("ACS_Not_Equal",&ACS_NEQUAL); + acs_def("ACS_Not_Equal", &ACS_NEQUAL); #endif #ifdef ACS_STERLING - acs_def("ACS_Sterling",&ACS_STERLING); + acs_def("ACS_Sterling", &ACS_STERLING); #endif } - #define GEN_EVENT(name,value) \ printf(" %-25s : constant Event_Mask := 8#%011lo#;\n", \ #name, value) @@ -845,7 +878,8 @@ static void gen_acs (void) #name, name) static -void gen_mouse_events(void) +void +gen_mouse_events(void) { mmask_t all1 = 0; mmask_t all2 = 0; @@ -959,15 +993,15 @@ void gen_mouse_events(void) #endif #ifdef REPORT_MOUSE_POSITION GEN_MEVENT(REPORT_MOUSE_POSITION); -#endif +#endif #ifdef ALL_MOUSE_EVENTS GEN_MEVENT(ALL_MOUSE_EVENTS); #endif -GEN_EVENT(BUTTON1_EVENTS,all1); -GEN_EVENT(BUTTON2_EVENTS,all2); -GEN_EVENT(BUTTON3_EVENTS,all3); -GEN_EVENT(BUTTON4_EVENTS,all4); + GEN_EVENT(BUTTON1_EVENTS, all1); + GEN_EVENT(BUTTON2_EVENTS, all2); + GEN_EVENT(BUTTON3_EVENTS, all3); + GEN_EVENT(BUTTON4_EVENTS, all4); } /* @@ -975,41 +1009,45 @@ GEN_EVENT(BUTTON4_EVENTS,all4); * The name parameter is the name of the facility to be used in * the comment. */ -static void prologue(const char *name) +static void +prologue(const char *name) { - printf("-- %s binding.\n",name); + printf("-- %s binding.\n", name); printf("-- This module is generated. Please don't change it manually!\n"); printf("-- Run the generator instead.\n-- |"); printf("define(`M4_BIT_ORDER',`%s_Order_First')", - little_endian ? "Low":"High"); + little_endian ? "Low" : "High"); } /* * Write the prologue for the curses facility and make sure that * KEY_MIN and KEY_MAX are defined for the rest of this source. */ -static void basedefs (void) +static void +basedefs(void) { prologue("curses"); #ifndef KEY_MAX # define KEY_MAX 0777 #endif - printf("define(`M4_KEY_MAX',`8#%o#')",KEY_MAX); + printf("define(`M4_KEY_MAX',`8#%o#')", KEY_MAX); #ifndef KEY_MIN # define KEY_MIN 0401 #endif - if (KEY_MIN == 256) { - fprintf(stderr,"Unexpected value for KEY_MIN: %d\n",KEY_MIN); - exit(1); - } - printf("define(`M4_SPECIAL_FIRST',`8#%o#')",KEY_MIN - 1); + if (KEY_MIN == 256) + { + fprintf(stderr, "Unexpected value for KEY_MIN: %d\n", KEY_MIN); + exit(1); + } + printf("define(`M4_SPECIAL_FIRST',`8#%o#')", KEY_MIN - 1); } /* * Write out the comment lines for the menu facility */ -static void menu_basedefs (void) +static void +menu_basedefs(void) { prologue("menu"); } @@ -1017,7 +1055,8 @@ static void menu_basedefs (void) /* * Write out the comment lines for the form facility */ -static void form_basedefs (void) +static void +form_basedefs(void) { prologue("form"); } @@ -1025,7 +1064,8 @@ static void form_basedefs (void) /* * Write out the comment lines for the mouse facility */ -static void mouse_basedefs(void) +static void +mouse_basedefs(void) { prologue("mouse"); } @@ -1033,9 +1073,10 @@ static void mouse_basedefs(void) /* * Write the definition of a single color */ -static void color_def (const char *name, int value) +static void +color_def(const char *name, int value) { - printf(" %-16s : constant Color_Number := %d;\n",name,value); + printf(" %-16s : constant Color_Number := %d;\n", name, value); } #define HAVE_USE_DEFAULT_COLORS 1 @@ -1043,87 +1084,93 @@ static void color_def (const char *name, int value) /* * Generate all color definitions */ -static void gen_color (void) +static void +gen_color(void) { #ifdef HAVE_USE_DEFAULT_COLORS - color_def ("Default_Color",-1); + color_def("Default_Color", -1); #endif #ifdef COLOR_BLACK - color_def ("Black",COLOR_BLACK); + color_def("Black", COLOR_BLACK); #endif #ifdef COLOR_RED - color_def ("Red",COLOR_RED); + color_def("Red", COLOR_RED); #endif #ifdef COLOR_GREEN - color_def ("Green",COLOR_GREEN); + color_def("Green", COLOR_GREEN); #endif #ifdef COLOR_YELLOW - color_def ("Yellow",COLOR_YELLOW); + color_def("Yellow", COLOR_YELLOW); #endif #ifdef COLOR_BLUE - color_def ("Blue",COLOR_BLUE); + color_def("Blue", COLOR_BLUE); #endif #ifdef COLOR_MAGENTA - color_def ("Magenta",COLOR_MAGENTA); + color_def("Magenta", COLOR_MAGENTA); #endif #ifdef COLOR_CYAN - color_def ("Cyan",COLOR_CYAN); + color_def("Cyan", COLOR_CYAN); #endif #ifdef COLOR_WHITE - color_def ("White",COLOR_WHITE); + color_def("White", COLOR_WHITE); #endif } /* * Generate the linker options for the base facility */ -static void gen_linkopts (void) +static void +gen_linkopts(void) { - printf(" pragma Linker_Options (\"-lncurses%s\");\n", model); + printf(" pragma Linker_Options (\"-lncurses%s\");\n", model); } /* * Generate the linker options for the menu facility */ -static void gen_menu_linkopts (void) +static void +gen_menu_linkopts(void) { - printf(" pragma Linker_Options (\"-lmenu%s\");\n", model); + printf(" pragma Linker_Options (\"-lmenu%s\");\n", model); } /* * Generate the linker options for the form facility */ -static void gen_form_linkopts (void) +static void +gen_form_linkopts(void) { - printf(" pragma Linker_Options (\"-lform%s\");\n", model); + printf(" pragma Linker_Options (\"-lform%s\");\n", model); } /* * Generate the linker options for the panel facility */ -static void gen_panel_linkopts (void) +static void +gen_panel_linkopts(void) { - printf(" pragma Linker_Options (\"-lpanel%s\");\n", model); + printf(" pragma Linker_Options (\"-lpanel%s\");\n", model); } -static void gen_version_info (void) +static void +gen_version_info(void) { - static const char* v1 = - " NC_Major_Version : constant := %d; -- Major version of the library\n"; - static const char* v2 = - " NC_Minor_Version : constant := %d; -- Minor version of the library\n"; - static const char* v3 = - " NC_Version : constant String := %c%d.%d%c; -- Version of library\n"; + static const char *v1 = + " NC_Major_Version : constant := %d; -- Major version of the library\n"; + static const char *v2 = + " NC_Minor_Version : constant := %d; -- Minor version of the library\n"; + static const char *v3 = + " NC_Version : constant String := %c%d.%d%c; -- Version of library\n"; printf(v1, NCURSES_VERSION_MAJOR); printf(v2, NCURSES_VERSION_MINOR); - printf(v3, '"',NCURSES_VERSION_MAJOR,NCURSES_VERSION_MINOR,'"'); + printf(v3, '"', NCURSES_VERSION_MAJOR, NCURSES_VERSION_MINOR, '"'); } static int -eti_gen(char*buf, int code, const char* name, int* etimin, int* etimax) +eti_gen(char *buf, int code, const char *name, int *etimin, int *etimax) { - sprintf(buf," E_%-16s : constant Eti_Error := %d;\n",name,code); + sprintf(buf, " E_%-16s : constant Eti_Error := %d;\n", name, code); if (code < *etimin) *etimin = code; if (code > *etimax) @@ -1136,68 +1183,77 @@ eti_gen(char*buf, int code, const char* name, int* etimin, int* etimax) o = offsetof(WINDOW, member); \ if ((o%sizeof(itype) == 0)) { \ printf(" Offset%-*s : constant Natural := %2ld; -- %s\n", \ - 12, #member, o/sizeof(itype),#itype); \ + 12, #member, (long)(o/sizeof(itype)),#itype); \ } \ } - + static void gen_offsets(void) { long o; - const char* s_bool = ""; - - GEN_OFFSET(_maxy,short); - GEN_OFFSET(_maxx,short); - GEN_OFFSET(_begy,short); - GEN_OFFSET(_begx,short); - GEN_OFFSET(_cury,short); - GEN_OFFSET(_curx,short); - GEN_OFFSET(_yoffset,short); - GEN_OFFSET(_pary,int); - GEN_OFFSET(_parx,int); - if (sizeof(bool) == sizeof(char)) { - GEN_OFFSET(_notimeout,char); - GEN_OFFSET(_clear,char); - GEN_OFFSET(_leaveok,char); - GEN_OFFSET(_scroll,char); - GEN_OFFSET(_idlok,char); - GEN_OFFSET(_idcok,char); - GEN_OFFSET(_immed,char); - GEN_OFFSET(_sync,char); - GEN_OFFSET(_use_keypad,char); - s_bool = "char"; - } else if (sizeof(bool) == sizeof(short)) { - GEN_OFFSET(_notimeout,short); - GEN_OFFSET(_clear,short); - GEN_OFFSET(_leaveok,short); - GEN_OFFSET(_scroll,short); - GEN_OFFSET(_idlok,short); - GEN_OFFSET(_idcok,short); - GEN_OFFSET(_immed,short); - GEN_OFFSET(_sync,short); - GEN_OFFSET(_use_keypad,short); - s_bool = "short"; - } else if (sizeof(bool) == sizeof(int)) { - GEN_OFFSET(_notimeout,int); - GEN_OFFSET(_clear,int); - GEN_OFFSET(_leaveok,int); - GEN_OFFSET(_scroll,int); - GEN_OFFSET(_idlok,int); - GEN_OFFSET(_idcok,int); - GEN_OFFSET(_immed,int); - GEN_OFFSET(_sync,int); - GEN_OFFSET(_use_keypad,int); - s_bool = "int"; - } + const char *s_bool = ""; + + GEN_OFFSET(_maxy, short); + GEN_OFFSET(_maxx, short); + GEN_OFFSET(_begy, short); + GEN_OFFSET(_begx, short); + GEN_OFFSET(_cury, short); + GEN_OFFSET(_curx, short); + GEN_OFFSET(_yoffset, short); + GEN_OFFSET(_pary, int); + GEN_OFFSET(_parx, int); + if (sizeof(bool) == sizeof(char)) + { + GEN_OFFSET(_notimeout, char); + GEN_OFFSET(_clear, char); + GEN_OFFSET(_leaveok, char); + GEN_OFFSET(_scroll, char); + GEN_OFFSET(_idlok, char); + GEN_OFFSET(_idcok, char); + GEN_OFFSET(_immed, char); + GEN_OFFSET(_sync, char); + GEN_OFFSET(_use_keypad, char); + + s_bool = "char"; + } + else if (sizeof(bool) == sizeof(short)) + { + GEN_OFFSET(_notimeout, short); + GEN_OFFSET(_clear, short); + GEN_OFFSET(_leaveok, short); + GEN_OFFSET(_scroll, short); + GEN_OFFSET(_idlok, short); + GEN_OFFSET(_idcok, short); + GEN_OFFSET(_immed, short); + GEN_OFFSET(_sync, short); + GEN_OFFSET(_use_keypad, short); + + s_bool = "short"; + } + else if (sizeof(bool) == sizeof(int)) + { + GEN_OFFSET(_notimeout, int); + GEN_OFFSET(_clear, int); + GEN_OFFSET(_leaveok, int); + GEN_OFFSET(_scroll, int); + GEN_OFFSET(_idlok, int); + GEN_OFFSET(_idcok, int); + GEN_OFFSET(_immed, int); + GEN_OFFSET(_sync, int); + GEN_OFFSET(_use_keypad, int); + + s_bool = "int"; + } printf(" Sizeof%-*s : constant Natural := %2ld; -- %s\n", - 12, "_bool", (long) sizeof(bool),"bool"); + 12, "_bool", (long)sizeof(bool), "bool"); + /* In ncurses _maxy and _maxx needs an offset for the "public" * value */ printf(" Offset%-*s : constant Natural := %2d; -- %s\n", - 12, "_XY",1,"int"); + 12, "_XY", 1, "int"); printf("\n"); - printf(" type Curses_Bool is mod 2 ** Interfaces.C.%s'Size;\n",s_bool); + printf(" type Curses_Bool is mod 2 ** Interfaces.C.%s'Size;\n", s_bool); } /* @@ -1213,7 +1269,8 @@ gen_offsets(void) * The second character then denotes the specific output that should be * generated for the selected facility. */ -int main(int argc, char *argv[]) +int +main(int argc, char *argv[]) { int x = 0x12345678; char *s = (char *)&x; @@ -1221,216 +1278,226 @@ int main(int argc, char *argv[]) if (*s == 0x78) little_endian = 1; - if (argc!=4) + if (argc != 4) exit(1); model = *++argv; - switch(argv[1][0]) + switch (argv[1][0]) { - /* ---------------------------------------------------------------*/ - case 'B': /* The Base facility */ - switch(argv[2][0]) + /* --------------------------------------------------------------- */ + case 'B': /* The Base facility */ + switch (argv[2][0]) { - case 'A': /* chtype translation into Ada95 record type */ + case 'A': /* chtype translation into Ada95 record type */ gen_attr_set("Character_Attribute_Set"); break; - case 'K': /* translation of keycodes */ + case 'K': /* translation of keycodes */ gen_keydefs(0); break; - case 'B': /* write some initial comment lines */ + case 'B': /* write some initial comment lines */ basedefs(); break; - case 'C': /* generate color constants */ + case 'C': /* generate color constants */ gen_color(); break; - case 'D': /* generate displacements of fields in WINDOW struct. */ + case 'D': /* generate displacements of fields in WINDOW struct. */ gen_offsets(); break; - case 'E': /* generate Mouse Event codes */ + case 'E': /* generate Mouse Event codes */ gen_mouse_events(); break; - case 'M': /* generate constants for the ACS characters */ + case 'M': /* generate constants for the ACS characters */ gen_acs(); break; - case 'L': /* generate the Linker_Options pragma */ + case 'L': /* generate the Linker_Options pragma */ gen_linkopts(); break; - case 'O': /* generate definitions of the old key code names */ + case 'O': /* generate definitions of the old key code names */ gen_keydefs(1); break; - case 'R': /* generate representation clause for Attributed character */ + case 'R': /* generate representation clause for Attributed character */ gen_chtype_rep("Attributed_Character"); break; - case 'V': /* generate version info */ + case 'V': /* generate version info */ gen_version_info(); break; - case 'T': /* generate the Trace info */ + case 'T': /* generate the Trace info */ gen_trace("Trace_Attribute_Set"); break; default: break; } break; - /* ---------------------------------------------------------------*/ - case 'M': /* The Menu facility */ - switch(argv[2][0]) + /* --------------------------------------------------------------- */ + case 'M': /* The Menu facility */ + switch (argv[2][0]) { - case 'R': /* generate representation clause for Menu_Option_Set */ + case 'R': /* generate representation clause for Menu_Option_Set */ gen_menu_opt_rep("Menu_Option_Set"); break; - case 'B': /* write some initial comment lines */ + case 'B': /* write some initial comment lines */ menu_basedefs(); break; - case 'L': /* generate the Linker_Options pragma */ + case 'L': /* generate the Linker_Options pragma */ gen_menu_linkopts(); break; - case 'I': /* generate representation clause for Item_Option_Set */ + case 'I': /* generate representation clause for Item_Option_Set */ gen_item_opt_rep("Item_Option_Set"); break; default: break; } break; - /* ---------------------------------------------------------------*/ - case 'F': /* The Form facility */ - switch(argv[2][0]) + /* --------------------------------------------------------------- */ + case 'F': /* The Form facility */ + switch (argv[2][0]) { - case 'R': /* generate representation clause for Form_Option_Set */ + case 'R': /* generate representation clause for Form_Option_Set */ gen_form_opt_rep("Form_Option_Set"); break; - case 'B': /* write some initial comment lines */ + case 'B': /* write some initial comment lines */ form_basedefs(); break; - case 'L': /* generate the Linker_Options pragma */ + case 'L': /* generate the Linker_Options pragma */ gen_form_linkopts(); break; - case 'I': /* generate representation clause for Field_Option_Set */ + case 'I': /* generate representation clause for Field_Option_Set */ gen_field_opt_rep("Field_Option_Set"); break; default: break; } break; - /* ---------------------------------------------------------------*/ - case 'P': /* The Pointer(=Mouse) facility */ - switch(argv[2][0]) { - case 'B': /* write some initial comment lines */ + /* --------------------------------------------------------------- */ + case 'P': /* The Pointer(=Mouse) facility */ + switch (argv[2][0]) + { + case 'B': /* write some initial comment lines */ mouse_basedefs(); break; - case 'M': /* generate representation clause for Mouse_Event */ + case 'M': /* generate representation clause for Mouse_Event */ gen_mrep_rep("Mouse_Event"); break; - case 'L': /* generate the Linker_Options pragma */ + case 'L': /* generate the Linker_Options pragma */ gen_panel_linkopts(); break; default: break; } - break; - /* ---------------------------------------------------------------*/ - case 'E' : /* chtype size detection */ - switch(argv[2][0]) { - case 'C': + break; + /* --------------------------------------------------------------- */ + case 'E': /* chtype size detection */ + switch (argv[2][0]) { - const char* fmt = " type C_Chtype is new %s;\n"; - const char* afmt = " type C_AttrType is new %s;\n"; - - if (sizeof(chtype)==sizeof(int)) { - if (sizeof(int)==sizeof(long)) - printf(fmt,"C_ULong"); + case 'C': + { + const char *fmt = " type C_Chtype is new %s;\n"; + const char *afmt = " type C_AttrType is new %s;\n"; + + if (sizeof(chtype) == sizeof(int)) + { + if (sizeof(int) == sizeof(long)) + printf(fmt, "C_ULong"); + + else + printf(fmt, "C_UInt"); + } + else if (sizeof(chtype) == sizeof(long)) + { + printf(fmt, "C_ULong"); + } else - printf(fmt,"C_UInt"); - } - else if (sizeof(chtype)==sizeof(long)) { - printf(fmt,"C_ULong"); - } - else - printf("Error\n"); - - if (sizeof(attr_t)==sizeof(int)) { - if (sizeof(int)==sizeof(long)) - printf(afmt,"C_ULong"); + printf("Error\n"); + + if (sizeof(attr_t) == sizeof(int)) + { + if (sizeof(int) == sizeof(long)) + printf(afmt, "C_ULong"); + + else + printf(afmt, "C_UInt"); + } + else if (sizeof(attr_t) == sizeof(long)) + { + printf(afmt, "C_ULong"); + } else - printf(afmt,"C_UInt"); - } - else if (sizeof(attr_t)==sizeof(long)) { - printf(afmt,"C_ULong"); - } - else - printf("Error\n"); + printf("Error\n"); - printf("define(`CF_CURSES_OK',`%d')",OK); - printf("define(`CF_CURSES_ERR',`%d')",ERR); - printf("define(`CF_CURSES_TRUE',`%d')",TRUE); - printf("define(`CF_CURSES_FALSE',`%d')",FALSE); - } - break; - case 'E': - { - char* buf = (char*)malloc(2048); - char* p = buf; - int etimin = E_OK; - int etimax = E_OK; - if (p) { - p += eti_gen(p, E_OK, "Ok", &etimin, &etimax); - p += eti_gen(p, E_SYSTEM_ERROR,"System_Error", &etimin, &etimax); - p += eti_gen(p, E_BAD_ARGUMENT, "Bad_Argument", &etimin, &etimax); - p += eti_gen(p, E_POSTED, "Posted", &etimin, &etimax); - p += eti_gen(p, E_CONNECTED, "Connected", &etimin, &etimax); - p += eti_gen(p, E_BAD_STATE, "Bad_State", &etimin, &etimax); - p += eti_gen(p, E_NO_ROOM, "No_Room", &etimin, &etimax); - p += eti_gen(p, E_NOT_POSTED, "Not_Posted", &etimin, &etimax); - p += eti_gen(p, E_UNKNOWN_COMMAND, - "Unknown_Command", &etimin, &etimax); - p += eti_gen(p, E_NO_MATCH, "No_Match", &etimin, &etimax); - p += eti_gen(p, E_NOT_SELECTABLE, - "Not_Selectable", &etimin, &etimax); - p += eti_gen(p, E_NOT_CONNECTED, - "Not_Connected", &etimin, &etimax); - p += eti_gen(p, E_REQUEST_DENIED, - "Request_Denied", &etimin, &etimax); - p += eti_gen(p, E_INVALID_FIELD, - "Invalid_Field", &etimin, &etimax); - p += eti_gen(p, E_CURRENT, - "Current", &etimin, &etimax); + printf("define(`CF_CURSES_OK',`%d')", OK); + printf("define(`CF_CURSES_ERR',`%d')", ERR); + printf("define(`CF_CURSES_TRUE',`%d')", TRUE); + printf("define(`CF_CURSES_FALSE',`%d')", FALSE); + } + break; + case 'E': + { + char *buf = (char *)malloc(2048); + char *p = buf; + int etimin = E_OK; + int etimax = E_OK; + + if (p) + { + p += eti_gen(p, E_OK, "Ok", &etimin, &etimax); + p += eti_gen(p, E_SYSTEM_ERROR, "System_Error", &etimin, &etimax); + p += eti_gen(p, E_BAD_ARGUMENT, "Bad_Argument", &etimin, &etimax); + p += eti_gen(p, E_POSTED, "Posted", &etimin, &etimax); + p += eti_gen(p, E_CONNECTED, "Connected", &etimin, &etimax); + p += eti_gen(p, E_BAD_STATE, "Bad_State", &etimin, &etimax); + p += eti_gen(p, E_NO_ROOM, "No_Room", &etimin, &etimax); + p += eti_gen(p, E_NOT_POSTED, "Not_Posted", &etimin, &etimax); + p += eti_gen(p, E_UNKNOWN_COMMAND, + "Unknown_Command", &etimin, &etimax); + p += eti_gen(p, E_NO_MATCH, "No_Match", &etimin, &etimax); + p += eti_gen(p, E_NOT_SELECTABLE, + "Not_Selectable", &etimin, &etimax); + p += eti_gen(p, E_NOT_CONNECTED, + "Not_Connected", &etimin, &etimax); + p += eti_gen(p, E_REQUEST_DENIED, + "Request_Denied", &etimin, &etimax); + p += eti_gen(p, E_INVALID_FIELD, + "Invalid_Field", &etimin, &etimax); + p += eti_gen(p, E_CURRENT, + "Current", &etimin, &etimax); + } + printf(" subtype Eti_Error is C_Int range %d .. %d;\n\n", + etimin, etimax); + printf(buf); } - printf(" subtype Eti_Error is C_Int range %d .. %d;\n\n", - etimin,etimax); - printf(buf); + break; + default: + break; } - break; - default: - break; - } break; - /* ---------------------------------------------------------------*/ - case 'V' : /* plain version dump */ + /* --------------------------------------------------------------- */ + case 'V': /* plain version dump */ { - switch(argv[2][0]) { - case '1': /* major version */ + switch (argv[2][0]) + { + case '1': /* major version */ #ifdef NCURSES_VERSION_MAJOR - printf("%d",NCURSES_VERSION_MAJOR); + printf("%d", NCURSES_VERSION_MAJOR); #endif - break; - case '2': /* minor version */ + break; + case '2': /* minor version */ #ifdef NCURSES_VERSION_MINOR - printf("%d",NCURSES_VERSION_MINOR); + printf("%d", NCURSES_VERSION_MINOR); #endif - break; - case '3': /* patch level */ + break; + case '3': /* patch level */ #ifdef NCURSES_VERSION_PATCH - printf("%d",NCURSES_VERSION_PATCH); + printf("%d", NCURSES_VERSION_PATCH); #endif - break; - default: - break; - } + break; + default: + break; + } } break; - /* ---------------------------------------------------------------*/ + /* --------------------------------------------------------------- */ default: break; } return 0; } - diff --git a/Ada95/gen/terminal_interface-curses-mouse.ads.m4 b/Ada95/gen/terminal_interface-curses-mouse.ads.m4 index bb9516f7..5ca079cf 100644 --- a/Ada95/gen/terminal_interface-curses-mouse.ads.m4 +++ b/Ada95/gen/terminal_interface-curses-mouse.ads.m4 @@ -10,7 +10,7 @@ include(M4MACRO)dnl -- S P E C -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -38,7 +38,8 @@ include(M4MACRO)dnl ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.22 $ +-- $Revision: 1.25 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ include(`Mouse_Base_Defs') @@ -169,7 +170,6 @@ private Bstate : Event_Mask; end record; pragma Convention (C, Mouse_Event); - pragma Pack (Mouse_Event); include(`Mouse_Event_Rep') Generation_Bit_Order : constant System.Bit_Order := System.M4_BIT_ORDER; diff --git a/Ada95/gen/terminal_interface-curses.ads.m4 b/Ada95/gen/terminal_interface-curses.ads.m4 index a8e9795b..32922f1e 100644 --- a/Ada95/gen/terminal_interface-curses.ads.m4 +++ b/Ada95/gen/terminal_interface-curses.ads.m4 @@ -9,7 +9,7 @@ include(M4MACRO)---------------------------------------------------------------- -- S P E C -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -37,7 +37,8 @@ include(M4MACRO)---------------------------------------------------------------- ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.31 $ +-- $Revision: 1.35 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ include(`Base_Defs') @@ -59,11 +60,12 @@ include(`Version_Info') subtype Column_Count is Column_Position range 1 .. Column_Position'Last; -- Type to count columns. We do not allow null windows, so must be positive - type Key_Code is new Natural; + type Key_Code is new Integer; -- That is anything including real characters, special keys and logical -- request codes. - subtype Real_Key_Code is Key_Code range 0 .. M4_KEY_MAX; + -- FIXME: The "-1" should be Curses_Err + subtype Real_Key_Code is Key_Code range -1 .. M4_KEY_MAX; -- This are the codes that potentially represent a real keystroke. -- Not all codes may be possible on a specific terminal. To check the -- availability of a special key, the Has_Key function is provided. diff --git a/Ada95/samples/Makefile.in b/Ada95/samples/Makefile.in index 8c8dd72f..e88c119b 100644 --- a/Ada95/samples/Makefile.in +++ b/Ada95/samples/Makefile.in @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -28,8 +28,7 @@ # # Author: Juergen Pfeifer, 1996 # -# Version Control -# $Revision: 1.30 $ +# $Id: Makefile.in,v 1.33 2005/05/28 16:11:01 tom Exp $ # .SUFFIXES: @@ -84,7 +83,7 @@ ALIB = @cf_ada_package@ ABASE = $(ALIB)-curses CARGS =-cargs $(ADAFLAGS) -LARGS =-largs -L../../lib @TEST_ARGS@ $(LD_FLAGS) -lAdaCurses @EXTRA_LIBS@ +LARGS =-largs @TEST_ARG2@ $(LD_FLAGS) -lAdaCurses PROGS = tour rain ncurses @@ -111,19 +110,19 @@ NCURSES_OBJS = ncurses.o ncurses2-getch_test.o \ all :: tour$x rain$x ncurses$x - @ + @echo made $@ sources : - @ + @echo made $@ libs \ install \ install.libs :: - @ + @echo made $@ uninstall \ uninstall.libs :: - @ + @echo made $@ ncurses$x : $(ADAMAKE) $(ADAMAKEFLAGS) ncurses $(CARGS) $(LARGS) @@ -138,7 +137,7 @@ rain$x : $(ADAMAKE) $(ADAMAKEFLAGS) rain $(CARGS) $(LARGS) mostlyclean: - @ + @echo made $@ clean :: mostlyclean rm -f *.o *.ali b_t*.* *.s $(PROGS) a.out core b_*_test.c *.xr[bs] \ @@ -148,6 +147,4 @@ distclean :: clean rm -f Makefile realclean :: distclean - @ - - + @echo made $@ diff --git a/Ada95/samples/ncurses2-acs_and_scroll.adb b/Ada95/samples/ncurses2-acs_and_scroll.adb index 65c2939a..66384cae 100644 --- a/Ada95/samples/ncurses2-acs_and_scroll.adb +++ b/Ada95/samples/ncurses2-acs_and_scroll.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.1 $ +-- $Revision: 1.6 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ -- Windows and scrolling tester. @@ -224,8 +225,8 @@ procedure ncurses2.acs_and_scroll is ); buf : Bounded_String; - do_keypad : Boolean := HaveKeyPad (curpw); - do_scroll : Boolean := HaveScroll (curpw); + do_keypad : constant Boolean := HaveKeyPad (curpw); + do_scroll : constant Boolean := HaveScroll (curpw); pos : Natural; @@ -331,8 +332,8 @@ procedure ncurses2.acs_and_scroll is res : pair; i : Line_Position := 0; j : Column_Position := 0; - si : Line_Position := lri - uli + 1; - sj : Column_Position := lrj - ulj + 1; + si : constant Line_Position := lri - uli + 1; + sj : constant Column_Position := lrj - ulj + 1; begin res.y := uli; res.x := ulj; @@ -714,7 +715,7 @@ begin Allow_Scrolling (Mode => True); - End_Mouse; + End_Mouse (Mask2); Set_Raw_Mode (SwitchOn => True); Erase; End_Windows; diff --git a/Ada95/samples/ncurses2-acs_display.adb b/Ada95/samples/ncurses2-acs_display.adb index ab072132..1ed4c643 100644 --- a/Ada95/samples/ncurses2-acs_display.adb +++ b/Ada95/samples/ncurses2-acs_display.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.1 $ +-- $Revision: 1.4 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; @@ -57,8 +58,8 @@ procedure ncurses2.acs_display is procedure show_upper_chars (first : Integer) is - C1 : Boolean := (first = 128); - last : Integer := first + 31; + C1 : constant Boolean := (first = 128); + last : constant Integer := first + 31; package p is new ncurses2.genericPuts (200); use p; use p.BS; @@ -91,9 +92,11 @@ procedure ncurses2.acs_display is for code in first .. last loop declare - row : Line_Position := Line_Position (4 + ((code - first) mod 16)); - col : Column_Position := Column_Position (((code - first) / 16) * - Integer (Columns) / 2); + row : constant Line_Position + := Line_Position (4 + ((code - first) mod 16)); + col : constant Column_Position + := Column_Position (((code - first) / 16) * + Integer (Columns) / 2); tmp3 : String (1 .. 3); tmpx : String (1 .. Integer (Columns / 4)); reply : Key_Code; @@ -129,8 +132,8 @@ procedure ncurses2.acs_display is code : Attributed_Character) return Integer is height : constant Integer := 16; - row : Line_Position := Line_Position (4 + (N mod height)); - col : Column_Position := Column_Position ((N / height) * + row : constant Line_Position := Line_Position (4 + (N mod height)); + col : constant Column_Position := Column_Position ((N / height) * Integer (Columns) / 2); tmpx : String (1 .. Integer (Columns) / 3); begin diff --git a/Ada95/samples/ncurses2-attr_test.adb b/Ada95/samples/ncurses2-attr_test.adb index d852bb7f..bb776919 100644 --- a/Ada95/samples/ncurses2-attr_test.adb +++ b/Ada95/samples/ncurses2-attr_test.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2001,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; @@ -222,7 +223,7 @@ procedure ncurses2.attr_test is elsif ncv > 0 and has_A_COLOR (Get_Background) then declare Color_Supported_Attributes : - Character_Attribute_Set := make_record (ncv); + constant Character_Attribute_Set := make_record (ncv); begin if intersect (Color_Supported_Attributes, attr) then Add (Str => " (NCV) "); @@ -236,7 +237,7 @@ procedure ncurses2.attr_test is procedure attr_getc (skip : out Integer; fg, bg : in out Color_Number; result : out Boolean) is - ch : Key_Code := Getchar; + ch : constant Key_Code := Getchar; nc : constant Color_Number := Color_Number (Number_Of_Colors); curscr : Window; pragma Import (C, curscr, "curscr"); @@ -293,7 +294,7 @@ begin -- row := 2; -- weird, row is set to 0 without this. -- TODO delete the above line, it was a gdb quirk that confused me if Has_Colors then declare - pair : Color_Pair := + pair : constant Color_Pair := Color_Pair (fg * Color_Number (Number_Of_Colors) + bg); begin -- Go though each color pair. Assume that the number of diff --git a/Ada95/samples/ncurses2-color_edit.adb b/Ada95/samples/ncurses2-color_edit.adb index ac14628f..a678ccf4 100644 --- a/Ada95/samples/ncurses2-color_edit.adb +++ b/Ada95/samples/ncurses2-color_edit.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.1 $ +-- $Revision: 1.4 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; @@ -101,7 +102,6 @@ procedure ncurses2.color_edit is current : Color_Number := 0; field : RGB_Enum := Redx; this_c : Key_Code := 0; - last_c : Key_Code; begin Refresh; @@ -185,7 +185,6 @@ begin Move_Cursor (Line => 2 + Line_Position (current), Column => 0); - last_c := this_c; this_c := Getchar; if Is_Digit (this_c) then value := 0; diff --git a/Ada95/samples/ncurses2-demo_forms.adb b/Ada95/samples/ncurses2-demo_forms.adb index 7f4cefc9..2cc99dae 100644 --- a/Ada95/samples/ncurses2-demo_forms.adb +++ b/Ada95/samples/ncurses2-demo_forms.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.1 $ +-- $Revision: 1.4 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; @@ -282,7 +283,7 @@ procedure ncurses2.demo_forms is ); c : Key_Code := Getchar (w); - me : Field := Current (f); + me : constant Field := Current (f); begin if c = Character'Pos (']') mod 16#20# then @@ -314,7 +315,7 @@ procedure ncurses2.demo_forms is end form_virtualize; function my_form_driver (f : Form; c : Key_Code) return Boolean is - flag : Driver_Result := Driver (f, F_Validate_Field); + flag : constant Driver_Result := Driver (f, F_Validate_Field); begin if c = Form_Request_Code'Last + 1 and flag = Form_Ok then @@ -328,7 +329,7 @@ procedure ncurses2.demo_forms is function make_label (frow : Line_Position; fcol : Column_Position; label : String) return Field is - f : Field := Create (1, label'Length, frow, fcol, 0, 0); + f : constant Field := Create (1, label'Length, frow, fcol, 0, 0); o : Field_Option_Set := Get_Options (f); begin if f /= Null_Field then diff --git a/Ada95/samples/ncurses2-demo_pad.adb b/Ada95/samples/ncurses2-demo_pad.adb index 1b17cbd5..399a2f4b 100644 --- a/Ada95/samples/ncurses2-demo_pad.adb +++ b/Ada95/samples/ncurses2-demo_pad.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.1 $ +-- $Revision: 1.5 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; @@ -104,7 +105,7 @@ procedure ncurses2.demo_pad is package myP is new System.Address_To_Access_Conversions (timeval); use myP; - t : Object_Pointer := new timeval; + t : constant Object_Pointer := new timeval; function gettimeofday (TP : System.Storage_Elements.Integer_Address; @@ -116,8 +117,13 @@ procedure ncurses2.demo_pad is (myP.To_Address (t)), System.Storage_Elements.To_Integer (myP.To_Address (null))); - retval.seconds := Integer (t.tv_sec); - retval.microseconds := Integer (t.tv_usec); + if tmp < 0 then + retval.seconds := 0; + retval.microseconds := 0; + else + retval.seconds := Integer (t.tv_sec); + retval.microseconds := Integer (t.tv_usec); + end if; return retval; end gettime; @@ -202,7 +208,7 @@ procedure ncurses2.demo_pad is "Use <,> (or h,l) to grow/shrink the panner horizontally. "); legendsize : constant := 4; - n : Integer := legendsize - Integer (Lines - line); + n : constant Integer := legendsize - Integer (Lines - line); begin if line < Lines and n >= 0 then Move_Cursor (Line => line, Column => 0); @@ -216,9 +222,10 @@ procedure ncurses2.demo_pad is end panner_legend; procedure panner_legend (line : Line_Position) is - tmp : Boolean; begin - tmp := panner_legend (line); + if not panner_legend (line) then + Beep; + end if; end panner_legend; procedure panner_h_cleanup (from_y : Line_Position; @@ -435,8 +442,8 @@ procedure ncurses2.demo_pad is when Key_Cursor_Right => -- pan rightwards -- if (basex + portx - (pymax > porty) < pxmax) - if (basex + portx - - Column_Position (greater (pymax, porty)) < pxmax) then + if basex + portx - + Column_Position (greater (pymax, porty)) < pxmax then -- if basex + portx < pxmax or -- (pymax > porty and basex + portx - 1 < pxmax) then basex := basex + 1; @@ -455,8 +462,8 @@ procedure ncurses2.demo_pad is when Key_Cursor_Down => -- pan downwards -- same as if (basey + porty - (pxmax > portx) < pymax) - if (basey + porty - - Line_Position (greater (pxmax, portx)) < pymax) then + if basey + porty - + Line_Position (greater (pxmax, portx)) < pymax then -- if (basey + porty < pymax) or -- (pxmax > portx and basey + porty - 1 < pymax) then basey := basey + 1; @@ -472,9 +479,10 @@ procedure ncurses2.demo_pad is when Character'Pos ('E') | Key_End | Key_Select => - basey := pymax - porty; - if basey < 0 then -- basey := max(basey, 0); + if pymax < porty then basey := 0; + else + basey := pymax - porty; end if; when others => @@ -500,7 +508,7 @@ procedure ncurses2.demo_pad is -- in C was ... pxmax > portx - 1 if scrollers and pxmax >= portx then declare - length : Column_Position := portx - top_x - 1; + length : constant Column_Position := portx - top_x - 1; lowend, highend : Column_Position; begin -- Instead of using floats, I'll use integers only. @@ -527,7 +535,7 @@ procedure ncurses2.demo_pad is if scrollers and pymax >= porty then declare - length : Line_Position := porty - top_y - 1; + length : constant Line_Position := porty - top_y - 1; lowend, highend : Line_Position; begin lowend := top_y + (basey * length) / pymax; diff --git a/Ada95/samples/ncurses2-demo_panels.adb b/Ada95/samples/ncurses2-demo_panels.adb index 9988a9f1..6a0b6036 100644 --- a/Ada95/samples/ncurses2-demo_panels.adb +++ b/Ada95/samples/ncurses2-demo_panels.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.1 $ +-- $Revision: 1.4 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; @@ -115,10 +116,10 @@ procedure ncurses2.demo_panels (nap_mseci : Integer) is procedure wait_a_while (msec : Integer) is begin -- The C version had some #ifdef blocks here - if nap_msec = 1 then + if msec = 1 then Getchar; else - Nap_Milli_Seconds (nap_msec); + Nap_Milli_Seconds (msec); end if; end wait_a_while; @@ -137,8 +138,8 @@ procedure ncurses2.demo_panels (nap_mseci : Integer) is use PUD; procedure fill_panel (pan : Panel) is - win : Window := Panel_Window (pan); - num : Character := Get_User_Data (pan) (2); + win : constant Window := Panel_Window (pan); + num : constant Character := Get_User_Data (pan) (2); tmp6 : String (1 .. 6) := "-panx-"; maxy : Line_Count; maxx : Column_Count; @@ -158,7 +159,7 @@ procedure ncurses2.demo_panels (nap_mseci : Integer) is end loop; end fill_panel; - modstr : array (0 .. 5) of String (1 .. 5) := + modstr : constant array (0 .. 5) of String (1 .. 5) := ("test ", "TEST ", "(**) ", @@ -185,11 +186,11 @@ begin for y in 0 .. 4 loop declare p1, p2, p3, p4, p5 : Panel; - U1 : User_Data_Access := new User_Data'("p1"); - U2 : User_Data_Access := new User_Data'("p2"); - U3 : User_Data_Access := new User_Data'("p3"); - U4 : User_Data_Access := new User_Data'("p4"); - U5 : User_Data_Access := new User_Data'("p5"); + U1 : constant User_Data_Access := new User_Data'("p1"); + U2 : constant User_Data_Access := new User_Data'("p2"); + U3 : constant User_Data_Access := new User_Data'("p3"); + U4 : constant User_Data_Access := new User_Data'("p4"); + U5 : constant User_Data_Access := new User_Data'("p5"); begin p1 := mkpanel (Red, Lines / 2 - 2, Columns / 8 + 1, 0, 0); @@ -295,8 +296,8 @@ begin for itmp in 0 .. 5 loop declare - w4 : Window := Panel_Window (p4); - w5 : Window := Panel_Window (p5); + w4 : constant Window := Panel_Window (p4); + w5 : constant Window := Panel_Window (p5); begin saywhat ("m4; press any key to continue"); @@ -364,7 +365,7 @@ begin rmpanel (p5); pflush; wait_a_while (nap_msec); - if (nap_msec = 1) then + if nap_msec = 1 then exit; else nap_msec := 100; diff --git a/Ada95/samples/ncurses2-getch_test.adb b/Ada95/samples/ncurses2-getch_test.adb index d786d496..57ceb961 100644 --- a/Ada95/samples/ncurses2-getch_test.adb +++ b/Ada95/samples/ncurses2-getch_test.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.1 $ +-- $Revision: 1.5 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ -- Character input test @@ -96,6 +97,7 @@ procedure ncurses2.getch_test is y : Line_Position; tmpx : Integer; incount : Integer := 0; + begin Refresh; tmp2 := Start_Mouse (All_Events); @@ -135,7 +137,7 @@ begin Add (Ch => newl); elsif c > 16#80# then -- TODO fix, use constant if possible declare - c2 : Character := Character'Val (c mod 16#80#); + c2 : constant Character := Character'Val (c mod 16#80#); begin if Ada.Characters.Handling.Is_Graphic (c2) then Add (Str => "M-"); @@ -150,7 +152,7 @@ begin Add (Ch => newl); end; else declare - c2 : Character := Character'Val (c mod 16#80#); + c2 : constant Character := Character'Val (c mod 16#80#); begin if Ada.Characters.Handling.Is_Graphic (c2) then Add (Ch => c2); @@ -242,7 +244,7 @@ begin end loop; end loop; - tmp2 := Start_Mouse (No_Events); + End_Mouse (tmp2); Set_Timeout_Mode (Mode => Blocking, Amount => 0); -- amount is ignored Set_Raw_Mode (SwitchOn => False); Set_NL_Mode (SwitchOn => True); diff --git a/Ada95/samples/ncurses2-getopt.adb b/Ada95/samples/ncurses2-getopt.adb index 176073b0..5719b1b0 100644 --- a/Ada95/samples/ncurses2-getopt.adb +++ b/Ada95/samples/ncurses2-getopt.adb @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.3 $ +-- $Revision: 1.6 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ -- A simplified version of the GNU getopt function @@ -47,8 +48,6 @@ with Ada.Text_IO; use Ada.Text_IO; package body ncurses2.getopt is - optopt : Character := '?'; - nextchar : Natural := 0; -- Ncurses doesn't use the non option elements so we are spared @@ -104,13 +103,12 @@ package body ncurses2.getopt is -- Look at and handle the next short option-character. declare c : Character := argv (optind) (nextchar); - temp : Natural := + temp : constant Natural := Ada.Strings.Fixed.Index (optstring, String'(1 => c)); begin if temp = 0 or c = ':' then Put_Line (Standard_Error, argv (optind) & ": invalid option -- " & c); - optopt := c; c := '?'; return; end if; @@ -134,7 +132,6 @@ package body ncurses2.getopt is Put_Line (Standard_Error, argv (optind) & ": option requires an argument -- " & c); - optopt := c; if optstring (1) = ':' then c := ':'; else diff --git a/Ada95/samples/ncurses2-m.adb b/Ada95/samples/ncurses2-m.adb index 214c735b..7b49fc52 100644 --- a/Ada95/samples/ncurses2-m.adb +++ b/Ada95/samples/ncurses2-m.adb @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.2 $ +-- $Revision: 1.5 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ -- TODO use Default_Character where appropriate @@ -332,7 +333,7 @@ package body ncurses2.m is default_colors := True; when 'e' => myio.Get (optarg.all, tmpi, length); - if Integer (tmpi) > 3 then + if tmpi > 3 then usage; return 1; end if; diff --git a/Ada95/samples/ncurses2-menu_test.adb b/Ada95/samples/ncurses2-menu_test.adb index 0b96315e..297940da 100644 --- a/Ada95/samples/ncurses2-menu_test.adb +++ b/Ada95/samples/ncurses2-menu_test.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.1 $ +-- $Revision: 1.5 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; @@ -92,6 +93,7 @@ procedure ncurses2.menu_test is items_a : Item_Array_Access := new Item_Array (1 .. animals'Last + 1); tmp : Event_Mask; + procedure xAdd (l : Line_Position; c : Column_Position; s : String) is begin Add (Line => l, Column => c, Str => s); @@ -161,5 +163,5 @@ begin Delete (m); - tmp := Start_Mouse (No_Events); + End_Mouse (tmp); end ncurses2.menu_test; diff --git a/Ada95/samples/ncurses2-overlap_test.adb b/Ada95/samples/ncurses2-overlap_test.adb index 5d3fc6d5..37e8d4c2 100644 --- a/Ada95/samples/ncurses2-overlap_test.adb +++ b/Ada95/samples/ncurses2-overlap_test.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.1 $ +-- $Revision: 1.4 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; @@ -71,8 +72,8 @@ procedure ncurses2.overlap_test is Get_Size (win, y1, x1); for y in 0 .. y1 - 1 loop for x in 0 .. x1 - 1 loop - if (((x > (x1 - 1) / 3) and (x <= (2 * (x1 - 1)) / 3)) - or (((y > (y1 - 1) / 3) and (y <= (2 * (y1 - 1)) / 3)))) then + if ((x > (x1 - 1) / 3) and (x <= (2 * (x1 - 1)) / 3)) + or (((y > (y1 - 1) / 3) and (y <= (2 * (y1 - 1)) / 3))) then Move_Cursor (win, y, x); Add (win, Ch => ch); end if; diff --git a/Ada95/samples/ncurses2-slk_test.adb b/Ada95/samples/ncurses2-slk_test.adb index 77ca2843..de4edb57 100644 --- a/Ada95/samples/ncurses2-slk_test.adb +++ b/Ada95/samples/ncurses2-slk_test.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.1 $ +-- $Revision: 1.6 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with ncurses2.util; use ncurses2.util; @@ -63,10 +64,13 @@ procedure ncurses2.slk_test is Len : int) return int; pragma Import (C, Wgetnstr, "wgetnstr"); - Txt : char_array (0 .. 10); + -- FIXME: how to construct "(Len > 0) ? Len : 80"? + Ask : constant Interfaces.C.size_t := Interfaces.C.size_t'Val (Len + 80); + Txt : char_array (0 .. Ask); + begin Txt (0) := Interfaces.C.char'First; - if Wgetnstr (Win, Txt, 8) = Curses_Err then + if Wgetnstr (Win, Txt, Txt'Length) = Curses_Err then raise Curses_Exception; end if; Str := To_Unbounded_String (To_Ada (Txt, True)); diff --git a/Ada95/samples/ncurses2-util.adb b/Ada95/samples/ncurses2-util.adb index 907dcef9..3e88ea8b 100644 --- a/Ada95/samples/ncurses2-util.adb +++ b/Ada95/samples/ncurses2-util.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Eugene V. Melaragno 2000 -- Version Control --- $Revision: 1.1 $ +-- $Revision: 1.5 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; @@ -104,9 +105,10 @@ package body ncurses2.util is end Getchar; procedure Getchar (win : Window := Standard_Window) is - x : Key_Code; begin - x := Getchar (win); + if Getchar (win) < 0 then + Beep; + end if; end Getchar; diff --git a/Ada95/samples/sample-curses_demo.adb b/Ada95/samples/sample-curses_demo.adb index aab45c29..700da768 100644 --- a/Ada95/samples/sample-curses_demo.adb +++ b/Ada95/samples/sample-curses_demo.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.12 $ +-- $Revision: 1.15 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; @@ -74,7 +75,7 @@ package body Sample.Curses_Demo is New_Item ("Mouse Demo"), Null_Item); M : Menu := New_Menu (Itm); - U1 : User_Data_Access := new User_Data'(4711); + U1 : constant User_Data_Access := new User_Data'(4711); U2 : User_Data_Access; function My_Driver (M : Menu; diff --git a/Ada95/samples/sample-explanation.adb b/Ada95/samples/sample-explanation.adb index 705e02da..66efb0db 100644 --- a/Ada95/samples/sample-explanation.adb +++ b/Ada95/samples/sample-explanation.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.15 $ +-- $Revision: 1.18 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ -- Poor mans help system. This scans a sequential file for key lines and @@ -57,7 +58,7 @@ package body Sample.Explanation is Help_Keys : constant String := "HELPKEYS"; In_Help : constant String := "INHELP"; - File_Name : String := "explain.msg"; + File_Name : constant String := "explain.msg"; F : File_Type; type Help_Line; @@ -116,7 +117,7 @@ package body Sample.Explanation is Current : Help_Line_Access; Top_Line : Help_Line_Access; - Has_More : Boolean; + Has_More : Boolean := True; procedure Unknown_Key is diff --git a/Ada95/samples/sample-form_demo-aux.adb b/Ada95/samples/sample-form_demo-aux.adb index 712fb5d1..81c97ad0 100644 --- a/Ada95/samples/sample-form_demo-aux.adb +++ b/Ada95/samples/sample-form_demo-aux.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.13 $ +-- $Revision: 1.16 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Characters.Latin_1; use Ada.Characters.Latin_1; @@ -198,7 +199,7 @@ package body Sample.Form_Demo.Aux is Text : String) return Field is Fld : Field; - C : Column_Count := Column_Count (Text'Length); + C : constant Column_Count := Column_Count (Text'Length); begin Fld := New_Field (1, C, Top, Left); Set_Buffer (Fld, 0, Text); @@ -215,7 +216,7 @@ package body Sample.Form_Demo.Aux is Left : Column_Position; Off_Screen : Natural := 0) return Field is - Fld : Field := New_Field (Height, Width, Top, Left, Off_Screen); + Fld : constant Field := New_Field (Height, Width, Top, Left, Off_Screen); begin if Has_Colors then Set_Foreground (Fld => Fld, Color => Form_Fore_Color); @@ -231,6 +232,9 @@ package body Sample.Form_Demo.Aux is P : Panel) return Boolean is begin + if P = Null_Panel then + raise Panel_Exception; + end if; if K in User_Key_Code'Range and then K = QUIT then if Driver (F, F_Validate_Field) = Form_Ok then return True; diff --git a/Ada95/samples/sample-form_demo-handler.adb b/Ada95/samples/sample-form_demo-handler.adb index 667df4dd..afe86f71 100644 --- a/Ada95/samples/sample-form_demo-handler.adb +++ b/Ada95/samples/sample-form_demo-handler.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.10 $ +-- $Revision: 1.13 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Sample.Form_Demo.Aux; @@ -72,7 +73,7 @@ package body Sample.Form_Demo.Handler is end if; loop declare - K : Key_Code := Aux.Get_Request (F, Pan, Handle_CRLF); + K : constant Key_Code := Aux.Get_Request (F, Pan, Handle_CRLF); R : Driver_Result; begin if (K = 13 or else K = 10) and then not Handle_CRLF then diff --git a/Ada95/samples/sample-form_demo.adb b/Ada95/samples/sample-form_demo.adb index c5df36f7..df138139 100644 --- a/Ada95/samples/sample-form_demo.adb +++ b/Ada95/samples/sample-form_demo.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,13 +35,13 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.10 $ +-- $Revision: 1.13 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; with Terminal_Interface.Curses.Forms.Field_User_Data; -with Terminal_Interface.Curses.Forms.Form_User_Data; with Sample.My_Field_Type; use Sample.My_Field_Type; with Sample.Explanation; use Sample.Explanation; with Sample.Form_Demo.Aux; use Sample.Form_Demo.Aux; @@ -66,10 +66,6 @@ package body Sample.Form_Demo is Terminal_Interface.Curses.Forms.Field_User_Data (User_Data, User_Access); - package Frm_U is new - Terminal_Interface.Curses.Forms.Form_User_Data (User_Data, - User_Access); - type Weekday is (Sunday, Monday, Tuesday, Wednesday, Thursday, Friday, Saturday); diff --git a/Ada95/samples/sample-function_key_setting.adb b/Ada95/samples/sample-function_key_setting.adb index 9c7a31e8..e40e4a40 100644 --- a/Ada95/samples/sample-function_key_setting.adb +++ b/Ada95/samples/sample-function_key_setting.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.10 $ +-- $Revision: 1.13 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; @@ -97,7 +98,7 @@ package body Sample.Function_Key_Setting is P.Help := Active_Context; P.Notepad := Active_Notepad; -- The notepad must now vanish and the new notepad is empty. - if (P.Notepad /= Null_Panel) then + if P.Notepad /= Null_Panel then Hide (P.Notepad); Update_Panels; end if; diff --git a/Ada95/samples/sample-header_handler.adb b/Ada95/samples/sample-header_handler.adb index 2c51e941..b187f976 100644 --- a/Ada95/samples/sample-header_handler.adb +++ b/Ada95/samples/sample-header_handler.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.11 $ +-- $Revision: 1.14 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Calendar; use Ada.Calendar; @@ -111,12 +112,12 @@ package body Sample.Header_Handler is "November ", "December "); - Now : Time := Clock; - Sec : Integer := Integer (Seconds (Now)); - Hour : Integer := Sec / 3600; - Minute : Integer := (Sec - Hour * 3600) / 60; - Mon : Month_Number := Month (Now); - D : Day_Number := Day (Now); + Now : constant Time := Clock; + Sec : constant Integer := Integer (Seconds (Now)); + Hour : constant Integer := Sec / 3600; + Minute : constant Integer := (Sec - Hour * 3600) / 60; + Mon : constant Month_Number := Month (Now); + D : constant Day_Number := Day (Now); begin if Header_Window /= Null_Window then if Minute /= Display_Min or else Hour /= Display_Hour diff --git a/Ada95/samples/sample-keyboard_handler.adb b/Ada95/samples/sample-keyboard_handler.adb index 60043581..5629ea77 100644 --- a/Ada95/samples/sample-keyboard_handler.adb +++ b/Ada95/samples/sample-keyboard_handler.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.9 $ +-- $Revision: 1.12 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Strings; use Ada.Strings; @@ -95,6 +96,9 @@ package body Sample.Keyboard_Handler is is Ch : Character; begin + if P = Null_Panel then + raise Panel_Exception; + end if; if C in User_Key_Code'Range and then C = QUIT then if Driver (F, F_Validate_Field) = Form_Ok then K := Key_None; @@ -102,7 +106,7 @@ package body Sample.Keyboard_Handler is end if; elsif C in Normal_Key_Code'Range then Ch := Character'Val (C); - if (Ch = LF or else Ch = CR) then + if Ch = LF or else Ch = CR then if Driver (F, F_Validate_Field) = Form_Ok then declare Buffer : String (1 .. Positive (Columns - 11)); diff --git a/Ada95/samples/sample-menu_demo-handler.adb b/Ada95/samples/sample-menu_demo-handler.adb index 6098a250..18747e9f 100644 --- a/Ada95/samples/sample-menu_demo-handler.adb +++ b/Ada95/samples/sample-menu_demo-handler.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.12 $ +-- $Revision: 1.15 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Sample.Menu_Demo.Aux; @@ -75,7 +76,7 @@ package body Sample.Menu_Demo.Handler is loop declare K : Key_Code := Aux.Get_Request (M, Pan); - R : Driver_Result := Driver (M, K); + R : constant Driver_Result := Driver (M, K); begin case R is when Menu_Ok => null; diff --git a/Ada95/samples/sample-menu_demo.adb b/Ada95/samples/sample-menu_demo.adb index a0ebf695..261658f9 100644 --- a/Ada95/samples/sample-menu_demo.adb +++ b/Ada95/samples/sample-menu_demo.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.13 $ +-- $Revision: 1.17 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses; use Terminal_Interface.Curses; @@ -105,6 +106,12 @@ package body Sample.Menu_Demo is P : Panel) return Boolean is begin + if M = Null_Menu then + raise Menu_Exception; + end if; + if P = Null_Panel then + raise Panel_Exception; + end if; To_Change := No_Change; if K in User_Key_Code'Range then if K = QUIT then @@ -331,9 +338,9 @@ package body Sample.Menu_Demo is Null_Item); M : Menu := New_Menu (Itm); - U1 : User_Data_Access := new User_Data'(4711); + U1 : constant User_Data_Access := new User_Data'(4711); U2 : User_Data_Access; - U3 : User_Data_Access := new User_Data'(4712); + U3 : constant User_Data_Access := new User_Data'(4712); U4 : User_Data_Access; function My_Driver (M : Menu; diff --git a/Ada95/samples/sample-my_field_type.adb b/Ada95/samples/sample-my_field_type.adb index cd289b91..0dacfc3a 100644 --- a/Ada95/samples/sample-my_field_type.adb +++ b/Ada95/samples/sample-my_field_type.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.9 $ +-- $Revision: 1.13 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; @@ -45,11 +46,14 @@ with Terminal_Interface.Curses.Forms; use Terminal_Interface.Curses.Forms; -- package body Sample.My_Field_Type is - -- That's simple. There are no field validity checks. + -- That's simple. There are minimal field validity checks. function Field_Check (Fld : Field; Typ : My_Data) return Boolean is begin + if Fld = Null_Field or Typ.Ch = Character'Val (0) then + return False; + end if; return True; end Field_Check; diff --git a/Ada95/samples/sample-text_io_demo.adb b/Ada95/samples/sample-text_io_demo.adb index 43b24232..b2448c1a 100644 --- a/Ada95/samples/sample-text_io_demo.adb +++ b/Ada95/samples/sample-text_io_demo.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control --- $Revision: 1.11 $ +-- $Revision: 1.14 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Numerics.Generic_Elementary_Functions; @@ -109,9 +110,9 @@ package body Sample.Text_IO_Demo is W : Window; P : Panel := Create (Standard_Window); K : Real_Key_Code; - Im : Complex := (0.0, 1.0); - Fx : Fix := 3.14; - Dc : Dec := 2.72; + Im : constant Complex := (0.0, 1.0); + Fx : constant Fix := 3.14; + Dc : constant Dec := 2.72; L : Md; begin diff --git a/Ada95/src/Makefile.in b/Ada95/src/Makefile.in index 01823144..634e7459 100644 --- a/Ada95/src/Makefile.in +++ b/Ada95/src/Makefile.in @@ -1,5 +1,5 @@ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -28,8 +28,7 @@ # # Author: Juergen Pfeifer, 1996 # -# Version Control -# $Revision: 1.28 $ +# $Id: Makefile.in,v 1.30 2004/08/21 21:29:50 tom Exp $ # .SUFFIXES: @@ -175,17 +174,17 @@ dotouch : @sh -c 'for f in $(LIBALIS) $(GENALIS); do test -f $$f || touch $$f; done' sources : - @ + @echo made $@ libs \ install \ install.libs \ uninstall \ uninstall.libs :: - @ + @echo made $@ generics: $(GENALIS) - @ + @echo made $@ mostlyclean :: rm -f *.o *.ali b_t*.* *.s $(PROGS) a.out core b_*_test.c *.xr[bs] *.a @@ -232,7 +231,7 @@ $(ABASE)-putwin.o: \ $(ABASE)-trace.adb : $(srcdir)/$(ABASE)-trace.adb_p rm -f $@ - $(ADAPREP) -DADA_TRACE=@ADA_TRACE@ $(srcdir)/$(ABASE)-trace.adb_p $@ + $(ADAPREP) -DADA_TRACE=@ADA_TRACE@ -DPRAGMA_UNREF=@PRAGMA_UNREF@ $(srcdir)/$(ABASE)-trace.adb_p $@ $(ABASE)-trace.o: \ $(ABASE)-trace.ads \ diff --git a/Ada95/src/terminal_interface-curses-forms-field_types-enumeration-ada.adb b/Ada95/src/terminal_interface-curses-forms-field_types-enumeration-ada.adb index 84f276af..b3eaf447 100644 --- a/Ada95/src/terminal_interface-curses-forms-field_types-enumeration-ada.adb +++ b/Ada95/src/terminal_interface-curses-forms-field_types-enumeration-ada.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.7 $ +-- $Revision: 1.10 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Characters.Handling; use Ada.Characters.Handling; @@ -54,7 +55,7 @@ package body Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is I.Match_Must_Be_Unique := Must_Be_Unique; for E in T'Range loop - I.Names (J) := new String'(T'Image (T (E))); + I.Names (J) := new String'(T'Image (E)); -- The Image attribute defaults to upper case, so we have to handle -- only the other ones... if Set /= Upper_Case then diff --git a/Ada95/src/terminal_interface-curses-forms-field_types-user-choice.adb b/Ada95/src/terminal_interface-curses-forms-field_types-user-choice.adb index d9ed454b..8d2f6c4c 100644 --- a/Ada95/src/terminal_interface-curses-forms-field_types-user-choice.adb +++ b/Ada95/src/terminal_interface-curses-forms-field_types-user-choice.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.10 $ +-- $Revision: 1.13 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; @@ -53,7 +54,7 @@ package body Terminal_Interface.Curses.Forms.Field_Types.User.Choice is Usr : System.Address) return C_Int is Result : Boolean; - Udf : User_Defined_Field_Type_With_Choice_Access := + Udf : constant User_Defined_Field_Type_With_Choice_Access := User_Defined_Field_Type_With_Choice_Access (To_Argument_Access (Usr).Typ); begin @@ -65,7 +66,7 @@ package body Terminal_Interface.Curses.Forms.Field_Types.User.Choice is Usr : System.Address) return C_Int is Result : Boolean; - Udf : User_Defined_Field_Type_With_Choice_Access := + Udf : constant User_Defined_Field_Type_With_Choice_Access := User_Defined_Field_Type_With_Choice_Access (To_Argument_Access (Usr).Typ); begin diff --git a/Ada95/src/terminal_interface-curses-forms-field_types-user.adb b/Ada95/src/terminal_interface-curses-forms-field_types-user.adb index 6e348b93..18320ef1 100644 --- a/Ada95/src/terminal_interface-curses-forms-field_types-user.adb +++ b/Ada95/src/terminal_interface-curses-forms-field_types-user.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.10 $ +-- $Revision: 1.13 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; @@ -63,7 +64,8 @@ package body Terminal_Interface.Curses.Forms.Field_Types.User is function Allocate_Arg (T : User_Defined_Field_Type'Class) return Argument_Access is - Ptr : Field_Type_Access := new User_Defined_Field_Type'Class'(T); + Ptr : constant Field_Type_Access + := new User_Defined_Field_Type'Class'(T); begin return new Argument'(Usr => System.Null_Address, Typ => Ptr, @@ -84,7 +86,7 @@ package body Terminal_Interface.Curses.Forms.Field_Types.User is Usr : System.Address) return C_Int is Result : Boolean; - Udf : User_Defined_Field_Type_Access := + Udf : constant User_Defined_Field_Type_Access := User_Defined_Field_Type_Access (To_Argument_Access (Usr).Typ); begin Result := Field_Check (Fld, Udf.all); @@ -95,7 +97,7 @@ package body Terminal_Interface.Curses.Forms.Field_Types.User is Usr : System.Address) return C_Int is Result : Boolean; - Udf : User_Defined_Field_Type_Access := + Udf : constant User_Defined_Field_Type_Access := User_Defined_Field_Type_Access (To_Argument_Access (Usr).Typ); begin Result := Character_Check (Character'Val (Ch), Udf.all); diff --git a/Ada95/src/terminal_interface-curses-forms-field_types.adb b/Ada95/src/terminal_interface-curses-forms-field_types.adb index e003058b..47efa4c2 100644 --- a/Ada95/src/terminal_interface-curses-forms-field_types.adb +++ b/Ada95/src/terminal_interface-curses-forms-field_types.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.14 $ +-- $Revision: 1.17 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Interfaces.C; @@ -144,7 +145,7 @@ package body Terminal_Interface.Curses.Forms.Field_Types is Typ : Field_Type'Class; Cft : C_Field_Type := C_Builtin_Router) is - Usr_Arg : System.Address := Get_Arg (Fld); + Usr_Arg : constant System.Address := Get_Arg (Fld); Low_Level : constant C_Field_Type := Get_Fieldtype (Fld); Arg : Argument_Access; Res : Eti_Error; diff --git a/Ada95/src/terminal_interface-curses-forms.adb b/Ada95/src/terminal_interface-curses-forms.adb index b50b031b..e3c053c6 100644 --- a/Ada95/src/terminal_interface-curses-forms.adb +++ b/Ada95/src/terminal_interface-curses-forms.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.22 $ +-- $Revision: 1.25 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; @@ -330,7 +331,7 @@ package body Terminal_Interface.Curses.Forms is Opt : C_Int) return C_Int; pragma Import (C, Set_Field_Opts, "set_field_opts"); - Opt : C_Int := FOS_2_CInt (Options); + Opt : constant C_Int := FOS_2_CInt (Options); Res : Eti_Error; begin Res := Set_Field_Opts (Fld, Opt); @@ -353,7 +354,7 @@ package body Terminal_Interface.Curses.Forms is pragma Import (C, Field_Opts_Off, "field_opts_off"); Err : Eti_Error; - Opt : C_Int := FOS_2_CInt (Options); + Opt : constant C_Int := FOS_2_CInt (Options); begin if On then Err := Field_Opts_On (Fld, Opt); @@ -373,7 +374,7 @@ package body Terminal_Interface.Curses.Forms is function Field_Opts (Fld : Field) return C_Int; pragma Import (C, Field_Opts, "field_opts"); - Res : C_Int := Field_Opts (Fld); + Res : constant C_Int := Field_Opts (Fld); begin Options := CInt_2_FOS (Res); end Get_Options; @@ -845,7 +846,7 @@ package body Terminal_Interface.Curses.Forms is Opt : C_Int) return C_Int; pragma Import (C, Set_Form_Opts, "set_form_opts"); - Opt : C_Int := FrmOS_2_CInt (Options); + Opt : constant C_Int := FrmOS_2_CInt (Options); Res : Eti_Error; begin Res := Set_Form_Opts (Frm, Opt); @@ -868,7 +869,7 @@ package body Terminal_Interface.Curses.Forms is pragma Import (C, Form_Opts_Off, "form_opts_off"); Err : Eti_Error; - Opt : C_Int := FrmOS_2_CInt (Options); + Opt : constant C_Int := FrmOS_2_CInt (Options); begin if On then Err := Form_Opts_On (Frm, Opt); @@ -888,7 +889,7 @@ package body Terminal_Interface.Curses.Forms is function Form_Opts (Frm : Form) return C_Int; pragma Import (C, Form_Opts, "form_opts"); - Res : C_Int := Form_Opts (Frm); + Res : constant C_Int := Form_Opts (Frm); begin Options := CInt_2_FrmOS (Res); end Get_Options; @@ -995,7 +996,7 @@ package body Terminal_Interface.Curses.Forms is function Frm_Driver (Frm : Form; Key : C_Int) return C_Int; pragma Import (C, Frm_Driver, "form_driver"); - R : Eti_Error := Frm_Driver (Frm, C_Int (Key)); + R : constant Eti_Error := Frm_Driver (Frm, C_Int (Key)); begin if R /= E_Ok then if R = E_Unknown_Command then @@ -1135,7 +1136,7 @@ package body Terminal_Interface.Curses.Forms is begin if FA /= null and then Free_Fields then for I in FA'First .. (FA'Last - 1) loop - if (FA (I) /= Null_Field) then + if FA (I) /= Null_Field then Delete (FA (I)); end if; end loop; diff --git a/Ada95/src/terminal_interface-curses-menus.adb b/Ada95/src/terminal_interface-curses-menus.adb index 3dac213d..4f218ffb 100644 --- a/Ada95/src/terminal_interface-curses-menus.adb +++ b/Ada95/src/terminal_interface-curses-menus.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.22 $ +-- $Revision: 1.25 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; @@ -105,8 +106,8 @@ package body Terminal_Interface.Curses.Menus is type Desc_String_Ptr is access Desc_String; pragma Controlled (Desc_String_Ptr); - Name_Str : Name_String_Ptr := new Name_String; - Desc_Str : Desc_String_Ptr := new Desc_String; + Name_Str : constant Name_String_Ptr := new Name_String; + Desc_Str : constant Desc_String_Ptr := new Desc_String; Name_Len, Desc_Len : size_t; Result : Item; begin @@ -194,7 +195,7 @@ package body Terminal_Interface.Curses.Menus is Opt : C_Int) return C_Int; pragma Import (C, Set_Item_Opts, "set_item_opts"); - Opt : C_Int := IOS_2_CInt (Options); + Opt : constant C_Int := IOS_2_CInt (Options); Res : Eti_Error; begin Res := Set_Item_Opts (Itm, Opt); @@ -214,7 +215,7 @@ package body Terminal_Interface.Curses.Menus is Opt : C_Int) return C_Int; pragma Import (C, Item_Opts_Off, "item_opts_off"); - Opt : C_Int := IOS_2_CInt (Options); + Opt : constant C_Int := IOS_2_CInt (Options); Err : Eti_Error; begin if On then @@ -233,7 +234,7 @@ package body Terminal_Interface.Curses.Menus is function Item_Opts (Itm : Item) return C_Int; pragma Import (C, Item_Opts, "item_opts"); - Res : C_Int := Item_Opts (Itm); + Res : constant C_Int := Item_Opts (Itm); begin Options := CInt_2_IOS (Res); end Get_Options; @@ -374,7 +375,7 @@ package body Terminal_Interface.Curses.Menus is Opt : C_Int) return C_Int; pragma Import (C, Set_Menu_Opts, "set_menu_opts"); - Opt : C_Int := MOS_2_CInt (Options); + Opt : constant C_Int := MOS_2_CInt (Options); Res : Eti_Error; begin Res := Set_Menu_Opts (Men, Opt); @@ -394,7 +395,7 @@ package body Terminal_Interface.Curses.Menus is Opt : C_Int) return C_Int; pragma Import (C, Menu_Opts_Off, "menu_opts_off"); - Opt : C_Int := MOS_2_CInt (Options); + Opt : constant C_Int := MOS_2_CInt (Options); Err : Eti_Error; begin if On then @@ -413,7 +414,7 @@ package body Terminal_Interface.Curses.Menus is function Menu_Opts (Men : Menu) return C_Int; pragma Import (C, Menu_Opts, "menu_opts"); - Res : C_Int := Menu_Opts (Men); + Res : constant C_Int := Menu_Opts (Men); begin Options := CInt_2_MOS (Res); end Get_Options; @@ -973,7 +974,7 @@ package body Terminal_Interface.Curses.Menus is Key : C_Int) return C_Int; pragma Import (C, Driver, "menu_driver"); - R : Eti_Error := Driver (Men, C_Int (Key)); + R : constant Eti_Error := Driver (Men, C_Int (Key)); begin if R /= E_Ok then case R is @@ -996,7 +997,7 @@ package body Terminal_Interface.Curses.Menus is begin if IA /= null and then Free_Items then for I in IA'First .. (IA'Last - 1) loop - if (IA (I) /= Null_Item) then + if IA (I) /= Null_Item then Delete (IA (I)); end if; end loop; diff --git a/Ada95/src/terminal_interface-curses-mouse.adb b/Ada95/src/terminal_interface-curses-mouse.adb index 52ac522e..10bcbf9a 100644 --- a/Ada95/src/terminal_interface-curses-mouse.adb +++ b/Ada95/src/terminal_interface-curses-mouse.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.18 $ +-- $Revision: 1.21 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with System; @@ -116,13 +117,18 @@ package body Terminal_Interface.Curses.Mouse is Old : aliased Event_Mask; begin R := MMask (Mask, Old'Access); + if R = No_Events then + Beep; + end if; return Old; end Start_Mouse; procedure End_Mouse (Mask : in Event_Mask := No_Events) is begin - null; + if Mask /= No_Events then + Beep; + end if; end End_Mouse; procedure Dispatch_Event (Mask : in Event_Mask; diff --git a/Ada95/src/terminal_interface-curses-panels.adb b/Ada95/src/terminal_interface-curses-panels.adb index a5af83a6..d7e18fa9 100644 --- a/Ada95/src/terminal_interface-curses-panels.adb +++ b/Ada95/src/terminal_interface-curses-panels.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.10 $ +-- $Revision: 1.13 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; @@ -104,7 +105,7 @@ package body Terminal_Interface.Curses.Panels is function Panel_Win (Pan : Panel) return Window; pragma Import (C, Panel_Win, "panel_window"); - Win : Window := Panel_Win (Pan); + Win : constant Window := Panel_Win (Pan); begin if Win = Null_Window then raise Panel_Exception; diff --git a/Ada95/src/terminal_interface-curses-termcap.adb b/Ada95/src/terminal_interface-curses-termcap.adb index be1da829..e62d8ef5 100644 --- a/Ada95/src/terminal_interface-curses-termcap.adb +++ b/Ada95/src/terminal_interface-curses-termcap.adb @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.6 $ +-- $Revision: 1.9 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ @@ -52,7 +53,7 @@ package body Terminal_Interface.Curses.Termcap is pragma Import (C, tgetent, "tgetent"); NameTxt : char_array (0 .. Name'Length); Length : size_t; - ignored : char_array (0 .. 0) := (0 => nul); + ignored : constant char_array (0 .. 0) := (0 => nul); result : C_Int; begin To_C (Name, NameTxt, Length); @@ -111,7 +112,7 @@ package body Terminal_Interface.Curses.Termcap is Length : size_t; Txt2 : chars_ptr; type t is new char_array (0 .. 1024); -- does it need to be 1024? - Return_Buffer : t := (others => nul); + Return_Buffer : constant t := (others => nul); begin To_C (Name, Txt, Length); Txt2 := tgetstr (Txt, char_array (Return_Buffer)); @@ -132,7 +133,7 @@ package body Terminal_Interface.Curses.Termcap is Length : size_t; Txt2 : chars_ptr; type t is new char_array (0 .. 1024); -- does it need to be 1024? - Phony_Txt : t := (others => nul); + Phony_Txt : constant t := (others => nul); begin To_C (Name, Txt, Length); Txt2 := tgetstr (Txt, char_array (Phony_Txt)); diff --git a/Ada95/src/terminal_interface-curses-text_io.adb b/Ada95/src/terminal_interface-curses-text_io.adb index cbf1d540..17ff28d9 100644 --- a/Ada95/src/terminal_interface-curses-text_io.adb +++ b/Ada95/src/terminal_interface-curses-text_io.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.14 $ +-- $Revision: 1.17 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ package body Terminal_Interface.Curses.Text_IO is @@ -86,9 +87,9 @@ package body Terminal_Interface.Curses.Text_IO is N_Cols : Column_Count; begin Get_Size (Win, N_Lines, N_Cols); - if Natural (N_Cols) > Natural (Count'Last) then - raise Layout_Error; - end if; + -- if Natural (N_Cols) > Natural (Count'Last) then + -- raise Layout_Error; + -- end if; return Count (N_Cols); end Line_Length; @@ -107,9 +108,9 @@ package body Terminal_Interface.Curses.Text_IO is return 0; else Get_Size (Win, N_Lines, N_Cols); - if Natural (N_Lines) > Natural (Count'Last) then - raise Layout_Error; - end if; + -- if Natural (N_Lines) > Natural (Count'Last) then + -- raise Layout_Error; + -- end if; return Count (N_Lines); end if; end Page_Length; @@ -229,9 +230,9 @@ package body Terminal_Interface.Curses.Text_IO is begin Get_Cursor_Position (Win, Y, X); N := Natural (X); N := N + 1; - if N > Natural (Count'Last) then - raise Layout_Error; - end if; + -- if N > Natural (Count'Last) then + -- raise Layout_Error; + -- end if; return Positive_Count (N); end Col; @@ -249,9 +250,9 @@ package body Terminal_Interface.Curses.Text_IO is begin Get_Cursor_Position (Win, Y, X); N := Natural (Y); N := N + 1; - if N > Natural (Count'Last) then - raise Layout_Error; - end if; + -- if N > Natural (Count'Last) then + -- raise Layout_Error; + -- end if; return Positive_Count (N); end Line; diff --git a/Ada95/src/terminal_interface-curses-trace.adb_p b/Ada95/src/terminal_interface-curses-trace.adb_p index 6b510d91..747454a5 100644 --- a/Ada95/src/terminal_interface-curses-trace.adb_p +++ b/Ada95/src/terminal_interface-curses-trace.adb_p @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,7 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.4 $ +-- $Revision: 1.5 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ #if ADA_TRACE then @@ -78,11 +78,17 @@ package body Terminal_Interface.Curses.Trace is end Trace_Put; #else procedure Trace_On (x : Trace_Attribute_Set) is +#if PRAGMA_UNREF + pragma Unreferenced (x); +#end if; begin null; end Trace_On; procedure Trace_Put (str : String) is +#if PRAGMA_UNREF + pragma Unreferenced (str); +#end if; begin null; end Trace_Put; diff --git a/Ada95/src/terminal_interface-curses.adb b/Ada95/src/terminal_interface-curses.adb index 0349c80d..86ea1b5a 100644 --- a/Ada95/src/terminal_interface-curses.adb +++ b/Ada95/src/terminal_interface-curses.adb @@ -7,7 +7,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -35,7 +35,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- $Revision: 1.29 $ +-- $Revision: 1.32 $ +-- $Date: 2004/08/21 21:37:00 $ -- Binding Version 01.00 ------------------------------------------------------------------------------ with System; @@ -373,7 +374,7 @@ package body Terminal_Interface.Curses is function Dupwin (Win : Window) return Window; pragma Import (C, Dupwin, "dupwin"); - W : Window := Dupwin (Win); + W : constant Window := Dupwin (Win); begin if W = Null_Window then raise Curses_Exception; @@ -935,6 +936,9 @@ package body Terminal_Interface.Curses is procedure No_Qiflush; pragma Import (C, No_Qiflush, "noqiflush"); begin + if Win = Null_Window then + raise Curses_Exception; + end if; if Flush then Qiflush; else @@ -1398,8 +1402,10 @@ package body Terminal_Interface.Curses is is -- Please note: in ncurses they are one off. -- This might be different in other implementations of curses - Y : C_Int := C_Int (W_Get_Short (Win, Offset_maxy)) + C_Int (Offset_XY); - X : C_Int := C_Int (W_Get_Short (Win, Offset_maxx)) + C_Int (Offset_XY); + Y : constant C_Int := C_Int (W_Get_Short (Win, Offset_maxy)) + + C_Int (Offset_XY); + X : constant C_Int := C_Int (W_Get_Short (Win, Offset_maxx)) + + C_Int (Offset_XY); begin Number_Of_Lines := Line_Count (Y); Number_Of_Columns := Column_Count (X); @@ -1410,8 +1416,8 @@ package body Terminal_Interface.Curses is Top_Left_Line : out Line_Position; Top_Left_Column : out Column_Position) is - Y : C_Short := W_Get_Short (Win, Offset_begy); - X : C_Short := W_Get_Short (Win, Offset_begx); + Y : constant C_Short := W_Get_Short (Win, Offset_begy); + X : constant C_Short := W_Get_Short (Win, Offset_begx); begin Top_Left_Line := Line_Position (Y); Top_Left_Column := Column_Position (X); @@ -1422,8 +1428,8 @@ package body Terminal_Interface.Curses is Line : out Line_Position; Column : out Column_Position) is - Y : C_Short := W_Get_Short (Win, Offset_cury); - X : C_Short := W_Get_Short (Win, Offset_curx); + Y : constant C_Short := W_Get_Short (Win, Offset_cury); + X : constant C_Short := W_Get_Short (Win, Offset_curx); begin Line := Line_Position (Y); Column := Column_Position (X); @@ -1435,8 +1441,8 @@ package body Terminal_Interface.Curses is Top_Left_Column : out Column_Position; Is_Not_A_Subwindow : out Boolean) is - Y : C_Int := W_Get_Int (Win, Offset_pary); - X : C_Int := W_Get_Int (Win, Offset_parx); + Y : constant C_Int := W_Get_Int (Win, Offset_pary); + X : constant C_Int := W_Get_Int (Win, Offset_parx); begin if Y = -1 then Top_Left_Line := Line_Position'Last; @@ -1762,7 +1768,8 @@ package body Terminal_Interface.Curses is pragma Import (C, Winchnstr, "winchnstr"); N : Integer := Len; - Txt : chtype_array (0 .. Str'Length) := (0 => Default_Character); + Txt : constant chtype_array (0 .. Str'Length) + := (0 => Default_Character); Cnt : Natural := 0; begin if N < 0 then @@ -2457,7 +2464,7 @@ package body Terminal_Interface.Curses is pragma Import (C, C_Assume_Default_Colors, "assume_default_colors"); Err : constant C_Int := C_Assume_Default_Colors (C_Int (Fore), - C_Int (Black)); + C_Int (Back)); begin if Err = Curses_Err then raise Curses_Exception; diff --git a/INSTALL b/INSTALL index 8743d494..bc3a4f84 100644 --- a/INSTALL +++ b/INSTALL @@ -1,4 +1,4 @@ --- $Id: INSTALL,v 1.71 2004/02/07 21:06:05 tom Exp $ +-- $Id: INSTALL,v 1.98 2005/10/09 14:09:37 tom Exp $ --------------------------------------------------------------------- How to install Ncurses/Terminfo on your system --------------------------------------------------------------------- @@ -19,12 +19,6 @@ below. If you are converting from BSD curses and do not have root access, be sure to read the BSD CONVERSION NOTES section below. -If you are using a version of XFree86 xterm older than 3.1.2F, see the section -on RECENT XTERM VERSIONS below. - -If you are trying to build GNU Emacs using ncurses for terminal support, -read the USING NCURSES WITH EMACS section below. - If you are trying to build applications using gpm with ncurses, read the USING NCURSES WITH GPM section below. @@ -45,7 +39,7 @@ do anything else. REQUIREMENTS: ------------ -You will need the following in order to build and install ncurses under UNIX: +You will need the following to build and install ncurses under UNIX: * ANSI C compiler (gcc, for instance) * sh (bash will do) @@ -64,9 +58,10 @@ INSTALLATION PROCEDURE: with it. The --prefix option to configure changes the root directory for installing - ncurses. The default is in subdirectories of /usr/local. Use - --prefix=/usr to replace your default curses distribution. This is the - default for Linux and BSD/OS users. + ncurses. The default is normally in subdirectories of /usr/local, except + for systems where ncurses is normally installed as a system library, e.g., + Linux, the various BSD systems and Cygwin. Use --prefix=/usr to replace + your default curses distribution. The package gets installed beneath the --prefix directory as follows: @@ -77,9 +72,20 @@ INSTALLATION PROCEDURE: In $(prefix)/include: C header files Under $(prefix)/man: the manual pages - Note however that the configure script attempts to locate previous - installation of ncurses, and will set the default prefix according to where - it finds the ncurses headers. + Note that the configure script attempts to locate previous installation of + ncurses, and will set the default prefix according to where it finds the + ncurses headers. + + Do not use commands such as + + make install prefix=XXX + + to change the prefix after configuration, since the prefix value is used + for some absolute pathnames such as TERMINFO. Instead do this + + make install DESTDIR=XXX + + See also the discussion of --with-install-prefix. 2. Type `./configure' in the top-level directory of the distribution to configure ncurses for your operating system and create the Makefiles. @@ -294,10 +300,22 @@ SUMMARY OF CONFIGURE OPTIONS: more likely writable than the system terminfo database. Use this option to disable the feature altogether. + --disable-largefile + Disable compiler flags needed to use large-file interfaces. + --disable-leaks For testing, compile-in code that frees memory that normally would not be freed, to simplify analysis of memory-leaks. + --disable-lp64 + The header files will ignore use of the _LP64 symbol to make chtype + and mmask_t types 32 bits (they may be long on 64-bit hosts, for + compatibility with older releases). + + NOTE: this is potentially an ABI change, depending on existing + packages. The default for this option is "disabled" for ncurses + ABI 5, and "enabled" for ABI 6. + --disable-macros For testing, use functions rather than macros. The program will run more slowly, but it is simpler to debug. This makes a header file @@ -379,6 +397,24 @@ SUMMARY OF CONFIGURE OPTIONS: For testing, generate functions for certain macros to make them visible as such to the debugger. See also the --disable-macros option. + --enable-ext-colors + Extend the cchar_t structure to allow more than 16 colors to be + encoded. This applies only to the wide-character (--enable-widec) + configuration. + + NOTE: using this option will make libraries which are not binary- + compatible with libncursesw 5.4. None of the interfaces change, but + applications which have an array of cchar_t's must be recompiled. + + --enable-ext-mouse + Modify the encoding of mouse state to make room for a 5th mouse button. + That allows one to use ncurses with a wheel mouse with xterm or + similar X terminal emulators. + + NOTE: using this option will make libraries which are not binary- + compatible with libncursesw 5.4. None of the interfaces change, but + applications which have mouse mask mmask_t's must be recompiled. + --enable-getcap Use the 4.4BSD getcap code if available, or a bundled version of it to fetch termcap entries. Entries read in this way cannot use (make @@ -388,7 +424,7 @@ SUMMARY OF CONFIGURE OPTIONS: --enable-getcap-cache Cache translated termcaps under the directory $HOME/.terminfo - NOTE: this sounds good - it makes ncurses run faster the second time. + NOTE: this sounds good - it makes ncurses run faster the second time. But look where the data comes from - an /etc/termcap containing lots of entries that are not up to date. If you configure with this option and forget to install the terminfo database before running an ncurses @@ -444,9 +480,9 @@ SUMMARY OF CONFIGURE OPTIONS: Turn on GCC compiler warnings. There should be only a few. --enable-widec - Compile with experimental wide-character code. This makes a different - version of the libraries (e.g., libncursesw.so), which stores - characters as wide-characters, + Compile with wide-character code. This makes a different version of + the libraries (e.g., libncursesw.so), which stores characters as + wide-characters, NOTE: applications compiled with this configuration are not compatible with those built for 8-bit characters. You cannot simply make a @@ -470,7 +506,7 @@ SUMMARY OF CONFIGURE OPTIONS: Specify the Ada95 compiler command (default "gnatmake") --with-ada-include=DIR - Tell where to install the Ada includes (default: + Tell where to install the Ada includes (default: PREFIX/lib/ada/adainclude) --with-ada-objects=DIR @@ -516,6 +552,13 @@ SUMMARY OF CONFIGURE OPTIONS: to use a terminfo database which is compatible with the native applications. + --with-chtype=TYPE + Override type of chtype, which stores the video attributes and (if + --enable-widec is not given) a character. Prior to ncurses 5.5, this + was always unsigned long, but with ncurses 5.5, it may be unsigned. + Use this option if you need to preserve compatibility with 64-bit + executables. + --with-database=XXX Specify the terminfo source file to install. Usually you will wish to install ncurses' default (misc/terminfo.src). Certain systems @@ -546,12 +589,19 @@ SUMMARY OF CONFIGURE OPTIONS: --with-gpm use Alessandro Rubini's GPM library to provide mouse support on the - Linux console. + Linux console. Prior to ncurses 5.5, this introduced a dependency + on the GPM library. Currently ncurses uses the dlsym() function to + bind to the at runtime, so it is only necessary that the library be + present when ncurses is built. --with-install-prefix=XXX Allows you to specify an alternate location for installing ncurses after building it. The value you specify is prepended to the "real" - install location. This simplifies making binary packages. + install location. This simplifies making binary packages. The + makefile variable DESTDIR is set by this option. It is also possible + to use + make install DESTDIR=XXX + since the makefiles pass that variable to subordinate makes. NOTE: a few systems build shared libraries with fixed pathnames; this option probably will not work for those configurations. @@ -568,6 +618,12 @@ SUMMARY OF CONFIGURE OPTIONS: particular version of libtool, e.g., /usr/bin/libtool-1.2.3 + It is possible to rebuild the configure script to use the automake + macros for libtool, e.g., AC_PROG_LIBTOOL. See the comments in + aclocal.m4 for CF_PROG_LIBTOOL, and ensure that you build configure + using the appropriate patch for autoconf from + http://invisible-island.net/autoconf/ + --with-manpage-aliases Tell the configure script you wish to create entries in the man-directory for aliases to manpages which list them, e.g., the @@ -600,11 +656,17 @@ SUMMARY OF CONFIGURE OPTIONS: by running them through tbl to generate tables understandable by nroff. + --with-mmask-t=TYPE + Override type of mmask_t, which stores the mouse mask. Prior to + ncurses 5.5, this was always unsigned long, but with ncurses 5.5, it + may be unsigned. Use this option if you need to preserve compatibility + with 64-bit executables. + --with-ospeed=TYPE Override type of ospeed variable, which is part of the termcap compatibility interface. In termcap, this is a 'short', which works for a wide range of baudrates because ospeed is not the actual speed - but the encoded value, e.g., B9600 would be a small number such as 13. + but the encoded value, e.g., B9600 would be a small number such as 13. However the encoding scheme originally allowed for values "only" up to 38400bd. A newer set of definitions past 38400bd is not encoded as compactly, and is not guaranteed to fit into a short (see the function @@ -633,11 +695,21 @@ SUMMARY OF CONFIGURE OPTIONS: Generate shared-libraries. The names given depend on the system for which you are building, typically using a ".so" suffix, along with symbolic links that refer to the release version. - + NOTE: Unless you override the configure script by setting the $CFLAGS environment variable, these will not be built with the -g debugging option. + NOTE: For some configurations, e.g., installing a new version of + ncurses shared libraries on a machine which already has ncurses + shared libraries, you may encounter problems with the linker. + For example, it may prevent you from running the build tree's + copy of tic (for installing the terminfo database) because it + loads the system's copy of the ncurses shared libraries. In that + case, using the misc/shlib script may be helpful, since it sets + $LD_LIBRARY_PATH to point to the build tree, e.g., + ./misc/shlib make install + --with-shlib-version=XXX Specify whether to use the release or ABI version for shared libraries. This is normally chosen automatically based on the type of system @@ -657,12 +729,19 @@ SUMMARY OF CONFIGURE OPTIONS: Specify a search-list of terminfo directories which will be compiled into the ncurses library (default: DATADIR/terminfo) - --with-termlib + --with-termlib[=XXX] When building the ncurses library, organize this as two parts: the curses library (libncurses) and the low-level terminfo library (libtinfo). This is done to accommodate applications that use only the latter. The terminfo library is about half the size of the total. + If an option value is given, that overrides the name of the terminfo + library. For instance, if the wide-character version is built, the + terminfo library would be named libtinfow. But the libtinfow interface + is upward compatible from libtinfo, so it would be possible to overlay + libtinfo.so with a "wide" version of libtinfow.so by renaming it with + this option. + --with-termpath=XXX Specify a search-list of termcap files which will be compiled into the ncurses library (default: /etc/termcap:/usr/share/misc/termcap) @@ -698,6 +777,11 @@ SUMMARY OF CONFIGURE OPTIONS: programs (e.g., tic). The test applications will still be built if you type "make", though not if you simply do "make install". + --without-xterm-new + Tell the configure script to use "xterm-old" for the entry used in + the terminfo database. This will work with variations such as + X11R5 and X11R6 xterm. + COMPATIBILITY WITH OLDER VERSIONS OF NCURSES: -------------------------------------------- @@ -714,10 +798,82 @@ COMPATIBILITY WITH OLDER VERSIONS OF NCURSES: you may encounter when building a system with different versions of ncurses: + 5.5 (October 10, 2005) + Interface changes: + + + terminfo installs "xterm-new" as "xterm" entry rather than + "xterm-old" (aka xterm-r6). + + + terminfo data is installed using the tic -x option (few systems + still use ncurses 4.2). + + + modify C++ binding to work with newer C++ compilers by providing + initializers and using modern casts. Old-style header names are + still used in this release to allow compiling with not-so-old + compilers. + + + form and menu libraries now work with wide-character data. + Applications which bypassed the form library and manipulated the + FIELD.buf data directly will not work properly with libformw, since + that no longer points to an array of char. The set_field_buffer() + and field_buffer() functions translate to/from the actual field + data. + + + change SP->_current_attr to a pointer, adjust ifdef's to ensure that + libtinfo.so and libtinfow.so have the same ABI. The reason for this + is that the corresponding data which belongs to the upper-level + ncurses library has a different size in each model. + + + winnstr() now returns multibyte character strings for the + wide-character configuration. + + + assume_default_colors() no longer requires that use_default_colors() + be called first. + + + data_ahead() now works with wide-characters. + + + slk_set() and slk_wset() now accept and store multibyte or + multicolumn characters. + + + start_color() now returns OK if colors have already been started. + start_color() also returns ERR if it cannot allocate memory. + + + pair_content() now returns -1 for consistency with init_pair() if it + corresponds to the default-color. + + + unctrl() now returns null if its parameter does not correspond + to an unsigned char. + + Added extensions: + Experimental mouse version 2 supports wheel mice with buttons + 4 and 5. This requires ABI 6 because it modifies the encoding + of mouse events. + + Experimental extended colors allows encoding of 256 foreground + and background colors, e.g., with the xterm-256color or + xterm-88color terminfo entries. This requires ABI 6 because + it changes the size of cchar_t. + + Added internal functions: + _nc_check_termtype2 + _nc_resolve_uses2 + _nc_retrace_cptr + _nc_retrace_cvoid_ptr + _nc_retrace_void_ptr + _nc_setup_term + + Removed internal functions: + none + + Modified internal functions: + _nc_insert_ch + _nc_save_str + _nc_trans_string + 5.4 (February 8, 2004) Interface changes: - + add the remaining functions for X/Open curses wide-character support. + + add the remaining functions for X/Open curses wide-character support. These are only available if the library is configured using the --enable-widec option. pecho_wchar() @@ -742,6 +898,7 @@ COMPATIBILITY WITH OLDER VERSIONS OF NCURSES: Added extensions: key_defined() + Added internal functions: _nc_get_locale() _nc_insert_ch() @@ -753,9 +910,11 @@ COMPATIBILITY WITH OLDER VERSIONS OF NCURSES: _nc_tparm_analyze() _nc_trace_bufcat() debug _nc_unicode_locale() + Removed internal functions: _nc_outstr() _nc_sigaction() + Modified internal functions: _nc_remove_string() _nc_retrace_chtype() @@ -778,6 +937,7 @@ COMPATIBILITY WITH OLDER VERSIONS OF NCURSES: Added extensions: is_term_resized() resize_term() + Added internal functions: _nc_altcharset_name() debug _nc_reset_colors() @@ -788,8 +948,10 @@ COMPATIBILITY WITH OLDER VERSIONS OF NCURSES: _nc_varargs() debug _nc_visbufn() debug _nc_wgetch() + Removed internal functions: _nc_background() + Modified internal functions: _nc_freeall() debug @@ -1063,17 +1225,10 @@ RECENT XTERM VERSIONS: --------------------- The terminfo database file included with this distribution assumes you - are running an XFree86 xterm based on X11R6 (i.e., xterm-r6). The - earlier X11R5 entry (xterm-r5) is provided as well. - - If you are running XFree86 version 3.2 (actually 3.1.2F and up), you - should consider using the xterm-xf86-v32 (or later, the most recent - version is always named "xterm-xfree86") entry, which adds ANSI color - and the VT220 capabilities which have been added in XFree86. If you - are running a mixed network, however, where this terminal description - may be used on an older xterm, you may have problems, since - applications that assume these capabilities will produce incorrect - output on the older xterm (e.g., highlighting is not cleared). + are running a modern xterm based on XFree86 (i.e., xterm-new). The + earlier X11R6 entry (xterm-r6) and X11R5 entry (xterm-r5) is provided + as well. See the --without-xterm-new configure script option if you + are unable to update your system. CONFIGURING FALLBACK ENTRIES: @@ -1082,7 +1237,8 @@ CONFIGURING FALLBACK ENTRIES: In order to support operation of ncurses programs before the terminfo tree is accessible (that is, in single-user mode or at OS installation time) the ncurses library can be compiled to include an array of - pre-fetched fallback entries. + pre-fetched fallback entries. This must be done on a machine which + has ncurses' infocmp and terminfo database installed. These entries are checked by setupterm() only when the conventional fetches from the terminfo tree and the termcap fallback (if configured) @@ -1090,23 +1246,23 @@ CONFIGURING FALLBACK ENTRIES: shadow modifications to the on-disk entry for the same type, when that entry is accessible. - By default, there are no entries on the fallback list. After you - have built the ncurses suite for the first time, you can change - the list (the process needs infocmp(1)). To do so, use the script - MKfallback.sh. A configure script option --with-fallbacks does this - (it accepts a comma-separated list of the names you wish, and does - not require a rebuild). + By default, there are no entries on the fallback list. After you have + built the ncurses suite for the first time, you can change the list + (the process needs infocmp(1)). To do so, use the script + ncurses/tinfo/MKfallback.sh. A configure script option + --with-fallbacks does this (it accepts a comma-separated list of the + names you wish, and does not require a rebuild). If you wanted (say) to have linux, vt100, and xterm fallbacks, you would use the commands cd ncurses; - MKfallback.sh linux vt100 xterm >fallback.c + tinfo/MKfallback.sh linux vt100 xterm >fallback.c Then just rebuild and reinstall the library as you would normally. You can restore the default empty fallback list with - MKfallback.sh >fallback.c + tinfo/MKfallback.sh >fallback.c The overhead for an empty fallback list is one trivial stub function. Any non-empty fallback list is const-ed and therefore lives in sharable @@ -1186,45 +1342,37 @@ USING NCURSES WITH AFS: can't hard-link across them. The --enable-symlinks option copes with this by making tic use symbolic links. -USING NCURSES WITH EMACS: - GNU Emacs has its own termcap support. By default, it uses a mixture - of those functions and code linked from the host system's libraries. - You need to foil this and shut out the GNU termcap library entirely. - - In order to do this, hack the Linux config file (s/linux.h) to contain - a #define TERMINFO and set the symbol LIBS_TERMCAP to "-lncurses". - - We have submitted such a change for the 19.30 release, so it may - already be applied in your sources -- check for the #define TERMINFO. - USING NCURSES WITH GPM: - Ncurses 4.1 and up can be configured to use GPM (General Purpose Mouse) - which is used on Linux console. Be aware that GPM is commonly + Ncurses 4.1 and up can be configured to use GPM (General Purpose + Mouse) which is used on Linux console. Be aware that GPM is commonly installed as a shared library which contains a wrapper for the curses wgetch() function (libcurses.o). Some integrators have simplified - linking applications by combining all or part of libcurses.so (the BSD - curses) into the libgpm.so file, producing symbol conflicts with - ncurses (specifically the wgetch function). You may be able to work - around this problem by linking as follows: + linking applications by combining all or part of libcurses.so into the + libgpm.so file, producing symbol conflicts with ncurses (specifically + the wgetch function). This was originally the BSD curses, but + generally whatever curses library exists on the system. + + You may be able to work around this problem by linking as follows: cc -o foo foo.o -lncurses -lgpm -lncurses but the linker may not cooperate, producing mysterious errors. - A patched version of gpm is available: + See the FAQ, as well as the discussion under the --with-gpm option: - dickey.his.com:/ncurses/gpm-1.10-970125.tar.gz - - This patch is incorporated in gpm 1.12; however some integrators - are slow to update this library. Current distributions of gpm can - be configured properly using the --without-curses option. + http://invisible-island.net/ncurses/ncurses.faq.html#using_gpm_lib BUILDING NCURSES WITH A CROSS-COMPILER Ncurses can be built with a cross-compiler. Some parts must be built with the host's compiler since they are used for building programs (e.g., ncurses/make_hash and ncurses/make_keys) that generate tables - that are compiled into the ncurses library. You should set the - BUILD_CC environment variable to your host's compiler, and run the - configure script configuring for the cross-compiler. + that are compiled into the ncurses library. The essential thing to do + is set the BUILD_CC environment variable to your host's compiler, and + run the configure script configuring for the cross-compiler. + + The configure options --with-build-cc, etc., are provided to make this + simpler. Since make_hash and make_keys use only ANSI C features, it + is normally not necessary to provide the other options such as + --with-build-libs, but they are provided for completeness. Note that all of the generated source-files which are part of ncurses will be made if you use @@ -1235,6 +1383,12 @@ BUILDING NCURSES WITH A CROSS-COMPILER support for the tools used to generate the sources, e.g., sed, awk and Bourne-shell. + When ncurses has been successfully cross-compiled, you may want to use + "make install" (with a suitable target directory) to construct an + install tree. Note that in this case (as with the --with-fallbacks + option), ncurses uses the development platform's tic to do the + "make install.data" portion. + BUGS: Send any feedback to the ncurses mailing list at bug-ncurses@gnu.org. To subscribe send mail to diff --git a/MANIFEST b/MANIFEST index 3d2297e1..1de68029 100644 --- a/MANIFEST +++ b/MANIFEST @@ -206,6 +206,7 @@ ./dist.mk ./doc/hackguide.doc ./doc/html/Ada95.html +./doc/html/NCURSES-Programming-HOWTO.html ./doc/html/ada/files.htm ./doc/html/ada/files/T.htm ./doc/html/ada/funcs.htm @@ -390,6 +391,7 @@ ./doc/html/man/form_requestname.3x.html ./doc/html/man/form_userptr.3x.html ./doc/html/man/form_win.3x.html +./doc/html/man/index.html ./doc/html/man/infocmp.1m.html ./doc/html/man/infotocap.1m.html ./doc/html/man/key_defined.3x.html @@ -433,6 +435,7 @@ ./doc/ncurses-intro.doc ./form/Makefile.in ./form/READ.ME +./form/f_trace.c ./form/fld_arg.c ./form/fld_attr.c ./form/fld_current.c @@ -663,6 +666,7 @@ ./menu/m_scale.c ./menu/m_spacing.c ./menu/m_sub.c +./menu/m_trace.c ./menu/m_userptr.c ./menu/m_win.c ./menu/menu.h @@ -677,11 +681,13 @@ ./misc/emx.src ./misc/form.def ./misc/form.ref -./misc/indent.pro +./misc/gen_edit.sh +./misc/jpf-indent ./misc/makedef.cmd ./misc/makellib ./misc/menu.def ./misc/menu.ref +./misc/ncu-indent ./misc/ncurses.def ./misc/ncurses.ref ./misc/panel.def @@ -738,6 +744,7 @@ ./ncurses/base/lib_initscr.c ./ncurses/base/lib_insch.c ./ncurses/base/lib_insdel.c +./ncurses/base/lib_insnstr.c ./ncurses/base/lib_instr.c ./ncurses/base/lib_isendwin.c ./ncurses/base/lib_leaveok.c @@ -839,6 +846,7 @@ ./ncurses/tinfo/read_termcap.c ./ncurses/tinfo/setbuf.c ./ncurses/tinfo/strings.c +./ncurses/tinfo/trim_sgr0.c ./ncurses/tinfo/write_entry.c ./ncurses/trace/README ./ncurses/trace/lib_trace.c @@ -958,6 +966,7 @@ ./test/demo_keyok.c ./test/demo_menus.c ./test/demo_panels.c +./test/demo_termcap.c ./test/ditto.c ./test/dots.c ./test/edit_field.c @@ -973,6 +982,7 @@ ./test/inserts.c ./test/keynames.c ./test/knight.c +./test/linux-color.dat ./test/listused.sh ./test/lrtest.c ./test/modules @@ -990,3 +1000,5 @@ ./test/view.c ./test/worm.c ./test/xmas.c +./test/xterm-16color.dat +./test/xterm-88color.dat diff --git a/Makefile.in b/Makefile.in index 7a30d322..cb8cd422 100644 --- a/Makefile.in +++ b/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.22 2001/10/27 18:17:22 tom Exp $ +# $Id: Makefile.in,v 1.24 2005/01/29 19:30:06 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -65,6 +65,9 @@ preinstall : @ echo '' @ echo '** Configuration summary for NCURSES $(NCURSES_MAJOR).$(NCURSES_MINOR) $(NCURSES_PATCH):' @ echo '' + @ echo ' extended funcs: '`test @NCURSES_EXT_FUNCS@ != 0 && echo yes || echo no` + @ echo ' xterm terminfo: '@WHICH_XTERM@ + @ echo '' @ echo ' bin directory: '$(bindir) @ echo ' lib directory: '$(libdir) @ echo ' include directory: '$(includedir) @@ -89,5 +92,6 @@ mostlyclean \ realclean \ depend \ sources \ +tags \ uninstall \ install :: diff --git a/NEWS b/NEWS index 3f2c2d29..04bc8456 100644 --- a/NEWS +++ b/NEWS @@ -1,4 +1,4 @@ --- $Id: NEWS,v 1.797 2004/02/08 21:15:26 tom Exp $ +-- $Id: NEWS,v 1.929 2005/10/09 14:17:59 tom Exp $ This is a log of changes that ncurses has gone through since Zeyd started working with Pavel Curtis' original work, pcurses, in 1992. @@ -6,6 +6,783 @@ working with Pavel Curtis' original work, pcurses, in 1992. Changes through 1.9.9e are recorded by Zeyd M. Ben-Halim. Changes since 1.9.9e are recorded by Thomas Dickey. +20051010 5.5 release for upload to ftp.gnu.org + +20051008 + + document in demo_forms.c some portability issues. + +20051001 + + document side-effect of werase() which sets the cursor position. + + save/restore the current position in form field editing to make + overlay mode work. + +20050924 + + correct header dependencies in progs, allowing parallel make (report + by Daniel Jacobowitz). + + modify CF_BUILD_CC to ensure that pre-setting $BUILD_CC overrides + the configure check for --with-build-cc (report by Daniel Jacobowitz). + + modify CF_CFG_DEFAULTS to not use /usr as the default prefix for + NetBSD. + + update config.guess and config.sub from + http://subversions.gnu.org/cgi-bin/viewcvs/config/config/ + +20050917 + + modify sed expression which computes path for /usr/lib/terminfo + symbolic link in install to ensure that it does not change unexpected + levels of the path (Gentoo #42336). + + modify default for --disable-lp64 configure option to reduce impact + on existing 64-bit builds. Enabling the _LP64 option may change the + size of chtype and mmask_t. However, for ABI 6, it is enabled by + default (report by Mike Frysinger). + + add configure script check for --enable-ext-mouse, bump ABI to 6 by + default if it is used. + + improve configure script logic for bumping ABI to omit this if the + --with-abi-version option was used. + + update address for Free Software Foundation in tack's source. + + correct wins_wch(), which was not marking the filler-cells of + multi-column characters (cf: 20041023). + +20050910 + + modify mouse initialization to ensure that Gpm_Open() is called only + once. Otherwise GPM gets confused in its initialization of signal + handlers (Debian #326709). + +20050903 + + modify logic for backspacing in a multiline form field to ensure that + it works even when the preceding line is full (report by Frank van + Vugt). + + remove comment about BUGS section of ncurses manpage (Debian #325481) + +20050827 + + document some workarounds for shared and libtool library + configurations in INSTALL (see --with-shared and --with-libtool). + + modify CF_GCC_VERSION and CF_GXX_VERSION macros to accommodate + cross-compilers which emit the platform name in their version + message, e.g., + arm-sa1100-linux-gnu-g++ (GCC) 4.0.1 + (report by Frank van Vugt). + +20050820 + + start updating documentation for upcoming 5.5 release. + + fix to make libtool and libtinfo work together again (cf: 20050122). + + fixes to allow building traces into libtinfo + + add debug trace to tic that shows if/how ncurses will write to the + lower corner of a terminal's screen. + + update llib-l* files. + +20050813 + + modify initializers in c++ binding to build with old versions of g++. + + improve special case for 20050115 repainting fix, ensuring that if + the first changed cell is not a character that the range to be + repainted is adjusted to start at a character's beginning (Debian + #316663). + +20050806 + + fixes to build on QNX 6.1 + + improve configure script checks for Intel 9.0 compiler. + + remove #include's for libc.h (obsolete). + + adjust ifdef's in curses.priv.h so that when cross-compiling to + produce comp_hash and make_keys, no dependency on wchar.h is needed. + That simplifies the build-cppflags (report by Frank van Vugt). + + move modules related to key-binding into libtinfo to fix linkage + problem caused by 20050430 changes to MKkeyname.sh (report by + Konstantin Andreev). + +20050723 + + updates/fixes for configure script macros from vile. + + make prism9's sgr string agree with the rest of the terminfo -TD + + make vt220's sgr0 string consistent with sgr string, do this for + several related cases -TD + + improve translation to termcap by filtering the 'me' (sgr0) strings + as in the runtime call to tgetent() (prompted by a discussion with + Thomas Klausner). + + improve tic check for sgr0 versus sgr(0), to help ensure that sgr0 + resets line-drawing. + +20050716 + + fix special cases for trimming sgr0 for hurd and vt220 (Debian + #318621). + + split-out _nc_trim_sgr0() from modifications made to tgetent(), to + allow it to be used by tic to provide information about the runtime + changes that would be made to sgr0 for termcap applications. + + modify make_sed.sh to make the group-name in the NAME section of + form/menu library manpage agree with the TITLE string when renaming + is done for Debian (Debian #78866). + +20050702 + + modify parameter type in c++ binding for insch() and mvwinsch() to + be consistent with underlying ncurses library (was char, is chtype). + + modify treatment of Intel compiler to allow _GNU_SOURCE to be defined + on Linux. + + improve configure check for nanosleep(), checking that it works since + some older systems such as AIX 4.3 have a nonworking version. + +20050625 + + update config.guess and config.sub from + http://subversions.gnu.org/cgi-bin/viewcvs/config/config/ + + modify misc/shlib to work in test-directory. + + suppress $suffix in misc/run_tic.sh when cross-compiling. This + allows cross-compiles to use the host's tic program to handle the + "make install.data" step. + + improve description of $LINES and $COLUMNS variables in manpages + (prompted by report by Dave Ulrick). + + improve description of cross-compiling in INSTALL + + add NCURSES-Programming-HOWTO.html by Pradeep Padala + (see http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/). + + modify configure script to obtain soname for GPM library (discussion + with Daniel Jacobowitz). + + modify configure script so that --with-chtype option will still + compute the unsigned literals suffix for constants in curses.h + (report by Daniel Jacobowitz: + + patches from Daniel Jacobowitz: + + the man_db.renames entry for tack.1 was backwards. + + tack.1 had some 1m's that should have been 1M's. + + the section for curs_inwstr.3 was wrong. + +20050619 + + correction to --with-chtype option (report by Daniel Jacobowitz). + +20050618 + + move build-time edit_man.sh and edit_man.sed scripts to top directory + to simplify reusing them for renaming tack's manpage (prompted by a + review of Debian package). + + revert minor optimization from 20041030 (Debian #313609). + + libtool-specific fixes, tested with libtool 1.4.3, 1.5.0, 1.5.6, + 1.5.10 and 1.5.18 (all work except as noted previously for the c++ + install using libtool 1.5.0): + + modify the clean-rule in c++/Makefile.in to work with IRIX64 make + program. + + use $(LIBTOOL_UNINSTALL) symbol, overlooked in 20030830 + + add configure options --with-chtype and --with-mmask-t, to allow + overriding of the non-LP64 model's use of the corresponding types. + + revise test for size of chtype (and mmask_t), which always returned + "long" due to an uninitialized variable (report by Daniel Jacobowitz). + +20050611 + + change _tracef's that used "%p" format for va_list values to ignore + that, since on some platforms those are not pointers. + + fixes for long-formats in printf's due to largefile support. + +20050604 + + fixes for termcap support: + + reset pointer to _nc_curr_token.tk_name when the input stream is + closed, which could point to free memory (cf: 20030215). + + delink TERMTYPE data which is used by the termcap reader, so that + extended names data will be freed consistently. + + free pointer to TERMTYPE data in _nc_free_termtype() rather than + its callers. + + add some entrypoints for freeing permanently allocated data via + _nc_freeall() when NO_LEAKS is defined. + + amend 20041030 change to _nc_do_color to ensure that optimization is + applied only when the terminal supports back_color_erase (bce). + +20050528 + + add sun-color terminfo entry -TD + + correct a missing assignment in c++ binding's method + NCursesPanel::UserPointer() from 20050409 changes. + + improve configure check for large-files, adding check for dirent64 + from vile. + + minor change to configure script to improve linker options for the + Ada95 tree. + +20050515 + + document error conditions for ncurses library functions (report by + Stanislav Ievlev). + + regenerated html documentation for ada binding. + see ftp://invisible-island.net/ncurses/patches/gnathtml + +20050507 + + regenerated html documentation for manpages. + + add $(BUILD_EXEEXT) suffix to invocation of make_keys in + ncurses/Makefile (Gentoo #89772). + + modify c++/demo.cc to build with g++ -fno-implicit-templates option + (patch by Mike Frysinger). + + modify tic to filter out long extended names when translating to + termcap format. Only two characters are permissible for termcap + capability names. + +20050430 + + modify terminfo entries xterm-new and rxvt to add strings for + shift-, control-cursor keys. + + workaround to allow c++ binding to compile with g++ 2.95.3, which + has a broken implementation of static_cast<> (patch by Jeff Chua). + + modify initialization of key lookup table so that if an extended + capability (tic -x) string is defined, and its name begins with 'k', + it will automatically be treated as a key. + + modify test/keynames.c to allow for the possibility of extended + key names, e.g., via define_key(), or via "tic -x". + + add test/demo_termcap.c to show the contents of given entry via the + termcap interface. + +20050423 + + minor fixes for vt100/vt52 entries -TD + + add configure option --enable-largefile + + corrected libraries used to build Ada95/gen/gen, found in testing + gcc 4.0.0. + +20050416 + + update config.guess, config.sub + + modify configure script check for _XOPEN_SOURCE, disable that on + Darwin whose header files have problems (patch by Chris Zubrzycki). + + modify form library Is_Printable_String() to use iswprint() rather + than wcwidth() for determining if a character is printable. The + latter caused it to reject menu items containing non-spacing + characters. + + modify ncurses test program's F-test to handle non-spacing characters + by combining them with a reverse-video blank. + + review/fix several gcc -Wconversion warnings. + +20050409 + + correct an off-by-one error in m_driver() for mouse-clicks used to + position the mouse to a particular item. + + implement test/demo_menus.c + + add some checks in lib_mouse to ensure SP is set. + + modify C++ binding to make 20050403 changes work with the configure + --enable-const option. + +20050403 + + modify start_color() to return ERR if it cannot allocate memory. + + address g++ compiler warnings in C++ binding by adding explicit + member initialization, assignment operators and copy constructors. + Most of the changes simply preserve the existing semantics of the + binding, which can leak memory, etc., but by making these features + visible, it provides a framework for improving the binding. + + improve C++ binding using static_cast, etc. + + modify configure script --enable-warnings to add options to g++ to + correspond to the gcc --enable-warnings. + + modify C++ binding to use some C internal functions to make it + compile properly on Solaris (and other platforms). + +20050327 + + amend change from 20050320 to limit it to configurations with a + valid locale. + + fix a bug introduced in 20050320 which broke the translation of + nonprinting characters to uparrow form (report by TAKAHASHI Tamotsu). + +20050326 + + add ifdef's for _LP64 in curses.h to avoid using wasteful 64-bits for + chtype and mmask_t, but add configure option --disable-lp64 in case + anyone used that configuration. + + update misc/shlib script to account for Mac OS X (report by Michail + Vidiassov). + + correct comparison for wrapping multibyte characters in + waddch_literal() (report by TAKAHASHI Tamotsu). + +20050320 + + add -c and -w options to tset to allow user to suppress ncurses' + resizing of the terminal emulator window in the special case where it + is not able to detect the true size (report by Win Delvaux, Debian + #300419). + + modify waddch_nosync() to account for locale zn_CH.GBK, which uses + codes 128-159 as part of multibyte characters (report by WANG + WenRui, Debian #300512). + +20050319 + + modify ncurses.c 'd' test to make it work with 88-color + configuration, i.e., by implementing scrolling. + + improve scrolling in ncurses.c 'c' and 'C' tests, e.g., for 88-color + configuration. + +20050312 + + change tracemunch to use strict checking. + + modify ncurses.c 'p' test to test line-drawing within a pad. + + implement environment variable NCURSES_NO_UTF8_ACS to support + miscellaneous terminal emulators which ignore alternate character + set escape sequences when in UTF-8 mode. + +20050305 + + change NCursesWindow::err_handler() to a virtual function (request by + Steve Beal). + + modify fty_int.c and fty_num.c to handle wide characters (report by + Wolfgang Gutjahr). + + adapt fix for fty_alpha.c to fty_alnum.c, which also handled normal + and wide characters inconsistently (report by Wolfgang Gutjahr). + + update llib-* files to reflect internal interface additions/changes. + +20050226 + + improve test/configure script, adding tests for _XOPEN_SOURCE, etc., + from lynx. + + add aixterm-16color terminfo entry -TD + + modified xterm-new terminfo entry to work with tgetent() changes -TD + + extended changes in tgetent() from 20040710 to allow the substring of + sgr0 which matches rmacs to be at the beginning of the sgr0 string + (request by Thomas Wolff, who says the visual effect in combination + with pre-20040710 ncurses is improved). + + fix off-by-one in winnstr() call which caused form field validation + of multibyte characters to ignore the last character in a field. + + correct logic in winsch() for inserting multibyte strings; the code + would clear cells after the insertion rather than push them to the + right (cf: 20040228). + + fix an inconsistency in Check_Alpha_Field() between normal and wide + character logic (report by Wolfgang Gutjahr). + +20050219 + + fix a bug in editing wide-characters in form library: deleting a + nonwide character modified the previous wide-character. + + update manpage to describe NCURSES_MOUSE_VERSION 2. + + correct manpage description of mouseinterval() (Debian #280687). + + add a note to default_colors.3x explaining why this extension was + added (Debian #295083). + + add traces to panel library. + +20050212 + + improve editing of wide-characters in form library: left/right + cursor movement, and single-character deletions work properly. + + disable GPM mouse support when $TERM happens to be prefixed with + "xterm". Gpm_Open() would otherwise assert that it can deal with + mouse events in this case. + + modify GPM mouse support so it closes the server connection when + the caller disables the mouse (report by Stanislav Ievlev). + +20050205 + + add traces for callback functions in form library. + + add experimental configure option --enable-ext-mouse, which defines + NCURSES_MOUSE_VERSION 2, and modifies the encoding of mouse events to + support wheel mice, which may transmit buttons 4 and 5. This works + with xterm and similar X terminal emulators (prompted by question by + Andreas Henningsson, this is also related to Debian #230990). + + improve configure macros CF_XOPEN_SOURCE and CF_POSIX_C_SOURCE to + avoid redefinition warnings on cygwin. + +20050129 + + merge remaining development changes for extended colors (mostly + complete, does not appear to break other configurations). + + add xterm-88color.dat (part of extended colors testing). + + improve _tracedump() handling of color pairs past 96. + + modify return-value from start_color() to return OK if colors have + already been started. + + modify curs_color.3x list error conditions for init_pair(), + pair_content() and color_content(). + + modify pair_content() to return -1 for consistency with init_pair() + if it corresponds to the default-color. + + change internal representation of default-color to allow application + to use color number 255. This does not affect the total number of + color pairs which are allowed. + + add a top-level tags rule. + +20050122 + + add a null-pointer check in wgetch() in case it is called without + first calling initscr(). + + add some null-pointer checks for SP, which is not set by libtinfo. + + modify misc/shlib to ensure that absolute pathnames are used. + + modify test/Makefile.in, etc., to link test programs only against the + libraries needed, e.g., omit form/menu/panel library for the ones + that are curses-specific. + + change SP->_current_attr to a pointer, adjust ifdef's to ensure that + libtinfo.so and libtinfow.so have the same ABI. The reason for this + is that the corresponding data which belongs to the upper-level + ncurses library has a different size in each model (report by + Stanislav Ievlev). + +20050115 + + minor fixes to allow test-compiles with g++. + + correct column value shown in tic's warnings, which did not account + for leading whitespace. + + add a check in _nc_trans_string() for improperly ended strings, i.e., + where a following line begins in column 1. + + modify _nc_save_str() to return a null pointer on buffer overflow. + + improve repainting while scrolling wide-character data (Eungkyu Song). + +20050108 + + merge some development changes to extend color capabilities. + +20050101 + + merge some development changes to extend color capabilities. + + fix manpage typo (FreeBSD report docs/75544). + + update config.guess, config.sub + > patches by Albert Chin-A-Young (for configure script): + + improved fix to make mbstate_t recognized on HPUX 11i (cf: + 20030705), making vsscanf() prototype visible on IRIX64. Tested for + on HP-UX 11i, Solaris 7, 8, 9, AIX 4.3.3, 5.2, Tru64 UNIX 4.0D, 5.1, + IRIX64 6.5, Redhat Linux 7.1, 9, and RHEL 2.1, 3.0. + + print the result of the --disable-home-terminfo option. + + use -rpath when compiling with SGI C compiler. + +20041225 + + add trace calls to remaining public functions in form and menu + libraries. + + fix check for numeric digits in test/ncurses.c 'b' and 'B' tests. + + fix typo in test/ncurses.c 'c' test from 20041218. + +20041218 + + revise test/ncurses.c 'c' color test to improve use for xterm-88color + and xterm-256color, added 'C' test using the wide-character color_set + and attr_set functions. + +20041211 + + modify configure script to work with Intel compiler. + + fix an limit-check in wadd_wchnstr() which caused labels in the + forms-demo to be one character short. + + fix typo in curs_addchstr.3x (Jared Yanovich). + + add trace calls to most functions in form and menu libraries. + + update working-position for adding wide-characters when window is + scrolled (prompted by related report by Eungkyu Song). + +20041204 + + replace some references on Linux to wcrtomb() which use it to obtain + the length of a multibyte string with _nc_wcrtomb, since wcrtomb() is + broken in glibc (see Debian #284260). + + corrected length-computation in wide-character support for + field_buffer(). + + some fixes to frm_driver.c to allow it to accept multibyte input. + + modify configure script to work with Intel 8.0 compiler. + +20041127 + + amend change to setupterm() in 20030405 which would reuse the value + of cur_term if the same output was selected. This now reuses it only + when setupterm() is called from tgetent(), which has no notion of + separate SCREENs. Note that tgetent() must be called after initscr() + or newterm() to use this feature (Redhat Bugzilla #140326). + + add a check in CF_BUILD_CC macro to ensure that developer has given + the --with-build-cc option when cross-compiling (report by Alexandre + Campo). + + improved configure script checks for _XOPEN_SOURCE and + _POSIX_C_SOURCE (fix for IRIX 5.3 from Georg Schwarz, _POSIX_C_SOURCE + updates from lynx). + + cosmetic fix to test/gdc.c to recolor the bottom edge of the box + for consistency (comment by Dan Nelson). + +20041120 + + update wsvt25 terminfo entry -TD + + modify test/ins_wide.c to test all flavors of ins_wstr(). + + ignore filler-cells in wadd_wchnstr() when adding a cchar_t array + which consists of multi-column characters, since this function + constructs them (cf: 20041023). + + modify winnstr() to return multibyte character strings for the + wide-character configuration. + +20041106 + + fixes to make slk_set() and slk_wset() accept and store multibyte + or multicolumn characters. + +20041030 + + improve color optimization a little by making _nc_do_color() check + if the old/new pairs are equivalent to the default pair 0. + + modify assume_default_colors() to not require that + use_default_colors() be called first. + +20041023 + + modify term_attrs() to use termattrs(), add the extended attributes + such as enter_horizontal_hl_mode for WA_HORIZONTAL to term_attrs(). + + add logic in waddch_literal() to clear orphaned cells when one + multi-column character partly overwrites another. + + improved logic for clearing cells when a multi-column character + must be wrapped to a new line. + + revise storage of cells for multi-column characters to correct a + problem with repainting. In the old scheme, it was possible for + doupdate() to decide that only part of a multi-column character + should be repainted since the filler cells stored only an attribute + to denote them as fillers, rather than the character value and the + attribute. + +20041016 + + minor fixes for traces. + + add SP->_screen_acs_map[], used to ensure that mapping of missing + line-drawing characters is handled properly. For example, ACS_DARROW + is absent from xterm-new, and it was coincidentally displayed the + same as ACS_BTEE. + +20041009 + + amend 20021221 workaround for broken acs to reset the sgr, rmacs + and smacs strings as well. Also modify the check for screen's + limitations in that area to allow the multi-character shift-in + and shift-out which seem to work. + + change GPM initialization, using dl library to load it dynamically + at runtime (Debian #110586). + +20041002 + + correct logic for color pair in setcchar() and getcchar() (patch by + Marcin 'Qrczak' Kowalczyk). + + add t/T commands to ncurses b/B tests to allow a different color to + be tested for the attrset part of the test than is used in the + background color. + +20040925 + + fix to make setcchar() to work when its wchar_t* parameter is + pointing to a string which contains more data than can be converted. + + modify wget_wstr() and example in ncurses.c to work if wchar_t and + wint_t are different sizes (report by Marcin 'Qrczak' Kowalczyk). + +20040918 + + remove check in wget_wch() added to fix an infinite loop, appears to + have been working around a transitory glibc bug, and interferes + with normal operation (report by Marcin 'Qrczak' Kowalczyk). + + correct wadd_wch() and wecho_wch(), which did not pass the rendition + information (report by Marcin 'Qrczak' Kowalczyk). + + fix aclocal.m4 so that the wide-character version of ncurses gets + compiled as libncursesw.5.dylib, instead of libncurses.5w.dylib + (adapted from patch by James J Ramsey). + + change configure script for --with-caps option to indicate that it + is no longer experimental. + + change configure script to reflect the fact that --enable-widec has + not been "experimental" since 5.3 (report by Bruno Lustosa). + +20040911 + + add 'B' test to ncurses.c, to exercise some wide-character functions. + +20040828 + + modify infocmp -i option to match 8-bit controls against its table + entries, e.g., so it can analyze the xterm-8bit entry. + + add morphos terminfo entry, improve amiga-8bit entry (Pavel Fedin). + + correct translation of "%%" in terminfo format to termcap, e.g., + using "tic -C" (Redhat Bugzilla #130921). + + modified configure script CF_XOPEN_SOURCE macro to ensure that if + it defines _POSIX_C_SOURCE, that it defines it to a specific value + (comp.os.stratus newsgroup comment). + +20040821 + + fixes to build with Ada95 binding with gnat 3.4 (all warnings are + fatal, and gnat does not follow the guidelines for pragmas). + However that did find a coding error in Assume_Default_Colors(). + + modify several terminfo entries to ensure xterm mouse and cursor + visibility are reset in rs2 string: hurd, putty, gnome, + konsole-base, mlterm, Eterm, screen (Debian #265784, #55637). The + xterm entries are left alone - old ones for compatibility, and the + new ones do not require this change. -TD + +20040814 + + fake a SIGWINCH in newterm() to accommodate buggy terminal emulators + and window managers (Debian #265631). + > terminfo updates -TD + + remove dch/dch1 from rxvt because they are implemented inconsistently + with the common usage of bce/ech + + remove khome from vt220 (vt220's have no home key) + + add rxvt+pcfkeys + +20040807 + + modify test/ncurses.c 'b' test, adding v/V toggles to cycle through + combinations of video attributes so that for instance bold and + underline can be tested. This made the legend too crowded, added + a help window as well. + + modify test/ncurses.c 'b' test to cycle through default colors if + the -d option is set. + + update putty terminfo entry (Robert de Bath). + +20040731 + + modify test/cardfile.c to allow it to read more data than can be + displayed. + + correct logic in resizeterm.c which kept it from processing all + levels of window hierarchy (reports by Folkert van Heusden, + Chris Share). + +20040724 + + modify "tic -cv" to ignore delays when comparing strings. Also + modify it to ignore a canceled sgr string, e.g., for terminals which + cannot properly combine attributes in one control sequence. + + corrections for gnome and konsole entries (Redhat Bugzilla #122815, + patch by Hans de Goede) + > terminfo updates -TD + + make ncsa-m rmacs/smacs consistent with sgr + + add sgr, rc/sc and ech to syscons entries + + add function-keys to decansi + + add sgr to mterm-ansi + + add sgr, civis, cnorm to emu + + correct/simplify cup in addrinfo + +20040717 + > terminfo updates -TD + + add xterm-pc-fkeys + + review/update gnome and gnome-rh90 entries (prompted by Redhat + Bugzilla #122815). + + review/update konsole entries + + add sgr, correct sgr0 for kterm and mlterm + + correct tsl string in kterm + +20040711 + + add configure option --without-xterm-new + +20040710 + + add check in wget_wch() for printable bytes that are not part of a + multibyte character. + + modify wadd_wchnstr() to render text using window's background + attributes. + + improve tic's check to compare sgr and sgr0. + + fix c++ directory's .cc.i rule. + + modify logic in tgetent() which adjusts the termcap "me" string + to work with ISO-2022 string used in xterm-new (cf: 20010908). + + modify tic's check for conflicting function keys to omit that if + converting termcap to termcap format. + + add -U option to tic and infocmp. + + add rmam/smam to linux terminfo entry (Trevor Van Bremen) + > terminfo updates -TD + + minor fixes for emu + + add emu-220 + + change wyse acsc strings to use 'i' map rather than 'I' + + fixes for avatar0 + + fixes for vp3a+ + +20040703 + + use tic -x to install terminfo database -TD + + add -x to infocmp's usage message. + + correct field used for comparing O_ROWMAJOR in set_menu_format() + (report/patch by Tony Li). + + fix a missing nul check in set_field_buffer() from 20040508 changes. + > terminfo updates -TD + + make xterm-xf86-v43 derived from xterm-xf86-v40 rather than + xterm-basic -TD + + align with xterm patch #192's use of xterm-new -TD + + update xterm-new and xterm-8bit for cvvis/cnorm strings -TD + + make xterm-new the default "xterm" entry -TD + +20040626 + + correct BUILD_CPPFLAGS substitution in ncurses/Makefile.in, to allow + cross-compiling from a separate directory tree (report/patch by + Dan Engel). + + modify is_term_resized() to ensure that window sizes are nonzero, + as documented in the manpage (report by Ian Collier). + + modify CF_XOPEN_SOURCE configure macro to make Hurd port build + (Debian #249214, report/patch by Jeff Bailey). + + configure-script mods from xterm, e.g., updates to CF_ADD_CFLAGS + + update config.guess, config.sub + > terminfo updates -TD + + add mlterm + + add xterm-xf86-v44 + + modify xterm-new aka xterm-xfree86 to accommodate luit, which + relies on G1 being used via an ISO-2022 escape sequence (report by + Juliusz Chroboczek) + + add 'hurd' entry + +20040619 + + reconsidered winsnstr(), decided after comparing other + implementations that wrapping is an X/Open documentation error. + + modify test/inserts.c to test all flavors of insstr(). + +20040605 + + add setlocale() calls to a few test programs which may require it: + demo_forms.c, filter.c, ins_wide.c, inserts.c + + correct a few misspelled function names in ncurses-intro.html (report + by Tony Li). + + correct internal name of key_defined() manpage, which conflicted with + define_key(). + +20040529 + + correct size of internal pad used for holding wide-character + field_buffer() results. + + modify data_ahead() to work with wide-characters. + +20040522 + + improve description of terminfo if-then-else expressions (suggested + by Arne Thomassen). + + improve test/ncurses.c 'd' test, allow it to use external file for + initial palette (added xterm-16color.dat and linux-color.dat), and + reset colors to the initial palette when starting/ending the test. + + change limit-check in init_color() to allow r/g/b component to + reach 1000 (cf: 20020928). + +20040516 + + modify form library to use cchar_t's rather than char's in the + wide-character configuration for storing data for field buffers. + + correct logic of win_wchnstr(), which did not work for more than + one cell. + +20040508 + + replace memset/memcpy usage in form library with for-loops to + simplify changing the datatype of FIELD.buf, part of wide-character + changes. + + fix some inconsistent use of #if/#ifdef (report by Alain Guibert). + +20040501 + + modify menu library to account for actual number of columns used by + multibyte character strings, in the wide-character configuration + (adapted from patch by Philipp Tomsich). + + add "-x" option to infocmp like tic's "-x", for use in "-F" + comparisons. This modifies infocmp to only report extended + capabilities if the -x option is given, making this more consistent + with tic. Some scripts may break, since infocmp previous gave this + information without an option. + + modify termcap-parsing to retain 2-character aliases at the beginning + of an entry if the "-x" option is used in tic. + +20040424 + + minor compiler-warning and test-program fixes. + +20040417 + + modify tic's missing-sgr warning to apply to terminfo only. + + free some memory leaks in tic. + + remove check in post_menu() that prevented menus from extending + beyond the screen (request by Max J. Werner). + + remove check in newwin() that prevents allocating windows + that extend beyond the screen. Solaris curses does this. + + add ifdef in test/color_set.c to allow it to compile with older + curses. + + add napms() calls to test/dots.c to make it not be a CPU hog. + +20040403 + + modify unctrl() to return null if its parameter does not correspond + to an unsigned char. + + add some limit-checks to guard isprint(), etc., from being used on + values that do not fit into an unsigned char (report by Sami Farin). + +20040328 + + fix a typo in the _nc_get_locale() change. + +20040327 + + modify _nc_get_locale() to use setlocale() to query the program's + current locale rather than using getenv(). This fixes a case in tin + which relies on legacy treatment of 8-bit characters when the locale + is not initialized (reported by Urs Jansen). + + add sgr string to screen's and rxvt's terminfo entries -TD. + + add a check in tic for terminfo entries having an sgr0 but no sgr + string. This confuses Tru64 and HPUX curses when combined with + color, e.g., making them leave line-drawing characters in odd places. + + correct casts used in ABSENT_BOOLEAN, CANCELLED_BOOLEAN, matches the + original definitions used in Debian package to fix PowerPC bug before + 20030802 (Debian #237629). + +20040320 + + modify PutAttrChar() and PUTC() macro to improve use of + A_ALTCHARSET attribute to prevent line-drawing characters from + being lost in situations where the locale would otherwise treat the + raw data as nonprintable (Debian #227879). + +20040313 + + fix a redefinition of CTRL() macro in test/view.c for AIX 5.2 (report + by Jim Idle). + + remove ".PP" after ".SH NAME" in a few manpages; this confuses + some apropos script (Debian #237831). + +20040306 + + modify ncurses.c 'r' test so editing commands, like inserted text, + set the field background, and the state of insert/overlay editing + mode is shown in that test. + + change syntax of dummy targets in Ada95 makefiles to work with pmake. + + correct logic in test/ncurses.c 'b' for noncolor terminals which + did not recognize a quit-command (cf: 20030419). + +20040228 + + modify _nc_insert_ch() to allow for its input to be part of a + multibyte string. + + split out lib_insnstr.c, to prepare to rewrite it. X/Open states + that this function performs wrapping, unlike all of the other + insert-functions. Currently it does not wrap. + + check for nl_langinfo(CODESET), use it if available (report by + Stanislav Ievlev). + + split-out CF_BUILD_CC macro, actually did this for lynx first. + + fixes for configure script CF_WITH_DBMALLOC and CF_WITH_DMALLOC, + which happened to work with bash, but not with Bourne shell (report + by Marco d'Itri via tin-dev). + +20040221 + + some changes to adapt the form library to wide characters, incomplete + (request by Mike Aubury). + + add symbol to curses.h which can be used to suppress include of + stdbool.h, e.g., + #define NCURSES_ENABLE_STDBOOL_H 0 + #include + (discussion on XFree86 mailing list). + +20040214 + + modify configure --with-termlib option to accept a value which sets + the name of the terminfo library. This would allow a packager to + build libtinfow.so renamed to coincide with libtinfo.so (discussion + with Stanislav Ievlev). + + improve documentation of --with-install-prefix, --prefix and + $(DESTDIR) in INSTALL (prompted by discussion with Paul Lew). + + add configure check if the compiler can use -c -o options to rename + its output file, use that to omit the 'cd' command which was used to + ensure object files are created in a separate staging directory + (prompted by comments by Johnny Wezel, Martin Mokrejs). + 20040208 5.4 release for upload to ftp.gnu.org + update TO-DO. @@ -6014,7 +6791,8 @@ Changes since 1.9.9e are recorded by Thomas Dickey. + added has_key() + added 't' to ncurses.c test. + moved delay_output() to lib_tputs.c - + removed tparam(). + + removed tparam() (was added in 1.9.9, but conflicts with emacs and + is not part of X/Open Curses). + misc cursor & optimization fixes. 960504 - snapshot diff --git a/README b/README index 6fd3098d..37cb8d2b 100644 --- a/README +++ b/README @@ -1,4 +1,4 @@ --- $Id: README,v 1.21 2003/02/08 19:36:39 tom Exp $ +-- $Id: README,v 1.22 2004/08/07 23:42:43 tom Exp $ ------------------------------------------------------------------------------- README file for the ncurses package @@ -64,7 +64,7 @@ install.libs' rule as libncurses++. In the `Ada95' directory, you'll find code and documentation for an Ada95 binding of the curses API, to be used with the GNAT compiler. This binding is built by a normal top-level `make' if configure detects -an usable version of GNAT (3.10 or above). It is not installed automatically. +an usable version of GNAT (3.11 or above). It is not installed automatically. See the Ada95 directory for more build and installation instructions and for documentation of the binding. diff --git a/README.emx b/README.emx index 0605e67b..3a5ca1a1 100644 --- a/README.emx +++ b/README.emx @@ -1,4 +1,4 @@ --- $Id: README.emx,v 1.6 2002/09/07 17:03:19 tom Exp $ +-- $Id: README.emx,v 1.7 2005/08/27 17:04:26 tom Exp $ -- Author: Thomas Dickey ------------------------------------------------------------------------------- @@ -21,8 +21,8 @@ Apply the autoconf patches from These are ordered by date: - autoconf-2.13-20020210.patch.gz - autoconf-2.13-20020210-emx.patch.gz + autoconf-2.13-20030927.patch.gz + autoconf-2.13-20030927-emx.patch.gz I built my development environment for ncurses using EMX 0.9c at the end of 1997. Much of the EMX patch for autoconf was done originally by J.J.G.Ripoll, diff --git a/TO-DO b/TO-DO index a689447b..caefedd8 100644 --- a/TO-DO +++ b/TO-DO @@ -1,77 +1,72 @@ --- $Id: TO-DO,v 1.43 2004/02/08 21:09:00 tom Exp $ +-- $Id: TO-DO,v 1.45 2005/08/20 20:53:04 tom Exp $ SHORT-TERM TO-DO ITEMS: Known Problems: -* The form/menu libraries do not use wide-character features. ++ libtool does not work with GNAT. -* Some users would like to build a single version of libtinfo which can be - used from either libncursesw or libncurses. - -* libtool does not work with GNAT. - -* The screen optimization has been tested only in an ad hoc manner. We should ++ The screen optimization has been tested only in an ad hoc manner. We should develop a good set of regression tests to cover lib_doupdate.c and lib_mvcur.c. -* Magic cookie support does not work, since the logic does not take into account - refresh. Also, the initial optimize does not adjust the current location - when a cookie is emitted. ++ Magic cookie support does not work, since the logic does not take into + account refresh. Also, the initial optimize does not adjust the current + location when a cookie is emitted. -* Scrolling optimization has holes: for example, it forces repaints of the ++ Scrolling optimization has holes: for example, it forces repaints of the screen between calls to refresh(). -* SVr4 uses slightly different rules for determining when softkeys are shown. ++ SVr4 uses slightly different rules for determining when softkeys are shown. For example, they are initially displayed (before the ncurses 'e' test activates them), and a touchwin can apparently also force them to be displayed. -* The code departs from perfect 8-bit cleanness in one respect; you cannot - specify a character \200 as part of a capability string, because the terminfo - library interprets \200 as a request to embed NUL (\000) at that point. This - is a legacy terminfo property we can't mess with. ++ The code departs from perfect 8-bit cleanness in one respect; you cannot + specify a character \200 as part of a capability string, because the + terminfo library interprets \200 as a request to embed NUL (\000) at that + point. This is a legacy terminfo property we can't mess with. -* The window classes defined in the c++ subdirectory need documentation. - Some C++ programmer could earn a lot of good karma by doing this... ++ The window classes defined in the c++ subdirectory need documentation. Some + C++ programmer could earn a lot of good karma by doing this... -* The resizeterm() function does not handle ripped-off lines such as that - done for the slk_XXX functions. ++ The resizeterm() function does not handle ripped-off lines such as that done + for the slk_XXX functions. Portability (or lack thereof): -* Users of older System V UNIXes (but not Solaris, and probably not SVr4) - may trip over a known problem with the signal-handling code which causes - abrupt termination of ncurses applications following resume from a ^Z - suspend (this problem was first seen running lynx). You will not see - this problem if you are running Linux or one of the 4.4BSD derivatives - like FreeBSD, NetBSD, or BSDI. For details, see the analysis in the - header comment of ncurses/tty/lib_tstp.c . ++ Users of older System V UNIXes (but not Solaris, and probably not SVr4) may + trip over a known problem with the signal-handling code which causes abrupt + termination of ncurses applications following resume from a ^Z suspend (this + problem was first seen running lynx). You will not see this problem if you + are running Linux or one of the 4.4BSD derivatives like FreeBSD, NetBSD, or + BSDI. For details, see the analysis in the header comment of + ncurses/tty/lib_tstp.c . -* In theory, vwprintw and vwscanf are supposed to use the older varargs.h ++ In theory, vwprintw and vwscanf are supposed to use the older varargs.h interface for handling variadic argument lists. Linux doesn't have - varargs.h, it has the newer X/Open-standard stdargs.h equivalent. So - these functions use stdargs instead. This is unlikely to be a problem - unless you're building ncurses on a System V old enough to only have - varargs.h. (Solaris 2.5.1 uses the stdarg.h binding as well). + varargs.h, it has the newer X/Open-standard stdargs.h equivalent. So these + functions use stdargs instead. This is unlikely to be a problem unless + you're building ncurses on a System V old enough to only have varargs.h. + (Solaris 2.5.1 uses the stdarg.h binding as well). -* If you're using a BSD earlier than 4.4BSD, or a Linux old enough not to - have a native vsscanf(3) in its library, vwscanw() will not work. You lose. - (It should work on any System V, however). If you want to fix this, add - an implementation to ncurses/vsscanf.c. ++ If you're using a BSD earlier than 4.4BSD, or a Linux old enough not to have + a native vsscanf(3) in its library, vwscanw() will not work. You lose. (It + should work on any System V, however). If you want to fix this, add an + implementation to ncurses/vsscanf.c. -* The C++ binding fails to build with a few C++ compilers, mainly with ++ The C++ binding fails to build with a few C++ compilers, mainly with configure script problems with vsscanf(). -* terminfo.5 does not format with the SunOS (and most other platform's) tbl - utility because it relies on a diversion for each table entry. Get the groff - package. ++ terminfo.5 does not format with the SunOS (and most other platform's) tbl + utility because it relies on a diversion for each table entry. Get the + groff package. Untested features: -* The code for the HP color model using set_color_pair is untested. ++ The code for the HP color model using set_color_pair is untested. -* The code for handling soft labels on a terminal type with built-in support ++ The code for handling soft labels on a terminal type with built-in support for them (num_labels > 0, label_height, label_width, label_format, label_off, label_on, plab_norm, lab_f*) has not been tested. The label_format and lab_f* capabilities aren't presently used. @@ -87,7 +82,7 @@ supporting internationalization. 2. DOS port -Only 16 of the 55 files in the library depend on the terminfo format. +Only a few of the files in the library depend on the terminfo format. It should be possible to further kernelize the package, then rewrite a small number of core files to produce a functionally-compatible port that would do updates to a memory-mapped screen area. The first diff --git a/aclocal.m4 b/aclocal.m4 index a70a64e1..8cbe58ab 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * +dnl Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * dnl copy of this software and associated documentation files (the * @@ -26,15 +26,38 @@ dnl sale, use or other dealings in this Software without prior written * dnl authorization. * dnl*************************************************************************** dnl -dnl Author: Thomas E. Dickey 1995-2003 +dnl Author: Thomas E. Dickey 1995-on dnl -dnl $Id: aclocal.m4,v 1.333 2004/01/30 20:59:56 tom Exp $ +dnl $Id: aclocal.m4,v 1.373 2005/09/24 21:58:59 tom Exp $ dnl Macros used in NCURSES auto-configuration script. dnl dnl See http://invisible-island.net/autoconf/ for additional information. dnl dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- +dnl AM_LANGINFO_CODESET version: 3 updated: 2002/10/27 23:21:42 +dnl ------------------- +dnl Inserted as requested by gettext 0.10.40 +dnl File from /usr/share/aclocal +dnl codeset.m4 +dnl ==================== +dnl serial AM1 +dnl +dnl From Bruno Haible. +AC_DEFUN([AM_LANGINFO_CODESET], +[ + AC_CACHE_CHECK([for nl_langinfo and CODESET], am_cv_langinfo_codeset, + [AC_TRY_LINK([#include ], + [char* cs = nl_langinfo(CODESET);], + am_cv_langinfo_codeset=yes, + am_cv_langinfo_codeset=no) + ]) + if test $am_cv_langinfo_codeset = yes; then + AC_DEFINE(HAVE_LANGINFO_CODESET, 1, + [Define if you have and nl_langinfo(CODESET).]) + fi +])dnl +dnl --------------------------------------------------------------------------- dnl CF_ADA_INCLUDE_DIRS version: 4 updated: 2002/12/01 00:12:15 dnl ------------------- dnl Construct the list of include-options for the C programs in the Ada95 @@ -59,18 +82,44 @@ fi AC_SUBST(ACPPFLAGS) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_ADD_CFLAGS version: 5 updated: 2002/12/01 00:12:15 +dnl CF_ADD_CFLAGS version: 7 updated: 2004/04/25 17:48:30 dnl ------------- dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS dnl The second parameter if given makes this macro verbose. +dnl +dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, +dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily +dnl confused by the quotes (which require backslashes to keep them usable). AC_DEFUN([CF_ADD_CFLAGS], [ +cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= +cf_new_extra_cppflags= + for cf_add_cflags in $1 do +case $cf_fix_cppflags in +no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; @@ -83,6 +132,17 @@ do cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac done if test -n "$cf_new_cflags" ; then @@ -95,6 +155,13 @@ if test -n "$cf_new_cppflags" ; then CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi +if test -n "$cf_new_extra_cppflags" ; then + ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +AC_SUBST(EXTRA_CPPFLAGS) + ])dnl dnl --------------------------------------------------------------------------- dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34 @@ -282,7 +349,98 @@ if test "$cf_cv_type_of_bool" = unknown ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CFG_DEFAULTS version: 6 updated: 2003/07/12 15:15:19 +dnl CF_BUILD_CC version: 5 updated: 2005/09/24 17:55:52 +dnl ----------- +dnl If we're cross-compiling, allow the user to override the tools and their +dnl options. The configure script is oriented toward identifying the host +dnl compiler, etc., but we need a build compiler to generate parts of the +dnl source. +dnl +dnl $1 = default for $CPPFLAGS +dnl $2 = default for $LIBS +AC_DEFUN([CF_BUILD_CC],[ +AC_REQUIRE([CF_PROG_EXT]) +if test "$cross_compiling" = yes ; then + + # defaults that we might want to override + : ${BUILD_CFLAGS:=''} + : ${BUILD_CPPFLAGS:='ifelse([$1],,,[$1])'} + : ${BUILD_LDFLAGS:=''} + : ${BUILD_LIBS:='ifelse([$2],,,[$2])'} + : ${BUILD_EXEEXT:='$x'} + : ${BUILD_OBJEXT:='o'} + + AC_ARG_WITH(build-cc, + [ --with-build-cc=XXX the build C compiler ($BUILD_CC)], + [BUILD_CC="$withval"], + [AC_CHECK_PROGS(BUILD_CC, gcc cc cl)]) + AC_MSG_CHECKING(for native build C compiler) + AC_MSG_RESULT($BUILD_CC) + + AC_MSG_CHECKING(for native build C preprocessor) + AC_ARG_WITH(build-cpp, + [ --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP)], + [BUILD_CPP="$withval"], + [BUILD_CPP='$(BUILD_CC) -E']) + AC_MSG_RESULT($BUILD_CPP) + + AC_MSG_CHECKING(for native build C flags) + AC_ARG_WITH(build-cflags, + [ --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS)], + [BUILD_CFLAGS="$withval"]) + AC_MSG_RESULT($BUILD_CFLAGS) + + AC_MSG_CHECKING(for native build C preprocessor-flags) + AC_ARG_WITH(build-cppflags, + [ --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS)], + [BUILD_CPPFLAGS="$withval"]) + AC_MSG_RESULT($BUILD_CPPFLAGS) + + AC_MSG_CHECKING(for native build linker-flags) + AC_ARG_WITH(build-ldflags, + [ --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS)], + [BUILD_LDFLAGS="$withval"]) + AC_MSG_RESULT($BUILD_LDFLAGS) + + AC_MSG_CHECKING(for native build linker-libraries) + AC_ARG_WITH(build-libs, + [ --with-build-libs=XXX the build libraries ($(BUILD_LIBS)], + [BUILD_LIBS="$withval"]) + AC_MSG_RESULT($BUILD_LIBS) + + # this assumes we're on Unix. + BUILD_EXEEXT= + BUILD_OBJEXT=o + + : ${BUILD_CC:='$(CC)'} + + if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '$(CC)' ) ; then + AC_MSG_ERROR([Cross-build requires two compilers. +Use --with-build-cc to specify the native compiler.]) + fi + +else + : ${BUILD_CC:='$(CC)'} + : ${BUILD_CPP:='$(CPP)'} + : ${BUILD_CFLAGS:='$(CFLAGS)'} + : ${BUILD_CPPFLAGS:='$(CPPFLAGS)'} + : ${BUILD_LDFLAGS:='$(LDFLAGS)'} + : ${BUILD_LIBS:='$(LIBS)'} + : ${BUILD_EXEEXT:='$x'} + : ${BUILD_OBJEXT:='o'} +fi + +AC_SUBST(BUILD_CC) +AC_SUBST(BUILD_CPP) +AC_SUBST(BUILD_CFLAGS) +AC_SUBST(BUILD_CPPFLAGS) +AC_SUBST(BUILD_LDFLAGS) +AC_SUBST(BUILD_LIBS) +AC_SUBST(BUILD_EXEEXT) +AC_SUBST(BUILD_OBJEXT) +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CFG_DEFAULTS version: 7 updated: 2005/09/24 16:15:00 dnl --------------- dnl Determine the default configuration into which we'll install ncurses. This dnl can be overridden by the user's command-line options. There's two items to @@ -300,7 +458,7 @@ AC_MSG_CHECKING(for prefix) if test "x$prefix" = "xNONE" ; then case "$cf_cv_system_name" in # non-vendor systems don't have a conflict - openbsd*|netbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu) + openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu) prefix=/usr ;; *) prefix=$ac_default_prefix @@ -359,7 +517,7 @@ AC_MSG_RESULT($cf_cv_cgetent) test "$cf_cv_cgetent" = yes && AC_DEFINE(HAVE_BSD_CGETENT) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_CACHE version: 9 updated: 2004/01/30 15:59:13 +dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31 dnl -------------- dnl Check if we're accidentally using a cache from a different machine. dnl Derive the system name, as a check for reusing the autoconf cache. @@ -373,7 +531,7 @@ dnl Note: we would use $ac_config_sub, but that is one of the places where dnl autoconf 2.5x broke compatibility with autoconf 2.13 AC_DEFUN([CF_CHECK_CACHE], [ -if test -f $srcdir/config.guess ; then +if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then ifelse([$1],,[AC_CANONICAL_HOST],[$1]) system_name="$host_os" else @@ -485,6 +643,62 @@ fi test "$cf_cv_cpp_param_init" = yes && AC_DEFINE(CPP_HAS_PARAM_INIT) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_CPP_STATIC_CAST version: 1 updated: 2005/07/23 16:52:43 +dnl ------------------ +dnl Check if the C++ compiler accepts static_cast in generics. This appears to +dnl not be supported in g++ before 3.0 +AC_DEFUN([CF_CPP_STATIC_CAST], +[ +if test -n "$CXX"; then + +AC_CACHE_CHECK(if $CXX accepts static_cast,cf_cv_cpp_static_cast,[ + AC_LANG_SAVE + AC_LANG_CPLUSPLUS + + AC_TRY_COMPILE([ +class NCursesPanel +{ +public: + NCursesPanel(int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0) + { + } + + ~NCursesPanel(); +}; + +template class NCursesUserPanel : public NCursesPanel +{ +public: + NCursesUserPanel (int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = static_cast(0)) + : NCursesPanel (nlines, ncols, begin_y, begin_x) + { + }; + NCursesUserPanel(const T* p_UserData = static_cast(0)) : NCursesPanel() + { + }; + + virtual ~NCursesUserPanel() {}; +}; +],[ + const char* p_UserData = static_cast(0)], + [cf_cv_cpp_static_cast=yes], + [cf_cv_cpp_static_cast=no]) + + AC_LANG_RESTORE +]) + +fi + +test "$cf_cv_cpp_static_cast" = yes && AC_DEFINE(CPP_HAS_STATIC_CAST) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_CPP_VSCAN_FUNC version: 5 updated: 2001/12/02 01:39:28 dnl ----------------- dnl Check if the g++ compiler supports vscan function (not a standard feature). @@ -627,6 +841,41 @@ AC_MSG_RESULT($cf_result) CXXFLAGS="$cf_save_CXXFLAGS" ]) dnl --------------------------------------------------------------------------- +dnl CF_FUNC_DLSYM version: 1 updated: 2004/06/16 20:52:45 +dnl ------------- +dnl Test for dlsym() and related functions, as well as libdl. +dnl +dnl Sets +dnl $cf_have_dlsym +dnl $cf_have_libdl +AC_DEFUN([CF_FUNC_DLSYM],[ +cf_have_dlsym=no +AC_CHECK_FUNC(dlsym,cf_have_dlsym=yes,[ + +cf_have_libdl=no +AC_CHECK_LIB(dl,dlsym,[ + cf_have_dlsym=yes + cf_have_libdl=yes])]) + +if test "$cf_have_dlsym" = yes ; then + test "$cf_have_libdl" = yes && LIBS="-ldl $LIBS" + + AC_MSG_CHECKING(whether able to link to dl*() functions) + AC_TRY_LINK([#include ],[ + void *obj; + if ((obj = dlopen("filename", 0)) != 0) { + if (dlsym(obj, "symbolname") == 0) { + dlclose(obj); + } + }],[ + AC_DEFINE(HAVE_LIBDL)],[ + AC_MSG_ERROR(Cannot link test program for libdl)]) + AC_MSG_RESULT(ok) +else + AC_MSG_ERROR(Cannot find dlsym function) +fi +]) +dnl --------------------------------------------------------------------------- dnl CF_FUNC_MEMMOVE version: 5 updated: 2000/08/12 23:18:52 dnl --------------- dnl Check for memmove, or a bcopy that can handle overlapping copy. If neither @@ -658,6 +907,40 @@ int main() { fi ])])dnl dnl --------------------------------------------------------------------------- +dnl CF_FUNC_NANOSLEEP version: 1 updated: 2005/07/02 15:38:12 +dnl ----------------- +dnl Check for existence of workable nanosleep() function. Some systems, e.g., +dnl AIX 4.x, provide a non-working version. +AC_DEFUN([CF_FUNC_NANOSLEEP],[ +AC_CACHE_CHECK(if nanosleep really works,cf_cv_func_nanosleep,[ +AC_TRY_RUN([ +#include +#include +#include + +#ifdef HAVE_SYS_TIME_H +#include +#endif + +int main() { + struct timespec ts1, ts2; + int code; + ts1.tv_sec = 0; + ts1.tv_nsec = 750000000; + ts2.tv_sec = 0; + ts2.tv_nsec = 0; + errno = 0; + code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */ + exit(code != 0); +} +], + [cf_cv_func_nanosleep=yes], + [cf_cv_func_nanosleep=no], + [cf_cv_func_nanosleep=unknown])]) + +test "$cf_cv_func_nanosleep" = "yes" && AC_DEFINE(HAVE_NANOSLEEP) +]) +dnl --------------------------------------------------------------------------- dnl CF_FUNC_POLL version: 2 updated: 2000/02/06 01:38:04 dnl ------------ dnl See if the poll function really works. Some platforms have poll(), but @@ -761,7 +1044,7 @@ esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GCC_ATTRIBUTES version: 9 updated: 2002/12/21 19:25:52 +dnl CF_GCC_ATTRIBUTES version: 10 updated: 2005/05/28 13:16:28 dnl ----------------- dnl Test for availability of useful gcc __attribute__ directives to quiet dnl compiler warnings. Though useful, not all are supported -- and contrary @@ -809,18 +1092,18 @@ int main(int argc GCC_UNUSED, char *argv[[]] GCC_UNUSED) { return 0; } EOF for cf_attribute in scanf printf unused noreturn do - CF_UPPER(CF_ATTRIBUTE,$cf_attribute) + CF_UPPER(cf_ATTRIBUTE,$cf_attribute) cf_directive="__attribute__(($cf_attribute))" echo "checking for $CC $cf_directive" 1>&AC_FD_CC case $cf_attribute in scanf|printf) cat >conftest.h <conftest.h < conftest.$ac_ext < conftest.$ac_ext <>conftest.ads <>conftest.adb <&AC_FD_CC 2>&1 ) ; then +ifelse($3,, :,[ $3]) +ifelse($4,,,[else + $4]) +fi +rm -f conftest* +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_GNAT_TRY_RUN version: 3 updated: 2004/08/21 19:02:08 dnl --------------- dnl Verify that a test program compiles and runs with GNAT dnl $cf_ada_make is set to the program that compiles/links +dnl $ADAFLAGS may be set to the GNAT flags. +dnl +dnl $1 is the text of the spec +dnl $2 is the text of the body +dnl $3 is the shell command to execute if successful +dnl $4 is the shell command to execute if not successful AC_DEFUN([CF_GNAT_TRY_RUN], [ rm -f conftest* @@ -926,7 +1290,7 @@ CF_EOF cat >>conftest.adb <&AC_FD_CC 2>&1 ) ; then +if ( $cf_ada_make $ADAFLAGS conftest 1>&AC_FD_CC 2>&1 ) ; then if ( ./conftest 1>&AC_FD_CC 2>&1 ) ; then ifelse($3,, :,[ $3]) ifelse($4,,,[ else @@ -967,7 +1331,7 @@ case $cf_gnat_version in esac ]) dnl --------------------------------------------------------------------------- -dnl CF_GNU_SOURCE version: 3 updated: 2000/10/29 23:30:53 +dnl CF_GNU_SOURCE version: 6 updated: 2005/07/09 13:23:07 dnl ------------- dnl Check if we must define _GNU_SOURCE to get a reasonable value for dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect @@ -1041,7 +1405,7 @@ if test "$GXX" = yes; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_GXX_VERSION version: 3 updated: 2003/09/06 19:16:21 +dnl CF_GXX_VERSION version: 5 updated: 2005/08/27 09:53:42 dnl -------------- dnl Check for version of g++ AC_DEFUN([CF_GXX_VERSION],[ @@ -1049,11 +1413,128 @@ AC_REQUIRE([AC_PROG_CPP]) GXX_VERSION=none if test "$GXX" = yes; then AC_MSG_CHECKING(version of g++) - GXX_VERSION="`${CXX-g++} --version|sed -e '2,$d'`" + GXX_VERSION="`${CXX-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[[^0-9.]]*//' -e 's/[[^0-9.]].*//'`" + test -z "$GXX_VERSION" && GXX_VERSION=unknown AC_MSG_RESULT($GXX_VERSION) fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF_GXX_WARNINGS version: 5 updated: 2005/08/13 14:54:38 +dnl --------------- +dnl Check if the compiler supports useful warning options. +dnl +dnl Most of gcc's options apply to g++, except: +dnl -Wbad-function-cast +dnl -Wmissing-declarations +dnl -Wnested-externs +dnl +dnl Omit a few (for now): +dnl -Winline +dnl +dnl Parameter: +dnl $1 is an optional list of g++ warning flags that a particular +dnl application might want to use, e.g., "no-unused" for +dnl -Wno-unused +dnl Special: +dnl If $with_ext_const is "yes", add a check for -Wwrite-strings +dnl +AC_DEFUN([CF_GXX_WARNINGS], +[ + +CF_INTEL_COMPILER(GXX,INTEL_CPLUSPLUS,CXXFLAGS) + +AC_REQUIRE([CF_GXX_VERSION]) + +AC_LANG_SAVE +AC_LANG_CPLUSPLUS + +cat > conftest.$ac_ext < +#include + ],[ + /* if transitional largefile support is setup, this is true */ + extern struct dirent64 * readdir(DIR *); + struct dirent64 *x = readdir((DIR *)0); + struct dirent *y = readdir((DIR *)0); + int z = x - y; + ], + [cf_cv_struct_dirent64=yes], + [cf_cv_struct_dirent64=no]) + ]) + test "$cf_cv_struct_dirent64" = yes && AC_DEFINE(HAVE_STRUCT_DIRENT64) +]) +]) +dnl --------------------------------------------------------------------------- dnl CF_LIBUTF8 version: 2 updated: 2002/01/19 22:51:32 dnl ---------- dnl Check for libutf8 @@ -1138,7 +1692,7 @@ ifelse($1,,,[$1=$LIB_PREFIX]) AC_SUBST(LIB_PREFIX) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_LIB_RULES version: 30 updated: 2004/01/10 15:50:50 +dnl CF_LIB_RULES version: 36 updated: 2005/05/28 13:16:28 dnl ------------ dnl Append definitions and rules for the given models to the subdirectory dnl Makefiles, and the recursion rule for the top-level Makefile. If the @@ -1170,13 +1724,33 @@ do case "$cf_cv_shlib_version" in #(vi rel) #(vi case "$cf_cv_system_name" in #(vi - darwin*) cf_suffix='.$(REL_VERSION)'"$cf_suffix" ;; #(vi + darwin*) + case .${LIB_SUFFIX} in + .w*) + cf_suffix=`echo $cf_suffix | sed 's/^w//'` + cf_suffix=w'.$(REL_VERSION)'"$cf_suffix" + ;; + *) + cf_suffix='.$(REL_VERSION)'"$cf_suffix" + ;; + esac + ;; #(vi *) cf_suffix="$cf_suffix"'.$(REL_VERSION)' ;; esac ;; abi) case "$cf_cv_system_name" in #(vi - darwin*) cf_suffix='.$(ABI_VERSION)'"$cf_suffix" ;; #(vi + darwin*) + case .${LIB_SUFFIX} in + .w*) + cf_suffix=`echo $cf_suffix | sed 's/^w//'` + cf_suffix=w'.$(ABI_VERSION)'"$cf_suffix" + ;; + *) + cf_suffix='.$(ABI_VERSION)'"$cf_suffix" + ;; + esac + ;; #(vi *) cf_suffix="$cf_suffix"'.$(ABI_VERSION)' ;; esac ;; @@ -1199,7 +1773,7 @@ do cf_subsets="$LIB_SUBSETS" cf_termlib=`echo "$cf_subsets" |sed -e 's/ .*$//'` if test "$cf_termlib" != "$cf_subsets" ; then - cf_item=`echo $LIBS_TO_MAKE |sed -e s%$LIB_NAME%$TINFO_NAME%g` + cf_item=`echo $LIBS_TO_MAKE |sed -e s%${LIB_NAME}${LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g` LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE" fi else @@ -1222,10 +1796,26 @@ do for cf_item in $CF_LIST_MODELS do echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})" - CF_UPPER(CF_ITEM,$cf_item) + CF_UPPER(cf_ITEM,$cf_item) CF_LIB_SUFFIX($cf_item,cf_suffix) CF_OBJ_SUBDIR($cf_item,cf_subdir) + # Test for case where we build libtinfo with a different name. + cf_libname=$cf_dir + if test $cf_dir = ncurses ; then + case $cf_subset in + *base*) + ;; + termlib*) + cf_libname=$TINFO_LIB_SUFFIX + if test -n "${DFT_ARG_SUFFIX}" ; then + # undo $LIB_SUFFIX add-on in CF_LIB_SUFFIX + cf_suffix=`echo $cf_suffix |sed -e "s%^${LIB_SUFFIX}%%"` + fi + ;; + esac + fi + # These dependencies really are for development, not # builds, but they are useful in porting, too. cf_depend="../include/ncurses_cfg.h" @@ -1241,10 +1831,24 @@ do cf_depend="$cf_depend $cf_reldir/curses.priv.h" fi + cf_dir_suffix= + old_cf_suffix="$cf_suffix" + if test "$cf_cv_shlib_version_infix" = yes ; then + if test -n "$LIB_SUFFIX" ; then + case $LIB_SUFFIX in + w*) + cf_libname=`echo $cf_libname | sed 's/w$//'` + cf_suffix=`echo $cf_suffix | sed 's/^w//'` + cf_dir_suffix=w + ;; + esac + fi + fi + $AWK -f $srcdir/mk-1st.awk \ - name=$cf_dir \ + name=${cf_libname}${cf_dir_suffix} \ traces=$LIB_TRACING \ - MODEL=$CF_ITEM \ + MODEL=$cf_ITEM \ model=$cf_subdir \ prefix=$cf_prefix \ suffix=$cf_suffix \ @@ -1258,6 +1862,9 @@ do depend="$cf_depend" \ host="$host" \ $srcdir/$cf_dir/modules >>$cf_dir/Makefile + + cf_suffix="$old_cf_suffix" + for cf_subdir2 in $cf_subdirs lib do test $cf_subdir = $cf_subdir2 && break @@ -1266,11 +1873,13 @@ do $AWK -f $srcdir/mk-2nd.awk \ name=$cf_dir \ traces=$LIB_TRACING \ - MODEL=$CF_ITEM \ + MODEL=$cf_ITEM \ model=$cf_subdir \ subset=$cf_subset \ srcdir=$srcdir \ echo=$WITH_ECHO \ + crenames=$cf_cv_prog_CC_c_o \ + cxxrenames=$cf_cv_prog_CXX_c_o \ $srcdir/$cf_dir/modules >>$cf_dir/Makefile cf_subdirs="$cf_subdirs $cf_subdir" done @@ -1492,6 +2101,43 @@ done ])dnl dnl --------------------------------------------------------------------------- +dnl CF_LIB_SONAME version: 2 updated: 2005/06/25 16:05:47 +dnl ------------- +dnl Find the and soname for the given shared library. Set the cache variable +dnl cf_cv_$3_soname to this, unless it is not found. Then set the cache +dnl variable to "unknown". +dnl +dnl $1 = headers +dnl $2 = code +dnl $3 = library name +AC_DEFUN([CF_LIB_SONAME], +[ +AC_CACHE_CHECK(for soname of $3 library,cf_cv_$3_soname,[ + +cf_cv_$3_soname=unknown +if test "$cross_compiling" != yes ; then +cat >conftest.$ac_ext </dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep lib$3.` + test -z "$cf_cv_$3_soname" && cf_cv_$3_soname=unknown + fi + fi +rm -f conftest* +LIBS="$cf_save_LIBS" +fi +]) +]) +dnl --------------------------------------------------------------------------- dnl CF_LIB_SUFFIX version: 13 updated: 2003/11/01 16:09:07 dnl ------------- dnl Compute the library file-suffix from the given model name @@ -1837,7 +2483,7 @@ if test -n "$cf_unknown" ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MANPAGE_RENAMES version: 6 updated: 2002/01/19 22:51:32 +dnl CF_MANPAGE_RENAMES version: 7 updated: 2005/06/18 18:51:57 dnl ------------------ dnl The Debian people have their own naming convention for manpages. This dnl option lets us override the name of the file containing renaming, or @@ -1876,7 +2522,7 @@ if test "$MANPAGE_RENAMES" != no ; then # Construct a sed-script to perform renaming within man-pages if test -n "$MANPAGE_RENAMES" ; then test ! -d man && mkdir man - sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >man/edit_man.sed + sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >./edit_man.sed fi fi @@ -1943,7 +2589,7 @@ AC_ARG_WITH(manpage-tbl, AC_MSG_RESULT($MANPAGE_TBL) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_MAN_PAGES version: 27 updated: 2003/12/20 20:39:45 +dnl CF_MAN_PAGES version: 29 updated: 2005/06/18 19:42:52 dnl ------------ dnl Try to determine if the man-pages on the system are compressed, and if dnl so, what format is used. Use this information to construct a script that @@ -1992,7 +2638,7 @@ case "$MANPAGE_FORMAT" in #(vi ;; esac -cf_edit_man=man/edit_man.sh +cf_edit_man=./edit_man.sh cat >$cf_edit_man <>$cf_edit_man <>$cf_edit_man <\$TMP + < \$i | sed -f `pwd`/edit_man.sed >\$TMP CF_EOF else cat >>$cf_edit_man <&AC_FD_CC +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_NCURSES_ABI_6 version: 1 updated: 2005/09/17 18:42:49 +dnl ---------------- +dnl Set ncurses' ABI to 6 unless overridden by explicit configure option, and +dnl warn about this. +AC_DEFUN([CF_NCURSES_ABI_6],[ +if test "${with_abi_version+set}" != set; then + case $cf_cv_rel_version in + 5.*) + cf_cv_rel_version=6.0 + cf_cv_abi_version=6 + AC_MSG_WARN(Overriding ABI version to $cf_cv_abi_version) + ;; + esac +fi +])dnl +dnl --------------------------------------------------------------------------- dnl CF_NUMBER_SYNTAX version: 1 updated: 2003/09/20 18:12:49 dnl ---------------- dnl Check if the given variable is a number. If not, report an error. @@ -2427,6 +3098,84 @@ case ".[$]$1" in #(vi ifelse($2,,[AC_ERROR([expected a pathname, not \"[$]$1\"])],$2) ;; esac +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_POSIX_C_SOURCE version: 6 updated: 2005/07/14 20:25:10 +dnl ----------------- +dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. +dnl +dnl POSIX.1-1990 _POSIX_SOURCE +dnl POSIX.1-1990 and _POSIX_SOURCE and +dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 +dnl Bindings Option +dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L +dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L +dnl X/Open 2000 _POSIX_C_SOURCE=200112L +dnl +dnl Parameters: +dnl $1 is the nominal value for _POSIX_C_SOURCE +AC_DEFUN([CF_POSIX_C_SOURCE], +[ +cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1) + +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" + +CF_REMOVE_DEFINE(cf_trim_CFLAGS,$cf_save_CFLAGS,_POSIX_C_SOURCE) +CF_REMOVE_DEFINE(cf_trim_CPPFLAGS,$cf_save_CPPFLAGS,_POSIX_C_SOURCE) + +AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ + CF_MSG_LOG(if the symbol is already defined go no further) + AC_TRY_COMPILE([#include ],[ +#ifndef _POSIX_C_SOURCE +make an error +#endif], + [cf_cv_posix_c_source=no], + [cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in #(vi + .[[12]]??*) #(vi + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + .2) #(vi + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + .*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then + AC_TRY_COMPILE([#include ],[ +#ifdef _POSIX_SOURCE +make an error +#endif],[], + cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE") + fi + CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS $cf_cv_posix_c_source" + CF_MSG_LOG(if the second compile does not leave our definition intact error) + AC_TRY_COMPILE([#include ],[ +#ifndef _POSIX_C_SOURCE +make an error +#endif],, + [cf_cv_posix_c_source=no]) + CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" + ]) +]) + +if test "$cf_cv_posix_c_source" != no ; then + CFLAGS="$cf_trim_CFLAGS" + CPPFLAGS="$cf_trim_CPPFLAGS" + if test "$cf_cv_cc_u_d_options" = yes ; then + cf_temp_posix_c_source=`echo "$cf_cv_posix_c_source" | \ + sed -e 's/-D/-U/g' -e 's/=[[^ ]]*//g'` + CPPFLAGS="$CPPFLAGS $cf_temp_posix_c_source" + fi + CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source" +fi + ])dnl dnl --------------------------------------------------------------------------- dnl CF_PREDEFINE version: 1 updated: 2003/07/26 17:53:56 @@ -2462,6 +3211,70 @@ make an error fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF_PROG_CC_C_O version: 1 updated: 2004/02/14 15:00:43 +dnl -------------- +dnl Analogous to AC_PROG_CC_C_O, but more useful: tests only $CC, ensures that +dnl the output file can be renamed, and allows for a shell variable that can +dnl be used later. The parameter is either CC or CXX. The result is the +dnl cache variable: +dnl $cf_cv_prog_CC_c_o +dnl $cf_cv_prog_CXX_c_o +AC_DEFUN([CF_PROG_CC_C_O], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_MSG_CHECKING([whether [$]$1 understands -c and -o together]) +AC_CACHE_VAL(cf_cv_prog_$1_c_o, +[ +cat > conftest.$ac_ext < +int main() +{ + return 0; +} +CF_EOF +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='[$]$1 -c conftest.$ac_ext -o conftest2.$ac_objext >&AC_FD_CC' +if AC_TRY_EVAL(ac_try) && + test -f conftest2.$ac_objext && AC_TRY_EVAL(ac_try); +then + eval cf_cv_prog_$1_c_o=yes +else + eval cf_cv_prog_$1_c_o=no +fi +rm -f conftest* +])dnl +if test $cf_cv_prog_$1_c_o = yes; then + AC_MSG_RESULT([yes]) +else + AC_MSG_RESULT([no]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_PROG_CC_U_D version: 1 updated: 2005/07/14 16:59:30 +dnl -------------- +dnl Check if C (preprocessor) -U and -D options are processed in the order +dnl given rather than by type of option. Some compilers insist on apply all +dnl of the -U options after all of the -D options. Others allow mixing them, +dnl and may predefine symbols that conflict with those we define. +AC_DEFUN([CF_PROG_CC_U_D], +[ +AC_CACHE_CHECK(if $CC -U and -D options work together,cf_cv_cc_u_d_options,[ + cf_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS" + AC_TRY_COMPILE([],[ +#ifndef U_D_OPTIONS +make an undefined-error +#endif +#ifdef D_U_OPTIONS +make a defined-error +#endif + ],[ + cf_cv_cc_u_d_options=yes],[ + cf_cv_cc_u_d_options=no]) + CPPFLAGS="$cf_save_CPPFLAGS" +]) +])dnl +dnl --------------------------------------------------------------------------- dnl CF_PROG_EXT version: 10 updated: 2004/01/03 19:28:18 dnl ----------- dnl Compute $PROG_EXT, used for non-Unix ports, such as OS/2 EMX. @@ -2559,7 +3372,25 @@ case $cf_cv_regex in esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SHARED_OPTS version: 30 updated: 2003/12/27 20:48:07 +dnl CF_REMOVE_DEFINE version: 2 updated: 2005/07/09 16:12:18 +dnl ---------------- +dnl Remove all -U and -D options that refer to the given symbol from a list +dnl of C compiler options. This works around the problem that not all +dnl compilers process -U and -D options from left-to-right, so a -U option +dnl cannot be used to cancel the effect of a preceding -D option. +dnl +dnl $1 = target (which could be the same as the source variable) +dnl $2 = source (including '$') +dnl $3 = symbol to remove +define([CF_REMOVE_DEFINE], +[ +# remove $3 symbol from $2 +$1=`echo "$2" | \ + sed -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[[ ]]/ /g' \ + -e 's/-[[UD]]$3\(=[[^ ]]*\)\?[$]//g'` +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_SHARED_OPTS version: 31 updated: 2005/01/01 16:39:44 dnl -------------- dnl Attempt to determine the appropriate CC/LD options for creating a shared dnl library. @@ -2661,8 +3492,13 @@ AC_DEFUN([CF_SHARED_OPTS], ;; irix*) if test "$cf_cv_ld_rpath" = yes ; then - cf_ld_rpath_opt="-Wl,-rpath," - EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS" + if test "$GCC" = yes; then + cf_ld_rpath_opt="-Wl,-rpath," + EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS" + else + cf_ld_rpath_opt="-rpath " + EXTRA_LDFLAGS="-rpath \$(libdir) $EXTRA_LDFLAGS" + fi fi # tested with IRIX 5.2 and 'cc'. if test "$GCC" != yes; then @@ -2904,7 +3740,7 @@ if test "$cf_cv_sizechange" != no ; then fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_SRC_MODULES version: 15 updated: 2004/01/10 16:05:16 +dnl CF_SRC_MODULES version: 18 updated: 2005/05/28 12:58:54 dnl -------------- dnl For each parameter, test if the source-directory exists, and if it contains dnl a 'modules' file. If so, add to the list $cf_cv_src_modules which we'll @@ -2918,15 +3754,15 @@ AC_MSG_CHECKING(for src modules) # dependencies and linker-arguments for test-programs TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" +TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEP2" if test "$DFT_LWR_MODEL" = "libtool"; then TEST_ARGS="${TEST_DEPS}" + TEST_ARG2="${TEST_DEP2}" else TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" + TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2" fi -# dependencies and linker-arguments for utility-programs -test "$with_termlib" != yes && PROG_ARGS="$TEST_ARGS" - cf_cv_src_modules= for cf_dir in $1 do @@ -2957,21 +3793,27 @@ do AC_DEFINE_UNQUOTED(HAVE_${cf_have_include}_H) AC_DEFINE_UNQUOTED(HAVE_LIB${cf_have_include}) TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" + TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEP2" if test "$DFT_LWR_MODEL" = "libtool"; then TEST_ARGS="${TEST_DEPS}" + TEST_ARG2="${TEST_DEP2}" else TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" + TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2" fi fi fi done AC_MSG_RESULT($cf_cv_src_modules) + TEST_ARGS="-L${LIB_DIR} $TEST_ARGS" -AC_SUBST(TEST_DEPS) +TEST_ARG2="-L${LIB_2ND} $TEST_ARG2" + AC_SUBST(TEST_ARGS) +AC_SUBST(TEST_DEPS) -PROG_ARGS="-L${LIB_DIR} $PROG_ARGS" -AC_SUBST(PROG_ARGS) +AC_SUBST(TEST_ARG2) +AC_SUBST(TEST_DEP2) SRC_SUBDIRS="man include" for cf_dir in $cf_cv_src_modules @@ -3168,7 +4010,7 @@ AC_MSG_RESULT($cf_cv_sys_time_select) test "$cf_cv_sys_time_select" = yes && AC_DEFINE(HAVE_SYS_TIME_SELECT) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_TYPEOF_CHTYPE version: 4 updated: 2000/10/04 09:18:40 +dnl CF_TYPEOF_CHTYPE version: 6 updated: 2005/06/25 16:16:34 dnl ---------------- dnl Determine the type we should use for chtype (and attr_t, which is treated dnl as the same thing). We want around 32 bits, so on most machines want a @@ -3176,35 +4018,22 @@ dnl long, but on newer 64-bit machines, probably want an int. If we're using dnl wide characters, we have to have a type compatible with that, as well. AC_DEFUN([CF_TYPEOF_CHTYPE], [ -AC_REQUIRE([CF_UNSIGNED_LITERALS]) AC_MSG_CHECKING([for type of chtype]) AC_CACHE_VAL(cf_cv_typeof_chtype,[ AC_TRY_RUN([ -#ifdef USE_WIDEC_SUPPORT -#include /* we want wchar_t */ -#define WANT_BITS 39 -#else #define WANT_BITS 31 -#endif #include int main() { FILE *fp = fopen("cf_test.out", "w"); if (fp != 0) { char *result = "long"; -#ifdef USE_WIDEC_SUPPORT - /* - * If wchar_t is smaller than a long, it must be an int or a - * short. We prefer not to use a short anyway. - */ - if (sizeof(unsigned long) > sizeof(wchar_t)) - result = "int"; -#endif if (sizeof(unsigned long) > sizeof(unsigned int)) { int n; - unsigned int x; + unsigned int x, y; for (n = 0; n < WANT_BITS; n++) { - unsigned int y = (x >> n); + x = (1 << n); + y = (x >> n); if (y != 1 || x == 0) { x = 0; break; @@ -3231,12 +4060,6 @@ AC_MSG_RESULT($cf_cv_typeof_chtype) AC_SUBST(cf_cv_typeof_chtype) AC_DEFINE_UNQUOTED(TYPEOF_CHTYPE,$cf_cv_typeof_chtype) - -cf_cv_1UL="1" -test "$cf_cv_unsigned_literals" = yes && cf_cv_1UL="${cf_cv_1UL}U" -test "$cf_cv_typeof_chtype" = long && cf_cv_1UL="${cf_cv_1UL}L" -AC_SUBST(cf_cv_1UL) - ])dnl dnl --------------------------------------------------------------------------- dnl CF_TYPE_SIGACTION version: 3 updated: 2000/08/12 23:18:52 @@ -3356,36 +4179,69 @@ $1_ABI=$cf_cv_abi_version ]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_DBMALLOC version: 2 updated: 2002/12/29 21:11:45 +dnl CF_WITH_DBMALLOC version: 4 updated: 2004/02/28 05:49:27 dnl ---------------- -dnl Configure-option for dbmalloc +dnl Configure-option for dbmalloc. The optional parameter is used to override +dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. AC_DEFUN([CF_WITH_DBMALLOC],[ AC_MSG_CHECKING(if you want to link with dbmalloc for testing) AC_ARG_WITH(dbmalloc, - [ --with-dbmalloc test: use Conor Cahill's dbmalloc library], + [ --with-dbmalloc use Conor Cahill's dbmalloc library], [with_dbmalloc=$withval], [with_dbmalloc=no]) AC_MSG_RESULT($with_dbmalloc) -if test $with_dbmalloc = yes ; then - AC_CHECK_LIB(dbmalloc,debug_malloc) +if test "$with_dbmalloc" = yes ; then + AC_CHECK_HEADER(dbmalloc.h, + [AC_CHECK_LIB(dbmalloc,[debug_malloc]ifelse($1,,[],[,$1]))]) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_WITH_DMALLOC version: 2 updated: 2002/12/29 21:11:45 +dnl CF_WITH_DMALLOC version: 4 updated: 2004/02/28 05:49:27 dnl --------------- -dnl Configure-option for dmalloc +dnl Configure-option for dmalloc. The optional parameter is used to override +dnl the updating of $LIBS, e.g., to avoid conflict with subsequent tests. AC_DEFUN([CF_WITH_DMALLOC],[ AC_MSG_CHECKING(if you want to link with dmalloc for testing) AC_ARG_WITH(dmalloc, - [ --with-dmalloc test: use Gray Watson's dmalloc library], + [ --with-dmalloc use Gray Watson's dmalloc library], [with_dmalloc=$withval], [with_dmalloc=no]) AC_MSG_RESULT($with_dmalloc) -if test $with_dmalloc = yes ; then - AC_CHECK_LIB(dmalloc,dmalloc_debug) +if test "$with_dmalloc" = yes ; then + AC_CHECK_HEADER(dmalloc.h, + [AC_CHECK_LIB(dmalloc,[dmalloc_debug]ifelse($1,,[],[,$1]))]) fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF_WITH_GPM version: 1 updated: 2005/06/25 15:47:45 +dnl ----------- +AC_DEFUN([CF_WITH_GPM], +[ +AC_MSG_CHECKING(if you want to link with the GPM mouse library) +AC_ARG_WITH(gpm, + [ --with-gpm use Alessandro Rubini's GPM library], + [with_gpm=$withval], + [with_gpm=maybe]) +AC_MSG_RESULT($with_gpm) +if test "$with_gpm" != no ; then + AC_CHECK_LIB(gpm,Gpm_Open,[ + AC_CHECK_HEADER(gpm.h,[ + AC_DEFINE(HAVE_GPM_H) + with_gpm=yes + ],[ + if test "$with_gpm" = yes ; then + AC_ERROR(Cannot find GPM header) + fi + ]) + ],[ + if test "$with_gpm" = yes ; then + AC_ERROR(Cannot link with GPM library) + fi + with_gpm=no + ]) +fi +]) +dnl --------------------------------------------------------------------------- dnl CF_WITH_LIBTOOL version: 9 updated: 2004/01/16 14:55:37 dnl --------------- dnl Provide a configure option to incorporate libtool. Define several useful @@ -3631,22 +4487,43 @@ test "$cf_with_sysmouse" = yes && AC_DEFINE(USE_SYSMOUSE) fi ])dnl dnl --------------------------------------------------------------------------- -dnl CF_XOPEN_SOURCE version: 11 updated: 2004/01/26 20:58:41 +dnl CF_XOPEN_SOURCE version: 22 updated: 2005/08/06 18:06:32 dnl --------------- dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, dnl or adapt to the vendor's definitions to get equivalent functionality. +dnl +dnl Parameters: +dnl $1 is the nominal value for _XOPEN_SOURCE +dnl $2 is the nominal value for _POSIX_C_SOURCE AC_DEFUN([CF_XOPEN_SOURCE],[ + +AC_REQUIRE([CF_PROG_CC_U_D]) + +cf_XOPEN_SOURCE=ifelse($1,,500,$1) +cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2) + case $host_os in #(vi +aix[[45]]*) #(vi + CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE" + ;; +darwin*) #(vi + # setting _XOPEN_SOURCE breaks things on Darwin + ;; freebsd*) #(vi - CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" + # 5.x headers associate + # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L + # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L + cf_POSIX_C_SOURCE=200112L + cf_XOPEN_SOURCE=600 + CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" ;; hpux*) #(vi CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE" ;; -irix6.*) #(vi +irix[[56]].*) #(vi CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE" ;; -linux*) #(vi +linux*|gnu*) #(vi CF_GNU_SOURCE ;; mirbsd*) #(vi @@ -3661,6 +4538,9 @@ openbsd*) #(vi osf[[45]]*) #(vi CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE" ;; +nto-qnx*) #(vi + CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE" + ;; sco*) #(vi # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer ;; @@ -3675,37 +4555,24 @@ make an error #endif], [cf_cv_xopen_source=no], [cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500" + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" AC_TRY_COMPILE([#include ],[ #ifdef _XOPEN_SOURCE make an error #endif], [cf_cv_xopen_source=no], - [cf_cv_xopen_source=yes]) - CPPFLAGS="$cf_save" - ]) -]) -test "$cf_cv_xopen_source" = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500" - - # FreeBSD 5.x headers demand this... - AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_xopen_source,[ - AC_TRY_COMPILE([#include ],[ -#ifndef _POSIX_C_SOURCE -make an error -#endif], - [cf_cv_xopen_source=no], - [cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE" - AC_TRY_COMPILE([#include ],[ -#ifdef _POSIX_C_SOURCE -make an error -#endif], - [cf_cv_xopen_source=no], - [cf_cv_xopen_source=yes]) + [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) CPPFLAGS="$cf_save" ]) ]) -test "$cf_cv_xopen_source" = yes && CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE" + if test "$cf_cv_xopen_source" != no ; then + CF_REMOVE_DEFINE(CFLAGS,$CFLAGS,_XOPEN_SOURCE) + CF_REMOVE_DEFINE(CPPFLAGS,$CPPFLAGS,_XOPEN_SOURCE) + test "$cf_cv_cc_u_d_options" = yes && \ + CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE" + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source" + fi + CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) ;; esac ]) diff --git a/announce.html.in b/announce.html.in index 11fb87c3..82079c36 100644 --- a/announce.html.in +++ b/announce.html.in @@ -1,6 +1,6 @@ @@ -19,8 +19,8 @@ and multiple highlights and forms characters and function-key mapping, and has all the other SYSV-curses enhancements over BSD curses.

In mid-June 1995, the maintainer of 4.4BSD curses declared that he -considered 4.4BSD curses obsolete, and is encouraging the keepers of -Unix releases such as BSD/OS, freeBSD and netBSD to switch over to +considered 4.4BSD curses obsolete, and encouraged the keepers of +Unix releases such as BSD/OS, FreeBSD and NetBSD to switch over to ncurses.

The ncurses code was developed under GNU/Linux. @@ -42,198 +42,186 @@ the GNU distribution site

Release Notes

-This release is designed to be upward compatible from ncurses 5.0 and 5.3; +This release is designed to be upward compatible from ncurses 5.0 through 5.4; very few applications will require recompilation, depending on the platform. -These are the highlights from the change-log since ncurses 5.3 release. +These are the highlights from the change-log since ncurses 5.4 release.

Interface changes:

    -
  • add the remaining functions for X/Open curses wide-character - support. -
      -
    • pecho_wchar() -
    • slk_wset() -
    - These are only available if the library is configured using the - --enable-widec option. - -
  • write getyx() and related 2-return macros in terms of - getcury(), - getcurx(), etc. - -
  • simplify ifdef for bool declaration in curses.h - -
  • modify ifdef's in curses.h that disabled use of - __attribute__() for g++, since recent versions - implement the cases which ncurses uses. - -
  • add key_defined() function, to tell which keycode a - string is bound to. +
  • terminfo installs "xterm-new" as "xterm" entry rather than + "xterm-old" (aka xterm-r6). + +
  • terminfo data is installed using the tic -x option (few systems + still use ncurses 4.2). + +
  • modify C++ binding to work with newer C++ compilers by providing + initializers and using modern casts. Old-style header names are + still used in this release to allow compiling with not-so-old + compilers. + +
  • modify parameter type in c++ binding for insch() and mvwinsch() to + be consistent with underlying ncurses library (was char, is chtype). + +
  • change NCursesWindow::err_handler() to a virtual function. + +
  • form and menu libraries now work with wide-character data. + Applications which bypassed the form library and manipulated the + FIELD.buf data directly will not work properly with libformw, + since that no longer points to an array of char. The + set_field_buffer() and field_buffer() functions translate to/from + the actual field data. + + +
  • add symbol to curses.h which can be used to suppress include of + stdbool.h, e.g., +
    +                #define NCURSES_ENABLE_STDBOOL_H 0
    +                #include <curses.h>
    +          
    + +
  • change SP->_current_attr to a pointer, adjust ifdef's to ensure + that libtinfo.so and libtinfow.so have the same ABI. The reason + for this is that the corresponding data which belongs to the + upper-level ncurses library has a different size in each model. + +
  • winnstr() now returns multibyte character strings for the + wide-character configuration. + +
  • assume_default_colors() no longer requires that + use_default_colors() be called first. + +
  • data_ahead() now works with wide-characters. + +
  • slk_set() and slk_wset() now accept and store multibyte or + multicolumn characters. + +
  • start_color() now returns OK if colors have + already been started. + start_color() also returns ERR if it cannot allocate memory. + +
  • pair_content() now returns -1 for consistency with init_pair() + if it corresponds to the default-color. + +
  • unctrl() now returns null if its parameter does not correspond + to an unsigned char. +
New features and improvements:
  • library
      -
    • implement logic in lib_mouse.c to handle position reports which - are generated when XFree86 xterm is initialized with private - modes 1002 or 1003. These are returned to the application as the - REPORT_MOUSE_POSITION mask, which was not implemented. -
    • modify soft-key initialization to use A_REVERSE if A_STANDOUT - would not be shown when colors are used, i.e., if ncv#1 is set in - the terminfo as is done in "screen". -
    • add configure option for FreeBSD sysmouse, --with-sysmouse, and - implement library support for that. +
    • environment variable NCURSES_NO_UTF8_ACS supports + miscellaneous terminal emulators which ignore alternate + character set escape sequences when in UTF-8 mode. + +
    • modify initialization of key lookup table so that if an extended + capability (tic -x) string is defined, and its name begins with 'k', + ncurses will automatically treat it as a key. + +
    • change GPM initialization, using dl library to load it + dynamically at runtime. + +
    • form, menu and panel libraries support debug-tracing. +
    -
  • programs: +
  • add NCURSES-Programming-HOWTO.html by Pradeep Padala + (see http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/). -
      -
    • tack: +
    • programs: +
    • infocmp:
        -
      • allow it to run from fallback terminfo data. -
      • reset colors after each color test, correct a place - where exit_standout_mode was used instead of - exit_attribute_mode. -
      • improve bce test by making it set colors other - than black on white. +
      • The -i option now matches 8-bit controls against its table + entries, e.g., so it can analyze the xterm-8bit entry. + +
      • add "-x" option to infocmp like tic's "-x", for use in "-F" + comparisons. This modifies infocmp to only report extended + capabilities if the -x option is given, making this more + consistent with tic. Some scripts may break, since infocmp + previous gave this information without an option. +
    • tic:
        -
      • handle a case where an entry has no - description, and capabilities begin on the same line as the entry - name. -
      • allow a terminfo entry with a leading 2-character name. -
      • improved warnings when suppressing items to fit in termcap's - 1023-byte limit. -
      • add check for multiple "tc=" clauses in a termcap. -
      • correct logic for resolving "use=" clauses - allow infocmp and tic to show cancelled capabilities. -
      • check for incomplete line-drawing character mapping. -
      • check for missing/empty/illegal terminfo name. -
      -
    • tput: -
        -
      • modify tput to use the same parameter analysis as tparm() does, - to provide for user-defined strings, e.g., for xterm title, a - corresponding capability might be - title=\E]2;%p1%s^G, +
      • modify termcap-parsing to retain 2-character aliases at the + beginning of an entry if the "-x" option is used in tic. + +
      • filter out long extended names when translating to termcap + format. Only two characters are permissible for termcap + capability names. + +
      • correct translation of "%%" in terminfo format to termcap, + e.g., using "tic -C". + +
      • modify the "-c -v" options to ignore delays when comparing + strings. Also modify it to ignore a canceled sgr string, + e.g., for terminals which cannot properly combine attributes + in one control sequence. + +
      • add a check for improperly ended strings, i.e., where a + following line begins in column 1. + +
      • add a check in tic for terminfo entries having an sgr0 but no + sgr string. This confuses Tru64 and HPUX curses when combined + with color, e.g., making them leave line-drawing characters in + odd places. + +
      • add check (with debug configuration) that provides about the + runtime changes that would be made to sgr0 for termcap + applications. +
    • tset:
        -
      • use the system's default values for CKILL and other default - control characters. -
      • correct interchanged defaults for kill and interrupt - characters, which caused it to report unnecessarily. + +
      • add -c and -w options to allow user to suppress ncurses' + resizing of the terminal emulator window in the special case + where it is not able to detect the true size. +
      -
Major bug fixes:
    -
  • prevent recursion in wgetch() via wgetnstr() if the connection - cannot be switched between cooked/raw modes because it is not a TTY. -
  • correct a case in _nc_remove_string(), used by - define_key(), to avoid infinite loop if the given string - happens to be a substring of other strings which are assigned to keys. +
  • improve logic in tgetent() which adjusts the termcap "me" string + to work with ISO-2022 string used in xterm-new. + This is a feature that was incompletely implemented in ncurses 5.3. + ncurses attempts to provide termcap clients with the portion of + the sgr0 (termcap "me") string that does not reset line-drawing. -
  • modify logic of acsc to use the original character if no mapping is - defined, rather than a null. +
  • cells in the WINDOW which are continuations of a multicolumn + character are encoded differently, making repainting more + reliable. -
  • several improvements for handling multi-cell display of wide - characters. -
      -
    • modify setcchar() to allow converting control characters to complex - characters. -
    • correct handling of multibyte characters in waddch_literal() which - force wrapping because they are started too late on the line. -
    • modify setcchar() to allow for wchar_t input strings that have - more than one spacing character. -
    +
  • amend change to setupterm() in ncurses 5.4 (20030405) which would + reuse the value of cur_term if the same output was selected. This + now reuses it only when setupterm() is called from tgetent(), + which has no notion of separate SCREENs. Note that tgetent() must + be called after initscr() or newterm() to use this feature. -
  • other fixes for wide-character support: -
      -
    • rewrote lib_acs.c to allow PutAttrChar() to decide how to render - alternate-characters, i.e., to work with Linux console and UTF-8 - locale. -
    • implement a workaround so that line-drawing works with screen's - crippled UTF-8 support (tested with 3.9.13). This only works with - the wide-character support (--enable-widec); the normal library - will simply suppress line-drawing when running in a UTF-8 locale in - screen. -
    • corrections to lib_get_wstr.c: -
        -
      • null-terminate buffer passed to setcchar(), which occasionally - failed. -
      • map special characters such as erase- and kill-characters into - key-codes so those will work as expected even if they are not - mentioned in the terminfo. -
      -
    +
  • make setcchar() now works when its wchar_t* parameter is + pointing to a string which contains more data than can be converted. -
  • modify setupterm() to check if the terminfo and - terminal-modes have already been read. This ensures that it does not - reinvoke def_prog_mode() when an application calls more - than one function, such as tgetent() and - initscr(). +
  • win_wchnstr() now works for more than one cell. -
  • fix form_driver() cases for REQ_CLR_EOF, REQ_CLR_EOL, REQ_DEL_CHAR, - REQ_DEL_PREV and REQ_NEW_LINE, which did not ensure the cursor was at - the editing position before making modifications. +
  • resizeterm() now processes all levels of window hierarchy. -
  • correct keybound(), which reported definitions in the - wrong table, i.e., the list of definitions which are disabled by - keyok(). +
  • disable GPM mouse support when $TERM happens to be prefixed with + "xterm". Gpm_Open() would otherwise assert that it can deal with + mouse events in this case. -
  • fixes related to safe_sprintf.c: -
      -
    • correct an allocation size in safe_sprintf.c for the "*" format - code. -
    • correct safe_sprintf.c to not return a null pointer if the format - happens to be an empty string. -
    • make return value from _nc_printf_string() consistent. Before, - depending on whether --enable-safe-sprintf was used, it might not - be cached for reallocating. -
    +
  • add SP->_screen_acs_map[], used to ensure that mapping of missing + line-drawing characters is handled properly. For example, ACS_DARROW + is absent from xterm-new, and it was coincidentally displayed the + same as ACS_BTEE. -
  • other low-level improvements to the optimization code include: -
      -
    • if the output is a socket or other non-tty device, use 1 - millisecond - for the cost in mvcur; previously it was 9 milliseconds because the - baudrate was not known. -
    • modify lib_getch.c to avoid recursion via wgetnstr() when the - input - is not a tty and consequently mode-changes do not work. -
    • fix several places in tack/pad.c which tested and used the - parameter- and parameterless strings inconsistently. -
    • change several tputs() calls in scrolling code to use putp(), to - enable padding which may be needed for some terminals. -
    • improve mvcur() by checking if it is safe to move when video - attributes are set (msgr), and if not, reset/restore attributes - within that function rather than doing it separately in the GoTo() - function in tty_update.c. -
    • use tputs() rather than putp() in a few cases in tty_update.c - since the corresponding delays are proportional to the number of - lines affected: repeat_char, clr_eos, change_scroll_region. -
    - -
  • correct line/column reference in adjust_window(), needed to make - special windows such as curscr track properly when resizing. - -
  • fix a potential recursion between napms() and _nc_timed_wait() - -
  • rewrote lib_insch.c, combining it with lib_insstr.c so both handle - tab and other control characters consistently. - -
  • do not try to open gpm mouse driver if standard output is not a - tty; the gpm library does not make this check.
Portability: @@ -242,97 +230,85 @@ Portability:
  • new options:
    -
    --with-abi-version option. -
    addresses platforms where packagers have diverged from - ncurses ABI numbering. -
    --with-manpage-format=catonly -
    addresses - behavior of BSDI, allow install of man+cat files on NetBSD, - whose behavior has diverged by requiring both to be present. -
    --with-manpage-aliases -
    extends - "--with-manpage-aliases" to provide the option of generating - ".so" files rather than symbolic links for manpage aliases. -
    --with-rel-version -
    workaround to force - libtool on Darwin generate the "same" library names as with - the "--with-shared" option. The Darwin ld program does not - work well with a zero as the minor-version value. -
    --with-trace -
    simplifies defining TRACE to incorporate trace() in libraries. +
    --enable-largefile +
    set compiler and linker flags to use largefile support. + +
    --enable-ext-colors +
    Allow encoding of 256 foreground + and background colors, e.g., with the xterm-256color or + xterm-88color terminfo entries. + This requires ABI 6 because it changes the size of cchar_t. + +
    --enable-ext-mouse +
    This defines NCURSES_MOUSE_VERSION 2, and modifies the encoding of + mouse events to support wheel mice, which may transmit buttons + 4 and 5. This works with xterm and similar terminal + emulators. + This requires ABI 6 because it changes the encoding of + mouse events. + +
    --with-chtype +
    overriding of the non-LP64 model's use of chtype + +
    --with-mmask-t +
    overriding of the non-LP64 model's use of mmask_t + +
    --without-xterm-new +
    Installs "xterm-old" as the "xterm" entry of the terminfo + database. +
    - + +
  • The --with-termlib option now accepts a value which sets + the name of the terminfo library. This would allow a packager to + build libtinfow.so renamed to coincide with libtinfo.so +
  • fixes/improvements for cross-compiling: - -
      -
    • allow BUILD_CC and related configure script variables to be - overridden from the environment. -
    • use AC_CHECK_TOOL to get proper values for AR and LD for cross - compiling. -
    • use $cross_compiling variable in configure script - rather than comparing $host_alias and - $target alias, since "host" is traditionally misused - in autoconf to refer to the target platform. -
    • modify run_tic.in to avoid using wrong shared libraries when - cross-compiling. -
    - -
  • fixes for Mac OS X: -
      -
    • fix a redefinition of $RANLIB in the configure - script when libtool is used. -
    • modify MKlib_gen.sh to avoid passing "#" tokens through the C - preprocessor. This works around Mac OS X's preprocessor, which - insists on adding a blank on each side of the token. -
    - -
  • workarounds for broken tools: +
      -
    • add configure check for wchar_t and wint_t types, rather than - rely on preprocessor definitions. Also work around for gcc - fixinclude bug which creates a shadow copy of - curses.h if it sees these symbols apparently typedef'd. -
    • modify configure script to omit -Winline for gcc 3.3, since - that feature is broken. -
    • several script fixes to work around the ironically named - POSIXLY_CORRECT feature of GNU sed 4.0. -
    • modify configure script to avoid using "head -1", which does - not work if POSIXLY_CORRECT (sic) is set. -
    • update configure script to reflect fix for - AC_PROG_GCC_TRADITIONAL, which is broken in autoconf 2.5x for Mac - OS X 10.2.3. -
    • repair check for missing C++ compiler, which is broken in - autoconf 2.5x by hardcoding it to g++. +
    • suppress $suffix in misc/run_tic.sh when cross-compiling. + This allows cross-compiles to use the host's tic program to + handle the "make install.data" step. + +
    • correct BUILD_CPPFLAGS substitution in ncurses/Makefile.in, to allow + cross-compiling from a separate directory tree. +
    - -
  • corrected ifdef's relating to configure check for wchar_t, etc. -
  • remove configure script check to allow -Wconversion for older - versions of gcc -
  • modify configure script to accommodate libtool 1.5, as well as - add an parameter to the "--with-libtool" option which can specify - the pathname of libtool. -
  • change several sed scripts to avoid using "\+" since it is not a - BRE (basic regular expression). One instance caused terminfo.5 to - be misformatted on FreeBSD. -
  • use '%' as sed substitute delimiter in run_tic script to avoid - problems with pathname delimiters such as ':' and '@'. -
  • add -D_XOPEN_SOURCE=500 if needed when configuring with - "--enable-widec", to get mbstate_t declaration on HPUX - 11.11. +
  • library:
      -
    • adjust include-options in CF_ETIP_DEFINES to avoid missing - ncurses_dll.h, fixing special definitions that may be needed for - etip.h. -
    • modify CF_LIB_SUFFIX for Itanium releases of HP-UX, which use a - ".so" suffix. -
    • improve ifdef's to guard against redefinition of wchar_t and wint_t - in curses.h. -
    • remove an #undef for KEY_EVENT from curses.tail used in the - experimental NCURSES_WGETCH_EVENTS feature. The #undef confuses - Debian dpkg's build script. + +
    • add ifdef's for _LP64 in curses.h to avoid using wasteful + 64-bits for chtype and mmask_t, but add configure option + --disable-lp64 in case anyone used that configuration. + +
    • modify C++ binding to use some C internal functions to make it + compile properly on Solaris (and other platforms). + +
    • remove check in newwin() that prevents allocating windows that + extend beyond the screen (Solaris does this). + +
    • check for nl_langinfo(CODESET), use it if available. + This replaces ad hoc tests of environment variables to + check if the terminal is setup for UTF-8 encoding. + Applications which do not call setlocale() + should be corrected, to make them work properly with + UTF-8 encoding. +
      + In particular, applications which assume (and + do not call setlocale()) that + Latin-1 codes are printable will no longer work in + a UTF-8 locale since the ad hoc check of environment + variables to see if the locale was UTF-8 is not used + when nl_langinfo(CODESET) is available. + +
    • use setlocale() to query the program's current locale rather + than using getenv(). This supports applications which rely + upon legacy treatment of 8-bit characters when the locale is + not initialized. +
    diff --git a/c++/Makefile.in b/c++/Makefile.in index c3894494..746e7acd 100644 --- a/c++/Makefile.in +++ b/c++/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.72 2004/01/16 22:44:56 tom Exp $ +# $Id: Makefile.in,v 1.77 2005/06/12 22:52:56 tom Exp $ ############################################################################## -# Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -67,8 +67,8 @@ CXX_AR_OPTS = @CXX_AR_OPTS@ RANLIB = @LIB_PREP@ CXX = @CXX@ -CPP = @CPP@ -CXXFLAGS = @CXXFLAGS@ +CPP = @CXXCPP@ +CXXFLAGS = @CXXFLAGS@ @EXTRA_CXXFLAGS@ CXXLIBS = @CXXLIBS@ INCDIR = ../include @@ -108,7 +108,7 @@ LINK_PROFILE = $(LINK_FLAGS) LINK_SHARED = $(LINK_FLAGS) LDFLAGS = @TEST_ARGS@ @LDFLAGS@ \ - @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ $(CXXLIBS) + @LD_MODEL@ @LIBS@ @LOCAL_LDFLAGS@ $(CXXLIBS) LDFLAGS_LIBTOOL = $(LDFLAGS) $(CFLAGS_LIBTOOL) LDFLAGS_NORMAL = $(LDFLAGS) $(CFLAGS_NORMAL) @@ -130,6 +130,9 @@ sources : $(AUTO_SRC) depend : +tags: + ctags *.[h] *.cc + # Build a conventional library for installing, since a shared library would # pull in all of the ncurses libraries (panel, menu, form, ncurses) as direct # dependencies. @@ -184,7 +187,7 @@ mostlyclean :: clean :: mostlyclean -sh -c "if test -n '$x' ; then $(MAKE) clean x=''; fi" -rm -rf $(MODEL)/SunWS_cache - -$(LIBTOOL_CLEAN) rm -f demo$x $(AUTO_SRC) ../lib/$(LIBNAME) $(LIB_OBJS) $(LIB_OBJS:$o=.lo) $(OBJS_DEMO) + -$(LIBTOOL_CLEAN) rm -f demo$x $(AUTO_SRC) ../lib/$(LIBNAME) $(LIB_OBJS) $(OBJS_DEMO) -rm -rf .libs distclean :: clean diff --git a/c++/cursesapp.cc b/c++/cursesapp.cc index 82432c5c..6871a69a 100644 --- a/c++/cursesapp.cc +++ b/c++/cursesapp.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,14 +34,15 @@ #include "internal.h" #include "cursesapp.h" -MODULE_ID("$Id: cursesapp.cc,v 1.10 2003/10/25 15:04:46 tom Exp $") +MODULE_ID("$Id: cursesapp.cc,v 1.13 2005/04/03 12:25:23 tom Exp $") void -NCursesApplication::init(bool bColors) { +NCursesApplication::init(bool bColors) +{ if (bColors) NCursesWindow::useColors(); - - if (Root_Window->colors() > 1) { + + if (Root_Window->colors() > 1) { b_Colors = TRUE; Root_Window->setcolor(1); Root_Window->setpalette(COLOR_YELLOW,COLOR_BLUE); @@ -66,7 +67,8 @@ NCursesApplication* NCursesApplication::theApp = 0; NCursesWindow* NCursesApplication::titleWindow = 0; NCursesApplication::SLK_Link* NCursesApplication::slk_stack = 0; -NCursesApplication::~NCursesApplication() { +NCursesApplication::~NCursesApplication() +{ Soft_Label_Key_Set* S; delete titleWindow; @@ -78,12 +80,14 @@ NCursesApplication::~NCursesApplication() { ::endwin(); } -int NCursesApplication::rinit(NCursesWindow& w) { +int NCursesApplication::rinit(NCursesWindow& w) +{ titleWindow = &w; return OK; } -void NCursesApplication::push(Soft_Label_Key_Set& S) { +void NCursesApplication::push(Soft_Label_Key_Set& S) +{ SLK_Link* L = new SLK_Link; assert(L != 0); L->prev = slk_stack; @@ -93,7 +97,8 @@ void NCursesApplication::push(Soft_Label_Key_Set& S) { S.show(); } -bool NCursesApplication::pop() { +bool NCursesApplication::pop() +{ if (slk_stack) { SLK_Link* L = slk_stack; slk_stack = slk_stack->prev; @@ -104,22 +109,24 @@ bool NCursesApplication::pop() { return (slk_stack ? FALSE : TRUE); } -Soft_Label_Key_Set* NCursesApplication::top() const { +Soft_Label_Key_Set* NCursesApplication::top() const +{ if (slk_stack) return slk_stack->SLKs; else - return (Soft_Label_Key_Set*)0; + return static_cast(0); } -int NCursesApplication::operator()(void) { +int NCursesApplication::operator()(void) +{ bool bColors = b_Colors; - Soft_Label_Key_Set* S; + Soft_Label_Key_Set* S = 0; int ts = titlesize(); if (ts>0) NCursesWindow::ripoffline(ts,rinit); Soft_Label_Key_Set::Label_Layout fmt = useSLKs(); - if (fmt!=Soft_Label_Key_Set::None) { + if (fmt!=Soft_Label_Key_Set::None) { S = new Soft_Label_Key_Set(fmt); assert(S != 0); init_labels(*S); @@ -137,8 +144,10 @@ int NCursesApplication::operator()(void) { return run(); } -NCursesApplication::NCursesApplication(bool bColors) { - b_Colors = bColors; +NCursesApplication::NCursesApplication(bool bColors) + : b_Colors(bColors), + Root_Window(NULL) +{ if (theApp) THROW(new NCursesException("Application object already created.")); else diff --git a/c++/cursesapp.h b/c++/cursesapp.h index 4a7a21f1..7e995d2e 100644 --- a/c++/cursesapp.h +++ b/c++/cursesapp.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: cursesapp.h,v 1.9 2003/10/25 15:04:46 tom Exp $ +// $Id: cursesapp.h,v 1.11 2005/05/28 21:57:44 tom Exp $ #ifndef NCURSES_CURSESAPP_H_incl #define NCURSES_CURSESAPP_H_incl @@ -86,11 +86,24 @@ protected: // be the exit value of your application. virtual int run() = 0; - // The constructor is protected, so you may use it in your derived // class constructor. The argument tells whether or not you want colors. NCursesApplication(bool wantColors = FALSE); + NCursesApplication& operator=(const NCursesApplication& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesApplication(const NCursesApplication& rhs) + : b_Colors(rhs.b_Colors), + Root_Window(rhs.Root_Window) + { + } + public: virtual ~NCursesApplication(); @@ -160,4 +173,4 @@ public: }; -#endif // NCURSES_CURSESAPP_H_incl +#endif /* NCURSES_CURSESAPP_H_incl */ diff --git a/c++/cursesf.cc b/c++/cursesf.cc index b6a0a593..aaf1202c 100644 --- a/c++/cursesf.cc +++ b/c++/cursesf.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,9 +35,10 @@ #include "cursesf.h" #include "cursesapp.h" -MODULE_ID("$Id: cursesf.cc,v 1.16 2003/10/25 15:04:46 tom Exp $") +MODULE_ID("$Id: cursesf.cc,v 1.21 2005/08/13 18:09:06 tom Exp $") -NCursesFormField::~NCursesFormField () { +NCursesFormField::~NCursesFormField () +{ if (field) OnError(::free_field (field)); } @@ -46,7 +47,8 @@ NCursesFormField::~NCursesFormField () { * objects. */ FIELD** -NCursesForm::mapFields(NCursesFormField* nfields[]) { +NCursesForm::mapFields(NCursesFormField* nfields[]) +{ int fieldCount = 0,lcv; FIELD** old_fields; @@ -65,13 +67,14 @@ NCursesForm::mapFields(NCursesFormField* nfields[]) { my_fields = nfields; if (form && (old_fields = ::form_fields(form))) { - ::set_form_fields(form,(FIELD**)0); + ::set_form_fields(form, static_cast(0)); delete[] old_fields; } return fields; } -void NCursesForm::setDefaultAttributes() { +void NCursesForm::setDefaultAttributes() +{ NCursesApplication* S = NCursesApplication::getApplication(); int n = count(); @@ -102,7 +105,8 @@ void NCursesForm::setDefaultAttributes() { void NCursesForm::InitForm(NCursesFormField* nfields[], bool with_frame, - bool autoDelete_Fields) { + bool autoDelete_Fields) +{ int mrows, mcols; keypad(TRUE); @@ -111,7 +115,7 @@ NCursesForm::InitForm(NCursesFormField* nfields[], b_framed = with_frame; b_autoDelete = autoDelete_Fields; - form = (FORM*)0; + form = static_cast(0); form = ::new_form(mapFields(nfields)); if (!form) OnError (E_SYSTEM_ERROR); @@ -120,12 +124,12 @@ NCursesForm::InitForm(NCursesFormField* nfields[], hook->m_user = NULL; hook->m_back = this; hook->m_owner = form; - ::set_form_userptr(form,(void*)hook); + ::set_form_userptr(form, reinterpret_cast(hook)); - ::set_form_init (form, NCursesForm::frm_init); - ::set_form_term (form, NCursesForm::frm_term); - ::set_field_init (form, NCursesForm::fld_init); - ::set_field_term (form, NCursesForm::fld_term); + ::set_form_init (form, _nc_xx_frm_init); + ::set_form_term (form, _nc_xx_frm_term); + ::set_field_init (form, _nc_xx_fld_init); + ::set_field_term (form, _nc_xx_fld_term); scale(mrows, mcols); ::set_form_win(form, w); @@ -138,25 +142,26 @@ NCursesForm::InitForm(NCursesFormField* nfields[], b_sub_owner = TRUE; } else { - sub = (NCursesWindow*)0; + sub = static_cast(0); b_sub_owner = FALSE; } options_on(O_NL_OVERLOAD); setDefaultAttributes(); } -NCursesForm::~NCursesForm() { - UserHook* hook = (UserHook*)::form_userptr(form); +NCursesForm::~NCursesForm() +{ + UserHook* hook = reinterpret_cast(::form_userptr(form)); delete hook; if (b_sub_owner) { delete sub; - ::set_form_sub(form,(WINDOW *)0); + ::set_form_sub(form, static_cast(0)); } if (form) { FIELD** fields = ::form_fields(form); int cnt = count(); - OnError(::set_form_fields(form,(FIELD**)0)); + OnError(::set_form_fields(form, static_cast(0))); if (b_autoDelete) { if (cnt>0) { @@ -173,7 +178,8 @@ NCursesForm::~NCursesForm() { } void -NCursesForm::setSubWindow(NCursesWindow& nsub) { +NCursesForm::setSubWindow(NCursesWindow& nsub) +{ if (!isDescendant(nsub)) OnError(E_SYSTEM_ERROR); else { @@ -190,46 +196,55 @@ NCursesForm::setSubWindow(NCursesWindow& nsub) { * implementing a virtual method in a derived class */ void -NCursesForm::frm_init(FORM *f) { - getHook(f)->On_Form_Init(); +_nc_xx_frm_init(FORM *f) +{ + NCursesForm::getHook(f)->On_Form_Init(); } void -NCursesForm::frm_term(FORM *f) { - getHook(f)->On_Form_Termination(); +_nc_xx_frm_term(FORM *f) +{ + NCursesForm::getHook(f)->On_Form_Termination(); } void -NCursesForm::fld_init(FORM *f) { - NCursesForm* F = getHook(f); +_nc_xx_fld_init(FORM *f) +{ + NCursesForm* F = NCursesForm::getHook(f); F->On_Field_Init (*(F->current_field ())); } void -NCursesForm::fld_term(FORM *f) { - NCursesForm* F = getHook(f); +_nc_xx_fld_term(FORM *f) +{ + NCursesForm* F = NCursesForm::getHook(f); F->On_Field_Termination (*(F->current_field ())); } void -NCursesForm::On_Form_Init() { +NCursesForm::On_Form_Init() +{ } void -NCursesForm::On_Form_Termination() { +NCursesForm::On_Form_Termination() +{ } void -NCursesForm::On_Field_Init(NCursesFormField& field) { +NCursesForm::On_Field_Init(NCursesFormField& field) +{ } void -NCursesForm::On_Field_Termination(NCursesFormField& field) { +NCursesForm::On_Field_Termination(NCursesFormField& field) +{ } // call the form driver and do basic error checking. int -NCursesForm::driver (int c) { +NCursesForm::driver (int c) +{ int res = ::form_driver (form, c); switch (res) { case E_OK: @@ -243,22 +258,26 @@ NCursesForm::driver (int c) { return (res); } -void NCursesForm::On_Request_Denied(int c) const { +void NCursesForm::On_Request_Denied(int c) const +{ ::beep(); } -void NCursesForm::On_Invalid_Field(int c) const { +void NCursesForm::On_Invalid_Field(int c) const +{ ::beep(); } -void NCursesForm::On_Unknown_Command(int c) const { +void NCursesForm::On_Unknown_Command(int c) const +{ ::beep(); } static const int CMD_QUIT = MAX_COMMAND + 1; NCursesFormField* -NCursesForm::operator()(void) { +NCursesForm::operator()(void) +{ int drvCmnd; int err; int c; @@ -296,7 +315,8 @@ NCursesForm::operator()(void) { // The default implementation provides a hopefully straightforward // mapping for the most common keystrokes and form requests. int -NCursesForm::virtualize(int c) { +NCursesForm::virtualize(int c) +{ switch(c) { case KEY_HOME : return(REQ_FIRST_FIELD); @@ -351,76 +371,84 @@ NCursesForm::virtualize(int c) { // User Defined Fieldtypes // ------------------------------------------------------------------------- // -bool UserDefinedFieldType::fcheck(FIELD *f, const void *u) { - NCursesFormField* F = (NCursesFormField*)u; +bool _nc_xx_fld_fcheck(FIELD *f, const void *u) +{ + NCursesFormField* F = reinterpret_cast(const_cast(u)); assert(F != 0); - UserDefinedFieldType* udf = (UserDefinedFieldType*)(F->fieldtype()); + UserDefinedFieldType* udf = reinterpret_cast(F->fieldtype()); assert(udf != 0); return udf->field_check(*F); } -bool UserDefinedFieldType::ccheck(int c, const void *u) { - NCursesFormField* F = (NCursesFormField*)u; +bool _nc_xx_fld_ccheck(int c, const void *u) +{ + NCursesFormField* F = reinterpret_cast(const_cast(u)); assert(F != 0); UserDefinedFieldType* udf = - (UserDefinedFieldType*)(F->fieldtype()); + reinterpret_cast(F->fieldtype()); assert(udf != 0); return udf->char_check(c); } -void* UserDefinedFieldType::makearg(va_list* va) { +void* _nc_xx_fld_makearg(va_list* va) +{ return va_arg(*va,NCursesFormField*); } FIELDTYPE* UserDefinedFieldType::generic_fieldtype = - ::new_fieldtype(UserDefinedFieldType::fcheck, - UserDefinedFieldType::ccheck); + ::new_fieldtype(_nc_xx_fld_fcheck, + _nc_xx_fld_ccheck); FIELDTYPE* UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice = - ::new_fieldtype(UserDefinedFieldType::fcheck, - UserDefinedFieldType::ccheck); + ::new_fieldtype(_nc_xx_fld_fcheck, + _nc_xx_fld_ccheck); -bool UserDefinedFieldType_With_Choice::next_choice(FIELD *f, const void *u) { - NCursesFormField* F = (NCursesFormField*)u; +bool _nc_xx_next_choice(FIELD *f, const void *u) +{ + NCursesFormField* F = reinterpret_cast(const_cast(u)); assert(F != 0); UserDefinedFieldType_With_Choice* udf = - (UserDefinedFieldType_With_Choice*)(F->fieldtype()); + reinterpret_cast(F->fieldtype()); assert(udf != 0); return udf->next(*F); } -bool UserDefinedFieldType_With_Choice::prev_choice(FIELD *f, const void *u) { - NCursesFormField* F = (NCursesFormField*)u; +bool _nc_xx_prev_choice(FIELD *f, const void *u) +{ + NCursesFormField* F = reinterpret_cast(const_cast(u)); assert(F != 0); UserDefinedFieldType_With_Choice* udf = - (UserDefinedFieldType_With_Choice*)(F->fieldtype()); + reinterpret_cast(F->fieldtype()); assert(udf != 0); return udf->previous(*F); } -class UDF_Init { +class UDF_Init +{ private: int code; static UDF_Init* I; + public: - UDF_Init() { + UDF_Init() + : code(0) + { code = ::set_fieldtype_arg(UserDefinedFieldType::generic_fieldtype, - UserDefinedFieldType::makearg, + _nc_xx_fld_makearg, NULL, NULL); if (code==E_OK) code = ::set_fieldtype_arg (UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice, - UserDefinedFieldType::makearg, + _nc_xx_fld_makearg, NULL, NULL); if (code==E_OK) code = ::set_fieldtype_choice (UserDefinedFieldType_With_Choice::generic_fieldtype_with_choice, - UserDefinedFieldType_With_Choice::next_choice, - UserDefinedFieldType_With_Choice::prev_choice); + _nc_xx_next_choice, + _nc_xx_prev_choice); } }; UDF_Init* UDF_Init::I = new UDF_Init(); - diff --git a/c++/cursesf.h b/c++/cursesf.h index 91b390b2..70a30c37 100644 --- a/c++/cursesf.h +++ b/c++/cursesf.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,13 +31,16 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: cursesf.h,v 1.19 2004/01/15 00:43:46 tom Exp $ +// $Id: cursesf.h,v 1.28 2005/08/13 18:08:24 tom Exp $ #ifndef NCURSES_CURSESF_H_incl #define NCURSES_CURSESF_H_incl 1 #include + +#ifndef __EXT_QNX #include +#endif extern "C" { # include @@ -51,7 +54,8 @@ class NCURSES_IMPEXP NCursesFormField; // forward declaration // Class to represent builtin field types as well as C++ written new // fieldtypes (see classes UserDefineFieldType... -class NCURSES_IMPEXP NCursesFieldType { +class NCURSES_IMPEXP NCursesFieldType +{ friend class NCursesFormField; protected: @@ -71,8 +75,24 @@ protected: virtual void set(NCursesFormField& f) = 0; public: - NCursesFieldType() : fieldtype((FIELDTYPE*)0) { + NCursesFieldType() + : fieldtype(STATIC_CAST(FIELDTYPE*)(0)) + { + } + + NCursesFieldType& operator=(const NCursesFieldType& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesFieldType(const NCursesFieldType& rhs) + : fieldtype(rhs.fieldtype) + { } + }; // @@ -80,11 +100,12 @@ public: // The class representing a forms field, wrapping the lowlevel FIELD struct // ------------------------------------------------------------------------- // -class NCURSES_IMPEXP NCursesFormField { +class NCURSES_IMPEXP NCursesFormField +{ friend class NCursesForm; protected: - FIELD *field; // lowlevel structure + FIELD *field; // lowlevel structure NCursesFieldType* ftype; // Associated field type // Error handler @@ -96,27 +117,45 @@ protected: public: // Create a 'Null' field. Can be used to delimit a field list NCursesFormField() - : field((FIELD*)0), ftype((NCursesFieldType*)0) { + : field(STATIC_CAST(FIELD*)(0)), + ftype(STATIC_CAST(NCursesFieldType*)(0)) + { } // Create a new field NCursesFormField (int rows, - int cols, + int ncols, int first_row = 0, int first_col = 0, int offscreen_rows = 0, int additional_buffers = 0) - : ftype((NCursesFieldType*)0) { - field = ::new_field(rows,cols,first_row,first_col, + : field(0), + ftype(STATIC_CAST(NCursesFieldType*)(0)) + { + field = ::new_field(rows, ncols, first_row, first_col, offscreen_rows, additional_buffers); if (!field) OnError(errno); } + NCursesFormField& operator=(const NCursesFormField& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesFormField(const NCursesFormField& rhs) + : field(rhs.field), ftype(rhs.ftype) + { + } + virtual ~NCursesFormField (); // Duplicate the field at a new position - inline NCursesFormField* dup(int first_row, int first_col) { + inline NCursesFormField* dup(int first_row, int first_col) + { NCursesFormField* f = new NCursesFormField(); if (!f) OnError(E_SYSTEM_ERROR); @@ -149,10 +188,10 @@ public: } // Retrieve info about the field - inline void info(int& rows, int& cols, + inline void info(int& rows, int& ncols, int& first_row, int& first_col, int& offscreen_rows, int& additional_buffers) const { - OnError(::field_info(field, &rows, &cols, + OnError(::field_info(field, &rows, &ncols, &first_row, &first_col, &offscreen_rows, &additional_buffers)); } @@ -195,8 +234,8 @@ public: return ::field_just(field); } // Set the foreground attribute for the field - inline void set_foreground(chtype fore) { - OnError(::set_field_fore(field,fore)); + inline void set_foreground(chtype foreground) { + OnError(::set_field_fore(field,foreground)); } // Retrieve the fields foreground attribute @@ -205,8 +244,8 @@ public: } // Set the background attribute for the field - inline void set_background(chtype back) { - OnError(::set_field_back(field,back)); + inline void set_background(chtype background) { + OnError(::set_field_back(field,background)); } // Retrieve the fields background attribute @@ -215,8 +254,8 @@ public: } // Set the padding character for the field - inline void set_pad_character(int pad) { - OnError(::set_field_pad(field,pad)); + inline void set_pad_character(int padding) { + OnError(::set_field_pad(field, padding)); } // Retrieve the fields padding character @@ -225,13 +264,13 @@ public: } // Switch on the fields options - inline void options_on (Field_Options options) { - OnError (::field_opts_on (field, options)); + inline void options_on (Field_Options opts) { + OnError (::field_opts_on (field, opts)); } // Switch off the fields options - inline void options_off (Field_Options options) { - OnError (::field_opts_off (field, options)); + inline void options_off (Field_Options opts) { + OnError (::field_opts_off (field, opts)); } // Retrieve the fields options @@ -240,8 +279,8 @@ public: } // Set the fields options - inline void set_options (Field_Options options) { - OnError (::set_field_opts (field, options)); + inline void set_options (Field_Options opts) { + OnError (::set_field_opts (field, opts)); } // Mark the field as changed @@ -283,19 +322,30 @@ public: }; + // This are the built-in hook functions in this C++ binding. In C++ we use + // virtual member functions (see below On_..._Init and On_..._Termination) + // to provide this functionality in an object oriented manner. +extern "C" { + void _nc_xx_frm_init(FORM *); + void _nc_xx_frm_term(FORM *); + void _nc_xx_fld_init(FORM *); + void _nc_xx_fld_term(FORM *); +} + // // ------------------------------------------------------------------------- // The class representing a form, wrapping the lowlevel FORM struct // ------------------------------------------------------------------------- // -class NCURSES_IMPEXP NCursesForm : public NCursesPanel { +class NCURSES_IMPEXP NCursesForm : public NCursesPanel +{ protected: FORM* form; // the lowlevel structure private: NCursesWindow* sub; // the subwindow object bool b_sub_owner; // is this our own subwindow? - bool b_framed; // has the form a border? + bool b_framed; // has the form a border? bool b_autoDelete; // Delete fields when deleting form? NCursesFormField** my_fields; // The array of fields for this form @@ -303,25 +353,22 @@ private: // This structure is used for the form's user data field to link the // FORM* to the C++ object and to provide extra space for a user pointer. typedef struct { - void* m_user; // the pointer for the user's data + void* m_user; // the pointer for the user's data const NCursesForm* m_back; // backward pointer to C++ object - const FORM* m_owner; + const FORM* m_owner; } UserHook; // Get the backward pointer to the C++ object from a FORM static inline NCursesForm* getHook(const FORM *f) { - UserHook* hook = (UserHook*)::form_userptr(f); + UserHook* hook = reinterpret_cast(::form_userptr(f)); assert(hook != 0 && hook->m_owner==f); - return (NCursesForm*)(hook->m_back); + return const_cast(hook->m_back); } - // This are the built-in hook functions in this C++ binding. In C++ we use - // virtual member functions (see below On_..._Init and On_..._Termination) - // to provide this functionality in an object oriented manner. - static void frm_init(FORM *); - static void frm_term(FORM *); - static void fld_init(FORM *); - static void fld_term(FORM *); + friend void _nc_xx_frm_init(FORM *); + friend void _nc_xx_frm_term(FORM *); + friend void _nc_xx_fld_init(FORM *); + friend void _nc_xx_fld_term(FORM *); // Calculate FIELD* array for the menu FIELD** mapFields(NCursesFormField* nfields[]); @@ -329,13 +376,13 @@ private: protected: // internal routines inline void set_user(void *user) { - UserHook* uptr = (UserHook*)::form_userptr (form); + UserHook* uptr = reinterpret_cast(::form_userptr (form)); assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form); uptr->m_user = user; } inline void *get_user() { - UserHook* uptr = (UserHook*)::form_userptr (form); + UserHook* uptr = reinterpret_cast(::form_userptr (form)); assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==form); return uptr->m_user; } @@ -354,35 +401,75 @@ protected: // 'Internal' constructor, builds an object without association to a // field array. - NCursesForm( int lines, - int cols, + NCursesForm( int nlines, + int ncols, int begin_y = 0, int begin_x = 0) - : NCursesPanel(lines,cols,begin_y,begin_x), - form ((FORM*)0) { + : NCursesPanel(nlines, ncols, begin_y, begin_x), + form (STATIC_CAST(FORM*)(0)), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) + { } public: // Create form for the default panel. NCursesForm (NCursesFormField* Fields[], - bool with_frame=FALSE, // reserve space for a frame? + bool with_frame=FALSE, // reserve space for a frame? bool autoDelete_Fields=FALSE) // do automatic cleanup? - : NCursesPanel() { + : NCursesPanel(), + form(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) + { InitForm(Fields, with_frame, autoDelete_Fields); } // Create a form in a panel with the given position and size. NCursesForm (NCursesFormField* Fields[], - int lines, - int cols, + int nlines, + int ncols, int begin_y, int begin_x, - bool with_frame=FALSE, // reserve space for a frame? + bool with_frame=FALSE, // reserve space for a frame? bool autoDelete_Fields=FALSE) // do automatic cleanup? - : NCursesPanel(lines, cols, begin_y, begin_x) { + : NCursesPanel(nlines, ncols, begin_y, begin_x), + form(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_fields(0) + { InitForm(Fields, with_frame, autoDelete_Fields); } + NCursesForm& operator=(const NCursesForm& rhs) + { + if (this != &rhs) { + *this = rhs; + NCursesPanel::operator=(rhs); + } + return *this; + } + + NCursesForm(const NCursesForm& rhs) + : NCursesPanel(rhs), + form(rhs.form), + sub(rhs.sub), + b_sub_owner(rhs.b_sub_owner), + b_framed(rhs.b_framed), + b_autoDelete(rhs.b_autoDelete), + my_fields(rhs.my_fields) + { + } + virtual ~NCursesForm(); // Set the default attributes for the form @@ -452,8 +539,8 @@ public: virtual void On_Field_Termination(NCursesFormField& field); // Calculate required window size for the form. - void scale(int& rows, int& cols) const { - OnError(::scale_form(form,&rows,&cols)); + void scale(int& rows, int& ncols) const { + OnError(::scale_form(form,&rows,&ncols)); } // Retrieve number of fields in the form. @@ -462,8 +549,8 @@ public: } // Make the page the current page of the form. - void set_page(int page) { - OnError(::set_form_page(form,page)); + void set_page(int pageNum) { + OnError(::set_form_page(form, pageNum)); } // Retrieve current page number @@ -472,13 +559,13 @@ public: } // Switch on the forms options - inline void options_on (Form_Options options) { - OnError (::form_opts_on (form, options)); + inline void options_on (Form_Options opts) { + OnError (::form_opts_on (form, opts)); } // Switch off the forms options - inline void options_off (Form_Options options) { - OnError (::form_opts_off (form, options)); + inline void options_off (Form_Options opts) { + OnError (::form_opts_off (form, opts)); } // Retrieve the forms options @@ -487,8 +574,8 @@ public: } // Set the forms options - inline void set_options (Form_Options options) { - OnError (::set_form_opts (form, options)); + inline void set_options (Form_Options opts) { + OnError (::set_form_opts (form, opts)); } // Are there more data in the current field after the data shown @@ -545,28 +632,28 @@ template class NCURSES_IMPEXP NCursesUserField : public NCursesFormFiel { public: NCursesUserField (int rows, - int cols, + int ncols, int first_row = 0, int first_col = 0, - const T* p_UserData = (T*)0, + const T* p_UserData = STATIC_CAST(T*)(0), int offscreen_rows = 0, int additional_buffers = 0) - : NCursesFormField (rows, cols, + : NCursesFormField (rows, ncols, first_row, first_col, offscreen_rows, additional_buffers) { if (field) - OnError(::set_field_userptr(field,(void *)p_UserData)); + OnError(::set_field_userptr(field, STATIC_CAST(void *)(p_UserData))); } virtual ~NCursesUserField() {}; inline const T* UserData (void) const { - return (const T*)::field_userptr (field); + return reinterpret_cast(::field_userptr (field)); } inline virtual void setUserData(const T* p_UserData) { if (field) - OnError (::set_field_userptr (field, (void *)p_UserData)); + OnError (::set_field_userptr (field, STATIC_CAST(void *)(p_UserData))); } }; // @@ -579,50 +666,50 @@ template class NCURSES_IMPEXP NCursesUserForm : public NCursesForm protected: // 'Internal' constructor, builds an object without association to a // field array. - NCursesUserForm( int lines, - int cols, + NCursesUserForm( int nlines, + int ncols, int begin_y = 0, int begin_x = 0, - const T* p_UserData = (T*)0) - : NCursesForm(lines,cols,begin_y,begin_x) { + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesForm(nlines,ncols,begin_y,begin_x) { if (form) - set_user ((void *)p_UserData); + set_user (const_cast(p_UserData)); } public: NCursesUserForm (NCursesFormField Fields[], - const T* p_UserData = (T*)0, + const T* p_UserData = STATIC_CAST(T*)(0), bool with_frame=FALSE, bool autoDelete_Fields=FALSE) : NCursesForm (Fields, with_frame, autoDelete_Fields) { if (form) - set_user ((void *)p_UserData); + set_user (const_cast(p_UserData)); }; NCursesUserForm (NCursesFormField Fields[], - int lines, - int cols, + int nlines, + int ncols, int begin_y = 0, int begin_x = 0, - const T* p_UserData = (T*)0, + const T* p_UserData = STATIC_CAST(T*)(0), bool with_frame=FALSE, bool autoDelete_Fields=FALSE) - : NCursesForm (Fields, lines, cols, begin_y, begin_x, + : NCursesForm (Fields, nlines, ncols, begin_y, begin_x, with_frame, autoDelete_Fields) { if (form) - set_user ((void *)p_UserData); + set_user (const_cast(p_UserData)); }; virtual ~NCursesUserForm() { }; inline T* UserData (void) const { - return (T*)get_user (); + return reinterpret_cast(get_user ()); }; inline virtual void setUserData (const T* p_UserData) { if (form) - set_user ((void *)p_UserData); + set_user (const_cast(p_UserData)); } }; @@ -631,7 +718,8 @@ public: // Builtin Fieldtypes // ------------------------------------------------------------------------- // -class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType { +class NCURSES_IMPEXP Alpha_Field : public NCursesFieldType +{ private: int min_field_width; @@ -646,7 +734,8 @@ public: } }; -class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType { +class NCURSES_IMPEXP Alphanumeric_Field : public NCursesFieldType +{ private: int min_field_width; @@ -661,7 +750,8 @@ public: } }; -class NCURSES_IMPEXP Integer_Field : public NCursesFieldType { +class NCURSES_IMPEXP Integer_Field : public NCursesFieldType +{ private: int precision; long lower_limit, upper_limit; @@ -678,7 +768,8 @@ public: } }; -class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType { +class NCURSES_IMPEXP Numeric_Field : public NCursesFieldType +{ private: int precision; double lower_limit, upper_limit; @@ -695,7 +786,8 @@ public: } }; -class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType { +class NCURSES_IMPEXP Regular_Expression_Field : public NCursesFieldType +{ private: char* regex; @@ -703,11 +795,35 @@ private: OnError(::set_field_type(f.get_field(),fieldtype,regex)); } + void copy_regex(const char *source) + { + regex = new char[1 + ::strlen(source)]; + (::strcpy)(regex, source); + } + public: Regular_Expression_Field(const char *expr) - : NCursesFieldType(TYPE_REGEXP) { - regex = new char[1 + ::strlen(expr)]; - (::strcpy)(regex,expr); + : NCursesFieldType(TYPE_REGEXP), + regex(NULL) + { + copy_regex(expr); + } + + Regular_Expression_Field& operator=(const Regular_Expression_Field& rhs) + { + if (this != &rhs) { + *this = rhs; + copy_regex(rhs.regex); + NCursesFieldType::operator=(rhs); + } + return *this; + } + + Regular_Expression_Field(const Regular_Expression_Field& rhs) + : NCursesFieldType(rhs), + regex(NULL) + { + copy_regex(rhs.regex); } ~Regular_Expression_Field() { @@ -715,7 +831,8 @@ public: } }; -class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType { +class NCURSES_IMPEXP Enumeration_Field : public NCursesFieldType +{ private: const char** list; int case_sensitive; @@ -731,12 +848,30 @@ public: bool non_unique=FALSE) : NCursesFieldType(TYPE_ENUM), list(enums), - case_sensitive(case_sens?-1:0), - non_unique_matches(non_unique?-1:0) { + case_sensitive(case_sens ? -1 : 0), + non_unique_matches(non_unique ? -1 : 0) { + } + + Enumeration_Field& operator=(const Enumeration_Field& rhs) + { + if (this != &rhs) { + *this = rhs; + NCursesFieldType::operator=(rhs); + } + return *this; + } + + Enumeration_Field(const Enumeration_Field& rhs) + : NCursesFieldType(rhs), + list(rhs.list), + case_sensitive(rhs.case_sensitive), + non_unique_matches(rhs.non_unique_matches) + { } }; -class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType { +class NCURSES_IMPEXP IPV4_Address_Field : public NCursesFieldType +{ private: void set(NCursesFormField& f) { OnError(::set_field_type(f.get_field(),fieldtype)); @@ -746,12 +881,20 @@ public: IPV4_Address_Field() : NCursesFieldType(TYPE_IPV4) { } }; + +extern "C" { + bool _nc_xx_fld_fcheck(FIELD *, const void*); + bool _nc_xx_fld_ccheck(int c, const void *); + void* _nc_xx_fld_makearg(va_list*); +} + // // ------------------------------------------------------------------------- // Abstract base class for User-Defined Fieldtypes // ------------------------------------------------------------------------- // -class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType { +class NCURSES_IMPEXP UserDefinedFieldType : public NCursesFieldType +{ friend class UDF_Init; // Internal helper to set up statics private: // For all C++ defined fieldtypes we need only one generic lowlevel @@ -761,9 +904,9 @@ private: protected: // This are the functions required by the low level libforms functions // to construct a fieldtype. - static bool fcheck(FIELD *, const void*); - static bool ccheck(int c, const void *); - static void* makearg(va_list*); + friend bool _nc_xx_fld_fcheck(FIELD *, const void*); + friend bool _nc_xx_fld_ccheck(int c, const void *); + friend void* _nc_xx_fld_makearg(va_list*); void set(NCursesFormField& f) { OnError(::set_field_type(f.get_field(),fieldtype,&f)); @@ -782,12 +925,19 @@ public: UserDefinedFieldType() : NCursesFieldType(generic_fieldtype) { } }; + +extern "C" { + bool _nc_xx_next_choice(FIELD*, const void *); + bool _nc_xx_prev_choice(FIELD*, const void *); +} + // // ------------------------------------------------------------------------- // Abstract base class for User-Defined Fieldtypes with Choice functions // ------------------------------------------------------------------------- // -class NCURSES_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType { +class NCURSES_IMPEXP UserDefinedFieldType_With_Choice : public UserDefinedFieldType +{ friend class UDF_Init; // Internal helper to set up statics private: // For all C++ defined fieldtypes with choice functions we need only one @@ -796,8 +946,8 @@ private: // This are the functions required by the low level libforms functions // to construct a fieldtype with choice functions. - static bool next_choice(FIELD*, const void *); - static bool prev_choice(FIELD*, const void *); + friend bool _nc_xx_next_choice(FIELD*, const void *); + friend bool _nc_xx_prev_choice(FIELD*, const void *); protected: // Redefine this function to do the retrieval of the next choice value. @@ -814,5 +964,4 @@ public: } }; -#endif // NCURSES_CURSESF_H_incl - +#endif /* NCURSES_CURSESF_H_incl */ diff --git a/c++/cursesm.cc b/c++/cursesm.cc index 22b785bc..c253a679 100644 --- a/c++/cursesm.cc +++ b/c++/cursesm.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,23 +35,27 @@ #include "cursesm.h" #include "cursesapp.h" -MODULE_ID("$Id: cursesm.cc,v 1.18 2003/10/25 15:04:46 tom Exp $") +MODULE_ID("$Id: cursesm.cc,v 1.22 2005/04/02 20:39:05 tom Exp $") -NCursesMenuItem::~NCursesMenuItem() { +NCursesMenuItem::~NCursesMenuItem() +{ if (item) OnError(::free_item(item)); } bool -NCursesMenuItem::action() { +NCursesMenuItem::action() +{ return FALSE; -}; +} -NCursesMenuCallbackItem::~NCursesMenuCallbackItem() { +NCursesMenuCallbackItem::~NCursesMenuCallbackItem() +{ } bool -NCursesMenuCallbackItem::action() { +NCursesMenuCallbackItem::action() +{ if (p_fct) return p_fct (*this); else @@ -64,24 +68,28 @@ NCursesMenuCallbackItem::action() { * implementing a virtual method in a derived class */ void -NCursesMenu::mnu_init(MENU *m) { - getHook(m)->On_Menu_Init(); +_nc_xx_mnu_init(MENU *m) +{ + NCursesMenu::getHook(m)->On_Menu_Init(); } void -NCursesMenu::mnu_term(MENU *m) { - getHook(m)->On_Menu_Termination(); +_nc_xx_mnu_term(MENU *m) +{ + NCursesMenu::getHook(m)->On_Menu_Termination(); } void -NCursesMenu::itm_init(MENU *m) { - NCursesMenu* M = getHook(m); +_nc_xx_itm_init(MENU *m) +{ + NCursesMenu* M = NCursesMenu::getHook(m); M->On_Item_Init (*(M->current_item ())); } void -NCursesMenu::itm_term(MENU *m) { - NCursesMenu* M = getHook(m); +_nc_xx_itm_term(MENU *m) +{ + NCursesMenu* M = NCursesMenu::getHook(m); M->On_Item_Termination (*(M->current_item ())); } @@ -89,30 +97,32 @@ NCursesMenu::itm_term(MENU *m) { * objects. */ ITEM** -NCursesMenu::mapItems(NCursesMenuItem* nitems[]) { +NCursesMenu::mapItems(NCursesMenuItem* nitems[]) +{ int itemCount = 0,lcv; for (lcv=0; nitems[lcv]->item; ++lcv) ++itemCount; - ITEM** items = new ITEM*[itemCount + 1]; + ITEM** itemArray = new ITEM*[itemCount + 1]; for (lcv=0;nitems[lcv]->item;++lcv) { - items[lcv] = nitems[lcv]->item; + itemArray[lcv] = nitems[lcv]->item; } - items[lcv] = NULL; + itemArray[lcv] = NULL; my_items = nitems; if (menu) delete[] ::menu_items(menu); - return items; + return itemArray; } void NCursesMenu::InitMenu(NCursesMenuItem* nitems[], bool with_frame, - bool autoDelete_Items) { + bool autoDelete_Items) +{ int mrows, mcols; keypad(TRUE); @@ -121,7 +131,7 @@ NCursesMenu::InitMenu(NCursesMenuItem* nitems[], b_framed = with_frame; b_autoDelete = autoDelete_Items; - menu = (MENU*)0; + menu = static_cast(0); menu = ::new_menu(mapItems(nitems)); if (!menu) OnError (E_SYSTEM_ERROR); @@ -130,12 +140,12 @@ NCursesMenu::InitMenu(NCursesMenuItem* nitems[], hook->m_user = NULL; hook->m_back = this; hook->m_owner = menu; - ::set_menu_userptr(menu,(void*)hook); + ::set_menu_userptr(menu, static_cast(hook)); - ::set_menu_init (menu, NCursesMenu::mnu_init); - ::set_menu_term (menu, NCursesMenu::mnu_term); - ::set_item_init (menu, NCursesMenu::itm_init); - ::set_item_term (menu, NCursesMenu::itm_term); + ::set_menu_init (menu, _nc_xx_mnu_init); + ::set_menu_term (menu, _nc_xx_mnu_term); + ::set_item_init (menu, _nc_xx_itm_init); + ::set_item_term (menu, _nc_xx_itm_term); scale(mrows, mcols); ::set_menu_win(menu, w); @@ -148,14 +158,15 @@ NCursesMenu::InitMenu(NCursesMenuItem* nitems[], b_sub_owner = TRUE; } else { - sub = (NCursesWindow*)0; + sub = static_cast(0); b_sub_owner = FALSE; } setDefaultAttributes(); } void -NCursesMenu::setDefaultAttributes() { +NCursesMenu::setDefaultAttributes() +{ NCursesApplication* S = NCursesApplication::getApplication(); if (S) { ::set_menu_fore(menu, S->foregrounds()); @@ -164,18 +175,19 @@ NCursesMenu::setDefaultAttributes() { } } -NCursesMenu::~NCursesMenu() { - UserHook* hook = (UserHook*)::menu_userptr(menu); +NCursesMenu::~NCursesMenu() +{ + UserHook* hook = reinterpret_cast(::menu_userptr(menu)); delete hook; if (b_sub_owner) { delete sub; - ::set_menu_sub(menu,(WINDOW *)0); + ::set_menu_sub(menu, static_cast(0)); } if (menu) { ITEM** itms = ::menu_items(menu); int cnt = count(); - OnError(::set_menu_items(menu,(ITEM**)0)); + OnError(::set_menu_items(menu, static_cast(0))); if (b_autoDelete) { if (cnt>0) { @@ -192,7 +204,8 @@ NCursesMenu::~NCursesMenu() { } void -NCursesMenu::setSubWindow(NCursesWindow& nsub) { +NCursesMenu::setSubWindow(NCursesWindow& nsub) +{ if (!isDescendant(nsub)) OnError(E_SYSTEM_ERROR); else { @@ -204,7 +217,8 @@ NCursesMenu::setSubWindow(NCursesWindow& nsub) { } bool -NCursesMenu::set_pattern (const char *pat) { +NCursesMenu::set_pattern (const char *pat) +{ int res = ::set_menu_pattern (menu, pat); switch(res) { case E_OK: @@ -219,7 +233,8 @@ NCursesMenu::set_pattern (const char *pat) { // call the menu driver and do basic error checking. int -NCursesMenu::driver (int c) { +NCursesMenu::driver (int c) +{ int res = ::menu_driver (menu, c); switch (res) { case E_OK: @@ -244,7 +259,8 @@ static const int CMD_ACTION = MAX_COMMAND + 2; // mapping for the most common keystrokes and menu requests. // ------------------------------------------------------------------------- int -NCursesMenu::virtualize(int c) { +NCursesMenu::virtualize(int c) +{ switch(c) { case CTRL('X') : return(CMD_QUIT); // eXit @@ -281,7 +297,8 @@ NCursesMenu::virtualize(int c) { } NCursesMenuItem* -NCursesMenu::operator()(void) { +NCursesMenu::operator()(void) +{ int drvCmnd; int err; int c; @@ -290,9 +307,9 @@ NCursesMenu::operator()(void) { post(); show(); refresh(); - + while (!b_action && ((drvCmnd = virtualize((c=getKey()))) != CMD_QUIT)) { - + switch((err=driver(drvCmnd))) { case E_REQUEST_DENIED: On_Request_Denied(c); @@ -346,37 +363,45 @@ NCursesMenu::operator()(void) { } void -NCursesMenu::On_Menu_Init() { +NCursesMenu::On_Menu_Init() +{ } void -NCursesMenu::On_Menu_Termination() { +NCursesMenu::On_Menu_Termination() +{ } void -NCursesMenu::On_Item_Init(NCursesMenuItem& item) { +NCursesMenu::On_Item_Init(NCursesMenuItem& item) +{ } void -NCursesMenu::On_Item_Termination(NCursesMenuItem& item) { +NCursesMenu::On_Item_Termination(NCursesMenuItem& item) +{ } void -NCursesMenu::On_Request_Denied(int c) const { +NCursesMenu::On_Request_Denied(int c) const +{ ::beep(); } void -NCursesMenu::On_Not_Selectable(int c) const { +NCursesMenu::On_Not_Selectable(int c) const +{ ::beep(); } void -NCursesMenu::On_No_Match(int c) const { +NCursesMenu::On_No_Match(int c) const +{ ::beep(); } void -NCursesMenu::On_Unknown_Command(int c) const { +NCursesMenu::On_Unknown_Command(int c) const +{ ::beep(); } diff --git a/c++/cursesm.h b/c++/cursesm.h index cc12d33a..d9c2273e 100644 --- a/c++/cursesm.h +++ b/c++/cursesm.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: cursesm.h,v 1.17 2003/10/25 15:04:46 tom Exp $ +// $Id: cursesm.h,v 1.25 2005/08/13 18:10:36 tom Exp $ #ifndef NCURSES_CURSESM_H_incl #define NCURSES_CURSESM_H_incl 1 @@ -46,9 +46,10 @@ extern "C" { // This wraps the ITEM type of // ------------------------------------------------------------------------- // -class NCURSES_IMPEXP NCursesMenuItem { +class NCURSES_IMPEXP NCursesMenuItem +{ friend class NCursesMenu; - + protected: ITEM *item; @@ -59,15 +60,30 @@ protected: public: NCursesMenuItem (const char* p_name = NULL, - const char* p_descript = NULL ) { - item = p_name ? ::new_item (p_name, p_descript) : (ITEM*)0; + const char* p_descript = NULL) + : item(0) + { + item = p_name ? ::new_item (p_name, p_descript) : STATIC_CAST(ITEM*)(0); if (p_name && !item) OnError (E_SYSTEM_ERROR); } // Create an item. If you pass both parameters as NULL, a delimiting // item is constructed which can be used to terminate a list of // NCursesMenu objects. - + + NCursesMenuItem& operator=(const NCursesMenuItem& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesMenuItem(const NCursesMenuItem& rhs) + : item(0) + { + } + virtual ~NCursesMenuItem (); // Release the items memory @@ -80,19 +96,19 @@ public: return ::item_description (item); } // Description of the item - + inline int (index) (void) const { return ::item_index (item); } // Index of the item in an item array (or -1) - inline void options_on (Item_Options options) { - OnError (::item_opts_on (item, options)); + inline void options_on (Item_Options opts) { + OnError (::item_opts_on (item, opts)); } // Switch on the items options - inline void options_off (Item_Options options) { - OnError (::item_opts_off (item, options)); + inline void options_off (Item_Options opts) { + OnError (::item_opts_off (item, opts)); } // Switch off the item's option @@ -101,8 +117,8 @@ public: } // Retrieve the items options - inline void set_options (Item_Options options) { - OnError (::set_item_opts (item, options)); + inline void set_options (Item_Options opts) { + OnError (::set_item_opts (item, opts)); } // Set the items options @@ -115,7 +131,7 @@ public: return ::item_value (item); } // Retrieve the items selection state - + inline bool visible () const { return ::item_visible (item); } @@ -135,7 +151,8 @@ typedef bool ITEMCALLBACK(NCursesMenuItem&); // If you don't like to create a child class for individual items to // overload action(), you may use this class and provide a callback // function pointer for items. -class NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem { +class NCURSES_IMPEXP NCursesMenuCallbackItem : public NCursesMenuItem +{ private: ITEMCALLBACK* p_fct; @@ -146,17 +163,43 @@ public: : NCursesMenuItem (p_name, p_descript), p_fct (fct) { } - + + NCursesMenuCallbackItem& operator=(const NCursesMenuCallbackItem& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + NCursesMenuCallbackItem(const NCursesMenuCallbackItem& rhs) + : NCursesMenuItem(rhs), + p_fct(0) + { + } + virtual ~NCursesMenuCallbackItem(); bool action(); }; + + // This are the built-in hook functions in this C++ binding. In C++ we use + // virtual member functions (see below On_..._Init and On_..._Termination) + // to provide this functionality in an object oriented manner. +extern "C" { + void _nc_xx_mnu_init(MENU *); + void _nc_xx_mnu_term(MENU *); + void _nc_xx_itm_init(MENU *); + void _nc_xx_itm_term(MENU *); +} + // // ------------------------------------------------------------------------- // This wraps the MENU type of // ------------------------------------------------------------------------- // -class NCURSES_IMPEXP NCursesMenu : public NCursesPanel { +class NCURSES_IMPEXP NCursesMenu : public NCursesPanel +{ protected: MENU *menu; @@ -178,36 +221,33 @@ private: // Get the backward pointer to the C++ object from a MENU static inline NCursesMenu* getHook(const MENU *m) { - UserHook* hook = (UserHook*)::menu_userptr(m); + UserHook* hook = STATIC_CAST(UserHook*)(::menu_userptr(m)); assert(hook != 0 && hook->m_owner==m); - return (NCursesMenu*)(hook->m_back); + return const_cast(hook->m_back); } - // This are the built-in hook functions in this C++ binding. In C++ we use - // virtual member functions (see below On_..._Init and On_..._Termination) - // to provide this functionality in an object oriented manner. - static void mnu_init(MENU *); - static void mnu_term(MENU *); - static void itm_init(MENU *); - static void itm_term(MENU *); - + friend void _nc_xx_mnu_init(MENU *); + friend void _nc_xx_mnu_term(MENU *); + friend void _nc_xx_itm_init(MENU *); + friend void _nc_xx_itm_term(MENU *); + // Calculate ITEM* array for the menu ITEM** mapItems(NCursesMenuItem* nitems[]); - + protected: - // internal routines + // internal routines inline void set_user(void *user) { - UserHook* uptr = (UserHook*)::menu_userptr (menu); + UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu)); assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu); uptr->m_user = user; } inline void *get_user() { - UserHook* uptr = (UserHook*)::menu_userptr (menu); + UserHook* uptr = STATIC_CAST(UserHook*)(::menu_userptr (menu)); assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==menu); return uptr->m_user; - } - + } + void InitMenu (NCursesMenuItem* menu[], bool with_frame, bool autoDeleteItems); @@ -216,18 +256,24 @@ protected: if (err != E_OK) THROW(new NCursesMenuException (this, err)); } - + // this wraps the menu_driver call. virtual int driver (int c) ; - + // 'Internal' constructor to create a menu without association to // an array of items. - NCursesMenu( int lines, - int cols, - int begin_y = 0, - int begin_x = 0) - : NCursesPanel(lines,cols,begin_y,begin_x), - menu ((MENU*)0) { + NCursesMenu( int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0) + : NCursesPanel(nlines,ncols,begin_y,begin_x), + menu (STATIC_CAST(MENU*)(0)), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) + { } public: @@ -235,22 +281,56 @@ public: NCursesMenu (NCursesMenuItem* Items[], bool with_frame=FALSE, // Reserve space for a frame? bool autoDelete_Items=FALSE) // Autocleanup of Items? - : NCursesPanel() { + : NCursesPanel(), + menu(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) + { InitMenu(Items, with_frame, autoDelete_Items); } // Make a menu with a window of this size. - NCursesMenu (NCursesMenuItem* Items[], - int lines, - int cols, - int begin_y = 0, + NCursesMenu (NCursesMenuItem* Items[], + int nlines, + int ncols, + int begin_y = 0, int begin_x = 0, bool with_frame=FALSE, // Reserve space for a frame? bool autoDelete_Items=FALSE) // Autocleanup of Items? - : NCursesPanel(lines, cols, begin_y, begin_x) { + : NCursesPanel(nlines, ncols, begin_y, begin_x), + menu(0), + sub(0), + b_sub_owner(0), + b_framed(0), + b_autoDelete(0), + my_items(0) + { InitMenu(Items, with_frame, autoDelete_Items); } + NCursesMenu& operator=(const NCursesMenu& rhs) + { + if (this != &rhs) { + *this = rhs; + NCursesPanel::operator=(rhs); + } + return *this; + } + + NCursesMenu(const NCursesMenu& rhs) + : NCursesPanel(rhs), + menu(rhs.menu), + sub(rhs.sub), + b_sub_owner(rhs.b_sub_owner), + b_framed(rhs.b_framed), + b_autoDelete(rhs.b_autoDelete), + my_items(rhs.my_items) + { + } + virtual ~NCursesMenu (); // Retrieve the menus subwindow @@ -264,17 +344,17 @@ public: // Set these items for the menu inline void setItems(NCursesMenuItem* Items[]) { - OnError(::set_menu_items(menu,mapItems(Items))); + OnError(::set_menu_items(menu,mapItems(Items))); } // Remove the menu from the screen - inline void unpost (void) { - OnError (::unpost_menu (menu)); + inline void unpost (void) { + OnError (::unpost_menu (menu)); } - + // Post the menu to the screen if flag is true, unpost it otherwise inline void post(bool flag = TRUE) { - flag ? OnError (::post_menu(menu)) : OnError (::unpost_menu (menu)); + flag ? OnError (::post_menu(menu)) : OnError (::unpost_menu (menu)); } // Get the numer of rows and columns for this menu @@ -286,35 +366,35 @@ public: inline void set_format(int mrows, int mcols) { OnError (::set_menu_format(menu, mrows, mcols)); } - + // Get the format of this menu - inline void menu_format(int& rows,int& cols) { - ::menu_format(menu,&rows,&cols); + inline void menu_format(int& rows,int& ncols) { + ::menu_format(menu,&rows,&ncols); } - + // Items of the menu inline NCursesMenuItem* items() const { - return *my_items; + return *my_items; } // Get the number of items in this menu inline int count() const { - return ::item_count(menu); + return ::item_count(menu); } // Get the current item (i.e. the one the cursor is located) inline NCursesMenuItem* current_item() const { return my_items[::item_index(::current_item(menu))]; } - + // Get the marker string inline const char* mark() const { return ::menu_mark(menu); } // Set the marker string - inline void set_mark(const char *mark) { - OnError (::set_menu_mark (menu, mark)); + inline void set_mark(const char *marker) { + OnError (::set_menu_mark (menu, marker)); } // Get the name of the request code c @@ -363,7 +443,7 @@ public: inline chtype set_grey(chtype a) { return ::set_menu_grey(menu,a); } - + inline void options_on (Menu_Options opts) { OnError (::menu_opts_on (menu,opts)); } @@ -375,7 +455,7 @@ public: inline Menu_Options options() const { return ::menu_opts(menu); } - + inline void set_options (Menu_Options opts) { OnError (::set_menu_opts (menu,opts)); } @@ -387,7 +467,7 @@ public: inline void set_pad (int padch) { OnError (::set_menu_pad (menu, padch)); } - + // Position the cursor to the current item inline void position_cursor () const { OnError (::pos_menu_cursor (menu)); @@ -418,7 +498,7 @@ public: spc_rows, spc_columns)); } - + // Get the spacing info for the menu inline void Spacing(int& spc_description, int& spc_rows, @@ -443,7 +523,7 @@ public: else OnError(E_SYSTEM_ERROR); } - + inline void label(const char *topLabel, const char *bottomLabel) { if (b_framed) NCursesPanel::label(topLabel,bottomLabel); @@ -468,7 +548,7 @@ public: // Called before this item is left as current item. virtual void On_Item_Termination(NCursesMenuItem& item); - + // Provide a default key virtualization. Translate the keyboard // code c into a menu request code. // The default implementation provides a hopefully straightforward @@ -495,7 +575,7 @@ public: // Called if the request is denied virtual void On_Request_Denied(int c) const; - + // Called if the item is not selectable virtual void On_Not_Selectable(int c) const; @@ -519,21 +599,21 @@ template class NCURSES_IMPEXP NCursesUserItem : public NCursesMenuItem public: NCursesUserItem (const char* p_name, const char* p_descript = NULL, - const T* p_UserData = (T*)0) + const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesMenuItem (p_name, p_descript) { if (item) - OnError (::set_item_userptr (item, (void *)p_UserData)); - }; + OnError (::set_item_userptr (item, const_cast(reinterpret_cast(p_UserData)))); + } - virtual ~NCursesUserItem() {}; + virtual ~NCursesUserItem() {} inline const T* UserData (void) const { - return (const T*)::item_userptr (item); + return reinterpret_cast(::item_userptr (item)); }; inline virtual void setUserData(const T* p_UserData) { if (item) - OnError (::set_item_userptr (item, (void *)p_UserData)); + OnError (::set_item_userptr (item, const_cast(reinterpret_cast(p_UserData)))); } }; // @@ -544,49 +624,49 @@ public: template class NCURSES_IMPEXP NCursesUserMenu : public NCursesMenu { protected: - NCursesUserMenu( int lines, - int cols, - int begin_y = 0, + NCursesUserMenu( int nlines, + int ncols, + int begin_y = 0, int begin_x = 0, - const T* p_UserData = (T*)0) - : NCursesMenu(lines,cols,begin_y,begin_x) { + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesMenu(nlines,ncols,begin_y,begin_x) { if (menu) - set_user ((void *)p_UserData); + set_user (const_cast(p_UserData)); } public: NCursesUserMenu (NCursesMenuItem Items[], - const T* p_UserData = (T*)0, + const T* p_UserData = STATIC_CAST(T*)(0), bool with_frame=FALSE, bool autoDelete_Items=FALSE) : NCursesMenu (Items, with_frame, autoDelete_Items) { if (menu) - set_user ((void *)p_UserData); + set_user (const_cast(p_UserData)); }; - + NCursesUserMenu (NCursesMenuItem Items[], - int lines, - int cols, - int begin_y = 0, + int nlines, + int ncols, + int begin_y = 0, int begin_x = 0, - const T* p_UserData = (T*)0, + const T* p_UserData = STATIC_CAST(T*)(0), bool with_frame=FALSE) - : NCursesMenu (Items, lines, cols, begin_y, begin_x, with_frame) { + : NCursesMenu (Items, nlines, ncols, begin_y, begin_x, with_frame) { if (menu) - set_user ((void *)p_UserData); - }; - + set_user (const_cast(p_UserData)); + }; + virtual ~NCursesUserMenu() { }; - + inline T* UserData (void) const { - return (T*)get_user (); + return reinterpret_cast(get_user ()); }; inline virtual void setUserData (const T* p_UserData) { if (menu) - set_user ((void *)p_UserData); + set_user (const_cast(p_UserData)); } }; -#endif // NCURSES_CURSESM_H_incl +#endif /* NCURSES_CURSESM_H_incl */ diff --git a/c++/cursesp.cc b/c++/cursesp.cc index c236d516..9c4eab69 100644 --- a/c++/cursesp.cc +++ b/c++/cursesp.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -33,13 +33,13 @@ #include "internal.h" #include "cursesp.h" -#include -MODULE_ID("$Id: cursesp.cc,v 1.21 2003/10/25 15:04:46 tom Exp $") +MODULE_ID("$Id: cursesp.cc,v 1.25 2005/08/06 22:12:36 tom Exp $") -NCursesPanel* NCursesPanel::dummy = (NCursesPanel*)0; +NCursesPanel* NCursesPanel::dummy = static_cast(0); -void NCursesPanel::init() { +void NCursesPanel::init() +{ p = ::new_panel(w); if (!p) OnError(ERR); @@ -48,11 +48,12 @@ void NCursesPanel::init() { hook->m_user = NULL; hook->m_back = this; hook->m_owner = p; - ::set_panel_userptr(p, (void *)hook); + ::set_panel_userptr(p, reinterpret_cast(hook)); } -NCursesPanel::~NCursesPanel() { - UserHook* hook = (UserHook*)::panel_userptr(p); +NCursesPanel::~NCursesPanel() +{ + UserHook* hook = UserPointer(); assert(hook != 0 && hook->m_back==this && hook->m_owner==p); delete hook; ::del_panel(p); @@ -60,7 +61,8 @@ NCursesPanel::~NCursesPanel() { } void -NCursesPanel::redraw() { +NCursesPanel::redraw() +{ PANEL *pan; pan = ::panel_above(NULL); @@ -73,26 +75,30 @@ NCursesPanel::redraw() { } int -NCursesPanel::refresh() { +NCursesPanel::refresh() +{ ::update_panels(); return ::doupdate(); } int -NCursesPanel::noutrefresh() { +NCursesPanel::noutrefresh() +{ ::update_panels(); return OK; } void -NCursesPanel::boldframe(const char *title, const char* btitle) { +NCursesPanel::boldframe(const char *title, const char* btitle) +{ standout(); frame(title, btitle); standend(); } void -NCursesPanel::frame(const char *title,const char *btitle) { +NCursesPanel::frame(const char *title,const char *btitle) +{ int err = OK; if (!title && !btitle) { err = box(); @@ -106,7 +112,8 @@ NCursesPanel::frame(const char *title,const char *btitle) { } void -NCursesPanel::label(const char *tLabel, const char *bLabel) { +NCursesPanel::label(const char *tLabel, const char *bLabel) +{ if (tLabel) centertext(0,tLabel); if (bLabel) @@ -114,16 +121,18 @@ NCursesPanel::label(const char *tLabel, const char *bLabel) { } void -NCursesPanel::centertext(int row,const char *label) { - if (label) { - int x = (maxx() - ::strlen(label)) / 2; +NCursesPanel::centertext(int row,const char *labelText) +{ + if (labelText) { + int x = (maxx() - ::strlen(labelText)) / 2; if (x<0) x=0; - OnError(addstr(row, x, label, width())); + OnError(addstr(row, x, labelText, width())); } } int -NCursesPanel::getKey(void) { +NCursesPanel::getKey(void) +{ return getch(); } diff --git a/c++/cursesp.h b/c++/cursesp.h index 33eae9b2..adb54455 100644 --- a/c++/cursesp.h +++ b/c++/cursesp.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,7 +34,7 @@ #ifndef NCURSES_CURSESP_H_incl #define NCURSES_CURSESP_H_incl 1 -// $Id: cursesp.h,v 1.18 2003/10/25 15:04:46 tom Exp $ +// $Id: cursesp.h,v 1.26 2005/08/13 18:09:21 tom Exp $ #include @@ -42,7 +42,9 @@ extern "C" { # include } -class NCURSES_IMPEXP NCursesPanel : public NCursesWindow { +class NCURSES_IMPEXP NCursesPanel + : public NCursesWindow +{ protected: PANEL *p; static NCursesPanel *dummy; @@ -56,23 +58,33 @@ private: const PANEL* m_owner; // the panel itself } UserHook; + inline UserHook *UserPointer() + { + UserHook* uptr = reinterpret_cast( + const_cast(::panel_userptr (p))); + return uptr; + } + void init(); // Initialize the panel object protected: - void set_user(void *user) { - UserHook* uptr = (UserHook*)::panel_userptr (p); + void set_user(void *user) + { + UserHook* uptr = UserPointer(); assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==p); uptr->m_user = user; } // Set the user pointer of the panel. - - void *get_user() { - UserHook* uptr = (UserHook*)::panel_userptr (p); + + void *get_user() + { + UserHook* uptr = UserPointer(); assert (uptr != 0 && uptr->m_back==this && uptr->m_owner==p); return uptr->m_user; } - - void OnError (int err) const THROWS((NCursesPanelException)) { + + void OnError (int err) const THROWS((NCursesPanelException)) + { if (err==ERR) THROW(new NCursesPanelException (this, err)); } @@ -83,50 +95,76 @@ protected: virtual int getKey(void); public: - NCursesPanel(int lines, - int cols, + NCursesPanel(int nlines, + int ncols, int begin_y = 0, int begin_x = 0) - : NCursesWindow(lines,cols,begin_y,begin_x) { - init(); - } + : NCursesWindow(nlines,ncols,begin_y,begin_x), p(0) + { + init(); + } // Create a panel with this size starting at the requested position. - NCursesPanel() : NCursesWindow(::stdscr) { init(); } + NCursesPanel() + : NCursesWindow(::stdscr), p(0) + { + init(); + } // This constructor creates the default Panel associated with the // ::stdscr window + NCursesPanel& operator=(const NCursesPanel& rhs) + { + if (this != &rhs) { + *this = rhs; + NCursesWindow::operator=(rhs); + } + return *this; + } + + NCursesPanel(const NCursesPanel& rhs) + : NCursesWindow(rhs), + p(rhs.p) + { + } + virtual ~NCursesPanel(); - + // basic manipulation - inline void hide() { + inline void hide() + { OnError (::hide_panel(p)); } // Hide the panel. It stays in the stack but becomes invisible. - inline void show() { + inline void show() + { OnError (::show_panel(p)); } // Show the panel, i.e. make it visible. - inline void top() { + inline void top() + { OnError (::top_panel(p)); } // Make this panel the top panel in the stack. - - inline void bottom() { + + inline void bottom() + { OnError (::bottom_panel(p)); } // Make this panel the bottom panel in the stack. // N.B.: The panel associated with ::stdscr is always on the bottom. So // actually bottom() makes the panel the first above ::stdscr. - - virtual int mvwin(int y, int x) { + + virtual int mvwin(int y, int x) + { OnError(::move_panel(p, y, x)); return OK; } - - inline bool hidden() const { + + inline bool hidden() const + { return (::panel_hidden (p) ? TRUE : FALSE); } // Return TRUE if the panel is hidden, FALSE otherwise. @@ -138,12 +176,14 @@ public: need a reverse mapping from PANEL to NCursesPanel which needs some redesign of the low level stuff. At the moment, we define them in the interface but they will always produce an error. */ - inline NCursesPanel& above() const { + inline NCursesPanel& above() const + { OnError(ERR); return *dummy; } - inline NCursesPanel& below() const { + inline NCursesPanel& below() const + { OnError(ERR); return *dummy; } @@ -151,7 +191,7 @@ public: // Those two are rewrites of the corresponding virtual members of // NCursesWindow virtual int refresh(); - // Propagate all panel changes to the virtual screen and update the + // Propagate all panel changes to the virtual screen and update the // physical screen. virtual int noutrefresh(); @@ -159,9 +199,9 @@ public: static void redraw(); // Redraw all panels. - + // decorations - virtual void frame(const char* title=NULL, + virtual void frame(const char* title=NULL, const char* btitle=NULL); // Put a frame around the panel and put the title centered in the top line // and btitle in the bottom line. @@ -179,43 +219,47 @@ public: }; /* We use templates to provide a typesafe mechanism to associate - * user data with a panel. A NCursesUserPanel is a panel + * user data with a panel. A NCursesUserPanel is a panel * associated with some user data of type T. */ template class NCursesUserPanel : public NCursesPanel { public: - NCursesUserPanel (int lines, - int cols, + NCursesUserPanel (int nlines, + int ncols, int begin_y = 0, int begin_x = 0, - const T* p_UserData = (T*)0) - : NCursesPanel (lines, cols, begin_y, begin_x) { + const T* p_UserData = STATIC_CAST(T*)(0)) + : NCursesPanel (nlines, ncols, begin_y, begin_x) + { if (p) - set_user ((void *)p_UserData); + set_user (const_cast(p_UserData)); }; // This creates an user panel of the requested size with associated // user data pointed to by p_UserData. - - NCursesUserPanel(const T* p_UserData = (T*)0) : NCursesPanel() { + + NCursesUserPanel(const T* p_UserData = STATIC_CAST(T*)(0)) : NCursesPanel() + { if (p) - set_user((void *)p_UserData); + set_user(const_cast(p_UserData)); }; // This creates an user panel associated with the ::stdscr and user data // pointed to by p_UserData. virtual ~NCursesUserPanel() {}; - T* UserData (void) const { - return (T*)get_user (); + T* UserData (void) const + { + return reinterpret_cast(get_user ()); }; // Retrieve the user data associated with the panel. - - virtual void setUserData (const T* p_UserData) { + + virtual void setUserData (const T* p_UserData) + { if (p) - set_user ((void *)p_UserData); + set_user (const_cast(p_UserData)); } // Associate the user panel with the user data pointed to by p_UserData. }; -#endif // NCURSES_CURSESP_H_incl +#endif /* NCURSES_CURSESP_H_incl */ diff --git a/c++/cursespad.cc b/c++/cursespad.cc index 2d067a0e..d875a815 100644 --- a/c++/cursespad.cc +++ b/c++/cursespad.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,20 +32,23 @@ ****************************************************************************/ #include "internal.h" + +#include + #include "etip.h" #include "cursesw.h" -MODULE_ID("$Id: cursespad.cc,v 1.7 2003/10/25 15:04:46 tom Exp $") +MODULE_ID("$Id: cursespad.cc,v 1.11 2005/07/23 20:51:23 tom Exp $") -NCursesPad::NCursesPad(int lines, int cols) +NCursesPad::NCursesPad(int nlines, int ncols) : NCursesWindow(), - viewWin((NCursesWindow*)0), - viewSub((NCursesWindow*)0), + viewWin(static_cast(0)), + viewSub(static_cast(0)), h_gridsize(0), v_gridsize(0), min_row(0), min_col(0) { - w = ::newpad(lines,cols); - if ((WINDOW*)0==w) { + w = ::newpad(nlines, ncols); + if (static_cast(0) == w) { count--; err_handler("Cannot construct window"); } @@ -84,7 +87,7 @@ void NCursesPad::operator()(void) { NCursesWindow* W = Win(); - if ((NCursesWindow*)0 != W) { + if (static_cast(0) != W) { int Width = W->width(); int Height = W->height(); @@ -169,7 +172,7 @@ void NCursesPad::operator()(void) int NCursesPad::refresh() { int res = noutrefresh(); - if (res==OK && ((NCursesWindow*)0 != viewWin)) { + if (res==OK && (static_cast(0) != viewWin)) { res = (viewWin->refresh()); } return(res); @@ -179,9 +182,11 @@ int NCursesPad::noutrefresh() { int res = OK; NCursesWindow* W = Win(); - if ((NCursesWindow*)0 != W) { - res = copywin(*W,min_row,min_col, - 0,0,W->maxy(),W->maxx(), + if (static_cast(0) != W) { + int high = W->maxy(); + int wide = W->maxx(); + res = copywin(*W, min_row, min_col, + 0, 0, high, wide, FALSE); if (res==OK) { W->syncup(); @@ -207,7 +212,7 @@ void NCursesPad::setWindow(NCursesWindow& view, void NCursesPad::setSubWindow(NCursesWindow& sub) { - if ((NCursesWindow*)0 == viewWin) + if (static_cast(0) == viewWin) err_handler("Pad has no viewport"); if (!viewWin->isDescendant(sub)) THROW(new NCursesException("NCursesFramePad", E_SYSTEM_ERROR)); @@ -217,9 +222,9 @@ void NCursesPad::setSubWindow(NCursesWindow& sub) void NCursesFramedPad::OnOperation(int pad_req) { NCursesWindow* W = Win(); - NCursesWindow* Win = getWindow(); + NCursesWindow* W2 = getWindow(); - if (((NCursesWindow*)0 != W) && ((NCursesWindow*)0 != Win)) { + if ((static_cast(0) != W) && (static_cast(0) != W2)) { int Width = W->width(); int Height = W->height(); int i, row, col, h_len, v_len; @@ -244,32 +249,32 @@ void NCursesFramedPad::OnOperation(int pad_req) if (row + v_len > Height) row = Height - v_len; - Win->vline(1,Width+1,Height); - Win->attron(A_REVERSE); + W2->vline(1,Width+1,Height); + W2->attron(A_REVERSE); if (v_len>=2) { - Win->addch(row+1,Width+1,ACS_UARROW); + W2->addch(row+1,Width+1,ACS_UARROW); for(i=2;iaddch(row+i,Width+1,' '); - Win->addch(row+v_len,Width+1,ACS_DARROW); + W2->addch(row+i,Width+1,' '); + W2->addch(row+v_len,Width+1,ACS_DARROW); } else { for(i=1;i<=v_len;i++) - Win->addch(row+i,Width+1,' '); + W2->addch(row+i,Width+1,' '); } - Win->attroff(A_REVERSE); + W2->attroff(A_REVERSE); - Win->hline(Height+1,1,Width); - Win->attron(A_REVERSE); + W2->hline(Height+1,1,Width); + W2->attron(A_REVERSE); if (h_len >= 2) { - Win->addch(Height+1,col+1,ACS_LARROW); + W2->addch(Height+1,col+1,ACS_LARROW); for(i=2;iaddch(Height+1,col+i,' '); - Win->addch(Height+1,col+h_len,ACS_RARROW); + W2->addch(Height+1,col+i,' '); + W2->addch(Height+1,col+h_len,ACS_RARROW); } else { for(i=1;i<=h_len;i++) - Win->addch(Height+1,col+i,' '); + W2->addch(Height+1,col+i,' '); } - Win->attroff(A_REVERSE); + W2->attroff(A_REVERSE); } } diff --git a/c++/cursesw.cc b/c++/cursesw.cc index 662edb5a..106202a5 100644 --- a/c++/cursesw.cc +++ b/c++/cursesw.cc @@ -26,7 +26,7 @@ #include "internal.h" #include "cursesw.h" -MODULE_ID("$Id: cursesw.cc,v 1.26 2003/10/25 15:02:46 tom Exp $") +MODULE_ID("$Id: cursesw.cc,v 1.32 2005/08/13 18:12:17 tom Exp $") #define COLORS_NEED_INITIALIZATION -1 #define COLORS_NOT_INITIALIZED 0 @@ -150,7 +150,8 @@ NCursesWindow::err_handler(const char *msg) const THROWS(NCursesException) } void -NCursesWindow::initialize() { +NCursesWindow::initialize() +{ if (!b_initialized) { ::initscr(); b_initialized = TRUE; @@ -163,21 +164,24 @@ NCursesWindow::initialize() { } } -NCursesWindow::NCursesWindow() { +NCursesWindow::NCursesWindow() + : w(0), alloced(0), par(0), subwins(0), sib(0) +{ initialize(); - w = (WINDOW *)0; + w = static_cast(0); init(); alloced = FALSE; subwins = par = sib = 0; count++; } -NCursesWindow::NCursesWindow(int lines, int cols, int begin_y, int begin_x) +NCursesWindow::NCursesWindow(int nlines, int ncols, int begin_y, int begin_x) + : w(0), alloced(0), par(0), subwins(0), sib(0) { initialize(); - w = ::newwin(lines, cols, begin_y, begin_x); + w = ::newwin(nlines, ncols, begin_y, begin_x); if (w == 0) { err_handler("Cannot construct window"); } @@ -189,6 +193,7 @@ NCursesWindow::NCursesWindow(int lines, int cols, int begin_y, int begin_x) } NCursesWindow::NCursesWindow(WINDOW* &window) + : w(0), alloced(0), par(0), subwins(0), sib(0) { initialize(); @@ -201,6 +206,7 @@ NCursesWindow::NCursesWindow(WINDOW* &window) NCursesWindow::NCursesWindow(NCursesWindow& win, int l, int c, int begin_y, int begin_x, char absrel) + : w(0), alloced(0), par(0), subwins(0), sib(0) { initialize(); if (absrel == 'a') { // absolute origin @@ -227,9 +233,12 @@ NCursesWindow::NCursesWindow(NCursesWindow& win, int l, int c, NCursesWindow::NCursesWindow(NCursesWindow& win, bool do_box NCURSES_PARAM_INIT(TRUE)) + : w(0), alloced(0), par(0), subwins(0), sib(0) { initialize(); - w = :: derwin(win.w,win.height()-2,win.width()-2,1,1); + int myHeight = win.height(); + int myWidth = win.width(); + w = :: derwin(win.w, myHeight - 2, myWidth - 2, 1, 1); if (w == 0) { err_handler("Cannot construct subwindow"); } @@ -247,7 +256,8 @@ NCursesWindow::NCursesWindow(NCursesWindow& win, } } -NCursesWindow NCursesWindow::Clone() { +NCursesWindow NCursesWindow::Clone() +{ WINDOW *d = ::dupwin(w); NCursesWindow W(d); W.subwins = subwins; @@ -262,31 +272,32 @@ static RIPOFFINIT R_INIT[5]; // There can't be more static int r_init_idx = 0; static RIPOFFINIT* prip = R_INIT; -extern "C" int _nc_ripoffline(int,int (*init)(WINDOW*,int)); - -NCursesWindow::NCursesWindow(WINDOW *win, int cols) { +NCursesWindow::NCursesWindow(WINDOW *win, int ncols) + : w(0), alloced(0), par(0), subwins(0), sib(0) +{ initialize(); w = win; - assert((w->_maxx+1)==cols); + assert((w->_maxx+1)==ncols); alloced = FALSE; subwins = par = sib = 0; } -int NCursesWindow::ripoff_init(WINDOW *w, int cols) +int _nc_xx_ripoff_init(WINDOW *w, int ncols) { int res = ERR; RIPOFFINIT init = *prip++; if (init) { - NCursesWindow* W = new NCursesWindow(w,cols); + NCursesWindow* W = new NCursesWindow(w,ncols); res = init(*W); } return res; } int NCursesWindow::ripoffline(int ripoff_lines, - int (*init)(NCursesWindow& win)) { - int code = ::_nc_ripoffline(ripoff_lines,ripoff_init); + int (*init)(NCursesWindow& win)) +{ + int code = ::_nc_ripoffline(ripoff_lines,_nc_xx_ripoff_init); if (code==OK && init && ripoff_lines) { R_INIT[r_init_idx++] = init; } @@ -294,7 +305,8 @@ int NCursesWindow::ripoffline(int ripoff_lines, } bool -NCursesWindow::isDescendant(NCursesWindow& win) { +NCursesWindow::isDescendant(NCursesWindow& win) +{ for (NCursesWindow* p = subwins; p != NULL; p = p->sib) { if (p==&win) return TRUE; @@ -386,7 +398,7 @@ NCursesWindow::getcolor(int getback) const short fore, back; if (colorInitialized==COLORS_ARE_REALLY_THERE) { - if (::pair_content((short)PAIR_NUMBER(w->_attrs), &fore, &back)) + if (::pair_content(static_cast(PAIR_NUMBER(w->_attrs)), &fore, &back)) err_handler("Can't get color pair"); } else { @@ -427,7 +439,7 @@ int NCursesWindow::setpalette(short fore, short back) { if (colorInitialized==COLORS_ARE_REALLY_THERE) - return setpalette(fore, back, (short)PAIR_NUMBER(w->_attrs)); + return setpalette(fore, back, static_cast(PAIR_NUMBER(w->_attrs))); else return OK; } @@ -447,9 +459,8 @@ NCursesWindow::setcolor(short pair) } #if HAVE_HAS_KEY -extern "C" int _nc_has_mouse(void); - -bool NCursesWindow::has_mouse() const { +bool NCursesWindow::has_mouse() const +{ return ((::has_key(KEY_MOUSE) || ::_nc_has_mouse()) ? TRUE : FALSE); } diff --git a/c++/cursesw.h b/c++/cursesw.h index 8e86ff99..13f87a68 100644 --- a/c++/cursesw.h +++ b/c++/cursesw.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2001,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,12 +30,13 @@ #ifndef NCURSES_CURSESW_H_incl #define NCURSES_CURSESW_H_incl 1 -// $Id: cursesw.h,v 1.30 2004/02/08 00:11:54 tom Exp $ +// $Id: cursesw.h,v 1.38 2005/07/23 20:51:39 tom Exp $ -#include #include #include +#include + #if HAVE_STRSTREAM_H && (USE_STRSTREAM_VSCAN||USE_STRSTREAM_VSCAN_CAST) #include #endif @@ -307,7 +308,7 @@ inline chtype UNDEF(inch)() { return inch(); } #endif #ifdef insch -inline int UNDEF(insch)(char c) { return insch(c); } +inline int UNDEF(insch)(chtype c) { return insch(c); } #undef insch #define insch UNDEF(insch) #endif @@ -567,7 +568,7 @@ inline chtype UNDEF(mvwinch)(WINDOW *win, int y, int x) { #endif #ifdef mvwinsch -inline int UNDEF(mvwinsch)(WINDOW *win, int y, int x, char c) +inline int UNDEF(mvwinsch)(WINDOW *win, int y, int x, chtype c) { return mvwinsch(win, y, x, c); } #undef mvwinsch #define mvwinsch UNDEF(mvwinsch) @@ -626,7 +627,7 @@ inline chtype UNDEF(mvinch)(int y, int x) { return mvinch(y, x);} #endif #ifdef mvinsch -inline int UNDEF(mvinsch)(int y, int x, char c) +inline int UNDEF(mvinsch)(int y, int x, chtype c) { return mvinsch(y, x, c); } #undef mvinsch #define mvinsch UNDEF(mvinsch) @@ -690,9 +691,12 @@ inline void UNDEF(bkgdset)(chtype ch) { bkgdset(ch); } * * C++ class for windows. * - * */ +extern "C" int _nc_ripoffline(int, int (*init)(WINDOW*, int)); +extern "C" int _nc_xx_ripoff_init(WINDOW *, int); +extern "C" int _nc_has_mouse(void); + class NCURSES_IMPEXP NCursesWindow { friend class NCursesMenu; @@ -701,7 +705,7 @@ class NCURSES_IMPEXP NCursesWindow private: static bool b_initialized; static void initialize(); - static int ripoff_init(WINDOW *, int); + friend int _nc_xx_ripoff_init(WINDOW *, int); void init(); @@ -712,10 +716,10 @@ private: // This private constructor is only used during the initialization // of windows generated by ripoffline() calls. - NCursesWindow(WINDOW* win, int cols); + NCursesWindow(WINDOW* win, int ncols); protected: - void err_handler(const char *) const THROWS(NCursesException); + virtual void err_handler(const char *) const THROWS(NCursesException); // Signal an error with the given message text. static long count; // count of all active windows: @@ -741,14 +745,14 @@ protected: public: NCursesWindow(WINDOW* &window); // useful only for stdscr - NCursesWindow(int lines, // number of lines - int cols, // number of columns + NCursesWindow(int nlines, // number of lines + int ncols, // number of columns int begin_y, // line origin int begin_x); // col origin NCursesWindow(NCursesWindow& par,// parent window - int lines, // number of lines - int cols, // number of columns + int nlines, // number of lines + int ncols, // number of columns int begin_y, // absolute or relative int begin_x, // origins: char absrel = 'a');// if `a', begin_y & begin_x are @@ -760,6 +764,18 @@ public: // is two lines and two columns smaller and begins at (1,1). // We may automatically request the box around it. + NCursesWindow& operator=(const NCursesWindow& rhs) + { + if (this != &rhs) + *this = rhs; + return *this; + } + + NCursesWindow(const NCursesWindow& rhs) + : w(rhs.w), alloced(rhs.alloced), par(rhs.par), subwins(rhs.subwins), sib(rhs.sib) + { + } + virtual ~NCursesWindow(); NCursesWindow Clone(); @@ -979,10 +995,10 @@ public: int attron (chtype at) { return ::wattron (w, at); } // Switch on the window attributes; - int attroff(chtype at) { return ::wattroff(w, (int) at); } + int attroff(chtype at) { return ::wattroff(w, static_cast(at)); } // Switch off the window attributes; - int attrset(chtype at) { return ::wattrset(w, (int) at); } + int attrset(chtype at) { return ::wattrset(w, static_cast(at)); } // Set the window attributes; int color_set(short color_pair_number, void* opts=NULL) { @@ -1112,7 +1128,7 @@ public: // Mark the whole window as unmodified. int touchln(int s, int cnt, bool changed=TRUE) { - return ::wtouchln(w, s, cnt, (int)(changed?1:0)); } + return ::wtouchln(w, s, cnt, static_cast(changed ? 1 : 0)); } // Mark cnt lines beginning from line s as changed or unchanged, depending // on the value of the changed flag. @@ -1196,9 +1212,9 @@ public: int copywin(NCursesWindow& win, int sminrow, int smincol, int dminrow, int dmincol, - int dmaxrow, int dmaxcol, bool overlay=TRUE) { + int dmaxrow, int dmaxcol, bool overlaywin=TRUE) { return ::copywin(w, win.w, sminrow, smincol, dminrow, dmincol, - dmaxrow, dmaxcol, (int)(overlay?1:0)); } + dmaxrow, dmaxcol, static_cast(overlaywin ? 1 : 0)); } // Overlay or overwrite the rectangle in win given by dminrow,dmincol, // dmaxrow,dmaxcol with the rectangle in this window beginning at // sminrow,smincol. @@ -1228,26 +1244,28 @@ public: // ------------------------------------------------------------------------- // We leave this here for compatibility reasons. // ------------------------------------------------------------------------- -class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow { +class NCURSES_IMPEXP NCursesColorWindow : public NCursesWindow +{ public: NCursesColorWindow(WINDOW* &window) // useful only for stdscr : NCursesWindow(window) { useColors(); } - NCursesColorWindow(int lines, // number of lines - int cols, // number of columns + NCursesColorWindow(int nlines, // number of lines + int ncols, // number of columns int begin_y, // line origin int begin_x) // col origin - : NCursesWindow(lines, cols, begin_y, begin_x) { + : NCursesWindow(nlines, ncols, begin_y, begin_x) { useColors(); } - NCursesColorWindow(NCursesWindow& par,// parent window - int lines, // number of lines - int cols, // number of columns + NCursesColorWindow(NCursesWindow& parentWin,// parent window + int nlines, // number of lines + int ncols, // number of columns int begin_y, // absolute or relative int begin_x, // origins: char absrel = 'a') // if `a', by & bx are - : NCursesWindow(par, lines, cols, // absolute screen pos, + : NCursesWindow(parentWin, + nlines, ncols, // absolute screen pos, begin_y, begin_x, // else if `r', they are absrel ) { // relative to par origin useColors(); } @@ -1272,7 +1290,8 @@ public: // Pad Support. We allow an association of a pad with a "real" window // through which the pad may be viewed. // ------------------------------------------------------------------------- -class NCURSES_IMPEXP NCursesPad : public NCursesWindow { +class NCURSES_IMPEXP NCursesPad : public NCursesWindow +{ private: NCursesWindow* viewWin; // the "viewport" window NCursesWindow* viewSub; // the "viewport" subwindow @@ -1314,9 +1333,29 @@ protected: // the refresh() operation is done. public: - NCursesPad(int lines, int cols); + NCursesPad(int nlines, int ncols); // create a pad with the given size + NCursesPad& operator=(const NCursesPad& rhs) + { + if (this != &rhs) { + *this = rhs; + NCursesWindow::operator=(rhs); + } + return *this; + } + + NCursesPad(const NCursesPad& rhs) + : NCursesWindow(rhs), + viewWin(rhs.viewWin), + viewSub(rhs.viewSub), + h_gridsize(rhs.h_gridsize), + v_gridsize(rhs.v_gridsize), + min_row(rhs.min_row), + min_col(rhs.min_col) + { + } + virtual ~NCursesPad() {} int echochar(const chtype ch) { return ::pechochar(w, ch); } @@ -1364,14 +1403,15 @@ public: // A FramedPad is constructed always with a viewport window. This viewport // will be framed (by a box() command) and the interior of the box is the // viewport subwindow. On the frame we display scrollbar sliders. -class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad { +class NCURSES_IMPEXP NCursesFramedPad : public NCursesPad +{ protected: virtual void OnOperation(int pad_req); public: - NCursesFramedPad(NCursesWindow& win, int lines, int cols, + NCursesFramedPad(NCursesWindow& win, int nlines, int ncols, int v_grid = 1, int h_grid = 1) - : NCursesPad(lines, cols) { + : NCursesPad(nlines, ncols) { NCursesPad::setWindow(win, v_grid, h_grid); NCursesPad::setSubWindow(*(new NCursesWindow(win))); } @@ -1393,4 +1433,4 @@ public: }; -#endif // NCURSES_CURSESW_H_incl +#endif /* NCURSES_CURSESW_H_incl */ diff --git a/c++/cursslk.cc b/c++/cursslk.cc index fbc5cda4..cfbc9da4 100644 --- a/c++/cursslk.cc +++ b/c++/cursslk.cc @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,23 +34,26 @@ #include "internal.h" #include "cursslk.h" #include "cursesapp.h" -#include -MODULE_ID("$Id: cursslk.cc,v 1.11 2003/10/25 15:04:46 tom Exp $") +MODULE_ID("$Id: cursslk.cc,v 1.15 2005/08/06 22:12:36 tom Exp $") -void Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text) { +Soft_Label_Key_Set::Soft_Label_Key& + Soft_Label_Key_Set::Soft_Label_Key::operator=(char *text) +{ delete[] label; label = new char[1 + ::strlen(text)]; (::strcpy)(label,text); + return *this; } long Soft_Label_Key_Set::count = 0L; int Soft_Label_Key_Set::num_labels = 0; -Soft_Label_Key_Set::Label_Layout +Soft_Label_Key_Set::Label_Layout Soft_Label_Key_Set::format = None; -void Soft_Label_Key_Set::init() { +void Soft_Label_Key_Set::init() +{ slk_array = new Soft_Label_Key[num_labels]; for(int i=0; i < num_labels; i++) { slk_array[i].num = i+1; @@ -58,18 +61,24 @@ void Soft_Label_Key_Set::init() { b_attrInit = FALSE; } -Soft_Label_Key_Set::Soft_Label_Key_Set() { +Soft_Label_Key_Set::Soft_Label_Key_Set() + : b_attrInit(FALSE), + slk_array(NULL) +{ if (format==None) Error("No default SLK layout"); init(); } -Soft_Label_Key_Set::Soft_Label_Key_Set(Soft_Label_Key_Set::Label_Layout fmt) { +Soft_Label_Key_Set::Soft_Label_Key_Set(Soft_Label_Key_Set::Label_Layout fmt) + : b_attrInit(FALSE), + slk_array(NULL) +{ if (fmt==None) Error("Invalid SLK Layout"); if (count++==0) { format = fmt; - if (ERR == ::slk_init((int)fmt)) + if (ERR == ::slk_init(static_cast(fmt))) Error("slk_init"); num_labels = (fmt>=PC_Style?12:8); } @@ -103,7 +112,8 @@ void Soft_Label_Key_Set::activate_label(int i, bool bf) { noutrefresh(); } -void Soft_Label_Key_Set::activate_labels(bool bf) { +void Soft_Label_Key_Set::activate_labels(bool bf) +{ if (!b_attrInit) { NCursesApplication* A = NCursesApplication::getApplication(); if (A) attrset(A->labels()); diff --git a/c++/cursslk.h b/c++/cursslk.h index 0fa1f110..091695ee 100644 --- a/c++/cursslk.h +++ b/c++/cursslk.h @@ -1,6 +1,6 @@ // * this is for making emacs happy: -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: cursslk.h,v 1.9 2003/10/25 15:04:46 tom Exp $ +// $Id: cursslk.h,v 1.13 2005/05/28 21:58:18 tom Exp $ #ifndef NCURSES_CURSSLK_H_incl #define NCURSES_CURSSLK_H_incl @@ -51,28 +51,45 @@ public: Justification format; // The Justification int num; // The number of the Label - Soft_Label_Key() : label((char*)0),format(Left),num(-1) { + Soft_Label_Key() : label(NULL), format(Left), num(-1) { } - + virtual ~Soft_Label_Key() { delete[] label; }; public: // Set the text of the Label - void operator=(char *text); - + Soft_Label_Key& operator=(char *text); + // Set the Justification of the Label - inline void operator=(Justification just) { + Soft_Label_Key& operator=(Justification just) { format = just; + return *this; } - + // Retrieve the text of the label inline char* operator()(void) const { - return label; + return label; + } + + Soft_Label_Key& operator=(const Soft_Label_Key& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + Soft_Label_Key(const Soft_Label_Key& rhs) + : label(NULL), + format(rhs.format), + num(rhs.num) + { + *this = rhs.label; } }; - + public: typedef enum { None = -1, @@ -87,7 +104,7 @@ private: static Label_Layout NCURSES_IMPEXP format; // Layout of the Key Sets static int NCURSES_IMPEXP num_labels; // Number Of Labels in Key Sets bool NCURSES_IMPEXP b_attrInit; // Are attributes initialized - + Soft_Label_Key *slk_array; // The array of SLK's // Init the Key Set @@ -105,13 +122,13 @@ protected: } // Remove SLK's from screen - void clear() { + void clear() { if (ERR==::slk_clear()) Error("slk_clear"); - } + } // Restore them - void restore() { + void restore() { if (ERR==::slk_restore()) Error("slk_restore"); } @@ -128,29 +145,45 @@ public: // with a layout by the constructor above. This layout will be reused. NCURSES_IMPEXP Soft_Label_Key_Set(); + Soft_Label_Key_Set& operator=(const Soft_Label_Key_Set& rhs) + { + if (this != &rhs) { + *this = rhs; + init(); // allocate a new slk_array[] + } + return *this; + } + + Soft_Label_Key_Set(const Soft_Label_Key_Set& rhs) + : b_attrInit(rhs.b_attrInit), + slk_array(NULL) + { + init(); // allocate a new slk_array[] + } + virtual ~Soft_Label_Key_Set(); // Get Label# i. Label counting starts with 1! NCURSES_IMPEXP Soft_Label_Key& operator[](int i); // Retrieve number of Labels - inline int labels() const { return num_labels; } + inline int labels() const { return num_labels; } // Refresh the SLK portion of the screen - inline void refresh() { + inline void refresh() { if (ERR==::slk_refresh()) Error("slk_refresh"); } // Mark the SLK portion of the screen for refresh, defer actual refresh // until next update call. - inline void noutrefresh() { + inline void noutrefresh() { if (ERR==::slk_noutrefresh()) Error("slk_noutrefresh"); } // Mark the whole SLK portion of the screen as modified - inline void touch() { + inline void touch() { if (ERR==::slk_touch()) Error("slk_touch"); } @@ -202,4 +235,4 @@ public: } }; -#endif // NCURSES_CURSSLK_H_incl +#endif /* NCURSES_CURSSLK_H_incl */ diff --git a/c++/demo.cc b/c++/demo.cc index f3fe3e46..ffc46373 100644 --- a/c++/demo.cc +++ b/c++/demo.cc @@ -6,17 +6,14 @@ * Demo code for NCursesMenu and NCursesForm written by * Juergen Pfeifer * - * $Id: demo.cc,v 1.24 2004/01/15 00:21:27 tom Exp $ + * $Id: demo.cc,v 1.32 2005/08/13 18:14:44 tom Exp $ */ +#include "internal.h" #include "cursesapp.h" #include "cursesm.h" #include "cursesf.h" -#if HAVE_LIBC_H -# include -#endif - extern "C" unsigned int sleep(unsigned int); #undef index // needed for NeXT @@ -141,10 +138,10 @@ template class MyAction : public NCursesUserItem public: MyAction (const char* p_name, const T* p_UserData) - : NCursesUserItem(p_name, (const char*)0, p_UserData) - {}; + : NCursesUserItem(p_name, static_cast(0), p_UserData) + {} - ~MyAction() {} + virtual ~MyAction() {} bool action() { SillyDemo a; @@ -153,6 +150,9 @@ public: } }; +template class MyAction; +template class NCURSES_IMPEXP NCursesUserItem; + class QuitItem : public NCursesMenuItem { public: @@ -171,7 +171,7 @@ class Label : public NCursesFormField public: Label(const char* title, int row, int col) - : NCursesFormField(1,(int)::strlen(title),row,col) { + : NCursesFormField(1, static_cast(::strlen(title)), row, col) { set_value(title); options_off(O_EDIT|O_ACTIVE); } @@ -179,7 +179,8 @@ public: // // ------------------------------------------------------------------------- // -class MyFieldType : public UserDefinedFieldType { +class MyFieldType : public UserDefinedFieldType +{ private: int chk; protected: @@ -207,7 +208,13 @@ private: static const char *weekdays[]; public: - TestForm() : NCursesForm(13,51,(lines()-15)/2,(cols()-53)/2) { + TestForm() + : NCursesForm(13, 51, (lines() - 15)/2, (cols() - 53)/2), + F(0), + mft(0), + ift(0), + eft(0) + { F = new NCursesFormField*[10]; mft = new MyFieldType('X'); @@ -239,6 +246,19 @@ public: F[8]->options_off(O_STATIC); // make field dynamic } + TestForm& operator=(const TestForm& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + TestForm(const TestForm& rhs) + : NCursesForm(rhs), F(0), mft(0), ift(0), eft(0) + { + } + ~TestForm() { delete mft; delete ift; @@ -248,7 +268,7 @@ public: const char* TestForm::weekdays[] = { "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", - "Friday", "Saturday", (const char *)0 }; + "Friday", "Saturday", NULL }; // // ------------------------------------------------------------------------- // @@ -297,7 +317,7 @@ public: if (i==0 || j==0) FP.addch('+'); else - FP.addch((chtype)('A' + (gridcount++ % 26))); + FP.addch(static_cast('A' + (gridcount++ % 26))); } else if (i % GRIDSIZE == 0) FP.addch('-'); @@ -318,7 +338,8 @@ public: // // ------------------------------------------------------------------------- // -class PassiveItem : public NCursesMenuItem { +class PassiveItem : public NCursesMenuItem +{ public: PassiveItem(const char* text) : NCursesMenuItem(text) { options_off(O_SELECTABLE); @@ -346,13 +367,13 @@ public: ::echo(); s->printw("Enter decimal integers. The running total will be shown\n"); - int value = -1; + int nvalue = -1; int result = 0; - while (value != 0) { - value = 0; - s->scanw("%d", &value); - if (value != 0) { - s->printw("%d: ", result += value); + while (nvalue != 0) { + nvalue = 0; + s->scanw("%d", &nvalue); + if (nvalue != 0) { + s->printw("%d: ", result += nvalue); } s->refresh(); } @@ -380,7 +401,8 @@ private: public: MyMenu () - : NCursesMenu (n_items+2, 8, (lines()-10)/2, (cols()-10)/2) + : NCursesMenu (n_items+2, 8, (lines()-10)/2, (cols()-10)/2), + P(0), I(0), u(0) { u = new UserData(1); I = new NCursesMenuItem*[1+n_items]; @@ -400,6 +422,19 @@ public: P->show(); } + MyMenu& operator=(const MyMenu& rhs) + { + if (this != &rhs) { + *this = rhs; + } + return *this; + } + + MyMenu(const MyMenu& rhs) + : NCursesMenu(rhs), P(0), I(0), u(0) + { + } + ~MyMenu() { P->hide(); @@ -445,7 +480,8 @@ public: // // ------------------------------------------------------------------------- // -class TestApplication : public NCursesApplication { +class TestApplication : public NCursesApplication +{ protected: int titlesize() const { return 1; } void title(); @@ -461,7 +497,8 @@ public: int run(); }; -void TestApplication::init_labels(Soft_Label_Key_Set& S) const { +void TestApplication::init_labels(Soft_Label_Key_Set& S) const +{ for(int i=1; i <= S.labels(); i++) { char buf[5]; ::sprintf(buf,"Key%02d",i); @@ -470,17 +507,19 @@ void TestApplication::init_labels(Soft_Label_Key_Set& S) const { } } -void TestApplication::title() { - const char * const title = "Simple C++ Binding Demo"; - const int len = ::strlen(title); +void TestApplication::title() +{ + const char * const titleText = "Simple C++ Binding Demo"; + const int len = ::strlen(titleText); titleWindow->bkgd(screen_titles()); - titleWindow->addstr(0,(titleWindow->cols()-len)/2,title); + titleWindow->addstr(0,(titleWindow->cols() - len)/2, titleText); titleWindow->noutrefresh(); } -int TestApplication::run() { +int TestApplication::run() +{ MyMenu M; M(); return 0; diff --git a/c++/edit_cfg.sh b/c++/edit_cfg.sh index 30c94850..b56321f1 100755 --- a/c++/edit_cfg.sh +++ b/c++/edit_cfg.sh @@ -1,7 +1,7 @@ #!/bin/sh -# $Id: edit_cfg.sh,v 1.13 2003/12/20 13:14:25 tom Exp $ +# $Id: edit_cfg.sh,v 1.14 2005/04/30 21:00:22 tom Exp $ ############################################################################## -# Copyright (c) 1998-2001,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -39,6 +39,7 @@ echo "substituting autoconf'd values from $1 into $2" for name in \ CPP_HAS_PARAM_INIT \ + CPP_HAS_STATIC_CAST \ ETIP_NEEDS_MATH_EXCEPTION \ ETIP_NEEDS_MATH_H \ HAVE_BUILTIN_H \ diff --git a/c++/etip.h.in b/c++/etip.h.in index 2ddc292a..482f8eb4 100644 --- a/c++/etip.h.in +++ b/c++/etip.h.in @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: etip.h.in,v 1.25 2003/10/25 15:05:58 tom Exp $ +// $Id: etip.h.in,v 1.32 2005/08/06 19:55:57 tom Exp $ #ifndef NCURSES_ETIP_H_incl #define NCURSES_ETIP_H_incl 1 @@ -73,6 +73,10 @@ #define CPP_HAS_PARAM_INIT 0 #endif +#ifndef CPP_HAS_STATIC_CAST +#define CPP_HAS_STATIC_CAST 0 // workaround for g++ 2.95.3 +#endif + #ifndef USE_STRSTREAM_VSCAN #define USE_STRSTREAM_VSCAN 0 #endif @@ -111,9 +115,6 @@ # endif #elif defined (__SUNPRO_CC) # include -# include -#else -# include #endif #include @@ -135,6 +136,12 @@ extern "C" { #define NCURSES_PARAM_INIT(value) /*nothing*/ #endif +#if CPP_HAS_STATIC_CAST +#define STATIC_CAST(s) static_cast +#else +#define STATIC_CAST(s) (s) +#endif + // Forward Declarations class NCURSES_IMPEXP NCursesPanel; class NCURSES_IMPEXP NCursesMenu; @@ -154,9 +161,24 @@ public: : message(msg), errorno (E_SYSTEM_ERROR) {}; + NCursesException& operator=(const NCursesException& rhs) + { + errorno = rhs.errorno; + return *this; + } + + NCursesException(const NCursesException& rhs) + : message(rhs.message), errorno(rhs.errorno) + { + } + virtual const char *classname() const { return "NCursesWindow"; } + + virtual ~NCursesException() + { + } }; class NCURSES_IMPEXP NCursesPanelException : public NCursesException @@ -166,7 +188,7 @@ public: NCursesPanelException (const char *msg, int err) : NCursesException (msg, err), - p ((NCursesPanel*)0) + p (NULL) {}; NCursesPanelException (const NCursesPanel* panel, @@ -178,7 +200,7 @@ public: NCursesPanelException (int err) : NCursesException ("panel library error", err), - p ((NCursesPanel*)0) + p (NULL) {}; NCursesPanelException (const NCursesPanel* panel, @@ -187,10 +209,27 @@ public: p (panel) {}; + NCursesPanelException& operator=(const NCursesPanelException& rhs) + { + if (this != &rhs) { + NCursesException::operator=(rhs); + p = rhs.p; + } + return *this; + } + + NCursesPanelException(const NCursesPanelException& rhs) + : NCursesException(rhs), p(rhs.p) + { + } + virtual const char *classname() const { return "NCursesPanel"; } + virtual ~NCursesPanelException() + { + } }; class NCURSES_IMPEXP NCursesMenuException : public NCursesException @@ -200,7 +239,7 @@ public: NCursesMenuException (const char *msg, int err) : NCursesException (msg, err), - m ((NCursesMenu *)0) + m (NULL) {}; NCursesMenuException (const NCursesMenu* menu, @@ -212,7 +251,7 @@ public: NCursesMenuException (int err) : NCursesException ("menu library error", err), - m ((NCursesMenu *)0) + m (NULL) {}; NCursesMenuException (const NCursesMenu* menu, @@ -221,10 +260,27 @@ public: m (menu) {}; + NCursesMenuException& operator=(const NCursesMenuException& rhs) + { + if (this != &rhs) { + NCursesException::operator=(rhs); + m = rhs.m; + } + return *this; + } + + NCursesMenuException(const NCursesMenuException& rhs) + : NCursesException(rhs), m(rhs.m) + { + } + virtual const char *classname() const { return "NCursesMenu"; } + virtual ~NCursesMenuException() + { + } }; class NCURSES_IMPEXP NCursesFormException : public NCursesException @@ -234,7 +290,7 @@ public: NCursesFormException (const char *msg, int err) : NCursesException (msg, err), - f ((NCursesForm*)0) + f (NULL) {}; NCursesFormException (const NCursesForm* form, @@ -246,7 +302,7 @@ public: NCursesFormException (int err) : NCursesException ("form library error", err), - f ((NCursesForm*)0) + f (NULL) {}; NCursesFormException (const NCursesForm* form, @@ -255,10 +311,27 @@ public: f (form) {}; + NCursesFormException& operator=(const NCursesFormException& rhs) + { + if (this != &rhs) { + NCursesException::operator=(rhs); + f = rhs.f; + } + return *this; + } + + NCursesFormException(const NCursesFormException& rhs) + : NCursesException(rhs), f(rhs.f) + { + } + virtual const char *classname() const { return "NCursesForm"; } + virtual ~NCursesFormException() + { + } }; #if !((defined(__GNUG__) && defined(__EXCEPTIONS)) || defined(__SUNPRO_CC)) @@ -288,4 +361,4 @@ inline void THROW(const NCursesException *e) { #define THROWS(s) -#endif // NCURSES_ETIP_H_incl +#endif /* NCURSES_ETIP_H_incl */ diff --git a/c++/internal.h b/c++/internal.h index 921389c8..7eb47cdc 100644 --- a/c++/internal.h +++ b/c++/internal.h @@ -1,6 +1,6 @@ // * This makes emacs happy -*-Mode: C++;-*- /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -31,7 +31,7 @@ * Author: Juergen Pfeifer, 1997 * ****************************************************************************/ -// $Id: internal.h,v 1.10 2003/10/25 15:04:46 tom Exp $ +// $Id: internal.h,v 1.12 2005/08/06 22:12:25 tom Exp $ #ifndef NCURSES_CPLUS_INTERNAL_H #define NCURSES_CPLUS_INTERNAL_H 1 @@ -46,4 +46,8 @@ #define CTRL(x) ((x) & 0x1f) -#endif // NCURSES_CPLUS_INTERNAL_H +#ifndef __EXT_QNX +#include +#endif + +#endif /* NCURSES_CPLUS_INTERNAL_H */ diff --git a/config.guess b/config.guess index c033ee21..d0d57f69 100755 --- a/config.guess +++ b/config.guess @@ -1,9 +1,9 @@ #! /bin/sh # Attempt to guess a canonical system name. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2004-01-05' +timestamp='2005-09-19' # This file is free software; you can redistribute it and/or modify it # under the terms of the GNU General Public License as published by @@ -17,13 +17,15 @@ timestamp='2004-01-05' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. # # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Originally written by Per Bothner . # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. @@ -53,7 +55,7 @@ version="\ GNU config.guess ($timestamp) Originally written by Per Bothner. -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -66,11 +68,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -123,7 +125,7 @@ case $CC_FOR_BUILD,$HOST_CC,$CC in ;; ,,*) CC_FOR_BUILD=$CC ;; ,*,*) CC_FOR_BUILD=$HOST_CC ;; -esac ;' +esac ; set_cc_for_build= ;' # This is needed to find uname on a Pyramid OSx when run in the BSD universe. # (ghazi@noc.rutgers.edu 1994-08-24) @@ -196,53 +198,29 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # contains redundant information, the shorter form: # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. echo "${machine}-${os}${release}" - exit 0 ;; - amiga:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - arc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - hp300:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mac68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - macppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme68k:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvme88k:OpenBSD:*:*) - echo m88k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - mvmeppc:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pegasos:OpenBSD:*:*) - echo powerpc-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - pmax:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sgi:OpenBSD:*:*) - echo mipseb-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - sun3:OpenBSD:*:*) - echo m68k-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; - wgrisc:OpenBSD:*:*) - echo mipsel-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + exit ;; *:OpenBSD:*:*) - echo ${UNAME_MACHINE}-unknown-openbsd${UNAME_RELEASE} - exit 0 ;; + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerppc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; alpha:OSF1:*:*) - if test $UNAME_RELEASE = "V4.0"; then + case $UNAME_RELEASE in + *4.0) UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` - fi + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac # According to Compaq, /usr/sbin/psrinfo has been available on # OSF/1 and Tru64 systems produced since 1995. I hope that # covers most systems running today. This code pipes the CPU @@ -280,45 +258,49 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in "EV7.9 (21364A)") UNAME_MACHINE="alphaev79" ;; esac + # A Pn.n version is a patched version. # A Vn.n version is a released version. # A Tn.n version is a released field test version. # A Xn.n version is an unreleased experimental baselevel. # 1.2 uses "1.2" for uname -r. - echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[VTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - exit 0 ;; - Alpha*:OpenVMS:*:*) - echo alpha-hp-vms - exit 0 ;; + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; Alpha\ *:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # Should we change UNAME_MACHINE based on the output of uname instead # of the specific Alpha model? echo alpha-pc-interix - exit 0 ;; + exit ;; 21064:Windows_NT:50:3) echo alpha-dec-winnt3.5 - exit 0 ;; + exit ;; Amiga*:UNIX_System_V:4.0:*) echo m68k-unknown-sysv4 - exit 0;; + exit ;; *:[Aa]miga[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-amigaos - exit 0 ;; + exit ;; *:[Mm]orph[Oo][Ss]:*:*) echo ${UNAME_MACHINE}-unknown-morphos - exit 0 ;; + exit ;; *:OS/390:*:*) echo i370-ibm-openedition - exit 0 ;; + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; *:OS400:*:*) - echo powerpc-ibm-os400 - exit 0 ;; + echo powerpc-ibm-os400 + exit ;; arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) echo arm-acorn-riscix${UNAME_RELEASE} - exit 0;; + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) echo hppa1.1-hitachi-hiuxmpp - exit 0;; + exit ;; Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. if test "`(/bin/universe) 2>/dev/null`" = att ; then @@ -326,32 +308,32 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in else echo pyramid-pyramid-bsd fi - exit 0 ;; + exit ;; NILE*:*:*:dcosx) echo pyramid-pyramid-svr4 - exit 0 ;; + exit ;; DRS?6000:unix:4.0:6*) echo sparc-icl-nx6 - exit 0 ;; - DRS?6000:UNIX_SV:4.2*:7*) + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) case `/usr/bin/uname -p` in - sparc) echo sparc-icl-nx7 && exit 0 ;; + sparc) echo sparc-icl-nx7; exit ;; esac ;; sun4H:SunOS:5.*:*) echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; i86pc:SunOS:5.*:*) echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:6*:*) # According to config.sub, this is the proper way to canonicalize # SunOS6. Hard to guess exactly what SunOS6 will be like, but # it's likely to be more like Solaris than SunOS4. echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; sun4*:SunOS:*:*) case "`/usr/bin/arch -k`" in Series*|S4*) @@ -360,10 +342,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in esac # Japanese Language versions have a version number like `4.1.3-JL'. echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` - exit 0 ;; + exit ;; sun3*:SunOS:*:*) echo m68k-sun-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; sun*:*:4.2BSD:*) UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 @@ -375,10 +357,10 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in echo sparc-sun-sunos${UNAME_RELEASE} ;; esac - exit 0 ;; + exit ;; aushp:SunOS:*:*) echo sparc-auspex-sunos${UNAME_RELEASE} - exit 0 ;; + exit ;; # The situation for MiNT is a little confusing. The machine name # can be virtually everything (everything which is not # "atarist" or "atariste" at least should have a processor @@ -389,37 +371,40 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in # be no problem. atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) echo m68k-atari-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) echo m68k-milan-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) echo m68k-hades-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) echo m68k-unknown-mint${UNAME_RELEASE} - exit 0 ;; + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; powerpc:machten:*:*) echo powerpc-apple-machten${UNAME_RELEASE} - exit 0 ;; + exit ;; RISC*:Mach:*:*) echo mips-dec-mach_bsd4.3 - exit 0 ;; + exit ;; RISC*:ULTRIX:*:*) echo mips-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; VAX*:ULTRIX*:*:*) echo vax-dec-ultrix${UNAME_RELEASE} - exit 0 ;; + exit ;; 2020:CLIX:*:* | 2430:CLIX:*:*) echo clipper-intergraph-clix${UNAME_RELEASE} - exit 0 ;; + exit ;; mips:*:*:UMIPS | mips:*:*:RISCos) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -443,32 +428,33 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in exit (-1); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c \ - && $dummy `echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` \ - && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } echo mips-mips-riscos${UNAME_RELEASE} - exit 0 ;; + exit ;; Motorola:PowerMAX_OS:*:*) echo powerpc-motorola-powermax - exit 0 ;; + exit ;; Motorola:*:4.3:PL8-*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) echo powerpc-harris-powermax - exit 0 ;; + exit ;; Night_Hawk:Power_UNIX:*:*) echo powerpc-harris-powerunix - exit 0 ;; + exit ;; m88k:CX/UX:7*:*) echo m88k-harris-cxux7 - exit 0 ;; + exit ;; m88k:*:4*:R4*) echo m88k-motorola-sysv4 - exit 0 ;; + exit ;; m88k:*:3*:R3*) echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; AViiON:dgux:*:*) # DG/UX returns AViiON for all architectures UNAME_PROCESSOR=`/usr/bin/uname -p` @@ -484,29 +470,29 @@ EOF else echo i586-dg-dgux${UNAME_RELEASE} fi - exit 0 ;; + exit ;; M88*:DolphinOS:*:*) # DolphinOS (SVR3) echo m88k-dolphin-sysv3 - exit 0 ;; + exit ;; M88*:*:R3*:*) # Delta 88k system running SVR3 echo m88k-motorola-sysv3 - exit 0 ;; + exit ;; XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) echo m88k-tektronix-sysv3 - exit 0 ;; + exit ;; Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) echo m68k-tektronix-bsd - exit 0 ;; + exit ;; *:IRIX*:*:*) echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` - exit 0 ;; + exit ;; ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. - echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id - exit 0 ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' i*86:AIX:*:*) echo i386-ibm-aix - exit 0 ;; + exit ;; ia64:AIX:*:*) if [ -x /usr/bin/oslevel ] ; then IBM_REV=`/usr/bin/oslevel` @@ -514,7 +500,7 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:2:3) if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then eval $set_cc_for_build @@ -529,14 +515,18 @@ EOF exit(0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 - echo rs6000-ibm-aix3.2.5 + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then echo rs6000-ibm-aix3.2.4 else echo rs6000-ibm-aix3.2 fi - exit 0 ;; + exit ;; *:AIX:*:[45]) IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then @@ -550,28 +540,28 @@ EOF IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} fi echo ${IBM_ARCH}-ibm-aix${IBM_REV} - exit 0 ;; + exit ;; *:AIX:*:*) echo rs6000-ibm-aix - exit 0 ;; + exit ;; ibmrt:4.4BSD:*|romp-ibm:BSD:*) echo romp-ibm-bsd4.4 - exit 0 ;; + exit ;; ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to - exit 0 ;; # report: romp-ibm BSD 4.3 + exit ;; # report: romp-ibm BSD 4.3 *:BOSX:*:*) echo rs6000-bull-bosx - exit 0 ;; + exit ;; DPX/2?00:B.O.S.:*:*) echo m68k-bull-sysv3 - exit 0 ;; + exit ;; 9000/[34]??:4.3bsd:1.*:*) echo m68k-hp-bsd - exit 0 ;; + exit ;; hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) echo m68k-hp-bsd4.4 - exit 0 ;; + exit ;; 9000/[34678]??:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` case "${UNAME_MACHINE}" in @@ -633,9 +623,19 @@ EOF esac if [ ${HP_ARCH} = "hppa2.0w" ] then - # avoid double evaluation of $set_cc_for_build - test -n "$CC_FOR_BUILD" || eval $set_cc_for_build - if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E -) | grep __LP64__ >/dev/null + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep __LP64__ >/dev/null then HP_ARCH="hppa2.0w" else @@ -643,11 +643,11 @@ EOF fi fi echo ${HP_ARCH}-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; ia64:HP-UX:*:*) HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` echo ia64-hp-hpux${HPUX_REV} - exit 0 ;; + exit ;; 3050*:HI-UX:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -675,163 +675,166 @@ EOF exit (0); } EOF - $CC_FOR_BUILD -o $dummy $dummy.c && $dummy && exit 0 + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } echo unknown-hitachi-hiuxwe2 - exit 0 ;; + exit ;; 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) echo hppa1.1-hp-bsd - exit 0 ;; + exit ;; 9000/8??:4.3bsd:*:*) echo hppa1.0-hp-bsd - exit 0 ;; + exit ;; *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) echo hppa1.0-hp-mpeix - exit 0 ;; + exit ;; hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) echo hppa1.1-hp-osf - exit 0 ;; + exit ;; hp8??:OSF1:*:*) echo hppa1.0-hp-osf - exit 0 ;; + exit ;; i*86:OSF1:*:*) if [ -x /usr/sbin/sysversion ] ; then echo ${UNAME_MACHINE}-unknown-osf1mk else echo ${UNAME_MACHINE}-unknown-osf1 fi - exit 0 ;; + exit ;; parisc*:Lites*:*:*) echo hppa1.1-hp-lites - exit 0 ;; + exit ;; C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) echo c1-convex-bsd - exit 0 ;; + exit ;; C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) echo c34-convex-bsd - exit 0 ;; + exit ;; C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) echo c38-convex-bsd - exit 0 ;; + exit ;; C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) echo c4-convex-bsd - exit 0 ;; + exit ;; CRAY*Y-MP:*:*:*) echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*[A-Z]90:*:*:*) echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*TS:*:*:*) echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*T3E:*:*:*) echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; CRAY*SV1:*:*:*) echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + exit ;; *:UNICOS/mp:*:*) - echo nv1-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' - exit 0 ;; + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` - echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; 5000:UNIX_System_V:4.*:*) - FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` - FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` - echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" - exit 0 ;; + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; sparc*:BSD/OS:*:*) echo sparc-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:BSD/OS:*:*) echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} - exit 0 ;; + exit ;; *:FreeBSD:*:*) - # Determine whether the default compiler uses glibc. - eval $set_cc_for_build - sed 's/^ //' << EOF >$dummy.c - #include - #if __GLIBC__ >= 2 - LIBC=gnu - #else - LIBC= - #endif -EOF - eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - # GNU/KFreeBSD systems have a "k" prefix to indicate we are using - # FreeBSD's kernel, but not the complete OS. - case ${LIBC} in gnu) kernel_only='k' ;; esac - echo ${UNAME_MACHINE}-unknown-${kernel_only}freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`${LIBC:+-$LIBC} - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; i*:CYGWIN*:*) echo ${UNAME_MACHINE}-pc-cygwin - exit 0 ;; + exit ;; i*:MINGW*:*) echo ${UNAME_MACHINE}-pc-mingw32 - exit 0 ;; + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; i*:PW*:*) echo ${UNAME_MACHINE}-pc-pw32 - exit 0 ;; + exit ;; x86:Interix*:[34]*) echo i586-pc-interix${UNAME_RELEASE}|sed -e 's/\..*//' - exit 0 ;; + exit ;; [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) echo i${UNAME_MACHINE}-pc-mks - exit 0 ;; + exit ;; i*:Windows_NT*:* | Pentium*:Windows_NT*:*) # How do we know it's Interix rather than the generic POSIX subsystem? # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we # UNAME_MACHINE based on the output of uname instead of i386? echo i586-pc-interix - exit 0 ;; + exit ;; i*:UWIN*:*) echo ${UNAME_MACHINE}-pc-uwin - exit 0 ;; + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; p*:CYGWIN*:*) echo powerpcle-unknown-cygwin - exit 0 ;; + exit ;; prep*:SunOS:5.*:*) echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` - exit 0 ;; + exit ;; *:GNU:*:*) # the GNU system echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` - exit 0 ;; + exit ;; *:GNU/*:*:*) # other systems with GNU libc and userland echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu - exit 0 ;; + exit ;; i*86:Minix:*:*) echo ${UNAME_MACHINE}-pc-minix - exit 0 ;; + exit ;; arm*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; cris:Linux:*:*) echo cris-axis-linux-gnu - exit 0 ;; + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; ia64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; m68*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; mips:Linux:*:*) eval $set_cc_for_build sed 's/^ //' << EOF >$dummy.c @@ -849,7 +852,7 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; mips64:Linux:*:*) eval $set_cc_for_build @@ -868,14 +871,17 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^CPU=` - test x"${CPU}" != x && echo "${CPU}-unknown-linux-gnu" && exit 0 + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; ppc:Linux:*:*) echo powerpc-unknown-linux-gnu - exit 0 ;; + exit ;; ppc64:Linux:*:*) echo powerpc64-unknown-linux-gnu - exit 0 ;; + exit ;; alpha:Linux:*:*) case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in EV5) UNAME_MACHINE=alphaev5 ;; @@ -889,7 +895,7 @@ EOF objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} - exit 0 ;; + exit ;; parisc:Linux:*:* | hppa:Linux:*:*) # Look for CPU level case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in @@ -897,25 +903,25 @@ EOF PA8*) echo hppa2.0-unknown-linux-gnu ;; *) echo hppa-unknown-linux-gnu ;; esac - exit 0 ;; + exit ;; parisc64:Linux:*:* | hppa64:Linux:*:*) echo hppa64-unknown-linux-gnu - exit 0 ;; + exit ;; s390:Linux:*:* | s390x:Linux:*:*) echo ${UNAME_MACHINE}-ibm-linux - exit 0 ;; + exit ;; sh64*:Linux:*:*) - echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; sh*:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; sparc:Linux:*:* | sparc64:Linux:*:*) echo ${UNAME_MACHINE}-unknown-linux-gnu - exit 0 ;; + exit ;; x86_64:Linux:*:*) echo x86_64-unknown-linux-gnu - exit 0 ;; + exit ;; i*86:Linux:*:*) # The BFD linker knows what the default object file format is, so # first see if it will tell us. cd to the root directory to prevent @@ -933,15 +939,15 @@ EOF ;; a.out-i386-linux) echo "${UNAME_MACHINE}-pc-linux-gnuaout" - exit 0 ;; + exit ;; coff-i386) echo "${UNAME_MACHINE}-pc-linux-gnucoff" - exit 0 ;; + exit ;; "") # Either a pre-BFD a.out linker (linux-gnuoldld) or # one that does not give us useful --help. echo "${UNAME_MACHINE}-pc-linux-gnuoldld" - exit 0 ;; + exit ;; esac # Determine whether the default compiler is a.out or elf eval $set_cc_for_build @@ -969,15 +975,18 @@ EOF #endif EOF eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep ^LIBC=` - test x"${LIBC}" != x && echo "${UNAME_MACHINE}-pc-linux-${LIBC}" && exit 0 - test x"${TENTATIVE}" != x && echo "${TENTATIVE}" && exit 0 + test x"${LIBC}" != x && { + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit + } + test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; } ;; i*86:DYNIX/ptx:4*:*) # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. # earlier versions are messed up and put the nodename in both # sysname and nodename. echo i386-sequent-sysv4 - exit 0 ;; + exit ;; i*86:UNIX_SV:4.2MP:2.*) # Unixware is an offshoot of SVR4, but it has its own version # number series starting with 2... @@ -985,27 +994,27 @@ EOF # I just have to hope. -- rms. # Use sysv4.2uw... so that sysv4* matches it. echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:OS/2:*:*) # If we were able to find `uname', then EMX Unix compatibility # is probably installed. echo ${UNAME_MACHINE}-pc-os2-emx - exit 0 ;; + exit ;; i*86:XTS-300:*:STOP) echo ${UNAME_MACHINE}-unknown-stop - exit 0 ;; + exit ;; i*86:atheos:*:*) echo ${UNAME_MACHINE}-unknown-atheos - exit 0 ;; + exit ;; i*86:syllable:*:*) echo ${UNAME_MACHINE}-pc-syllable - exit 0 ;; + exit ;; i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*) echo i386-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; i*86:*DOS:*:*) echo ${UNAME_MACHINE}-pc-msdosdjgpp - exit 0 ;; + exit ;; i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then @@ -1013,15 +1022,16 @@ EOF else echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} fi - exit 0 ;; - i*86:*:5:[78]*) + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. case `/bin/uname -X | grep "^Machine"` in *486*) UNAME_MACHINE=i486 ;; *Pentium) UNAME_MACHINE=i586 ;; *Pent*|*Celeron) UNAME_MACHINE=i686 ;; esac echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} - exit 0 ;; + exit ;; i*86:*:3.2:*) if test -f /usr/options/cb.name; then UNAME_REL=`sed -n 's/.*Version //p' /dev/null 2>&1 ; then echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 else # Add other i860-SVR4 vendors below as they are discovered. echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 fi - exit 0 ;; + exit ;; mini*:CTIX:SYS*5:*) # "miniframe" echo m68010-convergent-sysv - exit 0 ;; + exit ;; mc68k:UNIX:SYSTEM5:3.51m) echo m68k-convergent-sysv - exit 0 ;; + exit ;; M680?0:D-NIX:5.3:*) echo m68k-diab-dnix - exit 0 ;; - M68*:*:R3V[567]*:*) - test -r /sysV68 && echo 'm68k-motorola-sysv' && exit 0 ;; - 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0) + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) OS_REL='' test -r /etc/.relid \ && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4.3${OS_REL} && exit 0 + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ - && echo i586-ncr-sysv4.3${OS_REL} && exit 0 ;; + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ - && echo i486-ncr-sysv4 && exit 0 ;; + && { echo i486-ncr-sysv4; exit; } ;; m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) echo m68k-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; mc68030:UNIX_System_V:4.*:*) echo m68k-atari-sysv4 - exit 0 ;; + exit ;; TSUNAMI:LynxOS:2.*:*) echo sparc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; rs6000:LynxOS:2.*:*) echo rs6000-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*) echo powerpc-unknown-lynxos${UNAME_RELEASE} - exit 0 ;; + exit ;; SM[BE]S:UNIX_SV:*:*) echo mips-dde-sysv${UNAME_RELEASE} - exit 0 ;; + exit ;; RM*:ReliantUNIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; RM*:SINIX-*:*:*) echo mips-sni-sysv4 - exit 0 ;; + exit ;; *:SINIX-*:*:*) if uname -p 2>/dev/null >/dev/null ; then UNAME_MACHINE=`(uname -p) 2>/dev/null` @@ -1113,68 +1123,72 @@ EOF else echo ns32k-sni-sysv fi - exit 0 ;; + exit ;; PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort # says echo i586-unisys-sysv4 - exit 0 ;; + exit ;; *:UNIX_System_V:4*:FTX*) # From Gerald Hewes . # How about differentiating between stratus architectures? -djm echo hppa1.1-stratus-sysv4 - exit 0 ;; + exit ;; *:*:*:FTX*) # From seanf@swdc.stratus.com. echo i860-stratus-sysv4 - exit 0 ;; + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; *:VOS:*:*) # From Paul.Green@stratus.com. echo hppa1.1-stratus-vos - exit 0 ;; + exit ;; mc68*:A/UX:*:*) echo m68k-apple-aux${UNAME_RELEASE} - exit 0 ;; + exit ;; news*:NEWS-OS:6*:*) echo mips-sony-newsos6 - exit 0 ;; + exit ;; R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) if [ -d /usr/nec ]; then echo mips-nec-sysv${UNAME_RELEASE} else echo mips-unknown-sysv${UNAME_RELEASE} fi - exit 0 ;; + exit ;; BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. echo powerpc-be-beos - exit 0 ;; + exit ;; BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. echo powerpc-apple-beos - exit 0 ;; + exit ;; BePC:BeOS:*:*) # BeOS running on Intel PC compatible. echo i586-pc-beos - exit 0 ;; + exit ;; SX-4:SUPER-UX:*:*) echo sx4-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-5:SUPER-UX:*:*) echo sx5-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; SX-6:SUPER-UX:*:*) echo sx6-nec-superux${UNAME_RELEASE} - exit 0 ;; + exit ;; Power*:Rhapsody:*:*) echo powerpc-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Rhapsody:*:*) echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Darwin:*:*) - case `uname -p` in - *86) UNAME_PROCESSOR=i686 ;; - powerpc) UNAME_PROCESSOR=powerpc ;; + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + unknown) UNAME_PROCESSOR=powerpc ;; esac echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} - exit 0 ;; + exit ;; *:procnto*:*:* | *:QNX:[0123456789]*:*) UNAME_PROCESSOR=`uname -p` if test "$UNAME_PROCESSOR" = "x86"; then @@ -1182,22 +1196,25 @@ EOF UNAME_MACHINE=pc fi echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} - exit 0 ;; + exit ;; *:QNX:*:4*) echo i386-pc-qnx - exit 0 ;; + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; NSR-?:NONSTOP_KERNEL:*:*) echo nsr-tandem-nsk${UNAME_RELEASE} - exit 0 ;; + exit ;; *:NonStop-UX:*:*) echo mips-compaq-nonstopux - exit 0 ;; + exit ;; BS2000:POSIX*:*:*) echo bs2000-siemens-sysv - exit 0 ;; + exit ;; DS/*:UNIX_System_V:*:*) echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} - exit 0 ;; + exit ;; *:Plan9:*:*) # "uname -m" is not consistent, so use $cputype instead. 386 # is converted to i386 for consistency with other x86 @@ -1208,31 +1225,44 @@ EOF UNAME_MACHINE="$cputype" fi echo ${UNAME_MACHINE}-unknown-plan9 - exit 0 ;; + exit ;; *:TOPS-10:*:*) echo pdp10-unknown-tops10 - exit 0 ;; + exit ;; *:TENEX:*:*) echo pdp10-unknown-tenex - exit 0 ;; + exit ;; KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) echo pdp10-dec-tops20 - exit 0 ;; + exit ;; XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) echo pdp10-xkl-tops20 - exit 0 ;; + exit ;; *:TOPS-20:*:*) echo pdp10-unknown-tops20 - exit 0 ;; + exit ;; *:ITS:*:*) echo pdp10-unknown-its - exit 0 ;; + exit ;; SEI:*:*:SEIUX) - echo mips-sei-seiux${UNAME_RELEASE} - exit 0 ;; - *:DRAGONFLY:*:*) - echo ${UNAME_MACHINE}-unknown-dragonfly${UNAME_RELEASE} - exit 0 ;; + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; esac #echo '(No uname command or uname output not recognized.)' 1>&2 @@ -1264,7 +1294,7 @@ main () #endif #if defined (__arm) && defined (__acorn) && defined (__unix) - printf ("arm-acorn-riscix"); exit (0); + printf ("arm-acorn-riscix\n"); exit (0); #endif #if defined (hp300) && !defined (hpux) @@ -1353,11 +1383,12 @@ main () } EOF -$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && $dummy && exit 0 +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } # Apollos put the system type in the environment. -test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit 0; } +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } # Convex versions that predate uname can use getsysinfo(1) @@ -1366,22 +1397,22 @@ then case `getsysinfo -f cpu_type` in c1*) echo c1-convex-bsd - exit 0 ;; + exit ;; c2*) if getsysinfo -f scalar_acc then echo c32-convex-bsd else echo c2-convex-bsd fi - exit 0 ;; + exit ;; c34*) echo c34-convex-bsd - exit 0 ;; + exit ;; c38*) echo c38-convex-bsd - exit 0 ;; + exit ;; c4*) echo c4-convex-bsd - exit 0 ;; + exit ;; esac fi @@ -1392,7 +1423,9 @@ This script, last modified $timestamp, has failed to recognize the operating system you are using. It is advised that you download the most up to date version of the config scripts from - ftp://ftp.gnu.org/pub/gnu/config/ + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.guess +and + http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/config/config/config.sub If the version you run ($0) is already up to date, please send the following data and any information you think might be diff --git a/config.sub b/config.sub index 6b6c9d6d..1c366dfd 100755 --- a/config.sub +++ b/config.sub @@ -1,9 +1,9 @@ #! /bin/sh # Configuration validation subroutine script. # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, -# 2000, 2001, 2002, 2003 Free Software Foundation, Inc. +# 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. -timestamp='2004-01-05' +timestamp='2005-07-08' # This file is (in principle) common to ALL GNU software. # The presence of a machine in this file suggests that SOME GNU software @@ -21,14 +21,15 @@ timestamp='2004-01-05' # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, -# Boston, MA 02111-1307, USA. - +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# # As a special exception to the GNU General Public License, if you # distribute this file as part of a program that contains a # configuration script generated by Autoconf, you may include it under # the same distribution terms that you use for the rest of that program. + # Please send patches to . Submit a context # diff and a properly formatted ChangeLog entry. # @@ -70,7 +71,7 @@ Report bugs and patches to ." version="\ GNU config.sub ($timestamp) -Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001 +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO @@ -83,11 +84,11 @@ Try \`$me --help' for more information." while test $# -gt 0 ; do case $1 in --time-stamp | --time* | -t ) - echo "$timestamp" ; exit 0 ;; + echo "$timestamp" ; exit ;; --version | -v ) - echo "$version" ; exit 0 ;; + echo "$version" ; exit ;; --help | --h* | -h ) - echo "$usage"; exit 0 ;; + echo "$usage"; exit ;; -- ) # Stop option processing shift; break ;; - ) # Use stdin as input. @@ -99,7 +100,7 @@ while test $# -gt 0 ; do *local*) # First pass through any local machine types. echo $1 - exit 0;; + exit ;; * ) break ;; @@ -145,7 +146,7 @@ case $os in -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ - -apple | -axis) + -apple | -axis | -knuth | -cray) os= basic_machine=$1 ;; @@ -231,13 +232,14 @@ case $basic_machine in | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ | am33_2.0 \ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr \ + | bfin \ | c4x | clipper \ | d10v | d30v | dlx | dsp16xx \ | fr30 | frv \ | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ | i370 | i860 | i960 | ia64 \ | ip2k | iq2000 \ - | m32r | m68000 | m68k | m88k | mcore \ + | m32r | m32rle | m68000 | m68k | m88k | maxq | mcore \ | mips | mipsbe | mipseb | mipsel | mipsle \ | mips16 \ | mips64 | mips64el \ @@ -246,6 +248,7 @@ case $basic_machine in | mips64vr4100 | mips64vr4100el \ | mips64vr4300 | mips64vr4300el \ | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ | mipsisa32 | mipsisa32el \ | mipsisa32r2 | mipsisa32r2el \ | mipsisa64 | mipsisa64el \ @@ -254,23 +257,28 @@ case $basic_machine in | mipsisa64sr71k | mipsisa64sr71kel \ | mipstx39 | mipstx39el \ | mn10200 | mn10300 \ + | ms1 \ | msp430 \ | ns16k | ns32k \ - | openrisc | or32 \ + | or32 \ | pdp10 | pdp11 | pj | pjl \ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ | pyramid \ - | sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ + | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \ | sh64 | sh64le \ - | sparc | sparc64 | sparc86x | sparclet | sparclite | sparcv9 | sparcv9b \ + | sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b \ | strongarm \ | tahoe | thumb | tic4x | tic80 | tron \ | v850 | v850e \ | we32k \ - | x86 | xscale | xstormy16 | xtensa \ + | x86 | xscale | xscalee[bl] | xstormy16 | xtensa \ | z8k) basic_machine=$basic_machine-unknown ;; + m32c) + basic_machine=$basic_machine-unknown + ;; m6811 | m68hc11 | m6812 | m68hc12) # Motorola 68HC11/12. basic_machine=$basic_machine-unknown @@ -283,8 +291,8 @@ case $basic_machine in # because (1) that's what they normally are, and # (2) the word "unknown" tends to confuse beginning users. i*86 | x86_64) - basic_machine=$basic_machine-pc - ;; + basic_machine=$basic_machine-pc + ;; # Object if more than one company name word. *-*-*) echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 @@ -298,9 +306,9 @@ case $basic_machine in | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ | avr-* \ - | bs2000-* \ + | bfin-* | bs2000-* \ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ - | clipper-* | cydra-* \ + | clipper-* | craynv-* | cydra-* \ | d10v-* | d30v-* | dlx-* \ | elxsi-* \ | f30[01]-* | f700-* | fr30-* | frv-* | fx80-* \ @@ -308,9 +316,9 @@ case $basic_machine in | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ | i*86-* | i860-* | i960-* | ia64-* \ | ip2k-* | iq2000-* \ - | m32r-* \ + | m32r-* | m32rle-* \ | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ - | m88110-* | m88k-* | mcore-* \ + | m88110-* | m88k-* | maxq-* | mcore-* \ | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ | mips16-* \ | mips64-* | mips64el-* \ @@ -319,6 +327,7 @@ case $basic_machine in | mips64vr4100-* | mips64vr4100el-* \ | mips64vr4300-* | mips64vr4300el-* \ | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ | mipsisa32-* | mipsisa32el-* \ | mipsisa32r2-* | mipsisa32r2el-* \ | mipsisa64-* | mipsisa64el-* \ @@ -326,27 +335,32 @@ case $basic_machine in | mipsisa64sb1-* | mipsisa64sb1el-* \ | mipsisa64sr71k-* | mipsisa64sr71kel-* \ | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | ms1-* \ | msp430-* \ - | none-* | np1-* | nv1-* | ns16k-* | ns32k-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ | orion-* \ | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ | pyramid-* \ | romp-* | rs6000-* \ - | sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | shbe-* \ | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ - | sparc-* | sparc64-* | sparc86x-* | sparclet-* | sparclite-* \ - | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \ | tahoe-* | thumb-* \ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \ | tron-* \ | v850-* | v850e-* | vax-* \ | we32k-* \ - | x86-* | x86_64-* | xps100-* | xscale-* | xstormy16-* \ - | xtensa-* \ + | x86-* | x86_64-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa-* \ | ymp-* \ | z8k-*) ;; + m32c-*) + ;; # Recognize the various machine names and aliases which stand # for a CPU type and a company and sometimes even an OS. 386bsd) @@ -363,6 +377,9 @@ case $basic_machine in basic_machine=a29k-amd os=-udi ;; + abacus) + basic_machine=abacus-unknown + ;; adobe68k) basic_machine=m68010-adobe os=-scout @@ -442,12 +459,27 @@ case $basic_machine in basic_machine=j90-cray os=-unicos ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16c) + basic_machine=cr16c-unknown + os=-elf + ;; crds | unos) basic_machine=m68k-crds ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; cris | cris-* | etrax*) basic_machine=cris-axis ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; da30 | da30-*) basic_machine=m68k-da30 ;; @@ -470,6 +502,10 @@ case $basic_machine in basic_machine=m88k-motorola os=-sysv3 ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; dpx20 | dpx20-*) basic_machine=rs6000-bull os=-bosx @@ -648,10 +684,6 @@ case $basic_machine in mips3*) basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown ;; - mmix*) - basic_machine=mmix-knuth - os=-mmixware - ;; monitor) basic_machine=m68k-rom68k os=-coff @@ -732,10 +764,6 @@ case $basic_machine in np1) basic_machine=np1-gould ;; - nv1) - basic_machine=nv1-cray - os=-unicosmp - ;; nsr-tandem) basic_machine=nsr-tandem ;; @@ -743,9 +771,8 @@ case $basic_machine in basic_machine=hppa1.1-oki os=-proelf ;; - or32 | or32-*) + openrisc | openrisc-*) basic_machine=or32-unknown - os=-coff ;; os400) basic_machine=powerpc-ibm @@ -1018,6 +1045,10 @@ case $basic_machine in basic_machine=hppa1.1-winbond os=-proelf ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; xps | xps100) basic_machine=xps100-honeywell ;; @@ -1048,6 +1079,9 @@ case $basic_machine in romp) basic_machine=romp-ibm ;; + mmix) + basic_machine=mmix-knuth + ;; rs6000) basic_machine=rs6000-ibm ;; @@ -1064,13 +1098,10 @@ case $basic_machine in we32k) basic_machine=we32k-att ;; - sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele) + sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele) basic_machine=sh-unknown ;; - sh64) - basic_machine=sh64-unknown - ;; - sparc | sparcv9 | sparcv9b) + sparc | sparcv8 | sparcv9 | sparcv9b) basic_machine=sparc-sun ;; cydra) @@ -1114,8 +1145,8 @@ esac if [ x"$os" != x"" ] then case $os in - # First match some system type aliases - # that might get confused with valid system types. + # First match some system type aliases + # that might get confused with valid system types. # -solaris* is a basic system type, with this one exception. -solaris1 | -solaris1.*) os=`echo $os | sed -e 's|solaris1|sunos4|'` @@ -1143,8 +1174,9 @@ case $os in | -aos* \ | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ - | -hiux* | -386bsd* | -knetbsd* | -netbsd* | -openbsd* | -kfreebsd* | -freebsd* | -riscix* \ - | -lynxos* | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* | -openbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ | -chorusos* | -chorusrdb* \ @@ -1155,7 +1187,8 @@ case $os in | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ - | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly*) + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku*) # Remember, each alternative MUST END IN *, to match a version number. ;; -qnx*) @@ -1173,7 +1206,7 @@ case $os in os=`echo $os | sed -e 's|nto|nto-qnx|'` ;; -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ - | -windows* | -osx | -abug | -netware* | -os9* | -beos* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) ;; -mac*) @@ -1194,7 +1227,7 @@ case $os in -opened*) os=-openedition ;; - -os400*) + -os400*) os=-os400 ;; -wince*) @@ -1243,7 +1276,7 @@ case $os in -sinix*) os=-sysv4 ;; - -tpf*) + -tpf*) os=-tpf ;; -triton*) @@ -1282,6 +1315,9 @@ case $os in -kaos*) os=-kaos ;; + -zvmoe) + os=-zvmoe + ;; -none) ;; *) @@ -1313,9 +1349,9 @@ case $basic_machine in arm*-semi) os=-aout ;; - c4x-* | tic4x-*) - os=-coff - ;; + c4x-* | tic4x-*) + os=-coff + ;; # This must come before the *-dec entry. pdp10-*) os=-tops20 @@ -1359,9 +1395,15 @@ case $basic_machine in *-be) os=-beos ;; + *-haiku) + os=-haiku + ;; *-ibm) os=-aix ;; + *-knuth) + os=-mmixware + ;; *-wec) os=-proelf ;; @@ -1527,7 +1569,7 @@ case $basic_machine in esac echo $basic_machine$os -exit 0 +exit # Local variables: # eval: (add-hook 'write-file-hooks 'time-stamp) diff --git a/configure b/configure index c5383e39..819d5725 100755 --- a/configure +++ b/configure @@ -1,5 +1,5 @@ #! /bin/sh -# From configure.in Revision: 1.312 . +# From configure.in Revision: 1.351 . # Guess values for system-dependent variables and create Makefiles. # Generated by Autoconf 2.52.20030208. # @@ -666,10 +666,11 @@ Optional Features: --with-install-prefix prefixes actual install-location ($DESTDIR) Build-Tools Needed to Compile Temporary Applications for Cross-compiling: --with-build-cc=XXX the build C compiler ($BUILD_CC) - --with-build-cflags=XXX the build C compiler-flags - --with-build-cppflags=XXX the build C preprocessor-flags - --with-build-ldflags=XXX the build linker-flags - --with-build-libs=XXX the build libraries + --with-build-cpp=XXX the build C preprocessor ($BUILD_CPP) + --with-build-cflags=XXX the build C compiler-flags ($BUILD_CFLAGS) + --with-build-cppflags=XXX the build C preprocessor-flags ($BUILD_CPPFLAGS) + --with-build-ldflags=XXX the build linker-flags ($BUILD_LDFLAGS) + --with-build-libs=XXX the build libraries ($(BUILD_LIBS) Options to Specify the Libraries Built/Used: --with-libtool generate libraries with libtool --with-shared generate shared-libraries @@ -677,8 +678,8 @@ Options to Specify the Libraries Built/Used: --with-debug generate debug-libraries (default) --with-profile generate profile-libraries --with-termlib generate separate terminfo library - --with-dbmalloc test: use Conor Cahill's dbmalloc library - --with-dmalloc test: use Gray Watson's dmalloc library + --with-dbmalloc use Conor Cahill's dbmalloc library + --with-dmalloc use Gray Watson's dmalloc library --with-gpm use Alessandro Rubini's GPM library --with-sysmouse use sysmouse (FreeBSD console) --enable-rpath use rpath option when generating shared libraries @@ -688,6 +689,7 @@ Fine-Tuning Your Configuration: --disable-database do not use terminfo, only fallbacks/termcap --with-database=XXX specify terminfo source to install --with-fallbacks=XXX specify list of fallback terminal descriptions + --without-xterm-new specify if xterm terminfo should be old version --with-terminfo-dirs=XXX specify list of terminfo directories (default: DATADIR/terminfo) --with-default-terminfo-dir=DIR default terminfo directory (default: DATADIR/terminfo) --disable-big-core assume machine has little memory @@ -696,10 +698,17 @@ Fine-Tuning Your Configuration: --enable-getcap fast termcap load, no xrefs to terminfo --enable-getcap-cache cache translated termcaps in ~/.terminfo --disable-home-terminfo drop ~/.terminfo from terminfo search-path + --disable-root-environ limit environment when running as root --enable-symlinks make tic use symbolic links not hard links --enable-broken_linker compile with broken-linker support code + --enable-widec compile with wide-char/UTF-8 code + --disable-lp64 allow chtype to be long (ignore _LP64) + --disable-largefile omit support for large files --with-bool=TYPE override fallback type of bool variable + --with-caps=alt compile with alternate Caps file + --with-chtype=TYPE override type of chtype --with-ospeed=TYPE override type of ospeed variable + --with-mmask-t=TYPE override type of mmask_t --enable-bsdpad recognize BSD-style prefix padding --with-rcs-ids compile-in RCS identifiers Options to Specify How Manpages are Installed: @@ -718,16 +727,15 @@ Extensions: Development Code: --with-develop enable all development options --enable-hard-tabs compile with hard-tabs code - --disable-root-environ limit environment when running as root --enable-xmc-glitch compile with limited support for xmc Experimental Code: --disable-assumed-color do not assume anything about default-colors --disable-hashmap compile without hashmap scrolling-optimization --enable-colorfgbg compile with $COLORFGBG code + --enable-ext-colors compile for experimental 256-color support + --enable-ext-mouse compile for experimental mouse-encoding --enable-safe-sprintf compile with experimental safe-sprintf code --disable-scroll-hints compile without scroll-hints code - --enable-widec compile with experimental wide-char/UTF-8 code - --with-caps=alt compile with experimental alternate Caps file Testing/development Options: --enable-echo build: display "compiling" commands (default) --enable-warnings build: turn on GCC compiler warnings @@ -936,7 +944,7 @@ if test -z "$CONFIG_SITE"; then fi for ac_site_file in $CONFIG_SITE; do if test -r "$ac_site_file"; then - { echo "$as_me:939: loading site script $ac_site_file" >&5 + { echo "$as_me:947: loading site script $ac_site_file" >&5 echo "$as_me: loading site script $ac_site_file" >&6;} cat "$ac_site_file" >&5 . "$ac_site_file" @@ -947,7 +955,7 @@ if test -r "$cache_file"; then # Some versions of bash will fail to source /dev/null (special # files actually), so we avoid doing that. if test -f "$cache_file"; then - { echo "$as_me:950: loading cache $cache_file" >&5 + { echo "$as_me:958: loading cache $cache_file" >&5 echo "$as_me: loading cache $cache_file" >&6;} case $cache_file in [\\/]* | ?:[\\/]* ) . $cache_file;; @@ -955,7 +963,7 @@ echo "$as_me: loading cache $cache_file" >&6;} esac fi else - { echo "$as_me:958: creating cache $cache_file" >&5 + { echo "$as_me:966: creating cache $cache_file" >&5 echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi @@ -971,21 +979,21 @@ for ac_var in `(set) 2>&1 | eval ac_new_val="\$ac_env_${ac_var}_value" case $ac_old_set,$ac_new_set in set,) - { echo "$as_me:974: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 + { echo "$as_me:982: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} ac_cache_corrupted=: ;; ,set) - { echo "$as_me:978: error: \`$ac_var' was not set in the previous run" >&5 + { echo "$as_me:986: error: \`$ac_var' was not set in the previous run" >&5 echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} ac_cache_corrupted=: ;; ,);; *) if test "x$ac_old_val" != "x$ac_new_val"; then - { echo "$as_me:984: error: \`$ac_var' has changed since the previous run:" >&5 + { echo "$as_me:992: error: \`$ac_var' has changed since the previous run:" >&5 echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} - { echo "$as_me:986: former value: $ac_old_val" >&5 + { echo "$as_me:994: former value: $ac_old_val" >&5 echo "$as_me: former value: $ac_old_val" >&2;} - { echo "$as_me:988: current value: $ac_new_val" >&5 + { echo "$as_me:996: current value: $ac_new_val" >&5 echo "$as_me: current value: $ac_new_val" >&2;} ac_cache_corrupted=: fi;; @@ -1004,9 +1012,9 @@ echo "$as_me: current value: $ac_new_val" >&2;} fi done if $ac_cache_corrupted; then - { echo "$as_me:1007: error: changes in the environment can compromise the build" >&5 + { echo "$as_me:1015: error: changes in the environment can compromise the build" >&5 echo "$as_me: error: changes in the environment can compromise the build" >&2;} - { { echo "$as_me:1009: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 + { { echo "$as_me:1017: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5 echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;} { (exit 1); exit 1; }; } fi @@ -1026,10 +1034,10 @@ esac echo "#! $SHELL" >conftest.sh echo "exit 0" >>conftest.sh chmod +x conftest.sh -if { (echo "$as_me:1029: PATH=\".;.\"; conftest.sh") >&5 +if { (echo "$as_me:1037: PATH=\".;.\"; conftest.sh") >&5 (PATH=".;."; conftest.sh) 2>&5 ac_status=$? - echo "$as_me:1032: \$? = $ac_status" >&5 + echo "$as_me:1040: \$? = $ac_status" >&5 (exit $ac_status); }; then ac_path_separator=';' else @@ -1046,7 +1054,7 @@ NCURSES_PATCH="`egrep '^NCURSES_PATCH[ ]*=' $srcdir/dist.mk | sed -e 's/^[^0-9] cf_cv_abi_version=${NCURSES_MAJOR} cf_cv_rel_version=${NCURSES_MAJOR}.${NCURSES_MINOR} cf_cv_timestamp=`date` -echo "$as_me:1049: result: Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&5 +echo "$as_me:1057: result: Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&5 echo "${ECHO_T}Configuring NCURSES $cf_cv_rel_version ABI $cf_cv_abi_version ($cf_cv_timestamp)" >&6 test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0 @@ -1054,7 +1062,7 @@ test -z "$cf_cv_rel_version" && cf_cv_rel_version=0.0 # Check whether --with-rel-version or --without-rel-version was given. if test "${with_rel_version+set}" = set; then withval="$with_rel_version" - { echo "$as_me:1057: WARNING: overriding release version $cf_cv_rel_version to $withval" >&5 + { echo "$as_me:1065: WARNING: overriding release version $cf_cv_rel_version to $withval" >&5 echo "$as_me: WARNING: overriding release version $cf_cv_rel_version to $withval" >&2;} cf_cv_rel_version=$withval fi; @@ -1067,13 +1075,13 @@ if test -n "$NCURSES_MAJOR" ; then [0-9]*) #(vi ;; *) - { { echo "$as_me:1070: error: Release major-version is not a number: $NCURSES_MAJOR" >&5 + { { echo "$as_me:1078: error: Release major-version is not a number: $NCURSES_MAJOR" >&5 echo "$as_me: error: Release major-version is not a number: $NCURSES_MAJOR" >&2;} { (exit 1); exit 1; }; } ;; esac else - { { echo "$as_me:1076: error: Release major-version value is empty" >&5 + { { echo "$as_me:1084: error: Release major-version value is empty" >&5 echo "$as_me: error: Release major-version value is empty" >&2;} { (exit 1); exit 1; }; } fi @@ -1083,13 +1091,13 @@ if test -n "$NCURSES_MINOR" ; then [0-9]*) #(vi ;; *) - { { echo "$as_me:1086: error: Release minor-version is not a number: $NCURSES_MINOR" >&5 + { { echo "$as_me:1094: error: Release minor-version is not a number: $NCURSES_MINOR" >&5 echo "$as_me: error: Release minor-version is not a number: $NCURSES_MINOR" >&2;} { (exit 1); exit 1; }; } ;; esac else - { { echo "$as_me:1092: error: Release minor-version value is empty" >&5 + { { echo "$as_me:1100: error: Release minor-version value is empty" >&5 echo "$as_me: error: Release minor-version value is empty" >&2;} { (exit 1); exit 1; }; } fi @@ -1099,7 +1107,7 @@ test -z "$cf_cv_abi_version" && cf_cv_abi_version=0 # Check whether --with-abi-version or --without-abi-version was given. if test "${with_abi_version+set}" = set; then withval="$with_abi_version" - { echo "$as_me:1102: WARNING: overriding ABI version $cf_cv_abi_version to $withval" >&5 + { echo "$as_me:1110: WARNING: overriding ABI version $cf_cv_abi_version to $withval" >&5 echo "$as_me: WARNING: overriding ABI version $cf_cv_abi_version to $withval" >&2;} cf_cv_abi_version=$withval fi; @@ -1109,13 +1117,13 @@ if test -n "$cf_cv_abi_version" ; then [0-9]*) #(vi ;; *) - { { echo "$as_me:1112: error: ABI version is not a number: $cf_cv_abi_version" >&5 + { { echo "$as_me:1120: error: ABI version is not a number: $cf_cv_abi_version" >&5 echo "$as_me: error: ABI version is not a number: $cf_cv_abi_version" >&2;} { (exit 1); exit 1; }; } ;; esac else - { { echo "$as_me:1118: error: ABI version value is empty" >&5 + { { echo "$as_me:1126: error: ABI version value is empty" >&5 echo "$as_me: error: ABI version value is empty" >&2;} { (exit 1); exit 1; }; } fi @@ -1137,7 +1145,7 @@ for ac_dir in $srcdir $srcdir/.. $srcdir/../..; do fi done if test -z "$ac_aux_dir"; then - { { echo "$as_me:1140: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 + { { echo "$as_me:1148: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&5 echo "$as_me: error: cannot find install-sh or install.sh in $srcdir $srcdir/.. $srcdir/../.." >&2;} { (exit 1); exit 1; }; } fi @@ -1147,11 +1155,11 @@ ac_configure="$SHELL $ac_aux_dir/configure" # This should be Cygnus configure. # Make sure we can run config.sub. $ac_config_sub sun4 >/dev/null 2>&1 || - { { echo "$as_me:1150: error: cannot run $ac_config_sub" >&5 + { { echo "$as_me:1158: error: cannot run $ac_config_sub" >&5 echo "$as_me: error: cannot run $ac_config_sub" >&2;} { (exit 1); exit 1; }; } -echo "$as_me:1154: checking build system type" >&5 +echo "$as_me:1162: checking build system type" >&5 echo $ECHO_N "checking build system type... $ECHO_C" >&6 if test "${ac_cv_build+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1160,23 +1168,23 @@ else test -z "$ac_cv_build_alias" && ac_cv_build_alias=`$ac_config_guess` test -z "$ac_cv_build_alias" && - { { echo "$as_me:1163: error: cannot guess build type; you must specify one" >&5 + { { echo "$as_me:1171: error: cannot guess build type; you must specify one" >&5 echo "$as_me: error: cannot guess build type; you must specify one" >&2;} { (exit 1); exit 1; }; } ac_cv_build=`$ac_config_sub $ac_cv_build_alias` || - { { echo "$as_me:1167: error: $ac_config_sub $ac_cv_build_alias failed." >&5 + { { echo "$as_me:1175: error: $ac_config_sub $ac_cv_build_alias failed." >&5 echo "$as_me: error: $ac_config_sub $ac_cv_build_alias failed." >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1172: result: $ac_cv_build" >&5 +echo "$as_me:1180: result: $ac_cv_build" >&5 echo "${ECHO_T}$ac_cv_build" >&6 build=$ac_cv_build build_cpu=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` build_vendor=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` build_os=`echo $ac_cv_build | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -echo "$as_me:1179: checking host system type" >&5 +echo "$as_me:1187: checking host system type" >&5 echo $ECHO_N "checking host system type... $ECHO_C" >&6 if test "${ac_cv_host+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1185,20 +1193,20 @@ else test -z "$ac_cv_host_alias" && ac_cv_host_alias=$ac_cv_build_alias ac_cv_host=`$ac_config_sub $ac_cv_host_alias` || - { { echo "$as_me:1188: error: $ac_config_sub $ac_cv_host_alias failed" >&5 + { { echo "$as_me:1196: error: $ac_config_sub $ac_cv_host_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_host_alias failed" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1193: result: $ac_cv_host" >&5 +echo "$as_me:1201: result: $ac_cv_host" >&5 echo "${ECHO_T}$ac_cv_host" >&6 host=$ac_cv_host host_cpu=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` host_vendor=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'` host_os=`echo $ac_cv_host | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'` -if test -f $srcdir/config.guess ; then - echo "$as_me:1201: checking target system type" >&5 +if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then + echo "$as_me:1209: checking target system type" >&5 echo $ECHO_N "checking target system type... $ECHO_C" >&6 if test "${ac_cv_target+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1207,12 +1215,12 @@ else test "x$ac_cv_target_alias" = "x" && ac_cv_target_alias=$ac_cv_host_alias ac_cv_target=`$ac_config_sub $ac_cv_target_alias` || - { { echo "$as_me:1210: error: $ac_config_sub $ac_cv_target_alias failed" >&5 + { { echo "$as_me:1218: error: $ac_config_sub $ac_cv_target_alias failed" >&5 echo "$as_me: error: $ac_config_sub $ac_cv_target_alias failed" >&2;} { (exit 1); exit 1; }; } fi -echo "$as_me:1215: result: $ac_cv_target" >&5 +echo "$as_me:1223: result: $ac_cv_target" >&5 echo "${ECHO_T}$ac_cv_target" >&6 target=$ac_cv_target target_cpu=`echo $ac_cv_target | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'` @@ -1243,13 +1251,13 @@ else fi test -z "$system_name" && system_name="$cf_cv_system_name" -test -n "$cf_cv_system_name" && echo "$as_me:1246: result: Configuring for $cf_cv_system_name" >&5 +test -n "$cf_cv_system_name" && echo "$as_me:1254: result: Configuring for $cf_cv_system_name" >&5 echo "${ECHO_T}Configuring for $cf_cv_system_name" >&6 if test ".$system_name" != ".$cf_cv_system_name" ; then - echo "$as_me:1250: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 + echo "$as_me:1258: result: Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&5 echo "${ECHO_T}Cached system name ($system_name) does not agree with actual ($cf_cv_system_name)" >&6 - { { echo "$as_me:1252: error: \"Please remove config.cache and try again.\"" >&5 + { { echo "$as_me:1260: error: \"Please remove config.cache and try again.\"" >&5 echo "$as_me: error: \"Please remove config.cache and try again.\"" >&2;} { (exit 1); exit 1; }; } fi @@ -1257,7 +1265,7 @@ fi # Check whether --with-system-type or --without-system-type was given. if test "${with_system_type+set}" = set; then withval="$with_system_type" - { echo "$as_me:1260: WARNING: overriding system type to $withval" >&5 + { echo "$as_me:1268: WARNING: overriding system type to $withval" >&5 echo "$as_me: WARNING: overriding system type to $withval" >&2;} cf_cv_system_name=$withval fi; @@ -1267,23 +1275,23 @@ cf_user_CFLAGS="$CFLAGS" ### Default install-location -echo "$as_me:1270: checking for prefix" >&5 +echo "$as_me:1278: checking for prefix" >&5 echo $ECHO_N "checking for prefix... $ECHO_C" >&6 if test "x$prefix" = "xNONE" ; then case "$cf_cv_system_name" in # non-vendor systems don't have a conflict - openbsd*|netbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu) + openbsd*|freebsd*|linux*|cygwin*|k*bsd*-gnu) prefix=/usr ;; *) prefix=$ac_default_prefix ;; esac fi -echo "$as_me:1282: result: $prefix" >&5 +echo "$as_me:1290: result: $prefix" >&5 echo "${ECHO_T}$prefix" >&6 if test "x$prefix" = "xNONE" ; then -echo "$as_me:1286: checking for default include-directory" >&5 +echo "$as_me:1294: checking for default include-directory" >&5 echo $ECHO_N "checking for default include-directory... $ECHO_C" >&6 test -n "$verbose" && echo 1>&6 for cf_symbol in \ @@ -1306,7 +1314,7 @@ do fi test -n "$verbose" && echo " tested $cf_dir" 1>&6 done -echo "$as_me:1309: result: $includedir" >&5 +echo "$as_me:1317: result: $includedir" >&5 echo "${ECHO_T}$includedir" >&6 fi @@ -1319,7 +1327,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. set dummy ${ac_tool_prefix}gcc; ac_word=$2 -echo "$as_me:1322: checking for $ac_word" >&5 +echo "$as_me:1330: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1334,7 +1342,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}gcc" -echo "$as_me:1337: found $ac_dir/$ac_word" >&5 +echo "$as_me:1345: found $ac_dir/$ac_word" >&5 break done @@ -1342,10 +1350,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1345: result: $CC" >&5 + echo "$as_me:1353: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1348: result: no" >&5 + echo "$as_me:1356: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1354,7 +1362,7 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "gcc", so it can be a program name with args. set dummy gcc; ac_word=$2 -echo "$as_me:1357: checking for $ac_word" >&5 +echo "$as_me:1365: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1369,7 +1377,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="gcc" -echo "$as_me:1372: found $ac_dir/$ac_word" >&5 +echo "$as_me:1380: found $ac_dir/$ac_word" >&5 break done @@ -1377,10 +1385,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1380: result: $ac_ct_CC" >&5 + echo "$as_me:1388: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1383: result: no" >&5 + echo "$as_me:1391: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1393,7 +1401,7 @@ if test -z "$CC"; then if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. set dummy ${ac_tool_prefix}cc; ac_word=$2 -echo "$as_me:1396: checking for $ac_word" >&5 +echo "$as_me:1404: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1408,7 +1416,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="${ac_tool_prefix}cc" -echo "$as_me:1411: found $ac_dir/$ac_word" >&5 +echo "$as_me:1419: found $ac_dir/$ac_word" >&5 break done @@ -1416,10 +1424,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1419: result: $CC" >&5 + echo "$as_me:1427: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1422: result: no" >&5 + echo "$as_me:1430: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1428,7 +1436,7 @@ if test -z "$ac_cv_prog_CC"; then ac_ct_CC=$CC # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:1431: checking for $ac_word" >&5 +echo "$as_me:1439: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1443,7 +1451,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="cc" -echo "$as_me:1446: found $ac_dir/$ac_word" >&5 +echo "$as_me:1454: found $ac_dir/$ac_word" >&5 break done @@ -1451,10 +1459,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1454: result: $ac_ct_CC" >&5 + echo "$as_me:1462: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1457: result: no" >&5 + echo "$as_me:1465: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1467,7 +1475,7 @@ fi if test -z "$CC"; then # Extract the first word of "cc", so it can be a program name with args. set dummy cc; ac_word=$2 -echo "$as_me:1470: checking for $ac_word" >&5 +echo "$as_me:1478: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1487,7 +1495,7 @@ if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then continue fi ac_cv_prog_CC="cc" -echo "$as_me:1490: found $ac_dir/$ac_word" >&5 +echo "$as_me:1498: found $ac_dir/$ac_word" >&5 break done @@ -1509,10 +1517,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1512: result: $CC" >&5 + echo "$as_me:1520: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1515: result: no" >&5 + echo "$as_me:1523: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1523,7 +1531,7 @@ if test -z "$CC"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:1526: checking for $ac_word" >&5 +echo "$as_me:1534: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1538,7 +1546,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CC="$ac_tool_prefix$ac_prog" -echo "$as_me:1541: found $ac_dir/$ac_word" >&5 +echo "$as_me:1549: found $ac_dir/$ac_word" >&5 break done @@ -1546,10 +1554,10 @@ fi fi CC=$ac_cv_prog_CC if test -n "$CC"; then - echo "$as_me:1549: result: $CC" >&5 + echo "$as_me:1557: result: $CC" >&5 echo "${ECHO_T}$CC" >&6 else - echo "$as_me:1552: result: no" >&5 + echo "$as_me:1560: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1562,7 +1570,7 @@ if test -z "$CC"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:1565: checking for $ac_word" >&5 +echo "$as_me:1573: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -1577,7 +1585,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CC="$ac_prog" -echo "$as_me:1580: found $ac_dir/$ac_word" >&5 +echo "$as_me:1588: found $ac_dir/$ac_word" >&5 break done @@ -1585,10 +1593,10 @@ fi fi ac_ct_CC=$ac_cv_prog_ac_ct_CC if test -n "$ac_ct_CC"; then - echo "$as_me:1588: result: $ac_ct_CC" >&5 + echo "$as_me:1596: result: $ac_ct_CC" >&5 echo "${ECHO_T}$ac_ct_CC" >&6 else - echo "$as_me:1591: result: no" >&5 + echo "$as_me:1599: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -1600,32 +1608,32 @@ fi fi -test -z "$CC" && { { echo "$as_me:1603: error: no acceptable cc found in \$PATH" >&5 +test -z "$CC" && { { echo "$as_me:1611: error: no acceptable cc found in \$PATH" >&5 echo "$as_me: error: no acceptable cc found in \$PATH" >&2;} { (exit 1); exit 1; }; } # Provide some information about the compiler. -echo "$as_me:1608:" \ +echo "$as_me:1616:" \ "checking for C compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:1611: \"$ac_compiler --version &5\"") >&5 +{ (eval echo "$as_me:1619: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? - echo "$as_me:1614: \$? = $ac_status" >&5 + echo "$as_me:1622: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:1616: \"$ac_compiler -v &5\"") >&5 +{ (eval echo "$as_me:1624: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? - echo "$as_me:1619: \$? = $ac_status" >&5 + echo "$as_me:1627: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:1621: \"$ac_compiler -V &5\"") >&5 +{ (eval echo "$as_me:1629: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? - echo "$as_me:1624: \$? = $ac_status" >&5 + echo "$as_me:1632: \$? = $ac_status" >&5 (exit $ac_status); } cat >conftest.$ac_ext <<_ACEOF -#line 1628 "configure" +#line 1636 "configure" #include "confdefs.h" int @@ -1641,13 +1649,13 @@ ac_clean_files="$ac_clean_files a.out a.exe" # Try to create an executable without -o first, disregard a.out. # It will help us diagnose broken compilers, and finding out an intuition # of exeext. -echo "$as_me:1644: checking for C compiler default output" >&5 +echo "$as_me:1652: checking for C compiler default output" >&5 echo $ECHO_N "checking for C compiler default output... $ECHO_C" >&6 ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` -if { (eval echo "$as_me:1647: \"$ac_link_default\"") >&5 +if { (eval echo "$as_me:1655: \"$ac_link_default\"") >&5 (eval $ac_link_default) 2>&5 ac_status=$? - echo "$as_me:1650: \$? = $ac_status" >&5 + echo "$as_me:1658: \$? = $ac_status" >&5 (exit $ac_status); }; then # Find the output, starting from the most likely. This scheme is # not robust to junk in `.', hence go to wildcards (a.*) only as a last @@ -1670,34 +1678,34 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:1673: error: C compiler cannot create executables" >&5 +{ { echo "$as_me:1681: error: C compiler cannot create executables" >&5 echo "$as_me: error: C compiler cannot create executables" >&2;} { (exit 77); exit 77; }; } fi ac_exeext=$ac_cv_exeext -echo "$as_me:1679: result: $ac_file" >&5 +echo "$as_me:1687: result: $ac_file" >&5 echo "${ECHO_T}$ac_file" >&6 # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:1684: checking whether the C compiler works" >&5 +echo "$as_me:1692: checking whether the C compiler works" >&5 echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6 # FIXME: These cross compiler hacks should be removed for Autoconf 3.0 # If not cross compiling, check that we can run a simple program. if test "$cross_compiling" != yes; then if { ac_try='./$ac_file' - { (eval echo "$as_me:1690: \"$ac_try\"") >&5 + { (eval echo "$as_me:1698: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1693: \$? = $ac_status" >&5 + echo "$as_me:1701: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cross_compiling=no else if test "$cross_compiling" = maybe; then cross_compiling=yes else - { { echo "$as_me:1700: error: cannot run C compiled programs. + { { echo "$as_me:1708: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&5 echo "$as_me: error: cannot run C compiled programs. If you meant to cross compile, use \`--host'." >&2;} @@ -1705,24 +1713,24 @@ If you meant to cross compile, use \`--host'." >&2;} fi fi fi -echo "$as_me:1708: result: yes" >&5 +echo "$as_me:1716: result: yes" >&5 echo "${ECHO_T}yes" >&6 rm -f a.out a.exe conftest$ac_cv_exeext ac_clean_files=$ac_clean_files_save # Check the compiler produces executables we can run. If not, either # the compiler is broken, or we cross compile. -echo "$as_me:1715: checking whether we are cross compiling" >&5 +echo "$as_me:1723: checking whether we are cross compiling" >&5 echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6 -echo "$as_me:1717: result: $cross_compiling" >&5 +echo "$as_me:1725: result: $cross_compiling" >&5 echo "${ECHO_T}$cross_compiling" >&6 -echo "$as_me:1720: checking for executable suffix" >&5 +echo "$as_me:1728: checking for executable suffix" >&5 echo $ECHO_N "checking for executable suffix... $ECHO_C" >&6 -if { (eval echo "$as_me:1722: \"$ac_link\"") >&5 +if { (eval echo "$as_me:1730: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:1725: \$? = $ac_status" >&5 + echo "$as_me:1733: \$? = $ac_status" >&5 (exit $ac_status); }; then # If both `conftest.exe' and `conftest' are `present' (well, observable) # catch `conftest.exe'. For instance with Cygwin, `ls conftest' will @@ -1738,25 +1746,25 @@ for ac_file in `(ls conftest.exe; ls conftest; ls conftest.*) 2>/dev/null`; do esac done else - { { echo "$as_me:1741: error: cannot compute EXEEXT: cannot compile and link" >&5 + { { echo "$as_me:1749: error: cannot compute EXEEXT: cannot compile and link" >&5 echo "$as_me: error: cannot compute EXEEXT: cannot compile and link" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest$ac_cv_exeext -echo "$as_me:1747: result: $ac_cv_exeext" >&5 +echo "$as_me:1755: result: $ac_cv_exeext" >&5 echo "${ECHO_T}$ac_cv_exeext" >&6 rm -f conftest.$ac_ext EXEEXT=$ac_cv_exeext ac_exeext=$EXEEXT -echo "$as_me:1753: checking for object suffix" >&5 +echo "$as_me:1761: checking for object suffix" >&5 echo $ECHO_N "checking for object suffix... $ECHO_C" >&6 if test "${ac_cv_objext+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1759 "configure" +#line 1767 "configure" #include "confdefs.h" int @@ -1768,10 +1776,10 @@ main () } _ACEOF rm -f conftest.o conftest.obj -if { (eval echo "$as_me:1771: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1779: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1774: \$? = $ac_status" >&5 + echo "$as_me:1782: \$? = $ac_status" >&5 (exit $ac_status); }; then for ac_file in `(ls conftest.o conftest.obj; ls conftest.*) 2>/dev/null`; do case $ac_file in @@ -1783,24 +1791,24 @@ done else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -{ { echo "$as_me:1786: error: cannot compute OBJEXT: cannot compile" >&5 +{ { echo "$as_me:1794: error: cannot compute OBJEXT: cannot compile" >&5 echo "$as_me: error: cannot compute OBJEXT: cannot compile" >&2;} { (exit 1); exit 1; }; } fi rm -f conftest.$ac_cv_objext conftest.$ac_ext fi -echo "$as_me:1793: result: $ac_cv_objext" >&5 +echo "$as_me:1801: result: $ac_cv_objext" >&5 echo "${ECHO_T}$ac_cv_objext" >&6 OBJEXT=$ac_cv_objext ac_objext=$OBJEXT -echo "$as_me:1797: checking whether we are using the GNU C compiler" >&5 +echo "$as_me:1805: checking whether we are using the GNU C compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6 if test "${ac_cv_c_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1803 "configure" +#line 1811 "configure" #include "confdefs.h" int @@ -1815,16 +1823,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1818: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1826: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1821: \$? = $ac_status" >&5 + echo "$as_me:1829: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1824: \"$ac_try\"") >&5 + { (eval echo "$as_me:1832: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1827: \$? = $ac_status" >&5 + echo "$as_me:1835: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else @@ -1836,19 +1844,19 @@ rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_c_compiler_gnu=$ac_compiler_gnu fi -echo "$as_me:1839: result: $ac_cv_c_compiler_gnu" >&5 +echo "$as_me:1847: result: $ac_cv_c_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6 GCC=`test $ac_compiler_gnu = yes && echo yes` ac_test_CFLAGS=${CFLAGS+set} ac_save_CFLAGS=$CFLAGS CFLAGS="-g" -echo "$as_me:1845: checking whether $CC accepts -g" >&5 +echo "$as_me:1853: checking whether $CC accepts -g" >&5 echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cc_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 1851 "configure" +#line 1859 "configure" #include "confdefs.h" int @@ -1860,16 +1868,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1863: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1871: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1866: \$? = $ac_status" >&5 + echo "$as_me:1874: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1869: \"$ac_try\"") >&5 + { (eval echo "$as_me:1877: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1872: \$? = $ac_status" >&5 + echo "$as_me:1880: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_g=yes else @@ -1879,7 +1887,7 @@ ac_cv_prog_cc_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:1882: result: $ac_cv_prog_cc_g" >&5 +echo "$as_me:1890: result: $ac_cv_prog_cc_g" >&5 echo "${ECHO_T}$ac_cv_prog_cc_g" >&6 if test "$ac_test_CFLAGS" = set; then CFLAGS=$ac_save_CFLAGS @@ -1906,16 +1914,16 @@ cat >conftest.$ac_ext <<_ACEOF #endif _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1909: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1917: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1912: \$? = $ac_status" >&5 + echo "$as_me:1920: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1915: \"$ac_try\"") >&5 + { (eval echo "$as_me:1923: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1918: \$? = $ac_status" >&5 + echo "$as_me:1926: \$? = $ac_status" >&5 (exit $ac_status); }; }; then for ac_declaration in \ ''\ @@ -1927,7 +1935,7 @@ if { (eval echo "$as_me:1909: \"$ac_compile\"") >&5 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line 1930 "configure" +#line 1938 "configure" #include "confdefs.h" #include $ac_declaration @@ -1940,16 +1948,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1943: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1951: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1946: \$? = $ac_status" >&5 + echo "$as_me:1954: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1949: \"$ac_try\"") >&5 + { (eval echo "$as_me:1957: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1952: \$? = $ac_status" >&5 + echo "$as_me:1960: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -1959,7 +1967,7 @@ continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line 1962 "configure" +#line 1970 "configure" #include "confdefs.h" $ac_declaration int @@ -1971,16 +1979,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:1974: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:1982: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:1977: \$? = $ac_status" >&5 + echo "$as_me:1985: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:1980: \"$ac_try\"") >&5 + { (eval echo "$as_me:1988: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:1983: \$? = $ac_status" >&5 + echo "$as_me:1991: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -2009,11 +2017,11 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu GCC_VERSION=none if test "$GCC" = yes ; then - echo "$as_me:2012: checking version of $CC" >&5 + echo "$as_me:2020: checking version of $CC" >&5 echo $ECHO_N "checking version of $CC... $ECHO_C" >&6 - GCC_VERSION="`${CC} --version|sed -e '2,$d' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" + GCC_VERSION="`${CC} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" test -z "$GCC_VERSION" && GCC_VERSION=unknown - echo "$as_me:2016: result: $GCC_VERSION" >&5 + echo "$as_me:2024: result: $GCC_VERSION" >&5 echo "${ECHO_T}$GCC_VERSION" >&6 fi @@ -2022,7 +2030,7 @@ ac_cpp='$CPP $CPPFLAGS' ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:2025: checking how to run the C preprocessor" >&5 +echo "$as_me:2033: checking how to run the C preprocessor" >&5 echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6 # On Suns, sometimes $CPP names a directory. if test -n "$CPP" && test -d "$CPP"; then @@ -2043,18 +2051,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 2046 "configure" +#line 2054 "configure" #include "confdefs.h" #include Syntax error _ACEOF -if { (eval echo "$as_me:2051: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2059: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2057: \$? = $ac_status" >&5 + echo "$as_me:2065: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2077,17 +2085,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 2080 "configure" +#line 2088 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:2084: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2092: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2090: \$? = $ac_status" >&5 + echo "$as_me:2098: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2124,7 +2132,7 @@ fi else ac_cv_prog_CPP=$CPP fi -echo "$as_me:2127: result: $CPP" >&5 +echo "$as_me:2135: result: $CPP" >&5 echo "${ECHO_T}$CPP" >&6 ac_preproc_ok=false for ac_c_preproc_warn_flag in '' yes @@ -2134,18 +2142,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 2137 "configure" +#line 2145 "configure" #include "confdefs.h" #include Syntax error _ACEOF -if { (eval echo "$as_me:2142: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2150: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2148: \$? = $ac_status" >&5 + echo "$as_me:2156: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2168,17 +2176,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 2171 "configure" +#line 2179 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:2175: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:2183: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:2181: \$? = $ac_status" >&5 + echo "$as_me:2189: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -2206,7 +2214,7 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { echo "$as_me:2209: error: C preprocessor \"$CPP\" fails sanity check" >&5 + { { echo "$as_me:2217: error: C preprocessor \"$CPP\" fails sanity check" >&5 echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi @@ -2218,14 +2226,14 @@ ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test $ac_cv_c_compiler_gnu = yes; then - echo "$as_me:2221: checking whether $CC needs -traditional" >&5 + echo "$as_me:2229: checking whether $CC needs -traditional" >&5 echo $ECHO_N "checking whether $CC needs -traditional... $ECHO_C" >&6 if test "${ac_cv_prog_gcc_traditional+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else ac_pattern="Autoconf.*'x'" cat >conftest.$ac_ext <<_ACEOF -#line 2228 "configure" +#line 2236 "configure" #include "confdefs.h" #include int Autoconf = TIOCGETP; @@ -2240,7 +2248,7 @@ rm -f conftest* if test $ac_cv_prog_gcc_traditional = no; then cat >conftest.$ac_ext <<_ACEOF -#line 2243 "configure" +#line 2251 "configure" #include "confdefs.h" #include int Autoconf = TCGETA; @@ -2253,19 +2261,61 @@ rm -f conftest* fi fi -echo "$as_me:2256: result: $ac_cv_prog_gcc_traditional" >&5 +echo "$as_me:2264: result: $ac_cv_prog_gcc_traditional" >&5 echo "${ECHO_T}$ac_cv_prog_gcc_traditional" >&6 if test $ac_cv_prog_gcc_traditional = yes; then CC="$CC -traditional" fi fi -echo "$as_me:2263: checking for POSIXized ISC" >&5 +echo "$as_me:2271: checking whether $CC understands -c and -o together" >&5 +echo $ECHO_N "checking whether $CC understands -c and -o together... $ECHO_C" >&6 +if test "${cf_cv_prog_CC_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat > conftest.$ac_ext < +int main() +{ + return 0; +} +CF_EOF +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +if { (eval echo "$as_me:2287: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2290: \$? = $ac_status" >&5 + (exit $ac_status); } && + test -f conftest2.$ac_objext && { (eval echo "$as_me:2292: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:2295: \$? = $ac_status" >&5 + (exit $ac_status); }; +then + eval cf_cv_prog_CC_c_o=yes +else + eval cf_cv_prog_CC_c_o=no +fi +rm -f conftest* + +fi +if test $cf_cv_prog_CC_c_o = yes; then + echo "$as_me:2306: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:2309: result: no" >&5 +echo "${ECHO_T}no" >&6 +fi + +echo "$as_me:2313: checking for POSIXized ISC" >&5 echo $ECHO_N "checking for POSIXized ISC... $ECHO_C" >&6 if test -d /etc/conf/kconfig.d && grep _POSIX_VERSION /usr/include/sys/unistd.h >/dev/null 2>&1 then - echo "$as_me:2268: result: yes" >&5 + echo "$as_me:2318: result: yes" >&5 echo "${ECHO_T}yes" >&6 ISC=yes # If later tests want to check for ISC. @@ -2279,12 +2329,12 @@ EOF CC="$CC -Xp" fi else - echo "$as_me:2282: result: no" >&5 + echo "$as_me:2332: result: no" >&5 echo "${ECHO_T}no" >&6 ISC= fi -echo "$as_me:2287: checking for ${CC-cc} option to accept ANSI C" >&5 +echo "$as_me:2337: checking for ${CC-cc} option to accept ANSI C" >&5 echo $ECHO_N "checking for ${CC-cc} option to accept ANSI C... $ECHO_C" >&6 if test "${cf_cv_ansi_cc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2309,12 +2359,34 @@ for cf_arg in "-DCC_HAS_PROTOS" \ -Xc do +cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= +cf_new_extra_cppflags= + for cf_add_cflags in $cf_arg do +case $cf_fix_cppflags in +no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; @@ -2327,6 +2399,17 @@ do cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac done if test -n "$cf_new_cflags" ; then @@ -2339,8 +2422,13 @@ if test -n "$cf_new_cppflags" ; then CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + cat >conftest.$ac_ext <<_ACEOF -#line 2343 "configure" +#line 2431 "configure" #include "confdefs.h" #ifndef CC_HAS_PROTOS @@ -2361,16 +2449,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2364: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2452: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2367: \$? = $ac_status" >&5 + echo "$as_me:2455: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2370: \"$ac_try\"") >&5 + { (eval echo "$as_me:2458: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2373: \$? = $ac_status" >&5 + echo "$as_me:2461: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_ansi_cc="$cf_arg"; break else @@ -2383,18 +2471,40 @@ CFLAGS="$cf_save_CFLAGS" CPPFLAGS="$cf_save_CPPFLAGS" fi -echo "$as_me:2386: result: $cf_cv_ansi_cc" >&5 +echo "$as_me:2474: result: $cf_cv_ansi_cc" >&5 echo "${ECHO_T}$cf_cv_ansi_cc" >&6 if test "$cf_cv_ansi_cc" != "no"; then if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then +cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= +cf_new_extra_cppflags= + for cf_add_cflags in $cf_cv_ansi_cc do +case $cf_fix_cppflags in +no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; @@ -2407,6 +2517,17 @@ do cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac done if test -n "$cf_new_cflags" ; then @@ -2419,6 +2540,11 @@ if test -n "$cf_new_cppflags" ; then CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + else cat >>confdefs.h <<\EOF #define CC_HAS_PROTOS 1 @@ -2428,7 +2554,7 @@ fi fi if test "$cf_cv_ansi_cc" = "no"; then - { { echo "$as_me:2431: error: Your compiler does not appear to recognize prototypes. + { { echo "$as_me:2557: error: Your compiler does not appear to recognize prototypes. You have the following choices: a. adjust your compiler options b. get an up-to-date compiler @@ -2468,7 +2594,7 @@ freebsd*) #(vi *) LDPATH=$PATH:/sbin:/usr/sbin # Extract the first word of "ldconfig", so it can be a program name with args. set dummy ldconfig; ac_word=$2 -echo "$as_me:2471: checking for $ac_word" >&5 +echo "$as_me:2597: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_LDCONFIG+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2485,7 +2611,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_LDCONFIG="$ac_dir/$ac_word" - echo "$as_me:2488: found $ac_dir/$ac_word" >&5 + echo "$as_me:2614: found $ac_dir/$ac_word" >&5 break fi done @@ -2496,10 +2622,10 @@ fi LDCONFIG=$ac_cv_path_LDCONFIG if test -n "$LDCONFIG"; then - echo "$as_me:2499: result: $LDCONFIG" >&5 + echo "$as_me:2625: result: $LDCONFIG" >&5 echo "${ECHO_T}$LDCONFIG" >&6 else - echo "$as_me:2502: result: no" >&5 + echo "$as_me:2628: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2507,7 +2633,7 @@ fi esac fi -echo "$as_me:2510: checking if you want to ensure bool is consistent with C++" >&5 +echo "$as_me:2636: checking if you want to ensure bool is consistent with C++" >&5 echo $ECHO_N "checking if you want to ensure bool is consistent with C++... $ECHO_C" >&6 # Check whether --with-cxx or --without-cxx was given. @@ -2517,7 +2643,7 @@ if test "${with_cxx+set}" = set; then else cf_with_cxx=yes fi; -echo "$as_me:2520: result: $cf_with_cxx" >&5 +echo "$as_me:2646: result: $cf_with_cxx" >&5 echo "${ECHO_T}$cf_with_cxx" >&6 if test "X$cf_with_cxx" = Xno ; then CXX="" @@ -2534,7 +2660,7 @@ if test -n "$ac_tool_prefix"; then do # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. set dummy $ac_tool_prefix$ac_prog; ac_word=$2 -echo "$as_me:2537: checking for $ac_word" >&5 +echo "$as_me:2663: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2549,7 +2675,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_CXX="$ac_tool_prefix$ac_prog" -echo "$as_me:2552: found $ac_dir/$ac_word" >&5 +echo "$as_me:2678: found $ac_dir/$ac_word" >&5 break done @@ -2557,10 +2683,10 @@ fi fi CXX=$ac_cv_prog_CXX if test -n "$CXX"; then - echo "$as_me:2560: result: $CXX" >&5 + echo "$as_me:2686: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else - echo "$as_me:2563: result: no" >&5 + echo "$as_me:2689: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2573,7 +2699,7 @@ if test -z "$CXX"; then do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:2576: checking for $ac_word" >&5 +echo "$as_me:2702: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2588,7 +2714,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_CXX="$ac_prog" -echo "$as_me:2591: found $ac_dir/$ac_word" >&5 +echo "$as_me:2717: found $ac_dir/$ac_word" >&5 break done @@ -2596,10 +2722,10 @@ fi fi ac_ct_CXX=$ac_cv_prog_ac_ct_CXX if test -n "$ac_ct_CXX"; then - echo "$as_me:2599: result: $ac_ct_CXX" >&5 + echo "$as_me:2725: result: $ac_ct_CXX" >&5 echo "${ECHO_T}$ac_ct_CXX" >&6 else - echo "$as_me:2602: result: no" >&5 + echo "$as_me:2728: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -2611,32 +2737,32 @@ test -n "$ac_ct_CXX" || ac_ct_CXX="g++" fi # Provide some information about the compiler. -echo "$as_me:2614:" \ +echo "$as_me:2740:" \ "checking for C++ compiler version" >&5 ac_compiler=`set X $ac_compile; echo $2` -{ (eval echo "$as_me:2617: \"$ac_compiler --version &5\"") >&5 +{ (eval echo "$as_me:2743: \"$ac_compiler --version &5\"") >&5 (eval $ac_compiler --version &5) 2>&5 ac_status=$? - echo "$as_me:2620: \$? = $ac_status" >&5 + echo "$as_me:2746: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:2622: \"$ac_compiler -v &5\"") >&5 +{ (eval echo "$as_me:2748: \"$ac_compiler -v &5\"") >&5 (eval $ac_compiler -v &5) 2>&5 ac_status=$? - echo "$as_me:2625: \$? = $ac_status" >&5 + echo "$as_me:2751: \$? = $ac_status" >&5 (exit $ac_status); } -{ (eval echo "$as_me:2627: \"$ac_compiler -V &5\"") >&5 +{ (eval echo "$as_me:2753: \"$ac_compiler -V &5\"") >&5 (eval $ac_compiler -V &5) 2>&5 ac_status=$? - echo "$as_me:2630: \$? = $ac_status" >&5 + echo "$as_me:2756: \$? = $ac_status" >&5 (exit $ac_status); } -echo "$as_me:2633: checking whether we are using the GNU C++ compiler" >&5 +echo "$as_me:2759: checking whether we are using the GNU C++ compiler" >&5 echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6 if test "${ac_cv_cxx_compiler_gnu+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2639 "configure" +#line 2765 "configure" #include "confdefs.h" int @@ -2651,16 +2777,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2654: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2780: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2657: \$? = $ac_status" >&5 + echo "$as_me:2783: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2660: \"$ac_try\"") >&5 + { (eval echo "$as_me:2786: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2663: \$? = $ac_status" >&5 + echo "$as_me:2789: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_compiler_gnu=yes else @@ -2672,19 +2798,19 @@ rm -f conftest.$ac_objext conftest.$ac_ext ac_cv_cxx_compiler_gnu=$ac_compiler_gnu fi -echo "$as_me:2675: result: $ac_cv_cxx_compiler_gnu" >&5 +echo "$as_me:2801: result: $ac_cv_cxx_compiler_gnu" >&5 echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6 GXX=`test $ac_compiler_gnu = yes && echo yes` ac_test_CXXFLAGS=${CXXFLAGS+set} ac_save_CXXFLAGS=$CXXFLAGS CXXFLAGS="-g" -echo "$as_me:2681: checking whether $CXX accepts -g" >&5 +echo "$as_me:2807: checking whether $CXX accepts -g" >&5 echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6 if test "${ac_cv_prog_cxx_g+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 2687 "configure" +#line 2813 "configure" #include "confdefs.h" int @@ -2696,16 +2822,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2699: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2825: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2702: \$? = $ac_status" >&5 + echo "$as_me:2828: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2705: \"$ac_try\"") >&5 + { (eval echo "$as_me:2831: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2708: \$? = $ac_status" >&5 + echo "$as_me:2834: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cxx_g=yes else @@ -2715,7 +2841,7 @@ ac_cv_prog_cxx_g=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:2718: result: $ac_cv_prog_cxx_g" >&5 +echo "$as_me:2844: result: $ac_cv_prog_cxx_g" >&5 echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6 if test "$ac_test_CXXFLAGS" = set; then CXXFLAGS=$ac_save_CXXFLAGS @@ -2742,7 +2868,7 @@ for ac_declaration in \ 'void exit (int);' do cat >conftest.$ac_ext <<_ACEOF -#line 2745 "configure" +#line 2871 "configure" #include "confdefs.h" #include $ac_declaration @@ -2755,16 +2881,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2758: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2884: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2761: \$? = $ac_status" >&5 + echo "$as_me:2887: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2764: \"$ac_try\"") >&5 + { (eval echo "$as_me:2890: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2767: \$? = $ac_status" >&5 + echo "$as_me:2893: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -2774,7 +2900,7 @@ continue fi rm -f conftest.$ac_objext conftest.$ac_ext cat >conftest.$ac_ext <<_ACEOF -#line 2777 "configure" +#line 2903 "configure" #include "confdefs.h" $ac_declaration int @@ -2786,16 +2912,16 @@ exit (42); } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:2789: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:2915: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:2792: \$? = $ac_status" >&5 + echo "$as_me:2918: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:2795: \"$ac_try\"") >&5 + { (eval echo "$as_me:2921: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:2798: \$? = $ac_status" >&5 + echo "$as_me:2924: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -2821,7 +2947,7 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu if test "$CXX" = "g++" ; then # Extract the first word of "g++", so it can be a program name with args. set dummy g++; ac_word=$2 -echo "$as_me:2824: checking for $ac_word" >&5 +echo "$as_me:2950: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_CXX+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2838,7 +2964,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_CXX="$ac_dir/$ac_word" - echo "$as_me:2841: found $ac_dir/$ac_word" >&5 + echo "$as_me:2967: found $ac_dir/$ac_word" >&5 break fi done @@ -2849,16 +2975,16 @@ fi CXX=$ac_cv_path_CXX if test -n "$CXX"; then - echo "$as_me:2852: result: $CXX" >&5 + echo "$as_me:2978: result: $CXX" >&5 echo "${ECHO_T}$CXX" >&6 else - echo "$as_me:2855: result: no" >&5 + echo "$as_me:2981: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test "$CXX" = "g++" ; then - { echo "$as_me:2861: WARNING: ignoring hardcoded g++" >&5 + { echo "$as_me:2987: WARNING: ignoring hardcoded g++" >&5 echo "$as_me: WARNING: ignoring hardcoded g++" >&2;} cf_with_cxx=no; CXX=""; GXX=""; fi @@ -2866,10 +2992,11 @@ fi GXX_VERSION=none if test "$GXX" = yes; then - echo "$as_me:2869: checking version of g++" >&5 + echo "$as_me:2995: checking version of g++" >&5 echo $ECHO_N "checking version of g++... $ECHO_C" >&6 - GXX_VERSION="`${CXX-g++} --version|sed -e '2,$d'`" - echo "$as_me:2872: result: $GXX_VERSION" >&5 + GXX_VERSION="`${CXX-g++} --version| sed -e '2,$d' -e 's/^.*(GCC) //' -e 's/^[^0-9.]*//' -e 's/[^0-9.].*//'`" + test -z "$GXX_VERSION" && GXX_VERSION=unknown + echo "$as_me:2999: result: $GXX_VERSION" >&5 echo "${ECHO_T}$GXX_VERSION" >&6 fi @@ -2877,12 +3004,12 @@ case $GXX_VERSION in 1*|2.[0-6]*) GXX=""; CXX=""; ac_cv_cxx_compiler_gnu=no cf_cxx_library=no - { echo "$as_me:2880: WARNING: templates do not work" >&5 + { echo "$as_me:3007: WARNING: templates do not work" >&5 echo "$as_me: WARNING: templates do not work" >&2;} ;; esac -echo "$as_me:2885: checking if you want to build C++ binding and demo" >&5 +echo "$as_me:3012: checking if you want to build C++ binding and demo" >&5 echo $ECHO_N "checking if you want to build C++ binding and demo... $ECHO_C" >&6 # Check whether --with-cxx-binding or --without-cxx-binding was given. @@ -2892,10 +3019,10 @@ if test "${with_cxx_binding+set}" = set; then else cf_with_cxx_binding=$cf_with_cxx fi; -echo "$as_me:2895: result: $cf_with_cxx_binding" >&5 +echo "$as_me:3022: result: $cf_with_cxx_binding" >&5 echo "${ECHO_T}$cf_with_cxx_binding" >&6 -echo "$as_me:2898: checking if you want to build with Ada95" >&5 +echo "$as_me:3025: checking if you want to build with Ada95" >&5 echo $ECHO_N "checking if you want to build with Ada95... $ECHO_C" >&6 # Check whether --with-ada or --without-ada was given. @@ -2905,10 +3032,10 @@ if test "${with_ada+set}" = set; then else cf_with_ada=yes fi; -echo "$as_me:2908: result: $cf_with_ada" >&5 +echo "$as_me:3035: result: $cf_with_ada" >&5 echo "${ECHO_T}$cf_with_ada" >&6 -echo "$as_me:2911: checking if you want to build programs such as tic" >&5 +echo "$as_me:3038: checking if you want to build programs such as tic" >&5 echo $ECHO_N "checking if you want to build programs such as tic... $ECHO_C" >&6 # Check whether --with-progs or --without-progs was given. @@ -2918,10 +3045,10 @@ if test "${with_progs+set}" = set; then else cf_with_progs=yes fi; -echo "$as_me:2921: result: $cf_with_progs" >&5 +echo "$as_me:3048: result: $cf_with_progs" >&5 echo "${ECHO_T}$cf_with_progs" >&6 -echo "$as_me:2924: checking if you wish to install curses.h" >&5 +echo "$as_me:3051: checking if you wish to install curses.h" >&5 echo $ECHO_N "checking if you wish to install curses.h... $ECHO_C" >&6 # Check whether --with-curses-h or --without-curses-h was given. @@ -2931,7 +3058,7 @@ if test "${with_curses_h+set}" = set; then else with_curses_h=yes fi; -echo "$as_me:2934: result: $with_curses_h" >&5 +echo "$as_me:3061: result: $with_curses_h" >&5 echo "${ECHO_T}$with_curses_h" >&6 modules_to_build="ncurses" @@ -2957,7 +3084,7 @@ for ac_prog in mawk gawk nawk awk do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:2960: checking for $ac_word" >&5 +echo "$as_me:3087: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AWK+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -2972,7 +3099,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_AWK="$ac_prog" -echo "$as_me:2975: found $ac_dir/$ac_word" >&5 +echo "$as_me:3102: found $ac_dir/$ac_word" >&5 break done @@ -2980,17 +3107,17 @@ fi fi AWK=$ac_cv_prog_AWK if test -n "$AWK"; then - echo "$as_me:2983: result: $AWK" >&5 + echo "$as_me:3110: result: $AWK" >&5 echo "${ECHO_T}$AWK" >&6 else - echo "$as_me:2986: result: no" >&5 + echo "$as_me:3113: result: no" >&5 echo "${ECHO_T}no" >&6 fi test -n "$AWK" && break done -echo "$as_me:2993: checking whether ${MAKE-make} sets \${MAKE}" >&5 +echo "$as_me:3120: checking whether ${MAKE-make} sets \${MAKE}" >&5 echo $ECHO_N "checking whether ${MAKE-make} sets \${MAKE}... $ECHO_C" >&6 set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y,./+-,__p_,'` if eval "test \"\${ac_cv_prog_make_${ac_make}_set+set}\" = set"; then @@ -3010,11 +3137,11 @@ fi rm -f conftest.make fi if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then - echo "$as_me:3013: result: yes" >&5 + echo "$as_me:3140: result: yes" >&5 echo "${ECHO_T}yes" >&6 SET_MAKE= else - echo "$as_me:3017: result: no" >&5 + echo "$as_me:3144: result: no" >&5 echo "${ECHO_T}no" >&6 SET_MAKE="MAKE=${MAKE-make}" fi @@ -3031,7 +3158,7 @@ fi # AFS /usr/afsws/bin/install, which mishandles nonexistent args # SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" # ./install, which can be erroneously created by make from ./install.sh. -echo "$as_me:3034: checking for a BSD compatible install" >&5 +echo "$as_me:3161: checking for a BSD compatible install" >&5 echo $ECHO_N "checking for a BSD compatible install... $ECHO_C" >&6 if test -z "$INSTALL"; then if test "${ac_cv_path_install+set}" = set; then @@ -3080,7 +3207,7 @@ fi INSTALL=$ac_install_sh fi fi -echo "$as_me:3083: result: $INSTALL" >&5 +echo "$as_me:3210: result: $INSTALL" >&5 echo "${ECHO_T}$INSTALL" >&6 # Use test -z because SunOS4 sh mishandles braces in ${var-val}. @@ -3101,7 +3228,7 @@ case $INSTALL in ;; esac -echo "$as_me:3104: checking for long file names" >&5 +echo "$as_me:3231: checking for long file names" >&5 echo $ECHO_N "checking for long file names... $ECHO_C" >&6 if test "${ac_cv_sys_long_file_names+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3140,7 +3267,7 @@ for ac_dir in . $ac_tmpdirs `eval echo $prefix/lib $exec_prefix/lib` ; do rm -rf $ac_xdir 2>/dev/null done fi -echo "$as_me:3143: result: $ac_cv_sys_long_file_names" >&5 +echo "$as_me:3270: result: $ac_cv_sys_long_file_names" >&5 echo "${ECHO_T}$ac_cv_sys_long_file_names" >&6 if test $ac_cv_sys_long_file_names = yes; then @@ -3150,7 +3277,7 @@ EOF fi -echo "$as_me:3153: checking if filesystem supports mixed-case filenames" >&5 +echo "$as_me:3280: checking if filesystem supports mixed-case filenames" >&5 echo $ECHO_N "checking if filesystem supports mixed-case filenames... $ECHO_C" >&6 if test "${cf_cv_mixedcase+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3177,26 +3304,26 @@ else fi fi -echo "$as_me:3180: result: $cf_cv_mixedcase" >&5 +echo "$as_me:3307: result: $cf_cv_mixedcase" >&5 echo "${ECHO_T}$cf_cv_mixedcase" >&6 test "$cf_cv_mixedcase" = yes && cat >>confdefs.h <<\EOF #define MIXEDCASE_FILENAMES 1 EOF -echo "$as_me:3186: checking whether ln -s works" >&5 +echo "$as_me:3313: checking whether ln -s works" >&5 echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6 LN_S=$as_ln_s if test "$LN_S" = "ln -s"; then - echo "$as_me:3190: result: yes" >&5 + echo "$as_me:3317: result: yes" >&5 echo "${ECHO_T}yes" >&6 else - echo "$as_me:3193: result: no, using $LN_S" >&5 + echo "$as_me:3320: result: no, using $LN_S" >&5 echo "${ECHO_T}no, using $LN_S" >&6 fi # Extract the first word of "ctags", so it can be a program name with args. set dummy ctags; ac_word=$2 -echo "$as_me:3199: checking for $ac_word" >&5 +echo "$as_me:3326: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MAKE_LOWER_TAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3211,7 +3338,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAKE_LOWER_TAGS="yes" -echo "$as_me:3214: found $ac_dir/$ac_word" >&5 +echo "$as_me:3341: found $ac_dir/$ac_word" >&5 break done @@ -3220,17 +3347,17 @@ fi fi MAKE_LOWER_TAGS=$ac_cv_prog_MAKE_LOWER_TAGS if test -n "$MAKE_LOWER_TAGS"; then - echo "$as_me:3223: result: $MAKE_LOWER_TAGS" >&5 + echo "$as_me:3350: result: $MAKE_LOWER_TAGS" >&5 echo "${ECHO_T}$MAKE_LOWER_TAGS" >&6 else - echo "$as_me:3226: result: no" >&5 + echo "$as_me:3353: result: no" >&5 echo "${ECHO_T}no" >&6 fi if test "$cf_cv_mixedcase" = yes ; then # Extract the first word of "etags", so it can be a program name with args. set dummy etags; ac_word=$2 -echo "$as_me:3233: checking for $ac_word" >&5 +echo "$as_me:3360: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MAKE_UPPER_TAGS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3245,7 +3372,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAKE_UPPER_TAGS="yes" -echo "$as_me:3248: found $ac_dir/$ac_word" >&5 +echo "$as_me:3375: found $ac_dir/$ac_word" >&5 break done @@ -3254,10 +3381,10 @@ fi fi MAKE_UPPER_TAGS=$ac_cv_prog_MAKE_UPPER_TAGS if test -n "$MAKE_UPPER_TAGS"; then - echo "$as_me:3257: result: $MAKE_UPPER_TAGS" >&5 + echo "$as_me:3384: result: $MAKE_UPPER_TAGS" >&5 echo "${ECHO_T}$MAKE_UPPER_TAGS" >&6 else - echo "$as_me:3260: result: no" >&5 + echo "$as_me:3387: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3281,7 +3408,7 @@ for ac_prog in tdlint lint alint do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:3284: checking for $ac_word" >&5 +echo "$as_me:3411: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_LINT+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3296,7 +3423,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_LINT="$ac_prog" -echo "$as_me:3299: found $ac_dir/$ac_word" >&5 +echo "$as_me:3426: found $ac_dir/$ac_word" >&5 break done @@ -3304,10 +3431,10 @@ fi fi LINT=$ac_cv_prog_LINT if test -n "$LINT"; then - echo "$as_me:3307: result: $LINT" >&5 + echo "$as_me:3434: result: $LINT" >&5 echo "${ECHO_T}$LINT" >&6 else - echo "$as_me:3310: result: no" >&5 + echo "$as_me:3437: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3318,7 +3445,7 @@ for ac_prog in man man_db do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:3321: checking for $ac_word" >&5 +echo "$as_me:3448: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_MAN+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3333,7 +3460,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_MAN="$ac_prog" -echo "$as_me:3336: found $ac_dir/$ac_word" >&5 +echo "$as_me:3463: found $ac_dir/$ac_word" >&5 break done @@ -3341,10 +3468,10 @@ fi fi MAN=$ac_cv_prog_MAN if test -n "$MAN"; then - echo "$as_me:3344: result: $MAN" >&5 + echo "$as_me:3471: result: $MAN" >&5 echo "${ECHO_T}$MAN" >&6 else - echo "$as_me:3347: result: no" >&5 + echo "$as_me:3474: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3354,7 +3481,7 @@ done if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. set dummy ${ac_tool_prefix}ranlib; ac_word=$2 -echo "$as_me:3357: checking for $ac_word" >&5 +echo "$as_me:3484: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3369,7 +3496,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" -echo "$as_me:3372: found $ac_dir/$ac_word" >&5 +echo "$as_me:3499: found $ac_dir/$ac_word" >&5 break done @@ -3377,10 +3504,10 @@ fi fi RANLIB=$ac_cv_prog_RANLIB if test -n "$RANLIB"; then - echo "$as_me:3380: result: $RANLIB" >&5 + echo "$as_me:3507: result: $RANLIB" >&5 echo "${ECHO_T}$RANLIB" >&6 else - echo "$as_me:3383: result: no" >&5 + echo "$as_me:3510: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3389,7 +3516,7 @@ if test -z "$ac_cv_prog_RANLIB"; then ac_ct_RANLIB=$RANLIB # Extract the first word of "ranlib", so it can be a program name with args. set dummy ranlib; ac_word=$2 -echo "$as_me:3392: checking for $ac_word" >&5 +echo "$as_me:3519: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3404,7 +3531,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_RANLIB="ranlib" -echo "$as_me:3407: found $ac_dir/$ac_word" >&5 +echo "$as_me:3534: found $ac_dir/$ac_word" >&5 break done @@ -3413,10 +3540,10 @@ fi fi ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB if test -n "$ac_ct_RANLIB"; then - echo "$as_me:3416: result: $ac_ct_RANLIB" >&5 + echo "$as_me:3543: result: $ac_ct_RANLIB" >&5 echo "${ECHO_T}$ac_ct_RANLIB" >&6 else - echo "$as_me:3419: result: no" >&5 + echo "$as_me:3546: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3428,7 +3555,7 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ld", so it can be a program name with args. set dummy ${ac_tool_prefix}ld; ac_word=$2 -echo "$as_me:3431: checking for $ac_word" >&5 +echo "$as_me:3558: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3443,7 +3570,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_LD="${ac_tool_prefix}ld" -echo "$as_me:3446: found $ac_dir/$ac_word" >&5 +echo "$as_me:3573: found $ac_dir/$ac_word" >&5 break done @@ -3451,10 +3578,10 @@ fi fi LD=$ac_cv_prog_LD if test -n "$LD"; then - echo "$as_me:3454: result: $LD" >&5 + echo "$as_me:3581: result: $LD" >&5 echo "${ECHO_T}$LD" >&6 else - echo "$as_me:3457: result: no" >&5 + echo "$as_me:3584: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3463,7 +3590,7 @@ if test -z "$ac_cv_prog_LD"; then ac_ct_LD=$LD # Extract the first word of "ld", so it can be a program name with args. set dummy ld; ac_word=$2 -echo "$as_me:3466: checking for $ac_word" >&5 +echo "$as_me:3593: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_LD+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3478,7 +3605,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_LD="ld" -echo "$as_me:3481: found $ac_dir/$ac_word" >&5 +echo "$as_me:3608: found $ac_dir/$ac_word" >&5 break done @@ -3487,10 +3614,10 @@ fi fi ac_ct_LD=$ac_cv_prog_ac_ct_LD if test -n "$ac_ct_LD"; then - echo "$as_me:3490: result: $ac_ct_LD" >&5 + echo "$as_me:3617: result: $ac_ct_LD" >&5 echo "${ECHO_T}$ac_ct_LD" >&6 else - echo "$as_me:3493: result: no" >&5 + echo "$as_me:3620: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3502,7 +3629,7 @@ fi if test -n "$ac_tool_prefix"; then # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args. set dummy ${ac_tool_prefix}ar; ac_word=$2 -echo "$as_me:3505: checking for $ac_word" >&5 +echo "$as_me:3632: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3517,7 +3644,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_AR="${ac_tool_prefix}ar" -echo "$as_me:3520: found $ac_dir/$ac_word" >&5 +echo "$as_me:3647: found $ac_dir/$ac_word" >&5 break done @@ -3525,10 +3652,10 @@ fi fi AR=$ac_cv_prog_AR if test -n "$AR"; then - echo "$as_me:3528: result: $AR" >&5 + echo "$as_me:3655: result: $AR" >&5 echo "${ECHO_T}$AR" >&6 else - echo "$as_me:3531: result: no" >&5 + echo "$as_me:3658: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3537,7 +3664,7 @@ if test -z "$ac_cv_prog_AR"; then ac_ct_AR=$AR # Extract the first word of "ar", so it can be a program name with args. set dummy ar; ac_word=$2 -echo "$as_me:3540: checking for $ac_word" >&5 +echo "$as_me:3667: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_ac_ct_AR+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3552,7 +3679,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_ac_ct_AR="ar" -echo "$as_me:3555: found $ac_dir/$ac_word" >&5 +echo "$as_me:3682: found $ac_dir/$ac_word" >&5 break done @@ -3561,10 +3688,10 @@ fi fi ac_ct_AR=$ac_cv_prog_ac_ct_AR if test -n "$ac_ct_AR"; then - echo "$as_me:3564: result: $ac_ct_AR" >&5 + echo "$as_me:3691: result: $ac_ct_AR" >&5 echo "${ECHO_T}$ac_ct_AR" >&6 else - echo "$as_me:3567: result: no" >&5 + echo "$as_me:3694: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3577,10 +3704,10 @@ if test "${cf_cv_subst_AR_OPTS+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else -echo "$as_me:3580: checking for archiver options (symbol AR_OPTS)" >&5 +echo "$as_me:3707: checking for archiver options (symbol AR_OPTS)" >&5 echo $ECHO_N "checking for archiver options (symbol AR_OPTS)... $ECHO_C" >&6 test -z "$AR_OPTS" && AR_OPTS=rv -echo "$as_me:3583: result: $AR_OPTS" >&5 +echo "$as_me:3710: result: $AR_OPTS" >&5 echo "${ECHO_T}$AR_OPTS" >&6 cf_cv_subst_AR_OPTS=$AR_OPTS @@ -3588,7 +3715,7 @@ fi AR_OPTS=${cf_cv_subst_AR_OPTS} -echo "$as_me:3591: checking for makeflags variable" >&5 +echo "$as_me:3718: checking for makeflags variable" >&5 echo $ECHO_N "checking for makeflags variable... $ECHO_C" >&6 if test "${cf_cv_makeflags+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3621,10 +3748,10 @@ CF_EOF rm -f cf_makeflags.tmp fi -echo "$as_me:3624: result: $cf_cv_makeflags" >&5 +echo "$as_me:3751: result: $cf_cv_makeflags" >&5 echo "${ECHO_T}$cf_cv_makeflags" >&6 -echo "$as_me:3627: checking if you have specified an install-prefix" >&5 +echo "$as_me:3754: checking if you have specified an install-prefix" >&5 echo $ECHO_N "checking if you have specified an install-prefix... $ECHO_C" >&6 # Check whether --with-install-prefix or --without-install-prefix was given. @@ -3637,7 +3764,7 @@ if test "${with_install_prefix+set}" = set; then ;; esac fi; -echo "$as_me:3640: result: $DESTDIR" >&5 +echo "$as_me:3767: result: $DESTDIR" >&5 echo "${ECHO_T}$DESTDIR" >&6 ############################################################################### @@ -3645,24 +3772,27 @@ echo "${ECHO_T}$DESTDIR" >&6 # If we're cross-compiling, allow the user to override the tools and their # options. The configure script is oriented toward identifying the host # compiler, etc., but we need a build compiler to generate parts of the source. -: ${BUILD_CC:='$(CC)'} -: ${BUILD_CFLAGS:='$(CFLAGS)'} -: ${BUILD_CPPFLAGS:='$(CPPFLAGS)'} -: ${BUILD_LDFLAGS:='$(LDFLAGS)'} -: ${BUILD_LIBS:='$(LIBS)'} -: ${BUILD_EXEEXT:='$x'} + if test "$cross_compiling" = yes ; then + # defaults that we might want to override + : ${BUILD_CFLAGS:=''} + : ${BUILD_CPPFLAGS:=''} + : ${BUILD_LDFLAGS:=''} + : ${BUILD_LIBS:=''} + : ${BUILD_EXEEXT:='$x'} + : ${BUILD_OBJEXT:='o'} + # Check whether --with-build-cc or --without-build-cc was given. if test "${with_build_cc+set}" = set; then withval="$with_build_cc" BUILD_CC="$withval" else - for ac_prog in $CC gcc cc + for ac_prog in gcc cc cl do # Extract the first word of "$ac_prog", so it can be a program name with args. set dummy $ac_prog; ac_word=$2 -echo "$as_me:3665: checking for $ac_word" >&5 +echo "$as_me:3795: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_BUILD_CC+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3677,7 +3807,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_BUILD_CC="$ac_prog" -echo "$as_me:3680: found $ac_dir/$ac_word" >&5 +echo "$as_me:3810: found $ac_dir/$ac_word" >&5 break done @@ -3685,10 +3815,10 @@ fi fi BUILD_CC=$ac_cv_prog_BUILD_CC if test -n "$BUILD_CC"; then - echo "$as_me:3688: result: $BUILD_CC" >&5 + echo "$as_me:3818: result: $BUILD_CC" >&5 echo "${ECHO_T}$BUILD_CC" >&6 else - echo "$as_me:3691: result: no" >&5 + echo "$as_me:3821: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -3696,31 +3826,91 @@ fi done fi; + echo "$as_me:3829: checking for native build C compiler" >&5 +echo $ECHO_N "checking for native build C compiler... $ECHO_C" >&6 + echo "$as_me:3831: result: $BUILD_CC" >&5 +echo "${ECHO_T}$BUILD_CC" >&6 + + echo "$as_me:3834: checking for native build C preprocessor" >&5 +echo $ECHO_N "checking for native build C preprocessor... $ECHO_C" >&6 + +# Check whether --with-build-cpp or --without-build-cpp was given. +if test "${with_build_cpp+set}" = set; then + withval="$with_build_cpp" + BUILD_CPP="$withval" +else + BUILD_CPP='$(BUILD_CC) -E' +fi; + echo "$as_me:3844: result: $BUILD_CPP" >&5 +echo "${ECHO_T}$BUILD_CPP" >&6 + + echo "$as_me:3847: checking for native build C flags" >&5 +echo $ECHO_N "checking for native build C flags... $ECHO_C" >&6 # Check whether --with-build-cflags or --without-build-cflags was given. if test "${with_build_cflags+set}" = set; then withval="$with_build_cflags" BUILD_CFLAGS="$withval" fi; + echo "$as_me:3855: result: $BUILD_CFLAGS" >&5 +echo "${ECHO_T}$BUILD_CFLAGS" >&6 + + echo "$as_me:3858: checking for native build C preprocessor-flags" >&5 +echo $ECHO_N "checking for native build C preprocessor-flags... $ECHO_C" >&6 # Check whether --with-build-cppflags or --without-build-cppflags was given. if test "${with_build_cppflags+set}" = set; then withval="$with_build_cppflags" BUILD_CPPFLAGS="$withval" fi; + echo "$as_me:3866: result: $BUILD_CPPFLAGS" >&5 +echo "${ECHO_T}$BUILD_CPPFLAGS" >&6 + + echo "$as_me:3869: checking for native build linker-flags" >&5 +echo $ECHO_N "checking for native build linker-flags... $ECHO_C" >&6 # Check whether --with-build-ldflags or --without-build-ldflags was given. if test "${with_build_ldflags+set}" = set; then withval="$with_build_ldflags" BUILD_LDFLAGS="$withval" fi; + echo "$as_me:3877: result: $BUILD_LDFLAGS" >&5 +echo "${ECHO_T}$BUILD_LDFLAGS" >&6 + + echo "$as_me:3880: checking for native build linker-libraries" >&5 +echo $ECHO_N "checking for native build linker-libraries... $ECHO_C" >&6 # Check whether --with-build-libs or --without-build-libs was given. if test "${with_build_libs+set}" = set; then withval="$with_build_libs" BUILD_LIBS="$withval" fi; + echo "$as_me:3888: result: $BUILD_LIBS" >&5 +echo "${ECHO_T}$BUILD_LIBS" >&6 + + # this assumes we're on Unix. BUILD_EXEEXT= + BUILD_OBJEXT=o + + : ${BUILD_CC:='$(CC)'} + + if ( test "$BUILD_CC" = "$CC" || test "$BUILD_CC" = '$(CC)' ) ; then + { { echo "$as_me:3898: error: Cross-build requires two compilers. +Use --with-build-cc to specify the native compiler." >&5 +echo "$as_me: error: Cross-build requires two compilers. +Use --with-build-cc to specify the native compiler." >&2;} + { (exit 1); exit 1; }; } + fi + +else + : ${BUILD_CC:='$(CC)'} + : ${BUILD_CPP:='$(CPP)'} + : ${BUILD_CFLAGS:='$(CFLAGS)'} + : ${BUILD_CPPFLAGS:='$(CPPFLAGS)'} + : ${BUILD_LDFLAGS:='$(LDFLAGS)'} + : ${BUILD_LIBS:='$(LIBS)'} + : ${BUILD_EXEEXT:='$x'} + : ${BUILD_OBJEXT:='o'} fi ############################################################################### @@ -3746,7 +3936,7 @@ LIB_LINK= LIB_INSTALL= LIB_UNINSTALL= -echo "$as_me:3749: checking if you want to build libraries with libtool" >&5 +echo "$as_me:3939: checking if you want to build libraries with libtool" >&5 echo $ECHO_N "checking if you want to build libraries with libtool... $ECHO_C" >&6 # Check whether --with-libtool or --without-libtool was given. @@ -3756,7 +3946,7 @@ if test "${with_libtool+set}" = set; then else with_libtool=no fi; -echo "$as_me:3759: result: $with_libtool" >&5 +echo "$as_me:3949: result: $with_libtool" >&5 echo "${ECHO_T}$with_libtool" >&6 if test "$with_libtool" != "no"; then @@ -3781,7 +3971,7 @@ case ".$with_libtool" in #(vi with_libtool=`echo $with_libtool | sed -e s%NONE%$ac_default_prefix%` ;; *) - { { echo "$as_me:3784: error: expected a pathname, not \"$with_libtool\"" >&5 + { { echo "$as_me:3974: error: expected a pathname, not \"$with_libtool\"" >&5 echo "$as_me: error: expected a pathname, not \"$with_libtool\"" >&2;} { (exit 1); exit 1; }; } ;; @@ -3791,7 +3981,7 @@ esac else # Extract the first word of "libtool", so it can be a program name with args. set dummy libtool; ac_word=$2 -echo "$as_me:3794: checking for $ac_word" >&5 +echo "$as_me:3984: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_path_LIBTOOL+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -3808,7 +3998,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. if $as_executable_p "$ac_dir/$ac_word"; then ac_cv_path_LIBTOOL="$ac_dir/$ac_word" - echo "$as_me:3811: found $ac_dir/$ac_word" >&5 + echo "$as_me:4001: found $ac_dir/$ac_word" >&5 break fi done @@ -3819,16 +4009,16 @@ fi LIBTOOL=$ac_cv_path_LIBTOOL if test -n "$LIBTOOL"; then - echo "$as_me:3822: result: $LIBTOOL" >&5 + echo "$as_me:4012: result: $LIBTOOL" >&5 echo "${ECHO_T}$LIBTOOL" >&6 else - echo "$as_me:3825: result: no" >&5 + echo "$as_me:4015: result: no" >&5 echo "${ECHO_T}no" >&6 fi fi if test -z "$LIBTOOL" ; then - { { echo "$as_me:3831: error: Cannot find libtool" >&5 + { { echo "$as_me:4021: error: Cannot find libtool" >&5 echo "$as_me: error: Cannot find libtool" >&2;} { (exit 1); exit 1; }; } fi @@ -3843,17 +4033,17 @@ echo "$as_me: error: Cannot find libtool" >&2;} LIB_PREP=: # Show the version of libtool - echo "$as_me:3846: checking version of libtool" >&5 + echo "$as_me:4036: checking version of libtool" >&5 echo $ECHO_N "checking version of libtool... $ECHO_C" >&6 # Save the version in a cache variable - this is not entirely a good # thing, but the version string from libtool is very ugly, and for # bug reports it might be useful to have the original string. cf_cv_libtool_version=`$LIBTOOL --version 2>&1 | sed -e '2,$d' -e 's/([^)]*)//g' -e 's/^[^1-9]*//' -e 's/[^0-9.].*//'` - echo "$as_me:3853: result: $cf_cv_libtool_version" >&5 + echo "$as_me:4043: result: $cf_cv_libtool_version" >&5 echo "${ECHO_T}$cf_cv_libtool_version" >&6 if test -z "$cf_cv_libtool_version" ; then - { { echo "$as_me:3856: error: This is not libtool" >&5 + { { echo "$as_me:4046: error: This is not libtool" >&5 echo "$as_me: error: This is not libtool" >&2;} { (exit 1); exit 1; }; } fi @@ -3880,7 +4070,7 @@ cf_list_models="$cf_list_models libtool" else -echo "$as_me:3883: checking if you want to build shared libraries" >&5 +echo "$as_me:4073: checking if you want to build shared libraries" >&5 echo $ECHO_N "checking if you want to build shared libraries... $ECHO_C" >&6 # Check whether --with-shared or --without-shared was given. @@ -3890,11 +4080,11 @@ if test "${with_shared+set}" = set; then else with_shared=no fi; -echo "$as_me:3893: result: $with_shared" >&5 +echo "$as_me:4083: result: $with_shared" >&5 echo "${ECHO_T}$with_shared" >&6 test "$with_shared" = "yes" && cf_list_models="$cf_list_models shared" -echo "$as_me:3897: checking if you want to build static libraries" >&5 +echo "$as_me:4087: checking if you want to build static libraries" >&5 echo $ECHO_N "checking if you want to build static libraries... $ECHO_C" >&6 # Check whether --with-normal or --without-normal was given. @@ -3904,11 +4094,11 @@ if test "${with_normal+set}" = set; then else with_normal=yes fi; -echo "$as_me:3907: result: $with_normal" >&5 +echo "$as_me:4097: result: $with_normal" >&5 echo "${ECHO_T}$with_normal" >&6 test "$with_normal" = "yes" && cf_list_models="$cf_list_models normal" -echo "$as_me:3911: checking if you want to build debug libraries" >&5 +echo "$as_me:4101: checking if you want to build debug libraries" >&5 echo $ECHO_N "checking if you want to build debug libraries... $ECHO_C" >&6 # Check whether --with-debug or --without-debug was given. @@ -3918,11 +4108,11 @@ if test "${with_debug+set}" = set; then else with_debug=yes fi; -echo "$as_me:3921: result: $with_debug" >&5 +echo "$as_me:4111: result: $with_debug" >&5 echo "${ECHO_T}$with_debug" >&6 test "$with_debug" = "yes" && cf_list_models="$cf_list_models debug" -echo "$as_me:3925: checking if you want to build profiling libraries" >&5 +echo "$as_me:4115: checking if you want to build profiling libraries" >&5 echo $ECHO_N "checking if you want to build profiling libraries... $ECHO_C" >&6 # Check whether --with-profile or --without-profile was given. @@ -3932,7 +4122,7 @@ if test "${with_profile+set}" = set; then else with_profile=no fi; -echo "$as_me:3935: result: $with_profile" >&5 +echo "$as_me:4125: result: $with_profile" >&5 echo "${ECHO_T}$with_profile" >&6 test "$with_profile" = "yes" && cf_list_models="$cf_list_models profile" @@ -3940,19 +4130,19 @@ fi ############################################################################### -echo "$as_me:3943: checking for specified models" >&5 +echo "$as_me:4133: checking for specified models" >&5 echo $ECHO_N "checking for specified models... $ECHO_C" >&6 test -z "$cf_list_models" && cf_list_models=normal test "$with_libtool" != "no" && cf_list_models=libtool -echo "$as_me:3947: result: $cf_list_models" >&5 +echo "$as_me:4137: result: $cf_list_models" >&5 echo "${ECHO_T}$cf_list_models" >&6 ### Use the first model as the default, and save its suffix for use in building ### up test-applications. -echo "$as_me:3952: checking for default model" >&5 +echo "$as_me:4142: checking for default model" >&5 echo $ECHO_N "checking for default model... $ECHO_C" >&6 DFT_LWR_MODEL=`echo "$cf_list_models" | $AWK '{print $1}'` -echo "$as_me:3955: result: $DFT_LWR_MODEL" >&5 +echo "$as_me:4145: result: $DFT_LWR_MODEL" >&5 echo "${ECHO_T}$DFT_LWR_MODEL" >&6 DFT_UPR_MODEL=`echo "$DFT_LWR_MODEL" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` @@ -3962,6 +4152,7 @@ TINFO_NAME=tinfo LIB_NAME=ncurses LIB_DIR=../lib +LIB_2ND=../../lib case $cf_cv_system_name in OS/2*) LIB_PREFIX='' ;; @@ -3976,7 +4167,7 @@ LIB_SUFFIX= ############################################################################### -echo "$as_me:3979: checking if you want to build a separate terminfo library" >&5 +echo "$as_me:4170: checking if you want to build a separate terminfo library" >&5 echo $ECHO_N "checking if you want to build a separate terminfo library... $ECHO_C" >&6 # Check whether --with-termlib or --without-termlib was given. @@ -3986,12 +4177,12 @@ if test "${with_termlib+set}" = set; then else with_termlib=no fi; -echo "$as_me:3989: result: $with_termlib" >&5 +echo "$as_me:4180: result: $with_termlib" >&5 echo "${ECHO_T}$with_termlib" >&6 ### Checks for special libraries, must be done up-front. -echo "$as_me:3994: checking if you want to link with dbmalloc for testing" >&5 +echo "$as_me:4185: checking if you want to link with dbmalloc for testing" >&5 echo $ECHO_N "checking if you want to link with dbmalloc for testing... $ECHO_C" >&6 # Check whether --with-dbmalloc or --without-dbmalloc was given. @@ -4001,11 +4192,49 @@ if test "${with_dbmalloc+set}" = set; then else with_dbmalloc=no fi; -echo "$as_me:4004: result: $with_dbmalloc" >&5 +echo "$as_me:4195: result: $with_dbmalloc" >&5 echo "${ECHO_T}$with_dbmalloc" >&6 -if test $with_dbmalloc = yes ; then +if test "$with_dbmalloc" = yes ; then + echo "$as_me:4198: checking for dbmalloc.h" >&5 +echo $ECHO_N "checking for dbmalloc.h... $ECHO_C" >&6 +if test "${ac_cv_header_dbmalloc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4204 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:4208: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4214: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_dbmalloc_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_dbmalloc_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:4233: result: $ac_cv_header_dbmalloc_h" >&5 +echo "${ECHO_T}$ac_cv_header_dbmalloc_h" >&6 +if test $ac_cv_header_dbmalloc_h = yes; then -echo "$as_me:4008: checking for debug_malloc in -ldbmalloc" >&5 +echo "$as_me:4237: checking for debug_malloc in -ldbmalloc" >&5 echo $ECHO_N "checking for debug_malloc in -ldbmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dbmalloc_debug_malloc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4013,7 +4242,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldbmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4016 "configure" +#line 4245 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4032,16 +4261,16 @@ debug_malloc (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4035: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4264: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4038: \$? = $ac_status" >&5 + echo "$as_me:4267: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4041: \"$ac_try\"") >&5 + { (eval echo "$as_me:4270: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4044: \$? = $ac_status" >&5 + echo "$as_me:4273: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dbmalloc_debug_malloc=yes else @@ -4052,7 +4281,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4055: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 +echo "$as_me:4284: result: $ac_cv_lib_dbmalloc_debug_malloc" >&5 echo "${ECHO_T}$ac_cv_lib_dbmalloc_debug_malloc" >&6 if test $ac_cv_lib_dbmalloc_debug_malloc = yes; then cat >>confdefs.h <&5 +fi + +echo "$as_me:4299: checking if you want to link with dmalloc for testing" >&5 echo $ECHO_N "checking if you want to link with dmalloc for testing... $ECHO_C" >&6 # Check whether --with-dmalloc or --without-dmalloc was given. @@ -4075,11 +4306,49 @@ if test "${with_dmalloc+set}" = set; then else with_dmalloc=no fi; -echo "$as_me:4078: result: $with_dmalloc" >&5 +echo "$as_me:4309: result: $with_dmalloc" >&5 echo "${ECHO_T}$with_dmalloc" >&6 -if test $with_dmalloc = yes ; then +if test "$with_dmalloc" = yes ; then + echo "$as_me:4312: checking for dmalloc.h" >&5 +echo $ECHO_N "checking for dmalloc.h... $ECHO_C" >&6 +if test "${ac_cv_header_dmalloc_h+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 4318 "configure" +#include "confdefs.h" +#include +_ACEOF +if { (eval echo "$as_me:4322: \"$ac_cpp conftest.$ac_ext\"") >&5 + (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 + ac_status=$? + egrep -v '^ *\+' conftest.er1 >conftest.err + rm -f conftest.er1 + cat conftest.err >&5 + echo "$as_me:4328: \$? = $ac_status" >&5 + (exit $ac_status); } >/dev/null; then + if test -s conftest.err; then + ac_cpp_err=$ac_c_preproc_warn_flag + else + ac_cpp_err= + fi +else + ac_cpp_err=yes +fi +if test -z "$ac_cpp_err"; then + ac_cv_header_dmalloc_h=yes +else + echo "$as_me: failed program was:" >&5 + cat conftest.$ac_ext >&5 + ac_cv_header_dmalloc_h=no +fi +rm -f conftest.err conftest.$ac_ext +fi +echo "$as_me:4347: result: $ac_cv_header_dmalloc_h" >&5 +echo "${ECHO_T}$ac_cv_header_dmalloc_h" >&6 +if test $ac_cv_header_dmalloc_h = yes; then -echo "$as_me:4082: checking for dmalloc_debug in -ldmalloc" >&5 +echo "$as_me:4351: checking for dmalloc_debug in -ldmalloc" >&5 echo $ECHO_N "checking for dmalloc_debug in -ldmalloc... $ECHO_C" >&6 if test "${ac_cv_lib_dmalloc_dmalloc_debug+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4087,7 +4356,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldmalloc $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4090 "configure" +#line 4359 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4106,16 +4375,16 @@ dmalloc_debug (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4109: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4378: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4112: \$? = $ac_status" >&5 + echo "$as_me:4381: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4115: \"$ac_try\"") >&5 + { (eval echo "$as_me:4384: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4118: \$? = $ac_status" >&5 + echo "$as_me:4387: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dmalloc_dmalloc_debug=yes else @@ -4126,7 +4395,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4129: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 +echo "$as_me:4398: result: $ac_cv_lib_dmalloc_dmalloc_debug" >&5 echo "${ECHO_T}$ac_cv_lib_dmalloc_dmalloc_debug" >&6 if test $ac_cv_lib_dmalloc_dmalloc_debug = yes; then cat >>confdefs.h <&5 -echo $ECHO_N "checking if you want to link with the gpm mouse library... $ECHO_C" >&6 + +echo "$as_me:4415: checking if you want to link with the GPM mouse library" >&5 +echo $ECHO_N "checking if you want to link with the GPM mouse library... $ECHO_C" >&6 # Check whether --with-gpm or --without-gpm was given. if test "${with_gpm+set}" = set; then withval="$with_gpm" with_gpm=$withval else - with_gpm=no + with_gpm=maybe fi; -echo "$as_me:4153: result: $with_gpm" >&5 +echo "$as_me:4425: result: $with_gpm" >&5 echo "${ECHO_T}$with_gpm" >&6 -if test "$with_gpm" = yes ; then - echo "$as_me:4156: checking for Gpm_Open in -lgpm" >&5 +if test "$with_gpm" != no ; then + echo "$as_me:4428: checking for Gpm_Open in -lgpm" >&5 echo $ECHO_N "checking for Gpm_Open in -lgpm... $ECHO_C" >&6 if test "${ac_cv_lib_gpm_Gpm_Open+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -4161,7 +4433,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lgpm $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 4164 "configure" +#line 4436 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -4180,16 +4452,16 @@ Gpm_Open (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4183: \"$ac_link\"") >&5 +if { (eval echo "$as_me:4455: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4186: \$? = $ac_status" >&5 + echo "$as_me:4458: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4189: \"$ac_try\"") >&5 + { (eval echo "$as_me:4461: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4192: \$? = $ac_status" >&5 + echo "$as_me:4464: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_gpm_Gpm_Open=yes else @@ -4200,36 +4472,27 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:4203: result: $ac_cv_lib_gpm_Gpm_Open" >&5 +echo "$as_me:4475: result: $ac_cv_lib_gpm_Gpm_Open" >&5 echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Open" >&6 if test $ac_cv_lib_gpm_Gpm_Open = yes; then - EXTRA_LIBS="-lgpm -lncurses $EXTRA_LIBS" - SHLIB_LIST="-lgpm $SHLIB_LIST" - cat >>confdefs.h <<\EOF -#define HAVE_LIBGPM 1 -EOF - -for ac_header in gpm.h -do -as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:4216: checking for $ac_header" >&5 -echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 -if eval "test \"\${$as_ac_Header+set}\" = set"; then + echo "$as_me:4479: checking for gpm.h" >&5 +echo $ECHO_N "checking for gpm.h... $ECHO_C" >&6 +if test "${ac_cv_header_gpm_h+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 4222 "configure" +#line 4485 "configure" #include "confdefs.h" -#include <$ac_header> +#include _ACEOF -if { (eval echo "$as_me:4226: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:4489: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:4232: \$? = $ac_status" >&5 + echo "$as_me:4495: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -4240,107 +4503,410 @@ else ac_cpp_err=yes fi if test -z "$ac_cpp_err"; then - eval "$as_ac_Header=yes" + ac_cv_header_gpm_h=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 - eval "$as_ac_Header=no" + ac_cv_header_gpm_h=no fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:4251: result: `eval echo '${'$as_ac_Header'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 -if test `eval echo '${'$as_ac_Header'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}$ac_cv_header_gpm_h" >&6 +if test $ac_cv_header_gpm_h = yes; then + + cat >>confdefs.h <<\EOF +#define HAVE_GPM_H 1 EOF + with_gpm=yes + +else + + if test "$with_gpm" = yes ; then + { { echo "$as_me:4527: error: Cannot find GPM header" >&5 +echo "$as_me: error: Cannot find GPM header" >&2;} + { (exit 1); exit 1; }; } + fi + fi -done else - { echo "$as_me:4262: WARNING: Cannot link with gpm library - read the FAQ" >&5 -echo "$as_me: WARNING: Cannot link with gpm library - read the FAQ" >&2;} + + if test "$with_gpm" = yes ; then + { { echo "$as_me:4537: error: Cannot link with GPM library" >&5 +echo "$as_me: error: Cannot link with GPM library" >&2;} + { (exit 1); exit 1; }; } + fi + with_gpm=no + fi fi -# not everyone has "test -c" -if test -c /dev/sysmouse 2>/dev/null ; then -echo "$as_me:4270: checking if you want to use sysmouse" >&5 -echo $ECHO_N "checking if you want to use sysmouse... $ECHO_C" >&6 +if test "$with_gpm" = yes ; then -# Check whether --with-sysmouse or --without-sysmouse was given. -if test "${with_sysmouse+set}" = set; then - withval="$with_sysmouse" - cf_with_sysmouse=$withval +cf_have_dlsym=no +echo "$as_me:4550: checking for dlsym" >&5 +echo $ECHO_N "checking for dlsym... $ECHO_C" >&6 +if test "${ac_cv_func_dlsym+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cf_with_sysmouse=maybe -fi; - if test "$cf_with_sysmouse" != no ; then - cat >conftest.$ac_ext <<_ACEOF -#line 4282 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 4556 "configure" #include "confdefs.h" - -#include -#if (__FreeBSD_version >= 400017) -#include -#include -#else -#include +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char dlsym (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" #endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlsym (); +char (*f) (); int main () { - - struct mouse_info the_mouse; - ioctl(0, CONS_MOUSECTL, &the_mouse); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_dlsym) || defined (__stub___dlsym) +choke me +#else +f = dlsym; +#endif ; return 0; } _ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:4305: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4587: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4308: \$? = $ac_status" >&5 + echo "$as_me:4590: \$? = $ac_status" >&5 (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4311: \"$ac_try\"") >&5 + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4593: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4314: \$? = $ac_status" >&5 + echo "$as_me:4596: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_with_sysmouse=yes + ac_cv_func_dlsym=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_with_sysmouse=no +ac_cv_func_dlsym=no fi -rm -f conftest.$ac_objext conftest.$ac_ext - fi -echo "$as_me:4324: result: $cf_with_sysmouse" >&5 -echo "${ECHO_T}$cf_with_sysmouse" >&6 -test "$cf_with_sysmouse" = yes && cat >>confdefs.h <<\EOF -#define USE_SYSMOUSE 1 -EOF +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:4606: result: $ac_cv_func_dlsym" >&5 +echo "${ECHO_T}$ac_cv_func_dlsym" >&6 +if test $ac_cv_func_dlsym = yes; then + cf_have_dlsym=yes +else +cf_have_libdl=no +echo "$as_me:4613: checking for dlsym in -ldl" >&5 +echo $ECHO_N "checking for dlsym in -ldl... $ECHO_C" >&6 +if test "${ac_cv_lib_dl_dlsym+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 4621 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char dlsym (); +int +main () +{ +dlsym (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4640: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4643: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4646: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4649: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_dl_dlsym=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_dl_dlsym=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS fi +echo "$as_me:4660: result: $ac_cv_lib_dl_dlsym" >&5 +echo "${ECHO_T}$ac_cv_lib_dl_dlsym" >&6 +if test $ac_cv_lib_dl_dlsym = yes; then -if test X"$CC_G_OPT" = X"" ; then - CC_G_OPT='-g' - test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT='' + cf_have_dlsym=yes + cf_have_libdl=yes fi -if test X"$CXX_G_OPT" = X"" ; then - CXX_G_OPT='-g' - test -n "$GXX" && test "${ac_cv_prog_cxx_g}" != yes && CXX_G_OPT='' fi -echo "$as_me:4342: checking for default loader flags" >&5 -echo $ECHO_N "checking for default loader flags... $ECHO_C" >&6 +if test "$cf_have_dlsym" = yes ; then + test "$cf_have_libdl" = yes && LIBS="-ldl $LIBS" + + echo "$as_me:4673: checking whether able to link to dl*() functions" >&5 +echo $ECHO_N "checking whether able to link to dl*() functions... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 4676 "configure" +#include "confdefs.h" +#include +int +main () +{ + + void *obj; + if ((obj = dlopen("filename", 0)) != 0) { + if (dlsym(obj, "symbolname") == 0) { + dlclose(obj); + } + } + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4694: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4697: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4700: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4703: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + + cat >>confdefs.h <<\EOF +#define HAVE_LIBDL 1 +EOF + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 + + { { echo "$as_me:4714: error: Cannot link test program for libdl" >&5 +echo "$as_me: error: Cannot link test program for libdl" >&2;} + { (exit 1); exit 1; }; } +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + echo "$as_me:4719: result: ok" >&5 +echo "${ECHO_T}ok" >&6 +else + { { echo "$as_me:4722: error: Cannot find dlsym function" >&5 +echo "$as_me: error: Cannot find dlsym function" >&2;} + { (exit 1); exit 1; }; } +fi + +echo "$as_me:4727: checking for soname of gpm library" >&5 +echo $ECHO_N "checking for soname of gpm library... $ECHO_C" >&6 +if test "${cf_cv_gpm_soname+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cf_cv_gpm_soname=unknown +if test "$cross_compiling" != yes ; then +cat >conftest.$ac_ext < +int main() +{ +if (Gpm_Open(0,0)) Gpm_Close(); +return 0; +} +CF_EOF +cf_save_LIBS="$LIBS" + LIBS="-lgpm $LIBS" + if { (eval echo "$as_me:4745: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4748: \$? = $ac_status" >&5 + (exit $ac_status); } ; then + if { (eval echo "$as_me:4750: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4753: \$? = $ac_status" >&5 + (exit $ac_status); } ; then + cf_cv_gpm_soname=`ldd conftest$ac_exeext 2>/dev/null | sed -e 's,^.*/,,' -e 's, .*$,,' | fgrep libgpm.` + test -z "$cf_cv_gpm_soname" && cf_cv_gpm_soname=unknown + fi + fi +rm -f conftest* +LIBS="$cf_save_LIBS" +fi + +fi +echo "$as_me:4764: result: $cf_cv_gpm_soname" >&5 +echo "${ECHO_T}$cf_cv_gpm_soname" >&6 + + test "$cf_cv_gpm_soname" != "unknown" && cat >>confdefs.h <>confdefs.h <<\EOF +#define HAVE_LIBGPM 1 +EOF + + echo "$as_me:4776: checking for Gpm_Wgetch in -lgpm" >&5 +echo $ECHO_N "checking for Gpm_Wgetch in -lgpm... $ECHO_C" >&6 +if test "${ac_cv_lib_gpm_Gpm_Wgetch+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lgpm $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 4784 "configure" +#include "confdefs.h" + +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char Gpm_Wgetch (); +int +main () +{ +Gpm_Wgetch (); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:4803: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:4806: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:4809: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4812: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_lib_gpm_Gpm_Wgetch=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_lib_gpm_Gpm_Wgetch=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +echo "$as_me:4823: result: $ac_cv_lib_gpm_Gpm_Wgetch" >&5 +echo "${ECHO_T}$ac_cv_lib_gpm_Gpm_Wgetch" >&6 +if test $ac_cv_lib_gpm_Gpm_Wgetch = yes; then + + { echo "$as_me:4827: WARNING: GPM library is already linked with curses - read the FAQ" >&5 +echo "$as_me: WARNING: GPM library is already linked with curses - read the FAQ" >&2;} + +fi + +fi + +# not everyone has "test -c" +if test -c /dev/sysmouse 2>/dev/null ; then +echo "$as_me:4836: checking if you want to use sysmouse" >&5 +echo $ECHO_N "checking if you want to use sysmouse... $ECHO_C" >&6 + +# Check whether --with-sysmouse or --without-sysmouse was given. +if test "${with_sysmouse+set}" = set; then + withval="$with_sysmouse" + cf_with_sysmouse=$withval +else + cf_with_sysmouse=maybe +fi; + if test "$cf_with_sysmouse" != no ; then + cat >conftest.$ac_ext <<_ACEOF +#line 4848 "configure" +#include "confdefs.h" + +#include +#if (__FreeBSD_version >= 400017) +#include +#include +#else +#include +#endif + +int +main () +{ + + struct mouse_info the_mouse; + ioctl(0, CONS_MOUSECTL, &the_mouse); + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:4871: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:4874: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:4877: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:4880: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_with_sysmouse=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_with_sysmouse=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi +echo "$as_me:4890: result: $cf_with_sysmouse" >&5 +echo "${ECHO_T}$cf_with_sysmouse" >&6 +test "$cf_with_sysmouse" = yes && cat >>confdefs.h <<\EOF +#define USE_SYSMOUSE 1 +EOF + +fi + +if test X"$CC_G_OPT" = X"" ; then + CC_G_OPT='-g' + test -n "$GCC" && test "${ac_cv_prog_cc_g}" != yes && CC_G_OPT='' +fi + +if test X"$CXX_G_OPT" = X"" ; then + CXX_G_OPT='-g' + test -n "$GXX" && test "${ac_cv_prog_cxx_g}" != yes && CXX_G_OPT='' +fi + +echo "$as_me:4908: checking for default loader flags" >&5 +echo $ECHO_N "checking for default loader flags... $ECHO_C" >&6 case $DFT_LWR_MODEL in libtool) LD_MODEL='' ;; normal) LD_MODEL='' ;; @@ -4348,10 +4914,10 @@ debug) LD_MODEL=$CC_G_OPT ;; profile) LD_MODEL='-pg';; shared) LD_MODEL='' ;; esac -echo "$as_me:4351: result: $LD_MODEL" >&5 +echo "$as_me:4917: result: $LD_MODEL" >&5 echo "${ECHO_T}$LD_MODEL" >&6 -echo "$as_me:4354: checking if rpath option should be used" >&5 +echo "$as_me:4920: checking if rpath option should be used" >&5 echo $ECHO_N "checking if rpath option should be used... $ECHO_C" >&6 # Check whether --enable-rpath or --disable-rpath was given. @@ -4361,7 +4927,7 @@ if test "${enable_rpath+set}" = set; then else cf_cv_ld_rpath=no fi; -echo "$as_me:4364: result: $cf_cv_ld_rpath" >&5 +echo "$as_me:4930: result: $cf_cv_ld_rpath" >&5 echo "${ECHO_T}$cf_cv_ld_rpath" >&6 LOCAL_LDFLAGS= @@ -4371,7 +4937,7 @@ echo "${ECHO_T}$cf_cv_ld_rpath" >&6 cf_cv_do_symlinks=no - echo "$as_me:4374: checking if release/abi version should be used for shared libs" >&5 + echo "$as_me:4940: checking if release/abi version should be used for shared libs" >&5 echo $ECHO_N "checking if release/abi version should be used for shared libs... $ECHO_C" >&6 # Check whether --with-shlib-version or --without-shlib-version was given. @@ -4386,7 +4952,7 @@ if test "${with_shlib_version+set}" = set; then cf_cv_shlib_version=$withval ;; *) - { { echo "$as_me:4389: error: option value must be one of: rel, abi, auto or no" >&5 + { { echo "$as_me:4955: error: option value must be one of: rel, abi, auto or no" >&5 echo "$as_me: error: option value must be one of: rel, abi, auto or no" >&2;} { (exit 1); exit 1; }; } ;; @@ -4395,7 +4961,7 @@ echo "$as_me: error: option value must be one of: rel, abi, auto or no" >&2;} else cf_cv_shlib_version=auto fi; - echo "$as_me:4398: result: $cf_cv_shlib_version" >&5 + echo "$as_me:4964: result: $cf_cv_shlib_version" >&5 echo "${ECHO_T}$cf_cv_shlib_version" >&6 cf_cv_rm_so_locs=no @@ -4404,14 +4970,14 @@ echo "${ECHO_T}$cf_cv_shlib_version" >&6 CC_SHARED_OPTS= if test "$GCC" = yes then - echo "$as_me:4407: checking which $CC option to use" >&5 + echo "$as_me:4973: checking which $CC option to use" >&5 echo $ECHO_N "checking which $CC option to use... $ECHO_C" >&6 cf_save_CFLAGS="$CFLAGS" for CC_SHARED_OPTS in -fPIC -fpic '' do CFLAGS="$cf_save_CFLAGS $CC_SHARED_OPTS" cat >conftest.$ac_ext <<_ACEOF -#line 4414 "configure" +#line 4980 "configure" #include "confdefs.h" #include int @@ -4423,16 +4989,16 @@ int x = 1 } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:4426: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:4992: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:4429: \$? = $ac_status" >&5 + echo "$as_me:4995: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:4432: \"$ac_try\"") >&5 + { (eval echo "$as_me:4998: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4435: \$? = $ac_status" >&5 + echo "$as_me:5001: \$? = $ac_status" >&5 (exit $ac_status); }; }; then break else @@ -4441,7 +5007,7 @@ cat conftest.$ac_ext >&5 fi rm -f conftest.$ac_objext conftest.$ac_ext done - echo "$as_me:4444: result: $CC_SHARED_OPTS" >&5 + echo "$as_me:5010: result: $CC_SHARED_OPTS" >&5 echo "${ECHO_T}$CC_SHARED_OPTS" >&6 CFLAGS="$cf_save_CFLAGS" fi @@ -4480,8 +5046,13 @@ echo "${ECHO_T}$CC_SHARED_OPTS" >&6 ;; irix*) if test "$cf_cv_ld_rpath" = yes ; then - cf_ld_rpath_opt="-Wl,-rpath," - EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS" + if test "$GCC" = yes; then + cf_ld_rpath_opt="-Wl,-rpath," + EXTRA_LDFLAGS="-Wl,-rpath,\$(libdir) $EXTRA_LDFLAGS" + else + cf_ld_rpath_opt="-rpath " + EXTRA_LDFLAGS="-rpath \$(libdir) $EXTRA_LDFLAGS" + fi fi # tested with IRIX 5.2 and 'cc'. if test "$GCC" != yes; then @@ -4625,7 +5196,7 @@ echo "${ECHO_T}$CC_SHARED_OPTS" >&6 test "$cf_cv_do_symlinks" = no && cf_cv_do_symlinks=yes ;; *) - { echo "$as_me:4628: WARNING: ignored --with-shlib-version" >&5 + { echo "$as_me:5199: WARNING: ignored --with-shlib-version" >&5 echo "$as_me: WARNING: ignored --with-shlib-version" >&2;} ;; esac @@ -4633,12 +5204,12 @@ echo "$as_me: WARNING: ignored --with-shlib-version" >&2;} esac if test -n "$cf_ld_rpath_opt" ; then - echo "$as_me:4636: checking if we need a space after rpath option" >&5 + echo "$as_me:5207: checking if we need a space after rpath option" >&5 echo $ECHO_N "checking if we need a space after rpath option... $ECHO_C" >&6 cf_save_LIBS="$LIBS" LIBS="$LIBS ${cf_ld_rpath_opt}$libdir" cat >conftest.$ac_ext <<_ACEOF -#line 4641 "configure" +#line 5212 "configure" #include "confdefs.h" int @@ -4650,16 +5221,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:4653: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5224: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4656: \$? = $ac_status" >&5 + echo "$as_me:5227: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:4659: \"$ac_try\"") >&5 + { (eval echo "$as_me:5230: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4662: \$? = $ac_status" >&5 + echo "$as_me:5233: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_rpath_space=no else @@ -4669,7 +5240,7 @@ cf_rpath_space=yes fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS="$cf_save_LIBS" - echo "$as_me:4672: result: $cf_rpath_space" >&5 + echo "$as_me:5243: result: $cf_rpath_space" >&5 echo "${ECHO_T}$cf_rpath_space" >&6 test "$cf_rpath_space" = yes && cf_ld_rpath_opt="$cf_ld_rpath_opt " MK_SHARED_LIB="$MK_SHARED_LIB $cf_ld_rpath_opt\$(libdir)" @@ -4678,7 +5249,7 @@ echo "${ECHO_T}$cf_rpath_space" >&6 if test "$CC_SHARED_OPTS" = "unknown"; then for model in $cf_list_models; do if test "$model" = "shared"; then - { { echo "$as_me:4681: error: Shared libraries are not supported in this version" >&5 + { { echo "$as_me:5252: error: Shared libraries are not supported in this version" >&5 echo "$as_me: error: Shared libraries are not supported in this version" >&2;} { (exit 1); exit 1; }; } fi @@ -4688,7 +5259,7 @@ fi ############################################################################### ### use option --disable-overwrite to leave out the link to -lcurses -echo "$as_me:4691: checking if you wish to install ncurses overwriting curses" >&5 +echo "$as_me:5262: checking if you wish to install ncurses overwriting curses" >&5 echo $ECHO_N "checking if you wish to install ncurses overwriting curses... $ECHO_C" >&6 # Check whether --enable-overwrite or --disable-overwrite was given. @@ -4698,10 +5269,10 @@ if test "${enable_overwrite+set}" = set; then else if test "$prefix" = "/usr" ; then with_overwrite=yes; else with_overwrite=no; fi fi; -echo "$as_me:4701: result: $with_overwrite" >&5 +echo "$as_me:5272: result: $with_overwrite" >&5 echo "${ECHO_T}$with_overwrite" >&6 -echo "$as_me:4704: checking if external terminfo-database is used" >&5 +echo "$as_me:5275: checking if external terminfo-database is used" >&5 echo $ECHO_N "checking if external terminfo-database is used... $ECHO_C" >&6 # Check whether --enable-database or --disable-database was given. @@ -4711,7 +5282,7 @@ if test "${enable_database+set}" = set; then else use_database=yes fi; -echo "$as_me:4714: result: $use_database" >&5 +echo "$as_me:5285: result: $use_database" >&5 echo "${ECHO_T}$use_database" >&6 case $host_os in #(vi @@ -4733,7 +5304,7 @@ if test "$use_database" != no ; then #define USE_DATABASE 1 EOF - echo "$as_me:4736: checking which terminfo source-file will be installed" >&5 + echo "$as_me:5307: checking which terminfo source-file will be installed" >&5 echo $ECHO_N "checking which terminfo source-file will be installed... $ECHO_C" >&6 # Check whether --enable-database or --disable-database was given. @@ -4741,11 +5312,11 @@ if test "${enable_database+set}" = set; then enableval="$enable_database" TERMINFO_SRC=$withval fi; - echo "$as_me:4744: result: $TERMINFO_SRC" >&5 + echo "$as_me:5315: result: $TERMINFO_SRC" >&5 echo "${ECHO_T}$TERMINFO_SRC" >&6 fi -echo "$as_me:4748: checking for list of fallback descriptions" >&5 +echo "$as_me:5319: checking for list of fallback descriptions" >&5 echo $ECHO_N "checking for list of fallback descriptions... $ECHO_C" >&6 # Check whether --with-fallbacks or --without-fallbacks was given. @@ -4755,17 +5326,35 @@ if test "${with_fallbacks+set}" = set; then else with_fallback= fi; -echo "$as_me:4758: result: $with_fallback" >&5 +echo "$as_me:5329: result: $with_fallback" >&5 echo "${ECHO_T}$with_fallback" >&6 FALLBACK_LIST=`echo "$with_fallback" | sed -e 's/,/ /g'` +echo "$as_me:5333: checking if you want modern xterm or antique" >&5 +echo $ECHO_N "checking if you want modern xterm or antique... $ECHO_C" >&6 + +# Check whether --with-xterm-new or --without-xterm-new was given. +if test "${with_xterm_new+set}" = set; then + withval="$with_xterm_new" + with_xterm_new=$withval +else + with_xterm_new=yes +fi; +case $with_xterm_new in +no) with_xterm_new=xterm-old;; +*) with_xterm_new=xterm-new;; +esac +echo "$as_me:5347: result: $with_xterm_new" >&5 +echo "${ECHO_T}$with_xterm_new" >&6 +WHICH_XTERM=$with_xterm_new + MAKE_TERMINFO= if test "$use_database" = no ; then TERMINFO="${datadir}/terminfo" MAKE_TERMINFO="#" else -echo "$as_me:4768: checking for list of terminfo directories" >&5 +echo "$as_me:5357: checking for list of terminfo directories" >&5 echo $ECHO_N "checking for list of terminfo directories... $ECHO_C" >&6 # Check whether --with-terminfo-dirs or --without-terminfo-dirs was given. @@ -4799,7 +5388,7 @@ case ".$cf_src_path" in #(vi cf_src_path=`echo $cf_src_path | sed -e s%NONE%$ac_default_prefix%` ;; *) - { { echo "$as_me:4802: error: expected a pathname, not \"$cf_src_path\"" >&5 + { { echo "$as_me:5391: error: expected a pathname, not \"$cf_src_path\"" >&5 echo "$as_me: error: expected a pathname, not \"$cf_src_path\"" >&2;} { (exit 1); exit 1; }; } ;; @@ -4812,13 +5401,13 @@ IFS="$ac_save_ifs" eval 'TERMINFO_DIRS="$cf_dst_path"' -echo "$as_me:4815: result: $TERMINFO_DIRS" >&5 +echo "$as_me:5404: result: $TERMINFO_DIRS" >&5 echo "${ECHO_T}$TERMINFO_DIRS" >&6 test -n "$TERMINFO_DIRS" && cat >>confdefs.h <&5 +echo "$as_me:5410: checking for default terminfo directory" >&5 echo $ECHO_N "checking for default terminfo directory... $ECHO_C" >&6 # Check whether --with-default-terminfo-dir or --without-default-terminfo-dir was given. @@ -4847,7 +5436,7 @@ case ".$withval" in #(vi withval=`echo $withval | sed -e s%NONE%$ac_default_prefix%` ;; *) - { { echo "$as_me:4850: error: expected a pathname, not \"$withval\"" >&5 + { { echo "$as_me:5439: error: expected a pathname, not \"$withval\"" >&5 echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} { (exit 1); exit 1; }; } ;; @@ -4855,7 +5444,7 @@ esac eval TERMINFO="$withval" -echo "$as_me:4858: result: $TERMINFO" >&5 +echo "$as_me:5447: result: $TERMINFO" >&5 echo "${ECHO_T}$TERMINFO" >&6 cat >>confdefs.h <&5 +echo "$as_me:5457: checking if big-core option selected" >&5 echo $ECHO_N "checking if big-core option selected... $ECHO_C" >&6 # Check whether --enable-big-core or --disable-big-core was given. @@ -4877,7 +5466,7 @@ else with_big_core=no else cat >conftest.$ac_ext <<_ACEOF -#line 4880 "configure" +#line 5469 "configure" #include "confdefs.h" #include @@ -4891,15 +5480,15 @@ int main() { } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:4894: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5483: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:4897: \$? = $ac_status" >&5 + echo "$as_me:5486: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:4899: \"$ac_try\"") >&5 + { (eval echo "$as_me:5488: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:4902: \$? = $ac_status" >&5 + echo "$as_me:5491: \$? = $ac_status" >&5 (exit $ac_status); }; }; then with_big_core=yes else @@ -4911,14 +5500,14 @@ fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi; -echo "$as_me:4914: result: $with_big_core" >&5 +echo "$as_me:5503: result: $with_big_core" >&5 echo "${ECHO_T}$with_big_core" >&6 test "$with_big_core" = "yes" && cat >>confdefs.h <<\EOF #define HAVE_BIG_CORE 1 EOF ### use option --enable-termcap to compile in the termcap fallback support -echo "$as_me:4921: checking if you want termcap-fallback support" >&5 +echo "$as_me:5510: checking if you want termcap-fallback support" >&5 echo $ECHO_N "checking if you want termcap-fallback support... $ECHO_C" >&6 # Check whether --enable-termcap or --disable-termcap was given. @@ -4928,13 +5517,13 @@ if test "${enable_termcap+set}" = set; then else with_termcap=no fi; -echo "$as_me:4931: result: $with_termcap" >&5 +echo "$as_me:5520: result: $with_termcap" >&5 echo "${ECHO_T}$with_termcap" >&6 if test "$with_termcap" != "yes" ; then if test "$use_database" = no ; then if test -z "$with_fallback" ; then - { { echo "$as_me:4937: error: You have disabled the database w/o specifying fallbacks" >&5 + { { echo "$as_me:5526: error: You have disabled the database w/o specifying fallbacks" >&5 echo "$as_me: error: You have disabled the database w/o specifying fallbacks" >&2;} { (exit 1); exit 1; }; } fi @@ -4949,7 +5538,7 @@ cat >>confdefs.h <<\EOF #define USE_TERMCAP 1 EOF -echo "$as_me:4952: checking for list of termcap files" >&5 +echo "$as_me:5541: checking for list of termcap files" >&5 echo $ECHO_N "checking for list of termcap files... $ECHO_C" >&6 # Check whether --with-termpath or --without-termpath was given. @@ -4983,7 +5572,7 @@ case ".$cf_src_path" in #(vi cf_src_path=`echo $cf_src_path | sed -e s%NONE%$ac_default_prefix%` ;; *) - { { echo "$as_me:4986: error: expected a pathname, not \"$cf_src_path\"" >&5 + { { echo "$as_me:5575: error: expected a pathname, not \"$cf_src_path\"" >&5 echo "$as_me: error: expected a pathname, not \"$cf_src_path\"" >&2;} { (exit 1); exit 1; }; } ;; @@ -4996,14 +5585,14 @@ IFS="$ac_save_ifs" eval 'TERMPATH="$cf_dst_path"' -echo "$as_me:4999: result: $TERMPATH" >&5 +echo "$as_me:5588: result: $TERMPATH" >&5 echo "${ECHO_T}$TERMPATH" >&6 test -n "$TERMPATH" && cat >>confdefs.h <&5 +echo "$as_me:5595: checking if fast termcap-loader is needed" >&5 echo $ECHO_N "checking if fast termcap-loader is needed... $ECHO_C" >&6 # Check whether --enable-getcap or --disable-getcap was given. @@ -5013,13 +5602,13 @@ if test "${enable_getcap+set}" = set; then else with_getcap=no fi; -echo "$as_me:5016: result: $with_getcap" >&5 +echo "$as_me:5605: result: $with_getcap" >&5 echo "${ECHO_T}$with_getcap" >&6 test "$with_getcap" = "yes" && cat >>confdefs.h <<\EOF #define USE_GETCAP 1 EOF -echo "$as_me:5022: checking if translated termcaps will be cached in ~/.terminfo" >&5 +echo "$as_me:5611: checking if translated termcaps will be cached in ~/.terminfo" >&5 echo $ECHO_N "checking if translated termcaps will be cached in ~/.terminfo... $ECHO_C" >&6 # Check whether --enable-getcap-cache or --disable-getcap-cache was given. @@ -5029,7 +5618,7 @@ if test "${enable_getcap_cache+set}" = set; then else with_getcap_cache=no fi; -echo "$as_me:5032: result: $with_getcap_cache" >&5 +echo "$as_me:5621: result: $with_getcap_cache" >&5 echo "${ECHO_T}$with_getcap_cache" >&6 test "$with_getcap_cache" = "yes" && cat >>confdefs.h <<\EOF #define USE_GETCAP_CACHE 1 @@ -5038,7 +5627,7 @@ EOF fi ### Use option --disable-home-terminfo to completely remove ~/.terminfo -echo "$as_me:5041: checking if ~/.terminfo is wanted" >&5 +echo "$as_me:5630: checking if ~/.terminfo is wanted" >&5 echo $ECHO_N "checking if ~/.terminfo is wanted... $ECHO_C" >&6 # Check whether --enable-home-terminfo or --disable-home-terminfo was given. @@ -5048,10 +5637,28 @@ if test "${enable_home_terminfo+set}" = set; then else with_home_terminfo=yes fi; +echo "$as_me:5640: result: $with_home_terminfo" >&5 +echo "${ECHO_T}$with_home_terminfo" >&6 test "$with_home_terminfo" = "yes" && cat >>confdefs.h <<\EOF #define USE_HOME_TERMINFO 1 EOF +echo "$as_me:5646: checking if you want to use restrict environment when running as root" >&5 +echo $ECHO_N "checking if you want to use restrict environment when running as root... $ECHO_C" >&6 + +# Check whether --enable-root-environ or --disable-root-environ was given. +if test "${enable_root_environ+set}" = set; then + enableval="$enable_root_environ" + with_root_environ=$enableval +else + with_root_environ=yes +fi; +echo "$as_me:5656: result: $with_root_environ" >&5 +echo "${ECHO_T}$with_root_environ" >&6 +test "$with_root_environ" = yes && cat >>confdefs.h <<\EOF +#define USE_ROOT_ENVIRON 1 +EOF + ### Use option --enable-symlinks to make tic use symlinks, not hard links ### to reduce storage requirements for the terminfo database. @@ -5060,13 +5667,13 @@ for ac_func in \ unlink do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:5063: checking for $ac_func" >&5 +echo "$as_me:5670: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5069 "configure" +#line 5676 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -5097,16 +5704,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5100: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5707: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5103: \$? = $ac_status" >&5 + echo "$as_me:5710: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5106: \"$ac_try\"") >&5 + { (eval echo "$as_me:5713: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5109: \$? = $ac_status" >&5 + echo "$as_me:5716: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -5116,7 +5723,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5119: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:5726: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:5743: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 5142 "configure" +#line 5749 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -5170,16 +5777,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:5173: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5780: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5176: \$? = $ac_status" >&5 + echo "$as_me:5783: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:5179: \"$ac_try\"") >&5 + { (eval echo "$as_me:5786: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5182: \$? = $ac_status" >&5 + echo "$as_me:5789: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -5189,7 +5796,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:5192: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:5799: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 + echo "$as_me:5810: checking if link/symlink functions work" >&5 echo $ECHO_N "checking if link/symlink functions work... $ECHO_C" >&6 if test "${cf_cv_link_funcs+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -5213,7 +5820,7 @@ else eval 'ac_cv_func_'$cf_func'=error' else cat >conftest.$ac_ext <<_ACEOF -#line 5216 "configure" +#line 5823 "configure" #include "confdefs.h" #include @@ -5243,15 +5850,15 @@ int main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:5246: \"$ac_link\"") >&5 +if { (eval echo "$as_me:5853: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:5249: \$? = $ac_status" >&5 + echo "$as_me:5856: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:5251: \"$ac_try\"") >&5 + { (eval echo "$as_me:5858: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:5254: \$? = $ac_status" >&5 + echo "$as_me:5861: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_link_funcs="$cf_cv_link_funcs $cf_func" @@ -5269,7 +5876,7 @@ fi test -z "$cf_cv_link_funcs" && cf_cv_link_funcs=no fi -echo "$as_me:5272: result: $cf_cv_link_funcs" >&5 +echo "$as_me:5879: result: $cf_cv_link_funcs" >&5 echo "${ECHO_T}$cf_cv_link_funcs" >&6 test "$ac_cv_func_link" = yes && cat >>confdefs.h <<\EOF #define HAVE_LINK 1 @@ -5285,27 +5892,27 @@ with_links=no with_symlinks=no if test "$ac_cv_func_link" != yes ; then - echo "$as_me:5288: checking if tic should use symbolic links" >&5 + echo "$as_me:5895: checking if tic should use symbolic links" >&5 echo $ECHO_N "checking if tic should use symbolic links... $ECHO_C" >&6 if test "$ac_cv_func_symlink" = yes ; then with_symlinks=yes else with_symlinks=no fi - echo "$as_me:5295: result: $with_symlinks" >&5 + echo "$as_me:5902: result: $with_symlinks" >&5 echo "${ECHO_T}$with_symlinks" >&6 elif test "$ac_cv_func_symlink" != yes ; then - echo "$as_me:5298: checking if tic should use hard links" >&5 + echo "$as_me:5905: checking if tic should use hard links" >&5 echo $ECHO_N "checking if tic should use hard links... $ECHO_C" >&6 if test "$ac_cv_func_link" = yes ; then with_links=yes else with_links=no fi - echo "$as_me:5305: result: $with_links" >&5 + echo "$as_me:5912: result: $with_links" >&5 echo "${ECHO_T}$with_links" >&6 else - echo "$as_me:5308: checking if tic should use symbolic links" >&5 + echo "$as_me:5915: checking if tic should use symbolic links" >&5 echo $ECHO_N "checking if tic should use symbolic links... $ECHO_C" >&6 # Check whether --enable-symlinks or --disable-symlinks was given. @@ -5315,7 +5922,7 @@ if test "${enable_symlinks+set}" = set; then else with_symlinks=no fi; - echo "$as_me:5318: result: $with_symlinks" >&5 + echo "$as_me:5925: result: $with_symlinks" >&5 echo "${ECHO_T}$with_symlinks" >&6 fi @@ -5328,7 +5935,7 @@ test "$with_symlinks" = yes && cat >>confdefs.h <<\EOF EOF ### use option --enable-broken-linker to force on use of broken-linker support -echo "$as_me:5331: checking if you want broken-linker support code" >&5 +echo "$as_me:5938: checking if you want broken-linker support code" >&5 echo $ECHO_N "checking if you want broken-linker support code... $ECHO_C" >&6 # Check whether --enable-broken_linker or --disable-broken_linker was given. @@ -5338,7 +5945,7 @@ if test "${enable_broken_linker+set}" = set; then else with_broken_linker=${BROKEN_LINKER-no} fi; -echo "$as_me:5341: result: $with_broken_linker" >&5 +echo "$as_me:5948: result: $with_broken_linker" >&5 echo "${ECHO_T}$with_broken_linker" >&6 BROKEN_LINKER=0 @@ -5362,1774 +5969,2502 @@ EOF esac fi -### use option --with-bool to override bool's type -echo "$as_me:5366: checking for type of bool" >&5 -echo $ECHO_N "checking for type of bool... $ECHO_C" >&6 +### use option --enable-widec to turn on use of wide-character support +NCURSES_CH_T=chtype +NCURSES_LIBUTF8=0 -# Check whether --with-bool or --without-bool was given. -if test "${with_bool+set}" = set; then - withval="$with_bool" - NCURSES_BOOL="$withval" -else - NCURSES_BOOL=auto -fi; -echo "$as_me:5376: result: $NCURSES_BOOL" >&5 -echo "${ECHO_T}$NCURSES_BOOL" >&6 +NEED_WCHAR_H=0 +NCURSES_MBSTATE_T=0 +NCURSES_WCHAR_T=0 +NCURSES_WINT_T=0 -### use option --with-ospeed to override ospeed's type -echo "$as_me:5380: checking for type of ospeed" >&5 -echo $ECHO_N "checking for type of ospeed... $ECHO_C" >&6 +# Check to define _XOPEN_SOURCE "automatically" -# Check whether --with-ospeed or --without-ospeed was given. -if test "${with_ospeed+set}" = set; then - withval="$with_ospeed" - NCURSES_OSPEED="$withval" +echo "$as_me:5983: checking if $CC -U and -D options work together" >&5 +echo $ECHO_N "checking if $CC -U and -D options work together... $ECHO_C" >&6 +if test "${cf_cv_cc_u_d_options+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - NCURSES_OSPEED=short -fi; -echo "$as_me:5390: result: $NCURSES_OSPEED" >&5 -echo "${ECHO_T}$NCURSES_OSPEED" >&6 -### use option --enable-bsdpad to have tputs process BSD-style prefix padding -echo "$as_me:5394: checking if tputs should process BSD-style prefix padding" >&5 -echo $ECHO_N "checking if tputs should process BSD-style prefix padding... $ECHO_C" >&6 + cf_save_CPPFLAGS="$CPPFLAGS" + CPPFLAGS="-UU_D_OPTIONS -DU_D_OPTIONS -DD_U_OPTIONS -UD_U_OPTIONS" + cat >conftest.$ac_ext <<_ACEOF +#line 5992 "configure" +#include "confdefs.h" -# Check whether --enable-bsdpad or --disable-bsdpad was given. -if test "${enable_bsdpad+set}" = set; then - enableval="$enable_bsdpad" - with_bsdpad=$enableval -else - with_bsdpad=no -fi; -echo "$as_me:5404: result: $with_bsdpad" >&5 -echo "${ECHO_T}$with_bsdpad" >&6 -test "$with_bsdpad" = yes && cat >>confdefs.h <<\EOF -#define BSD_TPUTS 1 -EOF +int +main () +{ -### Enable compiling-in rcs id's -echo "$as_me:5411: checking if RCS identifiers should be compiled-in" >&5 -echo $ECHO_N "checking if RCS identifiers should be compiled-in... $ECHO_C" >&6 +#ifndef U_D_OPTIONS +make an undefined-error +#endif +#ifdef D_U_OPTIONS +make a defined-error +#endif -# Check whether --with-rcs-ids or --without-rcs-ids was given. -if test "${with_rcs_ids+set}" = set; then - withval="$with_rcs_ids" - with_rcs_ids=$withval -else - with_rcs_ids=no -fi; -echo "$as_me:5421: result: $with_rcs_ids" >&5 -echo "${ECHO_T}$with_rcs_ids" >&6 -test "$with_rcs_ids" = yes && cat >>confdefs.h <<\EOF -#define USE_RCS_IDS 1 -EOF - -############################################################################### - -echo "$as_me:5429: checking format of man-pages" >&5 -echo $ECHO_N "checking format of man-pages... $ECHO_C" >&6 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6011: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6014: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6017: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6020: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then -# Check whether --with-manpage-format or --without-manpage-format was given. -if test "${with_manpage_format+set}" = set; then - withval="$with_manpage_format" - MANPAGE_FORMAT=$withval + cf_cv_cc_u_d_options=yes else - MANPAGE_FORMAT=unknown -fi; - -test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown -MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'` - -cf_unknown= - -case $MANPAGE_FORMAT in -unknown) - if test -z "$MANPATH" ; then - MANPATH="/usr/man:/usr/share/man" - fi - - # look for the 'date' man-page (it's most likely to be installed!) - MANPAGE_FORMAT= - cf_preform=no - cf_catonly=yes - cf_example=date - - IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}" - for cf_dir in $MANPATH; do - test -z "$cf_dir" && cf_dir=/usr/man - for cf_name in $cf_dir/man*/$cf_example.[01]* $cf_dir/cat*/$cf_example.[01]* $cf_dir/man*/$cf_example $cf_dir/cat*/$cf_example - do - cf_test=`echo $cf_name | sed -e 's/*//'` - if test "x$cf_test" = "x$cf_name" ; then - - case "$cf_name" in - *.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";; - *.Z) MANPAGE_FORMAT="$MANPAGE_FORMAT compress";; - *.0) MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";; - *) MANPAGE_FORMAT="$MANPAGE_FORMAT normal";; - esac - - case "$cf_name" in - $cf_dir/man*) - cf_catonly=no - ;; - $cf_dir/cat*) - cf_preform=yes - ;; - esac - break - fi - - # if we found a match in either man* or cat*, stop looking - if test -n "$MANPAGE_FORMAT" ; then - cf_found=no - test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted" - test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly" - case "$cf_name" in - $cf_dir/cat*) - cf_found=yes - ;; - esac - test $cf_found=yes && break - fi - done - # only check the first directory in $MANPATH where we find manpages - if test -n "$MANPAGE_FORMAT" ; then - break - fi - done - # if we did not find the example, just assume it is normal - test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal - IFS="$ac_save_ifs" - ;; -*) - for cf_option in $MANPAGE_FORMAT; do - case $cf_option in #(vi - gzip|compress|BSDI|normal|formatted|catonly) - ;; - *) - cf_unknown="$cf_unknown $cf_option" - ;; - esac - done - ;; -esac + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 -echo "$as_me:5518: result: $MANPAGE_FORMAT" >&5 -echo "${ECHO_T}$MANPAGE_FORMAT" >&6 -if test -n "$cf_unknown" ; then - { echo "$as_me:5521: WARNING: Unexpected manpage-format $cf_unknown" >&5 -echo "$as_me: WARNING: Unexpected manpage-format $cf_unknown" >&2;} + cf_cv_cc_u_d_options=no fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save_CPPFLAGS" -echo "$as_me:5525: checking for manpage renaming" >&5 -echo $ECHO_N "checking for manpage renaming... $ECHO_C" >&6 - -# Check whether --with-manpage-renames or --without-manpage-renames was given. -if test "${with_manpage_renames+set}" = set; then - withval="$with_manpage_renames" - MANPAGE_RENAMES=$withval -else - MANPAGE_RENAMES=yes -fi; - -case ".$MANPAGE_RENAMES" in #(vi -.no) #(vi - ;; -.|.yes) - # Debian 'man' program? - if test -f /etc/debian_version ; then - MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames - else - MANPAGE_RENAMES=no - fi - ;; -esac - -if test "$MANPAGE_RENAMES" != no ; then - if test -f $srcdir/man/$MANPAGE_RENAMES ; then - MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES - elif test ! -f $MANPAGE_RENAMES ; then - { { echo "$as_me:5553: error: not a filename: $MANPAGE_RENAMES" >&5 -echo "$as_me: error: not a filename: $MANPAGE_RENAMES" >&2;} - { (exit 1); exit 1; }; } - fi - - test ! -d man && mkdir man - - # Construct a sed-script to perform renaming within man-pages - if test -n "$MANPAGE_RENAMES" ; then - test ! -d man && mkdir man - sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >man/edit_man.sed - fi fi +echo "$as_me:6034: result: $cf_cv_cc_u_d_options" >&5 +echo "${ECHO_T}$cf_cv_cc_u_d_options" >&6 -echo "$as_me:5567: result: $MANPAGE_RENAMES" >&5 -echo "${ECHO_T}$MANPAGE_RENAMES" >&6 +cf_XOPEN_SOURCE=500 +cf_POSIX_C_SOURCE=199506L -echo "$as_me:5570: checking if manpage aliases will be installed" >&5 -echo $ECHO_N "checking if manpage aliases will be installed... $ECHO_C" >&6 +case $host_os in #(vi +aix[45]*) #(vi + CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE" + ;; +darwin*) #(vi + # setting _XOPEN_SOURCE breaks things on Darwin + ;; +freebsd*) #(vi + # 5.x headers associate + # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L + # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L + cf_POSIX_C_SOURCE=200112L + cf_XOPEN_SOURCE=600 + CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + ;; +hpux*) #(vi + CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE" + ;; +irix[56].*) #(vi + CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE" + ;; +linux*|gnu*) #(vi -# Check whether --with-manpage-aliases or --without-manpage-aliases was given. -if test "${with_manpage_aliases+set}" = set; then - withval="$with_manpage_aliases" - MANPAGE_ALIASES=$withval +echo "$as_me:6063: checking if we must define _GNU_SOURCE" >&5 +echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_gnu_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - MANPAGE_ALIASES=yes -fi; -echo "$as_me:5581: result: $MANPAGE_ALIASES" >&5 -echo "${ECHO_T}$MANPAGE_ALIASES" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line 6070 "configure" +#include "confdefs.h" +#include +int +main () +{ -if test "$LN_S" = "ln -s"; then - cf_use_symlinks=yes +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6085: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6088: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6091: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6094: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_gnu_source=no else - cf_use_symlinks=no -fi - -MANPAGE_SYMLINKS=no -if test "$MANPAGE_ALIASES" = yes ; then -echo "$as_me:5592: checking if manpage symlinks should be used" >&5 -echo $ECHO_N "checking if manpage symlinks should be used... $ECHO_C" >&6 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" + cat >conftest.$ac_ext <<_ACEOF +#line 6103 "configure" +#include "confdefs.h" +#include +int +main () +{ -# Check whether --with-manpage-symlinks or --without-manpage-symlinks was given. -if test "${with_manpage_symlinks+set}" = set; then - withval="$with_manpage_symlinks" - MANPAGE_SYMLINKS=$withval +#ifdef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6118: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6121: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6124: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6127: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_gnu_source=no else - MANPAGE_SYMLINKS=$cf_use_symlinks -fi; - -if test "$$cf_use_symlinks" = no; then -if test "$MANPAGE_SYMLINKS" = yes ; then - { echo "$as_me:5605: WARNING: cannot make symlinks" >&5 -echo "$as_me: WARNING: cannot make symlinks" >&2;} - MANPAGE_SYMLINKS=no -fi + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_gnu_source=yes fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" -echo "$as_me:5611: result: $MANPAGE_SYMLINKS" >&5 -echo "${ECHO_T}$MANPAGE_SYMLINKS" >&6 fi +rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:5615: checking for manpage tbl" >&5 -echo $ECHO_N "checking for manpage tbl... $ECHO_C" >&6 - -# Check whether --with-manpage-tbl or --without-manpage-tbl was given. -if test "${with_manpage_tbl+set}" = set; then - withval="$with_manpage_tbl" - MANPAGE_TBL=$withval -else - MANPAGE_TBL=no -fi; - -echo "$as_me:5626: result: $MANPAGE_TBL" >&5 -echo "${ECHO_T}$MANPAGE_TBL" >&6 +fi +echo "$as_me:6142: result: $cf_cv_gnu_source" >&5 +echo "${ECHO_T}$cf_cv_gnu_source" >&6 +test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" - if test "$prefix" = "NONE" ; then - cf_prefix="$ac_default_prefix" - else - cf_prefix="$prefix" - fi + ;; +mirbsd*) #(vi + # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks + ;; +netbsd*) #(vi + # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw + ;; +openbsd*) #(vi + # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw + ;; +osf[45]*) #(vi + CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE" + ;; +nto-qnx*) #(vi + CPPFLAGS="$CPPFLAGS -D_QNX_SOURCE" + ;; +sco*) #(vi + # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer + ;; +solaris*) #(vi + CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__" + ;; +*) + echo "$as_me:6169: checking if we should define _XOPEN_SOURCE" >&5 +echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_xopen_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else - case "$MANPAGE_FORMAT" in # (vi - *catonly*) # (vi - cf_format=yes - cf_inboth=no - ;; - *formatted*) # (vi - cf_format=yes - cf_inboth=yes - ;; - *) - cf_format=no - cf_inboth=no - ;; - esac + cat >conftest.$ac_ext <<_ACEOF +#line 6176 "configure" +#include "confdefs.h" +#include +int +main () +{ -test ! -d man && mkdir man +#ifndef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6191: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6194: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6197: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6200: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + cat >conftest.$ac_ext <<_ACEOF +#line 6209 "configure" +#include "confdefs.h" +#include +int +main () +{ -cf_so_strip= -cf_compress= -case "$MANPAGE_FORMAT" in #(vi -*compress*) #(vi - cf_so_strip="Z" - cf_compress=compress - ;; -*gzip*) #(vi - cf_so_strip="gz" - cf_compress=gzip - ;; -esac +#ifdef _XOPEN_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6224: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6227: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6230: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6233: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_xopen_source=no +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_xopen_source=$cf_XOPEN_SOURCE +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CPPFLAGS="$cf_save" -cf_edit_man=man/edit_man.sh +fi +rm -f conftest.$ac_objext conftest.$ac_ext -cat >$cf_edit_man <&5 +echo "${ECHO_T}$cf_cv_xopen_source" >&6 + if test "$cf_cv_xopen_source" != no ; then -TMP=\${TMPDIR-/tmp}/man\$\$ -trap "rm -f \$TMP" 0 1 2 5 15 +# remove _XOPEN_SOURCE symbol from $CFLAGS +CFLAGS=`echo "$CFLAGS" | \ + sed -e 's/-[UD]_XOPEN_SOURCE\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]_XOPEN_SOURCE\(=[^ ]*\)\?$//g'` -form=\$1 -shift || exit 1 +# remove _XOPEN_SOURCE symbol from $CPPFLAGS +CPPFLAGS=`echo "$CPPFLAGS" | \ + sed -e 's/-[UD]_XOPEN_SOURCE\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]_XOPEN_SOURCE\(=[^ ]*\)\?$//g'` -verb=\$1 -shift || exit 1 + test "$cf_cv_cc_u_d_options" = yes && \ + CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE" + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_cv_xopen_source" + fi -mandir=\$1 -shift || exit 1 +cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -srcdir=\$1 -shift || exit 1 +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" -if test "\$form" = normal ; then - if test "$cf_format" = yes ; then - if test "$cf_inboth" = no ; then - sh \$0 format \$verb \$mandir \$srcdir \$* - exit $? - fi - fi - cf_subdir=\$mandir/man - cf_tables=$MANPAGE_TBL +# remove _POSIX_C_SOURCE symbol from $cf_save_CFLAGS +cf_trim_CFLAGS=`echo "$cf_save_CFLAGS" | \ + sed -e 's/-[UD]_POSIX_C_SOURCE\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]_POSIX_C_SOURCE\(=[^ ]*\)\?$//g'` + +# remove _POSIX_C_SOURCE symbol from $cf_save_CPPFLAGS +cf_trim_CPPFLAGS=`echo "$cf_save_CPPFLAGS" | \ + sed -e 's/-[UD]_POSIX_C_SOURCE\(=[^ ]*\)\?[ ]/ /g' \ + -e 's/-[UD]_POSIX_C_SOURCE\(=[^ ]*\)\?$//g'` + +echo "$as_me:6282: checking if we should define _POSIX_C_SOURCE" >&5 +echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 +if test "${cf_cv_posix_c_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - cf_subdir=\$mandir/cat - cf_tables=yes -fi -# process the list of source-files -for i in \$* ; do -case \$i in #(vi -*.orig|*.rej) ;; #(vi -*.[0-9]*) - section=\`expr "\$i" : '.*\\.\\([0-9]\\)[xm]*'\`; - if test \$verb = installing ; then - if test ! -d \$cf_subdir\${section} ; then - \$MKDIRS \$cf_subdir\$section - fi - fi - aliases= - source=\`basename \$i\` - inalias=\$source - test ! -f \$inalias && inalias="\$srcdir/\$inalias" - if test ! -f \$inalias ; then - echo .. skipped \$source - continue - fi -CF_EOF +echo "(line 6288) testing if the symbol is already defined go no further ..." 1>&5 -if test "$MANPAGE_ALIASES" != no ; then -cat >>$cf_edit_man <conftest.$ac_ext <<_ACEOF +#line 6291 "configure" +#include "confdefs.h" +#include +int +main () +{ -if test "$MANPAGE_RENAMES" = no ; then -cat >>$cf_edit_man <&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6309: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6312: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6315: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_posix_c_source=no else -cat >>$cf_edit_man <&5 +cat conftest.$ac_ext >&5 +cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in #(vi + .[12]??*) #(vi + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + .2) #(vi + cf_cv_posix_c_source="-D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + .*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then + cat >conftest.$ac_ext <<_ACEOF +#line 6336 "configure" +#include "confdefs.h" +#include +int +main () +{ + +#ifdef _POSIX_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6351: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6354: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6357: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6360: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_c_source="$cf_cv_posix_c_source -D_POSIX_SOURCE" fi +rm -f conftest.$ac_objext conftest.$ac_ext + fi - # replace variables in man page +echo "(line 6371) testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 - for cf_name in captoinfo clear infocmp infotocap tic toe tput - do -cat >>$cf_edit_man <>$cf_edit_man <&5 - for cf_name in captoinfo clear infocmp infotocap tic toe tput - do - cf_NAME=`echo "$cf_name" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` -cat >>$cf_edit_man <conftest.$ac_ext <<_ACEOF +#line 6379 "configure" +#include "confdefs.h" +#include +int +main () +{ -if test -f $MANPAGE_RENAMES ; then -cat >>$cf_edit_man <\$TMP -CF_EOF +#ifndef _POSIX_C_SOURCE +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6394: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6397: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6400: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6403: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + : else -cat >>$cf_edit_man <\$TMP -CF_EOF + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_posix_c_source=no fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + CPPFLAGS="$cf_save_CPPFLAGS" -cat >>$cf_edit_man <\$TMP.out - mv \$TMP.out \$TMP fi -CF_EOF +rm -f conftest.$ac_objext conftest.$ac_ext -if test $with_curses_h != yes ; then -cat >>$cf_edit_man <\$TMP.out - mv \$TMP.out \$TMP -CF_EOF fi +echo "$as_me:6419: result: $cf_cv_posix_c_source" >&5 +echo "${ECHO_T}$cf_cv_posix_c_source" >&6 -cat >>$cf_edit_man <\$TMP.out - mv \$TMP.out \$TMP - fi -CF_EOF - -if test -n "$cf_compress" ; then -cat >>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <\$TMP -CF_EOF -if test -n "$cf_compress" ; then -cat >>$cf_edit_man <&5 +echo $ECHO_N "checking for nl_langinfo and CODESET... $ECHO_C" >&6 +if test "${am_cv_langinfo_codeset+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 6444 "configure" +#include "confdefs.h" +#include +int +main () +{ +char* cs = nl_langinfo(CODESET); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6456: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6459: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6462: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6465: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + am_cv_langinfo_codeset=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +am_cv_langinfo_codeset=no fi -cat >>$cf_edit_man <&5 -echo $ECHO_N "checking if you want to build with function extensions... $ECHO_C" >&6 +echo "$as_me:6476: result: $am_cv_langinfo_codeset" >&5 +echo "${ECHO_T}$am_cv_langinfo_codeset" >&6 + if test $am_cv_langinfo_codeset = yes; then -# Check whether --enable-ext-funcs or --disable-ext-funcs was given. -if test "${enable_ext_funcs+set}" = set; then - enableval="$enable_ext_funcs" - with_ext_funcs=$enableval -else - with_ext_funcs=yes -fi; -echo "$as_me:5924: result: $with_ext_funcs" >&5 -echo "${ECHO_T}$with_ext_funcs" >&6 -if test "$with_ext_funcs" = yes ; then - NCURSES_EXT_FUNCS=1 - cat >>confdefs.h <<\EOF -#define HAVE_CURSES_VERSION 1 +cat >>confdefs.h <<\EOF +#define HAVE_LANGINFO_CODESET 1 EOF - cat >>confdefs.h <<\EOF -#define HAVE_HAS_KEY 1 -EOF + fi - cat >>confdefs.h <<\EOF -#define HAVE_RESIZETERM 1 -EOF +# use these variables to work around a defect in gcc's fixincludes. +NCURSES_OK_WCHAR_T= +NCURSES_OK_WINT_T= - cat >>confdefs.h <<\EOF -#define HAVE_RESIZE_TERM 1 -EOF +echo "$as_me:6490: checking if you want wide-character code" >&5 +echo $ECHO_N "checking if you want wide-character code... $ECHO_C" >&6 +# Check whether --enable-widec or --disable-widec was given. +if test "${enable_widec+set}" = set; then + enableval="$enable_widec" + with_widec=$enableval +else + with_widec=no +fi; +echo "$as_me:6500: result: $with_widec" >&5 +echo "${ECHO_T}$with_widec" >&6 +if test "$with_widec" = yes ; then + LIB_SUFFIX="w${LIB_SUFFIX}" cat >>confdefs.h <<\EOF -#define HAVE_USE_DEFAULT_COLORS 1 +#define USE_WIDEC_SUPPORT 1 EOF - cat >>confdefs.h <<\EOF -#define HAVE_WRESIZE 1 -EOF +echo "$as_me:6508: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5 +echo $ECHO_N "checking if we must define _XOPEN_SOURCE_EXTENDED... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line 6511 "configure" +#include "confdefs.h" +#include - cat >>confdefs.h <<\EOF -#define NCURSES_EXT_FUNCS 1 -EOF +int +main () +{ +#ifndef _XOPEN_SOURCE_EXTENDED +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6527: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6530: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6533: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6536: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=no else - NCURSES_EXT_FUNCS=0 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=yes fi +rm -f conftest.$ac_objext conftest.$ac_ext +echo "$as_me:6545: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 -### use option --enable-const to turn on use of const beyond that in XSI. -echo "$as_me:5961: checking for extended use of const keyword" >&5 -echo $ECHO_N "checking for extended use of const keyword... $ECHO_C" >&6 +if test "$cf_result" = yes ; then + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" +elif test "x" != "x" ; then + echo "$as_me:6551: checking checking for compatible value versus " >&5 +echo $ECHO_N "checking checking for compatible value versus ... $ECHO_C" >&6 + cat >conftest.$ac_ext <<_ACEOF +#line 6554 "configure" +#include "confdefs.h" +#include -# Check whether --enable-const or --disable-const was given. -if test "${enable_const+set}" = set; then - enableval="$enable_const" - with_ext_const=$enableval +int +main () +{ + +#if _XOPEN_SOURCE_EXTENDED- < 0 +make an error +#endif + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:6570: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:6573: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:6576: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6579: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_result=yes else - with_ext_const=no -fi; -echo "$as_me:5971: result: $with_ext_const" >&5 -echo "${ECHO_T}$with_ext_const" >&6 -NCURSES_CONST='/*nothing*/' -if test "$with_ext_const" = yes ; then - NCURSES_CONST=const + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_result=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + echo "$as_me:6588: result: $cf_result" >&5 +echo "${ECHO_T}$cf_result" >&6 + if test "$cf_result" = no ; then + # perhaps we can override it - try... + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=" + fi fi -echo "$as_me:5978: checking if you want \$NCURSES_NO_PADDING code" >&5 -echo $ECHO_N "checking if you want \$NCURSES_NO_PADDING code... $ECHO_C" >&6 + # with_overwrite=no + NCURSES_CH_T=cchar_t -# Check whether --enable-no-padding or --disable-no-padding was given. -if test "${enable_no_padding+set}" = set; then - enableval="$enable_no_padding" - with_no_padding=$enableval +for ac_func in putwc btowc wctob mbtowc wctomb mblen mbrlen mbrtowc +do +as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` +echo "$as_me:6602: checking for $ac_func" >&5 +echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 +if eval "test \"\${$as_ac_var+set}\" = set"; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - with_no_padding=$with_ext_funcs -fi; -echo "$as_me:5988: result: $with_no_padding" >&5 -echo "${ECHO_T}$with_no_padding" >&6 -test "$with_no_padding" = yes && cat >>confdefs.h <<\EOF -#define NCURSES_NO_PADDING 1 -EOF + cat >conftest.$ac_ext <<_ACEOF +#line 6608 "configure" +#include "confdefs.h" +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $ac_func (); below. */ +#include +/* Override any gcc2 internal prototype to avoid an error. */ +#ifdef __cplusplus +extern "C" +#endif +/* We use char because int might match the return type of a gcc2 + builtin and then its argument prototype would still apply. */ +char $ac_func (); +char (*f) (); -### use option --enable-sigwinch to turn on use of SIGWINCH logic -echo "$as_me:5995: checking if you want SIGWINCH handler" >&5 -echo $ECHO_N "checking if you want SIGWINCH handler... $ECHO_C" >&6 +int +main () +{ +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined (__stub_$ac_func) || defined (__stub___$ac_func) +choke me +#else +f = $ac_func; +#endif -# Check whether --enable-sigwinch or --disable-sigwinch was given. -if test "${enable_sigwinch+set}" = set; then - enableval="$enable_sigwinch" - with_sigwinch=$enableval + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6639: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6642: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6645: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6648: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + eval "$as_ac_var=yes" else - with_sigwinch=$with_ext_funcs -fi; -echo "$as_me:6005: result: $with_sigwinch" >&5 -echo "${ECHO_T}$with_sigwinch" >&6 -test "$with_sigwinch" = yes && cat >>confdefs.h <<\EOF -#define USE_SIGWINCH 1 + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +eval "$as_ac_var=no" +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:6658: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 +if test `eval echo '${'$as_ac_var'}'` = yes; then + cat >>confdefs.h <&5 -echo $ECHO_N "checking if you want user-definable terminal capabilities like termcap... $ECHO_C" >&6 - -# Check whether --enable-tcap-names or --disable-tcap-names was given. -if test "${enable_tcap_names+set}" = set; then - enableval="$enable_tcap_names" - with_tcap_names=$enableval -else - with_tcap_names=$with_ext_funcs -fi; -echo "$as_me:6022: result: $with_tcap_names" >&5 -echo "${ECHO_T}$with_tcap_names" >&6 -NCURSES_XNAMES=0 -test "$with_tcap_names" = yes && NCURSES_XNAMES=1 - -############################################################################### -# These options are relatively safe to experiment with. - -echo "$as_me:6030: checking if you want all development code" >&5 -echo $ECHO_N "checking if you want all development code... $ECHO_C" >&6 - -# Check whether --with-develop or --without-develop was given. -if test "${with_develop+set}" = set; then - withval="$with_develop" - with_develop=$withval -else - with_develop=no -fi; -echo "$as_me:6040: result: $with_develop" >&5 -echo "${ECHO_T}$with_develop" >&6 +fi +done -### use option --enable-hard-tabs to turn on use of hard-tabs optimize -echo "$as_me:6044: checking if you want hard-tabs code" >&5 -echo $ECHO_N "checking if you want hard-tabs code... $ECHO_C" >&6 + if test "$ac_cv_func_putwc" != yes ; then -# Check whether --enable-hard-tabs or --disable-hard-tabs was given. -if test "${enable_hard_tabs+set}" = set; then - enableval="$enable_hard_tabs" - with_hardtabs=$enableval +echo "$as_me:6670: checking for putwc in libutf8" >&5 +echo $ECHO_N "checking for putwc in libutf8... $ECHO_C" >&6 +if test "${cf_cv_libutf8+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - with_hardtabs=$with_develop -fi; -echo "$as_me:6054: result: $with_hardtabs" >&5 -echo "${ECHO_T}$with_hardtabs" >&6 -test "$with_hardtabs" = yes && cat >>confdefs.h <<\EOF -#define USE_HARD_TABS 1 -EOF -echo "$as_me:6060: checking if you want to use restrict environment when running as root" >&5 -echo $ECHO_N "checking if you want to use restrict environment when running as root... $ECHO_C" >&6 + cf_save_LIBS="$LIBS" + LIBS="-lutf8 $LIBS" +cat >conftest.$ac_ext <<_ACEOF +#line 6679 "configure" +#include "confdefs.h" -# Check whether --enable-root-environ or --disable-root-environ was given. -if test "${enable_root_environ+set}" = set; then - enableval="$enable_root_environ" - with_root_environ=$enableval +#include +int +main () +{ +putwc(0,0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:6692: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:6695: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:6698: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:6701: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_libutf8=yes else - with_root_environ=yes -fi; -echo "$as_me:6070: result: $with_root_environ" >&5 -echo "${ECHO_T}$with_root_environ" >&6 -test "$with_root_environ" = yes && cat >>confdefs.h <<\EOF -#define USE_ROOT_ENVIRON 1 -EOF + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_libutf8=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext + LIBS="$cf_save_LIBS" -### use option --enable-xmc-glitch to turn on use of magic-cookie optimize -echo "$as_me:6077: checking if you want limited support for xmc" >&5 -echo $ECHO_N "checking if you want limited support for xmc... $ECHO_C" >&6 +fi +echo "$as_me:6713: result: $cf_cv_libutf8" >&5 +echo "${ECHO_T}$cf_cv_libutf8" >&6 -# Check whether --enable-xmc-glitch or --disable-xmc-glitch was given. -if test "${enable_xmc_glitch+set}" = set; then - enableval="$enable_xmc_glitch" - with_xmc_glitch=$enableval -else - with_xmc_glitch=$with_develop -fi; -echo "$as_me:6087: result: $with_xmc_glitch" >&5 -echo "${ECHO_T}$with_xmc_glitch" >&6 -test "$with_xmc_glitch" = yes && cat >>confdefs.h <<\EOF -#define USE_XMC_SUPPORT 1 +if test "$cf_cv_libutf8" = yes ; then + cat >>confdefs.h <<\EOF +#define HAVE_LIBUTF8_H 1 EOF -############################################################################### -# These are just experimental, probably should not be in a package: + LIBS="-lutf8 $LIBS" +fi -echo "$as_me:6096: checking if you do not want to assume colors are white-on-black" >&5 -echo $ECHO_N "checking if you do not want to assume colors are white-on-black... $ECHO_C" >&6 + if test "$cf_cv_libutf8" = yes ; then + NCURSES_LIBUTF8=1 + fi + fi -# Check whether --enable-assumed-color or --disable-assumed-color was given. -if test "${enable_assumed_color+set}" = set; then - enableval="$enable_assumed_color" - with_assumed_color=$enableval +# This is needed on Tru64 5.0 to declare mbstate_t +echo "$as_me:6730: checking if we must include wchar.h to declare mbstate_t" >&5 +echo $ECHO_N "checking if we must include wchar.h to declare mbstate_t... $ECHO_C" >&6 +if test "${cf_cv_mbstate_t+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 else - with_assumed_color=yes -fi; -echo "$as_me:6106: result: $with_assumed_color" >&5 -echo "${ECHO_T}$with_assumed_color" >&6 -test "$with_assumed_color" = yes && cat >>confdefs.h <<\EOF -#define USE_ASSUMED_COLOR 1 -EOF -### use option --enable-hashmap to turn on use of hashmap scrolling logic -echo "$as_me:6113: checking if you want hashmap scrolling-optimization code" >&5 -echo $ECHO_N "checking if you want hashmap scrolling-optimization code... $ECHO_C" >&6 +cat >conftest.$ac_ext <<_ACEOF +#line 6737 "configure" +#include "confdefs.h" -# Check whether --enable-hashmap or --disable-hashmap was given. -if test "${enable_hashmap+set}" = set; then - enableval="$enable_hashmap" - with_hashmap=$enableval -else - with_hashmap=yes -fi; -echo "$as_me:6123: result: $with_hashmap" >&5 -echo "${ECHO_T}$with_hashmap" >&6 -test "$with_hashmap" = yes && cat >>confdefs.h <<\EOF -#define USE_HASHMAP 1 -EOF - -### use option --enable-colorfgbg to turn on use of $COLORFGBG environment -echo "$as_me:6130: checking if you want colorfgbg code" >&5 -echo $ECHO_N "checking if you want colorfgbg code... $ECHO_C" >&6 - -# Check whether --enable-colorfgbg or --disable-colorfgbg was given. -if test "${enable_colorfgbg+set}" = set; then - enableval="$enable_colorfgbg" - with_colorfgbg=$enableval -else - with_colorfgbg=no -fi; -echo "$as_me:6140: result: $with_colorfgbg" >&5 -echo "${ECHO_T}$with_colorfgbg" >&6 -test "$with_colorfgbg" = yes && cat >>confdefs.h <<\EOF -#define USE_COLORFGBG 1 -EOF - -echo "$as_me:6146: checking if you want experimental safe-sprintf code" >&5 -echo $ECHO_N "checking if you want experimental safe-sprintf code... $ECHO_C" >&6 - -# Check whether --enable-safe-sprintf or --disable-safe-sprintf was given. -if test "${enable_safe_sprintf+set}" = set; then - enableval="$enable_safe_sprintf" - with_safe_sprintf=$enableval -else - with_safe_sprintf=no -fi; -echo "$as_me:6156: result: $with_safe_sprintf" >&5 -echo "${ECHO_T}$with_safe_sprintf" >&6 -test "$with_safe_sprintf" = yes && cat >>confdefs.h <<\EOF -#define USE_SAFE_SPRINTF 1 -EOF - -### use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic -# when hashmap is used scroll hints are useless -if test "$with_hashmap" = no ; then -echo "$as_me:6165: checking if you want to experiment without scrolling-hints code" >&5 -echo $ECHO_N "checking if you want to experiment without scrolling-hints code... $ECHO_C" >&6 - -# Check whether --enable-scroll-hints or --disable-scroll-hints was given. -if test "${enable_scroll_hints+set}" = set; then - enableval="$enable_scroll_hints" - with_scroll_hints=$enableval -else - with_scroll_hints=yes -fi; -echo "$as_me:6175: result: $with_scroll_hints" >&5 -echo "${ECHO_T}$with_scroll_hints" >&6 -test "$with_scroll_hints" = yes && cat >>confdefs.h <<\EOF -#define USE_SCROLL_HINTS 1 -EOF - -fi - -### use option --enable-widec to turn on use of wide-character support -NCURSES_CH_T=chtype -NCURSES_LIBUTF8=0 - -NEED_WCHAR_H=0 -NCURSES_MBSTATE_T=0 -NCURSES_WCHAR_T=0 -NCURSES_WINT_T=0 - -# Check to define _XOPEN_SOURCE "automatically" - -case $host_os in #(vi -freebsd*) #(vi - CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=200112 -D_XOPEN_SOURCE=600" - ;; -hpux*) #(vi - CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE" - ;; -irix6.*) #(vi - CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE" - ;; -linux*) #(vi - -echo "$as_me:6206: checking if we must define _GNU_SOURCE" >&5 -echo $ECHO_N "checking if we must define _GNU_SOURCE... $ECHO_C" >&6 -if test "${cf_cv_gnu_source+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - -cat >conftest.$ac_ext <<_ACEOF -#line 6213 "configure" -#include "confdefs.h" -#include +#include +#include +#include +#ifdef HAVE_LIBUTF8_H +#include +#endif int main () { - -#ifndef _XOPEN_SOURCE -make an error -#endif +mbstate_t state ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6228: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6755: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6231: \$? = $ac_status" >&5 + echo "$as_me:6758: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6234: \"$ac_try\"") >&5 + { (eval echo "$as_me:6761: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6237: \$? = $ac_status" >&5 + echo "$as_me:6764: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_gnu_source=no + cf_cv_mbstate_t=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" - cat >conftest.$ac_ext <<_ACEOF -#line 6246 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 6771 "configure" #include "confdefs.h" -#include + +#include +#include +#include +#include +#ifdef HAVE_LIBUTF8_H +#include +#endif int main () { - -#ifdef _XOPEN_SOURCE -make an error -#endif +mbstate_t value ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6261: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6790: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6264: \$? = $ac_status" >&5 + echo "$as_me:6793: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6267: \"$ac_try\"") >&5 + { (eval echo "$as_me:6796: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6270: \$? = $ac_status" >&5 + echo "$as_me:6799: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_gnu_source=no + cf_cv_mbstate_t=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_gnu_source=yes +cf_cv_mbstate_t=unknown fi rm -f conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$cf_save" - fi rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:6811: result: $cf_cv_mbstate_t" >&5 +echo "${ECHO_T}$cf_cv_mbstate_t" >&6 + +if test "$cf_cv_mbstate_t" = yes ; then + cat >>confdefs.h <<\EOF +#define NEED_WCHAR_H 1 +EOF + NEED_WCHAR_H=1 fi -echo "$as_me:6285: result: $cf_cv_gnu_source" >&5 -echo "${ECHO_T}$cf_cv_gnu_source" >&6 -test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" - ;; -mirbsd*) #(vi - # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks - ;; -netbsd*) #(vi - # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw - ;; -openbsd*) #(vi - # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw - ;; -osf[45]*) #(vi - CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE" - ;; -sco*) #(vi - # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer - ;; -solaris*) #(vi - CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__" - ;; -*) - echo "$as_me:6309: checking if we should define _XOPEN_SOURCE" >&5 -echo $ECHO_N "checking if we should define _XOPEN_SOURCE... $ECHO_C" >&6 -if test "${cf_cv_xopen_source+set}" = set; then +# if we do not find mbstate_t in either place, use substitution to provide a fallback. +if test "$cf_cv_mbstate_t" = unknown ; then + NCURSES_MBSTATE_T=1 +fi + +# This is needed on Tru64 5.0 to declare wchar_t +echo "$as_me:6828: checking if we must include wchar.h to declare wchar_t" >&5 +echo $ECHO_N "checking if we must include wchar.h to declare wchar_t... $ECHO_C" >&6 +if test "${cf_cv_wchar_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -#line 6316 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 6835 "configure" #include "confdefs.h" -#include + +#include +#include +#include +#ifdef HAVE_LIBUTF8_H +#include +#endif int main () { - -#ifndef _XOPEN_SOURCE -make an error -#endif +wchar_t state ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6331: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6853: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6334: \$? = $ac_status" >&5 + echo "$as_me:6856: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6337: \"$ac_try\"") >&5 + { (eval echo "$as_me:6859: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6340: \$? = $ac_status" >&5 + echo "$as_me:6862: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_xopen_source=no + cf_cv_wchar_t=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500" - cat >conftest.$ac_ext <<_ACEOF -#line 6349 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 6869 "configure" #include "confdefs.h" -#include + +#include +#include +#include +#include +#ifdef HAVE_LIBUTF8_H +#include +#endif int main () { - -#ifdef _XOPEN_SOURCE -make an error -#endif +wchar_t value ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6364: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6888: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6367: \$? = $ac_status" >&5 + echo "$as_me:6891: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6370: \"$ac_try\"") >&5 + { (eval echo "$as_me:6894: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6373: \$? = $ac_status" >&5 + echo "$as_me:6897: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_xopen_source=no + cf_cv_wchar_t=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_xopen_source=yes +cf_cv_wchar_t=unknown fi rm -f conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$cf_save" - fi rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:6909: result: $cf_cv_wchar_t" >&5 +echo "${ECHO_T}$cf_cv_wchar_t" >&6 + +if test "$cf_cv_wchar_t" = yes ; then + cat >>confdefs.h <<\EOF +#define NEED_WCHAR_H 1 +EOF + NEED_WCHAR_H=1 fi -echo "$as_me:6388: result: $cf_cv_xopen_source" >&5 -echo "${ECHO_T}$cf_cv_xopen_source" >&6 -test "$cf_cv_xopen_source" = yes && CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500" - # FreeBSD 5.x headers demand this... - echo "$as_me:6393: checking if we should define _POSIX_C_SOURCE" >&5 -echo $ECHO_N "checking if we should define _POSIX_C_SOURCE... $ECHO_C" >&6 -if test "${cf_cv_xopen_source+set}" = set; then +# if we do not find wchar_t in either place, use substitution to provide a fallback. +if test "$cf_cv_wchar_t" = unknown ; then + NCURSES_WCHAR_T=1 +fi + +# if we find wchar_t in either place, use substitution to provide a fallback. +if test "$cf_cv_wchar_t" != unknown ; then + NCURSES_OK_WCHAR_T=1 +fi + +# This is needed on Tru64 5.0 to declare wint_t +echo "$as_me:6931: checking if we must include wchar.h to declare wint_t" >&5 +echo $ECHO_N "checking if we must include wchar.h to declare wint_t... $ECHO_C" >&6 +if test "${cf_cv_wint_t+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else - cat >conftest.$ac_ext <<_ACEOF -#line 6400 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 6938 "configure" #include "confdefs.h" -#include + +#include +#include +#include +#ifdef HAVE_LIBUTF8_H +#include +#endif int main () { - -#ifndef _POSIX_C_SOURCE -make an error -#endif +wint_t state ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6415: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6956: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6418: \$? = $ac_status" >&5 + echo "$as_me:6959: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6421: \"$ac_try\"") >&5 + { (eval echo "$as_me:6962: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6424: \$? = $ac_status" >&5 + echo "$as_me:6965: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_xopen_source=no + cf_cv_wint_t=no else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_save="$CPPFLAGS" - CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE" - cat >conftest.$ac_ext <<_ACEOF -#line 6433 "configure" +cat >conftest.$ac_ext <<_ACEOF +#line 6972 "configure" #include "confdefs.h" -#include + +#include +#include +#include +#include +#ifdef HAVE_LIBUTF8_H +#include +#endif int main () { - -#ifdef _POSIX_C_SOURCE -make an error -#endif +wint_t value ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6448: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:6991: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6451: \$? = $ac_status" >&5 + echo "$as_me:6994: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6454: \"$ac_try\"") >&5 + { (eval echo "$as_me:6997: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6457: \$? = $ac_status" >&5 + echo "$as_me:7000: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_cv_xopen_source=no + cf_cv_wint_t=yes else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_cv_xopen_source=yes +cf_cv_wint_t=unknown fi rm -f conftest.$ac_objext conftest.$ac_ext - CPPFLAGS="$cf_save" - fi rm -f conftest.$ac_objext conftest.$ac_ext +fi +echo "$as_me:7012: result: $cf_cv_wint_t" >&5 +echo "${ECHO_T}$cf_cv_wint_t" >&6 + +if test "$cf_cv_wint_t" = yes ; then + cat >>confdefs.h <<\EOF +#define NEED_WCHAR_H 1 +EOF + NEED_WCHAR_H=1 fi -echo "$as_me:6472: result: $cf_cv_xopen_source" >&5 -echo "${ECHO_T}$cf_cv_xopen_source" >&6 -test "$cf_cv_xopen_source" = yes && CPPFLAGS="$CPPFLAGS -D_POSIX_C_SOURCE" + +# if we do not find wint_t in either place, use substitution to provide a fallback. +if test "$cf_cv_wint_t" = unknown ; then + NCURSES_WINT_T=1 +fi + +# if we find wint_t in either place, use substitution to provide a fallback. +if test "$cf_cv_wint_t" != unknown ; then + NCURSES_OK_WINT_T=1 +fi + + if test "$NCURSES_MBSTATE_T" != 0; then + cat >>confdefs.h <<\EOF +#define NEED_MBSTATE_T_DEF 1 +EOF + + fi +fi + +### use option --disable-lp64 to allow long chtype +case $cf_cv_abi_version in +[345]*) + default_with_lp64=no + ;; +*) + default_with_lp64=yes ;; esac -# use these variables to work around a defect in gcc's fixincludes. -NCURSES_OK_WCHAR_T= -NCURSES_OK_WINT_T= - -echo "$as_me:6482: checking if you want experimental wide-character code" >&5 -echo $ECHO_N "checking if you want experimental wide-character code... $ECHO_C" >&6 +echo "$as_me:7051: checking whether to enable _LP64 definition in curses.h" >&5 +echo $ECHO_N "checking whether to enable _LP64 definition in curses.h... $ECHO_C" >&6 -# Check whether --enable-widec or --disable-widec was given. -if test "${enable_widec+set}" = set; then - enableval="$enable_widec" - with_widec=$enableval +# Check whether --enable-lp64 or --disable-lp64 was given. +if test "${enable_lp64+set}" = set; then + enableval="$enable_lp64" + with_lp64=$enableval else - with_widec=no + with_lp64=$default_with_lp64 fi; -echo "$as_me:6492: result: $with_widec" >&5 -echo "${ECHO_T}$with_widec" >&6 -if test "$with_widec" = yes ; then - LIB_SUFFIX="w${LIB_SUFFIX}" - cat >>confdefs.h <<\EOF -#define USE_WIDEC_SUPPORT 1 +echo "$as_me:7061: result: $with_lp64" >&5 +echo "${ECHO_T}$with_lp64" >&6 + +if test "$with_lp64" = yes ; then + cf_cv_enable_lp64=1 +else + cf_cv_enable_lp64=0 +fi + + echo "$as_me:7070: checking for _LARGEFILE_SOURCE value needed for large files" >&5 +echo $ECHO_N "checking for _LARGEFILE_SOURCE value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_largefile_source+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_largefile_source=no + cat >conftest.$ac_ext <<_ACEOF +#line 7078 "configure" +#include "confdefs.h" +#include +int +main () +{ +return !fseeko; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7090: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7093: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7096: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7099: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 7108 "configure" +#include "confdefs.h" +#define _LARGEFILE_SOURCE 1 +#include +int +main () +{ +return !fseeko; + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7121: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7124: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7127: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7130: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_sys_largefile_source=1; break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + break +done +fi +echo "$as_me:7141: result: $ac_cv_sys_largefile_source" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_source" >&6 +if test "$ac_cv_sys_largefile_source" != no; then + +cat >>confdefs.h <&5 -echo $ECHO_N "checking if we must define _XOPEN_SOURCE... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line 6503 "configure" +fi +rm -f conftest* + +# We used to try defining _XOPEN_SOURCE=500 too, to work around a bug +# in glibc 2.1.3, but that breaks too many other things. +# If you want fseeko and ftello with glibc, upgrade to a fixed glibc. +echo "$as_me:7155: checking for fseeko" >&5 +echo $ECHO_N "checking for fseeko... $ECHO_C" >&6 +if test "${ac_cv_func_fseeko+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + cat >conftest.$ac_ext <<_ACEOF +#line 7161 "configure" #include "confdefs.h" -#include +#include +int +main () +{ +return fseeko && fseeko (stdin, 0, 0); + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext conftest$ac_exeext +if { (eval echo "$as_me:7173: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:7176: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest$ac_exeext' + { (eval echo "$as_me:7179: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7182: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + ac_cv_func_fseeko=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +ac_cv_func_fseeko=no +fi +rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext +fi +echo "$as_me:7192: result: $ac_cv_func_fseeko" >&5 +echo "${ECHO_T}$ac_cv_func_fseeko" >&6 +if test $ac_cv_func_fseeko = yes; then + +cat >>confdefs.h <<\EOF +#define HAVE_FSEEKO 1 +EOF + +fi + +# Check whether --enable-largefile or --disable-largefile was given. +if test "${enable_largefile+set}" = set; then + enableval="$enable_largefile" + +fi; +if test "$enable_largefile" != no; then + echo "$as_me:7209: checking for special C compiler options needed for large files" >&5 +echo $ECHO_N "checking for special C compiler options needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_largefile_CC+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + ac_cv_sys_largefile_CC=no + if test "$GCC" != yes; then + ac_save_CC=$CC + while :; do + # IRIX 6.2 and later do not support large files by default, + # so use the C compiler's -n32 option if that helps. + cat >conftest.$ac_ext <<_ACEOF +#line 7221 "configure" +#include "confdefs.h" +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int main () { -#ifndef _XOPEN_SOURCE -make an error -#endif ; return 0; } _ACEOF + rm -f conftest.$ac_objext +if { (eval echo "$as_me:7241: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7244: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7247: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7250: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi rm -f conftest.$ac_objext -if { (eval echo "$as_me:6519: \"$ac_compile\"") >&5 + CC="$CC -n32" + rm -f conftest.$ac_objext +if { (eval echo "$as_me:7260: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6522: \$? = $ac_status" >&5 + echo "$as_me:7263: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6525: \"$ac_try\"") >&5 + { (eval echo "$as_me:7266: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6528: \$? = $ac_status" >&5 + echo "$as_me:7269: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_result=no + ac_cv_sys_largefile_CC=' -n32'; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_result=yes fi -rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:6537: result: $cf_result" >&5 -echo "${ECHO_T}$cf_result" >&6 +rm -f conftest.$ac_objext + break + done + CC=$ac_save_CC + rm -f conftest.$ac_ext + fi +fi +echo "$as_me:7283: result: $ac_cv_sys_largefile_CC" >&5 +echo "${ECHO_T}$ac_cv_sys_largefile_CC" >&6 + if test "$ac_cv_sys_largefile_CC" != no; then + CC=$CC$ac_cv_sys_largefile_CC + fi -if test "$cf_result" = yes ; then - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500" -elif test "x500" != "x" ; then - echo "$as_me:6543: checking checking for compatible value versus 500" >&5 -echo $ECHO_N "checking checking for compatible value versus 500... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 6546 "configure" + echo "$as_me:7289: checking for _FILE_OFFSET_BITS value needed for large files" >&5 +echo $ECHO_N "checking for _FILE_OFFSET_BITS value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_file_offset_bits+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_file_offset_bits=no + cat >conftest.$ac_ext <<_ACEOF +#line 7297 "configure" #include "confdefs.h" #include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; +int +main () +{ + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7317: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7320: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7323: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7326: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + break +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + cat >conftest.$ac_ext <<_ACEOF +#line 7335 "configure" +#include "confdefs.h" +#define _FILE_OFFSET_BITS 64 +#include + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int main () { -#if _XOPEN_SOURCE-500 < 0 -make an error -#endif ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6562: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:7356: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6565: \$? = $ac_status" >&5 + echo "$as_me:7359: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6568: \"$ac_try\"") >&5 + { (eval echo "$as_me:7362: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6571: \$? = $ac_status" >&5 + echo "$as_me:7365: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_result=yes + ac_cv_sys_file_offset_bits=64; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_result=no fi rm -f conftest.$ac_objext conftest.$ac_ext - echo "$as_me:6580: result: $cf_result" >&5 -echo "${ECHO_T}$cf_result" >&6 - if test "$cf_result" = no ; then - # perhaps we can override it - try... - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500" - fi + break +done fi +echo "$as_me:7376: result: $ac_cv_sys_file_offset_bits" >&5 +echo "${ECHO_T}$ac_cv_sys_file_offset_bits" >&6 +if test "$ac_cv_sys_file_offset_bits" != no; then -echo "$as_me:6588: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5 -echo $ECHO_N "checking if we must define _XOPEN_SOURCE_EXTENDED... $ECHO_C" >&6 -cat >conftest.$ac_ext <<_ACEOF -#line 6591 "configure" +cat >>confdefs.h <&5 +echo $ECHO_N "checking for _LARGE_FILES value needed for large files... $ECHO_C" >&6 +if test "${ac_cv_sys_large_files+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + while :; do + ac_cv_sys_large_files=no + cat >conftest.$ac_ext <<_ACEOF +#line 7394 "configure" #include "confdefs.h" #include - + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int main () { -#ifndef _XOPEN_SOURCE_EXTENDED -make an error -#endif ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6607: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:7414: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6610: \$? = $ac_status" >&5 + echo "$as_me:7417: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6613: \"$ac_try\"") >&5 + { (eval echo "$as_me:7420: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6616: \$? = $ac_status" >&5 + echo "$as_me:7423: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_result=no + break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_result=yes fi rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:6625: result: $cf_result" >&5 -echo "${ECHO_T}$cf_result" >&6 - -if test "$cf_result" = yes ; then - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" -elif test "x" != "x" ; then - echo "$as_me:6631: checking checking for compatible value versus " >&5 -echo $ECHO_N "checking checking for compatible value versus ... $ECHO_C" >&6 - cat >conftest.$ac_ext <<_ACEOF -#line 6634 "configure" + cat >conftest.$ac_ext <<_ACEOF +#line 7432 "configure" #include "confdefs.h" +#define _LARGE_FILES 1 #include - + /* Check that off_t can represent 2**63 - 1 correctly. + We can't simply define LARGE_OFF_T to be 9223372036854775807, + since some C++ compilers masquerading as C compilers + incorrectly reject 9223372036854775807. */ +#define LARGE_OFF_T (((off_t) 1 << 62) - 1 + ((off_t) 1 << 62)) + int off_t_is_large[(LARGE_OFF_T % 2147483629 == 721 + && LARGE_OFF_T % 2147483647 == 1) + ? 1 : -1]; int main () { -#if _XOPEN_SOURCE_EXTENDED- < 0 -make an error -#endif ; return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:6650: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:7453: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:6653: \$? = $ac_status" >&5 + echo "$as_me:7456: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6656: \"$ac_try\"") >&5 + { (eval echo "$as_me:7459: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:6659: \$? = $ac_status" >&5 + echo "$as_me:7462: \$? = $ac_status" >&5 (exit $ac_status); }; }; then - cf_result=yes + ac_cv_sys_large_files=1; break else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 -cf_result=no fi rm -f conftest.$ac_objext conftest.$ac_ext - echo "$as_me:6668: result: $cf_result" >&5 -echo "${ECHO_T}$cf_result" >&6 - if test "$cf_result" = no ; then - # perhaps we can override it - try... - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=" + break +done +fi +echo "$as_me:7473: result: $ac_cv_sys_large_files" >&5 +echo "${ECHO_T}$ac_cv_sys_large_files" >&6 +if test "$ac_cv_sys_large_files" != no; then + +cat >>confdefs.h <&5 +echo $ECHO_N "checking whether to use struct dirent64... $ECHO_C" >&6 +if test "${cf_cv_struct_dirent64+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 7502 "configure" +#include "confdefs.h" + +#include +#include + +int +main () +{ + + /* if transitional largefile support is setup, this is true */ + extern struct dirent64 * readdir(DIR *); + struct dirent64 *x = readdir((DIR *)0); + struct dirent *y = readdir((DIR *)0); + int z = x - y; + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:7523: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:7526: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:7529: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:7532: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_struct_dirent64=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_struct_dirent64=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi +echo "$as_me:7543: result: $cf_cv_struct_dirent64" >&5 +echo "${ECHO_T}$cf_cv_struct_dirent64" >&6 + test "$cf_cv_struct_dirent64" = yes && cat >>confdefs.h <<\EOF +#define HAVE_STRUCT_DIRENT64 1 +EOF + +### use option --with-bool to override bool's type +echo "$as_me:7550: checking for type of bool" >&5 +echo $ECHO_N "checking for type of bool... $ECHO_C" >&6 + +# Check whether --with-bool or --without-bool was given. +if test "${with_bool+set}" = set; then + withval="$with_bool" + NCURSES_BOOL="$withval" +else + NCURSES_BOOL=auto +fi; +echo "$as_me:7560: result: $NCURSES_BOOL" >&5 +echo "${ECHO_T}$NCURSES_BOOL" >&6 + +echo "$as_me:7563: checking for alternate terminal capabilities file" >&5 +echo $ECHO_N "checking for alternate terminal capabilities file... $ECHO_C" >&6 + +# Check whether --with-caps or --without-caps was given. +if test "${with_caps+set}" = set; then + withval="$with_caps" + TERMINFO_CAPS=Caps.$withval +else + TERMINFO_CAPS=Caps +fi; +test -f ${srcdir}/include/${TERMINFO_CAPS} || TERMINFO_CAPS=Caps +echo "$as_me:7574: result: $TERMINFO_CAPS" >&5 +echo "${ECHO_T}$TERMINFO_CAPS" >&6 + +### use option --with-chtype to override chtype's type +echo "$as_me:7578: checking for type of chtype" >&5 +echo $ECHO_N "checking for type of chtype... $ECHO_C" >&6 + +# Check whether --with-chtype or --without-chtype was given. +if test "${with_chtype+set}" = set; then + withval="$with_chtype" + NCURSES_CHTYPE="$withval" +else + NCURSES_CHTYPE=auto +fi; +echo "$as_me:7588: result: $NCURSES_CHTYPE" >&5 +echo "${ECHO_T}$NCURSES_CHTYPE" >&6 + +### use option --with-ospeed to override ospeed's type +echo "$as_me:7592: checking for type of ospeed" >&5 +echo $ECHO_N "checking for type of ospeed... $ECHO_C" >&6 + +# Check whether --with-ospeed or --without-ospeed was given. +if test "${with_ospeed+set}" = set; then + withval="$with_ospeed" + NCURSES_OSPEED="$withval" +else + NCURSES_OSPEED=short +fi; +echo "$as_me:7602: result: $NCURSES_OSPEED" >&5 +echo "${ECHO_T}$NCURSES_OSPEED" >&6 + +### use option --with-mmask-t to override mmask_t's type +echo "$as_me:7606: checking for type of mmask_t" >&5 +echo $ECHO_N "checking for type of mmask_t... $ECHO_C" >&6 + +# Check whether --with-mmask-t or --without-mmask-t was given. +if test "${with_mmask_t+set}" = set; then + withval="$with_mmask_t" + NCURSES_MMASK_T="$withval" +else + NCURSES_MMASK_T=auto +fi; +echo "$as_me:7616: result: $NCURSES_MMASK_T" >&5 +echo "${ECHO_T}$NCURSES_MMASK_T" >&6 + +### use option --enable-bsdpad to have tputs process BSD-style prefix padding +echo "$as_me:7620: checking if tputs should process BSD-style prefix padding" >&5 +echo $ECHO_N "checking if tputs should process BSD-style prefix padding... $ECHO_C" >&6 + +# Check whether --enable-bsdpad or --disable-bsdpad was given. +if test "${enable_bsdpad+set}" = set; then + enableval="$enable_bsdpad" + with_bsdpad=$enableval +else + with_bsdpad=no +fi; +echo "$as_me:7630: result: $with_bsdpad" >&5 +echo "${ECHO_T}$with_bsdpad" >&6 +test "$with_bsdpad" = yes && cat >>confdefs.h <<\EOF +#define BSD_TPUTS 1 +EOF + +### Enable compiling-in rcs id's +echo "$as_me:7637: checking if RCS identifiers should be compiled-in" >&5 +echo $ECHO_N "checking if RCS identifiers should be compiled-in... $ECHO_C" >&6 + +# Check whether --with-rcs-ids or --without-rcs-ids was given. +if test "${with_rcs_ids+set}" = set; then + withval="$with_rcs_ids" + with_rcs_ids=$withval +else + with_rcs_ids=no +fi; +echo "$as_me:7647: result: $with_rcs_ids" >&5 +echo "${ECHO_T}$with_rcs_ids" >&6 +test "$with_rcs_ids" = yes && cat >>confdefs.h <<\EOF +#define USE_RCS_IDS 1 +EOF + +############################################################################### + +echo "$as_me:7655: checking format of man-pages" >&5 +echo $ECHO_N "checking format of man-pages... $ECHO_C" >&6 + +# Check whether --with-manpage-format or --without-manpage-format was given. +if test "${with_manpage_format+set}" = set; then + withval="$with_manpage_format" + MANPAGE_FORMAT=$withval +else + MANPAGE_FORMAT=unknown +fi; + +test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=unknown +MANPAGE_FORMAT=`echo "$MANPAGE_FORMAT" | sed -e 's/,/ /g'` + +cf_unknown= + +case $MANPAGE_FORMAT in +unknown) + if test -z "$MANPATH" ; then + MANPATH="/usr/man:/usr/share/man" + fi + + # look for the 'date' man-page (it's most likely to be installed!) + MANPAGE_FORMAT= + cf_preform=no + cf_catonly=yes + cf_example=date + + IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS="${IFS}${PATHSEP}" + for cf_dir in $MANPATH; do + test -z "$cf_dir" && cf_dir=/usr/man + for cf_name in $cf_dir/man*/$cf_example.[01]* $cf_dir/cat*/$cf_example.[01]* $cf_dir/man*/$cf_example $cf_dir/cat*/$cf_example + do + cf_test=`echo $cf_name | sed -e 's/*//'` + if test "x$cf_test" = "x$cf_name" ; then + + case "$cf_name" in + *.gz) MANPAGE_FORMAT="$MANPAGE_FORMAT gzip";; + *.Z) MANPAGE_FORMAT="$MANPAGE_FORMAT compress";; + *.0) MANPAGE_FORMAT="$MANPAGE_FORMAT BSDI";; + *) MANPAGE_FORMAT="$MANPAGE_FORMAT normal";; + esac + + case "$cf_name" in + $cf_dir/man*) + cf_catonly=no + ;; + $cf_dir/cat*) + cf_preform=yes + ;; + esac + break + fi + + # if we found a match in either man* or cat*, stop looking + if test -n "$MANPAGE_FORMAT" ; then + cf_found=no + test "$cf_preform" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT formatted" + test "$cf_catonly" = yes && MANPAGE_FORMAT="$MANPAGE_FORMAT catonly" + case "$cf_name" in + $cf_dir/cat*) + cf_found=yes + ;; + esac + test $cf_found=yes && break + fi + done + # only check the first directory in $MANPATH where we find manpages + if test -n "$MANPAGE_FORMAT" ; then + break + fi + done + # if we did not find the example, just assume it is normal + test -z "$MANPAGE_FORMAT" && MANPAGE_FORMAT=normal + IFS="$ac_save_ifs" + ;; +*) + for cf_option in $MANPAGE_FORMAT; do + case $cf_option in #(vi + gzip|compress|BSDI|normal|formatted|catonly) + ;; + *) + cf_unknown="$cf_unknown $cf_option" + ;; + esac + done + ;; +esac + +echo "$as_me:7744: result: $MANPAGE_FORMAT" >&5 +echo "${ECHO_T}$MANPAGE_FORMAT" >&6 +if test -n "$cf_unknown" ; then + { echo "$as_me:7747: WARNING: Unexpected manpage-format $cf_unknown" >&5 +echo "$as_me: WARNING: Unexpected manpage-format $cf_unknown" >&2;} +fi + +echo "$as_me:7751: checking for manpage renaming" >&5 +echo $ECHO_N "checking for manpage renaming... $ECHO_C" >&6 + +# Check whether --with-manpage-renames or --without-manpage-renames was given. +if test "${with_manpage_renames+set}" = set; then + withval="$with_manpage_renames" + MANPAGE_RENAMES=$withval +else + MANPAGE_RENAMES=yes +fi; + +case ".$MANPAGE_RENAMES" in #(vi +.no) #(vi + ;; +.|.yes) + # Debian 'man' program? + if test -f /etc/debian_version ; then + MANPAGE_RENAMES=`cd $srcdir && pwd`/man/man_db.renames + else + MANPAGE_RENAMES=no + fi + ;; +esac + +if test "$MANPAGE_RENAMES" != no ; then + if test -f $srcdir/man/$MANPAGE_RENAMES ; then + MANPAGE_RENAMES=`cd $srcdir/man && pwd`/$MANPAGE_RENAMES + elif test ! -f $MANPAGE_RENAMES ; then + { { echo "$as_me:7779: error: not a filename: $MANPAGE_RENAMES" >&5 +echo "$as_me: error: not a filename: $MANPAGE_RENAMES" >&2;} + { (exit 1); exit 1; }; } + fi + + test ! -d man && mkdir man + + # Construct a sed-script to perform renaming within man-pages + if test -n "$MANPAGE_RENAMES" ; then + test ! -d man && mkdir man + sh $srcdir/man/make_sed.sh $MANPAGE_RENAMES >./edit_man.sed + fi +fi + +echo "$as_me:7793: result: $MANPAGE_RENAMES" >&5 +echo "${ECHO_T}$MANPAGE_RENAMES" >&6 + +echo "$as_me:7796: checking if manpage aliases will be installed" >&5 +echo $ECHO_N "checking if manpage aliases will be installed... $ECHO_C" >&6 + +# Check whether --with-manpage-aliases or --without-manpage-aliases was given. +if test "${with_manpage_aliases+set}" = set; then + withval="$with_manpage_aliases" + MANPAGE_ALIASES=$withval +else + MANPAGE_ALIASES=yes +fi; + +echo "$as_me:7807: result: $MANPAGE_ALIASES" >&5 +echo "${ECHO_T}$MANPAGE_ALIASES" >&6 + +if test "$LN_S" = "ln -s"; then + cf_use_symlinks=yes +else + cf_use_symlinks=no +fi + +MANPAGE_SYMLINKS=no +if test "$MANPAGE_ALIASES" = yes ; then +echo "$as_me:7818: checking if manpage symlinks should be used" >&5 +echo $ECHO_N "checking if manpage symlinks should be used... $ECHO_C" >&6 + +# Check whether --with-manpage-symlinks or --without-manpage-symlinks was given. +if test "${with_manpage_symlinks+set}" = set; then + withval="$with_manpage_symlinks" + MANPAGE_SYMLINKS=$withval +else + MANPAGE_SYMLINKS=$cf_use_symlinks +fi; + +if test "$$cf_use_symlinks" = no; then +if test "$MANPAGE_SYMLINKS" = yes ; then + { echo "$as_me:7831: WARNING: cannot make symlinks" >&5 +echo "$as_me: WARNING: cannot make symlinks" >&2;} + MANPAGE_SYMLINKS=no +fi +fi + +echo "$as_me:7837: result: $MANPAGE_SYMLINKS" >&5 +echo "${ECHO_T}$MANPAGE_SYMLINKS" >&6 +fi + +echo "$as_me:7841: checking for manpage tbl" >&5 +echo $ECHO_N "checking for manpage tbl... $ECHO_C" >&6 + +# Check whether --with-manpage-tbl or --without-manpage-tbl was given. +if test "${with_manpage_tbl+set}" = set; then + withval="$with_manpage_tbl" + MANPAGE_TBL=$withval +else + MANPAGE_TBL=no +fi; + +echo "$as_me:7852: result: $MANPAGE_TBL" >&5 +echo "${ECHO_T}$MANPAGE_TBL" >&6 + + if test "$prefix" = "NONE" ; then + cf_prefix="$ac_default_prefix" + else + cf_prefix="$prefix" + fi + + case "$MANPAGE_FORMAT" in # (vi + *catonly*) # (vi + cf_format=yes + cf_inboth=no + ;; + *formatted*) # (vi + cf_format=yes + cf_inboth=yes + ;; + *) + cf_format=no + cf_inboth=no + ;; + esac + +test ! -d man && mkdir man + +cf_so_strip= +cf_compress= +case "$MANPAGE_FORMAT" in #(vi +*compress*) #(vi + cf_so_strip="Z" + cf_compress=compress + ;; +*gzip*) #(vi + cf_so_strip="gz" + cf_compress=gzip + ;; +esac + +cf_edit_man=./edit_man.sh + +cat >$cf_edit_man <>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <\$TMP +CF_EOF +else +cat >>$cf_edit_man <\$TMP +CF_EOF +fi + +cat >>$cf_edit_man <\$TMP.out + mv \$TMP.out \$TMP +fi +CF_EOF + +if test $with_curses_h != yes ; then +cat >>$cf_edit_man <\$TMP.out + mv \$TMP.out \$TMP +CF_EOF +fi + +cat >>$cf_edit_man <\$TMP.out + mv \$TMP.out \$TMP + fi +CF_EOF + +if test -n "$cf_compress" ; then +cat >>$cf_edit_man <>$cf_edit_man <>$cf_edit_man <\$TMP +CF_EOF +if test -n "$cf_compress" ; then +cat >>$cf_edit_man <>$cf_edit_man <&5 -echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 -if eval "test \"\${$as_ac_var+set}\" = set"; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - cat >conftest.$ac_ext <<_ACEOF -#line 6688 "configure" -#include "confdefs.h" -/* System header to define __stub macros and hopefully few prototypes, - which can conflict with char $ac_func (); below. */ -#include -/* Override any gcc2 internal prototype to avoid an error. */ -#ifdef __cplusplus -extern "C" -#endif -/* We use char because int might match the return type of a gcc2 - builtin and then its argument prototype would still apply. */ -char $ac_func (); -char (*f) (); +############################################################################### -int -main () -{ -/* The GNU C library defines this for functions which it implements - to always fail with ENOSYS. Some functions are actually named - something starting with __ and the normal name is an alias. */ -#if defined (__stub_$ac_func) || defined (__stub___$ac_func) -choke me -#else -f = $ac_func; -#endif +### Note that some functions (such as const) are normally disabled anyway. +echo "$as_me:8141: checking if you want to build with function extensions" >&5 +echo $ECHO_N "checking if you want to build with function extensions... $ECHO_C" >&6 - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6719: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:6722: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6725: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6728: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - eval "$as_ac_var=yes" +# Check whether --enable-ext-funcs or --disable-ext-funcs was given. +if test "${enable_ext_funcs+set}" = set; then + enableval="$enable_ext_funcs" + with_ext_funcs=$enableval else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -eval "$as_ac_var=no" -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext -fi -echo "$as_me:6738: result: `eval echo '${'$as_ac_var'}'`" >&5 -echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 -if test `eval echo '${'$as_ac_var'}'` = yes; then - cat >>confdefs.h <&5 +echo "${ECHO_T}$with_ext_funcs" >&6 +if test "$with_ext_funcs" = yes ; then + NCURSES_EXT_FUNCS=1 + cat >>confdefs.h <<\EOF +#define HAVE_CURSES_VERSION 1 EOF -fi -done - - if test "$ac_cv_func_putwc" != yes ; then + cat >>confdefs.h <<\EOF +#define HAVE_HAS_KEY 1 +EOF -echo "$as_me:6750: checking for putwc in libutf8" >&5 -echo $ECHO_N "checking for putwc in libutf8... $ECHO_C" >&6 -if test "${cf_cv_libutf8+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else + cat >>confdefs.h <<\EOF +#define HAVE_RESIZETERM 1 +EOF - cf_save_LIBS="$LIBS" - LIBS="-lutf8 $LIBS" -cat >conftest.$ac_ext <<_ACEOF -#line 6759 "configure" -#include "confdefs.h" + cat >>confdefs.h <<\EOF +#define HAVE_RESIZE_TERM 1 +EOF -#include -int -main () -{ -putwc(0,0); - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:6772: \"$ac_link\"") >&5 - (eval $ac_link) 2>&5 - ac_status=$? - echo "$as_me:6775: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:6778: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6781: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_libutf8=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_cv_libutf8=no -fi -rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext - LIBS="$cf_save_LIBS" + cat >>confdefs.h <<\EOF +#define HAVE_USE_DEFAULT_COLORS 1 +EOF -fi -echo "$as_me:6793: result: $cf_cv_libutf8" >&5 -echo "${ECHO_T}$cf_cv_libutf8" >&6 + cat >>confdefs.h <<\EOF +#define HAVE_WRESIZE 1 +EOF -if test "$cf_cv_libutf8" = yes ; then cat >>confdefs.h <<\EOF -#define HAVE_LIBUTF8_H 1 +#define NCURSES_EXT_FUNCS 1 EOF - LIBS="-lutf8 $LIBS" +else + NCURSES_EXT_FUNCS=0 fi - if test "$cf_cv_libutf8" = yes ; then - NCURSES_LIBUTF8=1 - fi - fi +### use option --enable-const to turn on use of const beyond that in XSI. +echo "$as_me:8188: checking for extended use of const keyword" >&5 +echo $ECHO_N "checking for extended use of const keyword... $ECHO_C" >&6 -# This is needed on Tru64 5.0 to declare mbstate_t -echo "$as_me:6810: checking if we must include wchar.h to declare mbstate_t" >&5 -echo $ECHO_N "checking if we must include wchar.h to declare mbstate_t... $ECHO_C" >&6 -if test "${cf_cv_mbstate_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +# Check whether --enable-const or --disable-const was given. +if test "${enable_const+set}" = set; then + enableval="$enable_const" + with_ext_const=$enableval else + with_ext_const=no +fi; +echo "$as_me:8198: result: $with_ext_const" >&5 +echo "${ECHO_T}$with_ext_const" >&6 +NCURSES_CONST='/*nothing*/' +if test "$with_ext_const" = yes ; then + NCURSES_CONST=const +fi -cat >conftest.$ac_ext <<_ACEOF -#line 6817 "configure" -#include "confdefs.h" - -#include -#include -#include -#ifdef HAVE_LIBUTF8_H -#include -#endif -int -main () -{ -mbstate_t state - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:6835: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:6838: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6841: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6844: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_mbstate_t=no -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF -#line 6851 "configure" -#include "confdefs.h" +echo "$as_me:8205: checking if you want \$NCURSES_NO_PADDING code" >&5 +echo $ECHO_N "checking if you want \$NCURSES_NO_PADDING code... $ECHO_C" >&6 -#include -#include -#include -#include -#ifdef HAVE_LIBUTF8_H -#include -#endif -int -main () -{ -mbstate_t value - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:6870: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:6873: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6876: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6879: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_mbstate_t=yes +# Check whether --enable-no-padding or --disable-no-padding was given. +if test "${enable_no_padding+set}" = set; then + enableval="$enable_no_padding" + with_no_padding=$enableval else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_cv_mbstate_t=unknown -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:6891: result: $cf_cv_mbstate_t" >&5 -echo "${ECHO_T}$cf_cv_mbstate_t" >&6 - -if test "$cf_cv_mbstate_t" = yes ; then - cat >>confdefs.h <<\EOF -#define NEED_WCHAR_H 1 + with_no_padding=$with_ext_funcs +fi; +echo "$as_me:8215: result: $with_no_padding" >&5 +echo "${ECHO_T}$with_no_padding" >&6 +test "$with_no_padding" = yes && cat >>confdefs.h <<\EOF +#define NCURSES_NO_PADDING 1 EOF - NEED_WCHAR_H=1 -fi +### use option --enable-sigwinch to turn on use of SIGWINCH logic +echo "$as_me:8222: checking if you want SIGWINCH handler" >&5 +echo $ECHO_N "checking if you want SIGWINCH handler... $ECHO_C" >&6 -# if we do not find mbstate_t in either place, use substitution to provide a fallback. -if test "$cf_cv_mbstate_t" = unknown ; then - NCURSES_MBSTATE_T=1 -fi +# Check whether --enable-sigwinch or --disable-sigwinch was given. +if test "${enable_sigwinch+set}" = set; then + enableval="$enable_sigwinch" + with_sigwinch=$enableval +else + with_sigwinch=$with_ext_funcs +fi; +echo "$as_me:8232: result: $with_sigwinch" >&5 +echo "${ECHO_T}$with_sigwinch" >&6 +test "$with_sigwinch" = yes && cat >>confdefs.h <<\EOF +#define USE_SIGWINCH 1 +EOF -# This is needed on Tru64 5.0 to declare wchar_t -echo "$as_me:6908: checking if we must include wchar.h to declare wchar_t" >&5 -echo $ECHO_N "checking if we must include wchar.h to declare wchar_t... $ECHO_C" >&6 -if test "${cf_cv_wchar_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +### use option --enable-tcap-names to allow user to define new capabilities +echo "$as_me:8239: checking if you want user-definable terminal capabilities like termcap" >&5 +echo $ECHO_N "checking if you want user-definable terminal capabilities like termcap... $ECHO_C" >&6 + +# Check whether --enable-tcap-names or --disable-tcap-names was given. +if test "${enable_tcap_names+set}" = set; then + enableval="$enable_tcap_names" + with_tcap_names=$enableval else + with_tcap_names=$with_ext_funcs +fi; +echo "$as_me:8249: result: $with_tcap_names" >&5 +echo "${ECHO_T}$with_tcap_names" >&6 +NCURSES_XNAMES=0 +test "$with_tcap_names" = yes && NCURSES_XNAMES=1 -cat >conftest.$ac_ext <<_ACEOF -#line 6915 "configure" -#include "confdefs.h" +############################################################################### +# These options are relatively safe to experiment with. -#include -#include -#include -#ifdef HAVE_LIBUTF8_H -#include -#endif -int -main () -{ -wchar_t state - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:6933: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:6936: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6939: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6942: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_wchar_t=no +echo "$as_me:8257: checking if you want all development code" >&5 +echo $ECHO_N "checking if you want all development code... $ECHO_C" >&6 + +# Check whether --with-develop or --without-develop was given. +if test "${with_develop+set}" = set; then + withval="$with_develop" + with_develop=$withval else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF -#line 6949 "configure" -#include "confdefs.h" + with_develop=no +fi; +echo "$as_me:8267: result: $with_develop" >&5 +echo "${ECHO_T}$with_develop" >&6 -#include -#include -#include -#include -#ifdef HAVE_LIBUTF8_H -#include -#endif -int -main () -{ -wchar_t value - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:6968: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:6971: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:6974: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:6977: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_wchar_t=yes +### use option --enable-hard-tabs to turn on use of hard-tabs optimize +echo "$as_me:8271: checking if you want hard-tabs code" >&5 +echo $ECHO_N "checking if you want hard-tabs code... $ECHO_C" >&6 + +# Check whether --enable-hard-tabs or --disable-hard-tabs was given. +if test "${enable_hard_tabs+set}" = set; then + enableval="$enable_hard_tabs" + with_hardtabs=$enableval else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_cv_wchar_t=unknown -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -echo "$as_me:6989: result: $cf_cv_wchar_t" >&5 -echo "${ECHO_T}$cf_cv_wchar_t" >&6 + with_hardtabs=$with_develop +fi; +echo "$as_me:8281: result: $with_hardtabs" >&5 +echo "${ECHO_T}$with_hardtabs" >&6 +test "$with_hardtabs" = yes && cat >>confdefs.h <<\EOF +#define USE_HARD_TABS 1 +EOF -if test "$cf_cv_wchar_t" = yes ; then - cat >>confdefs.h <<\EOF -#define NEED_WCHAR_H 1 +### use option --enable-xmc-glitch to turn on use of magic-cookie optimize +echo "$as_me:8288: checking if you want limited support for xmc" >&5 +echo $ECHO_N "checking if you want limited support for xmc... $ECHO_C" >&6 + +# Check whether --enable-xmc-glitch or --disable-xmc-glitch was given. +if test "${enable_xmc_glitch+set}" = set; then + enableval="$enable_xmc_glitch" + with_xmc_glitch=$enableval +else + with_xmc_glitch=$with_develop +fi; +echo "$as_me:8298: result: $with_xmc_glitch" >&5 +echo "${ECHO_T}$with_xmc_glitch" >&6 +test "$with_xmc_glitch" = yes && cat >>confdefs.h <<\EOF +#define USE_XMC_SUPPORT 1 EOF - NEED_WCHAR_H=1 -fi +############################################################################### +# These are just experimental, probably should not be in a package: -# if we do not find wchar_t in either place, use substitution to provide a fallback. -if test "$cf_cv_wchar_t" = unknown ; then - NCURSES_WCHAR_T=1 -fi +echo "$as_me:8307: checking if you do not want to assume colors are white-on-black" >&5 +echo $ECHO_N "checking if you do not want to assume colors are white-on-black... $ECHO_C" >&6 -# if we find wchar_t in either place, use substitution to provide a fallback. -if test "$cf_cv_wchar_t" != unknown ; then - NCURSES_OK_WCHAR_T=1 -fi +# Check whether --enable-assumed-color or --disable-assumed-color was given. +if test "${enable_assumed_color+set}" = set; then + enableval="$enable_assumed_color" + with_assumed_color=$enableval +else + with_assumed_color=yes +fi; +echo "$as_me:8317: result: $with_assumed_color" >&5 +echo "${ECHO_T}$with_assumed_color" >&6 +test "$with_assumed_color" = yes && cat >>confdefs.h <<\EOF +#define USE_ASSUMED_COLOR 1 +EOF -# This is needed on Tru64 5.0 to declare wint_t -echo "$as_me:7011: checking if we must include wchar.h to declare wint_t" >&5 -echo $ECHO_N "checking if we must include wchar.h to declare wint_t... $ECHO_C" >&6 -if test "${cf_cv_wint_t+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 +### use option --enable-hashmap to turn on use of hashmap scrolling logic +echo "$as_me:8324: checking if you want hashmap scrolling-optimization code" >&5 +echo $ECHO_N "checking if you want hashmap scrolling-optimization code... $ECHO_C" >&6 + +# Check whether --enable-hashmap or --disable-hashmap was given. +if test "${enable_hashmap+set}" = set; then + enableval="$enable_hashmap" + with_hashmap=$enableval else + with_hashmap=yes +fi; +echo "$as_me:8334: result: $with_hashmap" >&5 +echo "${ECHO_T}$with_hashmap" >&6 +test "$with_hashmap" = yes && cat >>confdefs.h <<\EOF +#define USE_HASHMAP 1 +EOF -cat >conftest.$ac_ext <<_ACEOF -#line 7018 "configure" -#include "confdefs.h" +### use option --enable-colorfgbg to turn on use of $COLORFGBG environment +echo "$as_me:8341: checking if you want colorfgbg code" >&5 +echo $ECHO_N "checking if you want colorfgbg code... $ECHO_C" >&6 -#include -#include -#include -#ifdef HAVE_LIBUTF8_H -#include -#endif -int -main () -{ -wint_t state - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:7036: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:7039: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7042: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7045: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_wint_t=no +# Check whether --enable-colorfgbg or --disable-colorfgbg was given. +if test "${enable_colorfgbg+set}" = set; then + enableval="$enable_colorfgbg" + with_colorfgbg=$enableval else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cat >conftest.$ac_ext <<_ACEOF -#line 7052 "configure" -#include "confdefs.h" + with_colorfgbg=no +fi; +echo "$as_me:8351: result: $with_colorfgbg" >&5 +echo "${ECHO_T}$with_colorfgbg" >&6 +test "$with_colorfgbg" = yes && cat >>confdefs.h <<\EOF +#define USE_COLORFGBG 1 +EOF -#include -#include -#include -#include -#ifdef HAVE_LIBUTF8_H -#include -#endif -int -main () -{ -wint_t value - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:7071: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:7074: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7077: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:7080: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_wint_t=yes +### use option --enable-ext-colors to turn on use of colors beyond 16. +echo "$as_me:8358: checking if you want to use experimental extended colors" >&5 +echo $ECHO_N "checking if you want to use experimental extended colors... $ECHO_C" >&6 + +# Check whether --enable-ext-colors or --disable-ext-colors was given. +if test "${enable_ext_colors+set}" = set; then + enableval="$enable_ext_colors" + with_ext_colors=$enableval else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_cv_wint_t=unknown -fi -rm -f conftest.$ac_objext conftest.$ac_ext -fi -rm -f conftest.$ac_objext conftest.$ac_ext + with_ext_colors=no +fi; +echo "$as_me:8368: result: $with_ext_colors" >&5 +echo "${ECHO_T}$with_ext_colors" >&6 +NCURSES_EXT_COLORS=0 +if test "$with_ext_colors" = yes ; then + if test "$with_widec" != yes ; then + { echo "$as_me:8373: WARNING: This option applies only to wide-character library" >&5 +echo "$as_me: WARNING: This option applies only to wide-character library" >&2;} + else + # cannot be ABI 5 since it changes sizeof(cchar_t) + +if test "${with_abi_version+set}" != set; then + case $cf_cv_rel_version in + 5.*) + cf_cv_rel_version=6.0 + cf_cv_abi_version=6 + { echo "$as_me:8383: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5 +echo "$as_me: WARNING: Overriding ABI version to $cf_cv_abi_version" >&2;} + ;; + esac fi -echo "$as_me:7092: result: $cf_cv_wint_t" >&5 -echo "${ECHO_T}$cf_cv_wint_t" >&6 -if test "$cf_cv_wint_t" = yes ; then + fi + NCURSES_EXT_COLORS=1 cat >>confdefs.h <<\EOF -#define NEED_WCHAR_H 1 +#define NCURSES_EXT_COLORS 1 EOF - NEED_WCHAR_H=1 fi -# if we do not find wint_t in either place, use substitution to provide a fallback. -if test "$cf_cv_wint_t" = unknown ; then - NCURSES_WINT_T=1 -fi +### use option --enable-ext-mouse to modify coding to support 5-button mice +echo "$as_me:8398: checking if you want to use experimental extended mouse encoding" >&5 +echo $ECHO_N "checking if you want to use experimental extended mouse encoding... $ECHO_C" >&6 -# if we find wint_t in either place, use substitution to provide a fallback. -if test "$cf_cv_wint_t" != unknown ; then - NCURSES_OK_WINT_T=1 +# Check whether --enable-ext-mouse or --disable-ext-mouse was given. +if test "${enable_ext_mouse+set}" = set; then + enableval="$enable_ext_mouse" + with_ext_mouse=$enableval +else + with_ext_mouse=no +fi; +echo "$as_me:8408: result: $with_ext_mouse" >&5 +echo "${ECHO_T}$with_ext_mouse" >&6 +NCURSES_MOUSE_VERSION=1 +if test "$with_ext_mouse" = yes ; then + NCURSES_MOUSE_VERSION=2 + +if test "${with_abi_version+set}" != set; then + case $cf_cv_rel_version in + 5.*) + cf_cv_rel_version=6.0 + cf_cv_abi_version=6 + { echo "$as_me:8419: WARNING: Overriding ABI version to $cf_cv_abi_version" >&5 +echo "$as_me: WARNING: Overriding ABI version to $cf_cv_abi_version" >&2;} + ;; + esac fi fi -echo "$as_me:7115: checking for terminal capabilities file" >&5 -echo $ECHO_N "checking for terminal capabilities file... $ECHO_C" >&6 +echo "$as_me:8427: checking if you want experimental safe-sprintf code" >&5 +echo $ECHO_N "checking if you want experimental safe-sprintf code... $ECHO_C" >&6 -# Check whether --with-caps or --without-caps was given. -if test "${with_caps+set}" = set; then - withval="$with_caps" - TERMINFO_CAPS=Caps.$withval +# Check whether --enable-safe-sprintf or --disable-safe-sprintf was given. +if test "${enable_safe_sprintf+set}" = set; then + enableval="$enable_safe_sprintf" + with_safe_sprintf=$enableval else - TERMINFO_CAPS=Caps + with_safe_sprintf=no fi; -test -f ${srcdir}/include/${TERMINFO_CAPS} || TERMINFO_CAPS=Caps -echo "$as_me:7126: result: $TERMINFO_CAPS" >&5 -echo "${ECHO_T}$TERMINFO_CAPS" >&6 +echo "$as_me:8437: result: $with_safe_sprintf" >&5 +echo "${ECHO_T}$with_safe_sprintf" >&6 +test "$with_safe_sprintf" = yes && cat >>confdefs.h <<\EOF +#define USE_SAFE_SPRINTF 1 +EOF + +### use option --disable-scroll-hints to turn off use of scroll-hints scrolling logic +# when hashmap is used scroll hints are useless +if test "$with_hashmap" = no ; then +echo "$as_me:8446: checking if you want to experiment without scrolling-hints code" >&5 +echo $ECHO_N "checking if you want to experiment without scrolling-hints code... $ECHO_C" >&6 + +# Check whether --enable-scroll-hints or --disable-scroll-hints was given. +if test "${enable_scroll_hints+set}" = set; then + enableval="$enable_scroll_hints" + with_scroll_hints=$enableval +else + with_scroll_hints=yes +fi; +echo "$as_me:8456: result: $with_scroll_hints" >&5 +echo "${ECHO_T}$with_scroll_hints" >&6 +test "$with_scroll_hints" = yes && cat >>confdefs.h <<\EOF +#define USE_SCROLL_HINTS 1 +EOF + +fi ############################################################################### ### use option --disable-echo to suppress full display compiling commands -echo "$as_me:7132: checking if you want to display full commands during build" >&5 +echo "$as_me:8467: checking if you want to display full commands during build" >&5 echo $ECHO_N "checking if you want to display full commands during build... $ECHO_C" >&6 # Check whether --enable-echo or --disable-echo was given. @@ -7145,11 +8480,11 @@ else ECHO_LINK='@ echo linking $@ ... ;' test -n "$LIBTOOL" && LIBTOOL="$LIBTOOL --silent" fi -echo "$as_me:7148: result: $with_echo" >&5 +echo "$as_me:8483: result: $with_echo" >&5 echo "${ECHO_T}$with_echo" >&6 ### use option --enable-warnings to turn on all gcc warnings -echo "$as_me:7152: checking if you want to see compiler warnings" >&5 +echo "$as_me:8487: checking if you want to see compiler warnings" >&5 echo $ECHO_N "checking if you want to see compiler warnings... $ECHO_C" >&6 # Check whether --enable-warnings or --disable-warnings was given. @@ -7157,19 +8492,116 @@ if test "${enable_warnings+set}" = set; then enableval="$enable_warnings" with_warnings=$enableval fi; -echo "$as_me:7160: result: $with_warnings" >&5 +echo "$as_me:8495: result: $with_warnings" >&5 echo "${ECHO_T}$with_warnings" >&6 if test -n "$with_warnings"; then ADAFLAGS="$ADAFLAGS -gnatg" -if test "$GCC" = yes -then - cat > conftest.$ac_ext <&5 +echo $ECHO_N "checking if this is really Intel C compiler... $ECHO_C" >&6 + cf_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -no-gcc" + cat >conftest.$ac_ext <<_ACEOF +#line 8511 "configure" +#include "confdefs.h" + +int +main () +{ + +#ifdef __INTEL_COMPILER +#else +make an error +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8528: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8531: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8534: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8537: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + INTEL_COMPILER=yes +cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CFLAGS="$cf_save_CFLAGS" + echo "$as_me:8548: result: $INTEL_COMPILER" >&5 +echo "${ECHO_T}$INTEL_COMPILER" >&6 + ;; + esac +fi + +cat > conftest.$ac_ext <&5 + +if test "$INTEL_COMPILER" = yes +then +# The "-wdXXX" options suppress warnings: +# remark #1419: external declaration in primary source file +# remark #1682: implicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) +# remark #1683: explicit conversion of a 64-bit integral type to a smaller integral type (potential portability problem) +# remark #1684: conversion from pointer to same-sized integral type (potential portability problem) +# remark #193: zero used for undefined preprocessing identifier +# remark #593: variable "curs_sb_left_arrow" was set but never used +# remark #810: conversion from "int" to "Dimension={unsigned short}" may lose significant bits +# remark #869: parameter "tw" was never referenced +# remark #981: operands are evaluated in unspecified order +# warning #269: invalid format string conversion + + { echo "$as_me:8573: checking for $CC warning options..." >&5 +echo "$as_me: checking for $CC warning options..." >&6;} + cf_save_CFLAGS="$CFLAGS" + EXTRA_CFLAGS="-Wall" + for cf_opt in \ + wd1419 \ + wd1682 \ + wd1683 \ + wd1684 \ + wd193 \ + wd279 \ + wd593 \ + wd810 \ + wd869 \ + wd981 + do + CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" + if { (eval echo "$as_me:8590: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8593: \$? = $ac_status" >&5 + (exit $ac_status); }; then + test -n "$verbose" && echo "$as_me:8595: result: ... -$cf_opt" >&5 +echo "${ECHO_T}... -$cf_opt" >&6 + EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" + fi + done + CFLAGS="$cf_save_CFLAGS" + +elif test "$GCC" = yes +then + { echo "$as_me:8604: checking for $CC warning options..." >&5 echo "$as_me: checking for $CC warning options..." >&6;} cf_save_CFLAGS="$CFLAGS" EXTRA_CFLAGS="-W -Wall" @@ -7189,12 +8621,12 @@ echo "$as_me: checking for $CC warning options..." >&6;} Wundef $cf_warn_CONST do CFLAGS="$cf_save_CFLAGS $EXTRA_CFLAGS -$cf_opt" - if { (eval echo "$as_me:7192: \"$ac_compile\"") >&5 + if { (eval echo "$as_me:8624: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:7195: \$? = $ac_status" >&5 + echo "$as_me:8627: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:7197: result: ... -$cf_opt" >&5 + test -n "$verbose" && echo "$as_me:8629: result: ... -$cf_opt" >&5 echo "${ECHO_T}... -$cf_opt" >&6 case $cf_opt in #(vi Wcast-qual) #(vi @@ -7212,10 +8644,174 @@ echo "${ECHO_T}... -$cf_opt" >&6 EXTRA_CFLAGS="$EXTRA_CFLAGS -$cf_opt" fi done - rm -f conftest* CFLAGS="$cf_save_CFLAGS" fi +rm -f conftest* + + if test "$cf_with_cxx" = yes ; then + +INTEL_CPLUSPLUS=no + +if test "$GCC" = yes ; then + case $host_os in + linux*|gnu*) + echo "$as_me:8658: checking if this is really Intel C++ compiler" >&5 +echo $ECHO_N "checking if this is really Intel C++ compiler... $ECHO_C" >&6 + cf_save_CFLAGS="$CXXFLAGS" + CXXFLAGS="$CXXFLAGS -no-gcc" + cat >conftest.$ac_ext <<_ACEOF +#line 8663 "configure" +#include "confdefs.h" + +int +main () +{ + +#ifdef __INTEL_COMPILER +#else +make an error +#endif + + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:8680: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8683: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:8686: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:8689: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + INTEL_CPLUSPLUS=yes +cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" + +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +fi +rm -f conftest.$ac_objext conftest.$ac_ext + CXXFLAGS="$cf_save_CFLAGS" + echo "$as_me:8700: result: $INTEL_CPLUSPLUS" >&5 +echo "${ECHO_T}$INTEL_CPLUSPLUS" >&6 + ;; + esac +fi + +ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +cat > conftest.$ac_ext <&5 +echo "$as_me: checking for $CC warning options..." >&6;} + cf_save_CXXFLAGS="$CXXFLAGS" + EXTRA_CXXFLAGS="-Wall" + for cf_opt in \ + wd1419 \ + wd1682 \ + wd1683 \ + wd1684 \ + wd193 \ + wd279 \ + wd593 \ + wd810 \ + wd869 \ + wd981 + do + CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -$cf_opt" + if { (eval echo "$as_me:8748: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8751: \$? = $ac_status" >&5 + (exit $ac_status); }; then + test -n "$verbose" && echo "$as_me:8753: result: ... -$cf_opt" >&5 +echo "${ECHO_T}... -$cf_opt" >&6 + EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt" + fi + done + CXXFLAGS="$cf_save_CXXFLAGS" + +elif test "$GXX" = yes +then + { echo "$as_me:8762: checking for $CXX warning options..." >&5 +echo "$as_me: checking for $CXX warning options..." >&6;} + cf_save_CXXFLAGS="$CXXFLAGS" + EXTRA_CXXFLAGS="-W -Wall" + cf_gxx_extra_warnings="" + test "$with_ext_const" = yes && cf_gxx_extra_warnings="Wwrite-strings" + case "$GCC_VERSION" in + [1-2].*) + ;; + *) + cf_gxx_extra_warnings="$cf_gxx_extra_warnings Weffc++" + ;; + esac + for cf_opt in \ + Wabi \ + fabi-version=0 \ + Woverloaded-virtual \ + Wsign-promo \ + Wsynth \ + Wold-style-cast \ + Wcast-align \ + Wcast-qual \ + Wmissing-prototypes \ + Wpointer-arith \ + Wshadow \ + Wstrict-prototypes \ + Wundef $cf_gxx_extra_warnings Wno-unused + do + CXXFLAGS="$cf_save_CXXFLAGS $EXTRA_CXXFLAGS -Werror -$cf_opt" + if { (eval echo "$as_me:8791: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:8794: \$? = $ac_status" >&5 + (exit $ac_status); }; then + test -n "$verbose" && echo "$as_me:8796: result: ... -$cf_opt" >&5 +echo "${ECHO_T}... -$cf_opt" >&6 + EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS -$cf_opt" + else + test -n "$verbose" && echo "$as_me:8800: result: ... no -$cf_opt" >&5 +echo "${ECHO_T}... no -$cf_opt" >&6 + fi + done + CXXFLAGS="$cf_save_CXXFLAGS" +fi + +rm -f conftest* +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + fi fi if test "$GCC" = yes @@ -7236,10 +8832,10 @@ cat > conftest.i <&5 + { echo "$as_me:8835: checking for $CC __attribute__ directives..." >&5 echo "$as_me: checking for $CC __attribute__ directives..." >&6;} cat > conftest.$ac_ext <&5 case $cf_attribute in scanf|printf) cat >conftest.h <conftest.h <&5 + if { (eval echo "$as_me:8876: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:7283: \$? = $ac_status" >&5 + echo "$as_me:8879: \$? = $ac_status" >&5 (exit $ac_status); }; then - test -n "$verbose" && echo "$as_me:7285: result: ... $cf_attribute" >&5 + test -n "$verbose" && echo "$as_me:8881: result: ... $cf_attribute" >&5 echo "${ECHO_T}... $cf_attribute" >&6 cat conftest.h >>confdefs.h fi @@ -7294,7 +8890,7 @@ rm -rf conftest* fi ### use option --enable-assertions to turn on generation of assertion code -echo "$as_me:7297: checking if you want to enable runtime assertions" >&5 +echo "$as_me:8893: checking if you want to enable runtime assertions" >&5 echo $ECHO_N "checking if you want to enable runtime assertions... $ECHO_C" >&6 # Check whether --enable-assertions or --disable-assertions was given. @@ -7304,7 +8900,7 @@ if test "${enable_assertions+set}" = set; then else with_assertions=no fi; -echo "$as_me:7307: result: $with_assertions" >&5 +echo "$as_me:8903: result: $with_assertions" >&5 echo "${ECHO_T}$with_assertions" >&6 if test -n "$GCC" then @@ -7365,7 +8961,7 @@ case "$CFLAGS $CPPFLAGS" in ;; esac -echo "$as_me:7368: checking whether to add trace feature to all models" >&5 +echo "$as_me:8964: checking whether to add trace feature to all models" >&5 echo $ECHO_N "checking whether to add trace feature to all models... $ECHO_C" >&6 # Check whether --with-trace or --without-trace was given. @@ -7375,19 +8971,41 @@ if test "${with_trace+set}" = set; then else cf_with_trace=$cf_all_traces fi; -echo "$as_me:7378: result: $with_trace" >&5 -echo "${ECHO_T}$with_trace" >&6 +echo "$as_me:8974: result: $cf_with_trace" >&5 +echo "${ECHO_T}$cf_with_trace" >&6 if test "$cf_with_trace" = yes ; then LIB_TRACING=all ADA_TRACE=TRUE +cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= +cf_new_extra_cppflags= + for cf_add_cflags in -DTRACE do +case $cf_fix_cppflags in +no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; @@ -7400,6 +9018,17 @@ do cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac done if test -n "$cf_new_cflags" ; then @@ -7412,19 +9041,24 @@ if test -n "$cf_new_cppflags" ; then CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + else LIB_TRACING=DEBUG ADA_TRACE=FALSE fi ### Checks for libraries. -echo "$as_me:7421: checking for gettimeofday" >&5 +echo "$as_me:9055: checking for gettimeofday" >&5 echo $ECHO_N "checking for gettimeofday... $ECHO_C" >&6 if test "${ac_cv_func_gettimeofday+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7427 "configure" +#line 9061 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char gettimeofday (); below. */ @@ -7455,16 +9089,16 @@ f = gettimeofday; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7458: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9092: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7461: \$? = $ac_status" >&5 + echo "$as_me:9095: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7464: \"$ac_try\"") >&5 + { (eval echo "$as_me:9098: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7467: \$? = $ac_status" >&5 + echo "$as_me:9101: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_gettimeofday=yes else @@ -7474,7 +9108,7 @@ ac_cv_func_gettimeofday=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:7477: result: $ac_cv_func_gettimeofday" >&5 +echo "$as_me:9111: result: $ac_cv_func_gettimeofday" >&5 echo "${ECHO_T}$ac_cv_func_gettimeofday" >&6 if test $ac_cv_func_gettimeofday = yes; then cat >>confdefs.h <<\EOF @@ -7483,7 +9117,7 @@ EOF else -echo "$as_me:7486: checking for gettimeofday in -lbsd" >&5 +echo "$as_me:9120: checking for gettimeofday in -lbsd" >&5 echo $ECHO_N "checking for gettimeofday in -lbsd... $ECHO_C" >&6 if test "${ac_cv_lib_bsd_gettimeofday+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -7491,7 +9125,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lbsd $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 7494 "configure" +#line 9128 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -7510,16 +9144,16 @@ gettimeofday (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7513: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9147: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7516: \$? = $ac_status" >&5 + echo "$as_me:9150: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7519: \"$ac_try\"") >&5 + { (eval echo "$as_me:9153: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7522: \$? = $ac_status" >&5 + echo "$as_me:9156: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_bsd_gettimeofday=yes else @@ -7530,7 +9164,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:7533: result: $ac_cv_lib_bsd_gettimeofday" >&5 +echo "$as_me:9167: result: $ac_cv_lib_bsd_gettimeofday" >&5 echo "${ECHO_T}$ac_cv_lib_bsd_gettimeofday" >&6 if test $ac_cv_lib_bsd_gettimeofday = yes; then cat >>confdefs.h <<\EOF @@ -7542,14 +9176,14 @@ fi fi -echo "$as_me:7545: checking if -lm needed for math functions" >&5 +echo "$as_me:9179: checking if -lm needed for math functions" >&5 echo $ECHO_N "checking if -lm needed for math functions... $ECHO_C" >&6 if test "${cf_cv_need_libm+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7552 "configure" +#line 9186 "configure" #include "confdefs.h" #include @@ -7564,16 +9198,16 @@ double x = rand(); printf("result = %g\n", sin(x)) } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7567: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9201: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7570: \$? = $ac_status" >&5 + echo "$as_me:9204: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7573: \"$ac_try\"") >&5 + { (eval echo "$as_me:9207: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7576: \$? = $ac_status" >&5 + echo "$as_me:9210: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_need_libm=no else @@ -7583,7 +9217,7 @@ cf_cv_need_libm=yes fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:7586: result: $cf_cv_need_libm" >&5 +echo "$as_me:9220: result: $cf_cv_need_libm" >&5 echo "${ECHO_T}$cf_cv_need_libm" >&6 if test "$cf_cv_need_libm" = yes then @@ -7591,13 +9225,13 @@ MATH_LIB=-lm fi ### Checks for header files. -echo "$as_me:7594: checking for ANSI C header files" >&5 +echo "$as_me:9228: checking for ANSI C header files" >&5 echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6 if test "${ac_cv_header_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7600 "configure" +#line 9234 "configure" #include "confdefs.h" #include #include @@ -7605,13 +9239,13 @@ else #include _ACEOF -if { (eval echo "$as_me:7608: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:9242: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:7614: \$? = $ac_status" >&5 + echo "$as_me:9248: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -7633,7 +9267,7 @@ rm -f conftest.err conftest.$ac_ext if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line 7636 "configure" +#line 9270 "configure" #include "confdefs.h" #include @@ -7651,7 +9285,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat >conftest.$ac_ext <<_ACEOF -#line 7654 "configure" +#line 9288 "configure" #include "confdefs.h" #include @@ -7672,7 +9306,7 @@ if test $ac_cv_header_stdc = yes; then : else cat >conftest.$ac_ext <<_ACEOF -#line 7675 "configure" +#line 9309 "configure" #include "confdefs.h" #include #if ((' ' & 0x0FF) == 0x020) @@ -7698,15 +9332,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:7701: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9335: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7704: \$? = $ac_status" >&5 + echo "$as_me:9338: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:7706: \"$ac_try\"") >&5 + { (eval echo "$as_me:9340: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7709: \$? = $ac_status" >&5 + echo "$as_me:9343: \$? = $ac_status" >&5 (exit $ac_status); }; }; then : else @@ -7719,7 +9353,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi fi -echo "$as_me:7722: result: $ac_cv_header_stdc" >&5 +echo "$as_me:9356: result: $ac_cv_header_stdc" >&5 echo "${ECHO_T}$ac_cv_header_stdc" >&6 if test $ac_cv_header_stdc = yes; then @@ -7732,13 +9366,13 @@ fi ac_header_dirent=no for ac_hdr in dirent.h sys/ndir.h sys/dir.h ndir.h; do as_ac_Header=`echo "ac_cv_header_dirent_$ac_hdr" | $as_tr_sh` -echo "$as_me:7735: checking for $ac_hdr that defines DIR" >&5 +echo "$as_me:9369: checking for $ac_hdr that defines DIR" >&5 echo $ECHO_N "checking for $ac_hdr that defines DIR... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7741 "configure" +#line 9375 "configure" #include "confdefs.h" #include #include <$ac_hdr> @@ -7753,16 +9387,16 @@ return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:7756: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9390: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:7759: \$? = $ac_status" >&5 + echo "$as_me:9393: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7762: \"$ac_try\"") >&5 + { (eval echo "$as_me:9396: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7765: \$? = $ac_status" >&5 + echo "$as_me:9399: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_Header=yes" else @@ -7772,7 +9406,7 @@ eval "$as_ac_Header=no" fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:7775: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:9409: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 + echo "$as_me:9422: checking for opendir in -ldir" >&5 echo $ECHO_N "checking for opendir in -ldir... $ECHO_C" >&6 if test "${ac_cv_lib_dir_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -7793,7 +9427,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-ldir $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 7796 "configure" +#line 9430 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -7812,16 +9446,16 @@ opendir (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7815: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9449: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7818: \$? = $ac_status" >&5 + echo "$as_me:9452: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7821: \"$ac_try\"") >&5 + { (eval echo "$as_me:9455: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7824: \$? = $ac_status" >&5 + echo "$as_me:9458: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_dir_opendir=yes else @@ -7832,14 +9466,14 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:7835: result: $ac_cv_lib_dir_opendir" >&5 +echo "$as_me:9469: result: $ac_cv_lib_dir_opendir" >&5 echo "${ECHO_T}$ac_cv_lib_dir_opendir" >&6 if test $ac_cv_lib_dir_opendir = yes; then LIBS="$LIBS -ldir" fi else - echo "$as_me:7842: checking for opendir in -lx" >&5 + echo "$as_me:9476: checking for opendir in -lx" >&5 echo $ECHO_N "checking for opendir in -lx... $ECHO_C" >&6 if test "${ac_cv_lib_x_opendir+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -7847,7 +9481,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lx $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 7850 "configure" +#line 9484 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -7866,16 +9500,16 @@ opendir (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7869: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9503: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7872: \$? = $ac_status" >&5 + echo "$as_me:9506: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7875: \"$ac_try\"") >&5 + { (eval echo "$as_me:9509: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7878: \$? = $ac_status" >&5 + echo "$as_me:9512: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_x_opendir=yes else @@ -7886,7 +9520,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:7889: result: $ac_cv_lib_x_opendir" >&5 +echo "$as_me:9523: result: $ac_cv_lib_x_opendir" >&5 echo "${ECHO_T}$ac_cv_lib_x_opendir" >&6 if test $ac_cv_lib_x_opendir = yes; then LIBS="$LIBS -lx" @@ -7894,13 +9528,13 @@ fi fi -echo "$as_me:7897: checking whether time.h and sys/time.h may both be included" >&5 +echo "$as_me:9531: checking whether time.h and sys/time.h may both be included" >&5 echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6 if test "${ac_cv_header_time+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7903 "configure" +#line 9537 "configure" #include "confdefs.h" #include #include @@ -7916,16 +9550,16 @@ return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:7919: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9553: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:7922: \$? = $ac_status" >&5 + echo "$as_me:9556: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:7925: \"$ac_try\"") >&5 + { (eval echo "$as_me:9559: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7928: \$? = $ac_status" >&5 + echo "$as_me:9562: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_header_time=yes else @@ -7935,7 +9569,7 @@ ac_cv_header_time=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:7938: result: $ac_cv_header_time" >&5 +echo "$as_me:9572: result: $ac_cv_header_time" >&5 echo "${ECHO_T}$ac_cv_header_time" >&6 if test $ac_cv_header_time = yes; then @@ -7945,14 +9579,14 @@ EOF fi -echo "$as_me:7948: checking for regular-expression headers" >&5 +echo "$as_me:9582: checking for regular-expression headers" >&5 echo $ECHO_N "checking for regular-expression headers... $ECHO_C" >&6 if test "${cf_cv_regex+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 7955 "configure" +#line 9589 "configure" #include "confdefs.h" #include #include @@ -7970,16 +9604,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:7973: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9607: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:7976: \$? = $ac_status" >&5 + echo "$as_me:9610: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:7979: \"$ac_try\"") >&5 + { (eval echo "$as_me:9613: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:7982: \$? = $ac_status" >&5 + echo "$as_me:9616: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_regex="regex.h" else @@ -7987,7 +9621,7 @@ else cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 7990 "configure" +#line 9624 "configure" #include "confdefs.h" #include int @@ -8002,16 +9636,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8005: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9639: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8008: \$? = $ac_status" >&5 + echo "$as_me:9642: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8011: \"$ac_try\"") >&5 + { (eval echo "$as_me:9645: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8014: \$? = $ac_status" >&5 + echo "$as_me:9648: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_regex="regexp.h" else @@ -8021,7 +9655,7 @@ cat conftest.$ac_ext >&5 cf_save_LIBS="$LIBS" LIBS="-lgen $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8024 "configure" +#line 9658 "configure" #include "confdefs.h" #include int @@ -8036,16 +9670,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8039: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9673: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8042: \$? = $ac_status" >&5 + echo "$as_me:9676: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8045: \"$ac_try\"") >&5 + { (eval echo "$as_me:9679: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8048: \$? = $ac_status" >&5 + echo "$as_me:9682: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_regex="regexpr.h" else @@ -8061,7 +9695,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:8064: result: $cf_cv_regex" >&5 +echo "$as_me:9698: result: $cf_cv_regex" >&5 echo "${ECHO_T}$cf_cv_regex" >&6 case $cf_cv_regex in regex.h) cat >>confdefs.h <<\EOF @@ -8081,7 +9715,6 @@ esac for ac_header in \ fcntl.h \ getopt.h \ -libc.h \ limits.h \ locale.h \ poll.h \ @@ -8094,26 +9727,27 @@ sys/time.h \ sys/times.h \ ttyent.h \ unistd.h \ -wctype.h +wctype.h \ + do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:8100: checking for $ac_header" >&5 +echo "$as_me:9734: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8106 "configure" +#line 9740 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:8110: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:9744: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:8116: \$? = $ac_status" >&5 + echo "$as_me:9750: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -8132,7 +9766,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:8135: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:9769: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h < to declare fd_set if test "$ISC" = yes ; then -echo "$as_me:8149: checking for main in -lcposix" >&5 +echo "$as_me:9783: checking for main in -lcposix" >&5 echo $ECHO_N "checking for main in -lcposix... $ECHO_C" >&6 if test "${ac_cv_lib_cposix_main+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8154,7 +9788,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-lcposix $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8157 "configure" +#line 9791 "configure" #include "confdefs.h" int @@ -8166,16 +9800,16 @@ main (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8169: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9803: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8172: \$? = $ac_status" >&5 + echo "$as_me:9806: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8175: \"$ac_try\"") >&5 + { (eval echo "$as_me:9809: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8178: \$? = $ac_status" >&5 + echo "$as_me:9812: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_cposix_main=yes else @@ -8186,7 +9820,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:8189: result: $ac_cv_lib_cposix_main" >&5 +echo "$as_me:9823: result: $ac_cv_lib_cposix_main" >&5 echo "${ECHO_T}$ac_cv_lib_cposix_main" >&6 if test $ac_cv_lib_cposix_main = yes; then cat >>confdefs.h <&5 + echo "$as_me:9834: checking for bzero in -linet" >&5 echo $ECHO_N "checking for bzero in -linet... $ECHO_C" >&6 if test "${ac_cv_lib_inet_bzero+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8205,7 +9839,7 @@ else ac_check_lib_save_LIBS=$LIBS LIBS="-linet $LIBS" cat >conftest.$ac_ext <<_ACEOF -#line 8208 "configure" +#line 9842 "configure" #include "confdefs.h" /* Override any gcc2 internal prototype to avoid an error. */ @@ -8224,16 +9858,16 @@ bzero (); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8227: \"$ac_link\"") >&5 +if { (eval echo "$as_me:9861: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8230: \$? = $ac_status" >&5 + echo "$as_me:9864: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8233: \"$ac_try\"") >&5 + { (eval echo "$as_me:9867: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8236: \$? = $ac_status" >&5 + echo "$as_me:9870: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_lib_inet_bzero=yes else @@ -8244,21 +9878,21 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -echo "$as_me:8247: result: $ac_cv_lib_inet_bzero" >&5 +echo "$as_me:9881: result: $ac_cv_lib_inet_bzero" >&5 echo "${ECHO_T}$ac_cv_lib_inet_bzero" >&6 if test $ac_cv_lib_inet_bzero = yes; then LIBS="$LIBS -linet" fi fi -echo "$as_me:8254: checking if sys/time.h works with sys/select.h" >&5 +echo "$as_me:9888: checking if sys/time.h works with sys/select.h" >&5 echo $ECHO_N "checking if sys/time.h works with sys/select.h... $ECHO_C" >&6 if test "${cf_cv_sys_time_select+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8261 "configure" +#line 9895 "configure" #include "confdefs.h" #include @@ -8278,16 +9912,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8281: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:9915: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8284: \$? = $ac_status" >&5 + echo "$as_me:9918: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8287: \"$ac_try\"") >&5 + { (eval echo "$as_me:9921: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8290: \$? = $ac_status" >&5 + echo "$as_me:9924: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_sys_time_select=yes else @@ -8299,7 +9933,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:8302: result: $cf_cv_sys_time_select" >&5 +echo "$as_me:9936: result: $cf_cv_sys_time_select" >&5 echo "${ECHO_T}$cf_cv_sys_time_select" >&6 test "$cf_cv_sys_time_select" = yes && cat >>confdefs.h <<\EOF #define HAVE_SYS_TIME_SELECT 1 @@ -8312,7 +9946,7 @@ ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_c_compiler_gnu -echo "$as_me:8315: checking for $CC option to accept ANSI C" >&5 +echo "$as_me:9949: checking for $CC option to accept ANSI C" >&5 echo $ECHO_N "checking for $CC option to accept ANSI C... $ECHO_C" >&6 if test "${ac_cv_prog_cc_stdc+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8320,7 +9954,7 @@ else ac_cv_prog_cc_stdc=no ac_save_CC=$CC cat >conftest.$ac_ext <<_ACEOF -#line 8323 "configure" +#line 9957 "configure" #include "confdefs.h" #include #include @@ -8369,16 +10003,16 @@ for ac_arg in "" -qlanglvl=ansi -std1 -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIO do CC="$ac_save_CC $ac_arg" rm -f conftest.$ac_objext -if { (eval echo "$as_me:8372: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10006: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8375: \$? = $ac_status" >&5 + echo "$as_me:10009: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8378: \"$ac_try\"") >&5 + { (eval echo "$as_me:10012: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8381: \$? = $ac_status" >&5 + echo "$as_me:10015: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_prog_cc_stdc=$ac_arg break @@ -8395,21 +10029,21 @@ fi case "x$ac_cv_prog_cc_stdc" in x|xno) - echo "$as_me:8398: result: none needed" >&5 + echo "$as_me:10032: result: none needed" >&5 echo "${ECHO_T}none needed" >&6 ;; *) - echo "$as_me:8401: result: $ac_cv_prog_cc_stdc" >&5 + echo "$as_me:10035: result: $ac_cv_prog_cc_stdc" >&5 echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6 CC="$CC $ac_cv_prog_cc_stdc" ;; esac -echo "$as_me:8406: checking for an ANSI C-conforming const" >&5 +echo "$as_me:10040: checking for an ANSI C-conforming const" >&5 echo $ECHO_N "checking for an ANSI C-conforming const... $ECHO_C" >&6 if test "${ac_cv_c_const+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8412 "configure" +#line 10046 "configure" #include "confdefs.h" int @@ -8467,16 +10101,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8470: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10104: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8473: \$? = $ac_status" >&5 + echo "$as_me:10107: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8476: \"$ac_try\"") >&5 + { (eval echo "$as_me:10110: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8479: \$? = $ac_status" >&5 + echo "$as_me:10113: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_const=yes else @@ -8486,7 +10120,7 @@ ac_cv_c_const=no fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:8489: result: $ac_cv_c_const" >&5 +echo "$as_me:10123: result: $ac_cv_c_const" >&5 echo "${ECHO_T}$ac_cv_c_const" >&6 if test $ac_cv_c_const = no; then @@ -8496,7 +10130,7 @@ EOF fi -echo "$as_me:8499: checking for inline" >&5 +echo "$as_me:10133: checking for inline" >&5 echo $ECHO_N "checking for inline... $ECHO_C" >&6 if test "${ac_cv_c_inline+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8504,7 +10138,7 @@ else ac_cv_c_inline=no for ac_kw in inline __inline__ __inline; do cat >conftest.$ac_ext <<_ACEOF -#line 8507 "configure" +#line 10141 "configure" #include "confdefs.h" #ifndef __cplusplus static $ac_kw int static_foo () {return 0; } @@ -8513,16 +10147,16 @@ $ac_kw int foo () {return 0; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8516: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10150: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8519: \$? = $ac_status" >&5 + echo "$as_me:10153: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8522: \"$ac_try\"") >&5 + { (eval echo "$as_me:10156: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8525: \$? = $ac_status" >&5 + echo "$as_me:10159: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_c_inline=$ac_kw; break else @@ -8533,7 +10167,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:8536: result: $ac_cv_c_inline" >&5 +echo "$as_me:10170: result: $ac_cv_c_inline" >&5 echo "${ECHO_T}$ac_cv_c_inline" >&6 case $ac_cv_c_inline in inline | yes) ;; @@ -8552,50 +10186,9 @@ test "$ac_cv_c_inline" != no && cat >>confdefs.h <<\EOF #define CC_HAS_INLINE_FUNCS 1 EOF -echo "$as_me:8555: checking if unsigned literals are legal" >&5 -echo $ECHO_N "checking if unsigned literals are legal... $ECHO_C" >&6 -if test "${cf_cv_unsigned_literals+set}" = set; then - echo $ECHO_N "(cached) $ECHO_C" >&6 -else - - cat >conftest.$ac_ext <<_ACEOF -#line 8562 "configure" -#include "confdefs.h" - -int -main () -{ -long x = 1L + 1UL + 1U + 1 - ; - return 0; -} -_ACEOF -rm -f conftest.$ac_objext -if { (eval echo "$as_me:8574: \"$ac_compile\"") >&5 - (eval $ac_compile) 2>&5 - ac_status=$? - echo "$as_me:8577: \$? = $ac_status" >&5 - (exit $ac_status); } && - { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8580: \"$ac_try\"") >&5 - (eval $ac_try) 2>&5 - ac_status=$? - echo "$as_me:8583: \$? = $ac_status" >&5 - (exit $ac_status); }; }; then - cf_cv_unsigned_literals=yes -else - echo "$as_me: failed program was:" >&5 -cat conftest.$ac_ext >&5 -cf_cv_unsigned_literals=no -fi -rm -f conftest.$ac_objext conftest.$ac_ext - -fi +if test $NCURSES_CHTYPE = auto ; then -echo "$as_me:8595: result: $cf_cv_unsigned_literals" >&5 -echo "${ECHO_T}$cf_cv_unsigned_literals" >&6 - -echo "$as_me:8598: checking for type of chtype" >&5 +echo "$as_me:10191: checking for type of chtype" >&5 echo $ECHO_N "checking for type of chtype... $ECHO_C" >&6 if test "${cf_cv_typeof_chtype+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8605,34 +10198,22 @@ else cf_cv_typeof_chtype=long else cat >conftest.$ac_ext <<_ACEOF -#line 8608 "configure" +#line 10201 "configure" #include "confdefs.h" -#ifdef USE_WIDEC_SUPPORT -#include /* we want wchar_t */ -#define WANT_BITS 39 -#else #define WANT_BITS 31 -#endif #include int main() { FILE *fp = fopen("cf_test.out", "w"); if (fp != 0) { char *result = "long"; -#ifdef USE_WIDEC_SUPPORT - /* - * If wchar_t is smaller than a long, it must be an int or a - * short. We prefer not to use a short anyway. - */ - if (sizeof(unsigned long) > sizeof(wchar_t)) - result = "int"; -#endif if (sizeof(unsigned long) > sizeof(unsigned int)) { int n; - unsigned int x; + unsigned int x, y; for (n = 0; n < WANT_BITS; n++) { - unsigned int y = (x >> n); + x = (1 << n); + y = (x >> n); if (y != 1 || x == 0) { x = 0; break; @@ -8652,15 +10233,15 @@ int main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:8655: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10236: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8658: \$? = $ac_status" >&5 + echo "$as_me:10239: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:8660: \"$ac_try\"") >&5 + { (eval echo "$as_me:10241: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8663: \$? = $ac_status" >&5 + echo "$as_me:10244: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_typeof_chtype=`cat cf_test.out` else @@ -8675,27 +10256,80 @@ fi fi -echo "$as_me:8678: result: $cf_cv_typeof_chtype" >&5 +echo "$as_me:10259: result: $cf_cv_typeof_chtype" >&5 echo "${ECHO_T}$cf_cv_typeof_chtype" >&6 cat >>confdefs.h <&5 +echo $ECHO_N "checking if unsigned literals are legal... $ECHO_C" >&6 +if test "${cf_cv_unsigned_literals+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + cat >conftest.$ac_ext <<_ACEOF +#line 10277 "configure" +#include "confdefs.h" + +int +main () +{ +long x = 1L + 1UL + 1U + 1 + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:10289: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:10292: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:10295: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10298: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_unsigned_literals=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_unsigned_literals=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + +fi + +echo "$as_me:10310: result: $cf_cv_unsigned_literals" >&5 +echo "${ECHO_T}$cf_cv_unsigned_literals" >&6 + cf_cv_1UL="1" test "$cf_cv_unsigned_literals" = yes && cf_cv_1UL="${cf_cv_1UL}U" test "$cf_cv_typeof_chtype" = long && cf_cv_1UL="${cf_cv_1UL}L" +if test $NCURSES_MMASK_T = auto ; then + cf_cv_typeof_mmask_t=long +else + cf_cv_typeof_mmask_t=$NCURSES_MMASK_T +fi + ### Checks for external-data -echo "$as_me:8691: checking if external errno is declared" >&5 +echo "$as_me:10325: checking if external errno is declared" >&5 echo $ECHO_N "checking if external errno is declared... $ECHO_C" >&6 if test "${cf_cv_dcl_errno+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8698 "configure" +#line 10332 "configure" #include "confdefs.h" #ifdef HAVE_STDLIB_H @@ -8713,16 +10347,16 @@ long x = (long) errno } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:8716: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10350: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8719: \$? = $ac_status" >&5 + echo "$as_me:10353: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:8722: \"$ac_try\"") >&5 + { (eval echo "$as_me:10356: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8725: \$? = $ac_status" >&5 + echo "$as_me:10359: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_dcl_errno=yes else @@ -8733,7 +10367,7 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:8736: result: $cf_cv_dcl_errno" >&5 +echo "$as_me:10370: result: $cf_cv_dcl_errno" >&5 echo "${ECHO_T}$cf_cv_dcl_errno" >&6 if test "$cf_cv_dcl_errno" = no ; then @@ -8748,14 +10382,14 @@ fi # It's possible (for near-UNIX clones) that the data doesn't exist -echo "$as_me:8751: checking if external errno exists" >&5 +echo "$as_me:10385: checking if external errno exists" >&5 echo $ECHO_N "checking if external errno exists... $ECHO_C" >&6 if test "${cf_cv_have_errno+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8758 "configure" +#line 10392 "configure" #include "confdefs.h" #undef errno @@ -8770,16 +10404,16 @@ errno = 2 } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8773: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10407: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8776: \$? = $ac_status" >&5 + echo "$as_me:10410: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8779: \"$ac_try\"") >&5 + { (eval echo "$as_me:10413: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8782: \$? = $ac_status" >&5 + echo "$as_me:10416: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_have_errno=yes else @@ -8790,7 +10424,7 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:8793: result: $cf_cv_have_errno" >&5 +echo "$as_me:10427: result: $cf_cv_have_errno" >&5 echo "${ECHO_T}$cf_cv_have_errno" >&6 if test "$cf_cv_have_errno" = yes ; then @@ -8803,7 +10437,7 @@ EOF fi -echo "$as_me:8806: checking if data-only library module links" >&5 +echo "$as_me:10440: checking if data-only library module links" >&5 echo $ECHO_N "checking if data-only library module links... $ECHO_C" >&6 if test "${cf_cv_link_dataonly+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -8811,20 +10445,20 @@ else rm -f conftest.a cat >conftest.$ac_ext <&5 + if { (eval echo "$as_me:10451: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8820: \$? = $ac_status" >&5 + echo "$as_me:10454: \$? = $ac_status" >&5 (exit $ac_status); } ; then mv conftest.o data.o && \ ( $AR $AR_OPTS conftest.a data.o ) 2>&5 1>/dev/null fi rm -f conftest.$ac_ext data.o cat >conftest.$ac_ext <&5 + if { (eval echo "$as_me:10474: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:8843: \$? = $ac_status" >&5 + echo "$as_me:10477: \$? = $ac_status" >&5 (exit $ac_status); }; then mv conftest.o func.o && \ ( $AR $AR_OPTS conftest.a func.o ) 2>&5 1>/dev/null @@ -8853,7 +10487,7 @@ EOF cf_cv_link_dataonly=unknown else cat >conftest.$ac_ext <<_ACEOF -#line 8856 "configure" +#line 10490 "configure" #include "confdefs.h" int main() @@ -8864,15 +10498,15 @@ else _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:8867: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10501: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8870: \$? = $ac_status" >&5 + echo "$as_me:10504: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:8872: \"$ac_try\"") >&5 + { (eval echo "$as_me:10506: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8875: \$? = $ac_status" >&5 + echo "$as_me:10509: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_link_dataonly=yes else @@ -8887,7 +10521,7 @@ fi fi -echo "$as_me:8890: result: $cf_cv_link_dataonly" >&5 +echo "$as_me:10524: result: $cf_cv_link_dataonly" >&5 echo "${ECHO_T}$cf_cv_link_dataonly" >&6 if test "$cf_cv_link_dataonly" = no ; then @@ -8906,8 +10540,6 @@ getegid \ geteuid \ getttynam \ issetugid \ -memccpy \ -nanosleep \ poll \ remove \ select \ @@ -8924,13 +10556,13 @@ vsnprintf \ do as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh` -echo "$as_me:8927: checking for $ac_func" >&5 +echo "$as_me:10559: checking for $ac_func" >&5 echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6 if eval "test \"\${$as_ac_var+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 8933 "configure" +#line 10565 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char $ac_func (); below. */ @@ -8961,16 +10593,16 @@ f = $ac_func; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:8964: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10596: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:8967: \$? = $ac_status" >&5 + echo "$as_me:10599: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:8970: \"$ac_try\"") >&5 + { (eval echo "$as_me:10602: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:8973: \$? = $ac_status" >&5 + echo "$as_me:10605: \$? = $ac_status" >&5 (exit $ac_status); }; }; then eval "$as_ac_var=yes" else @@ -8980,7 +10612,7 @@ eval "$as_ac_var=no" fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:8983: result: `eval echo '${'$as_ac_var'}'`" >&5 +echo "$as_me:10615: result: `eval echo '${'$as_ac_var'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_var'}'`" >&6 if test `eval echo '${'$as_ac_var'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:10627: checking for terminal-capability database functions" >&5 echo $ECHO_N "checking for terminal-capability database functions... $ECHO_C" >&6 if test "${cf_cv_cgetent+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9002 "configure" +#line 10634 "configure" #include "confdefs.h" #include @@ -9019,16 +10651,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9022: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10654: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9025: \$? = $ac_status" >&5 + echo "$as_me:10657: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9028: \"$ac_try\"") >&5 + { (eval echo "$as_me:10660: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9031: \$? = $ac_status" >&5 + echo "$as_me:10663: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_cgetent=yes else @@ -9040,7 +10672,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:9043: result: $cf_cv_cgetent" >&5 +echo "$as_me:10675: result: $cf_cv_cgetent" >&5 echo "${ECHO_T}$cf_cv_cgetent" >&6 test "$cf_cv_cgetent" = yes && cat >>confdefs.h <<\EOF #define HAVE_BSD_CGETENT 1 @@ -9048,14 +10680,14 @@ EOF fi -echo "$as_me:9051: checking for isascii" >&5 +echo "$as_me:10683: checking for isascii" >&5 echo $ECHO_N "checking for isascii... $ECHO_C" >&6 if test "${cf_cv_have_isascii+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9058 "configure" +#line 10690 "configure" #include "confdefs.h" #include int @@ -9067,16 +10699,16 @@ int x = isascii(' ') } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9070: \"$ac_link\"") >&5 +if { (eval echo "$as_me:10702: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9073: \$? = $ac_status" >&5 + echo "$as_me:10705: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9076: \"$ac_try\"") >&5 + { (eval echo "$as_me:10708: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9079: \$? = $ac_status" >&5 + echo "$as_me:10711: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_have_isascii=yes else @@ -9087,17 +10719,17 @@ fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:9090: result: $cf_cv_have_isascii" >&5 +echo "$as_me:10722: result: $cf_cv_have_isascii" >&5 echo "${ECHO_T}$cf_cv_have_isascii" >&6 test "$cf_cv_have_isascii" = yes && cat >>confdefs.h <<\EOF #define HAVE_ISASCII 1 EOF if test "$ac_cv_func_sigaction" = yes; then -echo "$as_me:9097: checking whether sigaction needs _POSIX_SOURCE" >&5 +echo "$as_me:10729: checking whether sigaction needs _POSIX_SOURCE" >&5 echo $ECHO_N "checking whether sigaction needs _POSIX_SOURCE... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line 9100 "configure" +#line 10732 "configure" #include "confdefs.h" #include @@ -9111,16 +10743,16 @@ struct sigaction act } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9114: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10746: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9117: \$? = $ac_status" >&5 + echo "$as_me:10749: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9120: \"$ac_try\"") >&5 + { (eval echo "$as_me:10752: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9123: \$? = $ac_status" >&5 + echo "$as_me:10755: \$? = $ac_status" >&5 (exit $ac_status); }; }; then sigact_bad=no else @@ -9128,7 +10760,7 @@ else cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 9131 "configure" +#line 10763 "configure" #include "confdefs.h" #define _POSIX_SOURCE @@ -9143,16 +10775,16 @@ struct sigaction act } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9146: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10778: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9149: \$? = $ac_status" >&5 + echo "$as_me:10781: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9152: \"$ac_try\"") >&5 + { (eval echo "$as_me:10784: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9155: \$? = $ac_status" >&5 + echo "$as_me:10787: \$? = $ac_status" >&5 (exit $ac_status); }; }; then sigact_bad=yes cat >>confdefs.h <<\EOF @@ -9167,10 +10799,72 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest.$ac_ext -echo "$as_me:9170: result: $sigact_bad" >&5 +echo "$as_me:10802: result: $sigact_bad" >&5 echo "${ECHO_T}$sigact_bad" >&6 fi +echo "$as_me:10806: checking if nanosleep really works" >&5 +echo $ECHO_N "checking if nanosleep really works... $ECHO_C" >&6 +if test "${cf_cv_func_nanosleep+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +if test "$cross_compiling" = yes; then + cf_cv_func_nanosleep=unknown +else + cat >conftest.$ac_ext <<_ACEOF +#line 10816 "configure" +#include "confdefs.h" + +#include +#include +#include + +#ifdef HAVE_SYS_TIME_H +#include +#endif + +int main() { + struct timespec ts1, ts2; + int code; + ts1.tv_sec = 0; + ts1.tv_nsec = 750000000; + ts2.tv_sec = 0; + ts2.tv_nsec = 0; + errno = 0; + code = nanosleep(&ts1, &ts2); /* on failure errno is ENOSYS. */ + exit(code != 0); +} + +_ACEOF +rm -f conftest$ac_exeext +if { (eval echo "$as_me:10841: \"$ac_link\"") >&5 + (eval $ac_link) 2>&5 + ac_status=$? + echo "$as_me:10844: \$? = $ac_status" >&5 + (exit $ac_status); } && { ac_try='./conftest$ac_exeext' + { (eval echo "$as_me:10846: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:10849: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_func_nanosleep=yes +else + echo "$as_me: program exited with status $ac_status" >&5 +echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_func_nanosleep=no +fi +rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext +fi +fi +echo "$as_me:10861: result: $cf_cv_func_nanosleep" >&5 +echo "${ECHO_T}$cf_cv_func_nanosleep" >&6 + +test "$cf_cv_func_nanosleep" = "yes" && cat >>confdefs.h <<\EOF +#define HAVE_NANOSLEEP 1 +EOF + for ac_header in \ termio.h \ termios.h \ @@ -9178,23 +10872,23 @@ unistd.h \ do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:9181: checking for $ac_header" >&5 +echo "$as_me:10875: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9187 "configure" +#line 10881 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:9191: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:10885: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:9197: \$? = $ac_status" >&5 + echo "$as_me:10891: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -9213,7 +10907,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:9216: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:10910: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:10925: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9237 "configure" +#line 10931 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:9241: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:10935: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:9247: \$? = $ac_status" >&5 + echo "$as_me:10941: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_c_preproc_warn_flag @@ -9263,7 +10957,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:9266: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:10960: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 + echo "$as_me:10978: checking whether termios.h needs _POSIX_SOURCE" >&5 echo $ECHO_N "checking whether termios.h needs _POSIX_SOURCE... $ECHO_C" >&6 cat >conftest.$ac_ext <<_ACEOF -#line 9287 "configure" +#line 10981 "configure" #include "confdefs.h" #include int @@ -9296,16 +10990,16 @@ struct termios foo; int x = foo.c_iflag } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9299: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:10993: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9302: \$? = $ac_status" >&5 + echo "$as_me:10996: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9305: \"$ac_try\"") >&5 + { (eval echo "$as_me:10999: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9308: \$? = $ac_status" >&5 + echo "$as_me:11002: \$? = $ac_status" >&5 (exit $ac_status); }; }; then termios_bad=no else @@ -9313,7 +11007,7 @@ else cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 9316 "configure" +#line 11010 "configure" #include "confdefs.h" #define _POSIX_SOURCE @@ -9327,16 +11021,16 @@ struct termios foo; int x = foo.c_iflag } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9330: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11024: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9333: \$? = $ac_status" >&5 + echo "$as_me:11027: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9336: \"$ac_try\"") >&5 + { (eval echo "$as_me:11030: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9339: \$? = $ac_status" >&5 + echo "$as_me:11033: \$? = $ac_status" >&5 (exit $ac_status); }; }; then termios_bad=unknown else @@ -9351,19 +11045,19 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest.$ac_ext - echo "$as_me:9354: result: $termios_bad" >&5 + echo "$as_me:11048: result: $termios_bad" >&5 echo "${ECHO_T}$termios_bad" >&6 fi fi -echo "$as_me:9359: checking for tcgetattr" >&5 +echo "$as_me:11053: checking for tcgetattr" >&5 echo $ECHO_N "checking for tcgetattr... $ECHO_C" >&6 if test "${cf_cv_have_tcgetattr+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9366 "configure" +#line 11060 "configure" #include "confdefs.h" #include @@ -9391,16 +11085,16 @@ tcgetattr(1, &foo); } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9394: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11088: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9397: \$? = $ac_status" >&5 + echo "$as_me:11091: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9400: \"$ac_try\"") >&5 + { (eval echo "$as_me:11094: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9403: \$? = $ac_status" >&5 + echo "$as_me:11097: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_have_tcgetattr=yes else @@ -9410,20 +11104,20 @@ cf_cv_have_tcgetattr=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:9413: result: $cf_cv_have_tcgetattr" >&5 +echo "$as_me:11107: result: $cf_cv_have_tcgetattr" >&5 echo "${ECHO_T}$cf_cv_have_tcgetattr" >&6 test "$cf_cv_have_tcgetattr" = yes && cat >>confdefs.h <<\EOF #define HAVE_TCGETATTR 1 EOF -echo "$as_me:9419: checking for vsscanf function or workaround" >&5 +echo "$as_me:11113: checking for vsscanf function or workaround" >&5 echo $ECHO_N "checking for vsscanf function or workaround... $ECHO_C" >&6 if test "${cf_cv_func_vsscanf+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9426 "configure" +#line 11120 "configure" #include "confdefs.h" #include @@ -9439,16 +11133,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9442: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11136: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9445: \$? = $ac_status" >&5 + echo "$as_me:11139: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9448: \"$ac_try\"") >&5 + { (eval echo "$as_me:11142: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9451: \$? = $ac_status" >&5 + echo "$as_me:11145: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_func_vsscanf=vsscanf else @@ -9456,7 +11150,7 @@ else cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 9459 "configure" +#line 11153 "configure" #include "confdefs.h" #include @@ -9478,16 +11172,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9481: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11175: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9484: \$? = $ac_status" >&5 + echo "$as_me:11178: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9487: \"$ac_try\"") >&5 + { (eval echo "$as_me:11181: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9490: \$? = $ac_status" >&5 + echo "$as_me:11184: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_func_vsscanf=vfscanf else @@ -9495,7 +11189,7 @@ else cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 9498 "configure" +#line 11192 "configure" #include "confdefs.h" #include @@ -9517,16 +11211,16 @@ main () } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9520: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11214: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9523: \$? = $ac_status" >&5 + echo "$as_me:11217: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9526: \"$ac_try\"") >&5 + { (eval echo "$as_me:11220: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9529: \$? = $ac_status" >&5 + echo "$as_me:11223: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_func_vsscanf=_doscan else @@ -9541,7 +11235,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:9544: result: $cf_cv_func_vsscanf" >&5 +echo "$as_me:11238: result: $cf_cv_func_vsscanf" >&5 echo "${ECHO_T}$cf_cv_func_vsscanf" >&6 case $cf_cv_func_vsscanf in #(vi @@ -9559,7 +11253,7 @@ EOF ;; esac -echo "$as_me:9562: checking for working mkstemp" >&5 +echo "$as_me:11256: checking for working mkstemp" >&5 echo $ECHO_N "checking for working mkstemp... $ECHO_C" >&6 if test "${cf_cv_func_mkstemp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -9567,13 +11261,13 @@ else rm -f conftest* if test "$cross_compiling" = yes; then - echo "$as_me:9570: checking for mkstemp" >&5 + echo "$as_me:11264: checking for mkstemp" >&5 echo $ECHO_N "checking for mkstemp... $ECHO_C" >&6 if test "${ac_cv_func_mkstemp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9576 "configure" +#line 11270 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char mkstemp (); below. */ @@ -9604,16 +11298,16 @@ f = mkstemp; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:9607: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11301: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9610: \$? = $ac_status" >&5 + echo "$as_me:11304: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:9613: \"$ac_try\"") >&5 + { (eval echo "$as_me:11307: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9616: \$? = $ac_status" >&5 + echo "$as_me:11310: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_mkstemp=yes else @@ -9623,12 +11317,12 @@ ac_cv_func_mkstemp=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:9626: result: $ac_cv_func_mkstemp" >&5 +echo "$as_me:11320: result: $ac_cv_func_mkstemp" >&5 echo "${ECHO_T}$ac_cv_func_mkstemp" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9631 "configure" +#line 11325 "configure" #include "confdefs.h" #include @@ -9666,15 +11360,15 @@ int main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:9669: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11363: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9672: \$? = $ac_status" >&5 + echo "$as_me:11366: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:9674: \"$ac_try\"") >&5 + { (eval echo "$as_me:11368: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9677: \$? = $ac_status" >&5 + echo "$as_me:11371: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_func_mkstemp=yes @@ -9689,7 +11383,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:9692: result: $cf_cv_func_mkstemp" >&5 +echo "$as_me:11386: result: $cf_cv_func_mkstemp" >&5 echo "${ECHO_T}$cf_cv_func_mkstemp" >&6 if test "$cf_cv_func_mkstemp" = yes ; then cat >>confdefs.h <<\EOF @@ -9706,21 +11400,21 @@ else fi if test "$cross_compiling" = yes ; then - { echo "$as_me:9709: WARNING: cross compiling: assume setvbuf params not reversed" >&5 + { echo "$as_me:11403: WARNING: cross compiling: assume setvbuf params not reversed" >&5 echo "$as_me: WARNING: cross compiling: assume setvbuf params not reversed" >&2;} else - echo "$as_me:9712: checking whether setvbuf arguments are reversed" >&5 + echo "$as_me:11406: checking whether setvbuf arguments are reversed" >&5 echo $ECHO_N "checking whether setvbuf arguments are reversed... $ECHO_C" >&6 if test "${ac_cv_func_setvbuf_reversed+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else if test "$cross_compiling" = yes; then - { { echo "$as_me:9718: error: cannot run test program while cross compiling" >&5 + { { echo "$as_me:11412: error: cannot run test program while cross compiling" >&5 echo "$as_me: error: cannot run test program while cross compiling" >&2;} { (exit 1); exit 1; }; } else cat >conftest.$ac_ext <<_ACEOF -#line 9723 "configure" +#line 11417 "configure" #include "confdefs.h" #include /* If setvbuf has the reversed format, exit 0. */ @@ -9737,15 +11431,15 @@ main () } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:9740: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11434: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:9743: \$? = $ac_status" >&5 + echo "$as_me:11437: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:9745: \"$ac_try\"") >&5 + { (eval echo "$as_me:11439: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9748: \$? = $ac_status" >&5 + echo "$as_me:11442: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_setvbuf_reversed=yes else @@ -9758,7 +11452,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi rm -f core core.* *.core fi -echo "$as_me:9761: result: $ac_cv_func_setvbuf_reversed" >&5 +echo "$as_me:11455: result: $ac_cv_func_setvbuf_reversed" >&5 echo "${ECHO_T}$ac_cv_func_setvbuf_reversed" >&6 if test $ac_cv_func_setvbuf_reversed = yes; then @@ -9769,13 +11463,13 @@ EOF fi fi -echo "$as_me:9772: checking return type of signal handlers" >&5 +echo "$as_me:11466: checking return type of signal handlers" >&5 echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6 if test "${ac_cv_type_signal+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9778 "configure" +#line 11472 "configure" #include "confdefs.h" #include #include @@ -9797,16 +11491,16 @@ int i; } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9800: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11494: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9803: \$? = $ac_status" >&5 + echo "$as_me:11497: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9806: \"$ac_try\"") >&5 + { (eval echo "$as_me:11500: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9809: \$? = $ac_status" >&5 + echo "$as_me:11503: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_type_signal=void else @@ -9816,21 +11510,21 @@ ac_cv_type_signal=int fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:9819: result: $ac_cv_type_signal" >&5 +echo "$as_me:11513: result: $ac_cv_type_signal" >&5 echo "${ECHO_T}$ac_cv_type_signal" >&6 cat >>confdefs.h <&5 +echo "$as_me:11520: checking for type sigaction_t" >&5 echo $ECHO_N "checking for type sigaction_t... $ECHO_C" >&6 if test "${cf_cv_type_sigaction+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9833 "configure" +#line 11527 "configure" #include "confdefs.h" #include @@ -9843,16 +11537,16 @@ sigaction_t x } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9846: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11540: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9849: \$? = $ac_status" >&5 + echo "$as_me:11543: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9852: \"$ac_try\"") >&5 + { (eval echo "$as_me:11546: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9855: \$? = $ac_status" >&5 + echo "$as_me:11549: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_type_sigaction=yes else @@ -9863,13 +11557,13 @@ fi rm -f conftest.$ac_objext conftest.$ac_ext fi -echo "$as_me:9866: result: $cf_cv_type_sigaction" >&5 +echo "$as_me:11560: result: $cf_cv_type_sigaction" >&5 echo "${ECHO_T}$cf_cv_type_sigaction" >&6 test "$cf_cv_type_sigaction" = yes && cat >>confdefs.h <<\EOF #define HAVE_TYPE_SIGACTION 1 EOF -echo "$as_me:9872: checking declaration of size-change" >&5 +echo "$as_me:11566: checking declaration of size-change" >&5 echo $ECHO_N "checking declaration of size-change... $ECHO_C" >&6 if test "${cf_cv_sizechange+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -9884,7 +11578,7 @@ do CPPFLAGS="$cf_save_CPPFLAGS" test -n "$cf_opts" && CPPFLAGS="$CPPFLAGS -D$cf_opts" cat >conftest.$ac_ext <<_ACEOF -#line 9887 "configure" +#line 11581 "configure" #include "confdefs.h" #include #ifdef HAVE_TERMIOS_H @@ -9928,16 +11622,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:9931: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11625: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:9934: \$? = $ac_status" >&5 + echo "$as_me:11628: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:9937: \"$ac_try\"") >&5 + { (eval echo "$as_me:11631: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:9940: \$? = $ac_status" >&5 + echo "$as_me:11634: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_sizechange=yes else @@ -9956,7 +11650,7 @@ rm -f conftest.$ac_objext conftest.$ac_ext done fi -echo "$as_me:9959: result: $cf_cv_sizechange" >&5 +echo "$as_me:11653: result: $cf_cv_sizechange" >&5 echo "${ECHO_T}$cf_cv_sizechange" >&6 if test "$cf_cv_sizechange" != no ; then cat >>confdefs.h <<\EOF @@ -9973,13 +11667,13 @@ EOF esac fi -echo "$as_me:9976: checking for memmove" >&5 +echo "$as_me:11670: checking for memmove" >&5 echo $ECHO_N "checking for memmove... $ECHO_C" >&6 if test "${ac_cv_func_memmove+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 9982 "configure" +#line 11676 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char memmove (); below. */ @@ -10010,16 +11704,16 @@ f = memmove; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:10013: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11707: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10016: \$? = $ac_status" >&5 + echo "$as_me:11710: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:10019: \"$ac_try\"") >&5 + { (eval echo "$as_me:11713: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10022: \$? = $ac_status" >&5 + echo "$as_me:11716: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_memmove=yes else @@ -10029,19 +11723,19 @@ ac_cv_func_memmove=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:10032: result: $ac_cv_func_memmove" >&5 +echo "$as_me:11726: result: $ac_cv_func_memmove" >&5 echo "${ECHO_T}$ac_cv_func_memmove" >&6 if test $ac_cv_func_memmove = yes; then : else -echo "$as_me:10038: checking for bcopy" >&5 +echo "$as_me:11732: checking for bcopy" >&5 echo $ECHO_N "checking for bcopy... $ECHO_C" >&6 if test "${ac_cv_func_bcopy+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 10044 "configure" +#line 11738 "configure" #include "confdefs.h" /* System header to define __stub macros and hopefully few prototypes, which can conflict with char bcopy (); below. */ @@ -10072,16 +11766,16 @@ f = bcopy; } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:10075: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11769: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10078: \$? = $ac_status" >&5 + echo "$as_me:11772: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:10081: \"$ac_try\"") >&5 + { (eval echo "$as_me:11775: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10084: \$? = $ac_status" >&5 + echo "$as_me:11778: \$? = $ac_status" >&5 (exit $ac_status); }; }; then ac_cv_func_bcopy=yes else @@ -10091,11 +11785,11 @@ ac_cv_func_bcopy=no fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi -echo "$as_me:10094: result: $ac_cv_func_bcopy" >&5 +echo "$as_me:11788: result: $ac_cv_func_bcopy" >&5 echo "${ECHO_T}$ac_cv_func_bcopy" >&6 if test $ac_cv_func_bcopy = yes; then - echo "$as_me:10098: checking if bcopy does overlapping moves" >&5 + echo "$as_me:11792: checking if bcopy does overlapping moves" >&5 echo $ECHO_N "checking if bcopy does overlapping moves... $ECHO_C" >&6 if test "${cf_cv_good_bcopy+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -10105,7 +11799,7 @@ else cf_cv_good_bcopy=unknown else cat >conftest.$ac_ext <<_ACEOF -#line 10108 "configure" +#line 11802 "configure" #include "confdefs.h" int main() { @@ -10119,15 +11813,15 @@ int main() { _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:10122: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11816: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10125: \$? = $ac_status" >&5 + echo "$as_me:11819: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:10127: \"$ac_try\"") >&5 + { (eval echo "$as_me:11821: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10130: \$? = $ac_status" >&5 + echo "$as_me:11824: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_good_bcopy=yes else @@ -10140,7 +11834,7 @@ rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:10143: result: $cf_cv_good_bcopy" >&5 +echo "$as_me:11837: result: $cf_cv_good_bcopy" >&5 echo "${ECHO_T}$cf_cv_good_bcopy" >&6 else @@ -10161,7 +11855,7 @@ EOF fi -echo "$as_me:10164: checking if poll really works" >&5 +echo "$as_me:11858: checking if poll really works" >&5 echo $ECHO_N "checking if poll really works... $ECHO_C" >&6 if test "${cf_cv_working_poll+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -10171,7 +11865,7 @@ if test "$cross_compiling" = yes; then cf_cv_working_poll=unknown else cat >conftest.$ac_ext <<_ACEOF -#line 10174 "configure" +#line 11868 "configure" #include "confdefs.h" #include @@ -10192,15 +11886,15 @@ int main() { } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:10195: \"$ac_link\"") >&5 +if { (eval echo "$as_me:11889: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10198: \$? = $ac_status" >&5 + echo "$as_me:11892: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:10200: \"$ac_try\"") >&5 + { (eval echo "$as_me:11894: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10203: \$? = $ac_status" >&5 + echo "$as_me:11897: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_working_poll=yes else @@ -10212,7 +11906,7 @@ fi rm -f core core.* *.core conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext fi fi -echo "$as_me:10215: result: $cf_cv_working_poll" >&5 +echo "$as_me:11909: result: $cf_cv_working_poll" >&5 echo "${ECHO_T}$cf_cv_working_poll" >&6 test "$cf_cv_working_poll" = "yes" && cat >>confdefs.h <<\EOF #define HAVE_WORKING_POLL 1 @@ -10225,7 +11919,7 @@ fi # Just in case, check if the C compiler has a bool type. -echo "$as_me:10228: checking if we should include stdbool.h" >&5 +echo "$as_me:11922: checking if we should include stdbool.h" >&5 echo $ECHO_N "checking if we should include stdbool.h... $ECHO_C" >&6 if test "${cf_cv_header_stdbool_h+set}" = set; then @@ -10233,7 +11927,7 @@ if test "${cf_cv_header_stdbool_h+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF -#line 10236 "configure" +#line 11930 "configure" #include "confdefs.h" int @@ -10245,23 +11939,23 @@ bool foo = false } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10248: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11942: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10251: \$? = $ac_status" >&5 + echo "$as_me:11945: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10254: \"$ac_try\"") >&5 + { (eval echo "$as_me:11948: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10257: \$? = $ac_status" >&5 + echo "$as_me:11951: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_header_stdbool_h=0 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 10264 "configure" +#line 11958 "configure" #include "confdefs.h" #ifndef __BEOS__ @@ -10277,16 +11971,16 @@ bool foo = false } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10280: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:11974: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10283: \$? = $ac_status" >&5 + echo "$as_me:11977: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10286: \"$ac_try\"") >&5 + { (eval echo "$as_me:11980: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10289: \$? = $ac_status" >&5 + echo "$as_me:11983: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_header_stdbool_h=1 else @@ -10300,13 +11994,13 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi if test "$cf_cv_header_stdbool_h" = 1 -then echo "$as_me:10303: result: yes" >&5 +then echo "$as_me:11997: result: yes" >&5 echo "${ECHO_T}yes" >&6 -else echo "$as_me:10305: result: no" >&5 +else echo "$as_me:11999: result: no" >&5 echo "${ECHO_T}no" >&6 fi -echo "$as_me:10309: checking for builtin bool type" >&5 +echo "$as_me:12003: checking for builtin bool type" >&5 echo $ECHO_N "checking for builtin bool type... $ECHO_C" >&6 if test "${cf_cv_cc_bool_type+set}" = set; then @@ -10314,7 +12008,7 @@ if test "${cf_cv_cc_bool_type+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF -#line 10317 "configure" +#line 12011 "configure" #include "confdefs.h" #include @@ -10329,16 +12023,16 @@ bool x = false } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10332: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12026: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10335: \$? = $ac_status" >&5 + echo "$as_me:12029: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10338: \"$ac_try\"") >&5 + { (eval echo "$as_me:12032: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10341: \$? = $ac_status" >&5 + echo "$as_me:12035: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_cc_bool_type=1 else @@ -10351,9 +12045,9 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi if test "$cf_cv_cc_bool_type" = 1 -then echo "$as_me:10354: result: yes" >&5 +then echo "$as_me:12048: result: yes" >&5 echo "${ECHO_T}yes" >&6 -else echo "$as_me:10356: result: no" >&5 +else echo "$as_me:12050: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -10374,7 +12068,7 @@ os2*) #(vi cf_stdcpp_libname=stdc++ ;; esac -echo "$as_me:10377: checking for library $cf_stdcpp_libname" >&5 +echo "$as_me:12071: checking for library $cf_stdcpp_libname" >&5 echo $ECHO_N "checking for library $cf_stdcpp_libname... $ECHO_C" >&6 if test "${cf_cv_libstdcpp+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -10383,7 +12077,7 @@ else cf_save="$LIBS" LIBS="$LIBS -l$cf_stdcpp_libname" cat >conftest.$ac_ext <<_ACEOF -#line 10386 "configure" +#line 12080 "configure" #include "confdefs.h" #include @@ -10399,16 +12093,16 @@ strstreambuf foo(buf, sizeof(buf)) } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:10402: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12096: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10405: \$? = $ac_status" >&5 + echo "$as_me:12099: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:10408: \"$ac_try\"") >&5 + { (eval echo "$as_me:12102: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10411: \$? = $ac_status" >&5 + echo "$as_me:12105: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_libstdcpp=yes else @@ -10420,9 +12114,51 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS="$cf_save" fi -echo "$as_me:10423: result: $cf_cv_libstdcpp" >&5 +echo "$as_me:12117: result: $cf_cv_libstdcpp" >&5 echo "${ECHO_T}$cf_cv_libstdcpp" >&6 test "$cf_cv_libstdcpp" = yes && CXXLIBS="$CXXLIBS -l$cf_stdcpp_libname" +fi + + echo "$as_me:12122: checking whether $CXX understands -c and -o together" >&5 +echo $ECHO_N "checking whether $CXX understands -c and -o together... $ECHO_C" >&6 +if test "${cf_cv_prog_CXX_c_o+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + +cat > conftest.$ac_ext < +int main() +{ + return 0; +} +CF_EOF +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CXX -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +if { (eval echo "$as_me:12138: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12141: \$? = $ac_status" >&5 + (exit $ac_status); } && + test -f conftest2.$ac_objext && { (eval echo "$as_me:12143: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12146: \$? = $ac_status" >&5 + (exit $ac_status); }; +then + eval cf_cv_prog_CXX_c_o=yes +else + eval cf_cv_prog_CXX_c_o=no +fi +rm -f conftest* + +fi +if test $cf_cv_prog_CXX_c_o = yes; then + echo "$as_me:12157: result: yes" >&5 +echo "${ECHO_T}yes" >&6 +else + echo "$as_me:12160: result: no" >&5 +echo "${ECHO_T}no" >&6 fi case $GXX_VERSION in @@ -10441,12 +12177,12 @@ os2*) #(vi ;; esac if test "$GXX" = yes; then - echo "$as_me:10444: checking for lib$cf_gpp_libname" >&5 + echo "$as_me:12180: checking for lib$cf_gpp_libname" >&5 echo $ECHO_N "checking for lib$cf_gpp_libname... $ECHO_C" >&6 cf_save="$LIBS" LIBS="$LIBS -l$cf_gpp_libname" cat >conftest.$ac_ext <<_ACEOF -#line 10449 "configure" +#line 12185 "configure" #include "confdefs.h" #include <$cf_gpp_libname/builtin.h> @@ -10460,16 +12196,16 @@ two_arg_error_handler_t foo2 = lib_error_handler } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:10463: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12199: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10466: \$? = $ac_status" >&5 + echo "$as_me:12202: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:10469: \"$ac_try\"") >&5 + { (eval echo "$as_me:12205: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10472: \$? = $ac_status" >&5 + echo "$as_me:12208: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cxx_library=yes CXXLIBS="$CXXLIBS -l$cf_gpp_libname" @@ -10488,7 +12224,7 @@ else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 10491 "configure" +#line 12227 "configure" #include "confdefs.h" #include @@ -10502,16 +12238,16 @@ two_arg_error_handler_t foo2 = lib_error_handler } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:10505: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12241: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10508: \$? = $ac_status" >&5 + echo "$as_me:12244: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:10511: \"$ac_try\"") >&5 + { (eval echo "$as_me:12247: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10514: \$? = $ac_status" >&5 + echo "$as_me:12250: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cxx_library=yes CXXLIBS="$CXXLIBS -l$cf_gpp_libname" @@ -10528,7 +12264,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext fi rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext LIBS="$cf_save" - echo "$as_me:10531: result: $cf_cxx_library" >&5 + echo "$as_me:12267: result: $cf_cxx_library" >&5 echo "${ECHO_T}$cf_cxx_library" >&6 fi @@ -10543,7 +12279,7 @@ ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' ac_compiler_gnu=$ac_cv_cxx_compiler_gnu -echo "$as_me:10546: checking how to run the C++ preprocessor" >&5 +echo "$as_me:12282: checking how to run the C++ preprocessor" >&5 echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6 if test -z "$CXXCPP"; then if test "${ac_cv_prog_CXXCPP+set}" = set; then @@ -10560,18 +12296,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 10563 "configure" +#line 12299 "configure" #include "confdefs.h" #include Syntax error _ACEOF -if { (eval echo "$as_me:10568: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:12304: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:10574: \$? = $ac_status" >&5 + echo "$as_me:12310: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag @@ -10594,17 +12330,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 10597 "configure" +#line 12333 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:10601: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:12337: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:10607: \$? = $ac_status" >&5 + echo "$as_me:12343: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag @@ -10641,7 +12377,7 @@ fi else ac_cv_prog_CXXCPP=$CXXCPP fi -echo "$as_me:10644: result: $CXXCPP" >&5 +echo "$as_me:12380: result: $CXXCPP" >&5 echo "${ECHO_T}$CXXCPP" >&6 ac_preproc_ok=false for ac_cxx_preproc_warn_flag in '' yes @@ -10651,18 +12387,18 @@ do # On the NeXT, cc -E runs the code through the compiler's parser, # not just through cpp. "Syntax error" is here to catch this case. cat >conftest.$ac_ext <<_ACEOF -#line 10654 "configure" +#line 12390 "configure" #include "confdefs.h" #include Syntax error _ACEOF -if { (eval echo "$as_me:10659: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:12395: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:10665: \$? = $ac_status" >&5 + echo "$as_me:12401: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag @@ -10685,17 +12421,17 @@ rm -f conftest.err conftest.$ac_ext # OK, works on sane cases. Now check whether non-existent headers # can be detected and how. cat >conftest.$ac_ext <<_ACEOF -#line 10688 "configure" +#line 12424 "configure" #include "confdefs.h" #include _ACEOF -if { (eval echo "$as_me:10692: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:12428: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:10698: \$? = $ac_status" >&5 + echo "$as_me:12434: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag @@ -10723,7 +12459,7 @@ rm -f conftest.err conftest.$ac_ext if $ac_preproc_ok; then : else - { { echo "$as_me:10726: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&5 + { { echo "$as_me:12462: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&5 echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check" >&2;} { (exit 1); exit 1; }; } fi @@ -10737,23 +12473,23 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu for ac_header in typeinfo do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:10740: checking for $ac_header" >&5 +echo "$as_me:12476: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 10746 "configure" +#line 12482 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:10750: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:12486: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:10756: \$? = $ac_status" >&5 + echo "$as_me:12492: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag @@ -10772,7 +12508,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:10775: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:12511: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:12521: checking if we should include stdbool.h" >&5 echo $ECHO_N "checking if we should include stdbool.h... $ECHO_C" >&6 if test "${cf_cv_header_stdbool_h+set}" = set; then @@ -10790,7 +12526,7 @@ if test "${cf_cv_header_stdbool_h+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF -#line 10793 "configure" +#line 12529 "configure" #include "confdefs.h" int @@ -10802,23 +12538,23 @@ bool foo = false } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10805: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12541: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10808: \$? = $ac_status" >&5 + echo "$as_me:12544: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10811: \"$ac_try\"") >&5 + { (eval echo "$as_me:12547: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10814: \$? = $ac_status" >&5 + echo "$as_me:12550: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_header_stdbool_h=0 else echo "$as_me: failed program was:" >&5 cat conftest.$ac_ext >&5 cat >conftest.$ac_ext <<_ACEOF -#line 10821 "configure" +#line 12557 "configure" #include "confdefs.h" #ifndef __BEOS__ @@ -10834,16 +12570,16 @@ bool foo = false } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10837: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12573: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10840: \$? = $ac_status" >&5 + echo "$as_me:12576: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10843: \"$ac_try\"") >&5 + { (eval echo "$as_me:12579: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10846: \$? = $ac_status" >&5 + echo "$as_me:12582: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_header_stdbool_h=1 else @@ -10857,13 +12593,13 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi if test "$cf_cv_header_stdbool_h" = 1 -then echo "$as_me:10860: result: yes" >&5 +then echo "$as_me:12596: result: yes" >&5 echo "${ECHO_T}yes" >&6 -else echo "$as_me:10862: result: no" >&5 +else echo "$as_me:12598: result: no" >&5 echo "${ECHO_T}no" >&6 fi -echo "$as_me:10866: checking for builtin bool type" >&5 +echo "$as_me:12602: checking for builtin bool type" >&5 echo $ECHO_N "checking for builtin bool type... $ECHO_C" >&6 if test "${cf_cv_builtin_bool+set}" = set; then @@ -10871,7 +12607,7 @@ if test "${cf_cv_builtin_bool+set}" = set; then else cat >conftest.$ac_ext <<_ACEOF -#line 10874 "configure" +#line 12610 "configure" #include "confdefs.h" #include @@ -10886,16 +12622,16 @@ bool x = false } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:10889: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12625: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:10892: \$? = $ac_status" >&5 + echo "$as_me:12628: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:10895: \"$ac_try\"") >&5 + { (eval echo "$as_me:12631: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10898: \$? = $ac_status" >&5 + echo "$as_me:12634: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_builtin_bool=1 else @@ -10908,13 +12644,13 @@ rm -f conftest.$ac_objext conftest.$ac_ext fi if test "$cf_cv_builtin_bool" = 1 -then echo "$as_me:10911: result: yes" >&5 +then echo "$as_me:12647: result: yes" >&5 echo "${ECHO_T}yes" >&6 -else echo "$as_me:10913: result: no" >&5 +else echo "$as_me:12649: result: no" >&5 echo "${ECHO_T}no" >&6 fi -echo "$as_me:10917: checking for size of bool" >&5 +echo "$as_me:12653: checking for size of bool" >&5 echo $ECHO_N "checking for size of bool... $ECHO_C" >&6 if test "${cf_cv_type_of_bool+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -10925,7 +12661,7 @@ else cf_cv_type_of_bool=unknown else cat >conftest.$ac_ext <<_ACEOF -#line 10928 "configure" +#line 12664 "configure" #include "confdefs.h" #include @@ -10967,15 +12703,15 @@ main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:10970: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12706: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:10973: \$? = $ac_status" >&5 + echo "$as_me:12709: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:10975: \"$ac_try\"") >&5 + { (eval echo "$as_me:12711: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:10978: \$? = $ac_status" >&5 + echo "$as_me:12714: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_type_of_bool=`cat cf_test.out` if test -z "$cf_cv_type_of_bool"; then @@ -10993,18 +12729,18 @@ fi fi rm -f cf_test.out -echo "$as_me:10996: result: $cf_cv_type_of_bool" >&5 +echo "$as_me:12732: result: $cf_cv_type_of_bool" >&5 echo "${ECHO_T}$cf_cv_type_of_bool" >&6 if test "$cf_cv_type_of_bool" = unknown ; then case .$NCURSES_BOOL in #(vi .auto|.) NCURSES_BOOL=unsigned;; esac - { echo "$as_me:11002: WARNING: Assuming $NCURSES_BOOL for type of bool" >&5 + { echo "$as_me:12738: WARNING: Assuming $NCURSES_BOOL for type of bool" >&5 echo "$as_me: WARNING: Assuming $NCURSES_BOOL for type of bool" >&2;} cf_cv_type_of_bool=$NCURSES_BOOL fi -echo "$as_me:11007: checking for special defines needed for etip.h" >&5 +echo "$as_me:12743: checking for special defines needed for etip.h" >&5 echo $ECHO_N "checking for special defines needed for etip.h... $ECHO_C" >&6 cf_save_CXXFLAGS="$CXXFLAGS" cf_result="none" @@ -11016,7 +12752,7 @@ do test -n "$cf_math" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_math}" test -n "$cf_excp" && CXXFLAGS="$CXXFLAGS -DETIP_NEEDS_${cf_excp}" cat >conftest.$ac_ext <<_ACEOF -#line 11019 "configure" +#line 12755 "configure" #include "confdefs.h" #include @@ -11030,16 +12766,16 @@ main () } _ACEOF rm -f conftest.$ac_objext -if { (eval echo "$as_me:11033: \"$ac_compile\"") >&5 +if { (eval echo "$as_me:12769: \"$ac_compile\"") >&5 (eval $ac_compile) 2>&5 ac_status=$? - echo "$as_me:11036: \$? = $ac_status" >&5 + echo "$as_me:12772: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest.$ac_objext' - { (eval echo "$as_me:11039: \"$ac_try\"") >&5 + { (eval echo "$as_me:12775: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11042: \$? = $ac_status" >&5 + echo "$as_me:12778: \$? = $ac_status" >&5 (exit $ac_status); }; }; then test -n "$cf_math" && cat >>confdefs.h <&5 +echo "$as_me:12799: result: $cf_result" >&5 echo "${ECHO_T}$cf_result" >&6 CXXFLAGS="$cf_save_CXXFLAGS" if test -n "$CXX"; then -echo "$as_me:11068: checking if $CXX accepts parameter initialization" >&5 +echo "$as_me:12804: checking if $CXX accepts parameter initialization" >&5 echo $ECHO_N "checking if $CXX accepts parameter initialization... $ECHO_C" >&6 if test "${cf_cv_cpp_param_init+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -11081,7 +12817,7 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu cf_cv_cpp_param_init=unknown else cat >conftest.$ac_ext <<_ACEOF -#line 11084 "configure" +#line 12820 "configure" #include "confdefs.h" class TEST { @@ -11100,15 +12836,15 @@ void main() { } _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:11103: \"$ac_link\"") >&5 +if { (eval echo "$as_me:12839: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11106: \$? = $ac_status" >&5 + echo "$as_me:12842: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:11108: \"$ac_try\"") >&5 + { (eval echo "$as_me:12844: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11111: \$? = $ac_status" >&5 + echo "$as_me:12847: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_cpp_param_init=yes else @@ -11126,7 +12862,7 @@ ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ex ac_compiler_gnu=$ac_cv_cxx_compiler_gnu fi -echo "$as_me:11129: result: $cf_cv_cpp_param_init" >&5 +echo "$as_me:12865: result: $cf_cv_cpp_param_init" >&5 echo "${ECHO_T}$cf_cv_cpp_param_init" >&6 fi test "$cf_cv_cpp_param_init" = yes && cat >>confdefs.h <<\EOF @@ -11135,6 +12871,100 @@ EOF if test -n "$CXX"; then +echo "$as_me:12874: checking if $CXX accepts static_cast" >&5 +echo $ECHO_N "checking if $CXX accepts static_cast... $ECHO_C" >&6 +if test "${cf_cv_cpp_static_cast+set}" = set; then + echo $ECHO_N "(cached) $ECHO_C" >&6 +else + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + + cat >conftest.$ac_ext <<_ACEOF +#line 12887 "configure" +#include "confdefs.h" + +class NCursesPanel +{ +public: + NCursesPanel(int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0) + { + } + + ~NCursesPanel(); +}; + +template class NCursesUserPanel : public NCursesPanel +{ +public: + NCursesUserPanel (int nlines, + int ncols, + int begin_y = 0, + int begin_x = 0, + const T* p_UserData = static_cast(0)) + : NCursesPanel (nlines, ncols, begin_y, begin_x) + { + }; + NCursesUserPanel(const T* p_UserData = static_cast(0)) : NCursesPanel() + { + }; + + virtual ~NCursesUserPanel() {}; +}; + +int +main () +{ + + const char* p_UserData = static_cast(0) + ; + return 0; +} +_ACEOF +rm -f conftest.$ac_objext +if { (eval echo "$as_me:12931: \"$ac_compile\"") >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + echo "$as_me:12934: \$? = $ac_status" >&5 + (exit $ac_status); } && + { ac_try='test -s conftest.$ac_objext' + { (eval echo "$as_me:12937: \"$ac_try\"") >&5 + (eval $ac_try) 2>&5 + ac_status=$? + echo "$as_me:12940: \$? = $ac_status" >&5 + (exit $ac_status); }; }; then + cf_cv_cpp_static_cast=yes +else + echo "$as_me: failed program was:" >&5 +cat conftest.$ac_ext >&5 +cf_cv_cpp_static_cast=no +fi +rm -f conftest.$ac_objext conftest.$ac_ext + + ac_ext=cc +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +fi +echo "$as_me:12957: result: $cf_cv_cpp_static_cast" >&5 +echo "${ECHO_T}$cf_cv_cpp_static_cast" >&6 + +fi + +test "$cf_cv_cpp_static_cast" = yes && cat >>confdefs.h <<\EOF +#define CPP_HAS_STATIC_CAST 1 +EOF + +if test -n "$CXX"; then + ac_ext=cc ac_cpp='$CXXCPP $CPPFLAGS' ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' @@ -11144,23 +12974,23 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu for ac_header in strstream.h do as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh` -echo "$as_me:11147: checking for $ac_header" >&5 +echo "$as_me:12977: checking for $ac_header" >&5 echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6 if eval "test \"\${$as_ac_Header+set}\" = set"; then echo $ECHO_N "(cached) $ECHO_C" >&6 else cat >conftest.$ac_ext <<_ACEOF -#line 11153 "configure" +#line 12983 "configure" #include "confdefs.h" #include <$ac_header> _ACEOF -if { (eval echo "$as_me:11157: \"$ac_cpp conftest.$ac_ext\"") >&5 +if { (eval echo "$as_me:12987: \"$ac_cpp conftest.$ac_ext\"") >&5 (eval $ac_cpp conftest.$ac_ext) 2>conftest.er1 ac_status=$? egrep -v '^ *\+' conftest.er1 >conftest.err rm -f conftest.er1 cat conftest.err >&5 - echo "$as_me:11163: \$? = $ac_status" >&5 + echo "$as_me:12993: \$? = $ac_status" >&5 (exit $ac_status); } >/dev/null; then if test -s conftest.err; then ac_cpp_err=$ac_cxx_preproc_warn_flag @@ -11179,7 +13009,7 @@ else fi rm -f conftest.err conftest.$ac_ext fi -echo "$as_me:11182: result: `eval echo '${'$as_ac_Header'}'`" >&5 +echo "$as_me:13012: result: `eval echo '${'$as_ac_Header'}'`" >&5 echo "${ECHO_T}`eval echo '${'$as_ac_Header'}'`" >&6 if test `eval echo '${'$as_ac_Header'}'` = yes; then cat >>confdefs.h <&5 +echo "$as_me:13022: checking if $CXX supports vscan function" >&5 echo $ECHO_N "checking if $CXX supports vscan function... $ECHO_C" >&6 if test "${cf_cv_cpp_vscan_func+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -11203,7 +13033,7 @@ else strstream_cast) cf_vscan_defs=USE_STRSTREAM_VSCAN_CAST ;; esac cat >conftest.$ac_ext <<_ACEOF -#line 11206 "configure" +#line 13036 "configure" #include "confdefs.h" #include @@ -11248,16 +13078,16 @@ int tmp, foo = scanw("%d", &tmp) } _ACEOF rm -f conftest.$ac_objext conftest$ac_exeext -if { (eval echo "$as_me:11251: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13081: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11254: \$? = $ac_status" >&5 + echo "$as_me:13084: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='test -s conftest$ac_exeext' - { (eval echo "$as_me:11257: \"$ac_try\"") >&5 + { (eval echo "$as_me:13087: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11260: \$? = $ac_status" >&5 + echo "$as_me:13090: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_cpp_vscan_func=$cf_vscan_func; break else @@ -11270,7 +13100,7 @@ rm -f conftest.$ac_objext conftest$ac_exeext conftest.$ac_ext done fi -echo "$as_me:11273: result: $cf_cv_cpp_vscan_func" >&5 +echo "$as_me:13103: result: $cf_cv_cpp_vscan_func" >&5 echo "${ECHO_T}$cf_cv_cpp_vscan_func" >&6 ac_ext=cc @@ -11352,7 +13182,7 @@ else else if test "$cf_cv_header_stdbool_h" = 1 ; then -echo "$as_me:11355: checking for size of bool" >&5 +echo "$as_me:13185: checking for size of bool" >&5 echo $ECHO_N "checking for size of bool... $ECHO_C" >&6 if test "${cf_cv_type_of_bool+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -11363,7 +13193,7 @@ else cf_cv_type_of_bool=unknown else cat >conftest.$ac_ext <<_ACEOF -#line 11366 "configure" +#line 13196 "configure" #include "confdefs.h" #include @@ -11405,15 +13235,15 @@ main() _ACEOF rm -f conftest$ac_exeext -if { (eval echo "$as_me:11408: \"$ac_link\"") >&5 +if { (eval echo "$as_me:13238: \"$ac_link\"") >&5 (eval $ac_link) 2>&5 ac_status=$? - echo "$as_me:11411: \$? = $ac_status" >&5 + echo "$as_me:13241: \$? = $ac_status" >&5 (exit $ac_status); } && { ac_try='./conftest$ac_exeext' - { (eval echo "$as_me:11413: \"$ac_try\"") >&5 + { (eval echo "$as_me:13243: \"$ac_try\"") >&5 (eval $ac_try) 2>&5 ac_status=$? - echo "$as_me:11416: \$? = $ac_status" >&5 + echo "$as_me:13246: \$? = $ac_status" >&5 (exit $ac_status); }; }; then cf_cv_type_of_bool=`cat cf_test.out` if test -z "$cf_cv_type_of_bool"; then @@ -11431,25 +13261,25 @@ fi fi rm -f cf_test.out -echo "$as_me:11434: result: $cf_cv_type_of_bool" >&5 +echo "$as_me:13264: result: $cf_cv_type_of_bool" >&5 echo "${ECHO_T}$cf_cv_type_of_bool" >&6 if test "$cf_cv_type_of_bool" = unknown ; then case .$NCURSES_BOOL in #(vi .auto|.) NCURSES_BOOL=unsigned;; esac - { echo "$as_me:11440: WARNING: Assuming $NCURSES_BOOL for type of bool" >&5 + { echo "$as_me:13270: WARNING: Assuming $NCURSES_BOOL for type of bool" >&5 echo "$as_me: WARNING: Assuming $NCURSES_BOOL for type of bool" >&2;} cf_cv_type_of_bool=$NCURSES_BOOL fi else - echo "$as_me:11446: checking for fallback type of bool" >&5 + echo "$as_me:13276: checking for fallback type of bool" >&5 echo $ECHO_N "checking for fallback type of bool... $ECHO_C" >&6 case "$host_cpu" in #(vi i?86) cf_cv_type_of_bool=char ;; #(vi *) cf_cv_type_of_bool=int ;; esac - echo "$as_me:11452: result: $cf_cv_type_of_bool" >&5 + echo "$as_me:13282: result: $cf_cv_type_of_bool" >&5 echo "${ECHO_T}$cf_cv_type_of_bool" >&6 fi fi @@ -11478,7 +13308,7 @@ if test "$cf_with_ada" != "no" ; then cf_ada_make=gnatmake # Extract the first word of "$cf_ada_make", so it can be a program name with args. set dummy $cf_ada_make; ac_word=$2 -echo "$as_me:11481: checking for $ac_word" >&5 +echo "$as_me:13311: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_gnat_exists+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -11493,7 +13323,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_gnat_exists="yes" -echo "$as_me:11496: found $ac_dir/$ac_word" >&5 +echo "$as_me:13326: found $ac_dir/$ac_word" >&5 break done @@ -11502,10 +13332,10 @@ fi fi gnat_exists=$ac_cv_prog_gnat_exists if test -n "$gnat_exists"; then - echo "$as_me:11505: result: $gnat_exists" >&5 + echo "$as_me:13335: result: $gnat_exists" >&5 echo "${ECHO_T}$gnat_exists" >&6 else - echo "$as_me:11508: result: no" >&5 + echo "$as_me:13338: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -11513,11 +13343,11 @@ if test "$ac_cv_prog_gnat_exists" = no; then cf_ada_make= else -echo "$as_me:11516: checking for gnat version" >&5 +echo "$as_me:13346: checking for gnat version" >&5 echo $ECHO_N "checking for gnat version... $ECHO_C" >&6 cf_gnat_version=`${cf_ada_make-gnatmake} -v 2>&1 | grep '[0-9].[0-9][0-9]*' |\ sed -e '2,$d' -e 's/[^0-9 \.]//g' -e 's/^[ ]*//' -e 's/ .*//'` -echo "$as_me:11520: result: $cf_gnat_version" >&5 +echo "$as_me:13350: result: $cf_gnat_version" >&5 echo "${ECHO_T}$cf_gnat_version" >&6 case $cf_gnat_version in @@ -11540,7 +13370,7 @@ esac # Extract the first word of "m4", so it can be a program name with args. set dummy m4; ac_word=$2 -echo "$as_me:11543: checking for $ac_word" >&5 +echo "$as_me:13373: checking for $ac_word" >&5 echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6 if test "${ac_cv_prog_M4_exists+set}" = set; then echo $ECHO_N "(cached) $ECHO_C" >&6 @@ -11555,7 +13385,7 @@ for ac_dir in $ac_dummy; do test -z "$ac_dir" && ac_dir=. $as_executable_p "$ac_dir/$ac_word" || continue ac_cv_prog_M4_exists="yes" -echo "$as_me:11558: found $ac_dir/$ac_word" >&5 +echo "$as_me:13388: found $ac_dir/$ac_word" >&5 break done @@ -11564,10 +13394,10 @@ fi fi M4_exists=$ac_cv_prog_M4_exists if test -n "$M4_exists"; then - echo "$as_me:11567: result: $M4_exists" >&5 + echo "$as_me:13397: result: $M4_exists" >&5 echo "${ECHO_T}$M4_exists" >&6 else - echo "$as_me:11570: result: no" >&5 + echo "$as_me:13400: result: no" >&5 echo "${ECHO_T}no" >&6 fi @@ -11576,7 +13406,7 @@ fi echo Ada95 binding required program m4 not found. Ada95 binding disabled. fi if test "$cf_cv_prog_gnat_correct" = yes; then - echo "$as_me:11579: checking if GNAT works" >&5 + echo "$as_me:13409: checking if GNAT works" >&5 echo $ECHO_N "checking if GNAT works... $ECHO_C" >&6 rm -f conftest* @@ -11593,7 +13423,7 @@ begin GNAT.OS_Lib.OS_Exit (0); end conftest; CF_EOF -if ( $cf_ada_make conftest 1>&5 2>&1 ) ; then +if ( $cf_ada_make $ADAFLAGS conftest 1>&5 2>&1 ) ; then if ( ./conftest 1>&5 2>&1 ) ; then cf_cv_prog_gnat_correct=yes else @@ -11604,13 +13434,50 @@ else fi rm -f conftest* - echo "$as_me:11607: result: $cf_cv_prog_gnat_correct" >&5 + echo "$as_me:13437: result: $cf_cv_prog_gnat_correct" >&5 echo "${ECHO_T}$cf_cv_prog_gnat_correct" >&6 fi fi if test "$cf_cv_prog_gnat_correct" = yes; then ADAFLAGS="-O3 -gnatpn $ADAFLAGS" + echo "$as_me:13444: checking if GNAT pragma Unreferenced works" >&5 +echo $ECHO_N "checking if GNAT pragma Unreferenced works... $ECHO_C" >&6 + +rm -f conftest* +cat >>conftest.ads <>conftest.adb <&5 2>&1 ) ; then + cf_cv_pragma_unreferenced=yes +else + cf_cv_pragma_unreferenced=no +fi +rm -f conftest* + + echo "$as_me:13471: result: $cf_cv_pragma_unreferenced" >&5 +echo "${ECHO_T}$cf_cv_pragma_unreferenced" >&6 + + # if the pragma is supported, use it (needed in the Trace code). + if test $cf_cv_pragma_unreferenced = yes ; then + PRAGMA_UNREF=TRUE + else + PRAGMA_UNREF=FALSE + fi + # Check whether --with-ada-compiler or --without-ada-compiler was given. if test "${with_ada_compiler+set}" = set; then withval="$with_ada_compiler" @@ -11647,7 +13514,7 @@ case ".$withval" in #(vi withval=`echo $withval | sed -e s%NONE%$ac_default_prefix%` ;; *) - { { echo "$as_me:11650: error: expected a pathname, not \"$withval\"" >&5 + { { echo "$as_me:13517: error: expected a pathname, not \"$withval\"" >&5 echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} { (exit 1); exit 1; }; } ;; @@ -11681,7 +13548,7 @@ case ".$withval" in #(vi withval=`echo $withval | sed -e s%NONE%$ac_default_prefix%` ;; *) - { { echo "$as_me:11684: error: expected a pathname, not \"$withval\"" >&5 + { { echo "$as_me:13551: error: expected a pathname, not \"$withval\"" >&5 echo "$as_me: error: expected a pathname, not \"$withval\"" >&2;} { (exit 1); exit 1; }; } ;; @@ -11694,9 +13561,9 @@ fi ### Construct the library-subsets, if any, from this set of keywords: ### none, base, ext_funcs, ext_tinfo, termlib, widechar (see CF_LIB_RULES). -echo "$as_me:11697: checking for library subsets" >&5 +echo "$as_me:13564: checking for library subsets" >&5 echo $ECHO_N "checking for library subsets... $ECHO_C" >&6 -if test "$with_termlib" = yes ; then +if test "$with_termlib" != no ; then LIB_SUBSETS="termlib" test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo" LIB_SUBSETS="${LIB_SUBSETS} " @@ -11707,7 +13574,7 @@ fi LIB_SUBSETS="${LIB_SUBSETS}base" test "$with_widec" = yes && LIB_SUBSETS="${LIB_SUBSETS}+widechar" test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_funcs" -echo "$as_me:11710: result: $LIB_SUBSETS" >&5 +echo "$as_me:13577: result: $LIB_SUBSETS" >&5 echo "${ECHO_T}$LIB_SUBSETS" >&6 ### Construct the list of include-directories to be generated @@ -11745,7 +13612,7 @@ elif test "$includedir" != "/usr/include"; then fi ### Build up pieces for makefile rules -echo "$as_me:11748: checking default library suffix" >&5 +echo "$as_me:13615: checking default library suffix" >&5 echo $ECHO_N "checking default library suffix... $ECHO_C" >&6 case $DFT_LWR_MODEL in @@ -11756,10 +13623,10 @@ echo $ECHO_N "checking default library suffix... $ECHO_C" >&6 shared) DFT_ARG_SUFFIX='' ;; esac test -n "$LIB_SUFFIX" && DFT_ARG_SUFFIX="${LIB_SUFFIX}${DFT_ARG_SUFFIX}" -echo "$as_me:11759: result: $DFT_ARG_SUFFIX" >&5 +echo "$as_me:13626: result: $DFT_ARG_SUFFIX" >&5 echo "${ECHO_T}$DFT_ARG_SUFFIX" >&6 -echo "$as_me:11762: checking default library-dependency suffix" >&5 +echo "$as_me:13629: checking default library-dependency suffix" >&5 echo $ECHO_N "checking default library-dependency suffix... $ECHO_C" >&6 case $DFT_LWR_MODEL in @@ -11788,10 +13655,10 @@ if test $DFT_LWR_MODEL = shared ; then ;; esac fi -echo "$as_me:11791: result: $DFT_DEP_SUFFIX" >&5 +echo "$as_me:13658: result: $DFT_DEP_SUFFIX" >&5 echo "${ECHO_T}$DFT_DEP_SUFFIX" >&6 -echo "$as_me:11794: checking default object directory" >&5 +echo "$as_me:13661: checking default object directory" >&5 echo $ECHO_N "checking default object directory... $ECHO_C" >&6 case $DFT_LWR_MODEL in @@ -11807,12 +13674,12 @@ echo $ECHO_N "checking default object directory... $ECHO_C" >&6 DFT_OBJ_SUBDIR='obj_s' ;; esac esac -echo "$as_me:11810: result: $DFT_OBJ_SUBDIR" >&5 +echo "$as_me:13677: result: $DFT_OBJ_SUBDIR" >&5 echo "${ECHO_T}$DFT_OBJ_SUBDIR" >&6 # libtool thinks it can make c++ shared libraries (perhaps only g++) if test "$cf_with_cxx" = yes ; then -echo "$as_me:11815: checking c++ library-dependency suffix" >&5 +echo "$as_me:13682: checking c++ library-dependency suffix" >&5 echo $ECHO_N "checking c++ library-dependency suffix... $ECHO_C" >&6 if test "$with_libtool" != "no"; then CXX_LIB_SUFFIX=$DFT_DEP_SUFFIX @@ -11838,22 +13705,51 @@ else esac test -n "$LIB_SUFFIX" && CXX_LIB_SUFFIX="${LIB_SUFFIX}${CXX_LIB_SUFFIX}" fi -echo "$as_me:11841: result: $CXX_LIB_SUFFIX" >&5 +echo "$as_me:13708: result: $CXX_LIB_SUFFIX" >&5 echo "${ECHO_T}$CXX_LIB_SUFFIX" >&6 fi +### Set up low-level terminfo dependencies for makefiles. TINFO_LIST="$SHLIB_LIST" -if test "$with_libtool" = no ; then - test "$with_termlib" = yes && SHLIB_LIST="$SHLIB_LIST -ltinfo${LIB_SUFFIX}" +if test "$with_termlib" != no ; then + + if test "$with_termlib" != yes ; then + TINFO_NAME=$with_termlib + TINFO_ARG_SUFFIX="${with_termlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`" + TINFO_DEP_SUFFIX="${with_termlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`" + TINFO_LIB_SUFFIX="${with_termlib}" + else + TINFO_ARG_SUFFIX="${TINFO_NAME}${DFT_ARG_SUFFIX}" + TINFO_DEP_SUFFIX="${TINFO_NAME}${DFT_DEP_SUFFIX}" + TINFO_LIB_SUFFIX="${TINFO_NAME}${LIB_SUFFIX}" + fi + + TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}" + TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}" + if test "$DFT_LWR_MODEL" = "libtool"; then + TEST_ARGS="${TEST_DEPS}" + TEST_ARG2="${TEST_DEP2}" + TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS" + else + TEST_ARGS="-l${TINFO_ARG_SUFFIX}" + TEST_ARG2="-l${TINFO_ARG_SUFFIX}" + TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS" + SHLIB_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}" + fi +else + TINFO_ARGS="-L${LIB_DIR} -l${LIB_NAME}${DFT_ARG_SUFFIX}" fi -echo "$as_me:11851: checking where we will install curses.h" >&5 +# needed for Ada95 +TINFO_ARGS2=`echo "$TINFO_ARGS" | sed -e 's,-L\.\./,-L../../,'` + +echo "$as_me:13747: checking where we will install curses.h" >&5 echo $ECHO_N "checking where we will install curses.h... $ECHO_C" >&6 test "$with_overwrite" = no && \ test "x$includedir" = 'x${prefix}/include' && \ includedir='$(prefix)/include/ncurses'${LIB_SUFFIX} -echo "$as_me:11856: result: $includedir" >&5 +echo "$as_me:13752: result: $includedir" >&5 echo "${ECHO_T}$includedir" >&6 ### Resolve a conflict between normal and wide-curses by forcing applications @@ -11861,24 +13757,11 @@ echo "${ECHO_T}$includedir" >&6 if test "$with_overwrite" != no ; then if test "$NCURSES_LIBUTF8" = 1 ; then NCURSES_LIBUTF8='defined(HAVE_LIBUTF8_H)' - { echo "$as_me:11864: WARNING: Wide-character applications must define HAVE_LIBUTF8_H to include curses.h" >&5 + { echo "$as_me:13760: WARNING: Wide-character applications must define HAVE_LIBUTF8_H to include curses.h" >&5 echo "$as_me: WARNING: Wide-character applications must define HAVE_LIBUTF8_H to include curses.h" >&2;} fi fi -### Set up low-level terminfo dependencies for makefiles. Note that we -### could override this. -if test "$with_termlib" = yes ; then - TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}" - if test "$DFT_LWR_MODEL" = "libtool"; then - TEST_ARGS="${TEST_DEPS}" - else - TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}" - fi -fi -PROG_DEPS="$TEST_DEPS" -PROG_ARGS="$TEST_ARGS" - ### predefined stuff for the test programs cat >>confdefs.h <<\EOF #define HAVE_SLK_COLOR 1 @@ -11887,20 +13770,20 @@ EOF ### Construct the list of subdirectories for which we'll customize makefiles ### with the appropriate compile-rules. -echo "$as_me:11890: checking for src modules" >&5 +echo "$as_me:13773: checking for src modules" >&5 echo $ECHO_N "checking for src modules... $ECHO_C" >&6 # dependencies and linker-arguments for test-programs TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEPS" +TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${LIB_NAME}${DFT_DEP_SUFFIX} $TEST_DEP2" if test "$DFT_LWR_MODEL" = "libtool"; then TEST_ARGS="${TEST_DEPS}" + TEST_ARG2="${TEST_DEP2}" else TEST_ARGS="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARGS" + TEST_ARG2="-l${LIB_NAME}${DFT_ARG_SUFFIX} $TEST_ARG2" fi -# dependencies and linker-arguments for utility-programs -test "$with_termlib" != yes && PROG_ARGS="$TEST_ARGS" - cf_cv_src_modules= for cf_dir in $modules_to_build do @@ -11939,19 +13822,22 @@ EOF EOF TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEPS" + TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${cf_dir}${DFT_DEP_SUFFIX} $TEST_DEP2" if test "$DFT_LWR_MODEL" = "libtool"; then TEST_ARGS="${TEST_DEPS}" + TEST_ARG2="${TEST_DEP2}" else TEST_ARGS="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARGS" + TEST_ARG2="-l${cf_dir}${DFT_ARG_SUFFIX} $TEST_ARG2" fi fi fi done -echo "$as_me:11950: result: $cf_cv_src_modules" >&5 +echo "$as_me:13836: result: $cf_cv_src_modules" >&5 echo "${ECHO_T}$cf_cv_src_modules" >&6 -TEST_ARGS="-L${LIB_DIR} $TEST_ARGS" -PROG_ARGS="-L${LIB_DIR} $PROG_ARGS" +TEST_ARGS="-L${LIB_DIR} $TEST_ARGS" +TEST_ARG2="-L${LIB_2ND} $TEST_ARG2" SRC_SUBDIRS="man include" for cf_dir in $cf_cv_src_modules @@ -12021,12 +13907,34 @@ EOF ### Now that we're done running tests, add the compiler-warnings, if any +cf_fix_cppflags=no cf_new_cflags= cf_new_cppflags= +cf_new_extra_cppflags= + for cf_add_cflags in $EXTRA_CFLAGS do +case $cf_fix_cppflags in +no) case $cf_add_cflags in #(vi -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac case "$CPPFLAGS" in *$cf_add_cflags) #(vi ;; @@ -12039,6 +13947,17 @@ do cf_new_cflags="$cf_new_cflags $cf_add_cflags" ;; esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac done if test -n "$cf_new_cflags" ; then @@ -12051,6 +13970,11 @@ if test -n "$cf_new_cppflags" ; then CPPFLAGS="$cf_new_cppflags $CPPFLAGS" fi +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + ################################################################################ test "$use_database" = yes && SUB_MAKEFILES="$SUB_MAKEFILES misc/run_tic.sh:misc/run_tic.in" ac_config_files="$ac_config_files include/MKterm.h.awk include/curses.head:include/curses.h.in include/termcap.h include/unctrl.h $SUB_MAKEFILES Makefile" @@ -12134,7 +14058,7 @@ DEFS=-DHAVE_CONFIG_H : ${CONFIG_STATUS=./config.status} ac_clean_files_save=$ac_clean_files ac_clean_files="$ac_clean_files $CONFIG_STATUS" -{ echo "$as_me:12137: creating $CONFIG_STATUS" >&5 +{ echo "$as_me:14061: creating $CONFIG_STATUS" >&5 echo "$as_me: creating $CONFIG_STATUS" >&6;} cat >$CONFIG_STATUS <<_ACEOF #! $SHELL @@ -12310,7 +14234,7 @@ cat >>$CONFIG_STATUS <<\EOF echo "$ac_cs_version"; exit 0 ;; --he | --h) # Conflict between --help and --header - { { echo "$as_me:12313: error: ambiguous option: $1 + { { echo "$as_me:14237: error: ambiguous option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: ambiguous option: $1 Try \`$0 --help' for more information." >&2;} @@ -12329,7 +14253,7 @@ Try \`$0 --help' for more information." >&2;} ac_need_defaults=false;; # This is an error. - -*) { { echo "$as_me:12332: error: unrecognized option: $1 + -*) { { echo "$as_me:14256: error: unrecognized option: $1 Try \`$0 --help' for more information." >&5 echo "$as_me: error: unrecognized option: $1 Try \`$0 --help' for more information." >&2;} @@ -12369,6 +14293,7 @@ cat >>$CONFIG_STATUS <&5 + *) { { echo "$as_me:14342: error: invalid argument: $ac_config_target" >&5 echo "$as_me: error: invalid argument: $ac_config_target" >&2;} { (exit 1); exit 1; }; };; esac @@ -12519,6 +14449,7 @@ s,@ac_ct_CC@,$ac_ct_CC,;t t s,@EXEEXT@,$EXEEXT,;t t s,@OBJEXT@,$OBJEXT,;t t s,@CPP@,$CPP,;t t +s,@EXTRA_CPPFLAGS@,$EXTRA_CPPFLAGS,;t t s,@PROG_EXT@,$PROG_EXT,;t t s,@LDCONFIG@,$LDCONFIG,;t t s,@CXX@,$CXX,;t t @@ -12545,11 +14476,13 @@ s,@AR_OPTS@,$AR_OPTS,;t t s,@cf_cv_makeflags@,$cf_cv_makeflags,;t t s,@DESTDIR@,$DESTDIR,;t t s,@BUILD_CC@,$BUILD_CC,;t t +s,@BUILD_CPP@,$BUILD_CPP,;t t s,@BUILD_CFLAGS@,$BUILD_CFLAGS,;t t s,@BUILD_CPPFLAGS@,$BUILD_CPPFLAGS,;t t s,@BUILD_LDFLAGS@,$BUILD_LDFLAGS,;t t s,@BUILD_LIBS@,$BUILD_LIBS,;t t s,@BUILD_EXEEXT@,$BUILD_EXEEXT,;t t +s,@BUILD_OBJEXT@,$BUILD_OBJEXT,;t t s,@cf_list_models@,$cf_list_models,;t t s,@LIBTOOL@,$LIBTOOL,;t t s,@LIBTOOL_CXX@,$LIBTOOL_CXX,;t t @@ -12582,17 +14515,12 @@ s,@INSTALL_LIB@,$INSTALL_LIB,;t t s,@TERMINFO_SRC@,$TERMINFO_SRC,;t t s,@PATHSEP@,$PATHSEP,;t t s,@FALLBACK_LIST@,$FALLBACK_LIST,;t t +s,@WHICH_XTERM@,$WHICH_XTERM,;t t s,@TERMINFO_DIRS@,$TERMINFO_DIRS,;t t s,@TERMINFO@,$TERMINFO,;t t s,@MAKE_TERMINFO@,$MAKE_TERMINFO,;t t s,@TERMPATH@,$TERMPATH,;t t s,@BROKEN_LINKER@,$BROKEN_LINKER,;t t -s,@NCURSES_BOOL@,$NCURSES_BOOL,;t t -s,@NCURSES_OSPEED@,$NCURSES_OSPEED,;t t -s,@MANPAGE_RENAMES@,$MANPAGE_RENAMES,;t t -s,@NCURSES_EXT_FUNCS@,$NCURSES_EXT_FUNCS,;t t -s,@NCURSES_CONST@,$NCURSES_CONST,;t t -s,@NCURSES_XNAMES@,$NCURSES_XNAMES,;t t s,@NCURSES_CH_T@,$NCURSES_CH_T,;t t s,@NCURSES_LIBUTF8@,$NCURSES_LIBUTF8,;t t s,@NEED_WCHAR_H@,$NEED_WCHAR_H,;t t @@ -12601,13 +14529,24 @@ s,@NCURSES_WCHAR_T@,$NCURSES_WCHAR_T,;t t s,@NCURSES_WINT_T@,$NCURSES_WINT_T,;t t s,@NCURSES_OK_WCHAR_T@,$NCURSES_OK_WCHAR_T,;t t s,@NCURSES_OK_WINT_T@,$NCURSES_OK_WINT_T,;t t +s,@cf_cv_enable_lp64@,$cf_cv_enable_lp64,;t t +s,@NCURSES_BOOL@,$NCURSES_BOOL,;t t s,@TERMINFO_CAPS@,$TERMINFO_CAPS,;t t +s,@NCURSES_OSPEED@,$NCURSES_OSPEED,;t t +s,@MANPAGE_RENAMES@,$MANPAGE_RENAMES,;t t +s,@NCURSES_EXT_FUNCS@,$NCURSES_EXT_FUNCS,;t t +s,@NCURSES_CONST@,$NCURSES_CONST,;t t +s,@NCURSES_XNAMES@,$NCURSES_XNAMES,;t t +s,@NCURSES_EXT_COLORS@,$NCURSES_EXT_COLORS,;t t +s,@NCURSES_MOUSE_VERSION@,$NCURSES_MOUSE_VERSION,;t t s,@ECHO_LINK@,$ECHO_LINK,;t t s,@EXTRA_CFLAGS@,$EXTRA_CFLAGS,;t t +s,@EXTRA_CXXFLAGS@,$EXTRA_CXXFLAGS,;t t s,@ADA_TRACE@,$ADA_TRACE,;t t s,@MATH_LIB@,$MATH_LIB,;t t s,@cf_cv_typeof_chtype@,$cf_cv_typeof_chtype,;t t s,@cf_cv_1UL@,$cf_cv_1UL,;t t +s,@cf_cv_typeof_mmask_t@,$cf_cv_typeof_mmask_t,;t t s,@HAVE_VSSCANF@,$HAVE_VSSCANF,;t t s,@CXXCPP@,$CXXCPP,;t t s,@CXXLDFLAGS@,$CXXLDFLAGS,;t t @@ -12623,6 +14562,7 @@ s,@cf_ada_package@,$cf_ada_package,;t t s,@ADAFLAGS@,$ADAFLAGS,;t t s,@cf_compile_generics@,$cf_compile_generics,;t t s,@cf_generic_objects@,$cf_generic_objects,;t t +s,@PRAGMA_UNREF@,$PRAGMA_UNREF,;t t s,@ADA_INCLUDE@,$ADA_INCLUDE,;t t s,@ADA_OBJECTS@,$ADA_OBJECTS,;t t s,@ACPPFLAGS@,$ACPPFLAGS,;t t @@ -12630,12 +14570,17 @@ s,@DFT_ARG_SUFFIX@,$DFT_ARG_SUFFIX,;t t s,@DFT_DEP_SUFFIX@,$DFT_DEP_SUFFIX,;t t s,@DFT_OBJ_SUBDIR@,$DFT_OBJ_SUBDIR,;t t s,@CXX_LIB_SUFFIX@,$CXX_LIB_SUFFIX,;t t -s,@EXTRA_LIBS@,$EXTRA_LIBS,;t t +s,@TINFO_ARG_SUFFIX@,$TINFO_ARG_SUFFIX,;t t +s,@TINFO_DEP_SUFFIX@,$TINFO_DEP_SUFFIX,;t t +s,@TINFO_LIB_SUFFIX@,$TINFO_LIB_SUFFIX,;t t +s,@TINFO_ARGS@,$TINFO_ARGS,;t t +s,@TINFO_ARGS2@,$TINFO_ARGS2,;t t s,@TINFO_LIST@,$TINFO_LIST,;t t s,@SHLIB_LIST@,$SHLIB_LIST,;t t -s,@TEST_DEPS@,$TEST_DEPS,;t t s,@TEST_ARGS@,$TEST_ARGS,;t t -s,@PROG_ARGS@,$PROG_ARGS,;t t +s,@TEST_DEPS@,$TEST_DEPS,;t t +s,@TEST_ARG2@,$TEST_ARG2,;t t +s,@TEST_DEP2@,$TEST_DEP2,;t t s,@ADA_SUBDIRS@,$ADA_SUBDIRS,;t t s,@DIRS_TO_MAKE@,$DIRS_TO_MAKE,;t t CEOF @@ -12752,7 +14697,7 @@ done; } esac if test x"$ac_file" != x-; then - { echo "$as_me:12755: creating $ac_file" >&5 + { echo "$as_me:14700: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} rm -f "$ac_file" fi @@ -12770,7 +14715,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:12773: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:14718: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -12783,7 +14728,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:12786: error: cannot find input file: $f" >&5 + { { echo "$as_me:14731: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -12849,7 +14794,7 @@ for ac_file in : $CONFIG_HEADERS; do test "x$ac_file" = x: && continue * ) ac_file_in=$ac_file.in ;; esac - test x"$ac_file" != x- && { echo "$as_me:12852: creating $ac_file" >&5 + test x"$ac_file" != x- && { echo "$as_me:14797: creating $ac_file" >&5 echo "$as_me: creating $ac_file" >&6;} # First look for the input files in the build tree, otherwise in the @@ -12860,7 +14805,7 @@ echo "$as_me: creating $ac_file" >&6;} -) echo $tmp/stdin ;; [\\/$]*) # Absolute (can't be DOS-style, as IFS=:) - test -f "$f" || { { echo "$as_me:12863: error: cannot find input file: $f" >&5 + test -f "$f" || { { echo "$as_me:14808: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } echo $f;; @@ -12873,7 +14818,7 @@ echo "$as_me: error: cannot find input file: $f" >&2;} echo $srcdir/$f else # /dev/null tree - { { echo "$as_me:12876: error: cannot find input file: $f" >&5 + { { echo "$as_me:14821: error: cannot find input file: $f" >&5 echo "$as_me: error: cannot find input file: $f" >&2;} { (exit 1); exit 1; }; } fi;; @@ -12931,7 +14876,7 @@ cat >>$CONFIG_STATUS <<\EOF rm -f $tmp/in if test x"$ac_file" != x-; then if cmp -s $ac_file $tmp/config.h 2>/dev/null; then - { echo "$as_me:12934: $ac_file is unchanged" >&5 + { echo "$as_me:14879: $ac_file is unchanged" >&5 echo "$as_me: $ac_file is unchanged" >&6;} else ac_dir=`$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ @@ -13026,13 +14971,33 @@ do case "$cf_cv_shlib_version" in #(vi rel) #(vi case "$cf_cv_system_name" in #(vi - darwin*) cf_suffix='.$(REL_VERSION)'"$cf_suffix" ;; #(vi + darwin*) + case .${LIB_SUFFIX} in + .w*) + cf_suffix=`echo $cf_suffix | sed 's/^w//'` + cf_suffix=w'.$(REL_VERSION)'"$cf_suffix" + ;; + *) + cf_suffix='.$(REL_VERSION)'"$cf_suffix" + ;; + esac + ;; #(vi *) cf_suffix="$cf_suffix"'.$(REL_VERSION)' ;; esac ;; abi) case "$cf_cv_system_name" in #(vi - darwin*) cf_suffix='.$(ABI_VERSION)'"$cf_suffix" ;; #(vi + darwin*) + case .${LIB_SUFFIX} in + .w*) + cf_suffix=`echo $cf_suffix | sed 's/^w//'` + cf_suffix=w'.$(ABI_VERSION)'"$cf_suffix" + ;; + *) + cf_suffix='.$(ABI_VERSION)'"$cf_suffix" + ;; + esac + ;; #(vi *) cf_suffix="$cf_suffix"'.$(ABI_VERSION)' ;; esac ;; @@ -13055,7 +15020,7 @@ do cf_subsets="$LIB_SUBSETS" cf_termlib=`echo "$cf_subsets" |sed -e 's/ .*$//'` if test "$cf_termlib" != "$cf_subsets" ; then - cf_item=`echo $LIBS_TO_MAKE |sed -e s%$LIB_NAME%$TINFO_NAME%g` + cf_item=`echo $LIBS_TO_MAKE |sed -e s%${LIB_NAME}${LIB_SUFFIX}%${TINFO_LIB_SUFFIX}%g` LIBS_TO_MAKE="$cf_item $LIBS_TO_MAKE" fi else @@ -13079,7 +15044,7 @@ do do echo "Appending rules for ${cf_item} model (${cf_dir}: ${cf_subset})" -CF_ITEM=`echo "$cf_item" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` +cf_ITEM=`echo "$cf_item" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQRSTUVWXYZ___%` case $cf_item in libtool) cf_suffix='.la' ;; @@ -13115,6 +15080,22 @@ CF_ITEM=`echo "$cf_item" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQ esac esac + # Test for case where we build libtinfo with a different name. + cf_libname=$cf_dir + if test $cf_dir = ncurses ; then + case $cf_subset in + *base*) + ;; + termlib*) + cf_libname=$TINFO_LIB_SUFFIX + if test -n "${DFT_ARG_SUFFIX}" ; then + # undo $LIB_SUFFIX add-on in CF_LIB_SUFFIX + cf_suffix=`echo $cf_suffix |sed -e "s%^${LIB_SUFFIX}%%"` + fi + ;; + esac + fi + # These dependencies really are for development, not # builds, but they are useful in porting, too. cf_depend="../include/ncurses_cfg.h" @@ -13130,10 +15111,24 @@ CF_ITEM=`echo "$cf_item" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQ cf_depend="$cf_depend $cf_reldir/curses.priv.h" fi + cf_dir_suffix= + old_cf_suffix="$cf_suffix" + if test "$cf_cv_shlib_version_infix" = yes ; then + if test -n "$LIB_SUFFIX" ; then + case $LIB_SUFFIX in + w*) + cf_libname=`echo $cf_libname | sed 's/w$//'` + cf_suffix=`echo $cf_suffix | sed 's/^w//'` + cf_dir_suffix=w + ;; + esac + fi + fi + $AWK -f $srcdir/mk-1st.awk \ - name=$cf_dir \ + name=${cf_libname}${cf_dir_suffix} \ traces=$LIB_TRACING \ - MODEL=$CF_ITEM \ + MODEL=$cf_ITEM \ model=$cf_subdir \ prefix=$cf_prefix \ suffix=$cf_suffix \ @@ -13147,6 +15142,9 @@ CF_ITEM=`echo "$cf_item" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQ depend="$cf_depend" \ host="$host" \ $srcdir/$cf_dir/modules >>$cf_dir/Makefile + + cf_suffix="$old_cf_suffix" + for cf_subdir2 in $cf_subdirs lib do test $cf_subdir = $cf_subdir2 && break @@ -13155,11 +15153,13 @@ CF_ITEM=`echo "$cf_item" | sed y%abcdefghijklmnopqrstuvwxyz./-%ABCDEFGHIJKLMNOPQ $AWK -f $srcdir/mk-2nd.awk \ name=$cf_dir \ traces=$LIB_TRACING \ - MODEL=$CF_ITEM \ + MODEL=$cf_ITEM \ model=$cf_subdir \ subset=$cf_subset \ srcdir=$srcdir \ echo=$WITH_ECHO \ + crenames=$cf_cv_prog_CC_c_o \ + cxxrenames=$cf_cv_prog_CXX_c_o \ $srcdir/$cf_dir/modules >>$cf_dir/Makefile cf_subdirs="$cf_subdirs $cf_subdir" done diff --git a/configure.in b/configure.in index 02fd45cd..10a189ce 100644 --- a/configure.in +++ b/configure.in @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * +dnl Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * dnl copy of this software and associated documentation files (the * @@ -28,14 +28,14 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey 1995-on dnl -dnl $Id: configure.in,v 1.312 2004/01/24 19:29:13 tom Exp $ +dnl $Id: configure.in,v 1.351 2005/09/17 22:41:48 tom Exp $ dnl Process this file with autoconf to produce a configure script. dnl dnl See http://invisible-island.net/autoconf/ for additional information. dnl dnl --------------------------------------------------------------------------- AC_PREREQ(2.13.20020210) -AC_REVISION($Revision: 1.312 $) +AC_REVISION($Revision: 1.351 $) AC_INIT(ncurses/base/lib_initscr.c) AC_CONFIG_HEADER(include/ncurses_cfg.h:include/ncurses_cfg.hin) @@ -62,6 +62,7 @@ CF_GCC_VERSION AC_PROG_CPP AC_PROG_GCC_TRADITIONAL +CF_PROG_CC_C_O(CC) AC_ISC_POSIX CF_ANSI_CC_REQD CF_PROG_EXT @@ -180,37 +181,7 @@ CF_HELP_MESSAGE(Build-Tools Needed to Compile Temporary Applications for Cross-c # If we're cross-compiling, allow the user to override the tools and their # options. The configure script is oriented toward identifying the host # compiler, etc., but we need a build compiler to generate parts of the source. -: ${BUILD_CC:='$(CC)'} -: ${BUILD_CFLAGS:='$(CFLAGS)'} -: ${BUILD_CPPFLAGS:='$(CPPFLAGS)'} -: ${BUILD_LDFLAGS:='$(LDFLAGS)'} -: ${BUILD_LIBS:='$(LIBS)'} -: ${BUILD_EXEEXT:='$x'} -if test "$cross_compiling" = yes ; then - AC_ARG_WITH(build-cc, - [ --with-build-cc=XXX the build C compiler ($BUILD_CC)], - [BUILD_CC="$withval"], - [AC_CHECK_PROGS(BUILD_CC, $CC gcc cc)]) - AC_ARG_WITH(build-cflags, - [ --with-build-cflags=XXX the build C compiler-flags], - [BUILD_CFLAGS="$withval"]) - AC_ARG_WITH(build-cppflags, - [ --with-build-cppflags=XXX the build C preprocessor-flags], - [BUILD_CPPFLAGS="$withval"]) - AC_ARG_WITH(build-ldflags, - [ --with-build-ldflags=XXX the build linker-flags], - [BUILD_LDFLAGS="$withval"]) - AC_ARG_WITH(build-libs, - [ --with-build-libs=XXX the build libraries], - [BUILD_LIBS="$withval"]) - BUILD_EXEEXT= -fi -AC_SUBST(BUILD_CC) -AC_SUBST(BUILD_CFLAGS) -AC_SUBST(BUILD_CPPFLAGS) -AC_SUBST(BUILD_LDFLAGS) -AC_SUBST(BUILD_LIBS) -AC_SUBST(BUILD_EXEEXT) +CF_BUILD_CC ############################################################################### CF_HELP_MESSAGE(Options to Specify the Libraries Built/Used:) @@ -289,6 +260,8 @@ LIB_NAME=ncurses AC_SUBST(LIB_NAME) LIB_DIR=../lib +LIB_2ND=../../lib + CF_LIB_PREFIX(cf_prefix) LIB_PREFIX=$cf_prefix AC_SUBST(LIB_PREFIX) @@ -310,19 +283,16 @@ CF_WITH_DBMALLOC CF_WITH_DMALLOC SHLIB_LIST="" -AC_MSG_CHECKING(if you want to link with the gpm mouse library) -AC_ARG_WITH(gpm, - [ --with-gpm use Alessandro Rubini's GPM library], - [with_gpm=$withval], - [with_gpm=no]) -AC_MSG_RESULT($with_gpm) +CF_WITH_GPM if test "$with_gpm" = yes ; then - AC_CHECK_LIB(gpm,Gpm_Open,[ - EXTRA_LIBS="-lgpm -lncurses $EXTRA_LIBS" - SHLIB_LIST="-lgpm $SHLIB_LIST" - AC_DEFINE(HAVE_LIBGPM) - AC_CHECK_HEADERS(gpm.h) - ],AC_MSG_WARN(Cannot link with gpm library - read the FAQ)) + CF_FUNC_DLSYM + CF_LIB_SONAME([#include ],[if (Gpm_Open(0,0)) Gpm_Close();],gpm) + test "$cf_cv_gpm_soname" != "unknown" && AC_DEFINE_UNQUOTED(LIBGPM_SONAME,"$cf_cv_gpm_soname") + SHLIB_LIST="-ldl $SHLIB_LIST" + AC_DEFINE(HAVE_LIBGPM) + AC_CHECK_LIB(gpm,Gpm_Wgetch,[ + AC_MSG_WARN(GPM library is already linked with curses - read the FAQ) + ]) fi CF_WITH_SYSMOUSE @@ -415,6 +385,19 @@ AC_MSG_RESULT($with_fallback) FALLBACK_LIST=`echo "$with_fallback" | sed -e 's/,/ /g'` AC_SUBST(FALLBACK_LIST) +AC_MSG_CHECKING(if you want modern xterm or antique) +AC_ARG_WITH(xterm-new, + [ --without-xterm-new specify if xterm terminfo should be old version], + [with_xterm_new=$withval], + [with_xterm_new=yes]) +case $with_xterm_new in +no) with_xterm_new=xterm-old;; +*) with_xterm_new=xterm-new;; +esac +AC_MSG_RESULT($with_xterm_new) +WHICH_XTERM=$with_xterm_new +AC_SUBST(WHICH_XTERM) + MAKE_TERMINFO= if test "$use_database" = no ; then TERMINFO="${datadir}/terminfo" @@ -517,8 +500,17 @@ AC_ARG_ENABLE(home-terminfo, [ --disable-home-terminfo drop ~/.terminfo from terminfo search-path], [with_home_terminfo=$enableval], [with_home_terminfo=yes]) +AC_MSG_RESULT($with_home_terminfo) test "$with_home_terminfo" = "yes" && AC_DEFINE(USE_HOME_TERMINFO) +AC_MSG_CHECKING(if you want to use restrict environment when running as root) +AC_ARG_ENABLE(root-environ, + [ --disable-root-environ limit environment when running as root], + [with_root_environ=$enableval], + [with_root_environ=yes]) +AC_MSG_RESULT($with_root_environ) +test "$with_root_environ" = yes && AC_DEFINE(USE_ROOT_ENVIRON) + ### Use option --enable-symlinks to make tic use symlinks, not hard links ### to reduce storage requirements for the terminfo database. CF_LINK_FUNCS @@ -577,6 +569,89 @@ elif test "$DFT_LWR_MODEL" = shared ; then fi AC_SUBST(BROKEN_LINKER) +### use option --enable-widec to turn on use of wide-character support +NCURSES_CH_T=chtype +NCURSES_LIBUTF8=0 + +NEED_WCHAR_H=0 +NCURSES_MBSTATE_T=0 +NCURSES_WCHAR_T=0 +NCURSES_WINT_T=0 + +# Check to define _XOPEN_SOURCE "automatically" +CF_XOPEN_SOURCE + +# Checks for CODESET support. +AM_LANGINFO_CODESET + +# use these variables to work around a defect in gcc's fixincludes. +NCURSES_OK_WCHAR_T= +NCURSES_OK_WINT_T= + +AC_MSG_CHECKING(if you want wide-character code) +AC_ARG_ENABLE(widec, + [ --enable-widec compile with wide-char/UTF-8 code], + [with_widec=$enableval], + [with_widec=no]) +AC_MSG_RESULT($with_widec) +if test "$with_widec" = yes ; then + LIB_SUFFIX="w${LIB_SUFFIX}" + AC_DEFINE(USE_WIDEC_SUPPORT) + CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED) + # with_overwrite=no + NCURSES_CH_T=cchar_t + AC_CHECK_FUNCS(putwc btowc wctob mbtowc wctomb mblen mbrlen mbrtowc) + if test "$ac_cv_func_putwc" != yes ; then + CF_LIBUTF8 + if test "$cf_cv_libutf8" = yes ; then + NCURSES_LIBUTF8=1 + fi + fi + CF_WCHAR_TYPE(mbstate_t, NCURSES_MBSTATE_T) + CF_WCHAR_TYPE(wchar_t, NCURSES_WCHAR_T, NCURSES_OK_WCHAR_T) + CF_WCHAR_TYPE(wint_t, NCURSES_WINT_T, NCURSES_OK_WINT_T) + + if test "$NCURSES_MBSTATE_T" != 0; then + AC_DEFINE(NEED_MBSTATE_T_DEF) + fi +fi +AC_SUBST(NCURSES_CH_T) +AC_SUBST(NCURSES_LIBUTF8) + +AC_SUBST(NEED_WCHAR_H) +AC_SUBST(NCURSES_MBSTATE_T) +AC_SUBST(NCURSES_WCHAR_T) +AC_SUBST(NCURSES_WINT_T) + +AC_SUBST(NCURSES_OK_WCHAR_T) +AC_SUBST(NCURSES_OK_WINT_T) + +### use option --disable-lp64 to allow long chtype +case $cf_cv_abi_version in +[[345]]*) + default_with_lp64=no + ;; +*) + default_with_lp64=yes + ;; +esac + +AC_MSG_CHECKING(whether to enable _LP64 definition in curses.h) +AC_ARG_ENABLE(lp64, + [ --disable-lp64 allow chtype to be long (ignore _LP64)], + [with_lp64=$enableval], + [with_lp64=$default_with_lp64]) +AC_MSG_RESULT($with_lp64) + +if test "$with_lp64" = yes ; then + cf_cv_enable_lp64=1 +else + cf_cv_enable_lp64=0 +fi +AC_SUBST(cf_cv_enable_lp64) + +CF_LARGEFILE + ### use option --with-bool to override bool's type AC_MSG_CHECKING(for type of bool) AC_ARG_WITH(bool, @@ -586,6 +661,23 @@ AC_ARG_WITH(bool, AC_MSG_RESULT($NCURSES_BOOL) AC_SUBST(NCURSES_BOOL) +AC_MSG_CHECKING(for alternate terminal capabilities file) +AC_ARG_WITH(caps, + [ --with-caps=alt compile with alternate Caps file], + [TERMINFO_CAPS=Caps.$withval], + [TERMINFO_CAPS=Caps]) +test -f ${srcdir}/include/${TERMINFO_CAPS} || TERMINFO_CAPS=Caps +AC_MSG_RESULT($TERMINFO_CAPS) +AC_SUBST(TERMINFO_CAPS) + +### use option --with-chtype to override chtype's type +AC_MSG_CHECKING(for type of chtype) +AC_ARG_WITH(chtype, + [ --with-chtype=TYPE override type of chtype], + [NCURSES_CHTYPE="$withval"], + [NCURSES_CHTYPE=auto]) +AC_MSG_RESULT($NCURSES_CHTYPE) + ### use option --with-ospeed to override ospeed's type AC_MSG_CHECKING(for type of ospeed) AC_ARG_WITH(ospeed, @@ -595,6 +687,14 @@ AC_ARG_WITH(ospeed, AC_MSG_RESULT($NCURSES_OSPEED) AC_SUBST(NCURSES_OSPEED) +### use option --with-mmask-t to override mmask_t's type +AC_MSG_CHECKING(for type of mmask_t) +AC_ARG_WITH(mmask-t, + [ --with-mmask-t=TYPE override type of mmask_t], + [NCURSES_MMASK_T="$withval"], + [NCURSES_MMASK_T=auto]) +AC_MSG_RESULT($NCURSES_MMASK_T) + ### use option --enable-bsdpad to have tputs process BSD-style prefix padding AC_MSG_CHECKING(if tputs should process BSD-style prefix padding) AC_ARG_ENABLE(bsdpad, @@ -700,14 +800,6 @@ AC_ARG_ENABLE(hard-tabs, AC_MSG_RESULT($with_hardtabs) test "$with_hardtabs" = yes && AC_DEFINE(USE_HARD_TABS) -AC_MSG_CHECKING(if you want to use restrict environment when running as root) -AC_ARG_ENABLE(root-environ, - [ --disable-root-environ limit environment when running as root], - [with_root_environ=$enableval], - [with_root_environ=yes]) -AC_MSG_RESULT($with_root_environ) -test "$with_root_environ" = yes && AC_DEFINE(USE_ROOT_ENVIRON) - ### use option --enable-xmc-glitch to turn on use of magic-cookie optimize AC_MSG_CHECKING(if you want limited support for xmc) AC_ARG_ENABLE(xmc-glitch, @@ -747,6 +839,40 @@ AC_ARG_ENABLE(colorfgbg, AC_MSG_RESULT($with_colorfgbg) test "$with_colorfgbg" = yes && AC_DEFINE(USE_COLORFGBG) +### use option --enable-ext-colors to turn on use of colors beyond 16. +AC_MSG_CHECKING(if you want to use experimental extended colors) +AC_ARG_ENABLE(ext-colors, + [ --enable-ext-colors compile for experimental 256-color support], + [with_ext_colors=$enableval], + [with_ext_colors=no]) +AC_MSG_RESULT($with_ext_colors) +NCURSES_EXT_COLORS=0 +if test "$with_ext_colors" = yes ; then + if test "$with_widec" != yes ; then + AC_MSG_WARN(This option applies only to wide-character library) + else + # cannot be ABI 5 since it changes sizeof(cchar_t) + CF_NCURSES_ABI_6 + fi + NCURSES_EXT_COLORS=1 + AC_DEFINE(NCURSES_EXT_COLORS) +fi +AC_SUBST(NCURSES_EXT_COLORS) + +### use option --enable-ext-mouse to modify coding to support 5-button mice +AC_MSG_CHECKING(if you want to use experimental extended mouse encoding) +AC_ARG_ENABLE(ext-mouse, + [ --enable-ext-mouse compile for experimental mouse-encoding], + [with_ext_mouse=$enableval], + [with_ext_mouse=no]) +AC_MSG_RESULT($with_ext_mouse) +NCURSES_MOUSE_VERSION=1 +if test "$with_ext_mouse" = yes ; then + NCURSES_MOUSE_VERSION=2 + CF_NCURSES_ABI_6 +fi +AC_SUBST(NCURSES_MOUSE_VERSION) + AC_MSG_CHECKING(if you want experimental safe-sprintf code) AC_ARG_ENABLE(safe-sprintf, [ --enable-safe-sprintf compile with experimental safe-sprintf code], @@ -767,66 +893,6 @@ AC_MSG_RESULT($with_scroll_hints) test "$with_scroll_hints" = yes && AC_DEFINE(USE_SCROLL_HINTS) fi -### use option --enable-widec to turn on use of wide-character support -NCURSES_CH_T=chtype -NCURSES_LIBUTF8=0 - -NEED_WCHAR_H=0 -NCURSES_MBSTATE_T=0 -NCURSES_WCHAR_T=0 -NCURSES_WINT_T=0 - -# Check to define _XOPEN_SOURCE "automatically" -CF_XOPEN_SOURCE - -# use these variables to work around a defect in gcc's fixincludes. -NCURSES_OK_WCHAR_T= -NCURSES_OK_WINT_T= - -AC_MSG_CHECKING(if you want experimental wide-character code) -AC_ARG_ENABLE(widec, - [ --enable-widec compile with experimental wide-char/UTF-8 code], - [with_widec=$enableval], - [with_widec=no]) -AC_MSG_RESULT($with_widec) -if test "$with_widec" = yes ; then - LIB_SUFFIX="w${LIB_SUFFIX}" - AC_DEFINE(USE_WIDEC_SUPPORT) - CF_PREDEFINE(_XOPEN_SOURCE,500) - CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED) - # with_overwrite=no - NCURSES_CH_T=cchar_t - AC_CHECK_FUNCS(putwc btowc wctob mbtowc wctomb mblen mbrlen mbrtowc) - if test "$ac_cv_func_putwc" != yes ; then - CF_LIBUTF8 - if test "$cf_cv_libutf8" = yes ; then - NCURSES_LIBUTF8=1 - fi - fi - CF_WCHAR_TYPE(mbstate_t, NCURSES_MBSTATE_T) - CF_WCHAR_TYPE(wchar_t, NCURSES_WCHAR_T, NCURSES_OK_WCHAR_T) - CF_WCHAR_TYPE(wint_t, NCURSES_WINT_T, NCURSES_OK_WINT_T) -fi -AC_SUBST(NCURSES_CH_T) -AC_SUBST(NCURSES_LIBUTF8) - -AC_SUBST(NEED_WCHAR_H) -AC_SUBST(NCURSES_MBSTATE_T) -AC_SUBST(NCURSES_WCHAR_T) -AC_SUBST(NCURSES_WINT_T) - -AC_SUBST(NCURSES_OK_WCHAR_T) -AC_SUBST(NCURSES_OK_WINT_T) - -AC_MSG_CHECKING(for terminal capabilities file) -AC_ARG_WITH(caps, - [ --with-caps=alt compile with experimental alternate Caps file], - [TERMINFO_CAPS=Caps.$withval], - [TERMINFO_CAPS=Caps]) -test -f ${srcdir}/include/${TERMINFO_CAPS} || TERMINFO_CAPS=Caps -AC_MSG_RESULT($TERMINFO_CAPS) -AC_SUBST(TERMINFO_CAPS) - ############################################################################### CF_HELP_MESSAGE(Testing/development Options:) @@ -855,6 +921,9 @@ AC_MSG_RESULT($with_warnings) if test -n "$with_warnings"; then ADAFLAGS="$ADAFLAGS -gnatg" CF_GCC_WARNINGS + if test "$cf_with_cxx" = yes ; then + CF_GXX_WARNINGS(Wno-unused) + fi fi CF_GCC_ATTRIBUTES @@ -906,7 +975,7 @@ AC_ARG_WITH(trace, [ --with-trace test: add trace() function to all models of ncurses], [cf_with_trace=$withval], [cf_with_trace=$cf_all_traces]) -AC_MSG_RESULT($with_trace) +AC_MSG_RESULT($cf_with_trace) if test "$cf_with_trace" = yes ; then LIB_TRACING=all @@ -940,7 +1009,6 @@ dnl These are some other potentially nonportable headers. AC_CHECK_HEADERS( \ fcntl.h \ getopt.h \ -libc.h \ limits.h \ locale.h \ poll.h \ @@ -953,7 +1021,8 @@ sys/time.h \ sys/times.h \ ttyent.h \ unistd.h \ -wctype.h ) +wctype.h \ +) # check for ISC (this may also define _POSIX_SOURCE) # Note: even non-Posix ISC needs to declare fd_set @@ -970,7 +1039,25 @@ AC_C_CONST AC_C_INLINE test "$ac_cv_c_inline" != no && AC_DEFINE(CC_HAS_INLINE_FUNCS) -CF_TYPEOF_CHTYPE +if test $NCURSES_CHTYPE = auto ; then + CF_TYPEOF_CHTYPE +else + cf_cv_typeof_chtype=$NCURSES_CHTYPE +fi +AC_SUBST(cf_cv_typeof_chtype) + +CF_UNSIGNED_LITERALS +cf_cv_1UL="1" +test "$cf_cv_unsigned_literals" = yes && cf_cv_1UL="${cf_cv_1UL}U" +test "$cf_cv_typeof_chtype" = long && cf_cv_1UL="${cf_cv_1UL}L" +AC_SUBST(cf_cv_1UL) + +if test $NCURSES_MMASK_T = auto ; then + cf_cv_typeof_mmask_t=long +else + cf_cv_typeof_mmask_t=$NCURSES_MMASK_T +fi +AC_SUBST(cf_cv_typeof_mmask_t) ### Checks for external-data CF_ERRNO @@ -983,8 +1070,6 @@ getegid \ geteuid \ getttynam \ issetugid \ -memccpy \ -nanosleep \ poll \ remove \ select \ @@ -1005,6 +1090,7 @@ fi CF_ISASCII CF_STRUCT_SIGACTION +CF_FUNC_NANOSLEEP CF_FUNC_TERMIOS CF_FUNC_VSSCANF CF_MKSTEMP @@ -1042,6 +1128,7 @@ CF_BOOL_DECL(cf_cv_cc_bool_type) if test -n "$CXX" ; then AC_LANG_CPLUSPLUS CF_STDCPP_LIBRARY + CF_PROG_CC_C_O(CXX) case $GXX_VERSION in 1*|2.[0-6]*) @@ -1061,6 +1148,7 @@ if test -n "$CXX" ; then CF_BOOL_SIZE CF_ETIP_DEFINES CF_CPP_PARAM_INIT + CF_CPP_STATIC_CAST CF_CPP_VSCAN_FUNC CXX_AR='$(AR)' @@ -1168,6 +1256,28 @@ fi if test "$cf_cv_prog_gnat_correct" = yes; then ADAFLAGS="-O3 -gnatpn $ADAFLAGS" + AC_MSG_CHECKING(if GNAT pragma Unreferenced works) + CF_GNAT_TRY_LINK([procedure conftest;], +[with Text_IO; +with GNAT.OS_Lib; +procedure conftest is + test : Integer; + pragma Unreferenced (test); +begin + test := 1; + Text_IO.Put ("Hello World"); + Text_IO.New_Line; + GNAT.OS_Lib.OS_Exit (0); +end conftest;],[cf_cv_pragma_unreferenced=yes],[cf_cv_pragma_unreferenced=no]) + AC_MSG_RESULT($cf_cv_pragma_unreferenced) + + # if the pragma is supported, use it (needed in the Trace code). + if test $cf_cv_pragma_unreferenced = yes ; then + PRAGMA_UNREF=TRUE + else + PRAGMA_UNREF=FALSE + fi + AC_ARG_WITH(ada-compiler, [ --with-ada-compiler=CMD specify Ada95 compiler command (default gnatmake)], [cf_ada_compiler=$withval], @@ -1181,6 +1291,7 @@ if test "$cf_cv_prog_gnat_correct" = yes; then AC_SUBST(ADAFLAGS) AC_SUBST(cf_compile_generics) AC_SUBST(cf_generic_objects) + AC_SUBST(PRAGMA_UNREF) CF_WITH_PATH(ada-include, [ --with-ada-include=DIR Ada includes are in DIR], @@ -1202,7 +1313,7 @@ fi ### Construct the library-subsets, if any, from this set of keywords: ### none, base, ext_funcs, ext_tinfo, termlib, widechar (see CF_LIB_RULES). AC_MSG_CHECKING(for library subsets) -if test "$with_termlib" = yes ; then +if test "$with_termlib" != no ; then LIB_SUBSETS="termlib" test "$with_ext_funcs" = yes && LIB_SUBSETS="${LIB_SUBSETS}+ext_tinfo" LIB_SUBSETS="${LIB_SUBSETS} " @@ -1254,10 +1365,44 @@ AC_MSG_RESULT($CXX_LIB_SUFFIX) AC_SUBST(CXX_LIB_SUFFIX) fi +### Set up low-level terminfo dependencies for makefiles. TINFO_LIST="$SHLIB_LIST" -if test "$with_libtool" = no ; then - test "$with_termlib" = yes && SHLIB_LIST="$SHLIB_LIST -ltinfo${LIB_SUFFIX}" +if test "$with_termlib" != no ; then + + if test "$with_termlib" != yes ; then + TINFO_NAME=$with_termlib + TINFO_ARG_SUFFIX="${with_termlib}`echo ${DFT_ARG_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`" + TINFO_DEP_SUFFIX="${with_termlib}`echo ${DFT_DEP_SUFFIX}|sed -e "s/^${LIB_SUFFIX}//"`" + TINFO_LIB_SUFFIX="${with_termlib}" + else + TINFO_ARG_SUFFIX="${TINFO_NAME}${DFT_ARG_SUFFIX}" + TINFO_DEP_SUFFIX="${TINFO_NAME}${DFT_DEP_SUFFIX}" + TINFO_LIB_SUFFIX="${TINFO_NAME}${LIB_SUFFIX}" + fi + + TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}" + TEST_DEP2="${LIB_2ND}/${LIB_PREFIX}${TINFO_DEP_SUFFIX}" + if test "$DFT_LWR_MODEL" = "libtool"; then + TEST_ARGS="${TEST_DEPS}" + TEST_ARG2="${TEST_DEP2}" + TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS" + else + TEST_ARGS="-l${TINFO_ARG_SUFFIX}" + TEST_ARG2="-l${TINFO_ARG_SUFFIX}" + TINFO_ARGS="-L${LIB_DIR} $TEST_ARGS" + SHLIB_LIST="$SHLIB_LIST -l${TINFO_LIB_SUFFIX}" + fi +else + TINFO_ARGS="-L${LIB_DIR} -l${LIB_NAME}${DFT_ARG_SUFFIX}" fi +AC_SUBST(TINFO_ARG_SUFFIX) +AC_SUBST(TINFO_DEP_SUFFIX) +AC_SUBST(TINFO_LIB_SUFFIX) +AC_SUBST(TINFO_ARGS) + +# needed for Ada95 +TINFO_ARGS2=`echo "$TINFO_ARGS" | sed -e 's,-L\.\./,-L../../,'` +AC_SUBST(TINFO_ARGS2) AC_MSG_CHECKING(where we will install curses.h) test "$with_overwrite" = no && \ @@ -1274,23 +1419,9 @@ if test "$NCURSES_LIBUTF8" = 1 ; then fi fi -AC_SUBST(EXTRA_LIBS) AC_SUBST(TINFO_LIST) AC_SUBST(SHLIB_LIST) -### Set up low-level terminfo dependencies for makefiles. Note that we -### could override this. -if test "$with_termlib" = yes ; then - TEST_DEPS="${LIB_DIR}/${LIB_PREFIX}${TINFO_NAME}${DFT_DEP_SUFFIX}" - if test "$DFT_LWR_MODEL" = "libtool"; then - TEST_ARGS="${TEST_DEPS}" - else - TEST_ARGS="-l${TINFO_NAME}${DFT_ARG_SUFFIX}" - fi -fi -PROG_DEPS="$TEST_DEPS" -PROG_ARGS="$TEST_ARGS" - ### predefined stuff for the test programs AC_DEFINE(HAVE_SLK_COLOR) @@ -1323,6 +1454,7 @@ CF_LIB_RULES AWK="$AWK" CF_LIST_MODELS="$cf_list_models" +DFT_ARG_SUFFIX="$DFT_ARG_SUFFIX" DFT_LWR_MODEL="$DFT_LWR_MODEL" LDCONFIG="$LDCONFIG" LIB_NAME="$LIB_NAME" @@ -1333,12 +1465,17 @@ MAKE_TERMINFO="$MAKE_TERMINFO" NCURSES_OSPEED="$NCURSES_OSPEED" SRC_SUBDIRS="$SRC_SUBDIRS" TERMINFO="$TERMINFO" +TINFO_ARG_SUFFIX="$TINFO_ARG_SUFFIX" +TINFO_LIB_SUFFIX="$TINFO_LIB_SUFFIX" TINFO_NAME="$TINFO_NAME" WITH_CURSES_H="$with_curses_h" WITH_ECHO="$with_echo" WITH_OVERWRITE="$with_overwrite" cf_cv_abi_version="$cf_cv_abi_version" cf_cv_do_symlinks="$cf_cv_do_symlinks" +cf_cv_enable_lp64="$cf_cv_enable_lp64" +cf_cv_prog_CC_c_o=$cf_cv_prog_CC_c_o +cf_cv_prog_CXX_c_o=$cf_cv_prog_CXX_c_o cf_cv_rel_version="$cf_cv_rel_version" cf_cv_rm_so_locs="$cf_cv_rm_so_locs" cf_cv_shlib_version="$cf_cv_shlib_version" diff --git a/dist.mk b/dist.mk index 2651e2bb..9d7ef886 100644 --- a/dist.mk +++ b/dist.mk @@ -1,4 +1,4 @@ -# $Id: dist.mk,v 1.402 2004/02/08 20:56:43 tom Exp $ +# $Id: dist.mk,v 1.498 2005/10/09 14:41:57 tom Exp $ # Makefile for creating ncurses distributions. # # This only needs to be used directly as a makefile by developers, but @@ -9,12 +9,15 @@ SHELL = /bin/sh # These define the major/minor/patch versions of ncurses. NCURSES_MAJOR = 5 -NCURSES_MINOR = 4 -NCURSES_PATCH = 20040208 +NCURSES_MINOR = 5 +NCURSES_PATCH = 20051010 # We don't append the patch to the version, since this only applies to releases VERSION = $(NCURSES_MAJOR).$(NCURSES_MINOR) +# The most recent html files were generated with lynx 2.8.5, configured with +# --without-manpage-renames +# on Debian/testing. DUMP = lynx -dump DUMP2 = $(DUMP) -nolist @@ -37,7 +40,7 @@ dist: $(ALL) (cd ..; tar cvf ncurses-$(VERSION).tar `sed $@ -MANPROG = tbl | nroff -man +# This is the original command: +# MANPROG = tbl | nroff -man +# +# This happens to work for groff 1.18.1 on Debian. At some point groff's +# maintainer changed the line-length (we do not want/need that here). +# +# The distributed html files are formatted using +# configure --without-manpage-renames +MANPROG = tbl | nroff -mandoc -rLL=65n -rLT=71n -Tascii -manhtml: MANIFEST +manhtml: @rm -f doc/html/man/*.html @mkdir -p doc/html/man @rm -f subst.tmp ; @@ -90,42 +101,23 @@ manhtml: MANIFEST -e 's/>/\>/g' \ >> doc/html/man/$$g ;\ echo '-->' >> doc/html/man/$$g ;\ - man/edit_man.sh normal editing /usr/man man $$f | $(MANPROG) | tr '\255' '-' | $(MAN2HTML) -title "$$T" | \ + ./edit_man.sh normal editing /usr/man man $$f | $(MANPROG) | tr '\255' '-' | $(MAN2HTML) -title "$$T" | \ sed -f subst.sed |\ sed -e 's/"curses.3x.html"/"ncurses.3x.html"/g' \ >> doc/html/man/$$g ;\ done @rm -f subst.sed - @sed -e "\%./doc/html/man/%d" < MANIFEST > MANIFEST.tmp - @find ./doc/html/man -type f -print >> MANIFEST.tmp - @chmod u+w MANIFEST - @misc/csort -u < MANIFEST.tmp > MANIFEST - @rm -f MANIFEST.tmp # # Please note that this target can only be properly built if the build of the # Ada95 subdir has been done. The reason is, that the gnathtml tool uses the # .ali files generated by the Ada95 compiler during the build process. These # .ali files contain cross referencing information required by gnathtml. -adahtml: MANIFEST +adahtml: if [ ! -z "$(GNATHTML)" ]; then \ (cd ./Ada95/gen ; make html) ;\ - sed -e "\%./doc/html/ada/%d" < MANIFEST > MANIFEST.tmp ;\ - find ./doc/html/ada -type f -print >> MANIFEST.tmp ;\ - misc/csort -u < MANIFEST.tmp > MANIFEST ;\ - rm -f MANIFEST.tmp ;\ fi -# Prepare distribution for version control -vcprepare: - find . -type d -exec mkdir {}/RCS \; - -# Write-lock almost all files not under version control. -ADA_EXCEPTIONS=$(shell eval 'a="\\\\\|";for x in Ada95/gen/terminal*.m4; do echo -n $${a}Ada95/ada_include/`basename $${x} .m4`; done') -EXCEPTIONS = 'announce.html$\\|ANNOUNCE\\|misc/.*\\.doc\\|man/terminfo.5\\|lib_gen.c'$(ADA_EXCEPTIONS) -writelock: - for x in `grep -v $(EXCEPTIONS) MANIFEST`; do if [ ! -f `dirname $$x`/RCS/`basename $$x`,v ]; then chmod a-w $${x}; fi; done - # This only works on a clean source tree, of course. MANIFEST: -rm -f $@ diff --git a/doc/hackguide.doc b/doc/hackguide.doc index a3524301..fbc8f072 100644 --- a/doc/hackguide.doc +++ b/doc/hackguide.doc @@ -1,4 +1,3 @@ - A Hacker's Guide to NCURSES Contents diff --git a/doc/html/NCURSES-Programming-HOWTO.html b/doc/html/NCURSES-Programming-HOWTO.html new file mode 100644 index 00000000..3a101063 --- /dev/null +++ b/doc/html/NCURSES-Programming-HOWTO.html @@ -0,0 +1,6413 @@ + + + + +NCURSES Programming HOWTO + + + +
    +
    +

    NCURSES Programming +HOWTO

    +

    Pradeep Padala

    + +

    v1.9, 2005-06-20

    +
    + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
    Revision +History
    Revision 1.92005-06-20Revised by: ppadala
    The license has been changed to the +MIT-style license used by NCURSES. Note that the programs are also +re-licensed under this.
    Revision 1.82005-06-17Revised by: ppadala
    Lots of updates. Added references and +perl examples. Changes to examples. Many grammatical and stylistic +changes to the content. Changes to NCURSES history.
    Revision 1.7.12002-06-25Revised by: ppadala
    Added a README file for building and +instructions for building from source.
    Revision 1.72002-06-25Revised by: ppadala
    Added "Other formats" section and made +a lot of fancy changes to the programs. Inlining of programs is +gone.
    Revision 1.6.12002-02-24Revised by: ppadala
    Removed the old Changelog section, +cleaned the makefiles
    Revision 1.62002-02-16Revised by: ppadala
    Corrected a lot of spelling mistakes, +added ACS variables section
    Revision 1.52002-01-05Revised by: ppadala
    Changed structure to present proper +TOC
    Revision 1.3.12001-07-26Revised by: ppadala
    Corrected maintainers paragraph, +Corrected stable release number
    Revision 1.32001-07-24Revised by: ppadala
    Added copyright notices to main +document (LDP license) and programs (GPL), Corrected +printw_example.
    Revision 1.22001-06-05Revised by: ppadala
    Incorporated ravi's changes. Mainly to +introduction, menu, form, justforfun sections
    Revision 1.12001-05-22Revised by: ppadala
    Added "a word about window" section, +Added scanw_example.
    +
    +
    +
    +

    This document is intended to be an "All in One" guide for +programming with ncurses and its sister libraries. We graduate from +a simple "Hello World" program to more complex form manipulation. +No prior experience in ncurses is assumed. Send comments to +this +address

    +
    +
    +
    +
    +
    +
    Table of Contents
    +
    1. Introduction
    +
    +
    +
    1.1. What is NCURSES?
    +
    1.2. What we can do with +NCURSES
    +
    1.3. Where to get it
    +
    1.4. Purpose/Scope of the document
    +
    1.5. About the Programs
    +
    1.6. Other Formats of the +document
    +
    1.7. Credits
    +
    1.8. Wish List
    +
    1.9. Copyright
    +
    +
    +
    2. Hello World !!!
    +
    +
    +
    2.1. Compiling With the NCURSES +Library
    +
    2.2. Dissection
    +
    +
    +
    3. The Gory Details
    +
    4. Initialization
    +
    +
    +
    4.1. Initialization functions
    +
    4.2. raw() and cbreak()
    +
    4.3. echo() and noecho()
    +
    4.4. keypad()
    +
    4.5. halfdelay()
    +
    4.6. Miscellaneous Initialization +functions
    +
    4.7. An Example
    +
    +
    +
    5. A Word about Windows
    +
    6. Output functions
    +
    +
    +
    6.1. addch() class of functions
    +
    6.2. mvaddch(), waddch() and +mvwaddch()
    +
    6.3. printw() class of +functions
    +
    6.4. addstr() class of +functions
    +
    6.5. A word of caution
    +
    +
    +
    7. Input functions
    +
    +
    +
    7.1. getch() class of functions
    +
    7.2. scanw() class of functions
    +
    7.3. getstr() class of +functions
    +
    7.4. Some examples
    +
    +
    +
    8. Attributes
    +
    +
    +
    8.1. The details
    +
    8.2. attron() vs attrset()
    +
    8.3. attr_get()
    +
    8.4. attr_ functions
    +
    8.5. wattr functions
    +
    8.6. chgat() functions
    +
    +
    +
    9. Windows
    +
    +
    +
    9.1. The basics
    +
    9.2. Let there be a Window !!!
    +
    9.3. Explanation
    +
    9.4. The other stuff in the +example
    +
    9.5. Other Border +functions
    +
    +
    +
    10. Colors
    +
    +
    +
    10.1. The basics
    +
    10.2. Changing Color +Definitions
    +
    10.3. Color Content
    +
    +
    +
    11. Interfacing with the key board
    +
    +
    +
    11.1. The Basics
    +
    11.2. A Simple Key Usage +example
    +
    +
    +
    12. Interfacing with the mouse
    +
    +
    +
    12.1. The Basics
    +
    12.2. Getting the events
    +
    12.3. Putting it all Together
    +
    12.4. Miscellaneous +Functions
    +
    +
    +
    13. Screen Manipulation
    +
    +
    +
    13.1. getyx() functions
    +
    13.2. Screen Dumping
    +
    13.3. Window Dumping
    +
    +
    +
    14. Miscellaneous features
    +
    +
    +
    14.1. curs_set()
    +
    14.2. Temporarily Leaving Curses +mode
    +
    14.3. ACS_ variables
    +
    +
    +
    15. Other libraries
    +
    16. Panel Library
    +
    +
    +
    16.1. The Basics
    +
    16.2. Compiling With the Panels +Library
    +
    16.3. Panel Window Browsing
    +
    16.4. Using User Pointers
    +
    16.5. Moving and Resizing +Panels
    +
    16.6. Hiding and Showing +Panels
    +
    16.7. panel_above() and panel_below() +Functions
    +
    +
    +
    17. Menus Library
    +
    +
    +
    17.1. The Basics
    +
    17.2. Compiling With the Menu +Library
    +
    17.3. Menu Driver: The work horse of the +menu system
    +
    17.4. Menu Windows
    +
    17.5. Scrolling Menus
    +
    17.6. Multi Columnar Menus
    +
    17.7. Multi Valued Menus
    +
    17.8. Menu Options
    +
    17.9. The useful User Pointer
    +
    +
    +
    18. Forms Library
    +
    +
    +
    18.1. The Basics
    +
    18.2. Compiling With the Forms +Library
    +
    18.3. Playing with Fields
    +
    18.4. Form Windows
    +
    18.5. Field Validation
    +
    18.6. Form Driver: The work horse of the +forms system
    +
    +
    +
    19. Tools and Widget Libraries
    +
    +
    +
    19.1. CDK (Curses Development Kit)
    +
    19.2. The dialog
    +
    19.3. Perl Curses Modules CURSES::FORM +and CURSES::WIDGETS
    +
    +
    +
    20. Just For Fun !!!
    +
    +
    +
    20.1. The Game of Life
    +
    20.2. Magic Square
    +
    20.3. Towers of Hanoi
    +
    20.4. Queens Puzzle
    +
    20.5. Shuffle
    +
    20.6. Typing Tutor
    +
    +
    +
    21. References
    +
    +
    +
    +

    1. +Introduction

    +

    In the olden days of teletype terminals, terminals were away +from computers and were connected to them through serial cables. +The terminals could be configured by sending a series of bytes. All +the capabilities (such as moving the cursor to a new location, +erasing part of the screen, scrolling the screen, changing modes +etc.) of terminals could be accessed through these series of bytes. +These control seeuqnces are usually called escape sequences, +because they start with an escape(0x1B) character. Even today, with +proper emulation, we can send escape sequences to the emulator and +achieve the same effect on a terminal window.

    +

    Suppose you wanted to print a line in color. Try typing this on +your console.

    + + + + +
    +
    +echo "^[[0;31;40mIn Color"
    +
    +

    The first character is an escape character, which looks like two +characters ^ and [. To be able to print it, you have to press +CTRL+V and then the ESC key. All the others are normal printable +characters. You should be able to see the string "In Color" in red. +It stays that way and to revert back to the original mode type +this.

    + + + + +
    +
    +echo "^[[0;37;40m"
    +
    +

    Now, what do these magic characters mean? Difficult to +comprehend? They might even be different for different terminals. +So the designers of UNIX invented a mechanism named termcap. It is a file that lists all the +capabilities of a particular terminal, along with the escape +sequences needed to achieve a particular effect. In the later +years, this was replaced by terminfo. +Without delving too much into details, this mechanism allows +application programs to query the terminfo database and obtain the +control characters to be sent to a terminal or terminal +emulator.

    +
    +
    +

    1.1. What is +NCURSES?

    +

    You might be wondering, what the import of all this technical +gibberish is. In the above scenario, every application program is +supposed to query the terminfo and perform the necessary stuff +(sending control characters etc.). It soon became difficult to +manage this complexity and this gave birth to 'CURSES'. Curses is a +pun on the name "cursor optimization". The Curses library forms a +wrapper over working with raw terminal codes, and provides highly +flexible and efficient API (Application Programming Interface). It +provides functions to move the cursor, create windows, produce +colors, play with mouse etc. The application programs need not +worry about the underlying terminal capabilities.

    +

    So what is NCURSES? NCURSES is a clone of the original System V +Release 4.0 (SVr4) curses. It is a freely distributable library, +fully compatible with older version of curses. In short, it is a +library of functions that manages an application's display on +character-cell terminals. In the remainder of the document, the +terms curses and ncurses are used interchangeably.

    +

    A detailed history of NCURSES can be found in the NEWS file from +the source distribution. The current package is maintained by +Thomas Dickey. +You can contact the maintainers at bug-ncurses@gnu.org.

    +
    +
    +
    +

    1.2. What +we can do with NCURSES

    +

    NCURSES not only creates a wrapper over terminal capabilities, +but also gives a robust framework to create nice looking UI (User +Interface)s in text mode. It provides functions to create windows +etc. Its sister libraries panel, menu and form provide an extension +to the basic curses library. These libraries usually come along +with curses. One can create applications that contain multiple +windows, menus, panels and forms. Windows can be managed +independently, can provide 'scrollability' and even can be +hidden.

    +

    Menus provide the user with an easy command selection option. +Forms allow the creation of easy-to-use data entry and display +windows. Panels extend the capabilities of ncurses to deal with +overlapping and stacked windows.

    +

    These are just some of the basic things we can do with ncurses. +As we move along, We will see all the capabilities of these +libraries.

    +
    +
    +
    +

    1.3. +Where to get it

    +

    All right, now that you know what you can do with ncurses, you +must be rearing to get started. NCURSES is usually shipped with +your installation. In case you don't have the library or want to +compile it on your own, read on.

    +

    Compiling the package

    +

    NCURSES can be obtained from ftp://ftp.gnu.org/pub/gnu/ncurses/ncurses.tar.gz or any +of the ftp sites mentioned in http://www.gnu.org/order/ftp.html.

    +

    Read the README and INSTALL files for details on to how to +install it. It usually involves the following operations.

    + + + + +
    +
    +    tar zxvf ncurses<version>.tar.gz  # unzip and untar the archive
    +    cd ncurses<version>               # cd to the directory
    +    ./configure                             # configure the build according to your 
    +                                            # environment
    +    make                                    # make it
    +    su root                                 # become root
    +    make install                            # install it
    +
    +

    Using the RPM

    +

    NCURSES RPM can be found and downloaded from http://rpmfind.net . The RPM +can be installed with the following command after becoming +root.

    + + + + +
    +
    +    rpm -i <downloaded rpm>
    +
    +
    +
    +
    +

    1.4. Purpose/Scope +of the document

    +

    This document is intended to be a "All in One" guide for +programming with ncurses and its sister libraries. We graduate from +a simple "Hello World" program to more complex form manipulation. +No prior experience in ncurses is assumed. The writing is informal, +but a lot of detail is provided for each of the examples.

    +
    +
    +
    +

    1.5. +About the Programs

    +

    All the programs in the document are available in zipped form +here. Unzip and untar it. The directory structure +looks like this.

    + + + + +
    +
    +ncurses
    +   |
    +   |----> JustForFun     -- just for fun programs
    +   |----> basics         -- basic programs
    +   |----> demo           -- output files go into this directory after make
    +   |          |
    +   |          |----> exe -- exe files of all example programs
    +   |----> forms          -- programs related to form library
    +   |----> menus          -- programs related to menus library
    +   |----> panels         -- programs related to panels library
    +   |----> perl           -- perl equivalents of the examples (contributed
    +   |                            by Anuradha Ratnaweera)
    +   |----> Makefile       -- the top level Makefile
    +   |----> README         -- the top level README file. contains instructions
    +   |----> COPYING        -- copyright notice
    +
    +

    The individual directories contain the following files.

    + + + + +
    +
    +Description of files in each directory
    +--------------------------------------
    +JustForFun
    +    |
    +    |----> hanoi.c   -- The Towers of Hanoi Solver
    +    |----> life.c    -- The Game of Life demo
    +    |----> magic.c   -- An Odd Order Magic Square builder 
    +    |----> queens.c  -- The famous N-Queens Solver
    +    |----> shuffle.c -- A fun game, if you have time to kill
    +    |----> tt.c      -- A very trivial typing tutor
    +
    +  basics
    +    |
    +    |----> acs_vars.c            -- ACS_ variables example
    +    |----> hello_world.c         -- Simple "Hello World" Program
    +    |----> init_func_example.c   -- Initialization functions example
    +    |----> key_code.c            -- Shows the scan code of the key pressed
    +    |----> mouse_menu.c          -- A menu accessible by mouse
    +    |----> other_border.c        -- Shows usage of other border functions apa
    +    |                               -- rt from box()
    +    |----> printw_example.c      -- A very simple printw() example
    +    |----> scanw_example.c       -- A very simple getstr() example
    +    |----> simple_attr.c         -- A program that can print a c file with 
    +    |                               -- comments in attribute
    +    |----> simple_color.c        -- A simple example demonstrating colors
    +    |----> simple_key.c          -- A menu accessible with keyboard UP, DOWN 
    +    |                               -- arrows
    +    |----> temp_leave.c          -- Demonstrates temporarily leaving curses mode
    +    |----> win_border.c          -- Shows Creation of windows and borders
    +    |----> with_chgat.c          -- chgat() usage example
    +
    +  forms 
    +    |
    +    |----> form_attrib.c     -- Usage of field attributes
    +    |----> form_options.c    -- Usage of field options
    +    |----> form_simple.c     -- A simple form example
    +    |----> form_win.c        -- Demo of windows associated with forms
    +
    +  menus 
    +    |
    +    |----> menu_attrib.c     -- Usage of menu attributes
    +    |----> menu_item_data.c  -- Usage of item_name() etc.. functions
    +    |----> menu_multi_column.c    -- Creates multi columnar menus
    +    |----> menu_scroll.c     -- Demonstrates scrolling capability of menus
    +    |----> menu_simple.c     -- A simple menu accessed by arrow keys
    +    |----> menu_toggle.c     -- Creates multi valued menus and explains
    +    |                           -- REQ_TOGGLE_ITEM
    +    |----> menu_userptr.c    -- Usage of user pointer
    +    |----> menu_win.c        -- Demo of windows associated with menus
    +
    +  panels 
    +    |
    +    |----> panel_browse.c    -- Panel browsing through tab. Usage of user 
    +    |                           -- pointer
    +    |----> panel_hide.c      -- Hiding and Un hiding of panels
    +    |----> panel_resize.c    -- Moving and resizing of panels
    +    |----> panel_simple.c    -- A simple panel example
    +
    +  perl
    +    |----> 01-10.pl          -- Perl equivalents of first ten example programs
    +
    +

    There is a top level Makefile included in the main directory. It +builds all the files and puts the ready-to-use exes in demo/exe +directory. You can also do selective make by going into the +corresponding directory. Each directory contains a README file +explaining the purpose of each c file in the directory.

    +

    For every example, I have included path name for the file +relative to the examples directory.

    +

    If you prefer browsing individual programs, point your browser +to http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/ncurses_programs/

    +

    All the programs are released under the same license that is +used by ncurses (MIT-style). This gives you the ability to do +pretty much anything other than claiming them as yours. Feel free +to use them in your programs as appropriate.

    +
    +
    +
    +

    1.6. +Other Formats of the document

    +

    This howto is also availabe in various other formats on the +tldp.org site. Here are the links to other formats of this +document.

    + +
    +
    +

    1.6.2. +Building from source

    +

    If above links are broken or if you want to experiment with sgml +read on.

    + + + + +
    +
    +
    Get both the source and the tar,gzipped programs, available at
    +        http://cvsview.tldp.org/index.cgi/LDP/howto/docbook/
    +        NCURSES-HOWTO/NCURSES-Programming-HOWTO.sgml
    +        http://cvsview.tldp.org/index.cgi/LDP/howto/docbook/
    +        NCURSES-HOWTO/ncurses_programs.tar.gz
    +
    +    Unzip ncurses_programs.tar.gz with
    +    tar zxvf ncurses_programs.tar.gz
    +
    +    Use jade to create various formats. For example if you just want to create
    +    the multiple html files, you would use
    +        jade -t sgml -i html -d <path to docbook html stylesheet>
    +        NCURSES-Programming-HOWTO.sgml
    +    to get pdf, first create a single html file of the HOWTO with 
    +        jade -t sgml -i html -d <path to docbook html stylesheet> -V nochunks
    +        NCURSES-Programming-HOWTO.sgml > NCURSES-ONE-BIG-FILE.html
    +    then use htmldoc to get pdf file with
    +        htmldoc --size universal -t pdf --firstpage p1 -f <output file name.pdf>
    +        NCURSES-ONE-BIG-FILE.html
    +    for ps, you would use
    +        htmldoc --size universal -t ps --firstpage p1 -f <output file name.ps>
    +        NCURSES-ONE-BIG-FILE.html
    +
    +

    See LDP Author guide for more details. If all else failes, +mail me at ppadala@gmail.com

    +
    +
    +
    +
    +

    1.7. +Credits

    +

    I thank Sharath and Emre Akbas for helping me with few sections. +The introduction was initially written by sharath. I rewrote it +with few excerpts taken from his initial work. Emre helped in +writing printw and scanw sections.

    +

    Perl equivalents of the example programs are contributed by +Anuradha +Ratnaweera.

    +

    Then comes Ravi Parimi, my dearest friend, who has been on this +project before even one line was written. He constantly bombarded +me with suggestions and patiently reviewed the whole text. He also +checked each program on Linux and Solaris.

    +
    +
    +
    +

    1.8. Wish +List

    +

    This is the wish list, in the order of priority. If you have a +wish or you want to work on completing the wish, mail me.

    +
      +
    • +

      Add examples to last parts of forms section.

      +
    • +
    • +

      Prepare a Demo showing all the programs and allow the user to +browse through description of each program. Let the user compile +and see the program in action. A dialog based interface is +preferred.

      +
    • +
    • +

      Add debug info. _tracef, _tracemouse stuff.

      +
    • +
    • +

      Accessing termcap, terminfo using functions provided by ncurses +package.

      +
    • +
    • +

      Working on two terminals simultaneously.

      +
    • +
    • +

      Add more stuff to miscellaneous section.

      +
    • +
    +
    +
    +
    +

    1.9. +Copyright

    +

    Copyright © 2001 by Pradeep Padala.

    +

    Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, copy, +modify, merge, publish, distribute, distribute with modifications, +sublicense, and/or sell copies of the Software, and to permit +persons to whom the Software is furnished to do so, subject to the +following conditions:

    +

    The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software.

    +

    THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN +ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE.

    +

    Except as contained in this notice, the name(s) of the above +copyright holders shall not be used in advertising or otherwise to +promote the sale, use or other dealings in this Software without +prior written authorization.

    +
    +
    +
    +
    +

    2. Hello +World !!!

    +

    Welcome to the world of curses. Before we plunge into the +library and look into its various features, let's write a simple +program and say hello to the world.

    +
    +
    +

    2.1. +Compiling With the NCURSES Library

    +

    To use ncurses library functions, you have to include ncurses.h +in your programs. To link the program with ncurses the flag +-lncurses should be added.

    + + + + +
    +
    +    #include <ncurses.h>
    +    .
    +    .
    +    .
    +
    +    compile and link: gcc <program file> -lncurses
    +
    +
    +

    Example 1. The Hello World !!! Program

    + + + + +
    +
    +#include <ncurses.h>
    +
    +int main()
    +{       
    +        initscr();                      /* Start curses mode              */
    +        printw("Hello World !!!");      /* Print Hello World              */
    +        refresh();                      /* Print it on to the real screen */
    +        getch();                        /* Wait for user input */
    +        endwin();                       /* End curses mode                */
    +
    +        return 0;
    +}
    +
    +
    +
    +
    +
    +

    2.2. +Dissection

    +

    The above program prints "Hello World !!!" to the screen and +exits. This program shows how to initialize curses and do screen +manipulation and end curses mode. Let's dissect it line by +line.

    +
    +
    +

    2.2.1. +About initscr()

    +

    The function initscr() initializes the terminal in curses mode. +In some implementations, it clears the screen and presents a blank +screen. To do any screen manipulation using curses package this has +to be called first. This function initializes the curses system and +allocates memory for our present window (called stdscr) and some other data-structures. Under +extreme cases this function might fail due to insufficient memory +to allocate memory for curses library's data structures.

    +

    After this is done, we can do a variety of initializations to +customize our curses settings. These details will be explained +later .

    +
    +
    +
    +

    2.2.2. +The mysterious refresh()

    +

    The next line printw prints the string "Hello World !!!" on to +the screen. This function is analogous to normal printf in all +respects except that it prints the data on a window called stdscr +at the current (y,x) co-ordinates. Since our present co-ordinates +are at 0,0 the string is printed at the left hand corner of the +window.

    +

    This brings us to that mysterious refresh(). Well, when we +called printw the data is actually written to an imaginary window, +which is not updated on the screen yet. The job of printw is to +update a few flags and data structures and write the data to a +buffer corresponding to stdscr. In order to show it on the screen, +we need to call refresh() and tell the curses system to dump the +contents on the screen.

    +

    The philosophy behind all this is to allow the programmer to do +multiple updates on the imaginary screen or windows and do a +refresh once all his screen update is done. refresh() checks the +window and updates only the portion which has been changed. This +improves performance and offers greater flexibility too. But, it is +sometimes frustrating to beginners. A common mistake committed by +beginners is to forget to call refresh() after they did some update +through printw() class of functions. I still forget to add it +sometimes :-)

    +
    +
    +
    +

    2.2.3. +About endwin()

    +

    And finally don't forget to end the curses mode. Otherwise your +terminal might behave strangely after the program quits. endwin() +frees the memory taken by curses sub-system and its data structures +and puts the terminal in normal mode. This function must be called +after you are done with the curses mode.

    +
    +
    +
    +
    +
    +

    3. The Gory +Details

    +

    Now that we have seen how to write a simple curses program let's +get into the details. There are many functions that help customize +what you see on screen and many features which can be put to full +use.

    +

    Here we go...

    +
    +
    +
    +

    4. +Initialization

    +

    We now know that to initialize curses system the function +initscr() has to be called. There are functions which can be called +after this initialization to customize our curses session. We may +ask the curses system to set the terminal in raw mode or initialize +color or initialize the mouse etc.. Let's discuss some of the +functions that are normally called immediately after initscr();

    + +
    +
    +

    4.2. raw() and +cbreak()

    +

    Normally the terminal driver buffers the characters a user types +until a new line or carriage return is encountered. But most +programs require that the characters be available as soon as the +user types them. The above two functions are used to disable line +buffering. The difference between these two functions is in the way +control characters like suspend (CTRL-Z), interrupt and quit +(CTRL-C) are passed to the program. In the raw() mode these +characters are directly passed to the program without generating a +signal. In the cbreak() mode these +control characters are interpreted as any other character by the +terminal driver. I personally prefer to use raw() as I can exercise +greater control over what the user does.

    +
    +
    +
    +

    4.3. echo() +and noecho()

    +

    These functions control the echoing of characters typed by the +user to the terminal. noecho() switches +off echoing. The reason you might want to do this is to gain more +control over echoing or to suppress unnecessary echoing while +taking input from the user through the getch() etc. functions. Most +of the interactive programs call noecho() at initialization and do the echoing of +characters in a controlled manner. It gives the programmer the +flexibility of echoing characters at any place in the window +without updating current (y,x) co-ordinates.

    +
    +
    +
    +

    4.4. +keypad()

    +

    This is my favorite initialization function. It enables the +reading of function keys like F1, F2, arrow keys etc. Almost every +interactive program enables this, as arrow keys are a major part of +any User Interface. Do keypad(stdscr, +TRUE) to enable this feature for the regular screen (stdscr). +You will learn more about key management in later sections of this +document.

    +
    +
    +
    +

    4.5. +halfdelay()

    +

    This function, though not used very often, is a useful one at +times. halfdelay()is called to enable the half-delay mode, which is +similar to the cbreak() mode in that characters typed are +immediately available to program. However, it waits for 'X' tenths +of a second for input and then returns ERR, if no input is +available. 'X' is the timeout value passed to the function +halfdelay(). This function is useful when you want to ask the user +for input, and if he doesn't respond with in certain time, we can +do some thing else. One possible example is a timeout at the +password prompt.

    +
    +
    +
    +

    4.6. +Miscellaneous Initialization functions

    +

    There are few more functions which are called at initialization +to customize curses behavior. They are not used as extensively as +those mentioned above. Some of them are explained where +appropriate.

    +
    +
    +
    +

    4.7. An +Example

    +

    Let's write a program which will clarify the usage of these +functions.

    +
    +

    Example 2. Initialization Function Usage example

    + + + + +
    +
    +#include <ncurses.h>
    +
    +int main()
    +{       int ch;
    +
    +        initscr();                      /* Start curses mode            */
    +        raw();                          /* Line buffering disabled      */
    +        keypad(stdscr, TRUE);           /* We get F1, F2 etc..          */
    +        noecho();                       /* Don't echo() while we do getch */
    +
    +        printw("Type any character to see it in bold\n");
    +        ch = getch();                   /* If raw() hadn't been called
    +                                         * we have to press enter before it
    +                                         * gets to the program          */
    +        if(ch == KEY_F(1))              /* Without keypad enabled this will */
    +                printw("F1 Key pressed");/*  not get to us either       */
    +                                        /* Without noecho() some ugly escape
    +                                         * charachters might have been printed
    +                                         * on screen                    */
    +        else
    +        {       printw("The pressed key is ");
    +                attron(A_BOLD);
    +                printw("%c", ch);
    +                attroff(A_BOLD);
    +        }
    +        refresh();                      /* Print it on to the real screen */
    +        getch();                        /* Wait for user input */
    +        endwin();                       /* End curses mode                */
    +
    +        return 0;
    +}
    +
    +
    +

    This program is self-explanatory. But I used functions which +aren't explained yet. The function getch() is used to get a character from user. It is +equivalent to normal getchar() except +that we can disable the line buffering to avoid <enter> after +input. Look for more about getch()and +reading keys in the key management section . +The functions attron and attroff are used to switch some attributes +on and off respectively. In the example I used them to print the +character in bold. These functions are explained in detail +later.

    +
    +
    +
    +
    +

    5. A +Word about Windows

    +

    Before we plunge into the myriad ncurses functions, let me clear +few things about windows. Windows are explained in detail in +following sections

    +

    A Window is an imaginary screen defined by curses system. A +window does not mean a bordered window which you usually see on +Win9X platforms. When curses is initialized, it creates a default +window named stdscr which represents +your 80x25 (or the size of window in which you are running) screen. +If you are doing simple tasks like printing few strings, reading +input etc., you can safely use this single window for all of your +purposes. You can also create windows and call functions which +explicitly work on the specified window.

    +

    For example, if you call

    + + + + +
    +
    +    printw("Hi There !!!");
    +    refresh();
    +
    +

    It prints the string on stdscr at the present cursor position. +Similarly the call to refresh(), works on stdscr only.

    +

    Say you have created windows then you +have to call a function with a 'w' added to the usual function.

    + + + + +
    +
    +    wprintw(win, "Hi There !!!");
    +    wrefresh(win);
    +
    +

    As you will see in the rest of the document, naming of functions +follow the same convention. For each function there usually are +three more functions.

    + + + + +
    +
    +    printw(string);        /* Print on stdscr at present cursor position */
    +    mvprintw(y, x, string);/* Move to (y, x) then print string     */
    +    wprintw(win, string);  /* Print on window win at present cursor position */
    +                           /* in the window */
    +    mvwprintw(win, y, x, string);   /* Move to (y, x) relative to window */
    +                                    /* co-ordinates and then print         */
    +
    +

    Usually the w-less functions are macros which expand to +corresponding w-function with stdscr as the window parameter.

    +
    +
    +
    +

    6. Output +functions

    +

    I guess you can't wait any more to see some action. Back to our +odyssey of curses functions. Now that curses is initialized, let's +interact with world.

    +

    There are three classes of functions which you can use to do +output on screen.

    +
      +
    1. +

      addch() class: Print single character with attributes

      +
    2. +
    3. +

      printw() class: Print formatted output similar to printf()

      +
    4. +
    5. +

      addstr() class: Print strings

      +
    6. +
    +

    These functions can be used interchangeably and it's a matter of +style as to which class is used. Let's see each one in detail.

    +
    +
    +

    6.1. addch() +class of functions

    +

    These functions put a single character into the current cursor +location and advance the position of the cursor. You can give the +character to be printed but they usually are used to print a +character with some attributes. Attributes are explained in detail +in later sections of the document. If a +character is associated with an attribute(bold, reverse video +etc.), when curses prints the character, it is printed in that +attribute.

    +

    In order to combine a character with some attributes, you have +two options:

    +
      +
    • +

      By OR'ing a single character with the desired attribute macros. +These attribute macros could be found in the header file +ncurses.h. For example, you want to +print a character ch(of type char) bold and underlined, you would +call addch() as below.

      + + + + +
      +
      +    addch(ch | A_BOLD | A_UNDERLINE);
      +
      +
    • +
    • +

      By using functions like attrset(),attron(),attroff(). These functions are +explained in the Attributes section. Briefly, +they manipulate the current attributes of the given window. Once +set, the character printed in the window are associated with the +attributes until it is turned off.

      +
    • +
    +

    Additionally, curses provides some +special characters for character-based graphics. You can draw +tables, horizontal or vertical lines, etc. You can find all +avaliable characters in the header file ncurses.h. Try looking for macros beginning with +ACS_ in this file.

    +
    +
    +
    +

    6.2. mvaddch(), +waddch() and mvwaddch()

    +

    mvaddch() is used to move the cursor +to a given point, and then print. Thus, the calls:

    + + + + +
    +
    +    move(row,col);    /* moves the cursor to rowth row and colth column */
    +    addch(ch);
    +
    +can be replaced by + + + + +
    +
    +    mvaddch(row,col,ch);
    +
    +

    waddch() is similar to addch(), except that it adds a character into the +given window. (Note that addch() adds a +character into the window stdscr.)

    +

    In a similar fashion mvwaddch() +function is used to add a character into the given window at the +given coordinates.

    +

    Now, we are familiar with the basic output function addch(). But, if we want to print a string, it +would be very annoying to print it character by character. +Fortunately, ncurses provides +printf-like or puts-like functions.

    +
    +
    +
    +

    6.3. +printw() class of functions

    +

    These functions are similar to printf() with the added capability of printing at +any position on the screen.

    +
    +
    +

    6.3.1. printw() and mvprintw

    +

    These two functions work much like printf(). mvprintw() can +be used to move the cursor to a position and then print. If you +want to move the cursor first and then print using printw() function, use move() first and then use printw() though I see no point why one should avoid +using mvprintw(), you have the +flexibility to manipulate.

    +
    +
    +
    +

    6.3.2. wprintw() and mvwprintw

    +

    These two functions are similar to above two except that they +print in the corresponding window given as argument.

    +
    +
    +
    +

    6.3.3. +vwprintw()

    +

    This function is similar to vprintf(). This can be used when variable number of +arguments are to be printed.

    +
    +
    +
    +

    6.3.4. A Simple printw example

    +
    +

    Example 3. A Simple printw example

    + + + + +
    +
    +#include <ncurses.h>                   /* ncurses.h includes stdio.h */  
    +#include <string.h> 
    + 
    +int main()
    +{
    + char mesg[]="Just a string";           /* message to be appeared on the screen */
    + int row,col;                           /* to store the number of rows and *
    +                                         * the number of colums of the screen */
    + initscr();                             /* start the curses mode */
    + getmaxyx(stdscr,row,col);              /* get the number of rows and columns */
    + mvprintw(row/2,(col-strlen(mesg))/2,"%s",mesg);
    +                                        /* print the message at the center of the screen */
    + mvprintw(row-2,0,"This screen has %d rows and %d columns\n",row,col);
    + printw("Try resizing your window(if possible) and then run this program again");
    + refresh();
    + getch();
    + endwin();
    +
    + return 0;
    +}
    +
    +
    +

    Above program demonstrates how easy it is to use printw. You just feed the coordinates and the +message to be appeared on the screen, then it does what you +want.

    +

    The above program introduces us to a new function getmaxyx(), a macro defined in ncurses.h. It gives the number of columns and the +number of rows in a given window. getmaxyx() does this by updating the variables +given to it. Since getmaxyx() is not a +function we don't pass pointers to it, we just give two integer +variables.

    +
    +
    +
    +
    +

    6.4. +addstr() class of functions

    +

    addstr() is used to put a character +string into a given window. This function is similar to calling +addch() once for each character in a +given string. This is true for all output functions. There are +other functions from this family such as mvaddstr(),mvwaddstr() and waddstr(), which obey the naming convention of +curses.(e.g. mvaddstr() is similar to the respective calls move() +and then addstr().) Another function of this family is addnstr(), +which takes an integer parameter(say n) additionally. This function +puts at most n characters into the screen. If n is negative, then +the entire string will be added.

    +
    +
    +
    +

    6.5. A word of +caution

    +

    All these functions take y co-ordinate first and then x in their +arguments. A common mistake by beginners is to pass x,y in that +order. If you are doing too many manipulations of (y,x) +co-ordinates, think of dividing the screen into windows and +manipulate each one separately. Windows are explained in the +windows section.

    +
    +
    +
    +
    +

    7. Input +functions

    +

    Well, printing without taking input, is boring. Let's see +functions which allow us to get input from user. These functions +also can be divided into three categories.

    +
      +
    1. +

      getch() class: Get a character

      +
    2. +
    3. +

      scanw() class: Get formatted input

      +
    4. +
    5. +

      getstr() class: Get strings

      +
    6. +
    +
    +
    +

    7.1. getch() +class of functions

    +

    These functions read a single character from the terminal. But +there are several subtle facts to consider. For example if you +don't use the function cbreak(), curses will not read your input +characters contiguously but will begin read them only after a new +line or an EOF is encountered. In order to avoid this, the cbreak() +function must used so that characters are immediately available to +your program. Another widely used function is noecho(). As the name +suggests, when this function is set (used), the characters that are +keyed in by the user will not show up on the screen. The two +functions cbreak() and noecho() are typical examples of key +management. Functions of this genre are explained in the key management section .

    +
    +
    +
    +

    7.2. scanw() +class of functions

    +

    These functions are similar to scanf() with the added capability of getting the +input from any location on the screen.

    +
    +
    +

    7.2.1. +scanw() and mvscanw

    +

    The usage of these functions is similar to that of sscanf(), where the line to be scanned is provided +by wgetstr() function. That is, these +functions call to wgetstr() +function(explained below) and uses the resulting line for a +scan.

    +
    +
    +
    +

    7.2.2. wscanw() and mvwscanw()

    +

    These are similar to above two functions except that they read +from a window, which is supplied as one of the arguments to these +functions.

    +
    +
    +
    +

    7.2.3. +vwscanw()

    +

    This function is similar to vscanf(). +This can be used when a variable number of arguments are to be +scanned.

    +
    +
    +
    +
    +

    7.3. +getstr() class of functions

    +

    These functions are used to get strings from the terminal. In +essence, this function performs the same task as would be achieved +by a series of calls to getch() until a +newline, carriage return, or end-of-file is received. The resulting +string of characters are pointed to by str, which is a character pointer provided by the +user.

    +
    +
    +
    +

    7.4. Some +examples

    +
    +

    Example 4. A Simple scanw example

    + + + + +
    +
    +#include <ncurses.h>                   /* ncurses.h includes stdio.h */  
    +#include <string.h> 
    + 
    +int main()
    +{
    + char mesg[]="Enter a string: ";                /* message to be appeared on the screen */
    + char str[80];
    + int row,col;                           /* to store the number of rows and *
    +                                         * the number of colums of the screen */
    + initscr();                             /* start the curses mode */
    + getmaxyx(stdscr,row,col);              /* get the number of rows and columns */
    + mvprintw(row/2,(col-strlen(mesg))/2,"%s",mesg);
    +                                /* print the message at the center of the screen */
    + getstr(str);
    + mvprintw(LINES - 2, 0, "You Entered: %s", str);
    + getch();
    + endwin();
    +
    + return 0;
    +}
    +
    +
    +
    +
    +
    +
    +

    8. +Attributes

    +

    We have seen an example of how attributes can be used to print +characters with some special effects. Attributes, when set +prudently, can present information in an easy, understandable +manner. The following program takes a C file as input and prints +the file with comments in bold. Scan through the code.

    +
    +

    Example 5. A Simple Attributes example

    + + + + +
    +
    +/* pager functionality by Joseph Spainhour" <spainhou@bellsouth.net> */
    +#include <ncurses.h>
    +#include <stdlib.h>
    +
    +int main(int argc, char *argv[])
    +{ 
    +  int ch, prev, row, col;
    +  prev = EOF;
    +  FILE *fp;
    +  int y, x;
    +
    +  if(argc != 2)
    +  {
    +    printf("Usage: %s <a c file name>\n", argv[0]);
    +    exit(1);
    +  }
    +  fp = fopen(argv[1], "r");
    +  if(fp == NULL)
    +  {
    +    perror("Cannot open input file");
    +    exit(1);
    +  }
    +  initscr();                            /* Start curses mode */
    +  getmaxyx(stdscr, row, col);           /* find the boundaries of the screeen */
    +  while((ch = fgetc(fp)) != EOF)        /* read the file till we reach the end */
    +  {
    +    getyx(stdscr, y, x);                /* get the current curser position */
    +    if(y == (row - 1))                  /* are we are at the end of the screen */
    +    {
    +      printw("<-Press Any Key->");      /* tell the user to press a key */
    +      getch();
    +      clear();                          /* clear the screen */
    +      move(0, 0);                       /* start at the beginning of the screen */
    +    }
    +    if(prev == '/' && ch == '*')        /* If it is / and * then only
    +                                         * switch bold on */    
    +    {
    +      attron(A_BOLD);                   /* cut bold on */
    +      getyx(stdscr, y, x);              /* get the current curser position */
    +      move(y, x - 1);                   /* back up one space */
    +      printw("%c%c", '/', ch);          /* The actual printing is done here */
    +    }
    +    else
    +      printw("%c", ch);
    +    refresh();
    +    if(prev == '*' && ch == '/')
    +      attroff(A_BOLD);                  /* Switch it off once we got *
    +                                         * and then / */
    +    prev = ch;
    +  }
    +  endwin();                             /* End curses mode */
    +  fclose(fp);
    +  return 0;
    +}
    +
    +
    +

    Don't worry about all those initialization and other crap. +Concentrate on the while loop. It reads each character in the file +and searches for the pattern /*. Once it spots the pattern, it +switches the BOLD attribute on with attron() . When we get the pattern */ it is +switched off by attroff() .

    +

    The above program also introduces us to two useful functions +getyx() and move(). The first function gets the co-ordinates of +the present cursor into the variables y, x. Since getyx() is a +macro we don't have to pass pointers to variables. The function +move() moves the cursor to the +co-ordinates given to it.

    +

    The above program is really a simple one which doesn't do much. +On these lines one could write a more useful program which reads a +C file, parses it and prints it in different colors. One could even +extend it to other languages as well.

    +
    +
    +

    8.1. +The details

    +

    Let's get into more details of attributes. The functions +attron(), attroff(), attrset() , and +their sister functions attr_get() etc.. +can be used to switch attributes on/off , get attributes and +produce a colorful display.

    +

    The functions attron and attroff take a bit-mask of attributes +and switch them on or off, respectively. The following video +attributes, which are defined in <curses.h> can be passed to +these functions.

    + + + + +
    +
    +    
    +    A_NORMAL        Normal display (no highlight)
    +    A_STANDOUT      Best highlighting mode of the terminal.
    +    A_UNDERLINE     Underlining
    +    A_REVERSE       Reverse video
    +    A_BLINK         Blinking
    +    A_DIM           Half bright
    +    A_BOLD          Extra bright or bold
    +    A_PROTECT       Protected mode
    +    A_INVIS         Invisible or blank mode
    +    A_ALTCHARSET    Alternate character set
    +    A_CHARTEXT      Bit-mask to extract a character
    +    COLOR_PAIR(n)   Color-pair number n 
    +    
    +
    +

    The last one is the most colorful one :-) Colors are explained +in the next sections.

    +

    We can OR(|) any number of above attributes to get a combined +effect. If you wanted reverse video with blinking characters you +can use

    + + + + +
    +
    +    attron(A_REVERSE | A_BLINK);
    +
    +
    +
    +
    +

    8.2. attron() vs attrset()

    +

    Then what is the difference between attron() and attrset()? +attrset sets the attributes of window whereas attron just switches +on the attribute given to it. So attrset() fully overrides whatever +attributes the window previously had and sets it to the new +attribute(s). Similarly attroff() just switches off the +attribute(s) given to it as an argument. This gives us the +flexibility of managing attributes easily.But if you use them +carelessly you may loose track of what attributes the window has +and garble the display. This is especially true while managing +menus with colors and highlighting. So decide on a consistent +policy and stick to it. You can always use standend() which is equivalent to attrset(A_NORMAL) which turns off all attributes +and brings you to normal mode.

    +
    +
    +
    +

    8.3. +attr_get()

    +

    The function attr_get() gets the current attributes and color +pair of the window. Though we might not use this as often as the +above functions, this is useful in scanning areas of screen. Say we +wanted to do some complex update on screen and we are not sure what +attribute each character is associated with. Then this function can +be used with either attrset or attron to produce the desired +effect.

    +
    +
    +
    +

    8.4. attr_ +functions

    +

    There are series of functions like attr_set(), attr_on etc.. +These are similar to above functions except that they take +parameters of type attr_t.

    +
    +
    +
    +

    8.5. wattr +functions

    +

    For each of the above functions we have a corresponding function +with 'w' which operates on a particular window. The above functions +operate on stdscr.

    +
    +
    +
    +

    8.6. chgat() +functions

    +

    The function chgat() is listed in the end of the man page +curs_attr. It actually is a useful one. This function can be used +to set attributes for a group of characters without moving. I mean +it !!! without moving the cursor :-) It changes the attributes of a +given number of characters starting at the current cursor +location.

    +

    We can give -1 as the character count to update till end of +line. If you want to change attributes of characters from current +position to end of line, just use this.

    + + + + +
    +
    +    chgat(-1, A_REVERSE, 0, NULL);
    +
    +

    This function is useful when changing attributes for characters +that are already on the screen. Move to the character from which +you want to change and change the attribute.

    +

    Other functions wchgat(), mvchgat(), wchgat() behave similarly +except that the w functions operate on the particular window. The +mv functions first move the cursor then perform the work given to +them. Actually chgat is a macro which is replaced by a wchgat() +with stdscr as the window. Most of the "w-less" functions are +macros.

    +
    +

    Example 6. Chgat() Usage example

    + + + + +
    +
    +#include <ncurses.h>
    +
    +int main(int argc, char *argv[])
    +{       initscr();                      /* Start curses mode            */
    +        start_color();                  /* Start color functionality    */
    +        
    +        init_pair(1, COLOR_CYAN, COLOR_BLACK);
    +        printw("A Big string which i didn't care to type fully ");
    +        mvchgat(0, 0, -1, A_BLINK, 1, NULL);    
    +        /* 
    +         * First two parameters specify the position at which to start 
    +         * Third parameter number of characters to update. -1 means till 
    +         * end of line
    +         * Forth parameter is the normal attribute you wanted to give 
    +         * to the charcter
    +         * Fifth is the color index. It is the index given during init_pair()
    +         * use 0 if you didn't want color
    +         * Sixth one is always NULL 
    +         */
    +        refresh();
    +        getch();
    +        endwin();                       /* End curses mode                */
    +        return 0;
    +}
    +
    +
    +

    This example also introduces us to the color world of curses. +Colors will be explained in detail later. Use 0 for no color.

    +
    +
    +
    +
    +

    9. +Windows

    +

    Windows form the most important concept in curses. You have seen +the standard window stdscr above where all the functions implicitly +operated on this window. Now to make design even a simplest GUI, +you need to resort to windows. The main reason you may want to use +windows is to manipulate parts of the screen separately, for better +efficiency, by updating only the windows that need to be changed +and for a better design. I would say the last reason is the most +important in going for windows. You should always strive for a +better and easy-to-manage design in your programs. If you are +writing big, complex GUIs this is of pivotal importance before you +start doing anything.

    +
    +
    +

    9.1. The +basics

    +

    A Window can be created by calling the function newwin(). It doesn't create any thing on the screen +actually. It allocates memory for a structure to manipulate the +window and updates the structure with data regarding the window +like it's size, beginy, beginx etc.. Hence in curses, a window is +just an abstraction of an imaginary window, which can be +manipulated independent of other parts of screen. The function +newwin() returns a pointer to structure WINDOW, which can be passed +to window related functions like wprintw() etc.. Finally the window +can be destroyed with delwin(). It will deallocate the memory +associated with the window structure.

    +
    +
    +
    +

    9.2. Let +there be a Window !!!

    +

    What fun is it, if a window is created and we can't see it. So +the fun part begins by displaying the window. The function +box() can be used to draw a border +around the window. Let's explore these functions in more detail in +this example.

    +
    +

    Example 7. Window Border example

    + + + + +
    +
    +#include <ncurses.h>
    +
    +
    +WINDOW *create_newwin(int height, int width, int starty, int startx);
    +void destroy_win(WINDOW *local_win);
    +
    +int main(int argc, char *argv[])
    +{       WINDOW *my_win;
    +        int startx, starty, width, height;
    +        int ch;
    +
    +        initscr();                      /* Start curses mode            */
    +        cbreak();                       /* Line buffering disabled, Pass on
    +                                         * everty thing to me           */
    +        keypad(stdscr, TRUE);           /* I need that nifty F1         */
    +
    +        height = 3;
    +        width = 10;
    +        starty = (LINES - height) / 2;  /* Calculating for a center placement */
    +        startx = (COLS - width) / 2;    /* of the window                */
    +        printw("Press F1 to exit");
    +        refresh();
    +        my_win = create_newwin(height, width, starty, startx);
    +
    +        while((ch = getch()) != KEY_F(1))
    +        {       switch(ch)
    +                {       case KEY_LEFT:
    +                                destroy_win(my_win);
    +                                my_win = create_newwin(height, width, starty,--startx);
    +                                break;
    +                        case KEY_RIGHT:
    +                                destroy_win(my_win);
    +                                my_win = create_newwin(height, width, starty,++startx);
    +                                break;
    +                        case KEY_UP:
    +                                destroy_win(my_win);
    +                                my_win = create_newwin(height, width, --starty,startx);
    +                                break;
    +                        case KEY_DOWN:
    +                                destroy_win(my_win);
    +                                my_win = create_newwin(height, width, ++starty,startx);
    +                                break;  
    +                }
    +        }
    +                
    +        endwin();                       /* End curses mode                */
    +        return 0;
    +}
    +
    +WINDOW *create_newwin(int height, int width, int starty, int startx)
    +{       WINDOW *local_win;
    +
    +        local_win = newwin(height, width, starty, startx);
    +        box(local_win, 0 , 0);          /* 0, 0 gives default characters 
    +                                         * for the vertical and horizontal
    +                                         * lines                        */
    +        wrefresh(local_win);            /* Show that box                */
    +
    +        return local_win;
    +}
    +
    +void destroy_win(WINDOW *local_win)
    +{       
    +        /* box(local_win, ' ', ' '); : This won't produce the desired
    +         * result of erasing the window. It will leave it's four corners 
    +         * and so an ugly remnant of window. 
    +         */
    +        wborder(local_win, ' ', ' ', ' ',' ',' ',' ',' ',' ');
    +        /* The parameters taken are 
    +         * 1. win: the window on which to operate
    +         * 2. ls: character to be used for the left side of the window 
    +         * 3. rs: character to be used for the right side of the window 
    +         * 4. ts: character to be used for the top side of the window 
    +         * 5. bs: character to be used for the bottom side of the window 
    +         * 6. tl: character to be used for the top left corner of the window 
    +         * 7. tr: character to be used for the top right corner of the window 
    +         * 8. bl: character to be used for the bottom left corner of the window 
    +         * 9. br: character to be used for the bottom right corner of the window
    +         */
    +        wrefresh(local_win);
    +        delwin(local_win);
    +}
    +
    +
    +
    +
    +
    +

    9.3. +Explanation

    +

    Don't scream. I know it's a big example. But I have to explain +some important things here :-). This program creates a rectangular +window that can be moved with left, right, up, down arrow keys. It +repeatedly creates and destroys windows as user press a key. Don't +go beyond the screen limits. Checking for those limits is left as +an exercise for the reader. Let's dissect it by line by line.

    +

    The create_newwin() function creates +a window with newwin() and displays a +border around it with box. The function destroy_win() first erases the window from screen +by painting a border with ' ' character and then calling +delwin() to deallocate memory related to +it. Depending on the key the user presses, starty or startx is +changed and a new window is created.

    +

    In the destroy_win, as you can see, I used wborder instead of +box. The reason is written in the comments (You missed it. I know. +Read the code :-)). wborder draws a border around the window with +the characters given to it as the 4 corner points and the 4 lines. +To put it clearly, if you have called wborder as below:

    + + + + +
    +
    +    wborder(win, '|', '|', '-', '-', '+', '+', '+', '+');
    +
    +

    it produces some thing like

    + + + + +
    +
    +    +------------+
    +    |            |
    +    |            |
    +    |            |
    +    |            |
    +    |            |
    +    |            |
    +    +------------+
    +
    +
    +
    +
    +

    9.4. The +other stuff in the example

    +

    You can also see in the above examples, that I have used the +variables COLS, LINES which are initialized to the screen sizes +after initscr(). They can be useful in finding screen dimensions +and finding the center co-ordinate of the screen as above. The +function getch() as usual gets the key +from keyboard and according to the key it does the corresponding +work. This type of switch- case is very common in any GUI based +programs.

    +
    +
    +
    +

    9.5. Other Border functions

    +

    Above program is grossly inefficient in that with each press of +a key, a window is destroyed and another is created. So let's write +a more efficient program which uses other border related +functions.

    +

    The following program uses mvhline() +and mvvline() to achieve similar effect. +These two functions are simple. They create a horizontal or +vertical line of the specified length at the specified +position.

    +
    +

    Example 8. More border functions

    + + + + +
    +
    +#include <ncurses.h>
    +
    +typedef struct _win_border_struct {
    +        chtype  ls, rs, ts, bs, 
    +                tl, tr, bl, br;
    +}WIN_BORDER;
    +
    +typedef struct _WIN_struct {
    +
    +        int startx, starty;
    +        int height, width;
    +        WIN_BORDER border;
    +}WIN;
    +
    +void init_win_params(WIN *p_win);
    +void print_win_params(WIN *p_win);
    +void create_box(WIN *win, bool flag);
    +
    +int main(int argc, char *argv[])
    +{       WIN win;
    +        int ch;
    +
    +        initscr();                      /* Start curses mode            */
    +        start_color();                  /* Start the color functionality */
    +        cbreak();                       /* Line buffering disabled, Pass on
    +                                         * everty thing to me           */
    +        keypad(stdscr, TRUE);           /* I need that nifty F1         */
    +        noecho();
    +        init_pair(1, COLOR_CYAN, COLOR_BLACK);
    +
    +        /* Initialize the window parameters */
    +        init_win_params(&win);
    +        print_win_params(&win);
    +
    +        attron(COLOR_PAIR(1));
    +        printw("Press F1 to exit");
    +        refresh();
    +        attroff(COLOR_PAIR(1));
    +        
    +        create_box(&win, TRUE);
    +        while((ch = getch()) != KEY_F(1))
    +        {       switch(ch)
    +                {       case KEY_LEFT:
    +                                create_box(&win, FALSE);
    +                                --win.startx;
    +                                create_box(&win, TRUE);
    +                                break;
    +                        case KEY_RIGHT:
    +                                create_box(&win, FALSE);
    +                                ++win.startx;
    +                                create_box(&win, TRUE);
    +                                break;
    +                        case KEY_UP:
    +                                create_box(&win, FALSE);
    +                                --win.starty;
    +                                create_box(&win, TRUE);
    +                                break;
    +                        case KEY_DOWN:
    +                                create_box(&win, FALSE);
    +                                ++win.starty;
    +                                create_box(&win, TRUE);
    +                                break;  
    +                }
    +        }
    +        endwin();                       /* End curses mode                */
    +        return 0;
    +}
    +void init_win_params(WIN *p_win)
    +{
    +        p_win->height = 3;
    +        p_win->width = 10;
    +        p_win->starty = (LINES - p_win->height)/2;      
    +        p_win->startx = (COLS - p_win->width)/2;
    +
    +        p_win->border.ls = '|';
    +        p_win->border.rs = '|';
    +        p_win->border.ts = '-';
    +        p_win->border.bs = '-';
    +        p_win->border.tl = '+';
    +        p_win->border.tr = '+';
    +        p_win->border.bl = '+';
    +        p_win->border.br = '+';
    +
    +}
    +void print_win_params(WIN *p_win)
    +{
    +#ifdef _DEBUG
    +        mvprintw(25, 0, "%d %d %d %d", p_win->startx, p_win->starty, 
    +                                p_win->width, p_win->height);
    +        refresh();
    +#endif
    +}
    +void create_box(WIN *p_win, bool flag)
    +{       int i, j;
    +        int x, y, w, h;
    +
    +        x = p_win->startx;
    +        y = p_win->starty;
    +        w = p_win->width;
    +        h = p_win->height;
    +
    +        if(flag == TRUE)
    +        {       mvaddch(y, x, p_win->border.tl);
    +                mvaddch(y, x + w, p_win->border.tr);
    +                mvaddch(y + h, x, p_win->border.bl);
    +                mvaddch(y + h, x + w, p_win->border.br);
    +                mvhline(y, x + 1, p_win->border.ts, w - 1);
    +                mvhline(y + h, x + 1, p_win->border.bs, w - 1);
    +                mvvline(y + 1, x, p_win->border.ls, h - 1);
    +                mvvline(y + 1, x + w, p_win->border.rs, h - 1);
    +
    +        }
    +        else
    +                for(j = y; j <= y + h; ++j)
    +                        for(i = x; i <= x + w; ++i)
    +                                mvaddch(j, i, ' ');
    +                                
    +        refresh();
    +
    +}
    +
    +
    +
    +
    +
    +
    +

    10. Colors

    +
    +

    10.1. The +basics

    +

    Life seems dull with no colors. Curses has a nice mechanism to +handle colors. Let's get into the thick of the things with a small +program.

    +
    +

    Example 9. A Simple Color example

    + + + + +
    +
    +#include <ncurses.h>
    +
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string);
    +int main(int argc, char *argv[])
    +{       initscr();                      /* Start curses mode            */
    +        if(has_colors() == FALSE)
    +        {       endwin();
    +                printf("Your terminal does not support color\n");
    +                exit(1);
    +        }
    +        start_color();                  /* Start color                  */
    +        init_pair(1, COLOR_RED, COLOR_BLACK);
    +
    +        attron(COLOR_PAIR(1));
    +        print_in_middle(stdscr, LINES / 2, 0, 0, "Viola !!! In color ...");
    +        attroff(COLOR_PAIR(1));
    +        getch();
    +        endwin();
    +}
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string)
    +{       int length, x, y;
    +        float temp;
    +
    +        if(win == NULL)
    +                win = stdscr;
    +        getyx(win, y, x);
    +        if(startx != 0)
    +                x = startx;
    +        if(starty != 0)
    +                y = starty;
    +        if(width == 0)
    +                width = 80;
    +
    +        length = strlen(string);
    +        temp = (width - length)/ 2;
    +        x = startx + (int)temp;
    +        mvwprintw(win, y, x, "%s", string);
    +        refresh();
    +}
    +
    +
    +
    +

    As you can see, to start using color, you should first call the +function start_color(). After that, you +can use color capabilities of your terminals using various +functions. To find out whether a terminal has color capabilities or +not, you can use has_colors() function, +which returns FALSE if the terminal does not support color.

    +

    Curses initializes all the colors supported by terminal when +start_color() is called. These can be accessed by the define +constants like COLOR_BLACK etc. Now to +actually start using colors, you have to define pairs. Colors are +always used in pairs. That means you have to use the function +init_pair() to define the foreground and +background for the pair number you give. After that that pair +number can be used as a normal attribute with COLOR_PAIR()function. This may seem to be +cumbersome at first. But this elegant solution allows us to manage +color pairs very easily. To appreciate it, you have to look into +the the source code of "dialog", a utility for displaying dialog +boxes from shell scripts. The developers have defined foreground +and background combinations for all the colors they might need and +initialized at the beginning. This makes it very easy to set +attributes just by accessing a pair which we already have defined +as a constant.

    +

    The following colors are defined in curses.h. You can use these as parameters for +various color functions.

    + + + + +
    +
    +        COLOR_BLACK   0
    +        COLOR_RED     1
    +        COLOR_GREEN   2
    +        COLOR_YELLOW  3
    +        COLOR_BLUE    4
    +        COLOR_MAGENTA 5
    +        COLOR_CYAN    6
    +        COLOR_WHITE   7
    +
    +
    +
    +
    +

    10.2. Changing Color Definitions

    +

    The function init_color()can be used +to change the rgb values for the colors defined by curses +initially. Say you wanted to lighten the intensity of red color by +a minuscule. Then you can use this function as

    + + + + +
    +
    +    init_color(COLOR_RED, 700, 0, 0);
    +    /* param 1     : color name
    +     * param 2, 3, 4 : rgb content min = 0, max = 1000 */
    +
    +

    If your terminal cannot change the color definitions, the +function returns ERR. The function can_change_color() can be used to find out whether +the terminal has the capability of changing color content or not. +The rgb content is scaled from 0 to 1000. Initially RED color is +defined with content 1000(r), 0(g), 0(b).

    +
    +
    +
    +

    10.3. +Color Content

    +

    The functions color_content() and +pair_content() can be used to find the +color content and foreground, background combination for the +pair.

    +
    +
    +
    +
    +

    11. Interfacing with the +key board

    +
    +

    11.1. The +Basics

    +

    No GUI is complete without a strong user interface and to +interact with the user, a curses program should be sensitive to key +presses or the mouse actions done by the user. Let's deal with the +keys first.

    +

    As you have seen in almost all of the above examples, it's very +easy to get key input from the user. A simple way of getting key +presses is to use getch() function. The +cbreak mode should be enabled to read keys when you are interested +in reading individual key hits rather than complete lines of text +(which usually end with a carriage return). keypad should be +enabled to get the Functions keys, arrow keys etc. See the +initialization section for details.

    +

    getch() returns an integer +corresponding to the key pressed. If it is a normal character, the +integer value will be equivalent to the character. Otherwise it +returns a number which can be matched with the constants defined in +curses.h. For example if the user +presses F1, the integer returned is 265. This can be checked using +the macro KEY_F() defined in curses.h. This makes reading keys +portable and easy to manage.

    +

    For example, if you call getch() like this

    + + + + +
    +
    +    int ch;
    +
    +    ch = getch();
    +
    +

    getch() will wait for the user to press a key, (unless you +specified a timeout) and when user presses a key, the corresponding +integer is returned. Then you can check the value returned with the +constants defined in curses.h to match against the keys you +want.

    +

    The following code piece will do that job.

    + + + + +
    +
    +    if(ch == KEY_LEFT)
    +        printw("Left arrow is pressed\n");
    +
    +

    Let's write a small program which creates a menu which can be +navigated by up and down arrows.

    +
    +
    +
    +

    11.2. A +Simple Key Usage example

    +
    +

    Example 10. A Simple Key Usage example

    + + + + +
    +
    +#include <stdio.h>
    +#include <ncurses.h>
    +
    +#define WIDTH 30
    +#define HEIGHT 10 
    +
    +int startx = 0;
    +int starty = 0;
    +
    +char *choices[] = { 
    +                        "Choice 1",
    +                        "Choice 2",
    +                        "Choice 3",
    +                        "Choice 4",
    +                        "Exit",
    +                  };
    +int n_choices = sizeof(choices) / sizeof(char *);
    +void print_menu(WINDOW *menu_win, int highlight);
    +
    +int main()
    +{       WINDOW *menu_win;
    +        int highlight = 1;
    +        int choice = 0;
    +        int c;
    +
    +        initscr();
    +        clear();
    +        noecho();
    +        cbreak();       /* Line buffering disabled. pass on everything */
    +        startx = (80 - WIDTH) / 2;
    +        starty = (24 - HEIGHT) / 2;
    +                
    +        menu_win = newwin(HEIGHT, WIDTH, starty, startx);
    +        keypad(menu_win, TRUE);
    +        mvprintw(0, 0, "Use arrow keys to go up and down, Press enter to select a choice");
    +        refresh();
    +        print_menu(menu_win, highlight);
    +        while(1)
    +        {       c = wgetch(menu_win);
    +                switch(c)
    +                {       case KEY_UP:
    +                                if(highlight == 1)
    +                                        highlight = n_choices;
    +                                else
    +                                        --highlight;
    +                                break;
    +                        case KEY_DOWN:
    +                                if(highlight == n_choices)
    +                                        highlight = 1;
    +                                else 
    +                                        ++highlight;
    +                                break;
    +                        case 10:
    +                                choice = highlight;
    +                                break;
    +                        default:
    +                                mvprintw(24, 0, "Charcter pressed is = %3d Hopefully it can be printed as '%c'", c, c);
    +                                refresh();
    +                                break;
    +                }
    +                print_menu(menu_win, highlight);
    +                if(choice != 0) /* User did a choice come out of the infinite loop */
    +                        break;
    +        }       
    +        mvprintw(23, 0, "You chose choice %d with choice string %s\n", choice, choices[choice - 1]);
    +        clrtoeol();
    +        refresh();
    +        endwin();
    +        return 0;
    +}
    +
    +
    +void print_menu(WINDOW *menu_win, int highlight)
    +{
    +        int x, y, i;    
    +
    +        x = 2;
    +        y = 2;
    +        box(menu_win, 0, 0);
    +        for(i = 0; i < n_choices; ++i)
    +        {       if(highlight == i + 1) /* High light the present choice */
    +                {       wattron(menu_win, A_REVERSE); 
    +                        mvwprintw(menu_win, y, x, "%s", choices[i]);
    +                        wattroff(menu_win, A_REVERSE);
    +                }
    +                else
    +                        mvwprintw(menu_win, y, x, "%s", choices[i]);
    +                ++y;
    +        }
    +        wrefresh(menu_win);
    +}
    +
    +
    +
    +
    +
    +
    +
    +

    12. Interfacing with +the mouse

    +

    Now that you have seen how to get keys, lets do the same thing +from mouse. Usually each UI allows the user to interact with both +keyboard and mouse.

    +
    +
    +

    12.1. The +Basics

    +

    Before you do any thing else, the events you want to receive +have to be enabled with mousemask().

    + + + + +
    +
    +    mousemask(  mmask_t newmask,    /* The events you want to listen to */
    +                mmask_t *oldmask)    /* The old events mask                */
    +
    +

    The first parameter to above function is a bit mask of events +you would like to listen. By default, all the events are turned +off. The bit mask ALL_MOUSE_EVENTS can +be used to get all the events.

    +

    The following are all the event masks:

    + + + + +
    +
    +    Name            Description
    +       ---------------------------------------------------------------------
    +       BUTTON1_PRESSED          mouse button 1 down
    +       BUTTON1_RELEASED         mouse button 1 up
    +       BUTTON1_CLICKED          mouse button 1 clicked
    +       BUTTON1_DOUBLE_CLICKED   mouse button 1 double clicked
    +       BUTTON1_TRIPLE_CLICKED   mouse button 1 triple clicked
    +       BUTTON2_PRESSED          mouse button 2 down
    +       BUTTON2_RELEASED         mouse button 2 up
    +       BUTTON2_CLICKED          mouse button 2 clicked
    +       BUTTON2_DOUBLE_CLICKED   mouse button 2 double clicked
    +       BUTTON2_TRIPLE_CLICKED   mouse button 2 triple clicked
    +       BUTTON3_PRESSED          mouse button 3 down
    +       BUTTON3_RELEASED         mouse button 3 up
    +       BUTTON3_CLICKED          mouse button 3 clicked
    +       BUTTON3_DOUBLE_CLICKED   mouse button 3 double clicked
    +       BUTTON3_TRIPLE_CLICKED   mouse button 3 triple clicked
    +       BUTTON4_PRESSED          mouse button 4 down
    +       BUTTON4_RELEASED         mouse button 4 up
    +       BUTTON4_CLICKED          mouse button 4 clicked
    +       BUTTON4_DOUBLE_CLICKED   mouse button 4 double clicked
    +       BUTTON4_TRIPLE_CLICKED   mouse button 4 triple clicked
    +       BUTTON_SHIFT             shift was down during button state change
    +       BUTTON_CTRL              control was down during button state change
    +       BUTTON_ALT               alt was down during button state change
    +       ALL_MOUSE_EVENTS         report all button state changes
    +       REPORT_MOUSE_POSITION    report mouse movement
    +
    +
    +
    +
    +

    12.2. +Getting the events

    +

    Once a class of mouse events have been enabled, getch() class of +functions return KEY_MOUSE every time some mouse event happens. +Then the mouse event can be retrieved with getmouse().

    +

    The code approximately looks like this:

    + + + + +
    +
    +    MEVENT event;
    +
    +    ch = getch();
    +    if(ch == KEY_MOUSE)
    +        if(getmouse(&event) == OK)
    +            .    /* Do some thing with the event */
    +            .
    +            .
    +
    +

    getmouse() returns the event into the pointer given to it. It's +a structure which contains

    + + + + +
    +
    +    typedef struct
    +    {
    +        short id;         /* ID to distinguish multiple devices */
    +        int x, y, z;      /* event coordinates */
    +        mmask_t bstate;   /* button state bits */
    +    }    
    +
    +

    The bstate is the main variable we +are interested in. It tells the button state of the mouse.

    +

    Then with a code snippet like the following, we can find out +what happened.

    + + + + +
    +
    +    if(event.bstate & BUTTON1_PRESSED)
    +        printw("Left Button Pressed");
    +
    +
    +
    +
    +

    12.3. +Putting it all Together

    +

    That's pretty much interfacing with mouse. Let's create the same +menu and enable mouse interaction. To make things simpler, key +handling is removed.

    +
    +

    Example 11. Access the menu with mouse !!!

    + + + + +
    +
    +#include <ncurses.h>
    +
    +#define WIDTH 30
    +#define HEIGHT 10 
    +
    +int startx = 0;
    +int starty = 0;
    +
    +char *choices[] = {     "Choice 1",
    +                        "Choice 2",
    +                        "Choice 3",
    +                        "Choice 4",
    +                        "Exit",
    +                  };
    +
    +int n_choices = sizeof(choices) / sizeof(char *);
    +
    +void print_menu(WINDOW *menu_win, int highlight);
    +void report_choice(int mouse_x, int mouse_y, int *p_choice);
    +
    +int main()
    +{       int c, choice = 0;
    +        WINDOW *menu_win;
    +        MEVENT event;
    +
    +        /* Initialize curses */
    +        initscr();
    +        clear();
    +        noecho();
    +        cbreak();       //Line buffering disabled. pass on everything
    +
    +        /* Try to put the window in the middle of screen */
    +        startx = (80 - WIDTH) / 2;
    +        starty = (24 - HEIGHT) / 2;
    +        
    +        attron(A_REVERSE);
    +        mvprintw(23, 1, "Click on Exit to quit (Works best in a virtual console)");
    +        refresh();
    +        attroff(A_REVERSE);
    +
    +        /* Print the menu for the first time */
    +        menu_win = newwin(HEIGHT, WIDTH, starty, startx);
    +        print_menu(menu_win, 1);
    +        /* Get all the mouse events */
    +        mousemask(ALL_MOUSE_EVENTS, NULL);
    +        
    +        while(1)
    +        {       c = wgetch(menu_win);
    +                switch(c)
    +                {       case KEY_MOUSE:
    +                        if(getmouse(&event) == OK)
    +                        {       /* When the user clicks left mouse button */
    +                                if(event.bstate & BUTTON1_PRESSED)
    +                                {       report_choice(event.x + 1, event.y + 1, &choice);
    +                                        if(choice == -1) //Exit chosen
    +                                                goto end;
    +                                        mvprintw(22, 1, "Choice made is : %d String Chosen is \"%10s\"", choice, choices[choice - 1]);
    +                                        refresh(); 
    +                                }
    +                        }
    +                        print_menu(menu_win, choice);
    +                        break;
    +                }
    +        }               
    +end:
    +        endwin();
    +        return 0;
    +}
    +
    +
    +void print_menu(WINDOW *menu_win, int highlight)
    +{
    +        int x, y, i;    
    +
    +        x = 2;
    +        y = 2;
    +        box(menu_win, 0, 0);
    +        for(i = 0; i < n_choices; ++i)
    +        {       if(highlight == i + 1)
    +                {       wattron(menu_win, A_REVERSE); 
    +                        mvwprintw(menu_win, y, x, "%s", choices[i]);
    +                        wattroff(menu_win, A_REVERSE);
    +                }
    +                else
    +                        mvwprintw(menu_win, y, x, "%s", choices[i]);
    +                ++y;
    +        }
    +        wrefresh(menu_win);
    +}
    +
    +/* Report the choice according to mouse position */
    +void report_choice(int mouse_x, int mouse_y, int *p_choice)
    +{       int i,j, choice;
    +
    +        i = startx + 2;
    +        j = starty + 3;
    +        
    +        for(choice = 0; choice < n_choices; ++choice)
    +                if(mouse_y == j + choice && mouse_x >= i && mouse_x <= i + strlen(choices[choice]))
    +                {       if(choice == n_choices - 1)
    +                                *p_choice = -1;         
    +                        else
    +                                *p_choice = choice + 1; 
    +                        break;
    +                }
    +}
    +
    +
    +
    +
    +
    +

    12.4. Miscellaneous Functions

    +

    The functions mouse_trafo() and wmouse_trafo() can be used to +convert to mouse co-ordinates to screen relative co-ordinates. See +curs_mouse(3X) man page for details.

    +

    The mouseinterval function sets the maximum time (in thousands +of a second) that can elapse between press and release events in +order for them to be recognized as a click. This function returns +the previous interval value. The default is one fifth of a +second.

    +
    +
    +
    +
    +

    13. Screen +Manipulation

    +

    In this section, we will look into some functions, which allow +us to manage the screen efficiently and to write some fancy +programs. This is especially important in writing games.

    +
    +
    +

    13.1. getyx() +functions

    +

    The function getyx() can be used to +find out the present cursor co-ordinates. It will fill the values +of x and y co-ordinates in the arguments given to it. Since getyx() +is a macro you don't have to pass the address of the variables. It +can be called as

    + + + + +
    +
    +    getyx(win, y, x);
    +    /* win: window pointer
    +     *   y, x: y, x co-ordinates will be put into this variables 
    +     */
    +
    +

    The function getparyx() gets the beginning co-ordinates of the +sub window relative to the main window. This is some times useful +to update a sub window. When designing fancy stuff like writing +multiple menus, it becomes difficult to store the menu positions, +their first option co-ordinates etc. A simple solution to this +problem, is to create menus in sub windows and later find the +starting co-ordinates of the menus by using getparyx().

    +

    The functions getbegyx() and getmaxyx() store current window's +beginning and maximum co-ordinates. These functions are useful in +the same way as above in managing the windows and sub windows +effectively.

    +
    +
    +
    +

    13.2. Screen +Dumping

    +

    While writing games, some times it becomes necessary to store +the state of the screen and restore it back to the same state. The +function scr_dump() can be used to dump the screen contents to a +file given as an argument. Later it can be restored by scr_restore +function. These two simple functions can be used effectively to +maintain a fast moving game with changing scenarios.

    +
    +
    +
    +

    13.3. Window +Dumping

    +

    To store and restore windows, the functions putwin() and getwin() +can be used. putwin() puts the present +window state into a file, which can be later restored by +getwin().

    +

    The function copywin() can be used to +copy a window completely onto another window. It takes the source +and destination windows as parameters and according to the +rectangle specified, it copies the rectangular region from source +to destination window. It's last parameter specifies whether to +overwrite or just overlay the contents on to the destination +window. If this argument is true, then the copying is +non-destructive.

    +
    +
    +
    +
    +

    14. Miscellaneous +features

    +

    Now you know enough features to write a good curses program, +with all bells and whistles. There are some miscellaneous functions +which are useful in various cases. Let's go headlong into some of +those.

    +
    +
    +

    14.1. +curs_set()

    +

    This function can be used to make the cursor invisible. The +parameter to this function should be

    + + + + +
    +
    +    0 : invisible      or
    +    1 : normal    or
    +    2 : very visible.
    +
    +
    +
    +
    +

    14.2. +Temporarily Leaving Curses mode

    +

    Some times you may want to get back to cooked mode (normal line +buffering mode) temporarily. In such a case you will first need to +save the tty modes with a call to def_prog_mode() and then call endwin() to end the curses mode. This will leave +you in the original tty mode. To get back to curses once you are +done, call reset_prog_mode() . This +function returns the tty to the state stored by def_prog_mode(). Then do refresh(), and you are +back to the curses mode. Here is an example showing the sequence of +things to be done.

    +
    +

    Example 12. Temporarily Leaving Curses Mode

    + + + + +
    +
    +#include <ncurses.h>
    +
    +int main()
    +{       
    +        initscr();                      /* Start curses mode              */
    +        printw("Hello World !!!\n");    /* Print Hello World              */
    +        refresh();                      /* Print it on to the real screen */
    +        def_prog_mode();                /* Save the tty modes             */
    +        endwin();                       /* End curses mode temporarily    */
    +        system("/bin/sh");              /* Do whatever you like in cooked mode */
    +        reset_prog_mode();              /* Return to the previous tty mode*/
    +                                        /* stored by def_prog_mode()      */
    +        refresh();                      /* Do refresh() to restore the    */
    +                                        /* Screen contents                */
    +        printw("Another String\n");     /* Back to curses use the full    */
    +        refresh();                      /* capabilities of curses         */
    +        endwin();                       /* End curses mode                */
    +
    +        return 0;
    +}
    +
    +
    +
    +
    +
    +

    14.3. ACS_ +variables

    +

    If you have ever programmed in DOS, you know about those nifty +characters in extended character set. They are printable only on +some terminals. NCURSES functions like box() use these characters. All these variables +start with ACS meaning alternative character set. You might have +noticed me using these characters in some of the programs above. +Here's an example showing all the characters.

    +
    +

    Example 13. ACS Variables Example

    + + + + +
    +
    +#include <ncurses.h>
    +
    +int main()
    +{
    +        initscr();
    +
    +        printw("Upper left corner           "); addch(ACS_ULCORNER); printw("\n"); 
    +        printw("Lower left corner           "); addch(ACS_LLCORNER); printw("\n");
    +        printw("Lower right corner          "); addch(ACS_LRCORNER); printw("\n");
    +        printw("Tee pointing right          "); addch(ACS_LTEE); printw("\n");
    +        printw("Tee pointing left           "); addch(ACS_RTEE); printw("\n");
    +        printw("Tee pointing up             "); addch(ACS_BTEE); printw("\n");
    +        printw("Tee pointing down           "); addch(ACS_TTEE); printw("\n");
    +        printw("Horizontal line             "); addch(ACS_HLINE); printw("\n");
    +        printw("Vertical line               "); addch(ACS_VLINE); printw("\n");
    +        printw("Large Plus or cross over    "); addch(ACS_PLUS); printw("\n");
    +        printw("Scan Line 1                 "); addch(ACS_S1); printw("\n");
    +        printw("Scan Line 3                 "); addch(ACS_S3); printw("\n");
    +        printw("Scan Line 7                 "); addch(ACS_S7); printw("\n");
    +        printw("Scan Line 9                 "); addch(ACS_S9); printw("\n");
    +        printw("Diamond                     "); addch(ACS_DIAMOND); printw("\n");
    +        printw("Checker board (stipple)     "); addch(ACS_CKBOARD); printw("\n");
    +        printw("Degree Symbol               "); addch(ACS_DEGREE); printw("\n");
    +        printw("Plus/Minus Symbol           "); addch(ACS_PLMINUS); printw("\n");
    +        printw("Bullet                      "); addch(ACS_BULLET); printw("\n");
    +        printw("Arrow Pointing Left         "); addch(ACS_LARROW); printw("\n");
    +        printw("Arrow Pointing Right        "); addch(ACS_RARROW); printw("\n");
    +        printw("Arrow Pointing Down         "); addch(ACS_DARROW); printw("\n");
    +        printw("Arrow Pointing Up           "); addch(ACS_UARROW); printw("\n");
    +        printw("Board of squares            "); addch(ACS_BOARD); printw("\n");
    +        printw("Lantern Symbol              "); addch(ACS_LANTERN); printw("\n");
    +        printw("Solid Square Block          "); addch(ACS_BLOCK); printw("\n");
    +        printw("Less/Equal sign             "); addch(ACS_LEQUAL); printw("\n");
    +        printw("Greater/Equal sign          "); addch(ACS_GEQUAL); printw("\n");
    +        printw("Pi                          "); addch(ACS_PI); printw("\n");
    +        printw("Not equal                   "); addch(ACS_NEQUAL); printw("\n");
    +        printw("UK pound sign               "); addch(ACS_STERLING); printw("\n");
    +
    +        refresh();
    +        getch();
    +        endwin();
    +
    +        return 0;
    +}
    +
    +
    +
    +
    +
    +
    +

    15. Other +libraries

    +

    Apart from the curses library, there are few text mode +libraries, which provide more functionality and a lot of features. +The following sections explain three standard libraries which are +usually distributed along with curses.

    +
    +
    +
    +

    16. Panel +Library

    +

    Now that you are proficient in curses, you wanted to do some +thing big. You created a lot of overlapping windows to give a +professional windows-type look. Unfortunately, it soon becomes +difficult to manage these. The multiple refreshes, updates plunge +you into a nightmare. The overlapping windows create blotches, +whenever you forget to refresh the windows in the proper order.

    +

    Don't despair. There's an elegant solution provided in panels +library. In the words of developers of ncurses

    +

    When your interface design is such that windows may dive +deeper into the visibility stack or pop to the top at runtime, the +resulting book-keeping can be tedious and difficult to get right. +Hence the panels library.

    +

    If you have lot of overlapping windows, then panels library is +the way to go. It obviates the need of doing series of +wnoutrefresh(), doupdate() and relieves the burden of doing it +correctly(bottom up). The library maintains information about the +order of windows, their overlapping and update the screen properly. +So why wait? Let's take a close peek into panels.

    +
    +
    +

    16.1. The +Basics

    +

    Panel object is a window that is implicitly treated as part of a +deck including all other panel objects. The deck is treated as a +stack with the top panel being completely visible and the other +panels may or may not be obscured according to their positions. So +the basic idea is to create a stack of overlapping panels and use +panels library to display them correctly. There is a function +similar to refresh() which, when called , displays panels in the +correct order. Functions are provided to hide or show panels, move +panels, change its size etc.. The overlapping problem is managed by +the panels library during all the calls to these functions.

    +

    The general flow of a panel program goes like this:

    +
      +
    1. +

      Create the windows (with newwin()) to be attached to the +panels.

      +
    2. +
    3. +

      Create panels with the chosen visibility order. Stack them up +according to the desired visibility. The function new_panel() is +used to created panels.

      +
    4. +
    5. +

      Call update_panels() to write the panels to the virtual screen +in correct visibility order. Do a doupdate() to show it on the +screen.

      +
    6. +
    7. +

      Mainpulate the panels with show_panel(), hide_panel(), +move_panel() etc. Make use of helper functions like panel_hidden() +and panel_window(). Make use of user pointer to store custom data +for a panel. Use the functions set_panel_userptr() and +panel_userptr() to set and get the user pointer for a panel.

      +
    8. +
    9. +

      When you are done with the panel use del_panel() to delete the +panel.

      +
    10. +
    +

    Let's make the concepts clear, with some programs. The following +is a simple program which creates 3 overlapping panels and shows +them on the screen.

    +
    +
    +
    +

    16.2. +Compiling With the Panels Library

    +

    To use panels library functions, you have to include panel.h and +to link the program with panels library the flag -lpanel should be +added along with -lncurses in that order.

    + + + + +
    +
    +    #include <panel.h>
    +    .
    +    .
    +    .
    +
    +    compile and link: gcc <program file> -lpanel -lncurses
    +
    +
    +

    Example 14. Panel basics

    + + + + +
    +
    +#include <panel.h>
    +
    +int main()
    +{       WINDOW *my_wins[3];
    +        PANEL  *my_panels[3];
    +        int lines = 10, cols = 40, y = 2, x = 4, i;
    +
    +        initscr();
    +        cbreak();
    +        noecho();
    +
    +        /* Create windows for the panels */
    +        my_wins[0] = newwin(lines, cols, y, x);
    +        my_wins[1] = newwin(lines, cols, y + 1, x + 5);
    +        my_wins[2] = newwin(lines, cols, y + 2, x + 10);
    +
    +        /* 
    +         * Create borders around the windows so that you can see the effect
    +         * of panels
    +         */
    +        for(i = 0; i < 3; ++i)
    +                box(my_wins[i], 0, 0);
    +
    +        /* Attach a panel to each window */     /* Order is bottom up */
    +        my_panels[0] = new_panel(my_wins[0]);   /* Push 0, order: stdscr-0 */
    +        my_panels[1] = new_panel(my_wins[1]);   /* Push 1, order: stdscr-0-1 */
    +        my_panels[2] = new_panel(my_wins[2]);   /* Push 2, order: stdscr-0-1-2 */
    +
    +        /* Update the stacking order. 2nd panel will be on top */
    +        update_panels();
    +
    +        /* Show it on the screen */
    +        doupdate();
    +        
    +        getch();
    +        endwin();
    +}
    +
    +
    +
    +

    As you can see, above program follows a simple flow as +explained. The windows are created with newwin() and then they are +attached to panels with new_panel(). As we attach one panel after +another, the stack of panels gets updated. To put them on screen +update_panels() and doupdate() are called.

    +
    +
    +
    +

    16.3. +Panel Window Browsing

    +

    A slightly complicated example is given below. This program +creates 3 windows which can be cycled through using tab. Have a +look at the code.

    +
    +

    Example 15. Panel Window Browsing Example

    + + + + +
    +
    +#include <panel.h>
    +
    +#define NLINES 10
    +#define NCOLS 40
    +
    +void init_wins(WINDOW **wins, int n);
    +void win_show(WINDOW *win, char *label, int label_color);
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
    +
    +int main()
    +{       WINDOW *my_wins[3];
    +        PANEL  *my_panels[3];
    +        PANEL  *top;
    +        int ch;
    +
    +        /* Initialize curses */
    +        initscr();
    +        start_color();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +
    +        /* Initialize all the colors */
    +        init_pair(1, COLOR_RED, COLOR_BLACK);
    +        init_pair(2, COLOR_GREEN, COLOR_BLACK);
    +        init_pair(3, COLOR_BLUE, COLOR_BLACK);
    +        init_pair(4, COLOR_CYAN, COLOR_BLACK);
    +
    +        init_wins(my_wins, 3);
    +        
    +        /* Attach a panel to each window */     /* Order is bottom up */
    +        my_panels[0] = new_panel(my_wins[0]);   /* Push 0, order: stdscr-0 */
    +        my_panels[1] = new_panel(my_wins[1]);   /* Push 1, order: stdscr-0-1 */
    +        my_panels[2] = new_panel(my_wins[2]);   /* Push 2, order: stdscr-0-1-2 */
    +
    +        /* Set up the user pointers to the next panel */
    +        set_panel_userptr(my_panels[0], my_panels[1]);
    +        set_panel_userptr(my_panels[1], my_panels[2]);
    +        set_panel_userptr(my_panels[2], my_panels[0]);
    +
    +        /* Update the stacking order. 2nd panel will be on top */
    +        update_panels();
    +
    +        /* Show it on the screen */
    +        attron(COLOR_PAIR(4));
    +        mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)");
    +        attroff(COLOR_PAIR(4));
    +        doupdate();
    +
    +        top = my_panels[2];
    +        while((ch = getch()) != KEY_F(1))
    +        {       switch(ch)
    +                {       case 9:
    +                                top = (PANEL *)panel_userptr(top);
    +                                top_panel(top);
    +                                break;
    +                }
    +                update_panels();
    +                doupdate();
    +        }
    +        endwin();
    +        return 0;
    +}
    +
    +/* Put all the windows */
    +void init_wins(WINDOW **wins, int n)
    +{       int x, y, i;
    +        char label[80];
    +
    +        y = 2;
    +        x = 10;
    +        for(i = 0; i < n; ++i)
    +        {       wins[i] = newwin(NLINES, NCOLS, y, x);
    +                sprintf(label, "Window Number %d", i + 1);
    +                win_show(wins[i], label, i + 1);
    +                y += 3;
    +                x += 7;
    +        }
    +}
    +
    +/* Show the window with a border and a label */
    +void win_show(WINDOW *win, char *label, int label_color)
    +{       int startx, starty, height, width;
    +
    +        getbegyx(win, starty, startx);
    +        getmaxyx(win, height, width);
    +
    +        box(win, 0, 0);
    +        mvwaddch(win, 2, 0, ACS_LTEE); 
    +        mvwhline(win, 2, 1, ACS_HLINE, width - 2); 
    +        mvwaddch(win, 2, width - 1, ACS_RTEE); 
    +        
    +        print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color));
    +}
    +
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
    +{       int length, x, y;
    +        float temp;
    +
    +        if(win == NULL)
    +                win = stdscr;
    +        getyx(win, y, x);
    +        if(startx != 0)
    +                x = startx;
    +        if(starty != 0)
    +                y = starty;
    +        if(width == 0)
    +                width = 80;
    +
    +        length = strlen(string);
    +        temp = (width - length)/ 2;
    +        x = startx + (int)temp;
    +        wattron(win, color);
    +        mvwprintw(win, y, x, "%s", string);
    +        wattroff(win, color);
    +        refresh();
    +}
    +
    +
    +
    +
    +
    +

    16.4. +Using User Pointers

    +

    In the above example I used user pointers to find out the next +window in the cycle. We can attach custom information to the panel +by specifying a user pointer, which can point to any information +you want to store. In this case I stored the pointer to the next +panel in the cycle. User pointer for a panel can be set with the +function set_panel_userptr(). It can be +accessed using the function panel_userptr() which will return the user pointer +for the panel given as argument. After finding the next panel in +the cycle It's brought to the top by the function top_panel(). This +function brings the panel given as argument to the top of the panel +stack.

    +
    +
    +
    +

    16.5. Moving and Resizing Panels

    +

    The function move_panel() can be used +to move a panel to the desired location. It does not change the +position of the panel in the stack. Make sure that you use +move_panel() instead mvwin() on the window associated with the +panel.

    +

    Resizing a panel is slightly complex. There is no straight +forward function just to resize the window associated with a panel. +A solution to resize a panel is to create a new window with the +desired sizes, change the window associated with the panel using +replace_panel(). Don't forget to delete the old window. The window +associated with a panel can be found by using the function +panel_window().

    +

    The following program shows these concepts, in supposedly simple +program. You can cycle through the window with <TAB> as +usual. To resize or move the active panel press 'r' for resize 'm' +for moving. Then use arrow keys to resize or move it to the desired +way and press enter to end your resizing or moving. This example +makes use of user data to get the required data to do the +operations.

    +
    +

    Example 16. Panel Moving and Resizing example

    + + + + +
    +
    +#include <panel.h>
    +
    +typedef struct _PANEL_DATA {
    +        int x, y, w, h;
    +        char label[80]; 
    +        int label_color;
    +        PANEL *next;
    +}PANEL_DATA;
    +
    +#define NLINES 10
    +#define NCOLS 40
    +
    +void init_wins(WINDOW **wins, int n);
    +void win_show(WINDOW *win, char *label, int label_color);
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
    +void set_user_ptrs(PANEL **panels, int n);
    +
    +int main()
    +{       WINDOW *my_wins[3];
    +        PANEL  *my_panels[3];
    +        PANEL_DATA  *top;
    +        PANEL *stack_top;
    +        WINDOW *temp_win, *old_win;
    +        int ch;
    +        int newx, newy, neww, newh;
    +        int size = FALSE, move = FALSE;
    +
    +        /* Initialize curses */
    +        initscr();
    +        start_color();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +
    +        /* Initialize all the colors */
    +        init_pair(1, COLOR_RED, COLOR_BLACK);
    +        init_pair(2, COLOR_GREEN, COLOR_BLACK);
    +        init_pair(3, COLOR_BLUE, COLOR_BLACK);
    +        init_pair(4, COLOR_CYAN, COLOR_BLACK);
    +
    +        init_wins(my_wins, 3);
    +        
    +        /* Attach a panel to each window */     /* Order is bottom up */
    +        my_panels[0] = new_panel(my_wins[0]);   /* Push 0, order: stdscr-0 */
    +        my_panels[1] = new_panel(my_wins[1]);   /* Push 1, order: stdscr-0-1 */
    +        my_panels[2] = new_panel(my_wins[2]);   /* Push 2, order: stdscr-0-1-2 */
    +
    +        set_user_ptrs(my_panels, 3);
    +        /* Update the stacking order. 2nd panel will be on top */
    +        update_panels();
    +
    +        /* Show it on the screen */
    +        attron(COLOR_PAIR(4));
    +        mvprintw(LINES - 3, 0, "Use 'm' for moving, 'r' for resizing");
    +        mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)");
    +        attroff(COLOR_PAIR(4));
    +        doupdate();
    +
    +        stack_top = my_panels[2];
    +        top = (PANEL_DATA *)panel_userptr(stack_top);
    +        newx = top->x;
    +        newy = top->y;
    +        neww = top->w;
    +        newh = top->h;
    +        while((ch = getch()) != KEY_F(1))
    +        {       switch(ch)
    +                {       case 9:         /* Tab */
    +                                top = (PANEL_DATA *)panel_userptr(stack_top);
    +                                top_panel(top->next);
    +                                stack_top = top->next;
    +                                top = (PANEL_DATA *)panel_userptr(stack_top);
    +                                newx = top->x;
    +                                newy = top->y;
    +                                neww = top->w;
    +                                newh = top->h;
    +                                break;
    +                        case 'r':       /* Re-Size*/
    +                                size = TRUE;
    +                                attron(COLOR_PAIR(4));
    +                                mvprintw(LINES - 4, 0, "Entered Resizing :Use Arrow Keys to resize and press <ENTER> to end resizing");
    +                                refresh();
    +                                attroff(COLOR_PAIR(4));
    +                                break;
    +                        case 'm':       /* Move */
    +                                attron(COLOR_PAIR(4));
    +                                mvprintw(LINES - 4, 0, "Entered Moving: Use Arrow Keys to Move and press <ENTER> to end moving");
    +                                refresh();
    +                                attroff(COLOR_PAIR(4));
    +                                move = TRUE;
    +                                break;
    +                        case KEY_LEFT:
    +                                if(size == TRUE)
    +                                {       --newx;
    +                                        ++neww;
    +                                }
    +                                if(move == TRUE)
    +                                        --newx;
    +                                break;
    +                        case KEY_RIGHT:
    +                                if(size == TRUE)
    +                                {       ++newx;
    +                                        --neww;
    +                                }
    +                                if(move == TRUE)
    +                                        ++newx;
    +                                break;
    +                        case KEY_UP:
    +                                if(size == TRUE)
    +                                {       --newy;
    +                                        ++newh;
    +                                }
    +                                if(move == TRUE)
    +                                        --newy;
    +                                break;
    +                        case KEY_DOWN:
    +                                if(size == TRUE)
    +                                {       ++newy;
    +                                        --newh;
    +                                }
    +                                if(move == TRUE)
    +                                        ++newy;
    +                                break;
    +                        case 10:        /* Enter */
    +                                move(LINES - 4, 0);
    +                                clrtoeol();
    +                                refresh();
    +                                if(size == TRUE)
    +                                {       old_win = panel_window(stack_top);
    +                                        temp_win = newwin(newh, neww, newy, newx);
    +                                        replace_panel(stack_top, temp_win);
    +                                        win_show(temp_win, top->label, top->label_color); 
    +                                        delwin(old_win);
    +                                        size = FALSE;
    +                                }
    +                                if(move == TRUE)
    +                                {       move_panel(stack_top, newy, newx);
    +                                        move = FALSE;
    +                                }
    +                                break;
    +                        
    +                }
    +                attron(COLOR_PAIR(4));
    +                mvprintw(LINES - 3, 0, "Use 'm' for moving, 'r' for resizing");
    +                mvprintw(LINES - 2, 0, "Use tab to browse through the windows (F1 to Exit)");
    +                attroff(COLOR_PAIR(4));
    +                refresh();      
    +                update_panels();
    +                doupdate();
    +        }
    +        endwin();
    +        return 0;
    +}
    +
    +/* Put all the windows */
    +void init_wins(WINDOW **wins, int n)
    +{       int x, y, i;
    +        char label[80];
    +
    +        y = 2;
    +        x = 10;
    +        for(i = 0; i < n; ++i)
    +        {       wins[i] = newwin(NLINES, NCOLS, y, x);
    +                sprintf(label, "Window Number %d", i + 1);
    +                win_show(wins[i], label, i + 1);
    +                y += 3;
    +                x += 7;
    +        }
    +}
    +
    +/* Set the PANEL_DATA structures for individual panels */
    +void set_user_ptrs(PANEL **panels, int n)
    +{       PANEL_DATA *ptrs;
    +        WINDOW *win;
    +        int x, y, w, h, i;
    +        char temp[80];
    +        
    +        ptrs = (PANEL_DATA *)calloc(n, sizeof(PANEL_DATA));
    +
    +        for(i = 0;i < n; ++i)
    +        {       win = panel_window(panels[i]);
    +                getbegyx(win, y, x);
    +                getmaxyx(win, h, w);
    +                ptrs[i].x = x;
    +                ptrs[i].y = y;
    +                ptrs[i].w = w;
    +                ptrs[i].h = h;
    +                sprintf(temp, "Window Number %d", i + 1);
    +                strcpy(ptrs[i].label, temp);
    +                ptrs[i].label_color = i + 1;
    +                if(i + 1 == n)
    +                        ptrs[i].next = panels[0];
    +                else
    +                        ptrs[i].next = panels[i + 1];
    +                set_panel_userptr(panels[i], &ptrs[i]);
    +        }
    +}
    +
    +/* Show the window with a border and a label */
    +void win_show(WINDOW *win, char *label, int label_color)
    +{       int startx, starty, height, width;
    +
    +        getbegyx(win, starty, startx);
    +        getmaxyx(win, height, width);
    +
    +        box(win, 0, 0);
    +        mvwaddch(win, 2, 0, ACS_LTEE); 
    +        mvwhline(win, 2, 1, ACS_HLINE, width - 2); 
    +        mvwaddch(win, 2, width - 1, ACS_RTEE); 
    +        
    +        print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color));
    +}
    +
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
    +{       int length, x, y;
    +        float temp;
    +
    +        if(win == NULL)
    +                win = stdscr;
    +        getyx(win, y, x);
    +        if(startx != 0)
    +                x = startx;
    +        if(starty != 0)
    +                y = starty;
    +        if(width == 0)
    +                width = 80;
    +
    +        length = strlen(string);
    +        temp = (width - length)/ 2;
    +        x = startx + (int)temp;
    +        wattron(win, color);
    +        mvwprintw(win, y, x, "%s", string);
    +        wattroff(win, color);
    +        refresh();
    +}
    +
    +
    +

    Concentrate on the main while loop. Once it finds out the type +of key pressed, it takes appropriate action. If 'r' is pressed +resizing mode is started. After this the new sizes are updated as +the user presses the arrow keys. When the user presses +<ENTER> present selection ends and panel is resized by using +the concept explained. While in resizing mode the program doesn't +show how the window is getting resized. It's left as an exercise to +the reader to print a dotted border while it gets resized to a new +position.

    +

    When the user presses 'm' the move mode starts. This is a bit +simpler than resizing. As the arrow keys are pressed the new +position is updated and pressing of <ENTER> causes the panel +to be moved by calling the function move_panel().

    +

    In this program the user data which is represented as +PANEL_DATA, plays very important role in finding the associated +information with a panel. As written in the comments, the +PANEL_DATA stores the panel sizes, label, label color and a pointer +to the next panel in the cycle.

    +
    +
    +
    +

    16.6. +Hiding and Showing Panels

    +

    A Panel can be hidden by using the function hide_panel(). This +function merely removes it form the stack of panels, thus hiding it +on the screen once you do update_panels() and doupdate(). It +doesn't destroy the PANEL structure associated with the hidden +panel. It can be shown again by using the show_panel() +function.

    +

    The following program shows the hiding of panels. Press 'a' or +'b' or 'c' to show or hide first, second and third windows +respectively. It uses a user data with a small variable hide, which +keeps track of whether the window is hidden or not. For some reason +the function panel_hidden() which tells +whether a panel is hidden or not is not working. A bug report was +also presented by Michael Andres here

    +
    +

    Example 17. Panel Hiding and Showing example

    + + + + +
    +
    +#include <panel.h>
    +
    +typedef struct _PANEL_DATA {
    +        int hide;       /* TRUE if panel is hidden */
    +}PANEL_DATA;
    +
    +#define NLINES 10
    +#define NCOLS 40
    +
    +void init_wins(WINDOW **wins, int n);
    +void win_show(WINDOW *win, char *label, int label_color);
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
    +
    +int main()
    +{       WINDOW *my_wins[3];
    +        PANEL  *my_panels[3];
    +        PANEL_DATA panel_datas[3];
    +        PANEL_DATA *temp;
    +        int ch;
    +
    +        /* Initialize curses */
    +        initscr();
    +        start_color();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +
    +        /* Initialize all the colors */
    +        init_pair(1, COLOR_RED, COLOR_BLACK);
    +        init_pair(2, COLOR_GREEN, COLOR_BLACK);
    +        init_pair(3, COLOR_BLUE, COLOR_BLACK);
    +        init_pair(4, COLOR_CYAN, COLOR_BLACK);
    +
    +        init_wins(my_wins, 3);
    +        
    +        /* Attach a panel to each window */     /* Order is bottom up */
    +        my_panels[0] = new_panel(my_wins[0]);   /* Push 0, order: stdscr-0 */
    +        my_panels[1] = new_panel(my_wins[1]);   /* Push 1, order: stdscr-0-1 */
    +        my_panels[2] = new_panel(my_wins[2]);   /* Push 2, order: stdscr-0-1-2 */
    +
    +        /* Initialize panel datas saying that nothing is hidden */
    +        panel_datas[0].hide = FALSE;
    +        panel_datas[1].hide = FALSE;
    +        panel_datas[2].hide = FALSE;
    +
    +        set_panel_userptr(my_panels[0], &panel_datas[0]);
    +        set_panel_userptr(my_panels[1], &panel_datas[1]);
    +        set_panel_userptr(my_panels[2], &panel_datas[2]);
    +
    +        /* Update the stacking order. 2nd panel will be on top */
    +        update_panels();
    +
    +        /* Show it on the screen */
    +        attron(COLOR_PAIR(4));
    +        mvprintw(LINES - 3, 0, "Show or Hide a window with 'a'(first window)  'b'(Second Window)  'c'(Third Window)");
    +        mvprintw(LINES - 2, 0, "F1 to Exit");
    +
    +        attroff(COLOR_PAIR(4));
    +        doupdate();
    +        
    +        while((ch = getch()) != KEY_F(1))
    +        {       switch(ch)
    +                {       case 'a':                       
    +                                temp = (PANEL_DATA *)panel_userptr(my_panels[0]);
    +                                if(temp->hide == FALSE)
    +                                {       hide_panel(my_panels[0]);
    +                                        temp->hide = TRUE;
    +                                }
    +                                else
    +                                {       show_panel(my_panels[0]);
    +                                        temp->hide = FALSE;
    +                                }
    +                                break;
    +                        case 'b':
    +                                temp = (PANEL_DATA *)panel_userptr(my_panels[1]);
    +                                if(temp->hide == FALSE)
    +                                {       hide_panel(my_panels[1]);
    +                                        temp->hide = TRUE;
    +                                }
    +                                else
    +                                {       show_panel(my_panels[1]);
    +                                        temp->hide = FALSE;
    +                                }
    +                                break;
    +                        case 'c':
    +                                temp = (PANEL_DATA *)panel_userptr(my_panels[2]);
    +                                if(temp->hide == FALSE)
    +                                {       hide_panel(my_panels[2]);
    +                                        temp->hide = TRUE;
    +                                }
    +                                else
    +                                {       show_panel(my_panels[2]);
    +                                        temp->hide = FALSE;
    +                                }
    +                                break;
    +                }
    +                update_panels();
    +                doupdate();
    +        }
    +        endwin();
    +        return 0;
    +}
    +
    +/* Put all the windows */
    +void init_wins(WINDOW **wins, int n)
    +{       int x, y, i;
    +        char label[80];
    +
    +        y = 2;
    +        x = 10;
    +        for(i = 0; i < n; ++i)
    +        {       wins[i] = newwin(NLINES, NCOLS, y, x);
    +                sprintf(label, "Window Number %d", i + 1);
    +                win_show(wins[i], label, i + 1);
    +                y += 3;
    +                x += 7;
    +        }
    +}
    +
    +/* Show the window with a border and a label */
    +void win_show(WINDOW *win, char *label, int label_color)
    +{       int startx, starty, height, width;
    +
    +        getbegyx(win, starty, startx);
    +        getmaxyx(win, height, width);
    +
    +        box(win, 0, 0);
    +        mvwaddch(win, 2, 0, ACS_LTEE); 
    +        mvwhline(win, 2, 1, ACS_HLINE, width - 2); 
    +        mvwaddch(win, 2, width - 1, ACS_RTEE); 
    +        
    +        print_in_middle(win, 1, 0, width, label, COLOR_PAIR(label_color));
    +}
    +
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
    +{       int length, x, y;
    +        float temp;
    +
    +        if(win == NULL)
    +                win = stdscr;
    +        getyx(win, y, x);
    +        if(startx != 0)
    +                x = startx;
    +        if(starty != 0)
    +                y = starty;
    +        if(width == 0)
    +                width = 80;
    +
    +        length = strlen(string);
    +        temp = (width - length)/ 2;
    +        x = startx + (int)temp;
    +        wattron(win, color);
    +        mvwprintw(win, y, x, "%s", string);
    +        wattroff(win, color);
    +        refresh();
    +}
    +
    +
    +
    +
    +
    +

    16.7. +panel_above() and panel_below() Functions

    +

    The functions panel_above() and +panel_below() can be used to find out +the panel above and below a panel. If the argument to these +functions is NULL, then they return a pointer to bottom panel and +top panel respectively.

    +
    +
    +
    +
    +

    17. Menus +Library

    +

    The menus library provides a nice extension to basic curses, +through which you can create menus. It provides a set of functions +to create menus. But they have to be customized to give a nicer +look, with colors etc. Let's get into the details.

    +

    A menu is a screen display that assists the user to choose some +subset of a given set of items. To put it simple, a menu is a +collection of items from which one or more items can be chosen. +Some readers might not be aware of multiple item selection +capability. Menu library provides functionality to write menus from +which the user can chose more than one item as the preferred +choice. This is dealt with in a later section. Now it is time for +some rudiments.

    +
    +
    +

    17.1. The +Basics

    +

    To create menus, you first create items, and then post the menu +to the display. After that, all the processing of user responses is +done in an elegant function menu_driver() which is the work horse +of any menu program.

    +

    The general flow of control of a menu program looks like +this.

    +
      +
    1. +

      Initialize curses

      +
    2. +
    3. +

      Create items using new_item(). You can specify a name and +description for the items.

      +
    4. +
    5. +

      Create the menu with new_menu() by specifying the items to be +attached with.

      +
    6. +
    7. +

      Post the menu with menu_post() and refresh the screen.

      +
    8. +
    9. +

      Process the user requests with a loop and do necessary updates +to menu with menu_driver.

      +
    10. +
    11. +

      Unpost the menu with menu_unpost()

      +
    12. +
    13. +

      Free the memory allocated to menu by free_menu()

      +
    14. +
    15. +

      Free the memory allocated to the items with free_item()

      +
    16. +
    17. +

      End curses

      +
    18. +
    +

    Let's see a program which prints a simple menu and updates the +current selection with up, down arrows.

    +
    +
    +
    +

    17.2. +Compiling With the Menu Library

    +

    To use menu library functions, you have to include menu.h and to +link the program with menu library the flag -lmenu should be added +along with -lncurses in that order.

    + + + + +
    +
    +    #include <menu.h>
    +    .
    +    .
    +    .
    +
    +    compile and link: gcc <program file> -lmenu -lncurses
    +
    +
    +

    Example 18. Menu Basics

    + + + + +
    +
    +#include <curses.h>
    +#include <menu.h>
    +
    +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
    +#define CTRLD   4
    +
    +char *choices[] = {
    +                        "Choice 1",
    +                        "Choice 2",
    +                        "Choice 3",
    +                        "Choice 4",
    +                        "Exit",
    +                  };
    +
    +int main()
    +{       ITEM **my_items;
    +        int c;                          
    +        MENU *my_menu;
    +        int n_choices, i;
    +        ITEM *cur_item;
    +        
    +        
    +        initscr();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +        
    +        n_choices = ARRAY_SIZE(choices);
    +        my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *));
    +
    +        for(i = 0; i < n_choices; ++i)
    +                my_items[i] = new_item(choices[i], choices[i]);
    +        my_items[n_choices] = (ITEM *)NULL;
    +
    +        my_menu = new_menu((ITEM **)my_items);
    +        mvprintw(LINES - 2, 0, "F1 to Exit");
    +        post_menu(my_menu);
    +        refresh();
    +
    +        while((c = getch()) != KEY_F(1))
    +        {   switch(c)
    +            {   case KEY_DOWN:
    +                        menu_driver(my_menu, REQ_DOWN_ITEM);
    +                                break;
    +                        case KEY_UP:
    +                                menu_driver(my_menu, REQ_UP_ITEM);
    +                                break;
    +                }
    +        }       
    +
    +        free_item(my_items[0]);
    +        free_item(my_items[1]);
    +        free_menu(my_menu);
    +        endwin();
    +}
    +        
    +
    +
    +

    This program demonstrates the basic concepts involved in +creating a menu using menus library. First we create the items +using new_item() and then attach them to the menu with new_menu() +function. After posting the menu and refreshing the screen, the +main processing loop starts. It reads user input and takes +corresponding action. The function menu_driver() is the main work +horse of the menu system. The second parameter to this function +tells what's to be done with the menu. According to the parameter, +menu_driver() does the corresponding task. The value can be either +a menu navigational request, an ascii character, or a KEY_MOUSE +special key associated with a mouse event.

    +

    The menu_driver accepts following navigational requests.

    + + + + +
    +
    +
     REQ_LEFT_ITEM         Move left to an item.
    +     REQ_RIGHT_ITEM      Move right to an item.
    +     REQ_UP_ITEM         Move up to an item.
    +     REQ_DOWN_ITEM       Move down to an item.
    +     REQ_SCR_ULINE       Scroll up a line.
    +     REQ_SCR_DLINE          Scroll down a line.
    +     REQ_SCR_DPAGE          Scroll down a page.
    +     REQ_SCR_UPAGE         Scroll up a page.
    +     REQ_FIRST_ITEM     Move to the first item.
    +     REQ_LAST_ITEM         Move to the last item.
    +     REQ_NEXT_ITEM         Move to the next item.
    +     REQ_PREV_ITEM         Move to the previous item. 
    +     REQ_TOGGLE_ITEM     Select/deselect an item.
    +     REQ_CLEAR_PATTERN     Clear the menu pattern buffer.
    +     REQ_BACK_PATTERN      Delete the previous character from the pattern buffer.
    +     REQ_NEXT_MATCH     Move to the next item matching the pattern match.
    +     REQ_PREV_MATCH     Move to the previous item matching the pattern match.
    +
    +

    Don't get overwhelmed by the number of options. We will see them +slowly one after another. The options of interest in this example +are REQ_UP_ITEM and REQ_DOWN_ITEM. These two options when passed to +menu_driver, menu driver updates the current item to one item up or +down respectively.

    +
    +
    +
    +

    17.3. Menu +Driver: The work horse of the menu system

    +

    As you have seen in the above example, menu_driver plays an +important role in updating the menu. It is very important to +understand various options it takes and what they do. As explained +above, the second parameter to menu_driver() can be either a +navigational request, a printable character or a KEY_MOUSE key. +Let's dissect the different navigational requests.

    +
      +
    • +

      REQ_LEFT_ITEM and REQ_RIGHT_ITEM

      +

      A Menu can be displayed with multiple columns for more than one +item. This can be done by using the menu_format()function. When a multi columnar menu +is displayed these requests cause the menu driver to move the +current selection to left or right.

      +
    • +
    • +

      REQ_UP_ITEM and REQ_DOWN_ITEM

      +

      These two options you have seen in the above example. These +options when given, makes the menu_driver to move the current +selection to an item up or down.

      +
    • +
    • +

      REQ_SCR_* options

      +

      The four options REQ_SCR_ULINE, REQ_SCR_DLINE, REQ_SCR_DPAGE, +REQ_SCR_UPAGE are related to scrolling. If all the items in the +menu cannot be displayed in the menu sub window, then the menu is +scrollable. These requests can be given to the menu_driver to do +the scrolling either one line up, down or one page down or up +respectively.

      +
    • +
    • +

      REQ_FIRST_ITEM, REQ_LAST_ITEM, REQ_NEXT_ITEM and +REQ_PREV_ITEM

      +

      These requests are self explanatory.

      +
    • +
    • +

      REQ_TOGGLE_ITEM

      +

      This request when given, toggles the present selection. This +option is to be used only in a multi valued menu. So to use this +request the option O_ONEVALUE must be off. This option can be made +off or on with set_menu_opts().

      +
    • +
    • +

      Pattern Requests

      +

      Every menu has an associated pattern buffer, which is used to +find the nearest match to the ascii characters entered by the user. +Whenever ascii characters are given to menu_driver, it puts in to +the pattern buffer. It also tries to find the nearest match to the +pattern in the items list and moves current selection to that item. +The request REQ_CLEAR_PATTERN clears the pattern buffer. The +request REQ_BACK_PATTERN deletes the previous character in the +pattern buffer. In case the pattern matches more than one item then +the matched items can be cycled through REQ_NEXT_MATCH and +REQ_PREV_MATCH which move the current selection to the next and +previous matches respectively.

      +
    • +
    • +

      Mouse Requests

      +

      In case of KEY_MOUSE requests, according to the mouse position +an action is taken accordingly. The action to be taken is explained +in the man page as,

      + + + + +
      +
      +       If  the  second argument is the KEY_MOUSE special key, the
      +       associated mouse event is translated into one of the above
      +       pre-defined  requests.   Currently only clicks in the user
      +       window (e.g. inside the menu display area or  the  decora­
      +       tion  window)  are handled. If you click above the display
      +       region of the menu, a REQ_SCR_ULINE is generated,  if  you
      +       doubleclick  a  REQ_SCR_UPAGE  is  generated  and  if  you
      +       tripleclick a REQ_FIRST_ITEM is generated.  If  you  click
      +       below  the  display region of the menu, a REQ_SCR_DLINE is
      +       generated, if you doubleclick a REQ_SCR_DPAGE is generated
      +       and  if  you  tripleclick a REQ_LAST_ITEM is generated. If
      +       you click at an item inside the display area of the  menu,
      +       the menu cursor is positioned to that item.
      +
      +
    • +
    +

    Each of the above requests will be explained in the following +lines with several examples whenever appropriate.

    +
    +
    +
    +

    17.4. Menu +Windows

    +

    Every menu created is associated with a window and a sub window. +The menu window displays any title or border associated with the +menu. The menu sub window displays the menu items currently +available for selection. But we didn't specify any window or sub +window in the simple example. When a window is not specified, +stdscr is taken as the main window, and then menu system calculates +the sub window size required for the display of items. Then items +are displayed in the calculated sub window. So let's play with +these windows and display a menu with a border and a title.

    +
    +

    Example 19. Menu Windows Usage example

    + + + + +
    +
    +#include <menu.h>
    +
    +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
    +#define CTRLD   4
    +
    +char *choices[] = {
    +                        "Choice 1",
    +                        "Choice 2",
    +                        "Choice 3",
    +                        "Choice 4",
    +                        "Exit",
    +                        (char *)NULL,
    +                  };
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
    +
    +int main()
    +{       ITEM **my_items;
    +        int c;                          
    +        MENU *my_menu;
    +        WINDOW *my_menu_win;
    +        int n_choices, i;
    +        
    +        /* Initialize curses */
    +        initscr();
    +        start_color();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +        init_pair(1, COLOR_RED, COLOR_BLACK);
    +
    +        /* Create items */
    +        n_choices = ARRAY_SIZE(choices);
    +        my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *));
    +        for(i = 0; i < n_choices; ++i)
    +                my_items[i] = new_item(choices[i], choices[i]);
    +
    +        /* Crate menu */
    +        my_menu = new_menu((ITEM **)my_items);
    +
    +        /* Create the window to be associated with the menu */
    +        my_menu_win = newwin(10, 40, 4, 4);
    +        keypad(my_menu_win, TRUE);
    +     
    +        /* Set main window and sub window */
    +        set_menu_win(my_menu, my_menu_win);
    +        set_menu_sub(my_menu, derwin(my_menu_win, 6, 38, 3, 1));
    +
    +        /* Set menu mark to the string " * " */
    +        set_menu_mark(my_menu, " * ");
    +
    +        /* Print a border around the main window and print a title */
    +        box(my_menu_win, 0, 0);
    +        print_in_middle(my_menu_win, 1, 0, 40, "My Menu", COLOR_PAIR(1));
    +        mvwaddch(my_menu_win, 2, 0, ACS_LTEE);
    +        mvwhline(my_menu_win, 2, 1, ACS_HLINE, 38);
    +        mvwaddch(my_menu_win, 2, 39, ACS_RTEE);
    +        mvprintw(LINES - 2, 0, "F1 to exit");
    +        refresh();
    +        
    +        /* Post the menu */
    +        post_menu(my_menu);
    +        wrefresh(my_menu_win);
    +
    +        while((c = wgetch(my_menu_win)) != KEY_F(1))
    +        {       switch(c)
    +                {       case KEY_DOWN:
    +                                menu_driver(my_menu, REQ_DOWN_ITEM);
    +                                break;
    +                        case KEY_UP:
    +                                menu_driver(my_menu, REQ_UP_ITEM);
    +                                break;
    +                }
    +                wrefresh(my_menu_win);
    +        }       
    +
    +        /* Unpost and free all the memory taken up */
    +        unpost_menu(my_menu);
    +        free_menu(my_menu);
    +        for(i = 0; i < n_choices; ++i)
    +                free_item(my_items[i]);
    +        endwin();
    +}
    +
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
    +{       int length, x, y;
    +        float temp;
    +
    +        if(win == NULL)
    +                win = stdscr;
    +        getyx(win, y, x);
    +        if(startx != 0)
    +                x = startx;
    +        if(starty != 0)
    +                y = starty;
    +        if(width == 0)
    +                width = 80;
    +
    +        length = strlen(string);
    +        temp = (width - length)/ 2;
    +        x = startx + (int)temp;
    +        wattron(win, color);
    +        mvwprintw(win, y, x, "%s", string);
    +        wattroff(win, color);
    +        refresh();
    +}
    +
    +
    +

    This example creates a menu with a title, border, a fancy line +separating title and the items. As you can see, in order to attach +a window to a menu the function set_menu_win() has to be used. Then +we attach the sub window also. This displays the items in the sub +window. You can also set the mark string which gets displayed to +the left of the selected item with set_menu_mark().

    +
    +
    +
    +

    17.5. +Scrolling Menus

    +

    If the sub window given for a window is not big enough to show +all the items, then the menu will be scrollable. When you are on +the last item in the present list, if you send REQ_DOWN_ITEM, it +gets translated into REQ_SCR_DLINE and the menu scrolls by one +item. You can manually give REQ_SCR_ operations to do scrolling. +Let's see how it can be done.

    +
    +

    Example 20. Scrolling Menus example

    + + + + +
    +
    +#include <curses.h>
    +#include <menu.h>
    +
    +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
    +#define CTRLD   4
    +
    +char *choices[] = {
    +                        "Choice 1",
    +                        "Choice 2",
    +                        "Choice 3",
    +                        "Choice 4",
    +                        "Choice 5",
    +                        "Choice 6",
    +                        "Choice 7",
    +                        "Choice 8",
    +                        "Choice 9",
    +                        "Choice 10",
    +                        "Exit",
    +                        (char *)NULL,
    +                  };
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
    +
    +int main()
    +{       ITEM **my_items;
    +        int c;                          
    +        MENU *my_menu;
    +        WINDOW *my_menu_win;
    +        int n_choices, i;
    +        
    +        /* Initialize curses */
    +        initscr();
    +        start_color();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +        init_pair(1, COLOR_RED, COLOR_BLACK);
    +        init_pair(2, COLOR_CYAN, COLOR_BLACK);
    +
    +        /* Create items */
    +        n_choices = ARRAY_SIZE(choices);
    +        my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *));
    +        for(i = 0; i < n_choices; ++i)
    +                my_items[i] = new_item(choices[i], choices[i]);
    +
    +        /* Crate menu */
    +        my_menu = new_menu((ITEM **)my_items);
    +
    +        /* Create the window to be associated with the menu */
    +        my_menu_win = newwin(10, 40, 4, 4);
    +        keypad(my_menu_win, TRUE);
    +     
    +        /* Set main window and sub window */
    +        set_menu_win(my_menu, my_menu_win);
    +        set_menu_sub(my_menu, derwin(my_menu_win, 6, 38, 3, 1));
    +        set_menu_format(my_menu, 5, 1);
    +                        
    +        /* Set menu mark to the string " * " */
    +        set_menu_mark(my_menu, " * ");
    +
    +        /* Print a border around the main window and print a title */
    +        box(my_menu_win, 0, 0);
    +        print_in_middle(my_menu_win, 1, 0, 40, "My Menu", COLOR_PAIR(1));
    +        mvwaddch(my_menu_win, 2, 0, ACS_LTEE);
    +        mvwhline(my_menu_win, 2, 1, ACS_HLINE, 38);
    +        mvwaddch(my_menu_win, 2, 39, ACS_RTEE);
    +        
    +        /* Post the menu */
    +        post_menu(my_menu);
    +        wrefresh(my_menu_win);
    +        
    +        attron(COLOR_PAIR(2));
    +        mvprintw(LINES - 2, 0, "Use PageUp and PageDown to scoll down or up a page of items");
    +        mvprintw(LINES - 1, 0, "Arrow Keys to navigate (F1 to Exit)");
    +        attroff(COLOR_PAIR(2));
    +        refresh();
    +
    +        while((c = wgetch(my_menu_win)) != KEY_F(1))
    +        {       switch(c)
    +                {       case KEY_DOWN:
    +                                menu_driver(my_menu, REQ_DOWN_ITEM);
    +                                break;
    +                        case KEY_UP:
    +                                menu_driver(my_menu, REQ_UP_ITEM);
    +                                break;
    +                        case KEY_NPAGE:
    +                                menu_driver(my_menu, REQ_SCR_DPAGE);
    +                                break;
    +                        case KEY_PPAGE:
    +                                menu_driver(my_menu, REQ_SCR_UPAGE);
    +                                break;
    +                }
    +                wrefresh(my_menu_win);
    +        }       
    +
    +        /* Unpost and free all the memory taken up */
    +        unpost_menu(my_menu);
    +        free_menu(my_menu);
    +        for(i = 0; i < n_choices; ++i)
    +                free_item(my_items[i]);
    +        endwin();
    +}
    +
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
    +{       int length, x, y;
    +        float temp;
    +
    +        if(win == NULL)
    +                win = stdscr;
    +        getyx(win, y, x);
    +        if(startx != 0)
    +                x = startx;
    +        if(starty != 0)
    +                y = starty;
    +        if(width == 0)
    +                width = 80;
    +
    +        length = strlen(string);
    +        temp = (width - length)/ 2;
    +        x = startx + (int)temp;
    +        wattron(win, color);
    +        mvwprintw(win, y, x, "%s", string);
    +        wattroff(win, color);
    +        refresh();
    +}
    +
    +
    +

    This program is self-explanatory. In this example the number of +choices has been increased to ten, which is larger than our sub +window size which can hold 6 items. This message has to be +explicitly conveyed to the menu system with the function +set_menu_format(). In here we specify the number of rows and +columns we want to be displayed for a single page. We can specify +any number of items to be shown, in the rows variables, if it is +less than the height of the sub window. If the key pressed by the +user is a PAGE UP or PAGE DOWN, the menu is scrolled a page due to +the requests (REQ_SCR_DPAGE and REQ_SCR_UPAGE) given to +menu_driver().

    +
    +
    +
    +

    17.6. +Multi Columnar Menus

    +

    In the above example you have seen how to use the function +set_menu_format(). I didn't mention what the cols variable (third +parameter) does. Well, If your sub window is wide enough, you can +opt to display more than one item per row. This can be specified in +the cols variable. To make things simpler, the following example +doesn't show descriptions for the items.

    +
    +

    Example 21. Milt Columnar Menus Example

    + + + + +
    +
    +#include <curses.h>
    +#include <menu.h>
    +
    +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
    +#define CTRLD   4
    +
    +char *choices[] = {
    +                        "Choice 1", "Choice 2", "Choice 3", "Choice 4", "Choice 5",
    +                        "Choice 6", "Choice 7", "Choice 8", "Choice 9", "Choice 10",
    +                        "Choice 11", "Choice 12", "Choice 13", "Choice 14", "Choice 15",
    +                        "Choice 16", "Choice 17", "Choice 18", "Choice 19", "Choice 20",
    +                        "Exit",
    +                        (char *)NULL,
    +                  };
    +
    +int main()
    +{       ITEM **my_items;
    +        int c;                          
    +        MENU *my_menu;
    +        WINDOW *my_menu_win;
    +        int n_choices, i;
    +        
    +        /* Initialize curses */
    +        initscr();
    +        start_color();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +        init_pair(1, COLOR_RED, COLOR_BLACK);
    +        init_pair(2, COLOR_CYAN, COLOR_BLACK);
    +
    +        /* Create items */
    +        n_choices = ARRAY_SIZE(choices);
    +        my_items = (ITEM **)calloc(n_choices, sizeof(ITEM *));
    +        for(i = 0; i < n_choices; ++i)
    +                my_items[i] = new_item(choices[i], choices[i]);
    +
    +        /* Crate menu */
    +        my_menu = new_menu((ITEM **)my_items);
    +
    +        /* Set menu option not to show the description */
    +        menu_opts_off(my_menu, O_SHOWDESC);
    +
    +        /* Create the window to be associated with the menu */
    +        my_menu_win = newwin(10, 70, 4, 4);
    +        keypad(my_menu_win, TRUE);
    +     
    +        /* Set main window and sub window */
    +        set_menu_win(my_menu, my_menu_win);
    +        set_menu_sub(my_menu, derwin(my_menu_win, 6, 68, 3, 1));
    +        set_menu_format(my_menu, 5, 3);
    +        set_menu_mark(my_menu, " * ");
    +
    +        /* Print a border around the main window and print a title */
    +        box(my_menu_win, 0, 0);
    +        
    +        attron(COLOR_PAIR(2));
    +        mvprintw(LINES - 3, 0, "Use PageUp and PageDown to scroll");
    +        mvprintw(LINES - 2, 0, "Use Arrow Keys to navigate (F1 to Exit)");
    +        attroff(COLOR_PAIR(2));
    +        refresh();
    +
    +        /* Post the menu */
    +        post_menu(my_menu);
    +        wrefresh(my_menu_win);
    +        
    +        while((c = wgetch(my_menu_win)) != KEY_F(1))
    +        {       switch(c)
    +                {       case KEY_DOWN:
    +                                menu_driver(my_menu, REQ_DOWN_ITEM);
    +                                break;
    +                        case KEY_UP:
    +                                menu_driver(my_menu, REQ_UP_ITEM);
    +                                break;
    +                        case KEY_LEFT:
    +                                menu_driver(my_menu, REQ_LEFT_ITEM);
    +                                break;
    +                        case KEY_RIGHT:
    +                                menu_driver(my_menu, REQ_RIGHT_ITEM);
    +                                break;
    +                        case KEY_NPAGE:
    +                                menu_driver(my_menu, REQ_SCR_DPAGE);
    +                                break;
    +                        case KEY_PPAGE:
    +                                menu_driver(my_menu, REQ_SCR_UPAGE);
    +                                break;
    +                }
    +                wrefresh(my_menu_win);
    +        }       
    +
    +        /* Unpost and free all the memory taken up */
    +        unpost_menu(my_menu);
    +        free_menu(my_menu);
    +        for(i = 0; i < n_choices; ++i)
    +                free_item(my_items[i]);
    +        endwin();
    +}
    +
    +
    +

    Watch the function call to set_menu_format(). It specifies the +number of columns to be 3, thus displaying 3 items per row. We have +also switched off the showing descriptions with the function +menu_opts_off(). There are couple of functions set_menu_opts(), +menu_opts_on() and menu_opts() which can be used to manipulate menu +options. The following menu options can be specified.

    + + + + +
    +
    +       O_ONEVALUE
    +            Only one item can be selected for this menu.
    +
    +       O_SHOWDESC
    +            Display  the  item  descriptions  when  the  menu  is
    +            posted.
    +
    +       O_ROWMAJOR
    +            Display the menu in row-major order.
    +
    +       O_IGNORECASE
    +            Ignore the case when pattern-matching.
    +
    +       O_SHOWMATCH
    +            Move the cursor to within the item  name  while  pat­
    +            tern-matching.
    +
    +       O_NONCYCLIC
    +            Don't   wrap   around  next-item  and  previous-item,
    +            requests to the other end of the menu.
    +
    +

    All options are on by default. You can switch specific +attributes on or off with menu_opts_on() and menu_opts_off() +functions. You can also use set_menu_opts() to directly specify the +options. The argument to this function should be a OR ed value of +some of those above constants. The function menu_opts() can be used +to find out a menu's present options.

    +
    +
    +
    +

    17.7. Multi Valued Menus

    +

    You might be wondering what if you switch off the option +O_ONEVALUE. Then the menu becomes multi-valued. That means you can +select more than one item. This brings us to the request +REQ_TOGGLE_ITEM. Let's see it in action.

    +
    +

    Example 22. Multi Valued Menus example

    + + + + +
    +
    +#include <curses.h>
    +#include <menu.h>
    +
    +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
    +#define CTRLD   4
    +
    +char *choices[] = {
    +                        "Choice 1",
    +                        "Choice 2",
    +                        "Choice 3",
    +                        "Choice 4",
    +                        "Choice 5",
    +                        "Choice 6",
    +                        "Choice 7",
    +                        "Exit",
    +                  };
    +
    +int main()
    +{       ITEM **my_items;
    +        int c;                          
    +        MENU *my_menu;
    +        int n_choices, i;
    +        ITEM *cur_item;
    +        
    +        /* Initialize curses */ 
    +        initscr();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +
    +        /* Initialize items */
    +        n_choices = ARRAY_SIZE(choices);
    +        my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *));
    +        for(i = 0; i < n_choices; ++i)
    +                my_items[i] = new_item(choices[i], choices[i]);
    +        my_items[n_choices] = (ITEM *)NULL;
    +
    +        my_menu = new_menu((ITEM **)my_items);
    +
    +        /* Make the menu multi valued */
    +        menu_opts_off(my_menu, O_ONEVALUE);
    +
    +        mvprintw(LINES - 3, 0, "Use <SPACE> to select or unselect an item.");
    +        mvprintw(LINES - 2, 0, "<ENTER> to see presently selected items(F1 to Exit)");
    +        post_menu(my_menu);
    +        refresh();
    +
    +        while((c = getch()) != KEY_F(1))
    +        {       switch(c)
    +                {       case KEY_DOWN:
    +                                menu_driver(my_menu, REQ_DOWN_ITEM);
    +                                break;
    +                        case KEY_UP:
    +                                menu_driver(my_menu, REQ_UP_ITEM);
    +                                break;
    +                        case ' ':
    +                                menu_driver(my_menu, REQ_TOGGLE_ITEM);
    +                                break;
    +                        case 10:        /* Enter */
    +                        {       char temp[200];
    +                                ITEM **items;
    +
    +                                items = menu_items(my_menu);
    +                                temp[0] = '\0';
    +                                for(i = 0; i < item_count(my_menu); ++i)
    +                                        if(item_value(items[i]) == TRUE)
    +                                        {       strcat(temp, item_name(items[i]));
    +                                                strcat(temp, " ");
    +                                        }
    +                                move(20, 0);
    +                                clrtoeol();
    +                                mvprintw(20, 0, temp);
    +                                refresh();
    +                        }
    +                        break;
    +                }
    +        }       
    +
    +        free_item(my_items[0]);
    +        free_item(my_items[1]);
    +        free_menu(my_menu);
    +        endwin();
    +}
    +        
    +
    +
    +

    Whew, A lot of new functions. Let's take them one after another. +Firstly, the REQ_TOGGLE_ITEM. In a multi-valued menu, the user +should be allowed to select or un select more than one item. The +request REQ_TOGGLE_ITEM toggles the present selection. In this case +when space is pressed REQ_TOGGLE_ITEM request is sent to +menu_driver to achieve the result.

    +

    Now when the user presses <ENTER> we show the items he +presently selected. First we find out the items associated with the +menu using the function menu_items(). Then we loop through the +items to find out if the item is selected or not. The function +item_value() returns TRUE if an item is selected. The function +item_count() returns the number of items in the menu. The item name +can be found with item_name(). You can also find the description +associated with an item using item_description().

    +
    +
    +
    +

    17.8. Menu +Options

    +

    Well, by this time you must be itching for some difference in +your menu, with lots of functionality. I know. You want Colors !!!. +You want to create nice menus similar to those text mode dos +games. The functions set_menu_fore() and set_menu_back() can be +used to change the attribute of the selected item and unselected +item. The names are misleading. They don't change menu's foreground +or background which would have been useless.

    +

    The function set_menu_grey() can be used to set the display +attribute for the non-selectable items in the menu. This brings us +to the interesting option for an item the one and only +O_SELECTABLE. We can turn it off by the function item_opts_off() +and after that that item is not selectable. It's like a grayed item +in those fancy windows menus. Let's put these concepts in practice +with this example

    +
    +

    Example 23. Menu Options example

    + + + + +
    +
    +#include <menu.h>
    +
    +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
    +#define CTRLD   4
    +
    +char *choices[] = {
    +                        "Choice 1",
    +                        "Choice 2",
    +                        "Choice 3",
    +                        "Choice 4",
    +                        "Choice 5",
    +                        "Choice 6",
    +                        "Choice 7",
    +                        "Exit",
    +                  };
    +
    +int main()
    +{       ITEM **my_items;
    +        int c;                          
    +        MENU *my_menu;
    +        int n_choices, i;
    +        ITEM *cur_item;
    +        
    +        /* Initialize curses */ 
    +        initscr();
    +        start_color();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +        init_pair(1, COLOR_RED, COLOR_BLACK);
    +        init_pair(2, COLOR_GREEN, COLOR_BLACK);
    +        init_pair(3, COLOR_MAGENTA, COLOR_BLACK);
    +
    +        /* Initialize items */
    +        n_choices = ARRAY_SIZE(choices);
    +        my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *));
    +        for(i = 0; i < n_choices; ++i)
    +                my_items[i] = new_item(choices[i], choices[i]);
    +        my_items[n_choices] = (ITEM *)NULL;
    +        item_opts_off(my_items[3], O_SELECTABLE);
    +        item_opts_off(my_items[6], O_SELECTABLE);
    +
    +        /* Create menu */
    +        my_menu = new_menu((ITEM **)my_items);
    +
    +        /* Set fore ground and back ground of the menu */
    +        set_menu_fore(my_menu, COLOR_PAIR(1) | A_REVERSE);
    +        set_menu_back(my_menu, COLOR_PAIR(2));
    +        set_menu_grey(my_menu, COLOR_PAIR(3));
    +
    +        /* Post the menu */
    +        mvprintw(LINES - 3, 0, "Press <ENTER> to see the option selected");
    +        mvprintw(LINES - 2, 0, "Up and Down arrow keys to naviage (F1 to Exit)");
    +        post_menu(my_menu);
    +        refresh();
    +
    +        while((c = getch()) != KEY_F(1))
    +        {       switch(c)
    +                {       case KEY_DOWN:
    +                                menu_driver(my_menu, REQ_DOWN_ITEM);
    +                                break;
    +                        case KEY_UP:
    +                                menu_driver(my_menu, REQ_UP_ITEM);
    +                                break;
    +                        case 10: /* Enter */
    +                                move(20, 0);
    +                                clrtoeol();
    +                                mvprintw(20, 0, "Item selected is : %s", 
    +                                                item_name(current_item(my_menu)));
    +                                pos_menu_cursor(my_menu);
    +                                break;
    +                }
    +        }       
    +        unpost_menu(my_menu);
    +        for(i = 0; i < n_choices; ++i)
    +                free_item(my_items[i]);
    +        free_menu(my_menu);
    +        endwin();
    +}
    +        
    +
    +
    +
    +
    +
    +

    17.9. The +useful User Pointer

    +

    We can associate a user pointer with each item in the menu. It +works the same way as user pointer in panels. It's not touched by +menu system. You can store any thing you like in that. I usually +use it to store the function to be executed when the menu option is +chosen (It's selected and may be the user pressed +<ENTER>);

    +
    +

    Example 24. Menu User Pointer Usage

    + + + + +
    +
    +#include <curses.h>
    +#include <menu.h>
    +
    +#define ARRAY_SIZE(a) (sizeof(a) / sizeof(a[0]))
    +#define CTRLD   4
    +
    +char *choices[] = {
    +                        "Choice 1",
    +                        "Choice 2",
    +                        "Choice 3",
    +                        "Choice 4",
    +                        "Choice 5",
    +                        "Choice 6",
    +                        "Choice 7",
    +                        "Exit",
    +                  };
    +void func(char *name);
    +
    +int main()
    +{       ITEM **my_items;
    +        int c;                          
    +        MENU *my_menu;
    +        int n_choices, i;
    +        ITEM *cur_item;
    +        
    +        /* Initialize curses */ 
    +        initscr();
    +        start_color();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +        init_pair(1, COLOR_RED, COLOR_BLACK);
    +        init_pair(2, COLOR_GREEN, COLOR_BLACK);
    +        init_pair(3, COLOR_MAGENTA, COLOR_BLACK);
    +
    +        /* Initialize items */
    +        n_choices = ARRAY_SIZE(choices);
    +        my_items = (ITEM **)calloc(n_choices + 1, sizeof(ITEM *));
    +        for(i = 0; i < n_choices; ++i)
    +        {       my_items[i] = new_item(choices[i], choices[i]);
    +                /* Set the user pointer */
    +                set_item_userptr(my_items[i], func);
    +        }
    +        my_items[n_choices] = (ITEM *)NULL;
    +
    +        /* Create menu */
    +        my_menu = new_menu((ITEM **)my_items);
    +
    +        /* Post the menu */
    +        mvprintw(LINES - 3, 0, "Press <ENTER> to see the option selected");
    +        mvprintw(LINES - 2, 0, "Up and Down arrow keys to naviage (F1 to Exit)");
    +        post_menu(my_menu);
    +        refresh();
    +
    +        while((c = getch()) != KEY_F(1))
    +        {       switch(c)
    +                {       case KEY_DOWN:
    +                                menu_driver(my_menu, REQ_DOWN_ITEM);
    +                                break;
    +                        case KEY_UP:
    +                                menu_driver(my_menu, REQ_UP_ITEM);
    +                                break;
    +                        case 10: /* Enter */
    +                        {       ITEM *cur;
    +                                void (*p)(char *);
    +
    +                                cur = current_item(my_menu);
    +                                p = item_userptr(cur);
    +                                p((char *)item_name(cur));
    +                                pos_menu_cursor(my_menu);
    +                                break;
    +                        }
    +                        break;
    +                }
    +        }       
    +        unpost_menu(my_menu);
    +        for(i = 0; i < n_choices; ++i)
    +                free_item(my_items[i]);
    +        free_menu(my_menu);
    +        endwin();
    +}
    +
    +void func(char *name)
    +{       move(20, 0);
    +        clrtoeol();
    +        mvprintw(20, 0, "Item selected is : %s", name);
    +}       
    +
    +
    +
    +
    +
    +
    +

    18. Forms +Library

    +

    Well. If you have seen those forms on web pages which take input +from users and do various kinds of things, you might be wondering +how would any one create such forms in text mode display. It's +quite difficult to write those nifty forms in plain ncurses. Forms +library tries to provide a basic frame work to build and maintain +forms with ease. It has lot of features(functions) which manage +validation, dynamic expansion of fields etc.. Let's see it in full +flow.

    +

    A form is a collection of fields; each field can be either a +label(static text) or a data-entry location. The forms also library +provides functions to divide forms into multiple pages.

    +
    +
    +

    18.1. The +Basics

    +

    Forms are created in much the same way as menus. First the +fields related to the form are created with new_field(). You can +set options for the fields, so that they can be displayed with some +fancy attributes, validated before the field looses focus etc.. +Then the fields are attached to form. After this, the form can be +posted to display and is ready to receive inputs. On the similar +lines to menu_driver(), the form is manipulated with form_driver(). +We can send requests to form_driver to move focus to a certain +field, move cursor to end of the field etc.. After the user enters +values in the fields and validation done, form can be unposted and +memory allocated can be freed.

    +

    The general flow of control of a forms program looks like +this.

    +
      +
    1. +

      Initialize curses

      +
    2. +
    3. +

      Create fields using new_field(). You can specify the height and +width of the field, and its position on the form.

      +
    4. +
    5. +

      Create the forms with new_form() by specifying the fields to be +attached with.

      +
    6. +
    7. +

      Post the form with form_post() and refresh the screen.

      +
    8. +
    9. +

      Process the user requests with a loop and do necessary updates +to form with form_driver.

      +
    10. +
    11. +

      Unpost the menu with form_unpost()

      +
    12. +
    13. +

      Free the memory allocated to menu by free_form()

      +
    14. +
    15. +

      Free the memory allocated to the items with free_field()

      +
    16. +
    17. +

      End curses

      +
    18. +
    +

    As you can see, working with forms library is much similar to +handling menu library. The following examples will explore various +aspects of form processing. Let's start the journey with a simple +example. first.

    +
    +
    +
    +

    18.2. +Compiling With the Forms Library

    +

    To use forms library functions, you have to include form.h and +to link the program with forms library the flag -lform should be +added along with -lncurses in that order.

    + + + + +
    +
    +    #include <form.h>
    +    .
    +    .
    +    .
    +
    +    compile and link: gcc <program file> -lform -lncurses
    +
    +
    +

    Example 25. Forms Basics

    + + + + +
    +
    +#include <form.h>
    +
    +int main()
    +{       FIELD *field[3];
    +        FORM  *my_form;
    +        int ch;
    +        
    +        /* Initialize curses */
    +        initscr();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +
    +        /* Initialize the fields */
    +        field[0] = new_field(1, 10, 4, 18, 0, 0);
    +        field[1] = new_field(1, 10, 6, 18, 0, 0);
    +        field[2] = NULL;
    +
    +        /* Set field options */
    +        set_field_back(field[0], A_UNDERLINE);  /* Print a line for the option  */
    +        field_opts_off(field[0], O_AUTOSKIP);   /* Don't go to next field when this */
    +                                                /* Field is filled up           */
    +        set_field_back(field[1], A_UNDERLINE); 
    +        field_opts_off(field[1], O_AUTOSKIP);
    +
    +        /* Create the form and post it */
    +        my_form = new_form(field);
    +        post_form(my_form);
    +        refresh();
    +        
    +        mvprintw(4, 10, "Value 1:");
    +        mvprintw(6, 10, "Value 2:");
    +        refresh();
    +
    +        /* Loop through to get user requests */
    +        while((ch = getch()) != KEY_F(1))
    +        {       switch(ch)
    +                {       case KEY_DOWN:
    +                                /* Go to next field */
    +                                form_driver(my_form, REQ_NEXT_FIELD);
    +                                /* Go to the end of the present buffer */
    +                                /* Leaves nicely at the last character */
    +                                form_driver(my_form, REQ_END_LINE);
    +                                break;
    +                        case KEY_UP:
    +                                /* Go to previous field */
    +                                form_driver(my_form, REQ_PREV_FIELD);
    +                                form_driver(my_form, REQ_END_LINE);
    +                                break;
    +                        default:
    +                                /* If this is a normal character, it gets */
    +                                /* Printed                                */    
    +                                form_driver(my_form, ch);
    +                                break;
    +                }
    +        }
    +
    +        /* Un post form and free the memory */
    +        unpost_form(my_form);
    +        free_form(my_form);
    +        free_field(field[0]);
    +        free_field(field[1]); 
    +
    +        endwin();
    +        return 0;
    +}
    +
    +
    +

    Above example is pretty straight forward. It creates two fields +with new_field(). new_field() takes +height, width, starty, startx, number of offscreen rows and number +of additional working buffers. The fifth argument number of +offscreen rows specifies how much of the field to be shown. If it +is zero, the entire field is always displayed otherwise the form +will be scrollable when the user accesses not displayed parts of +the field. The forms library allocates one buffer per field to +store the data user enters. Using the last parameter to new_field() +we can specify it to allocate some additional buffers. These can be +used for any purpose you like.

    +

    After creating the fields, back ground attribute of both of them +is set to an underscore with set_field_back(). The AUTOSKIP option +is turned off using field_opts_off(). If this option is turned on, +focus will move to the next field in the form once the active field +is filled up completely.

    +

    After attaching the fields to the form, it is posted. Here on, +user inputs are processed in the while loop, by making +corresponding requests to form_driver. The details of all the +requests to the form_driver() are explained later.

    +
    +
    +
    +

    18.3. +Playing with Fields

    +

    Each form field is associated with a lot of attributes. They can +be manipulated to get the required effect and to have fun !!!. So +why wait?

    +
    +
    +

    18.3.1. +Fetching Size and Location of Field

    +

    The parameters we have given at the time of creation of a field +can be retrieved with field_info(). It returns height, width, +starty, startx, number of offscreen rows, and number of additional +buffers into the parameters given to it. It is a sort of inverse of +new_field().

    + + + + +
    +
    +int field_info(     FIELD *field,              /* field from which to fetch */
    +                    int *height, *int width,   /* field size */ 
    +                    int *top, int *left,       /* upper left corner */
    +                    int *offscreen,            /* number of offscreen rows */
    +                    int *nbuf);                /* number of working buffers */
    +
    +
    +
    +
    +

    18.3.2. Moving +the field

    +

    The location of the field can be moved to a different position +with move_field().

    + + + + +
    +
    +int move_field(    FIELD *field,              /* field to alter */
    +                   int top, int left);        /* new upper-left corner */
    +
    +

    As usual, the changed position can be queried with +field_infor().

    +
    +
    +
    +

    18.3.3. +Field Justification

    +

    The justification to be done for the field can be fixed using +the function set_field_just().

    + + + + +
    +
    +    int set_field_just(FIELD *field,          /* field to alter */
    +               int justmode);         /* mode to set */
    +    int field_just(FIELD *field);          /* fetch justify mode of field */
    +
    +

    The justification mode valued accepted and returned by these +functions are NO_JUSTIFICATION, JUSTIFY_RIGHT, JUSTIFY_LEFT, or +JUSTIFY_CENTER.

    +
    +
    +
    +

    18.3.4. Field Display Attributes

    +

    As you have seen, in the above example, display attribute for +the fields can be set with set_field_fore() and setfield_back(). +These functions set foreground and background attribute of the +fields. You can also specify a pad character which will be filled +in the unfilled portion of the field. The pad character is set with +a call to set_field_pad(). Default pad value is a space. The +functions field_fore(), field_back, field_pad() can be used to +query the present foreground, background attributes and pad +character for the field. The following list gives the usage of +functions.

    + + + + +
    +
    +
int set_field_fore(FIELD *field,        /* field to alter */
    +                   chtype attr);        /* attribute to set */ 
    +
    +chtype field_fore(FIELD *field);        /* field to query */
    +                                        /* returns foreground attribute */
    +
    +int set_field_back(FIELD *field,        /* field to alter */
    +                   chtype attr);        /* attribute to set */ 
    +
    +chtype field_back(FIELD *field);        /* field to query */
    +                                        /* returns background attribute */
    +
    +int set_field_pad(FIELD *field,         /* field to alter */
    +                  int pad);             /* pad character to set */ 
    +
    +chtype field_pad(FIELD *field);         /* field to query */  
    +                                        /* returns present pad character */
    +
    +

    Though above functions seem quite simple, using colors with +set_field_fore() may be frustrating in the beginning. Let me first +explain about foreground and background attributes of a field. The +foreground attribute is associated with the character. That means a +character in the field is printed with the attribute you have set +with set_field_fore(). Background attribute is the attribute used +to fill background of field, whether any character is there or not. +So what about colors? Since colors are always defined in pairs, +what is the right way to display colored fields? Here's an example +clarifying color attributes.

    +
    +

    Example 26. Form Attributes example

    + + + + +
    +
    +#include <form.h>
    +
    +int main()
    +{       FIELD *field[3];
    +        FORM  *my_form;
    +        int ch;
    +        
    +        /* Initialize curses */
    +        initscr();
    +        start_color();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +
    +        /* Initialize few color pairs */
    +        init_pair(1, COLOR_WHITE, COLOR_BLUE);
    +        init_pair(2, COLOR_WHITE, COLOR_BLUE);
    +
    +        /* Initialize the fields */
    +        field[0] = new_field(1, 10, 4, 18, 0, 0);
    +        field[1] = new_field(1, 10, 6, 18, 0, 0);
    +        field[2] = NULL;
    +
    +        /* Set field options */
    +        set_field_fore(field[0], COLOR_PAIR(1));/* Put the field with blue background */
    +        set_field_back(field[0], COLOR_PAIR(2));/* and white foreground (characters */
    +                                                /* are printed in white         */
    +        field_opts_off(field[0], O_AUTOSKIP);   /* Don't go to next field when this */
    +                                                /* Field is filled up           */
    +        set_field_back(field[1], A_UNDERLINE); 
    +        field_opts_off(field[1], O_AUTOSKIP);
    +
    +        /* Create the form and post it */
    +        my_form = new_form(field);
    +        post_form(my_form);
    +        refresh();
    +        
    +        set_current_field(my_form, field[0]); /* Set focus to the colored field */
    +        mvprintw(4, 10, "Value 1:");
    +        mvprintw(6, 10, "Value 2:");
    +        mvprintw(LINES - 2, 0, "Use UP, DOWN arrow keys to switch between fields");
    +        refresh();
    +
    +        /* Loop through to get user requests */
    +        while((ch = getch()) != KEY_F(1))
    +        {       switch(ch)
    +                {       case KEY_DOWN:
    +                                /* Go to next field */
    +                                form_driver(my_form, REQ_NEXT_FIELD);
    +                                /* Go to the end of the present buffer */
    +                                /* Leaves nicely at the last character */
    +                                form_driver(my_form, REQ_END_LINE);
    +                                break;
    +                        case KEY_UP:
    +                                /* Go to previous field */
    +                                form_driver(my_form, REQ_PREV_FIELD);
    +                                form_driver(my_form, REQ_END_LINE);
    +                                break;
    +                        default:
    +                                /* If this is a normal character, it gets */
    +                                /* Printed                                */    
    +                                form_driver(my_form, ch);
    +                                break;
    +                }
    +        }
    +
    +        /* Un post form and free the memory */
    +        unpost_form(my_form);
    +        free_form(my_form);
    +        free_field(field[0]);
    +        free_field(field[1]); 
    +
    +        endwin();
    +        return 0;
    +}
    +
    +
    +

    Play with the color pairs and try to understand the foreground +and background attributes. In my programs using color attributes, I +usually set only the background with set_field_back(). Curses +simply doesn't allow defining individual color attributes.

    +
    +
    +
    +

    18.3.5. Field Option Bits

    +

    There is also a large collection of field option bits you can +set to control various aspects of forms processing. You can +manipulate them with these functions:

    + + + + +
    +
    +int set_field_opts(FIELD *field,          /* field to alter */
    +                   int attr);             /* attribute to set */ 
    +
    +int field_opts_on(FIELD *field,           /* field to alter */
    +                  int attr);              /* attributes to turn on */ 
    +
    +int field_opts_off(FIELD *field,          /* field to alter */
    +                  int attr);              /* attributes to turn off */ 
    +
    +int field_opts(FIELD *field);             /* field to query */ 
    +
    +

    The function set_field_opts() can be used to directly set +attributes of a field or you can choose to switch a few attributes +on and off with field_opts_on() and field_opts_off() selectively. +Anytime you can query the attributes of a field with field_opts(). +The following is the list of available options. By default, all +options are on.

    +
    +
    +
    O_VISIBLE
    +
    +

    Controls whether the field is visible on the screen. Can be used +during form processing to hide or pop up fields depending on the +value of parent fields.

    +
    +
    O_ACTIVE
    +
    +

    Controls whether the field is active during forms processing +(i.e. visited by form navigation keys). Can be used to make labels +or derived fields with buffer values alterable by the forms +application, not the user.

    +
    +
    O_PUBLIC
    +
    +

    Controls whether data is displayed during field entry. If this +option is turned off on a field, the library will accept and edit +data in that field, but it will not be displayed and the visible +field cursor will not move. You can turn off the O_PUBLIC bit to +define password fields.

    +
    +
    O_EDIT
    +
    +

    Controls whether the field's data can be modified. When this +option is off, all editing requests except REQ_PREV_CHOICE and REQ_NEXT_CHOICEwill fail. Such read-only fields may +be useful for help messages.

    +
    +
    O_WRAP
    +
    +

    Controls word-wrapping in multi-line fields. Normally, when any +character of a (blank-separated) word reaches the end of the +current line, the entire word is wrapped to the next line (assuming +there is one). When this option is off, the word will be split +across the line break.

    +
    +
    O_BLANK
    +
    +

    Controls field blanking. When this option is on, entering a +character at the first field position erases the entire field +(except for the just-entered character).

    +
    +
    O_AUTOSKIP
    +
    +

    Controls automatic skip to next field when this one fills. +Normally, when the forms user tries to type more data into a field +than will fit, the editing location jumps to next field. When this +option is off, the user's cursor will hang at the end of the field. +This option is ignored in dynamic fields that have not reached +their size limit.

    +
    +
    O_NULLOK
    +
    +

    Controls whether validation is applied to blank fields. +Normally, it is not; the user can leave a field blank without +invoking the usual validation check on exit. If this option is off +on a field, exit from it will invoke a validation check.

    +
    +
    O_PASSOK
    +
    +

    Controls whether validation occurs on every exit, or only after +the field is modified. Normally the latter is true. Setting +O_PASSOK may be useful if your field's validation function may +change during forms processing.

    +
    +
    O_STATIC
    +
    +

    Controls whether the field is fixed to its initial dimensions. +If you turn this off, the field becomes dynamic and will stretch to +fit entered data.

    +
    +
    +
    +

    A field's options cannot be changed while the field is currently +selected. However, options may be changed on posted fields that are +not current.

    +

    The option values are bit-masks and can be composed with +logical-or in the obvious way. You have seen the usage of switching +off O_AUTOSKIP option. The following example clarifies usage of +some more options. Other options are explained where +appropriate.

    +
    +

    Example 27. Field Options Usage example

    + + + + +
    +
    +#include <form.h>
    +
    +#define STARTX 15
    +#define STARTY 4
    +#define WIDTH 25
    +
    +#define N_FIELDS 3
    +
    +int main()
    +{       FIELD *field[N_FIELDS];
    +        FORM  *my_form;
    +        int ch, i;
    +        
    +        /* Initialize curses */
    +        initscr();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +
    +        /* Initialize the fields */
    +        for(i = 0; i < N_FIELDS - 1; ++i)
    +                field[i] = new_field(1, WIDTH, STARTY + i * 2, STARTX, 0, 0);
    +        field[N_FIELDS - 1] = NULL;
    +
    +        /* Set field options */
    +        set_field_back(field[1], A_UNDERLINE);  /* Print a line for the option  */
    +        
    +        field_opts_off(field[0], O_ACTIVE); /* This field is a static label */
    +        field_opts_off(field[1], O_PUBLIC); /* This filed is like a password field*/
    +        field_opts_off(field[1], O_AUTOSKIP); /* To avoid entering the same field */
    +                                              /* after last character is entered */
    +        
    +        /* Create the form and post it */
    +        my_form = new_form(field);
    +        post_form(my_form);
    +        refresh();
    +        
    +        set_field_just(field[0], JUSTIFY_CENTER); /* Center Justification */
    +        set_field_buffer(field[0], 0, "This is a static Field"); 
    +                                                  /* Initialize the field  */
    +        mvprintw(STARTY, STARTX - 10, "Field 1:");
    +        mvprintw(STARTY + 2, STARTX - 10, "Field 2:");
    +        refresh();
    +
    +        /* Loop through to get user requests */
    +        while((ch = getch()) != KEY_F(1))
    +        {       switch(ch)
    +                {       case KEY_DOWN:
    +                                /* Go to next field */
    +                                form_driver(my_form, REQ_NEXT_FIELD);
    +                                /* Go to the end of the present buffer */
    +                                /* Leaves nicely at the last character */
    +                                form_driver(my_form, REQ_END_LINE);
    +                                break;
    +                        case KEY_UP:
    +                                /* Go to previous field */
    +                                form_driver(my_form, REQ_PREV_FIELD);
    +                                form_driver(my_form, REQ_END_LINE);
    +                                break;
    +                        default:
    +                                /* If this is a normal character, it gets */
    +                                /* Printed                                */    
    +                                form_driver(my_form, ch);
    +                                break;
    +                }
    +        }
    +
    +        /* Un post form and free the memory */
    +        unpost_form(my_form);
    +        free_form(my_form);
    +        free_field(field[0]);
    +        free_field(field[1]); 
    +
    +        endwin();
    +        return 0;
    +}
    +
    +
    +

    This example, though useless, shows the usage of options. If +used properly, they can present information very effectively in a +form. The second field being not O_PUBLIC, does not show the +characters you are typing.

    +
    +
    +
    +

    18.3.6. +Field Status

    +

    The field status specifies whether the field has got edited or +not. It is initially set to FALSE and when user enters something +and the data buffer gets modified it becomes TRUE. So a field's +status can be queried to find out whether it has been modified or +not. The following functions can assist in those operations.

    + + + + +
    +
    +int set_field_status(FIELD *field,      /* field to alter */
    +                   int status);         /* status to set */
    +
    +int field_status(FIELD *field);         /* fetch status of field */
    +
    +

    It's better to check the field's status only after after leaving +the field, as data buffer might not have been updated yet as the +validation is still due. To guarantee that right status is +returned, call field_status() either (1) in the field's exit +validation check routine, (2) from the field's or form's +initialization or termination hooks, or (3) just after a +REQ_VALIDATION request has been processed by the forms driver

    +
    +
    +
    +

    18.3.7. +Field User Pointer

    +

    Every field structure contains one pointer that can be used by +the user for various purposes. It is not touched by forms library +and can be used for any purpose by the user. The following +functions set and fetch user pointer.

    + + + + +
    +
    +int set_field_userptr(FIELD *field,   
    +           char *userptr);      /* the user pointer you wish to associate */
    +                                /* with the field    */
    +
    +char *field_userptr(FIELD *field);      /* fetch user pointer of the field */
    +
    +
    +
    +
    +

    18.3.8. Variable-Sized Fields

    +

    If you want a dynamically changing field with variable width, +this is the feature you want to put to full use. This will allow +the user to enter more data than the original size of the field and +let the field grow. According to the field orientation it will +scroll horizontally or vertically to incorporate the new data.

    +

    To make a field dynamically growable, the option O_STATIC should +be turned off. This can be done with a

    + + + + +
    +
    +    field_opts_off(field_pointer, O_STATIC);
    +
    +

    But it's usually not advisable to allow a field to grow +infinitely. You can set a maximum limit to the growth of the field +with

    + + + + +
    +
    +int set_max_field(FIELD *field,    /* Field on which to operate */
    +                  int max_growth); /* maximum growth allowed for the field */
    +
    +

    The field info for a dynamically growable field can be retrieved +by

    + + + + +
    +
    +int dynamic_field_info( FIELD *field,     /* Field on which to operate */
    +            int   *prows,     /* number of rows will be filled in this */
    +            int   *pcols,     /* number of columns will be filled in this*/
    +            int   *pmax)      /* maximum allowable growth will be filled */
    +                              /* in this */
    +
    +Though field_info work as usual, it is advisable to use this +function to get the proper attributes of a dynamically growable +field. +

    Recall the library routine new_field; a new field created with +height set to one will be defined to be a one line field. A new +field created with height greater than one will be defined to be a +multi line field.

    +

    A one line field with O_STATIC turned off (dynamically growable +field) will contain a single fixed row, but the number of columns +can increase if the user enters more data than the initial field +will hold. The number of columns displayed will remain fixed and +the additional data will scroll horizontally.

    +

    A multi line field with O_STATIC turned off (dynamically +growable field) will contain a fixed number of columns, but the +number of rows can increase if the user enters more data than the +initial field will hold. The number of rows displayed will remain +fixed and the additional data will scroll vertically.

    +

    The above two paragraphs pretty much describe a dynamically +growable field's behavior. The way other parts of forms library +behaves is described below:

    +
      +
    1. +

      The field option O_AUTOSKIP will be ignored if the option +O_STATIC is off and there is no maximum growth specified for the +field. Currently, O_AUTOSKIP generates an automatic REQ_NEXT_FIELD +form driver request when the user types in the last character +position of a field. On a growable field with no maximum growth +specified, there is no last character position. If a maximum growth +is specified, the O_AUTOSKIP option will work as normal if the +field has grown to its maximum size.

      +
    2. +
    3. +

      The field justification will be ignored if the option O_STATIC +is off. Currently, set_field_just can be used to JUSTIFY_LEFT, +JUSTIFY_RIGHT, JUSTIFY_CENTER the contents of a one line field. A +growable one line field will, by definition, grow and scroll +horizontally and may contain more data than can be justified. The +return from field_just will be unchanged.

      +
    4. +
    5. +

      The overloaded form driver request REQ_NEW_LINE will operate the +same way regardless of the O_NL_OVERLOAD form option if the field +option O_STATIC is off and there is no maximum growth specified for +the field. Currently, if the form option O_NL_OVERLOAD is on, +REQ_NEW_LINE implicitly generates a REQ_NEXT_FIELD if called from +the last line of a field. If a field can grow without bound, there +is no last line, so REQ_NEW_LINE will never implicitly generate a +REQ_NEXT_FIELD. If a maximum growth limit is specified and the +O_NL_OVERLOAD form option is on, REQ_NEW_LINE will only implicitly +generate REQ_NEXT_FIELD if the field has grown to its maximum size +and the user is on the last line.

      +
    6. +
    7. +

      The library call dup_field will work as usual; it will duplicate +the field, including the current buffer size and contents of the +field being duplicated. Any specified maximum growth will also be +duplicated.

      +
    8. +
    9. +

      The library call link_field will work as usual; it will +duplicate all field attributes and share buffers with the field +being linked. If the O_STATIC field option is subsequently changed +by a field sharing buffers, how the system reacts to an attempt to +enter more data into the field than the buffer will currently hold +will depend on the setting of the option in the current field.

      +
    10. +
    11. +

      The library call field_info will work as usual; the variable +nrow will contain the value of the original call to new_field. The +user should use dynamic_field_info, described above, to query the +current size of the buffer.

      +
    12. +
    +

    Some of the above points make sense only after explaining form +driver. We will be looking into that in next few sections.

    +
    +
    +
    +
    +

    18.4. Form +Windows

    +

    The form windows concept is pretty much similar to menu windows. +Every form is associated with a main window and a sub window. The +form main window displays any title or border associated or +whatever the user wishes. Then the sub window contains all the +fields and displays them according to their position. This gives +the flexibility of manipulating fancy form displaying very +easily.

    +

    Since this is pretty much similar to menu windows, I am +providing an example with out much explanation. The functions are +similar and they work the same way.

    +
    +

    Example 28. Form Windows Example

    + + + + +
    +
    +#include <form.h>
    +
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color);
    +
    +int main()
    +{
    +        FIELD *field[3];
    +        FORM  *my_form;
    +        WINDOW *my_form_win;
    +        int ch, rows, cols;
    +        
    +        /* Initialize curses */
    +        initscr();
    +        start_color();
    +        cbreak();
    +        noecho();
    +        keypad(stdscr, TRUE);
    +
    +        /* Initialize few color pairs */
    +        init_pair(1, COLOR_RED, COLOR_BLACK);
    +
    +        /* Initialize the fields */
    +        field[0] = new_field(1, 10, 6, 1, 0, 0);
    +        field[1] = new_field(1, 10, 8, 1, 0, 0);
    +        field[2] = NULL;
    +
    +        /* Set field options */
    +        set_field_back(field[0], A_UNDERLINE);
    +        field_opts_off(field[0], O_AUTOSKIP); /* Don't go to next field when this */
    +                                              /* Field is filled up             */
    +        set_field_back(field[1], A_UNDERLINE); 
    +        field_opts_off(field[1], O_AUTOSKIP);
    +        
    +        /* Create the form and post it */
    +        my_form = new_form(field);
    +        
    +        /* Calculate the area required for the form */
    +        scale_form(my_form, &rows, &cols);
    +
    +        /* Create the window to be associated with the form */
    +        my_form_win = newwin(rows + 4, cols + 4, 4, 4);
    +        keypad(my_form_win, TRUE);
    +
    +        /* Set main window and sub window */
    +        set_form_win(my_form, my_form_win);
    +        set_form_sub(my_form, derwin(my_form_win, rows, cols, 2, 2));
    +
    +        /* Print a border around the main window and print a title */
    +        box(my_form_win, 0, 0);
    +        print_in_middle(my_form_win, 1, 0, cols + 4, "My Form", COLOR_PAIR(1));
    +        
    +        post_form(my_form);
    +        wrefresh(my_form_win);
    +
    +        mvprintw(LINES - 2, 0, "Use UP, DOWN arrow keys to switch between fields");
    +        refresh();
    +
    +        /* Loop through to get user requests */
    +        while((ch = wgetch(my_form_win)) != KEY_F(1))
    +        {       switch(ch)
    +                {       case KEY_DOWN:
    +                                /* Go to next field */
    +                                form_driver(my_form, REQ_NEXT_FIELD);
    +                                /* Go to the end of the present buffer */
    +                                /* Leaves nicely at the last character */
    +                                form_driver(my_form, REQ_END_LINE);
    +                                break;
    +                        case KEY_UP:
    +                                /* Go to previous field */
    +                                form_driver(my_form, REQ_PREV_FIELD);
    +                                form_driver(my_form, REQ_END_LINE);
    +                                break;
    +                        default:
    +                                /* If this is a normal character, it gets */
    +                                /* Printed                                */    
    +                                form_driver(my_form, ch);
    +                                break;
    +                }
    +        }
    +
    +        /* Un post form and free the memory */
    +        unpost_form(my_form);
    +        free_form(my_form);
    +        free_field(field[0]);
    +        free_field(field[1]); 
    +
    +        endwin();
    +        return 0;
    +}
    +
    +void print_in_middle(WINDOW *win, int starty, int startx, int width, char *string, chtype color)
    +{       int length, x, y;
    +        float temp;
    +
    +        if(win == NULL)
    +                win = stdscr;
    +        getyx(win, y, x);
    +        if(startx != 0)
    +                x = startx;
    +        if(starty != 0)
    +                y = starty;
    +        if(width == 0)
    +                width = 80;
    +
    +        length = strlen(string);
    +        temp = (width - length)/ 2;
    +        x = startx + (int)temp;
    +        wattron(win, color);
    +        mvwprintw(win, y, x, "%s", string);
    +        wattroff(win, color);
    +        refresh();
    +}
    +
    +
    +
    +
    +
    +

    18.5. +Field Validation

    +

    By default, a field will accept any data input by the user. It +is possible to attach validation to the field. Then any attempt by +the user to leave the field, while it contains data that doesn't +match the validation type will fail. Some validation types also +have a character-validity check for each time a character is +entered in the field.

    +

    Validation can be attached to a field with the following +function.

    + + + + +
    +
    +int set_field_type(FIELD *field,          /* field to alter */
    +                   FIELDTYPE *ftype,      /* type to associate */
    +                   ...);                  /* additional arguments*/
    +
    +Once set, the validation type for a field can be queried with + + + + +
    +
    +FIELDTYPE *field_type(FIELD *field);      /* field to query */
    +
    +

    The form driver validates the data in a field only when data is +entered by the end-user. Validation does not occur when

    +
      +
    • +

      the application program changes the field value by calling +set_field_buffer.

      +
    • +
    • +

      linked field values are changed indirectly -- by changing the +field to which they are linked

      +
    • +
    +

    The following are the pre-defined validation types. You can also +specify custom validation, though it's a bit tricky and +cumbersome.

    +

    TYPE_ALPHA

    +

    This field type accepts alphabetic data; no blanks, no digits, +no special characters (this is checked at character-entry time). It +is set up with:

    + + + + +
    +
    +int set_field_type(FIELD *field,          /* field to alter */
    +                   TYPE_ALPHA,            /* type to associate */
    +                   int width);            /* maximum width of field */
    +
    +

    The width argument sets a minimum width of data. The user has to +enter at-least width number of characters before he can leave the +field. Typically you'll want to set this to the field width; if +it's greater than the field width, the validation check will always +fail. A minimum width of zero makes field completion optional.

    +

    TYPE_ALNUM

    +

    This field type accepts alphabetic data and digits; no blanks, +no special characters (this is checked at character-entry time). It +is set up with:

    + + + + +
    +
    +int set_field_type(FIELD *field,          /* field to alter */
    +                   TYPE_ALNUM,            /* type to associate */
    +                   int width);            /* maximum width of field */
    +
    +

    The width argument sets a minimum width of data. As with +TYPE_ALPHA, typically you'll want to set this to the field width; +if it's greater than the field width, the validation check will +always fail. A minimum width of zero makes field completion +optional.

    +

    TYPE_ENUM

    +

    This type allows you to restrict a field's values to be among a +specified set of string values (for example, the two-letter postal +codes for U.S. states). It is set up with:

    + + + + +
    +
    +int set_field_type(FIELD *field,          /* field to alter */
    +                   TYPE_ENUM,             /* type to associate */
    +                   char **valuelist;      /* list of possible values */
    +                   int checkcase;         /* case-sensitive? */
    +                   int checkunique);      /* must specify uniquely? */
    +
    +

    The valuelist parameter must point at a NULL-terminated list of +valid strings. The checkcase argument, if true, makes comparison +with the string case-sensitive.

    +

    When the user exits a TYPE_ENUM field, the validation procedure +tries to complete the data in the buffer to a valid entry. If a +complete choice string has been entered, it is of course valid. But +it is also possible to enter a prefix of a valid string and have it +completed for you.

    +

    By default, if you enter such a prefix and it matches more than +one value in the string list, the prefix will be completed to the +first matching value. But the checkunique argument, if true, +requires prefix matches to be unique in order to be valid.

    +

    The REQ_NEXT_CHOICE and REQ_PREV_CHOICE input requests can be +particularly useful with these fields.

    +

    TYPE_INTEGER

    +

    This field type accepts an integer. It is set up as follows:

    + + + + +
    +
    +int set_field_type(FIELD *field,          /* field to alter */
    +                   TYPE_INTEGER,          /* type to associate */
    +                   int padding,           /* # places to zero-pad to */
    +                   int vmin, int vmax);   /* valid range */
    +
    +

    Valid characters consist of an optional leading minus and +digits. The range check is performed on exit. If the range maximum +is less than or equal to the minimum, the range is ignored.

    +

    If the value passes its range check, it is padded with as many +leading zero digits as necessary to meet the padding argument.

    +

    A TYPE_INTEGER value buffer can conveniently be interpreted with +the C library function atoi(3).

    +

    TYPE_NUMERIC

    +

    This field type accepts a decimal number. It is set up as +follows:

    + + + + +
    +
    +int set_field_type(FIELD *field,          /* field to alter */
    +                   TYPE_NUMERIC,          /* type to associate */
    +                   int padding,           /* # places of precision */
    +                   int vmin, int vmax);   /* valid range */
    +
    +

    Valid characters consist of an optional leading minus and +digits. possibly including a decimal point. The range check is +performed on exit. If the range maximum is less than or equal to +the minimum, the range is ignored.

    +

    If the value passes its range check, it is padded with as many +trailing zero digits as necessary to meet the padding argument.

    +

    A TYPE_NUMERIC value buffer can conveniently be interpreted with +the C library function atof(3).

    +

    TYPE_REGEXP

    +

    This field type accepts data matching a regular expression. It +is set up as follows:

    + + + + +
    +
    +int set_field_type(FIELD *field,          /* field to alter */
    +                   TYPE_REGEXP,           /* type to associate */
    +                   char *regexp);         /* expression to match */
    +
    +

    The syntax for regular expressions is that of regcomp(3). The +check for regular-expression match is performed on exit.

    +
    +
    +
    +

    18.6. Form +Driver: The work horse of the forms system

    +

    As in the menu system, form_driver() plays a very important role +in forms system. All types of requests to forms system should be +funneled through form_driver().

    + + + + +
    +
    +int form_driver(FORM *form,     /* form on which to operate     */
    +                int request)    /* form request code         */
    +
    +

    As you have seen some of the examples above, you have to be in a +loop looking for user input and then decide whether it's a field +data or a form request. The form requests are then passed to +form_driver() to do the work.

    +

    The requests roughly can be divided into following categories. +Different requests and their usage is explained below:

    +
    +
    +

    18.6.1. Page +Navigation Requests

    +

    These requests cause page-level moves through the form, +triggering display of a new form screen. A form can be made of +multiple pages. If you have a big form with lot of fields and +logical sections, then you can divide the form into pages. The +function set_new_page() to set a new page at the field +specified.

    + + + + +
    +
    +int set_new_page(FIELD *field,/* Field at which page break to be set or unset */
    +         bool new_page_flag); /* should be TRUE to put a break */
    +
    +

    The following requests allow you to move to different pages

    +
      +
    • +

      REQ_NEXT_PAGE Move to the next form page.

      +
    • +
    • +

      REQ_PREV_PAGE Move to the previous form page.

      +
    • +
    • +

      REQ_FIRST_PAGE Move to the first form page.

      +
    • +
    • +

      REQ_LAST_PAGE Move to the last form page.

      +
    • +
    +

    These requests treat the list as cyclic; that is, REQ_NEXT_PAGE +from the last page goes to the first, and REQ_PREV_PAGE from the +first page goes to the last.

    +
    +
    +
    +

    18.6.2. Inter-Field Navigation Requests

    +

    These requests handle navigation between fields on the same +page.

    +
      +
    • +

      REQ_NEXT_FIELD Move to next field.

      +
    • +
    • +

      REQ_PREV_FIELD Move to previous field.

      +
    • +
    • +

      REQ_FIRST_FIELD Move to the first field.

      +
    • +
    • +

      REQ_LAST_FIELD Move to the last field.

      +
    • +
    • +

      REQ_SNEXT_FIELD Move to sorted next field.

      +
    • +
    • +

      REQ_SPREV_FIELD Move to sorted previous field.

      +
    • +
    • +

      REQ_SFIRST_FIELD Move to the sorted first field.

      +
    • +
    • +

      REQ_SLAST_FIELD Move to the sorted last field.

      +
    • +
    • +

      REQ_LEFT_FIELD Move left to field.

      +
    • +
    • +

      REQ_RIGHT_FIELD Move right to field.

      +
    • +
    • +

      REQ_UP_FIELD Move up to field.

      +
    • +
    • +

      REQ_DOWN_FIELD Move down to field.

      +
    • +
    +

    These requests treat the list of fields on a page as cyclic; +that is, REQ_NEXT_FIELD from the last field goes to the first, and +REQ_PREV_FIELD from the first field goes to the last. The order of +the fields for these (and the REQ_FIRST_FIELD and REQ_LAST_FIELD +requests) is simply the order of the field pointers in the form +array (as set up by new_form() or set_form_fields()

    +

    It is also possible to traverse the fields as if they had been +sorted in screen-position order, so the sequence goes left-to-right +and top-to-bottom. To do this, use the second group of four +sorted-movement requests.

    +

    Finally, it is possible to move between fields using visual +directions up, down, right, and left. To accomplish this, use the +third group of four requests. Note, however, that the position of a +form for purposes of these requests is its upper-left corner.

    +

    For example, suppose you have a multi-line field B, and two +single-line fields A and C on the same line with B, with A to the +left of B and C to the right of B. A REQ_MOVE_RIGHT from A will go +to B only if A, B, and C all share the same first line; otherwise +it will skip over B to C.

    +
    +
    +
    +

    18.6.3. Intra-Field Navigation Requests

    +

    These requests drive movement of the edit cursor within the +currently selected field.

    +
      +
    • +

      REQ_NEXT_CHAR Move to next character.

      +
    • +
    • +

      REQ_PREV_CHAR Move to previous character.

      +
    • +
    • +

      REQ_NEXT_LINE Move to next line.

      +
    • +
    • +

      REQ_PREV_LINE Move to previous line.

      +
    • +
    • +

      REQ_NEXT_WORD Move to next word.

      +
    • +
    • +

      REQ_PREV_WORD Move to previous word.

      +
    • +
    • +

      REQ_BEG_FIELD Move to beginning of field.

      +
    • +
    • +

      REQ_END_FIELD Move to end of field.

      +
    • +
    • +

      REQ_BEG_LINE Move to beginning of line.

      +
    • +
    • +

      REQ_END_LINE Move to end of line.

      +
    • +
    • +

      REQ_LEFT_CHAR Move left in field.

      +
    • +
    • +

      REQ_RIGHT_CHAR Move right in field.

      +
    • +
    • +

      REQ_UP_CHAR Move up in field.

      +
    • +
    • +

      REQ_DOWN_CHAR Move down in field.

      +
    • +
    +

    Each word is separated from the previous and next characters by +whitespace. The commands to move to beginning and end of line or +field look for the first or last non-pad character in their +ranges.

    +
    +
    +
    +

    18.6.4. +Scrolling Requests

    +

    Fields that are dynamic and have grown and fields explicitly +created with offscreen rows are scrollable. One-line fields scroll +horizontally; multi-line fields scroll vertically. Most scrolling +is triggered by editing and intra-field movement (the library +scrolls the field to keep the cursor visible). It is possible to +explicitly request scrolling with the following requests:

    +
      +
    • +

      REQ_SCR_FLINE Scroll vertically forward a line.

      +
    • +
    • +

      REQ_SCR_BLINE Scroll vertically backward a line.

      +
    • +
    • +

      REQ_SCR_FPAGE Scroll vertically forward a page.

      +
    • +
    • +

      REQ_SCR_BPAGE Scroll vertically backward a page.

      +
    • +
    • +

      REQ_SCR_FHPAGE Scroll vertically forward half a +page.

      +
    • +
    • +

      REQ_SCR_BHPAGE Scroll vertically backward half a +page.

      +
    • +
    • +

      REQ_SCR_FCHAR Scroll horizontally forward a +character.

      +
    • +
    • +

      REQ_SCR_BCHAR Scroll horizontally backward a +character.

      +
    • +
    • +

      REQ_SCR_HFLINE Scroll horizontally one field width +forward.

      +
    • +
    • +

      REQ_SCR_HBLINE Scroll horizontally one field width +backward.

      +
    • +
    • +

      REQ_SCR_HFHALF Scroll horizontally one half field width +forward.

      +
    • +
    • +

      REQ_SCR_HBHALF Scroll horizontally one half field width +backward.

      +
    • +
    +

    For scrolling purposes, a page of a field is the height of its +visible part.

    +
    +
    +
    +

    18.6.5. Editing +Requests

    +

    When you pass the forms driver an ASCII character, it is treated +as a request to add the character to the field's data buffer. +Whether this is an insertion or a replacement depends on the +field's edit mode (insertion is the default.

    +

    The following requests support editing the field and changing +the edit mode:

    +
      +
    • +

      REQ_INS_MODE Set insertion mode.

      +
    • +
    • +

      REQ_OVL_MODE Set overlay mode.

      +
    • +
    • +

      REQ_NEW_LINE New line request (see below for +explanation).

      +
    • +
    • +

      REQ_INS_CHAR Insert space at character location.

      +
    • +
    • +

      REQ_INS_LINE Insert blank line at character +location.

      +
    • +
    • +

      REQ_DEL_CHAR Delete character at cursor.

      +
    • +
    • +

      REQ_DEL_PREV Delete previous word at cursor.

      +
    • +
    • +

      REQ_DEL_LINE Delete line at cursor.

      +
    • +
    • +

      REQ_DEL_WORD Delete word at cursor.

      +
    • +
    • +

      REQ_CLR_EOL Clear to end of line.

      +
    • +
    • +

      REQ_CLR_EOF Clear to end of field.

      +
    • +
    • +

      REQ_CLR_FIELD Clear entire field.

      +
    • +
    +

    The behavior of the REQ_NEW_LINE and REQ_DEL_PREV requests is +complicated and partly controlled by a pair of forms options. The +special cases are triggered when the cursor is at the beginning of +a field, or on the last line of the field.

    +

    First, we consider REQ_NEW_LINE:

    +

    The normal behavior of REQ_NEW_LINE in insert mode is to break +the current line at the position of the edit cursor, inserting the +portion of the current line after the cursor as a new line +following the current and moving the cursor to the beginning of +that new line (you may think of this as inserting a newline in the +field buffer).

    +

    The normal behavior of REQ_NEW_LINE in overlay mode is to clear +the current line from the position of the edit cursor to end of +line. The cursor is then moved to the beginning of the next +line.

    +

    However, REQ_NEW_LINE at the beginning of a field, or on the +last line of a field, instead does a REQ_NEXT_FIELD. O_NL_OVERLOAD +option is off, this special action is disabled.

    +

    Now, let us consider REQ_DEL_PREV:

    +

    The normal behavior of REQ_DEL_PREV is to delete the previous +character. If insert mode is on, and the cursor is at the start of +a line, and the text on that line will fit on the previous one, it +instead appends the contents of the current line to the previous +one and deletes the current line (you may think of this as deleting +a newline from the field buffer).

    +

    However, REQ_DEL_PREV at the beginning of a field is instead +treated as a REQ_PREV_FIELD.

    +

    If the O_BS_OVERLOAD option is off, this special action is +disabled and the forms driver just returns E_REQUEST_DENIED.

    +
    +
    +
    +

    18.6.6. Order +Requests

    +

    If the type of your field is ordered, and has associated +functions for getting the next and previous values of the type from +a given value, there are requests that can fetch that value into +the field buffer:

    +
      +
    • +

      REQ_NEXT_CHOICE Place the successor value of the +current value in the buffer.

      +
    • +
    • +

      REQ_PREV_CHOICE Place the predecessor value of the +current value in the buffer.

      +
    • +
    +

    Of the built-in field types, only TYPE_ENUM has built-in +successor and predecessor functions. When you define a field type +of your own (see Custom Validation Types), you can associate our +own ordering functions.

    +
    +
    +
    +

    18.6.7. Application Commands

    +

    Form requests are represented as integers above the curses value +greater than KEY_MAX and less than or equal to the constant +MAX_COMMAND. A value within this range gets ignored by +form_driver(). So this can be used for any purpose by the +application. It can be treated as an application specific action +and take corresponding action.

    +
    +
    +
    +
    +
    +

    19. Tools and Widget +Libraries

    +

    Now that you have seen the capabilities of ncurses and its +sister libraries, you are rolling your sleeves up and gearing for a +project that heavily manipulates screen. But wait.. It can be +pretty difficult to write and maintain complex GUI widgets in plain +ncurses or even with the additional libraries. There are some +ready-to-use tools and widget libraries that can be used instead of +writing your own widgets. You can use some of them, get ideas from +the code, or even extend them.

    +
    +
    +

    19.1. CDK (Curses +Development Kit)

    +

    In the author's words

    +

    CDK stands for 'Curses Development Kit' and it currently +contains 21 ready to use widgets which facilitate the speedy +development of full screen curses programs.

    +

    The kit provides some useful widgets, which can be used in your +programs directly. It's pretty well written and the documentation +is very good. The examples in the examples directory can be a good +place to start for beginners. The CDK can be downloaded from +http://invisible-island.net/cdk/ . Follow the +instructions in README file to install it.

    +
    +
    +

    19.1.1. +Widget List

    +

    The following is the list of widgets provided with cdk and their +description.

    + + + + +
    +
    +Widget Type           Quick Description
    +===========================================================================
    +Alphalist             Allows a user to select from a list of words, with
    +                      the ability to narrow the search list by typing in a
    +                      few characters of the desired word.
    +Buttonbox             This creates a multiple button widget. 
    +Calendar              Creates a little simple calendar widget.
    +Dialog                Prompts the user with a message, and the user
    +                      can pick an answer from the buttons provided.
    +Entry                 Allows the user to enter various types of information.
    +File Selector         A file selector built from Cdk base widgets. This
    +                      example shows how to create more complicated widgets
    +                      using the Cdk widget library.
    +Graph                 Draws a graph.
    +Histogram             Draws a histogram.
    +Item List             Creates a pop up field which allows the user to select
    +                      one of several choices in a small field. Very useful
    +                      for things like days of the week or month names.
    +Label                 Displays messages in a pop up box, or the label can be
    +                      considered part of the screen.
    +Marquee               Displays a message in a scrolling marquee.
    +Matrix                Creates a complex matrix with lots of options.
    +Menu                  Creates a pull-down menu interface.
    +Multiple Line Entry   A multiple line entry field. Very useful
    +                      for long fields. (like a description
    +                      field)
    +Radio List            Creates a radio button list.
    +Scale                 Creates a numeric scale. Used for allowing a user to
    +                      pick a numeric value and restrict them to a range of 
    +                      values.
    +Scrolling List        Creates a scrolling list/menu list.
    +Scrolling Window      Creates a scrolling log file viewer. Can add 
    +                      information into the window while its running. 
    +                      A good widget for displaying the progress of
    +                      something. (akin to a console window)
    +Selection List        Creates a multiple option selection list.
    +Slider                Akin to the scale widget, this widget provides a
    +                      visual slide bar to represent the numeric value.
    +Template              Creates a entry field with character sensitive 
    +                      positions. Used for pre-formatted fields like
    +                      dates and phone numbers.
    +Viewer                This is a file/information viewer. Very useful
    +                      when you need to display loads of information.
    +===========================================================================
    +
    +

    A few of the widgets are modified by Thomas Dickey in recent +versions.

    +
    +
    +
    +

    19.1.2. Some +Attractive Features

    +

    Apart from making our life easier with readily usable widgets, +cdk solves one frustrating problem with printing multi colored +strings, justified strings elegantly. Special formatting tags can +be embedded in the strings which are passed to CDK functions. For +Example

    +

    If the string

    + + + + +
    +
    +"</B/1>This line should have a yellow foreground and a blue
    +background.<!1>"
    +
    +

    given as a parameter to newCDKLabel(), it prints the line with +yellow foreground and blue background. There are other tags +available for justifying string, embedding special drawing +characters etc.. Please refer to the man page cdk_display(3X) for +details. The man page explains the usage with nice examples.

    +
    +
    +
    +

    19.1.3. Conclusion

    +

    All in all, CDK is a well-written package of widgets, which if +used properly can form a strong frame work for developing complex +GUI.

    +
    +
    +
    +
    +

    19.2. The +dialog

    +

    Long long ago, in September 1994, when few people knew linux, +Jeff Tranter wrote an article on dialog in Linux Journal. He starts the +article with these words..

    +

    Linux is based on the Unix operating system, but also +features a number of unique and useful kernel features and +application programs that often go beyond what is available under +Unix. One little-known gem is "dialog", a utility for creating +professional-looking dialog boxes from within shell scripts. This +article presents a tutorial introduction to the dialog utility, and +shows examples of how and where it can be used

    +

    As he explains, dialog is a real gem in making +professional-looking dialog boxes with ease. It creates a variety +of dialog boxes, menus, check lists etc.. It is usually installed +by default. If not, you can download it from Thomas +Dickey's site.

    +

    The above-mentioned article gives a very good overview of its +uses and capabilites. The man page has more details. It can be used +in variety of situations. One good example is building of linux +kernel in text mode. Linux kernel uses a modified version of dialog +tailored for its needs.

    +

    dialog was initially designed to be used with shell scripts. If +you want to use its functionality in a c program, then you can use +libdialog. The documentation regarding this is sparse. Definitive +reference is the dialog.h header file which comes with the library. +You may need to hack here and there to get the required output. The +source is easily customizable. I have used it on a number of +occasions by modifying the code.

    +
    +
    +
    +

    19.3. Perl +Curses Modules CURSES::FORM and CURSES::WIDGETS

    +

    The perl module Curses, Curses::Form and Curses::Widgets give +access to curses from perl. If you have curses and basic perl is +installed, you can get these modules from CPAN All Modules page. Get the three zipped modules in +the Curses category. Once installed you can use these modules from +perl scripts like any other module. For more information on perl +modules see perlmod man page. The above modules come with good +documentation and they have some demo scripts to test the +functionality. Though the widgets provided are very rudimentary, +these modules provide good access to curses library from perl.

    +

    Some of my code examples are converted to perl by Anuradha +Ratnaweera and they are available in the perl directory.

    +

    For more information see man pages Curses(3) , Curses::Form(3) +and Curses::Widgets(3). These pages are installed only when the +above modules are acquired and installed.

    +
    +
    +
    +
    +

    20. Just For +Fun !!!

    +

    This section contains few programs written by me just for fun. +They don't signify a better programming practice or the best way of +using ncurses. They are provided here so as to allow beginners to +get ideas and add more programs to this section. If you have +written a couple of nice, simple programs in curses and want them +to included here, contact me.

    +
    +
    +

    20.1. The +Game of Life

    +

    Game of life is a wonder of math. In Paul Callahan's words

    + + + + +
    +
    +The Game of Life (or simply Life) is not a game in the conventional sense. There
    +are no players, and no winning or losing. Once the "pieces" are placed in the
    +starting position, the rules determine everything that happens later.
    +Nevertheless, Life is full of surprises! In most cases, it is impossible to look
    +at a starting position (or pattern) and see what will happen in the future. The
    +only way to find out is to follow the rules of the game.
    +
    +

    This program starts with a simple inverted U pattern and shows +how wonderful life works. There is a lot of room for improvement in +the program. You can let the user enter pattern of his choice or +even take input from a file. You can also change rules and play +with a lot of variations. Search on google for interesting information on game of +life.

    +

    File Path: JustForFun/life.c

    +
    +
    +
    +

    20.2. Magic +Square

    +

    Magic Square, another wonder of math, is very simple to +understand but very difficult to make. In a magic square sum of the +numbers in each row, each column is equal. Even diagnol sum can be +equal. There are many variations which have special properties.

    +

    This program creates a simple magic square of odd order.

    +

    File Path: JustForFun/magic.c

    +
    +
    +
    +

    20.3. Towers of +Hanoi

    +

    The famous towers of hanoi solver. The aim of the game is to +move the disks on the first peg to last peg, using middle peg as a +temporary stay. The catch is not to place a larger disk over a +small disk at any time.

    +

    File Path: JustForFun/hanoi.c

    +
    +
    +
    +

    20.4. Queens +Puzzle

    +

    The objective of the famous N-Queen puzzle is to put N queens on +a N X N chess board without attacking each other.

    +

    This program solves it with a simple backtracking technique.

    +

    File Path: JustForFun/queens.c

    +
    +
    +
    +

    20.5. +Shuffle

    +

    A fun game, if you have time to kill.

    +

    File Path: JustForFun/shuffle.c

    +
    +
    +
    +

    20.6. Typing Tutor

    +

    A simple typing tutor, I created more out of need than for ease +of use. If you know how to put your fingers correctly on the +keyboard, but lack practice, this can be helpful.

    +

    File Path: JustForFun/tt.c

    +
    +
    +
    +
    +

    21. References

    + +
    +
    + + diff --git a/doc/html/ada/files.htm b/doc/html/ada/files.htm index 682207c0..a3bad641 100644 --- a/doc/html/ada/files.htm +++ b/doc/html/ada/files.htm @@ -1,5 +1,6 @@ +

    Files

    [T] - \ No newline at end of file + diff --git a/doc/html/ada/files/T.htm b/doc/html/ada/files/T.htm index b9978941..d9d6950b 100644 --- a/doc/html/ada/files/T.htm +++ b/doc/html/ada/files/T.htm @@ -1,3 +1,4 @@ + T

    Files - T

    diff --git a/doc/html/ada/funcs.htm b/doc/html/ada/funcs.htm index 96e0b144..9a2da618 100644 --- a/doc/html/ada/funcs.htm +++ b/doc/html/ada/funcs.htm @@ -1,7 +1,7 @@ +

    Functions/Procedures

    -[ ] [A] [B] [C] @@ -24,4 +24,4 @@ [U] [V] [W] - \ No newline at end of file + diff --git a/doc/html/ada/funcs/A.htm b/doc/html/ada/funcs/A.htm index c59849d8..1c0b6dd7 100644 --- a/doc/html/ada/funcs/A.htm +++ b/doc/html/ada/funcs/A.htm @@ -1,8 +1,9 @@ + A

    Functions - A

    [index] diff --git a/doc/html/ada/funcs/B.htm b/doc/html/ada/funcs/B.htm index d23957e1..ab8c51b3 100644 --- a/doc/html/ada/funcs/B.htm +++ b/doc/html/ada/funcs/B.htm @@ -1,10 +1,11 @@ + B

    Functions - B

    [index] diff --git a/doc/html/ada/funcs/C.htm b/doc/html/ada/funcs/C.htm index 949508dd..251e2323 100644 --- a/doc/html/ada/funcs/C.htm +++ b/doc/html/ada/funcs/C.htm @@ -1,33 +1,34 @@ + C

    Functions - C

    [index] diff --git a/doc/html/ada/funcs/D.htm b/doc/html/ada/funcs/D.htm index fa010bc7..2e3f6c59 100644 --- a/doc/html/ada/funcs/D.htm +++ b/doc/html/ada/funcs/D.htm @@ -1,21 +1,22 @@ + D

    Functions - D

    [index] diff --git a/doc/html/ada/funcs/E.htm b/doc/html/ada/funcs/E.htm index 933c74ad..85fc2323 100644 --- a/doc/html/ada/funcs/E.htm +++ b/doc/html/ada/funcs/E.htm @@ -1,9 +1,10 @@ + E

    Functions - E

    [index] diff --git a/doc/html/ada/funcs/F.htm b/doc/html/ada/funcs/F.htm index 5a95433f..4ab9adf0 100644 --- a/doc/html/ada/funcs/F.htm +++ b/doc/html/ada/funcs/F.htm @@ -1,42 +1,43 @@ + F

    Functions - F

    [index] diff --git a/doc/html/ada/funcs/G.htm b/doc/html/ada/funcs/G.htm index 1a57040d..e739131f 100644 --- a/doc/html/ada/funcs/G.htm +++ b/doc/html/ada/funcs/G.htm @@ -1,32 +1,33 @@ + G

    Functions - G

    [index] diff --git a/doc/html/ada/funcs/H.htm b/doc/html/ada/funcs/H.htm index c3aa4789..638ba4cb 100644 --- a/doc/html/ada/funcs/H.htm +++ b/doc/html/ada/funcs/H.htm @@ -1,13 +1,14 @@ + H

    Functions - H

    [index] diff --git a/doc/html/ada/funcs/I.htm b/doc/html/ada/funcs/I.htm index 4968d3c2..b0e1b12c 100644 --- a/doc/html/ada/funcs/I.htm +++ b/doc/html/ada/funcs/I.htm @@ -1,28 +1,29 @@ + I

    Functions - I

    [index] diff --git a/doc/html/ada/funcs/K.htm b/doc/html/ada/funcs/K.htm index ad419ef3..d159d302 100644 --- a/doc/html/ada/funcs/K.htm +++ b/doc/html/ada/funcs/K.htm @@ -1,10 +1,11 @@ + K

    Functions - K

    [index] diff --git a/doc/html/ada/funcs/L.htm b/doc/html/ada/funcs/L.htm index b97a815e..cfb06183 100644 --- a/doc/html/ada/funcs/L.htm +++ b/doc/html/ada/funcs/L.htm @@ -1,14 +1,15 @@ + L

    Functions - L

    [index] diff --git a/doc/html/ada/funcs/M.htm b/doc/html/ada/funcs/M.htm index 37297ae0..2e592e0f 100644 --- a/doc/html/ada/funcs/M.htm +++ b/doc/html/ada/funcs/M.htm @@ -1,43 +1,43 @@ + M

    Functions - M

    [index] diff --git a/doc/html/ada/funcs/N.htm b/doc/html/ada/funcs/N.htm index 10345d6a..3b584cc6 100644 --- a/doc/html/ada/funcs/N.htm +++ b/doc/html/ada/funcs/N.htm @@ -1,27 +1,28 @@ + N

    Functions - N

    [index] diff --git a/doc/html/ada/funcs/O.htm b/doc/html/ada/funcs/O.htm index a4e4d3b7..ca0d4070 100644 --- a/doc/html/ada/funcs/O.htm +++ b/doc/html/ada/funcs/O.htm @@ -1,9 +1,10 @@ + O

    Functions - O

    [index] diff --git a/doc/html/ada/funcs/P.htm b/doc/html/ada/funcs/P.htm index 2e5fc912..1fdb8218 100644 --- a/doc/html/ada/funcs/P.htm +++ b/doc/html/ada/funcs/P.htm @@ -1,43 +1,44 @@ + P

    Functions - P

    [index] diff --git a/doc/html/ada/funcs/Q.htm b/doc/html/ada/funcs/Q.htm index 8164ad3e..1ae992bd 100644 --- a/doc/html/ada/funcs/Q.htm +++ b/doc/html/ada/funcs/Q.htm @@ -1,7 +1,8 @@ + Q

    Functions - Q

    [index] diff --git a/doc/html/ada/funcs/R.htm b/doc/html/ada/funcs/R.htm index eb6817b1..ebe8a1e2 100644 --- a/doc/html/ada/funcs/R.htm +++ b/doc/html/ada/funcs/R.htm @@ -1,19 +1,20 @@ + R

    Functions - R

    [index] diff --git a/doc/html/ada/funcs/S.htm b/doc/html/ada/funcs/S.htm index 9e68099f..7ac0fc05 100644 --- a/doc/html/ada/funcs/S.htm +++ b/doc/html/ada/funcs/S.htm @@ -1,97 +1,98 @@ + S

    Functions - S

    [index] diff --git a/doc/html/ada/funcs/T.htm b/doc/html/ada/funcs/T.htm index 3988e338..61d2a91e 100644 --- a/doc/html/ada/funcs/T.htm +++ b/doc/html/ada/funcs/T.htm @@ -1,30 +1,31 @@ + T

    Functions - T

    [index] diff --git a/doc/html/ada/funcs/U.htm b/doc/html/ada/funcs/U.htm index 1d8b8756..b4c513ee 100644 --- a/doc/html/ada/funcs/U.htm +++ b/doc/html/ada/funcs/U.htm @@ -1,11 +1,12 @@ + U

    Functions - U

    [index] diff --git a/doc/html/ada/funcs/V.htm b/doc/html/ada/funcs/V.htm index 1562c4a3..dbe65f82 100644 --- a/doc/html/ada/funcs/V.htm +++ b/doc/html/ada/funcs/V.htm @@ -1,7 +1,8 @@ + V

    Functions - V

    [index] diff --git a/doc/html/ada/funcs/W.htm b/doc/html/ada/funcs/W.htm index 00fd9769..3256beb1 100644 --- a/doc/html/ada/funcs/W.htm +++ b/doc/html/ada/funcs/W.htm @@ -1,55 +1,56 @@ + W

    Functions - W

    [index] diff --git a/doc/html/ada/index.htm b/doc/html/ada/index.htm index 79c9f4a4..4a13484d 100644 --- a/doc/html/ada/index.htm +++ b/doc/html/ada/index.htm @@ -1,13 +1,12 @@ + Source Browser - - + + <H2 ALIGN=CENTER>Files</H2> <A HREF="files/T.htm">[T]</A> -</UL> <HR> <H2 ALIGN=CENTER>Functions/Procedures</H2> -<A HREF="funcs/ .htm">[ ]</A> <A HREF="funcs/A.htm">[A]</A> <A HREF="funcs/B.htm">[B]</A> <A HREF="funcs/C.htm">[C]</A> @@ -30,9 +29,8 @@ <A HREF="funcs/U.htm">[U]</A> <A HREF="funcs/V.htm">[V]</A> <A HREF="funcs/W.htm">[W]</A> -</UL> -</NOFRAME> -<FRAMESET ROWS='50%,50%'> + + diff --git a/doc/html/ada/main.htm b/doc/html/ada/main.htm index 464a4f85..701fe7d1 100644 --- a/doc/html/ada/main.htm +++ b/doc/html/ada/main.htm @@ -1,10 +1,9 @@ +

    [No frame version is here]

    Files

    [T] -

    Functions/Procedures

    -[ ] [A] [B] [C] @@ -27,7 +26,6 @@ [U] [V] [W] -
    You should start your browsing with one of these files: + diff --git a/doc/html/ada/terminal_interface-curses-aux__adb.htm b/doc/html/ada/terminal_interface-curses-aux__adb.htm index 05c57e03..a6dacec9 100644 --- a/doc/html/ada/terminal_interface-curses-aux__adb.htm +++ b/doc/html/ada/terminal_interface-curses-aux__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-aux.adb

    File : terminal_interface-curses-aux.adb


    @@ -42,80 +43,80 @@ -- @Revision: 1.10 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -package body Terminal_Interface.Curses.Aux is +package body Terminal_Interface.Curses.Aux is -- -- Some helpers - procedure Fill_String (Cp : in chars_ptr; - Str : out String) + procedure Fill_String (Cp : in chars_ptr; + Str : out String) is -- Fill the string with the characters referenced by the -- chars_ptr. -- - Len : Natural; + Len : Natural; begin - if Cp /= Null_Ptr then - Len := Natural (Strlen (Cp)); - if Str'Length < Len then + if Cp /= Null_Ptr then + Len := Natural (Strlen (Cp)); + if Str'Length < Len then raise Constraint_Error; end if; declare - S : String (1 .. Len); + S : String (1 .. Len); begin - S := Value (Cp); - Str (Str'First .. (Str'First + Len - 1)) := S (S'Range); + S := Value (Cp); + Str (Str'First .. (Str'First + Len - 1)) := S (S'Range); end; else - Len := 0; + Len := 0; end if; - if Len < Str'Length then - Str ((Str'First + Len) .. Str'Last) := (others => ' '); + if Len < Str'Length then + Str ((Str'First + Len) .. Str'Last) := (others => ' '); end if; - end Fill_String; + end Fill_String; - function Fill_String (Cp : chars_ptr) return String + function Fill_String (Cp : chars_ptr) return String is - Len : Natural; + Len : Natural; begin - if Cp /= Null_Ptr then - Len := Natural (Strlen (Cp)); - if Len = 0 then + if Cp /= Null_Ptr then + Len := Natural (Strlen (Cp)); + if Len = 0 then return ""; else declare - S : String (1 .. Len); + S : String (1 .. Len); begin - Fill_String (Cp, S); - return S; + Fill_String (Cp, S); + return S; end; end if; else return ""; end if; - end Fill_String; + end Fill_String; - procedure Eti_Exception (Code : Eti_Error) + procedure Eti_Exception (Code : Eti_Error) is begin - case Code is - when E_Ok => null; - when E_System_Error => raise Eti_System_Error; - when E_Bad_Argument => raise Eti_Bad_Argument; - when E_Posted => raise Eti_Posted; - when E_Connected => raise Eti_Connected; - when E_Bad_State => raise Eti_Bad_State; - when E_No_Room => raise Eti_No_Room; - when E_Not_Posted => raise Eti_Not_Posted; - when E_Unknown_Command => raise Eti_Unknown_Command; - when E_No_Match => raise Eti_No_Match; - when E_Not_Selectable => raise Eti_Not_Selectable; - when E_Not_Connected => raise Eti_Not_Connected; - when E_Request_Denied => raise Eti_Request_Denied; - when E_Invalid_Field => raise Eti_Invalid_Field; - when E_Current => raise Eti_Current; + case Code is + when E_Ok => null; + when E_System_Error => raise Eti_System_Error; + when E_Bad_Argument => raise Eti_Bad_Argument; + when E_Posted => raise Eti_Posted; + when E_Connected => raise Eti_Connected; + when E_Bad_State => raise Eti_Bad_State; + when E_No_Room => raise Eti_No_Room; + when E_Not_Posted => raise Eti_Not_Posted; + when E_Unknown_Command => raise Eti_Unknown_Command; + when E_No_Match => raise Eti_No_Match; + when E_Not_Selectable => raise Eti_Not_Selectable; + when E_Not_Connected => raise Eti_Not_Connected; + when E_Request_Denied => raise Eti_Request_Denied; + when E_Invalid_Field => raise Eti_Invalid_Field; + when E_Current => raise Eti_Current; end case; - end Eti_Exception; + end Eti_Exception; -end Terminal_Interface.Curses.Aux; +end Terminal_Interface.Curses.Aux; diff --git a/doc/html/ada/terminal_interface-curses-aux__ads.htm b/doc/html/ada/terminal_interface-curses-aux__ads.htm index 02c03d6c..e81c3325 100644 --- a/doc/html/ada/terminal_interface-curses-aux__ads.htm +++ b/doc/html/ada/terminal_interface-curses-aux__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-aux.ads

    File : terminal_interface-curses-aux.ads


    @@ -47,9 +48,9 @@ -- This module is generated. Please don't change it manually! -- Run the generator instead. -- | -with System; -with Interfaces.C; -with Interfaces.C.Strings; use Interfaces.C.Strings; +with System; +with Interfaces.C; +with Interfaces.C.Strings; use Interfaces.C.Strings; with Unchecked_Conversion; package Terminal_Interface.Curses.Aux is @@ -57,15 +58,15 @@ use type Interfaces.C.int; - subtype C_Int is Interfaces.C.int; - subtype C_Short is Interfaces.C.short; - subtype C_Long_Int is Interfaces.C.long; - subtype C_Size_T is Interfaces.C.size_t; - subtype C_UInt is Interfaces.C.unsigned; - subtype C_ULong is Interfaces.C.unsigned_long; - subtype C_Char_Ptr is Interfaces.C.Strings.chars_ptr; - type C_Void_Ptr is new System.Address; - type C_Chtype is new C_ULong; + subtype C_Int is Interfaces.C.int; + subtype C_Short is Interfaces.C.short; + subtype C_Long_Int is Interfaces.C.long; + subtype C_Size_T is Interfaces.C.size_t; + subtype C_UInt is Interfaces.C.unsigned; + subtype C_ULong is Interfaces.C.unsigned_long; + subtype C_Char_Ptr is Interfaces.C.Strings.chars_ptr; + type C_Void_Ptr is new System.Address; + type C_Chtype is new C_ULong; type C_AttrType is new C_ULong; -- This is how those constants are defined in ncurses. I see them also @@ -73,29 +74,29 @@ -- could be that this is quite general, but please check with your curses. -- This is critical, because curses sometime mixes boolean returns with -- returning an error status. - Curses_Ok : constant C_Int := 0; + Curses_Ok : constant C_Int := 0; Curses_Err : constant C_Int := -1; - Curses_True : constant C_Int := 1; + Curses_True : constant C_Int := 1; Curses_False : constant C_Int := 0; -- Eti_Error: type for error codes returned by the menu and form subsystem subtype Eti_Error is C_Int range -14 .. 0; - E_Ok : constant Eti_Error := 0; - E_System_Error : constant Eti_Error := -1; - E_Bad_Argument : constant Eti_Error := -2; - E_Posted : constant Eti_Error := -3; - E_Connected : constant Eti_Error := -4; - E_Bad_State : constant Eti_Error := -5; - E_No_Room : constant Eti_Error := -6; - E_Not_Posted : constant Eti_Error := -7; - E_Unknown_Command : constant Eti_Error := -8; - E_No_Match : constant Eti_Error := -9; - E_Not_Selectable : constant Eti_Error := -10; - E_Not_Connected : constant Eti_Error := -11; - E_Request_Denied : constant Eti_Error := -12; - E_Invalid_Field : constant Eti_Error := -13; + E_Ok : constant Eti_Error := 0; + E_System_Error : constant Eti_Error := -1; + E_Bad_Argument : constant Eti_Error := -2; + E_Posted : constant Eti_Error := -3; + E_Connected : constant Eti_Error := -4; + E_Bad_State : constant Eti_Error := -5; + E_No_Room : constant Eti_Error := -6; + E_Not_Posted : constant Eti_Error := -7; + E_Unknown_Command : constant Eti_Error := -8; + E_No_Match : constant Eti_Error := -9; + E_Not_Selectable : constant Eti_Error := -10; + E_Not_Connected : constant Eti_Error := -11; + E_Request_Denied : constant Eti_Error := -12; + E_Invalid_Field : constant Eti_Error := -13; E_Current : constant Eti_Error := -14; procedure Eti_Exception (Code : Eti_Error); @@ -104,21 +105,21 @@ -- -- Some helpers function Chtype_To_AttrChar is new - Unchecked_Conversion (Source => C_Chtype, - Target => Attributed_Character); + Unchecked_Conversion (Source => C_Chtype, + Target => Attributed_Character); function AttrChar_To_Chtype is new - Unchecked_Conversion (Source => Attributed_Character, + Unchecked_Conversion (Source => Attributed_Character, Target => C_Chtype); function AttrChar_To_AttrType is new - Unchecked_Conversion (Source => Attributed_Character, + Unchecked_Conversion (Source => Attributed_Character, Target => C_AttrType); function AttrType_To_AttrChar is new - Unchecked_Conversion (Source => C_AttrType, + Unchecked_Conversion (Source => C_AttrType, Target => Attributed_Character); - procedure Fill_String (Cp : in chars_ptr; + procedure Fill_String (Cp : in chars_ptr; Str : out String); -- Fill the Str parameter with the string denoted by the chars_ptr -- C-Style string. diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__adb.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__adb.htm index 9a4063be..fb26df8c 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-alpha.adb

    File : terminal_interface-curses-forms-field_types-alpha.adb


    @@ -42,32 +43,32 @@ -- @Revision: 1.8 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Forms.Field_Types.Alpha is +package body Terminal_Interface.Curses.Forms.Field_Types.Alpha is - use type Interfaces.C.int; + use type Interfaces.C.int; - procedure Set_Field_Type (Fld : in Field; - Typ : in Alpha_Field) + procedure Set_Field_Type (Fld : in Field; + Typ : in Alpha_Field) is - C_Alpha_Field_Type : C_Field_Type; - pragma Import (C, C_Alpha_Field_Type, "TYPE_ALPHA"); + C_Alpha_Field_Type : C_Field_Type; + pragma Import (C, C_Alpha_Field_Type, "TYPE_ALPHA"); - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := C_Alpha_Field_Type; - Arg1 : C_Int) return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := C_Alpha_Field_Type; + Arg1 : C_Int) return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); - Res : Eti_Error; + Res : Eti_Error; begin - Res := Set_Fld_Type (Arg1 => C_Int (Typ.Minimum_Field_Width)); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fld_Type (Arg1 => C_Int (Typ.Minimum_Field_Width)); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Wrap_Builtin (Fld, Typ); - end Set_Field_Type; + Wrap_Builtin (Fld, Typ); + end Set_Field_Type; -end Terminal_Interface.Curses.Forms.Field_Types.Alpha; +end Terminal_Interface.Curses.Forms.Field_Types.Alpha; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__ads.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__ads.htm index 4f6c7ffd..6c671b3b 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-alpha__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-alpha.ads

    File : terminal_interface-curses-forms-field_types-alpha.ads


    @@ -42,17 +43,17 @@ -- @Revision: 1.11 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -package Terminal_Interface.Curses.Forms.Field_Types.Alpha is - pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.Alpha); +package Terminal_Interface.Curses.Forms.Field_Types.Alpha is + pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.Alpha); - type Alpha_Field is new Field_Type + type Alpha_Field is new Field_Type with record - Minimum_Field_Width : Natural := 0; + Minimum_Field_Width : Natural := 0; end record; - procedure Set_Field_Type (Fld : in Field; - Typ : in Alpha_Field); + procedure Set_Field_Type (Fld : in Field; + Typ : in Alpha_Field); pragma Inline (Set_Field_Type); -end Terminal_Interface.Curses.Forms.Field_Types.Alpha; +end Terminal_Interface.Curses.Forms.Field_Types.Alpha; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__adb.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__adb.htm index 8fd67a62..3c8f13a4 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-alphanumeric.adb

    File : terminal_interface-curses-forms-field_types-alphanumeric.adb


    @@ -42,32 +43,32 @@ -- @Revision: 1.8 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric is +package body Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric is - use type Interfaces.C.int; + use type Interfaces.C.int; - procedure Set_Field_Type (Fld : in Field; - Typ : in AlphaNumeric_Field) + procedure Set_Field_Type (Fld : in Field; + Typ : in AlphaNumeric_Field) is - C_AlphaNumeric_Field_Type : C_Field_Type; - pragma Import (C, C_AlphaNumeric_Field_Type, "TYPE_ALNUM"); + C_AlphaNumeric_Field_Type : C_Field_Type; + pragma Import (C, C_AlphaNumeric_Field_Type, "TYPE_ALNUM"); - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := C_AlphaNumeric_Field_Type; - Arg1 : C_Int) return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := C_AlphaNumeric_Field_Type; + Arg1 : C_Int) return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); - Res : Eti_Error; + Res : Eti_Error; begin - Res := Set_Fld_Type (Arg1 => C_Int (Typ.Minimum_Field_Width)); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fld_Type (Arg1 => C_Int (Typ.Minimum_Field_Width)); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Wrap_Builtin (Fld, Typ); - end Set_Field_Type; + Wrap_Builtin (Fld, Typ); + end Set_Field_Type; -end Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric; +end Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm index 42fe480a..c8ec8933 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-alphanumeric__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-alphanumeric.ads

    File : terminal_interface-curses-forms-field_types-alphanumeric.ads


    @@ -42,18 +43,18 @@ -- @Revision: 1.11 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -package Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric is +package Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric is pragma Preelaborate - (Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric); + (Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric); - type AlphaNumeric_Field is new Field_Type + type AlphaNumeric_Field is new Field_Type with record - Minimum_Field_Width : Natural := 0; + Minimum_Field_Width : Natural := 0; end record; - procedure Set_Field_Type (Fld : in Field; - Typ : in AlphaNumeric_Field); + procedure Set_Field_Type (Fld : in Field; + Typ : in AlphaNumeric_Field); pragma Inline (Set_Field_Type); -end Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric; +end Terminal_Interface.Curses.Forms.Field_Types.AlphaNumeric; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm index dcc4909c..cdd62757 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-enumeration-ada.adb

    File : terminal_interface-curses-forms-field_types-enumeration-ada.adb


    @@ -11,7 +12,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -39,47 +40,48 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.7 @ +-- @Revision: 1.10 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Characters.Handling; use Ada.Characters.Handling; -package body Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is +package body Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is - function Create (Set : Type_Set := Mixed_Case; - Case_Sensitive : Boolean := False; - Must_Be_Unique : Boolean := False) - return Enumeration_Field + function Create (Set : Type_Set := Mixed_Case; + Case_Sensitive : Boolean := False; + Must_Be_Unique : Boolean := False) + return Enumeration_Field is - I : Enumeration_Info (T'Pos (T'Last) - T'Pos (T'First) + 1); - J : Positive := 1; + I : Enumeration_Info (T'Pos (T'Last) - T'Pos (T'First) + 1); + J : Positive := 1; begin - I.Case_Sensitive := Case_Sensitive; - I.Match_Must_Be_Unique := Must_Be_Unique; + I.Case_Sensitive := Case_Sensitive; + I.Match_Must_Be_Unique := Must_Be_Unique; - for E in T'Range loop - I.Names (J) := new String'(T'Image (T (E))); + for E in T'Range loop + I.Names (J) := new String'(T'Image (E)); -- The Image attribute defaults to upper case, so we have to handle -- only the other ones... - if Set /= Upper_Case then - I.Names (J).all := To_Lower (I.Names (J).all); - if Set = Mixed_Case then - I.Names (J)(I.Names (J).all'First) := - To_Upper (I.Names (J)(I.Names (J).all'First)); + if Set /= Upper_Case then + I.Names (J).all := To_Lower (I.Names (J).all); + if Set = Mixed_Case then + I.Names (J)(I.Names (J).all'First) := + To_Upper (I.Names (J)(I.Names (J).all'First)); end if; end if; - J := J + 1; + J := J + 1; end loop; - return Create (I, True); - end Create; + return Create (I, True); + end Create; - function Value (Fld : Field; - Buf : Buffer_Number := Buffer_Number'First) return T + function Value (Fld : Field; + Buf : Buffer_Number := Buffer_Number'First) return T is begin - return T'Value (Get_Buffer (Fld, Buf)); - end Value; + return T'Value (Get_Buffer (Fld, Buf)); + end Value; -end Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada; +end Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm index 73b8ec10..d3bc6ff5 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration-ada__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-enumeration-ada.ads

    File : terminal_interface-curses-forms-field_types-enumeration-ada.ads


    @@ -43,22 +44,22 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ generic - type T is (<>); + type T is (<>); -package Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is +package Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada is pragma Preelaborate - (Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada); + (Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada); - function Create (Set : Type_Set := Mixed_Case; - Case_Sensitive : Boolean := False; - Must_Be_Unique : Boolean := False) - return Enumeration_Field; + function Create (Set : Type_Set := Mixed_Case; + Case_Sensitive : Boolean := False; + Must_Be_Unique : Boolean := False) + return Enumeration_Field; - function Value (Fld : Field; - Buf : Buffer_Number := Buffer_Number'First) return T; + function Value (Fld : Field; + Buf : Buffer_Number := Buffer_Number'First) return T; -- Translate the content of the fields buffer - indicated by the -- buffer number - into an enumeration value. If the buffer is empty -- or the content is invalid, a Constraint_Error is raises. -end Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada; +end Terminal_Interface.Curses.Forms.Field_Types.Enumeration.Ada; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__adb.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__adb.htm index 41d7ee74..4be45305 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-enumeration.adb

    File : terminal_interface-curses-forms-field_types-enumeration.adb


    @@ -43,82 +44,82 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; -with Interfaces.C; use Interfaces.C; -with Interfaces.C.Strings; use Interfaces.C.Strings; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; use Interfaces.C; +with Interfaces.C.Strings; use Interfaces.C.Strings; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Forms.Field_Types.Enumeration is +package body Terminal_Interface.Curses.Forms.Field_Types.Enumeration is - function Create (Info : Enumeration_Info; - Auto_Release_Names : Boolean := False) - return Enumeration_Field + function Create (Info : Enumeration_Info; + Auto_Release_Names : Boolean := False) + return Enumeration_Field is - procedure Release_String is + procedure Release_String is new Ada.Unchecked_Deallocation (String, - String_Access); - E : Enumeration_Field; - L : constant size_t := 1 + size_t (Info.C); - S : String_Access; + String_Access); + E : Enumeration_Field; + L : constant size_t := 1 + size_t (Info.C); + S : String_Access; begin - E.Case_Sensitive := Info.Case_Sensitive; - E.Match_Must_Be_Unique := Info.Match_Must_Be_Unique; - E.Arr := new chars_ptr_array (size_t (1) .. L); - for I in 1 .. Positive (L - 1) loop - if Info.Names (I) = null then - raise Form_Exception; + E.Case_Sensitive := Info.Case_Sensitive; + E.Match_Must_Be_Unique := Info.Match_Must_Be_Unique; + E.Arr := new chars_ptr_array (size_t (1) .. L); + for I in 1 .. Positive (L - 1) loop + if Info.Names (I) = null then + raise Form_Exception; end if; - E.Arr (size_t (I)) := New_String (Info.Names (I).all); - if Auto_Release_Names then - S := Info.Names (I); - Release_String (S); + E.Arr (size_t (I)) := New_String (Info.Names (I).all); + if Auto_Release_Names then + S := Info.Names (I); + Release_String (S); end if; end loop; - E.Arr (L) := Null_Ptr; - return E; - end Create; + E.Arr (L) := Null_Ptr; + return E; + end Create; - procedure Release (Enum : in out Enumeration_Field) + procedure Release (Enum : in out Enumeration_Field) is - I : size_t := 0; - P : chars_ptr; + I : size_t := 0; + P : chars_ptr; begin loop - P := Enum.Arr (I); - exit when P = Null_Ptr; - Free (P); - Enum.Arr (I) := Null_Ptr; - I := I + 1; + P := Enum.Arr (I); + exit when P = Null_Ptr; + Free (P); + Enum.Arr (I) := Null_Ptr; + I := I + 1; end loop; - Enum.Arr := null; - end Release; + Enum.Arr := null; + end Release; - procedure Set_Field_Type (Fld : in Field; - Typ : in Enumeration_Field) + procedure Set_Field_Type (Fld : in Field; + Typ : in Enumeration_Field) is - C_Enum_Type : C_Field_Type; - pragma Import (C, C_Enum_Type, "TYPE_ENUM"); + C_Enum_Type : C_Field_Type; + pragma Import (C, C_Enum_Type, "TYPE_ENUM"); - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := C_Enum_Type; - Arg1 : chars_ptr_array; - Arg2 : C_Int; - Arg3 : C_Int) return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := C_Enum_Type; + Arg1 : chars_ptr_array; + Arg2 : C_Int; + Arg3 : C_Int) return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); - Res : Eti_Error; + Res : Eti_Error; begin - if Typ.Arr = null then - raise Form_Exception; + if Typ.Arr = null then + raise Form_Exception; end if; - Res := Set_Fld_Type (Arg1 => Typ.Arr.all, - Arg2 => C_Int (Boolean'Pos (Typ.Case_Sensitive)), - Arg3 => C_Int (Boolean'Pos - (Typ.Match_Must_Be_Unique))); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fld_Type (Arg1 => Typ.Arr.all, + Arg2 => C_Int (Boolean'Pos (Typ.Case_Sensitive)), + Arg3 => C_Int (Boolean'Pos + (Typ.Match_Must_Be_Unique))); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Wrap_Builtin (Fld, Typ, C_Choice_Router); - end Set_Field_Type; + Wrap_Builtin (Fld, Typ, C_Choice_Router); + end Set_Field_Type; -end Terminal_Interface.Curses.Forms.Field_Types.Enumeration; +end Terminal_Interface.Curses.Forms.Field_Types.Enumeration; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm index 1c8eae3e..8ff65ab5 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-enumeration__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-enumeration.ads

    File : terminal_interface-curses-forms-field_types-enumeration.ads


    @@ -42,62 +43,62 @@ -- @Revision: 1.11 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C.Strings; +with Interfaces.C.Strings; -package Terminal_Interface.Curses.Forms.Field_Types.Enumeration is +package Terminal_Interface.Curses.Forms.Field_Types.Enumeration is pragma Preelaborate - (Terminal_Interface.Curses.Forms.Field_Types.Enumeration); + (Terminal_Interface.Curses.Forms.Field_Types.Enumeration); - type String_Access is access String; + type String_Access is access String; -- Type_Set is used by the child package Ada - type Type_Set is (Lower_Case, Upper_Case, Mixed_Case); + type Type_Set is (Lower_Case, Upper_Case, Mixed_Case); - type Enum_Array is array (Positive range <>) - of String_Access; + type Enum_Array is array (Positive range <>) + of String_Access; - type Enumeration_Info (C : Positive) is + type Enumeration_Info (C : Positive) is record - Names : Enum_Array (1 .. C); - Case_Sensitive : Boolean := False; - Match_Must_Be_Unique : Boolean := False; - end record; + Names : Enum_Array (1 .. C); + Case_Sensitive : Boolean := False; + Match_Must_Be_Unique : Boolean := False; + end record; - type Enumeration_Field is new Field_Type with private; + type Enumeration_Field is new Field_Type with private; - function Create (Info : Enumeration_Info; - Auto_Release_Names : Boolean := False) - return Enumeration_Field; + function Create (Info : Enumeration_Info; + Auto_Release_Names : Boolean := False) + return Enumeration_Field; -- Make an fieldtype from the info. Enumerations are special, because -- they normally don't copy the enum values into a private store, so -- we have to care for the lifetime of the info we provide. -- The Auto_Release_Names flag may be used to automatically releases -- the strings in the Names array of the Enumeration_Info. - function Make_Enumeration_Type (Info : Enumeration_Info; - Auto_Release_Names : Boolean := False) - return Enumeration_Field renames Create; + function Make_Enumeration_Type (Info : Enumeration_Info; + Auto_Release_Names : Boolean := False) + return Enumeration_Field renames Create; - procedure Release (Enum : in out Enumeration_Field); + procedure Release (Enum : in out Enumeration_Field); -- But we may want to release the field to release the memory allocated -- by it internally. After that the Enumeration field is no longer usable. -- The next type defintions are all ncurses extensions. They are typically -- not available in other curses implementations. - procedure Set_Field_Type (Fld : in Field; - Typ : in Enumeration_Field); + procedure Set_Field_Type (Fld : in Field; + Typ : in Enumeration_Field); pragma Inline (Set_Field_Type); private - type CPA_Access is access Interfaces.C.Strings.chars_ptr_array; + type CPA_Access is access Interfaces.C.Strings.chars_ptr_array; - type Enumeration_Field is new Field_Type with + type Enumeration_Field is new Field_Type with record - Case_Sensitive : Boolean := False; - Match_Must_Be_Unique : Boolean := False; - Arr : CPA_Access := null; + Case_Sensitive : Boolean := False; + Match_Must_Be_Unique : Boolean := False; + Arr : CPA_Access := null; end record; -end Terminal_Interface.Curses.Forms.Field_Types.Enumeration; +end Terminal_Interface.Curses.Forms.Field_Types.Enumeration; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__adb.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__adb.htm index 89814d5f..88e3fafb 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-intfield.adb

    File : terminal_interface-curses-forms-field_types-intfield.adb


    @@ -42,36 +43,36 @@ -- @Revision: 1.8 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Forms.Field_Types.IntField is +package body Terminal_Interface.Curses.Forms.Field_Types.IntField is - use type Interfaces.C.int; + use type Interfaces.C.int; - procedure Set_Field_Type (Fld : in Field; - Typ : in Integer_Field) + procedure Set_Field_Type (Fld : in Field; + Typ : in Integer_Field) is - C_Integer_Field_Type : C_Field_Type; - pragma Import (C, C_Integer_Field_Type, "TYPE_INTEGER"); + C_Integer_Field_Type : C_Field_Type; + pragma Import (C, C_Integer_Field_Type, "TYPE_INTEGER"); - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := C_Integer_Field_Type; - Arg1 : C_Int; - Arg2 : C_Long_Int; - Arg3 : C_Long_Int) return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := C_Integer_Field_Type; + Arg1 : C_Int; + Arg2 : C_Long_Int; + Arg3 : C_Long_Int) return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); - Res : Eti_Error; + Res : Eti_Error; begin - Res := Set_Fld_Type (Arg1 => C_Int (Typ.Precision), - Arg2 => C_Long_Int (Typ.Lower_Limit), - Arg3 => C_Long_Int (Typ.Upper_Limit)); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fld_Type (Arg1 => C_Int (Typ.Precision), + Arg2 => C_Long_Int (Typ.Lower_Limit), + Arg3 => C_Long_Int (Typ.Upper_Limit)); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Wrap_Builtin (Fld, Typ); - end Set_Field_Type; + Wrap_Builtin (Fld, Typ); + end Set_Field_Type; -end Terminal_Interface.Curses.Forms.Field_Types.IntField; +end Terminal_Interface.Curses.Forms.Field_Types.IntField; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__ads.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__ads.htm index b3a8bd5d..041af8cc 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-intfield__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-intfield.ads

    File : terminal_interface-curses-forms-field_types-intfield.ads


    @@ -42,19 +43,19 @@ -- @Revision: 1.11 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -package Terminal_Interface.Curses.Forms.Field_Types.IntField is - pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.IntField); +package Terminal_Interface.Curses.Forms.Field_Types.IntField is + pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.IntField); - type Integer_Field is new Field_Type with + type Integer_Field is new Field_Type with record - Precision : Natural; - Lower_Limit : Integer; - Upper_Limit : Integer; + Precision : Natural; + Lower_Limit : Integer; + Upper_Limit : Integer; end record; - procedure Set_Field_Type (Fld : in Field; - Typ : in Integer_Field); + procedure Set_Field_Type (Fld : in Field; + Typ : in Integer_Field); pragma Inline (Set_Field_Type); -end Terminal_Interface.Curses.Forms.Field_Types.IntField; +end Terminal_Interface.Curses.Forms.Field_Types.IntField; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__adb.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__adb.htm index 775005df..9c324f01 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-ipv4_address.adb

    File : terminal_interface-curses-forms-field_types-ipv4_address.adb


    @@ -42,32 +43,32 @@ -- @Revision: 1.8 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address is +package body Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address is - use type Interfaces.C.int; + use type Interfaces.C.int; - procedure Set_Field_Type (Fld : in Field; - Typ : in Internet_V4_Address_Field) + procedure Set_Field_Type (Fld : in Field; + Typ : in Internet_V4_Address_Field) is - C_IPV4_Field_Type : C_Field_Type; - pragma Import (C, C_IPV4_Field_Type, "TYPE_IPV4"); + C_IPV4_Field_Type : C_Field_Type; + pragma Import (C, C_IPV4_Field_Type, "TYPE_IPV4"); - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := C_IPV4_Field_Type) - return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := C_IPV4_Field_Type) + return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); - Res : Eti_Error; + Res : Eti_Error; begin - Res := Set_Fld_Type; - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fld_Type; + if Res /= E_Ok then + Eti_Exception (Res); end if; - Wrap_Builtin (Fld, Typ); - end Set_Field_Type; + Wrap_Builtin (Fld, Typ); + end Set_Field_Type; -end Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address; +end Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm index 2e826d5d..b738ce4e 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-ipv4_address__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-ipv4_address.ads

    File : terminal_interface-curses-forms-field_types-ipv4_address.ads


    @@ -42,15 +43,15 @@ -- @Revision: 1.11 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -package Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address is +package Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address is pragma Preelaborate - (Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address); + (Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address); - type Internet_V4_Address_Field is new Field_Type with null record; + type Internet_V4_Address_Field is new Field_Type with null record; - procedure Set_Field_Type (Fld : in Field; - Typ : in Internet_V4_Address_Field); + procedure Set_Field_Type (Fld : in Field; + Typ : in Internet_V4_Address_Field); pragma Inline (Set_Field_Type); -end Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address; +end Terminal_Interface.Curses.Forms.Field_Types.IPV4_Address; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__adb.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__adb.htm index 96f96f2c..8cc540cb 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-numeric.adb

    File : terminal_interface-curses-forms-field_types-numeric.adb


    @@ -42,38 +43,38 @@ -- @Revision: 1.9 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Forms.Field_Types.Numeric is +package body Terminal_Interface.Curses.Forms.Field_Types.Numeric is - use type Interfaces.C.int; + use type Interfaces.C.int; - procedure Set_Field_Type (Fld : in Field; - Typ : in Numeric_Field) + procedure Set_Field_Type (Fld : in Field; + Typ : in Numeric_Field) is - type Double is new Interfaces.C.double; + type Double is new Interfaces.C.double; - C_Numeric_Field_Type : C_Field_Type; - pragma Import (C, C_Numeric_Field_Type, "TYPE_NUMERIC"); + C_Numeric_Field_Type : C_Field_Type; + pragma Import (C, C_Numeric_Field_Type, "TYPE_NUMERIC"); - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := C_Numeric_Field_Type; - Arg1 : C_Int; - Arg2 : Double; - Arg3 : Double) return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := C_Numeric_Field_Type; + Arg1 : C_Int; + Arg2 : Double; + Arg3 : Double) return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); - Res : Eti_Error; + Res : Eti_Error; begin - Res := Set_Fld_Type (Arg1 => C_Int (Typ.Precision), - Arg2 => Double (Typ.Lower_Limit), - Arg3 => Double (Typ.Upper_Limit)); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fld_Type (Arg1 => C_Int (Typ.Precision), + Arg2 => Double (Typ.Lower_Limit), + Arg3 => Double (Typ.Upper_Limit)); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Wrap_Builtin (Fld, Typ); - end Set_Field_Type; + Wrap_Builtin (Fld, Typ); + end Set_Field_Type; -end Terminal_Interface.Curses.Forms.Field_Types.Numeric; +end Terminal_Interface.Curses.Forms.Field_Types.Numeric; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__ads.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__ads.htm index 00749b48..81780889 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-numeric__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-numeric.ads

    File : terminal_interface-curses-forms-field_types-numeric.ads


    @@ -42,19 +43,19 @@ -- @Revision: 1.11 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -package Terminal_Interface.Curses.Forms.Field_Types.Numeric is - pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.Numeric); +package Terminal_Interface.Curses.Forms.Field_Types.Numeric is + pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.Numeric); - type Numeric_Field is new Field_Type with + type Numeric_Field is new Field_Type with record - Precision : Natural; - Lower_Limit : Float; - Upper_Limit : Float; + Precision : Natural; + Lower_Limit : Float; + Upper_Limit : Float; end record; - procedure Set_Field_Type (Fld : in Field; - Typ : in Numeric_Field); + procedure Set_Field_Type (Fld : in Field; + Typ : in Numeric_Field); pragma Inline (Set_Field_Type); -end Terminal_Interface.Curses.Forms.Field_Types.Numeric; +end Terminal_Interface.Curses.Forms.Field_Types.Numeric; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__adb.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__adb.htm index 9c1d534f..72bf7fc2 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-regexp.adb

    File : terminal_interface-curses-forms-field_types-regexp.adb


    @@ -42,35 +43,35 @@ -- @Revision: 1.8 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C; use Interfaces.C; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; use Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Forms.Field_Types.RegExp is +package body Terminal_Interface.Curses.Forms.Field_Types.RegExp is - procedure Set_Field_Type (Fld : in Field; - Typ : in Regular_Expression_Field) + procedure Set_Field_Type (Fld : in Field; + Typ : in Regular_Expression_Field) is - type Char_Ptr is access all Interfaces.C.char; + type Char_Ptr is access all Interfaces.C.char; - C_Regexp_Field_Type : C_Field_Type; - pragma Import (C, C_Regexp_Field_Type, "TYPE_REGEXP"); + C_Regexp_Field_Type : C_Field_Type; + pragma Import (C, C_Regexp_Field_Type, "TYPE_REGEXP"); - function Set_Ftyp (F : Field := Fld; - Cft : C_Field_Type := C_Regexp_Field_Type; - Arg1 : Char_Ptr) return C_Int; - pragma Import (C, Set_Ftyp, "set_field_type"); + function Set_Ftyp (F : Field := Fld; + Cft : C_Field_Type := C_Regexp_Field_Type; + Arg1 : Char_Ptr) return C_Int; + pragma Import (C, Set_Ftyp, "set_field_type"); - Txt : char_array (0 .. Typ.Regular_Expression.all'Length); - Len : size_t; - Res : Eti_Error; + Txt : char_array (0 .. Typ.Regular_Expression.all'Length); + Len : size_t; + Res : Eti_Error; begin - To_C (Typ.Regular_Expression.all, Txt, Len); - Res := Set_Ftyp (Arg1 => Txt (Txt'First)'Access); - if Res /= E_Ok then - Eti_Exception (Res); + To_C (Typ.Regular_Expression.all, Txt, Len); + Res := Set_Ftyp (Arg1 => Txt (Txt'First)'Access); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Wrap_Builtin (Fld, Typ); - end Set_Field_Type; + Wrap_Builtin (Fld, Typ); + end Set_Field_Type; -end Terminal_Interface.Curses.Forms.Field_Types.RegExp; +end Terminal_Interface.Curses.Forms.Field_Types.RegExp; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__ads.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__ads.htm index e52f0400..ec2d741c 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-regexp__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-regexp.ads

    File : terminal_interface-curses-forms-field_types-regexp.ads


    @@ -42,19 +43,19 @@ -- @Revision: 1.11 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -package Terminal_Interface.Curses.Forms.Field_Types.RegExp is - pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.RegExp); +package Terminal_Interface.Curses.Forms.Field_Types.RegExp is + pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.RegExp); - type String_Access is access String; + type String_Access is access String; - type Regular_Expression_Field is new Field_Type with + type Regular_Expression_Field is new Field_Type with record - Regular_Expression : String_Access; + Regular_Expression : String_Access; end record; - procedure Set_Field_Type (Fld : in Field; - Typ : in Regular_Expression_Field); + procedure Set_Field_Type (Fld : in Field; + Typ : in Regular_Expression_Field); pragma Inline (Set_Field_Type); -end Terminal_Interface.Curses.Forms.Field_Types.RegExp; +end Terminal_Interface.Curses.Forms.Field_Types.RegExp; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__adb.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__adb.htm index e9123b00..1a84c5f6 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-user-choice.adb

    File : terminal_interface-curses-forms-field_types-user-choice.adb


    @@ -11,7 +12,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -39,77 +40,78 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.10 @ +-- @Revision: 1.13 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; -with Interfaces.C; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Forms.Field_Types.User.Choice is +package body Terminal_Interface.Curses.Forms.Field_Types.User.Choice is - use type Interfaces.C.int; + use type Interfaces.C.int; - function To_Argument_Access is new Ada.Unchecked_Conversion - (System.Address, Argument_Access); + function To_Argument_Access is new Ada.Unchecked_Conversion + (System.Address, Argument_Access); - function Generic_Next (Fld : Field; - Usr : System.Address) return C_Int + function Generic_Next (Fld : Field; + Usr : System.Address) return C_Int is - Result : Boolean; - Udf : User_Defined_Field_Type_With_Choice_Access := - User_Defined_Field_Type_With_Choice_Access - (To_Argument_Access (Usr).Typ); + Result : Boolean; + Udf : constant User_Defined_Field_Type_With_Choice_Access := + User_Defined_Field_Type_With_Choice_Access + (To_Argument_Access (Usr).Typ); begin - Result := Next (Fld, Udf.all); - return C_Int (Boolean'Pos (Result)); - end Generic_Next; + Result := Next (Fld, Udf.all); + return C_Int (Boolean'Pos (Result)); + end Generic_Next; - function Generic_Prev (Fld : Field; - Usr : System.Address) return C_Int + function Generic_Prev (Fld : Field; + Usr : System.Address) return C_Int is - Result : Boolean; - Udf : User_Defined_Field_Type_With_Choice_Access := - User_Defined_Field_Type_With_Choice_Access - (To_Argument_Access (Usr).Typ); + Result : Boolean; + Udf : constant User_Defined_Field_Type_With_Choice_Access := + User_Defined_Field_Type_With_Choice_Access + (To_Argument_Access (Usr).Typ); begin - Result := Previous (Fld, Udf.all); - return C_Int (Boolean'Pos (Result)); - end Generic_Prev; + Result := Previous (Fld, Udf.all); + return C_Int (Boolean'Pos (Result)); + end Generic_Prev; -- ----------------------------------------------------------------------- -- - function C_Generic_Choice return C_Field_Type + function C_Generic_Choice return C_Field_Type is - Res : Eti_Error; - T : C_Field_Type; + Res : Eti_Error; + T : C_Field_Type; begin - if M_Generic_Choice = Null_Field_Type then - T := New_Fieldtype (Generic_Field_Check'Access, - Generic_Char_Check'Access); - if T = Null_Field_Type then - raise Form_Exception; + if M_Generic_Choice = Null_Field_Type then + T := New_Fieldtype (Generic_Field_Check'Access, + Generic_Char_Check'Access); + if T = Null_Field_Type then + raise Form_Exception; else - Res := Set_Fieldtype_Arg (T, - Make_Arg'Access, - Copy_Arg'Access, - Free_Arg'Access); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fieldtype_Arg (T, + Make_Arg'Access, + Copy_Arg'Access, + Free_Arg'Access); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Res := Set_Fieldtype_Choice (T, - Generic_Next'Access, - Generic_Prev'Access); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fieldtype_Choice (T, + Generic_Next'Access, + Generic_Prev'Access); + if Res /= E_Ok then + Eti_Exception (Res); end if; end if; - M_Generic_Choice := T; + M_Generic_Choice := T; end if; - pragma Assert (M_Generic_Choice /= Null_Field_Type); - return M_Generic_Choice; - end C_Generic_Choice; + pragma Assert (M_Generic_Choice /= Null_Field_Type); + return M_Generic_Choice; + end C_Generic_Choice; -end Terminal_Interface.Curses.Forms.Field_Types.User.Choice; +end Terminal_Interface.Curses.Forms.Field_Types.User.Choice; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm index d9405fa6..ff68b28d 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-user-choice__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-user-choice.ads

    File : terminal_interface-curses-forms-field_types-user-choice.ads


    @@ -42,35 +43,35 @@ -- @Revision: 1.11 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C; +with Interfaces.C; -package Terminal_Interface.Curses.Forms.Field_Types.User.Choice is +package Terminal_Interface.Curses.Forms.Field_Types.User.Choice is pragma Preelaborate - (Terminal_Interface.Curses.Forms.Field_Types.User.Choice); + (Terminal_Interface.Curses.Forms.Field_Types.User.Choice); - use type Interfaces.C.int; - subtype C_Int is Interfaces.C.int; + use type Interfaces.C.int; + subtype C_Int is Interfaces.C.int; - type User_Defined_Field_Type_With_Choice is abstract new - User_Defined_Field_Type with null record; + type User_Defined_Field_Type_With_Choice is abstract new + User_Defined_Field_Type with null record; -- This is the root of the mechanism we use to create field types in -- Ada95 that allow the prev/next mechanism. You should your own type -- derive from this one and implement the Field_Check, Character_Check -- Next and Previous functions for your own type. - type User_Defined_Field_Type_With_Choice_Access is access all - User_Defined_Field_Type_With_Choice'Class; + type User_Defined_Field_Type_With_Choice_Access is access all + User_Defined_Field_Type_With_Choice'Class; - function Next - (Fld : Field; - Typ : User_Defined_Field_Type_With_Choice) return Boolean + function Next + (Fld : Field; + Typ : User_Defined_Field_Type_With_Choice) return Boolean is abstract; -- If True is returned, the function successfully generated a next -- value into the fields buffer. - function Previous - (Fld : Field; - Typ : User_Defined_Field_Type_With_Choice) return Boolean + function Previous + (Fld : Field; + Typ : User_Defined_Field_Type_With_Choice) return Boolean is abstract; -- If True is returned, the function successfully generated a previous -- value into the fields buffer. @@ -79,23 +80,23 @@ -- | Private Part. -- | private - use type Interfaces.C.int; + use type Interfaces.C.int; - function C_Generic_Choice return C_Field_Type; + function C_Generic_Choice return C_Field_Type; - function Generic_Next (Fld : Field; - Usr : System.Address) return C_Int; - pragma Convention (C, Generic_Next); + function Generic_Next (Fld : Field; + Usr : System.Address) return C_Int; + pragma Convention (C, Generic_Next); -- This is the generic next Choice_Function for the low-level fieldtype -- representing all the User_Defined_Field_Type derivates. It routes -- the call to the Next implementation for the type. - function Generic_Prev (Fld : Field; - Usr : System.Address) return C_Int; - pragma Convention (C, Generic_Prev); + function Generic_Prev (Fld : Field; + Usr : System.Address) return C_Int; + pragma Convention (C, Generic_Prev); -- This is the generic prev Choice_Function for the low-level fieldtype -- representing all the User_Defined_Field_Type derivates. It routes -- the call to the Previous implementation for the type. -end Terminal_Interface.Curses.Forms.Field_Types.User.Choice; +end Terminal_Interface.Curses.Forms.Field_Types.User.Choice; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-user__adb.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-user__adb.htm index 3e9f1c71..2a66031c 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-user__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-user__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-user.adb

    File : terminal_interface-curses-forms-field_types-user.adb


    @@ -11,7 +12,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -39,99 +40,101 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.10 @ +-- @Revision: 1.13 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Unchecked_Conversion; -with Interfaces.C; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Forms.Field_Types.User is +package body Terminal_Interface.Curses.Forms.Field_Types.User is - use type Interfaces.C.int; + use type Interfaces.C.int; - procedure Set_Field_Type (Fld : in Field; - Typ : in User_Defined_Field_Type) + procedure Set_Field_Type (Fld : in Field; + Typ : in User_Defined_Field_Type) is - function Allocate_Arg (T : User_Defined_Field_Type'Class) - return Argument_Access; + function Allocate_Arg (T : User_Defined_Field_Type'Class) + return Argument_Access; - function Set_Fld_Type (F : Field := Fld; - Cft : C_Field_Type := C_Generic_Type; - Arg1 : Argument_Access) - return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); + function Set_Fld_Type (F : Field := Fld; + Cft : C_Field_Type := C_Generic_Type; + Arg1 : Argument_Access) + return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); - Res : Eti_Error; + Res : Eti_Error; - function Allocate_Arg (T : User_Defined_Field_Type'Class) - return Argument_Access + function Allocate_Arg (T : User_Defined_Field_Type'Class) + return Argument_Access is - Ptr : Field_Type_Access := new User_Defined_Field_Type'Class'(T); + Ptr : constant Field_Type_Access + := new User_Defined_Field_Type'Class'(T); begin - return new Argument'(Usr => System.Null_Address, - Typ => Ptr, - Cft => Null_Field_Type); - end Allocate_Arg; + return new Argument'(Usr => System.Null_Address, + Typ => Ptr, + Cft => Null_Field_Type); + end Allocate_Arg; begin - Res := Set_Fld_Type (Arg1 => Allocate_Arg (Typ)); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fld_Type (Arg1 => Allocate_Arg (Typ)); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Field_Type; + end Set_Field_Type; - function To_Argument_Access is new Ada.Unchecked_Conversion - (System.Address, Argument_Access); + function To_Argument_Access is new Ada.Unchecked_Conversion + (System.Address, Argument_Access); - function Generic_Field_Check (Fld : Field; - Usr : System.Address) return C_Int + function Generic_Field_Check (Fld : Field; + Usr : System.Address) return C_Int is - Result : Boolean; - Udf : User_Defined_Field_Type_Access := - User_Defined_Field_Type_Access (To_Argument_Access (Usr).Typ); + Result : Boolean; + Udf : constant User_Defined_Field_Type_Access := + User_Defined_Field_Type_Access (To_Argument_Access (Usr).Typ); begin - Result := Field_Check (Fld, Udf.all); - return C_Int (Boolean'Pos (Result)); - end Generic_Field_Check; + Result := Field_Check (Fld, Udf.all); + return C_Int (Boolean'Pos (Result)); + end Generic_Field_Check; - function Generic_Char_Check (Ch : C_Int; - Usr : System.Address) return C_Int + function Generic_Char_Check (Ch : C_Int; + Usr : System.Address) return C_Int is - Result : Boolean; - Udf : User_Defined_Field_Type_Access := - User_Defined_Field_Type_Access (To_Argument_Access (Usr).Typ); + Result : Boolean; + Udf : constant User_Defined_Field_Type_Access := + User_Defined_Field_Type_Access (To_Argument_Access (Usr).Typ); begin - Result := Character_Check (Character'Val (Ch), Udf.all); - return C_Int (Boolean'Pos (Result)); - end Generic_Char_Check; + Result := Character_Check (Character'Val (Ch), Udf.all); + return C_Int (Boolean'Pos (Result)); + end Generic_Char_Check; -- ----------------------------------------------------------------------- -- - function C_Generic_Type return C_Field_Type + function C_Generic_Type return C_Field_Type is - Res : Eti_Error; - T : C_Field_Type; + Res : Eti_Error; + T : C_Field_Type; begin - if M_Generic_Type = Null_Field_Type then - T := New_Fieldtype (Generic_Field_Check'Access, - Generic_Char_Check'Access); - if T = Null_Field_Type then - raise Form_Exception; + if M_Generic_Type = Null_Field_Type then + T := New_Fieldtype (Generic_Field_Check'Access, + Generic_Char_Check'Access); + if T = Null_Field_Type then + raise Form_Exception; else - Res := Set_Fieldtype_Arg (T, - Make_Arg'Access, - Copy_Arg'Access, - Free_Arg'Access); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fieldtype_Arg (T, + Make_Arg'Access, + Copy_Arg'Access, + Free_Arg'Access); + if Res /= E_Ok then + Eti_Exception (Res); end if; end if; - M_Generic_Type := T; + M_Generic_Type := T; end if; - pragma Assert (M_Generic_Type /= Null_Field_Type); - return M_Generic_Type; - end C_Generic_Type; + pragma Assert (M_Generic_Type /= Null_Field_Type); + return M_Generic_Type; + end C_Generic_Type; -end Terminal_Interface.Curses.Forms.Field_Types.User; +end Terminal_Interface.Curses.Forms.Field_Types.User; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types-user__ads.htm b/doc/html/ada/terminal_interface-curses-forms-field_types-user__ads.htm index 2beaef3b..d7ce06a2 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types-user__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types-user__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types-user.ads

    File : terminal_interface-curses-forms-field_types-user.ads


    @@ -42,37 +43,37 @@ -- @Revision: 1.11 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C; +with Interfaces.C; -package Terminal_Interface.Curses.Forms.Field_Types.User is - pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.User); - use type Interfaces.C.int; - subtype C_Int is Interfaces.C.int; +package Terminal_Interface.Curses.Forms.Field_Types.User is + pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types.User); + use type Interfaces.C.int; + subtype C_Int is Interfaces.C.int; - type User_Defined_Field_Type is abstract new Field_Type with null record; + type User_Defined_Field_Type is abstract new Field_Type with null record; -- This is the root of the mechanism we use to create field types in -- Ada95. You should your own type derive from this one and implement -- the Field_Check and Character_Check functions for your own type. - type User_Defined_Field_Type_Access is access all - User_Defined_Field_Type'Class; + type User_Defined_Field_Type_Access is access all + User_Defined_Field_Type'Class; - function Field_Check - (Fld : Field; - Typ : User_Defined_Field_Type) return Boolean + function Field_Check + (Fld : Field; + Typ : User_Defined_Field_Type) return Boolean is abstract; -- If True is returned, the field is considered valid, otherwise it is -- invalid. - function Character_Check - (Ch : Character; - Typ : User_Defined_Field_Type) return Boolean + function Character_Check + (Ch : Character; + Typ : User_Defined_Field_Type) return Boolean is abstract; -- If True is returned, the character is considered as valid for the -- field, otherwise as invalid. - procedure Set_Field_Type (Fld : in Field; - Typ : in User_Defined_Field_Type); + procedure Set_Field_Type (Fld : in Field; + Typ : in User_Defined_Field_Type); -- This should work for all types derived from User_Defined_Field_Type. -- No need to reimplement it for your derived type. @@ -80,23 +81,23 @@ -- | Private Part. -- | Used by the Choice child package. private - use type Interfaces.C.int; + use type Interfaces.C.int; - function C_Generic_Type return C_Field_Type; + function C_Generic_Type return C_Field_Type; - function Generic_Field_Check (Fld : Field; - Usr : System.Address) return C_Int; - pragma Convention (C, Generic_Field_Check); + function Generic_Field_Check (Fld : Field; + Usr : System.Address) return C_Int; + pragma Convention (C, Generic_Field_Check); -- This is the generic Field_Check_Function for the low-level fieldtype -- representing all the User_Defined_Field_Type derivates. It routes -- the call to the Field_Check implementation for the type. - function Generic_Char_Check (Ch : C_Int; - Usr : System.Address) return C_Int; - pragma Convention (C, Generic_Char_Check); + function Generic_Char_Check (Ch : C_Int; + Usr : System.Address) return C_Int; + pragma Convention (C, Generic_Char_Check); -- This is the generic Char_Check_Function for the low-level fieldtype -- representing all the User_Defined_Field_Type derivates. It routes -- the call to the Character_Check implementation for the type. -end Terminal_Interface.Curses.Forms.Field_Types.User; +end Terminal_Interface.Curses.Forms.Field_Types.User; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types__adb.htm b/doc/html/ada/terminal_interface-curses-forms-field_types__adb.htm index aa32d205..46ba8ef9 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types.adb

    File : terminal_interface-curses-forms-field_types.adb


    @@ -11,7 +12,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -39,11 +40,12 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.14 @ +-- @Revision: 1.17 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; with Ada.Unchecked_Deallocation; with Ada.Unchecked_Conversion; -- | @@ -51,19 +53,19 @@ -- | man page form_fieldtype.3x -- |===================================================================== -- | -package body Terminal_Interface.Curses.Forms.Field_Types is +package body Terminal_Interface.Curses.Forms.Field_Types is - use type Interfaces.C.int; + use type Interfaces.C.int; use type System.Address; - function To_Argument_Access is new Ada.Unchecked_Conversion - (System.Address, Argument_Access); + function To_Argument_Access is new Ada.Unchecked_Conversion + (System.Address, Argument_Access); - function Get_Fieldtype (F : Field) return C_Field_Type; - pragma Import (C, Get_Fieldtype, "field_type"); + function Get_Fieldtype (F : Field) return C_Field_Type; + pragma Import (C, Get_Fieldtype, "field_type"); - function Get_Arg (F : Field) return System.Address; - pragma Import (C, Get_Arg, "field_arg"); + function Get_Arg (F : Field) return System.Address; + pragma Import (C, Get_Arg, "field_arg"); -- | -- |===================================================================== -- | man page form_field_validation.3x @@ -71,31 +73,31 @@ -- | -- | -- | - function Get_Type (Fld : in Field) return Field_Type_Access + function Get_Type (Fld : in Field) return Field_Type_Access is - Low_Level : constant C_Field_Type := Get_Fieldtype (Fld); - Arg : Argument_Access; + Low_Level : constant C_Field_Type := Get_Fieldtype (Fld); + Arg : Argument_Access; begin - if Low_Level = Null_Field_Type then + if Low_Level = Null_Field_Type then return null; else - if Low_Level = M_Builtin_Router or else - Low_Level = M_Generic_Type or else - Low_Level = M_Choice_Router or else - Low_Level = M_Generic_Choice then - Arg := To_Argument_Access (Get_Arg (Fld)); - if Arg = null then - raise Form_Exception; + if Low_Level = M_Builtin_Router or else + Low_Level = M_Generic_Type or else + Low_Level = M_Choice_Router or else + Low_Level = M_Generic_Choice then + Arg := To_Argument_Access (Get_Arg (Fld)); + if Arg = null then + raise Form_Exception; else - return Arg.Typ; + return Arg.Typ; end if; else - raise Form_Exception; + raise Form_Exception; end if; end if; - end Get_Type; + end Get_Type; - function Make_Arg (Args : System.Address) return System.Address + function Make_Arg (Args : System.Address) return System.Address is -- Actually args is a double indirected pointer to the arguments -- of a C variable argument list. In theory it is now quite @@ -106,196 +108,196 @@ -- we know its size and for the first arg we don't care about -- into which stack direction we have to proceed. We simply -- resolve the double indirection and thats it. - type V is access all System.Address; - function To_Access is new Ada.Unchecked_Conversion (System.Address, - V); + type V is access all System.Address; + function To_Access is new Ada.Unchecked_Conversion (System.Address, + V); begin - return To_Access (To_Access (Args).all).all; - end Make_Arg; + return To_Access (To_Access (Args).all).all; + end Make_Arg; - function Copy_Arg (Usr : System.Address) return System.Address + function Copy_Arg (Usr : System.Address) return System.Address is begin - return Usr; - end Copy_Arg; + return Usr; + end Copy_Arg; - procedure Free_Arg (Usr : in System.Address) + procedure Free_Arg (Usr : in System.Address) is - procedure Free_Type is new Ada.Unchecked_Deallocation - (Field_Type'Class, Field_Type_Access); - procedure Freeargs is new Ada.Unchecked_Deallocation - (Argument, Argument_Access); + procedure Free_Type is new Ada.Unchecked_Deallocation + (Field_Type'Class, Field_Type_Access); + procedure Freeargs is new Ada.Unchecked_Deallocation + (Argument, Argument_Access); - To_Be_Free : Argument_Access := To_Argument_Access (Usr); - Low_Level : C_Field_Type; + To_Be_Free : Argument_Access := To_Argument_Access (Usr); + Low_Level : C_Field_Type; begin - if To_Be_Free /= null then - if To_Be_Free.Usr /= System.Null_Address then - Low_Level := To_Be_Free.Cft; - if Low_Level.Freearg /= null then - Low_Level.Freearg (To_Be_Free.Usr); + if To_Be_Free /= null then + if To_Be_Free.Usr /= System.Null_Address then + Low_Level := To_Be_Free.Cft; + if Low_Level.Freearg /= null then + Low_Level.Freearg (To_Be_Free.Usr); end if; end if; - if To_Be_Free.Typ /= null then - Free_Type (To_Be_Free.Typ); + if To_Be_Free.Typ /= null then + Free_Type (To_Be_Free.Typ); end if; - Freeargs (To_Be_Free); + Freeargs (To_Be_Free); end if; - end Free_Arg; + end Free_Arg; - procedure Wrap_Builtin (Fld : Field; - Typ : Field_Type'Class; - Cft : C_Field_Type := C_Builtin_Router) + procedure Wrap_Builtin (Fld : Field; + Typ : Field_Type'Class; + Cft : C_Field_Type := C_Builtin_Router) is - Usr_Arg : System.Address := Get_Arg (Fld); - Low_Level : constant C_Field_Type := Get_Fieldtype (Fld); - Arg : Argument_Access; - Res : Eti_Error; - function Set_Fld_Type (F : Field := Fld; - Cf : C_Field_Type := Cft; - Arg1 : Argument_Access) return C_Int; - pragma Import (C, Set_Fld_Type, "set_field_type"); + Usr_Arg : constant System.Address := Get_Arg (Fld); + Low_Level : constant C_Field_Type := Get_Fieldtype (Fld); + Arg : Argument_Access; + Res : Eti_Error; + function Set_Fld_Type (F : Field := Fld; + Cf : C_Field_Type := Cft; + Arg1 : Argument_Access) return C_Int; + pragma Import (C, Set_Fld_Type, "set_field_type"); begin - pragma Assert (Low_Level /= Null_Field_Type); - if Cft /= C_Builtin_Router and then Cft /= C_Choice_Router then - raise Form_Exception; + pragma Assert (Low_Level /= Null_Field_Type); + if Cft /= C_Builtin_Router and then Cft /= C_Choice_Router then + raise Form_Exception; else - Arg := new Argument'(Usr => System.Null_Address, - Typ => new Field_Type'Class'(Typ), - Cft => Get_Fieldtype (Fld)); - if Usr_Arg /= System.Null_Address then - if Low_Level.Copyarg /= null then - Arg.Usr := Low_Level.Copyarg (Usr_Arg); + Arg := new Argument'(Usr => System.Null_Address, + Typ => new Field_Type'Class'(Typ), + Cft => Get_Fieldtype (Fld)); + if Usr_Arg /= System.Null_Address then + if Low_Level.Copyarg /= null then + Arg.Usr := Low_Level.Copyarg (Usr_Arg); else - Arg.Usr := Usr_Arg; + Arg.Usr := Usr_Arg; end if; end if; - Res := Set_Fld_Type (Arg1 => Arg); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fld_Type (Arg1 => Arg); + if Res /= E_Ok then + Eti_Exception (Res); end if; end if; - end Wrap_Builtin; + end Wrap_Builtin; - function Field_Check_Router (Fld : Field; - Usr : System.Address) return C_Int + function Field_Check_Router (Fld : Field; + Usr : System.Address) return C_Int is - Arg : constant Argument_Access := To_Argument_Access (Usr); + Arg : constant Argument_Access := To_Argument_Access (Usr); begin - pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type - and then Arg.Typ /= null); - if Arg.Cft.Fcheck /= null then - return Arg.Cft.Fcheck (Fld, Arg.Usr); + pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type + and then Arg.Typ /= null); + if Arg.Cft.Fcheck /= null then + return Arg.Cft.Fcheck (Fld, Arg.Usr); else return 1; end if; - end Field_Check_Router; + end Field_Check_Router; - function Char_Check_Router (Ch : C_Int; - Usr : System.Address) return C_Int + function Char_Check_Router (Ch : C_Int; + Usr : System.Address) return C_Int is - Arg : constant Argument_Access := To_Argument_Access (Usr); + Arg : constant Argument_Access := To_Argument_Access (Usr); begin - pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type - and then Arg.Typ /= null); - if Arg.Cft.Ccheck /= null then - return Arg.Cft.Ccheck (Ch, Arg.Usr); + pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type + and then Arg.Typ /= null); + if Arg.Cft.Ccheck /= null then + return Arg.Cft.Ccheck (Ch, Arg.Usr); else return 1; end if; - end Char_Check_Router; + end Char_Check_Router; - function Next_Router (Fld : Field; - Usr : System.Address) return C_Int + function Next_Router (Fld : Field; + Usr : System.Address) return C_Int is - Arg : constant Argument_Access := To_Argument_Access (Usr); + Arg : constant Argument_Access := To_Argument_Access (Usr); begin - pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type - and then Arg.Typ /= null); - if Arg.Cft.Next /= null then - return Arg.Cft.Next (Fld, Arg.Usr); + pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type + and then Arg.Typ /= null); + if Arg.Cft.Next /= null then + return Arg.Cft.Next (Fld, Arg.Usr); else return 1; end if; - end Next_Router; + end Next_Router; - function Prev_Router (Fld : Field; - Usr : System.Address) return C_Int + function Prev_Router (Fld : Field; + Usr : System.Address) return C_Int is - Arg : constant Argument_Access := To_Argument_Access (Usr); + Arg : constant Argument_Access := To_Argument_Access (Usr); begin - pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type - and then Arg.Typ /= null); - if Arg.Cft.Prev /= null then - return Arg.Cft.Prev (Fld, Arg.Usr); + pragma Assert (Arg /= null and then Arg.Cft /= Null_Field_Type + and then Arg.Typ /= null); + if Arg.Cft.Prev /= null then + return Arg.Cft.Prev (Fld, Arg.Usr); else return 1; end if; - end Prev_Router; + end Prev_Router; -- ----------------------------------------------------------------------- -- - function C_Builtin_Router return C_Field_Type + function C_Builtin_Router return C_Field_Type is - Res : Eti_Error; - T : C_Field_Type; + Res : Eti_Error; + T : C_Field_Type; begin - if M_Builtin_Router = Null_Field_Type then - T := New_Fieldtype (Field_Check_Router'Access, - Char_Check_Router'Access); - if T = Null_Field_Type then - raise Form_Exception; + if M_Builtin_Router = Null_Field_Type then + T := New_Fieldtype (Field_Check_Router'Access, + Char_Check_Router'Access); + if T = Null_Field_Type then + raise Form_Exception; else - Res := Set_Fieldtype_Arg (T, - Make_Arg'Access, - Copy_Arg'Access, - Free_Arg'Access); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fieldtype_Arg (T, + Make_Arg'Access, + Copy_Arg'Access, + Free_Arg'Access); + if Res /= E_Ok then + Eti_Exception (Res); end if; end if; - M_Builtin_Router := T; + M_Builtin_Router := T; end if; - pragma Assert (M_Builtin_Router /= Null_Field_Type); - return M_Builtin_Router; - end C_Builtin_Router; + pragma Assert (M_Builtin_Router /= Null_Field_Type); + return M_Builtin_Router; + end C_Builtin_Router; -- ----------------------------------------------------------------------- -- - function C_Choice_Router return C_Field_Type + function C_Choice_Router return C_Field_Type is - Res : Eti_Error; - T : C_Field_Type; + Res : Eti_Error; + T : C_Field_Type; begin - if M_Choice_Router = Null_Field_Type then - T := New_Fieldtype (Field_Check_Router'Access, - Char_Check_Router'Access); - if T = Null_Field_Type then - raise Form_Exception; + if M_Choice_Router = Null_Field_Type then + T := New_Fieldtype (Field_Check_Router'Access, + Char_Check_Router'Access); + if T = Null_Field_Type then + raise Form_Exception; else - Res := Set_Fieldtype_Arg (T, - Make_Arg'Access, - Copy_Arg'Access, - Free_Arg'Access); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fieldtype_Arg (T, + Make_Arg'Access, + Copy_Arg'Access, + Free_Arg'Access); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Res := Set_Fieldtype_Choice (T, - Next_Router'Access, - Prev_Router'Access); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Fieldtype_Choice (T, + Next_Router'Access, + Prev_Router'Access); + if Res /= E_Ok then + Eti_Exception (Res); end if; end if; - M_Choice_Router := T; + M_Choice_Router := T; end if; - pragma Assert (M_Choice_Router /= Null_Field_Type); - return M_Choice_Router; - end C_Choice_Router; + pragma Assert (M_Choice_Router /= Null_Field_Type); + return M_Choice_Router; + end C_Choice_Router; -end Terminal_Interface.Curses.Forms.Field_Types; +end Terminal_Interface.Curses.Forms.Field_Types; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_types__ads.htm b/doc/html/ada/terminal_interface-curses-forms-field_types__ads.htm index b0388f1d..86927ddb 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_types__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_types__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_types.ads

    File : terminal_interface-curses-forms-field_types.ads


    @@ -47,7 +48,7 @@ package Terminal_Interface.Curses.Forms.Field_Types is pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_Types); - use type Interfaces.C.int; + use type Interfaces.C.int; subtype C_Int is Interfaces.C.int; -- |===================================================================== @@ -68,7 +69,7 @@ type Field_Type_Access is access all Field_Type'Class; -- #1A NAME="AFU_1"#2| - procedure Set_Field_Type (Fld : in Field; + procedure Set_Field_Type (Fld : in Field; Fld_Type : in Field_Type) is abstract; -- AKA: set_field_type() -- But: we hide the vararg mechanism of the C interface. You always @@ -106,12 +107,12 @@ procedure (Usr : System.Address); pragma Convention (C, Freearg_Function); - type Field_Check_Function is access + type Field_Check_Function is access function (Fld : Field; Usr : System.Address) return C_Int; pragma Convention (C, Field_Check_Function); - type Char_Check_Function is access - function (Ch : C_Int; Usr : System.Address) return C_Int; + type Char_Check_Function is access + function (Ch : C_Int; Usr : System.Address) return C_Int; pragma Convention (C, Char_Check_Function); type Choice_Function is access @@ -123,14 +124,14 @@ -- | type Low_Level_Field_Type is record - Status : Interfaces.C.short; - Ref_Count : Interfaces.C.long; - Left, Right : System.Address; - Makearg : Makearg_Function; - Copyarg : Copyarg_Function; - Freearg : Freearg_Function; - Fcheck : Field_Check_Function; - Ccheck : Char_Check_Function; + Status : Interfaces.C.short; + Ref_Count : Interfaces.C.long; + Left, Right : System.Address; + Makearg : Makearg_Function; + Copyarg : Copyarg_Function; + Freearg : Freearg_Function; + Fcheck : Field_Check_Function; + Ccheck : Char_Check_Function; Next, Prev : Choice_Function; end record; pragma Convention (C, Low_Level_Field_Type); @@ -143,18 +144,18 @@ -- | fieldtypes handled by this binding. Any other low-level fieldtype -- | will result in a Form_Exception is function Get_Type. -- | - M_Generic_Type : C_Field_Type := null; - M_Generic_Choice : C_Field_Type := null; - M_Builtin_Router : C_Field_Type := null; + M_Generic_Type : C_Field_Type := null; + M_Generic_Choice : C_Field_Type := null; + M_Builtin_Router : C_Field_Type := null; M_Choice_Router : C_Field_Type := null; -- Two wrapper functions to access those low-level fieldtypes defined -- in this package. - function C_Builtin_Router return C_Field_Type; + function C_Builtin_Router return C_Field_Type; function C_Choice_Router return C_Field_Type; - procedure Wrap_Builtin (Fld : Field; - Typ : Field_Type'Class; + procedure Wrap_Builtin (Fld : Field; + Typ : Field_Type'Class; Cft : C_Field_Type := C_Builtin_Router); -- This procedure has to be called by the Set_Field_Type implementation -- for builtin low-level fieldtypes to replace it by an Ada95 @@ -169,7 +170,7 @@ -- This is the Makearg_Function for the internal low-level types -- introduced by this binding. - function Copy_Arg (Usr : System.Address) return System.Address; + function Copy_Arg (Usr : System.Address) return System.Address; pragma Convention (C, Copy_Arg); -- This is the Copyarg_Function for the internal low-level types -- introduced by this binding. @@ -179,32 +180,32 @@ -- This is the Freearg_Function for the internal low-level types -- introduced by this binding. - function Field_Check_Router (Fld : Field; - Usr : System.Address) return C_Int; + function Field_Check_Router (Fld : Field; + Usr : System.Address) return C_Int; pragma Convention (C, Field_Check_Router); -- This is the Field_Check_Function for the internal low-level types -- introduced to wrap the low-level types by a Field_Type derived -- type. It routes the call to the corresponding low-level validation -- function. - function Char_Check_Router (Ch : C_Int; - Usr : System.Address) return C_Int; + function Char_Check_Router (Ch : C_Int; + Usr : System.Address) return C_Int; pragma Convention (C, Char_Check_Router); -- This is the Char_Check_Function for the internal low-level types -- introduced to wrap the low-level types by a Field_Type derived -- type. It routes the call to the corresponding low-level validation -- function. - function Next_Router (Fld : Field; - Usr : System.Address) return C_Int; + function Next_Router (Fld : Field; + Usr : System.Address) return C_Int; pragma Convention (C, Next_Router); -- This is the Choice_Function for the internal low-level types -- introduced to wrap the low-level types by a Field_Type derived -- type. It routes the call to the corresponding low-level next_choice -- function. - function Prev_Router (Fld : Field; - Usr : System.Address) return C_Int; + function Prev_Router (Fld : Field; + Usr : System.Address) return C_Int; pragma Convention (C, Prev_Router); -- This is the Choice_Function for the internal low-level types -- introduced to wrap the low-level types by a Field_Type derived @@ -214,8 +215,8 @@ -- This is the Argument structure maintained by all low-level field types -- introduced by this binding. type Argument is record - Typ : Field_Type_Access; -- the Field_Type creating this record - Usr : System.Address; -- original arg for builtin low-level types + Typ : Field_Type_Access; -- the Field_Type creating this record + Usr : System.Address; -- original arg for builtin low-level types Cft : C_Field_Type; -- the original low-level type end record; type Argument_Access is access all Argument; @@ -224,20 +225,20 @@ -- | -- | Some Imports of libform routines to deal with low-level fieldtypes. -- | - function New_Fieldtype (Fcheck : Field_Check_Function; - Ccheck : Char_Check_Function) + function New_Fieldtype (Fcheck : Field_Check_Function; + Ccheck : Char_Check_Function) return C_Field_Type; pragma Import (C, New_Fieldtype, "new_fieldtype"); - function Set_Fieldtype_Arg (Cft : C_Field_Type; - Mak : Makearg_Function := Make_Arg'Access; - Cop : Copyarg_Function := Copy_Arg'Access; - Fre : Freearg_Function := Free_Arg'Access) + function Set_Fieldtype_Arg (Cft : C_Field_Type; + Mak : Makearg_Function := Make_Arg'Access; + Cop : Copyarg_Function := Copy_Arg'Access; + Fre : Freearg_Function := Free_Arg'Access) return C_Int; pragma Import (C, Set_Fieldtype_Arg, "set_fieldtype_arg"); - function Set_Fieldtype_Choice (Cft : C_Field_Type; - Next, Prev : Choice_Function) + function Set_Fieldtype_Choice (Cft : C_Field_Type; + Next, Prev : Choice_Function) return C_Int; pragma Import (C, Set_Fieldtype_Choice, "set_fieldtype_choice"); diff --git a/doc/html/ada/terminal_interface-curses-forms-field_user_data__adb.htm b/doc/html/ada/terminal_interface-curses-forms-field_user_data__adb.htm index 34a3b2fd..5cc2b610 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_user_data__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_user_data__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_user_data.adb

    File : terminal_interface-curses-forms-field_user_data.adb


    @@ -42,49 +43,49 @@ -- @Revision: 1.12 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -- | -- |===================================================================== -- | man page form_field_userptr.3x -- |===================================================================== -- | -package body Terminal_Interface.Curses.Forms.Field_User_Data is +package body Terminal_Interface.Curses.Forms.Field_User_Data is -- | -- | -- | - use type Interfaces.C.int; + use type Interfaces.C.int; - procedure Set_User_Data (Fld : in Field; - Data : in User_Access) + procedure Set_User_Data (Fld : in Field; + Data : in User_Access) is - function Set_Field_Userptr (Fld : Field; - Usr : User_Access) return C_Int; - pragma Import (C, Set_Field_Userptr, "set_field_userptr"); + function Set_Field_Userptr (Fld : Field; + Usr : User_Access) return C_Int; + pragma Import (C, Set_Field_Userptr, "set_field_userptr"); - Res : constant Eti_Error := Set_Field_Userptr (Fld, Data); + Res : constant Eti_Error := Set_Field_Userptr (Fld, Data); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_User_Data; + end Set_User_Data; -- | -- | -- | - function Get_User_Data (Fld : in Field) return User_Access + function Get_User_Data (Fld : in Field) return User_Access is - function Field_Userptr (Fld : Field) return User_Access; - pragma Import (C, Field_Userptr, "field_userptr"); + function Field_Userptr (Fld : Field) return User_Access; + pragma Import (C, Field_Userptr, "field_userptr"); begin - return Field_Userptr (Fld); - end Get_User_Data; + return Field_Userptr (Fld); + end Get_User_Data; - procedure Get_User_Data (Fld : in Field; - Data : out User_Access) + procedure Get_User_Data (Fld : in Field; + Data : out User_Access) is begin - Data := Get_User_Data (Fld); - end Get_User_Data; + Data := Get_User_Data (Fld); + end Get_User_Data; -end Terminal_Interface.Curses.Forms.Field_User_Data; +end Terminal_Interface.Curses.Forms.Field_User_Data; diff --git a/doc/html/ada/terminal_interface-curses-forms-field_user_data__ads.htm b/doc/html/ada/terminal_interface-curses-forms-field_user_data__ads.htm index de086738..f506ab5d 100644 --- a/doc/html/ada/terminal_interface-curses-forms-field_user_data__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-field_user_data__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-field_user_data.ads

    File : terminal_interface-curses-forms-field_user_data.ads


    @@ -45,8 +46,8 @@ ------------------------------------------------------------------------------ generic - type User is limited private; - type User_Access is access User; + type User is limited private; + type User_Access is access User; package Terminal_Interface.Curses.Forms.Field_User_Data is pragma Preelaborate (Terminal_Interface.Curses.Forms.Field_User_Data); @@ -55,13 +56,13 @@ -- |===================================================================== -- #1A NAME="AFU_1"#2| - procedure Set_User_Data (Fld : in Field; + procedure Set_User_Data (Fld : in Field; Data : in User_Access); -- AKA: set_field_userptr pragma Inline (Set_User_Data); -- #1A NAME="AFU_2"#2| - procedure Get_User_Data (Fld : in Field; + procedure Get_User_Data (Fld : in Field; Data : out User_Access); -- AKA: field_userptr diff --git a/doc/html/ada/terminal_interface-curses-forms-form_user_data__adb.htm b/doc/html/ada/terminal_interface-curses-forms-form_user_data__adb.htm index c1208aaf..fcb25bf1 100644 --- a/doc/html/ada/terminal_interface-curses-forms-form_user_data__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms-form_user_data__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-form_user_data.adb

    File : terminal_interface-curses-forms-form_user_data.adb


    @@ -47,45 +48,45 @@ -- | man page form__userptr.3x -- |===================================================================== -- | -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Forms.Form_User_Data is +package body Terminal_Interface.Curses.Forms.Form_User_Data is - use type Interfaces.C.int; + use type Interfaces.C.int; -- | -- | -- | - procedure Set_User_Data (Frm : in Form; - Data : in User_Access) + procedure Set_User_Data (Frm : in Form; + Data : in User_Access) is - function Set_Form_Userptr (Frm : Form; - Data : User_Access) return C_Int; - pragma Import (C, Set_Form_Userptr, "set_form_userptr"); + function Set_Form_Userptr (Frm : Form; + Data : User_Access) return C_Int; + pragma Import (C, Set_Form_Userptr, "set_form_userptr"); - Res : constant Eti_Error := Set_Form_Userptr (Frm, Data); + Res : constant Eti_Error := Set_Form_Userptr (Frm, Data); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_User_Data; + end Set_User_Data; -- | -- | -- | - function Get_User_Data (Frm : in Form) return User_Access + function Get_User_Data (Frm : in Form) return User_Access is - function Form_Userptr (Frm : Form) return User_Access; - pragma Import (C, Form_Userptr, "form_userptr"); + function Form_Userptr (Frm : Form) return User_Access; + pragma Import (C, Form_Userptr, "form_userptr"); begin - return Form_Userptr (Frm); - end Get_User_Data; + return Form_Userptr (Frm); + end Get_User_Data; - procedure Get_User_Data (Frm : in Form; - Data : out User_Access) + procedure Get_User_Data (Frm : in Form; + Data : out User_Access) is begin - Data := Get_User_Data (Frm); - end Get_User_Data; + Data := Get_User_Data (Frm); + end Get_User_Data; -end Terminal_Interface.Curses.Forms.Form_User_Data; +end Terminal_Interface.Curses.Forms.Form_User_Data; diff --git a/doc/html/ada/terminal_interface-curses-forms-form_user_data__ads.htm b/doc/html/ada/terminal_interface-curses-forms-form_user_data__ads.htm index 51045176..5948120a 100644 --- a/doc/html/ada/terminal_interface-curses-forms-form_user_data__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms-form_user_data__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms-form_user_data.ads

    File : terminal_interface-curses-forms-form_user_data.ads


    @@ -45,8 +46,8 @@ ------------------------------------------------------------------------------ generic - type User is limited private; - type User_Access is access User; + type User is limited private; + type User_Access is access User; package Terminal_Interface.Curses.Forms.Form_User_Data is pragma Preelaborate (Terminal_Interface.Curses.Forms.Form_User_Data); @@ -55,13 +56,13 @@ -- |===================================================================== -- #1A NAME="AFU_1"#2| - procedure Set_User_Data (Frm : in Form; + procedure Set_User_Data (Frm : in Form; Data : in User_Access); -- AKA: set_form_userptr pragma Inline (Set_User_Data); -- #1A NAME="AFU_2"#2| - procedure Get_User_Data (Frm : in Form; + procedure Get_User_Data (Frm : in Form; Data : out User_Access); -- AKA: form_userptr diff --git a/doc/html/ada/terminal_interface-curses-forms__adb.htm b/doc/html/ada/terminal_interface-curses-forms__adb.htm index eb24f811..cb5ab311 100644 --- a/doc/html/ada/terminal_interface-curses-forms__adb.htm +++ b/doc/html/ada/terminal_interface-curses-forms__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms.adb

    File : terminal_interface-curses-forms.adb


    @@ -11,7 +12,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -39,25 +40,26 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.22 @ +-- @Revision: 1.25 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; with Ada.Unchecked_Conversion; -with Interfaces.C; use Interfaces.C; -with Interfaces.C.Strings; use Interfaces.C.Strings; -with Interfaces.C.Pointers; +with Interfaces.C; use Interfaces.C; +with Interfaces.C.Strings; use Interfaces.C.Strings; +with Interfaces.C.Pointers; -with Terminal_Interface.Curses.Aux; +with Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Forms is +package body Terminal_Interface.Curses.Forms is - use Terminal_Interface.Curses.Aux; + use Terminal_Interface.Curses.Aux; - type C_Field_Array is array (Natural range <>) of aliased Field; - package F_Array is new - Interfaces.C.Pointers (Natural, Field, C_Field_Array, Null_Field); + type C_Field_Array is array (Natural range <>) of aliased Field; + package F_Array is new + Interfaces.C.Pointers (Natural, Field, C_Field_Array, Null_Field); ------------------------------------------------------------------------------ -- | @@ -65,38 +67,38 @@ -- | -- subtype chars_ptr is Interfaces.C.Strings.chars_ptr; - function FOS_2_CInt is new - Ada.Unchecked_Conversion (Field_Option_Set, - C_Int); + function FOS_2_CInt is new + Ada.Unchecked_Conversion (Field_Option_Set, + C_Int); - function CInt_2_FOS is new - Ada.Unchecked_Conversion (C_Int, - Field_Option_Set); + function CInt_2_FOS is new + Ada.Unchecked_Conversion (C_Int, + Field_Option_Set); - function FrmOS_2_CInt is new - Ada.Unchecked_Conversion (Form_Option_Set, - C_Int); + function FrmOS_2_CInt is new + Ada.Unchecked_Conversion (Form_Option_Set, + C_Int); - function CInt_2_FrmOS is new - Ada.Unchecked_Conversion (C_Int, - Form_Option_Set); + function CInt_2_FrmOS is new + Ada.Unchecked_Conversion (C_Int, + Form_Option_Set); - procedure Request_Name (Key : in Form_Request_Code; - Name : out String) + procedure Request_Name (Key : in Form_Request_Code; + Name : out String) is - function Form_Request_Name (Key : C_Int) return chars_ptr; - pragma Import (C, Form_Request_Name, "form_request_name"); + function Form_Request_Name (Key : C_Int) return chars_ptr; + pragma Import (C, Form_Request_Name, "form_request_name"); begin - Fill_String (Form_Request_Name (C_Int (Key)), Name); - end Request_Name; + Fill_String (Form_Request_Name (C_Int (Key)), Name); + end Request_Name; - function Request_Name (Key : Form_Request_Code) return String + function Request_Name (Key : Form_Request_Code) return String is - function Form_Request_Name (Key : C_Int) return chars_ptr; - pragma Import (C, Form_Request_Name, "form_request_name"); + function Form_Request_Name (Key : C_Int) return chars_ptr; + pragma Import (C, Form_Request_Name, "form_request_name"); begin - return Fill_String (Form_Request_Name (C_Int (Key))); - end Request_Name; + return Fill_String (Form_Request_Name (C_Int (Key))); + end Request_Name; ------------------------------------------------------------------------------ -- | -- | @@ -108,84 +110,84 @@ -- | -- | -- | - function Create (Height : Line_Count; - Width : Column_Count; - Top : Line_Position; - Left : Column_Position; - Off_Screen : Natural := 0; - More_Buffers : Buffer_Number := Buffer_Number'First) - return Field + function Create (Height : Line_Count; + Width : Column_Count; + Top : Line_Position; + Left : Column_Position; + Off_Screen : Natural := 0; + More_Buffers : Buffer_Number := Buffer_Number'First) + return Field is - function Newfield (H, W, T, L, O, M : C_Int) return Field; - pragma Import (C, Newfield, "new_field"); - Fld : constant Field := Newfield (C_Int (Height), C_Int (Width), - C_Int (Top), C_Int (Left), - C_Int (Off_Screen), - C_Int (More_Buffers)); + function Newfield (H, W, T, L, O, M : C_Int) return Field; + pragma Import (C, Newfield, "new_field"); + Fld : constant Field := Newfield (C_Int (Height), C_Int (Width), + C_Int (Top), C_Int (Left), + C_Int (Off_Screen), + C_Int (More_Buffers)); begin - if Fld = Null_Field then - raise Form_Exception; + if Fld = Null_Field then + raise Form_Exception; end if; - return Fld; - end Create; + return Fld; + end Create; -- | -- | -- | - procedure Delete (Fld : in out Field) + procedure Delete (Fld : in out Field) is - function Free_Field (Fld : Field) return C_Int; - pragma Import (C, Free_Field, "free_field"); + function Free_Field (Fld : Field) return C_Int; + pragma Import (C, Free_Field, "free_field"); - Res : Eti_Error; + Res : Eti_Error; begin - Res := Free_Field (Fld); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Free_Field (Fld); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Fld := Null_Field; - end Delete; + Fld := Null_Field; + end Delete; -- | -- | -- | - function Duplicate (Fld : Field; - Top : Line_Position; - Left : Column_Position) return Field + function Duplicate (Fld : Field; + Top : Line_Position; + Left : Column_Position) return Field is - function Dup_Field (Fld : Field; - Top : C_Int; - Left : C_Int) return Field; - pragma Import (C, Dup_Field, "dup_field"); - - F : constant Field := Dup_Field (Fld, - C_Int (Top), - C_Int (Left)); + function Dup_Field (Fld : Field; + Top : C_Int; + Left : C_Int) return Field; + pragma Import (C, Dup_Field, "dup_field"); + + F : constant Field := Dup_Field (Fld, + C_Int (Top), + C_Int (Left)); begin - if F = Null_Field then - raise Form_Exception; + if F = Null_Field then + raise Form_Exception; end if; - return F; - end Duplicate; + return F; + end Duplicate; -- | -- | -- | - function Link (Fld : Field; - Top : Line_Position; - Left : Column_Position) return Field + function Link (Fld : Field; + Top : Line_Position; + Left : Column_Position) return Field is - function Lnk_Field (Fld : Field; - Top : C_Int; - Left : C_Int) return Field; - pragma Import (C, Lnk_Field, "link_field"); - - F : constant Field := Lnk_Field (Fld, - C_Int (Top), - C_Int (Left)); + function Lnk_Field (Fld : Field; + Top : C_Int; + Left : C_Int) return Field; + pragma Import (C, Lnk_Field, "link_field"); + + F : constant Field := Lnk_Field (Fld, + C_Int (Top), + C_Int (Left)); begin - if F = Null_Field then - raise Form_Exception; + if F = Null_Field then + raise Form_Exception; end if; - return F; - end Link; + return F; + end Link; -- | -- |===================================================================== -- | man page form_field_just.3x @@ -193,31 +195,31 @@ -- | -- | -- | - procedure Set_Justification (Fld : in Field; - Just : in Field_Justification := None) + procedure Set_Justification (Fld : in Field; + Just : in Field_Justification := None) is - function Set_Field_Just (Fld : Field; - Just : C_Int) return C_Int; - pragma Import (C, Set_Field_Just, "set_field_just"); + function Set_Field_Just (Fld : Field; + Just : C_Int) return C_Int; + pragma Import (C, Set_Field_Just, "set_field_just"); - Res : constant Eti_Error := - Set_Field_Just (Fld, - C_Int (Field_Justification'Pos (Just))); + Res : constant Eti_Error := + Set_Field_Just (Fld, + C_Int (Field_Justification'Pos (Just))); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Justification; + end Set_Justification; -- | -- | -- | - function Get_Justification (Fld : Field) return Field_Justification + function Get_Justification (Fld : Field) return Field_Justification is - function Field_Just (Fld : Field) return C_Int; - pragma Import (C, Field_Just, "field_just"); + function Field_Just (Fld : Field) return C_Int; + pragma Import (C, Field_Just, "field_just"); begin - return Field_Justification'Val (Field_Just (Fld)); - end Get_Justification; + return Field_Justification'Val (Field_Just (Fld)); + end Get_Justification; -- | -- |===================================================================== -- | man page form_field_buffer.3x @@ -225,101 +227,101 @@ -- | -- | -- | - procedure Set_Buffer - (Fld : in Field; - Buffer : in Buffer_Number := Buffer_Number'First; - Str : in String) + procedure Set_Buffer + (Fld : in Field; + Buffer : in Buffer_Number := Buffer_Number'First; + Str : in String) is - type Char_Ptr is access all Interfaces.C.char; - function Set_Fld_Buffer (Fld : Field; - Bufnum : C_Int; - S : Char_Ptr) - return C_Int; - pragma Import (C, Set_Fld_Buffer, "set_field_buffer"); - - Txt : char_array (0 .. Str'Length); - Len : size_t; - Res : Eti_Error; + type Char_Ptr is access all Interfaces.C.char; + function Set_Fld_Buffer (Fld : Field; + Bufnum : C_Int; + S : Char_Ptr) + return C_Int; + pragma Import (C, Set_Fld_Buffer, "set_field_buffer"); + + Txt : char_array (0 .. Str'Length); + Len : size_t; + Res : Eti_Error; begin - To_C (Str, Txt, Len); - Res := Set_Fld_Buffer (Fld, C_Int (Buffer), Txt (Txt'First)'Access); - if Res /= E_Ok then - Eti_Exception (Res); + To_C (Str, Txt, Len); + Res := Set_Fld_Buffer (Fld, C_Int (Buffer), Txt (Txt'First)'Access); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Buffer; + end Set_Buffer; -- | -- | -- | - procedure Get_Buffer - (Fld : in Field; - Buffer : in Buffer_Number := Buffer_Number'First; - Str : out String) + procedure Get_Buffer + (Fld : in Field; + Buffer : in Buffer_Number := Buffer_Number'First; + Str : out String) is - function Field_Buffer (Fld : Field; - B : C_Int) return chars_ptr; - pragma Import (C, Field_Buffer, "field_buffer"); + function Field_Buffer (Fld : Field; + B : C_Int) return chars_ptr; + pragma Import (C, Field_Buffer, "field_buffer"); begin - Fill_String (Field_Buffer (Fld, C_Int (Buffer)), Str); - end Get_Buffer; + Fill_String (Field_Buffer (Fld, C_Int (Buffer)), Str); + end Get_Buffer; - function Get_Buffer - (Fld : in Field; - Buffer : in Buffer_Number := Buffer_Number'First) return String + function Get_Buffer + (Fld : in Field; + Buffer : in Buffer_Number := Buffer_Number'First) return String is - function Field_Buffer (Fld : Field; - B : C_Int) return chars_ptr; - pragma Import (C, Field_Buffer, "field_buffer"); + function Field_Buffer (Fld : Field; + B : C_Int) return chars_ptr; + pragma Import (C, Field_Buffer, "field_buffer"); begin - return Fill_String (Field_Buffer (Fld, C_Int (Buffer))); - end Get_Buffer; + return Fill_String (Field_Buffer (Fld, C_Int (Buffer))); + end Get_Buffer; -- | -- | -- | - procedure Set_Status (Fld : in Field; - Status : in Boolean := True) + procedure Set_Status (Fld : in Field; + Status : in Boolean := True) is - function Set_Fld_Status (Fld : Field; - St : C_Int) return C_Int; - pragma Import (C, Set_Fld_Status, "set_field_status"); + function Set_Fld_Status (Fld : Field; + St : C_Int) return C_Int; + pragma Import (C, Set_Fld_Status, "set_field_status"); - Res : constant Eti_Error := Set_Fld_Status (Fld, Boolean'Pos (Status)); + Res : constant Eti_Error := Set_Fld_Status (Fld, Boolean'Pos (Status)); begin - if Res /= E_Ok then - raise Form_Exception; + if Res /= E_Ok then + raise Form_Exception; end if; - end Set_Status; + end Set_Status; -- | -- | -- | - function Changed (Fld : Field) return Boolean + function Changed (Fld : Field) return Boolean is - function Field_Status (Fld : Field) return C_Int; - pragma Import (C, Field_Status, "field_status"); + function Field_Status (Fld : Field) return C_Int; + pragma Import (C, Field_Status, "field_status"); - Res : constant C_Int := Field_Status (Fld); + Res : constant C_Int := Field_Status (Fld); begin - if Res = Curses_False then + if Res = Curses_False then return False; else return True; end if; - end Changed; + end Changed; -- | -- | -- | - procedure Set_Maximum_Size (Fld : in Field; - Max : in Natural := 0) + procedure Set_Maximum_Size (Fld : in Field; + Max : in Natural := 0) is - function Set_Field_Max (Fld : Field; - M : C_Int) return C_Int; - pragma Import (C, Set_Field_Max, "set_max_field"); + function Set_Field_Max (Fld : Field; + M : C_Int) return C_Int; + pragma Import (C, Set_Field_Max, "set_max_field"); - Res : constant Eti_Error := Set_Field_Max (Fld, C_Int (Max)); + Res : constant Eti_Error := Set_Field_Max (Fld, C_Int (Max)); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Maximum_Size; + end Set_Maximum_Size; -- | -- |===================================================================== -- | man page form_field_opts.3x @@ -327,71 +329,71 @@ -- | -- | -- | - procedure Set_Options (Fld : in Field; - Options : in Field_Option_Set) + procedure Set_Options (Fld : in Field; + Options : in Field_Option_Set) is - function Set_Field_Opts (Fld : Field; - Opt : C_Int) return C_Int; - pragma Import (C, Set_Field_Opts, "set_field_opts"); + function Set_Field_Opts (Fld : Field; + Opt : C_Int) return C_Int; + pragma Import (C, Set_Field_Opts, "set_field_opts"); - Opt : C_Int := FOS_2_CInt (Options); - Res : Eti_Error; + Opt : constant C_Int := FOS_2_CInt (Options); + Res : Eti_Error; begin - Res := Set_Field_Opts (Fld, Opt); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Field_Opts (Fld, Opt); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Options; + end Set_Options; -- | -- | -- | - procedure Switch_Options (Fld : in Field; - Options : in Field_Option_Set; - On : Boolean := True) + procedure Switch_Options (Fld : in Field; + Options : in Field_Option_Set; + On : Boolean := True) is - function Field_Opts_On (Fld : Field; - Opt : C_Int) return C_Int; - pragma Import (C, Field_Opts_On, "field_opts_on"); - function Field_Opts_Off (Fld : Field; - Opt : C_Int) return C_Int; - pragma Import (C, Field_Opts_Off, "field_opts_off"); - - Err : Eti_Error; - Opt : C_Int := FOS_2_CInt (Options); + function Field_Opts_On (Fld : Field; + Opt : C_Int) return C_Int; + pragma Import (C, Field_Opts_On, "field_opts_on"); + function Field_Opts_Off (Fld : Field; + Opt : C_Int) return C_Int; + pragma Import (C, Field_Opts_Off, "field_opts_off"); + + Err : Eti_Error; + Opt : constant C_Int := FOS_2_CInt (Options); begin - if On then - Err := Field_Opts_On (Fld, Opt); + if On then + Err := Field_Opts_On (Fld, Opt); else - Err := Field_Opts_Off (Fld, Opt); + Err := Field_Opts_Off (Fld, Opt); end if; - if Err /= E_Ok then - Eti_Exception (Err); + if Err /= E_Ok then + Eti_Exception (Err); end if; - end Switch_Options; + end Switch_Options; -- | -- | -- | - procedure Get_Options (Fld : in Field; - Options : out Field_Option_Set) + procedure Get_Options (Fld : in Field; + Options : out Field_Option_Set) is - function Field_Opts (Fld : Field) return C_Int; - pragma Import (C, Field_Opts, "field_opts"); + function Field_Opts (Fld : Field) return C_Int; + pragma Import (C, Field_Opts, "field_opts"); - Res : C_Int := Field_Opts (Fld); + Res : constant C_Int := Field_Opts (Fld); begin - Options := CInt_2_FOS (Res); - end Get_Options; + Options := CInt_2_FOS (Res); + end Get_Options; -- | -- | -- | - function Get_Options (Fld : Field := Null_Field) - return Field_Option_Set + function Get_Options (Fld : Field := Null_Field) + return Field_Option_Set is - Fos : Field_Option_Set; + Fos : Field_Option_Set; begin - Get_Options (Fld, Fos); - return Fos; - end Get_Options; + Get_Options (Fld, Fos); + return Fos; + end Get_Options; -- | -- |===================================================================== -- | man page form_field_attributes.3x @@ -399,119 +401,119 @@ -- | -- | -- | - procedure Set_Foreground - (Fld : in Field; - Fore : in Character_Attribute_Set := Normal_Video; - Color : in Color_Pair := Color_Pair'First) + procedure Set_Foreground + (Fld : in Field; + Fore : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) is - function Set_Field_Fore (Fld : Field; - Attr : C_Chtype) return C_Int; - pragma Import (C, Set_Field_Fore, "set_field_fore"); - - Ch : constant Attributed_Character := (Ch => Character'First, - Color => Color, - Attr => Fore); - Res : constant Eti_Error := - Set_Field_Fore (Fld, AttrChar_To_Chtype (Ch)); + function Set_Field_Fore (Fld : Field; + Attr : C_Chtype) return C_Int; + pragma Import (C, Set_Field_Fore, "set_field_fore"); + + Ch : constant Attributed_Character := (Ch => Character'First, + Color => Color, + Attr => Fore); + Res : constant Eti_Error := + Set_Field_Fore (Fld, AttrChar_To_Chtype (Ch)); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Foreground; + end Set_Foreground; -- | -- | -- | - procedure Foreground (Fld : in Field; - Fore : out Character_Attribute_Set) + procedure Foreground (Fld : in Field; + Fore : out Character_Attribute_Set) is - function Field_Fore (Fld : Field) return C_Chtype; - pragma Import (C, Field_Fore, "field_fore"); + function Field_Fore (Fld : Field) return C_Chtype; + pragma Import (C, Field_Fore, "field_fore"); begin - Fore := Chtype_To_AttrChar (Field_Fore (Fld)).Attr; - end Foreground; + Fore := Chtype_To_AttrChar (Field_Fore (Fld)).Attr; + end Foreground; - procedure Foreground (Fld : in Field; - Fore : out Character_Attribute_Set; - Color : out Color_Pair) + procedure Foreground (Fld : in Field; + Fore : out Character_Attribute_Set; + Color : out Color_Pair) is - function Field_Fore (Fld : Field) return C_Chtype; - pragma Import (C, Field_Fore, "field_fore"); + function Field_Fore (Fld : Field) return C_Chtype; + pragma Import (C, Field_Fore, "field_fore"); begin - Fore := Chtype_To_AttrChar (Field_Fore (Fld)).Attr; - Color := Chtype_To_AttrChar (Field_Fore (Fld)).Color; - end Foreground; + Fore := Chtype_To_AttrChar (Field_Fore (Fld)).Attr; + Color := Chtype_To_AttrChar (Field_Fore (Fld)).Color; + end Foreground; -- | -- | -- | - procedure Set_Background - (Fld : in Field; - Back : in Character_Attribute_Set := Normal_Video; - Color : in Color_Pair := Color_Pair'First) + procedure Set_Background + (Fld : in Field; + Back : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) is - function Set_Field_Back (Fld : Field; - Attr : C_Chtype) return C_Int; - pragma Import (C, Set_Field_Back, "set_field_back"); - - Ch : constant Attributed_Character := (Ch => Character'First, - Color => Color, - Attr => Back); - Res : constant Eti_Error := - Set_Field_Back (Fld, AttrChar_To_Chtype (Ch)); + function Set_Field_Back (Fld : Field; + Attr : C_Chtype) return C_Int; + pragma Import (C, Set_Field_Back, "set_field_back"); + + Ch : constant Attributed_Character := (Ch => Character'First, + Color => Color, + Attr => Back); + Res : constant Eti_Error := + Set_Field_Back (Fld, AttrChar_To_Chtype (Ch)); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Background; + end Set_Background; -- | -- | -- | - procedure Background (Fld : in Field; - Back : out Character_Attribute_Set) + procedure Background (Fld : in Field; + Back : out Character_Attribute_Set) is - function Field_Back (Fld : Field) return C_Chtype; - pragma Import (C, Field_Back, "field_back"); + function Field_Back (Fld : Field) return C_Chtype; + pragma Import (C, Field_Back, "field_back"); begin - Back := Chtype_To_AttrChar (Field_Back (Fld)).Attr; - end Background; + Back := Chtype_To_AttrChar (Field_Back (Fld)).Attr; + end Background; - procedure Background (Fld : in Field; - Back : out Character_Attribute_Set; - Color : out Color_Pair) + procedure Background (Fld : in Field; + Back : out Character_Attribute_Set; + Color : out Color_Pair) is - function Field_Back (Fld : Field) return C_Chtype; - pragma Import (C, Field_Back, "field_back"); + function Field_Back (Fld : Field) return C_Chtype; + pragma Import (C, Field_Back, "field_back"); begin - Back := Chtype_To_AttrChar (Field_Back (Fld)).Attr; - Color := Chtype_To_AttrChar (Field_Back (Fld)).Color; - end Background; + Back := Chtype_To_AttrChar (Field_Back (Fld)).Attr; + Color := Chtype_To_AttrChar (Field_Back (Fld)).Color; + end Background; -- | -- | -- | - procedure Set_Pad_Character (Fld : in Field; - Pad : in Character := Space) + procedure Set_Pad_Character (Fld : in Field; + Pad : in Character := Space) is - function Set_Field_Pad (Fld : Field; - Ch : C_Int) return C_Int; - pragma Import (C, Set_Field_Pad, "set_field_pad"); + function Set_Field_Pad (Fld : Field; + Ch : C_Int) return C_Int; + pragma Import (C, Set_Field_Pad, "set_field_pad"); - Res : constant Eti_Error := Set_Field_Pad (Fld, - C_Int (Character'Pos (Pad))); + Res : constant Eti_Error := Set_Field_Pad (Fld, + C_Int (Character'Pos (Pad))); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Pad_Character; + end Set_Pad_Character; -- | -- | -- | - procedure Pad_Character (Fld : in Field; - Pad : out Character) + procedure Pad_Character (Fld : in Field; + Pad : out Character) is - function Field_Pad (Fld : Field) return C_Int; - pragma Import (C, Field_Pad, "field_pad"); + function Field_Pad (Fld : Field) return C_Int; + pragma Import (C, Field_Pad, "field_pad"); begin - Pad := Character'Val (Field_Pad (Fld)); - end Pad_Character; + Pad := Character'Val (Field_Pad (Fld)); + end Pad_Character; -- | -- |===================================================================== -- | man page form_field_info.3x @@ -519,62 +521,62 @@ -- | -- | -- | - procedure Info (Fld : in Field; - Lines : out Line_Count; - Columns : out Column_Count; - First_Row : out Line_Position; - First_Column : out Column_Position; - Off_Screen : out Natural; - Additional_Buffers : out Buffer_Number) + procedure Info (Fld : in Field; + Lines : out Line_Count; + Columns : out Column_Count; + First_Row : out Line_Position; + First_Column : out Column_Position; + Off_Screen : out Natural; + Additional_Buffers : out Buffer_Number) is - type C_Int_Access is access all C_Int; - function Fld_Info (Fld : Field; - L, C, Fr, Fc, Os, Ab : C_Int_Access) - return C_Int; - pragma Import (C, Fld_Info, "field_info"); - - L, C, Fr, Fc, Os, Ab : aliased C_Int; - Res : constant Eti_Error := Fld_Info (Fld, - L'Access, C'Access, - Fr'Access, Fc'Access, - Os'Access, Ab'Access); + type C_Int_Access is access all C_Int; + function Fld_Info (Fld : Field; + L, C, Fr, Fc, Os, Ab : C_Int_Access) + return C_Int; + pragma Import (C, Fld_Info, "field_info"); + + L, C, Fr, Fc, Os, Ab : aliased C_Int; + Res : constant Eti_Error := Fld_Info (Fld, + L'Access, C'Access, + Fr'Access, Fc'Access, + Os'Access, Ab'Access); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); else - Lines := Line_Count (L); - Columns := Column_Count (C); - First_Row := Line_Position (Fr); - First_Column := Column_Position (Fc); - Off_Screen := Natural (Os); - Additional_Buffers := Buffer_Number (Ab); + Lines := Line_Count (L); + Columns := Column_Count (C); + First_Row := Line_Position (Fr); + First_Column := Column_Position (Fc); + Off_Screen := Natural (Os); + Additional_Buffers := Buffer_Number (Ab); end if; - end Info; + end Info; -- | -- | -- | - procedure Dynamic_Info (Fld : in Field; - Lines : out Line_Count; - Columns : out Column_Count; - Max : out Natural) + procedure Dynamic_Info (Fld : in Field; + Lines : out Line_Count; + Columns : out Column_Count; + Max : out Natural) is - type C_Int_Access is access all C_Int; - function Dyn_Info (Fld : Field; L, C, M : C_Int_Access) return C_Int; - pragma Import (C, Dyn_Info, "dynamic_field_info"); - - L, C, M : aliased C_Int; - Res : constant Eti_Error := Dyn_Info (Fld, - L'Access, C'Access, - M'Access); + type C_Int_Access is access all C_Int; + function Dyn_Info (Fld : Field; L, C, M : C_Int_Access) return C_Int; + pragma Import (C, Dyn_Info, "dynamic_field_info"); + + L, C, M : aliased C_Int; + Res : constant Eti_Error := Dyn_Info (Fld, + L'Access, C'Access, + M'Access); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); else - Lines := Line_Count (L); - Columns := Column_Count (C); - Max := Natural (M); + Lines := Line_Count (L); + Columns := Column_Count (C); + Max := Natural (M); end if; - end Dynamic_Info; + end Dynamic_Info; -- | -- |===================================================================== -- | man page form_win.3x @@ -582,79 +584,79 @@ -- | -- | -- | - procedure Set_Window (Frm : in Form; - Win : in Window) + procedure Set_Window (Frm : in Form; + Win : in Window) is - function Set_Form_Win (Frm : Form; - Win : Window) return C_Int; - pragma Import (C, Set_Form_Win, "set_form_win"); + function Set_Form_Win (Frm : Form; + Win : Window) return C_Int; + pragma Import (C, Set_Form_Win, "set_form_win"); - Res : constant Eti_Error := Set_Form_Win (Frm, Win); + Res : constant Eti_Error := Set_Form_Win (Frm, Win); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Window; + end Set_Window; -- | -- | -- | - function Get_Window (Frm : Form) return Window + function Get_Window (Frm : Form) return Window is - function Form_Win (Frm : Form) return Window; - pragma Import (C, Form_Win, "form_win"); + function Form_Win (Frm : Form) return Window; + pragma Import (C, Form_Win, "form_win"); - W : constant Window := Form_Win (Frm); + W : constant Window := Form_Win (Frm); begin - return W; - end Get_Window; + return W; + end Get_Window; -- | -- | -- | - procedure Set_Sub_Window (Frm : in Form; - Win : in Window) + procedure Set_Sub_Window (Frm : in Form; + Win : in Window) is - function Set_Form_Sub (Frm : Form; - Win : Window) return C_Int; - pragma Import (C, Set_Form_Sub, "set_form_sub"); + function Set_Form_Sub (Frm : Form; + Win : Window) return C_Int; + pragma Import (C, Set_Form_Sub, "set_form_sub"); - Res : constant Eti_Error := Set_Form_Sub (Frm, Win); + Res : constant Eti_Error := Set_Form_Sub (Frm, Win); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Sub_Window; + end Set_Sub_Window; -- | -- | -- | - function Get_Sub_Window (Frm : Form) return Window + function Get_Sub_Window (Frm : Form) return Window is - function Form_Sub (Frm : Form) return Window; - pragma Import (C, Form_Sub, "form_sub"); + function Form_Sub (Frm : Form) return Window; + pragma Import (C, Form_Sub, "form_sub"); - W : constant Window := Form_Sub (Frm); + W : constant Window := Form_Sub (Frm); begin - return W; - end Get_Sub_Window; + return W; + end Get_Sub_Window; -- | -- | -- | - procedure Scale (Frm : in Form; - Lines : out Line_Count; - Columns : out Column_Count) + procedure Scale (Frm : in Form; + Lines : out Line_Count; + Columns : out Column_Count) is - type C_Int_Access is access all C_Int; - function M_Scale (Frm : Form; Yp, Xp : C_Int_Access) return C_Int; - pragma Import (C, M_Scale, "scale_form"); + type C_Int_Access is access all C_Int; + function M_Scale (Frm : Form; Yp, Xp : C_Int_Access) return C_Int; + pragma Import (C, M_Scale, "scale_form"); - X, Y : aliased C_Int; - Res : constant Eti_Error := M_Scale (Frm, Y'Access, X'Access); + X, Y : aliased C_Int; + Res : constant Eti_Error := M_Scale (Frm, Y'Access, X'Access); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Lines := Line_Count (Y); - Columns := Column_Count (X); - end Scale; + Lines := Line_Count (Y); + Columns := Column_Count (X); + end Scale; -- | -- |===================================================================== -- | man page menu_hook.3x @@ -662,67 +664,67 @@ -- | -- | -- | - procedure Set_Field_Init_Hook (Frm : in Form; - Proc : in Form_Hook_Function) + procedure Set_Field_Init_Hook (Frm : in Form; + Proc : in Form_Hook_Function) is - function Set_Field_Init (Frm : Form; - Proc : Form_Hook_Function) return C_Int; - pragma Import (C, Set_Field_Init, "set_field_init"); + function Set_Field_Init (Frm : Form; + Proc : Form_Hook_Function) return C_Int; + pragma Import (C, Set_Field_Init, "set_field_init"); - Res : constant Eti_Error := Set_Field_Init (Frm, Proc); + Res : constant Eti_Error := Set_Field_Init (Frm, Proc); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Field_Init_Hook; + end Set_Field_Init_Hook; -- | -- | -- | - procedure Set_Field_Term_Hook (Frm : in Form; - Proc : in Form_Hook_Function) + procedure Set_Field_Term_Hook (Frm : in Form; + Proc : in Form_Hook_Function) is - function Set_Field_Term (Frm : Form; - Proc : Form_Hook_Function) return C_Int; - pragma Import (C, Set_Field_Term, "set_field_term"); + function Set_Field_Term (Frm : Form; + Proc : Form_Hook_Function) return C_Int; + pragma Import (C, Set_Field_Term, "set_field_term"); - Res : constant Eti_Error := Set_Field_Term (Frm, Proc); + Res : constant Eti_Error := Set_Field_Term (Frm, Proc); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Field_Term_Hook; + end Set_Field_Term_Hook; -- | -- | -- | - procedure Set_Form_Init_Hook (Frm : in Form; - Proc : in Form_Hook_Function) + procedure Set_Form_Init_Hook (Frm : in Form; + Proc : in Form_Hook_Function) is - function Set_Form_Init (Frm : Form; - Proc : Form_Hook_Function) return C_Int; - pragma Import (C, Set_Form_Init, "set_form_init"); + function Set_Form_Init (Frm : Form; + Proc : Form_Hook_Function) return C_Int; + pragma Import (C, Set_Form_Init, "set_form_init"); - Res : constant Eti_Error := Set_Form_Init (Frm, Proc); + Res : constant Eti_Error := Set_Form_Init (Frm, Proc); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Form_Init_Hook; + end Set_Form_Init_Hook; -- | -- | -- | - procedure Set_Form_Term_Hook (Frm : in Form; - Proc : in Form_Hook_Function) + procedure Set_Form_Term_Hook (Frm : in Form; + Proc : in Form_Hook_Function) is - function Set_Form_Term (Frm : Form; - Proc : Form_Hook_Function) return C_Int; - pragma Import (C, Set_Form_Term, "set_form_term"); + function Set_Form_Term (Frm : Form; + Proc : Form_Hook_Function) return C_Int; + pragma Import (C, Set_Form_Term, "set_form_term"); - Res : constant Eti_Error := Set_Form_Term (Frm, Proc); + Res : constant Eti_Error := Set_Form_Term (Frm, Proc); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Form_Term_Hook; + end Set_Form_Term_Hook; -- | -- |===================================================================== -- | man page form_fields.3x @@ -730,71 +732,71 @@ -- | -- | -- | - procedure Redefine (Frm : in Form; - Flds : in Field_Array_Access) + procedure Redefine (Frm : in Form; + Flds : in Field_Array_Access) is - function Set_Frm_Fields (Frm : Form; - Items : System.Address) return C_Int; - pragma Import (C, Set_Frm_Fields, "set_form_fields"); + function Set_Frm_Fields (Frm : Form; + Items : System.Address) return C_Int; + pragma Import (C, Set_Frm_Fields, "set_form_fields"); - Res : Eti_Error; + Res : Eti_Error; begin - pragma Assert (Flds (Flds'Last) = Null_Field); - if Flds (Flds'Last) /= Null_Field then - raise Form_Exception; + pragma Assert (Flds (Flds'Last) = Null_Field); + if Flds (Flds'Last) /= Null_Field then + raise Form_Exception; else - Res := Set_Frm_Fields (Frm, Flds (Flds'First)'Address); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Frm_Fields (Frm, Flds (Flds'First)'Address); + if Res /= E_Ok then + Eti_Exception (Res); end if; end if; - end Redefine; + end Redefine; -- | -- | -- | - function Fields (Frm : Form; - Index : Positive) return Field + function Fields (Frm : Form; + Index : Positive) return Field is - use F_Array; + use F_Array; - function C_Fields (Frm : Form) return Pointer; - pragma Import (C, C_Fields, "form_fields"); + function C_Fields (Frm : Form) return Pointer; + pragma Import (C, C_Fields, "form_fields"); - P : Pointer := C_Fields (Frm); + P : Pointer := C_Fields (Frm); begin - if P = null or else Index not in 1 .. Field_Count (Frm) then - raise Form_Exception; + if P = null or else Index not in 1 .. Field_Count (Frm) then + raise Form_Exception; else - P := P + ptrdiff_t (C_Int (Index) - 1); - return P.all; + P := P + ptrdiff_t (C_Int (Index) - 1); + return P.all; end if; - end Fields; + end Fields; -- | -- | -- | - function Field_Count (Frm : Form) return Natural + function Field_Count (Frm : Form) return Natural is - function Count (Frm : Form) return C_Int; - pragma Import (C, Count, "field_count"); + function Count (Frm : Form) return C_Int; + pragma Import (C, Count, "field_count"); begin - return Natural (Count (Frm)); - end Field_Count; + return Natural (Count (Frm)); + end Field_Count; -- | -- | -- | - procedure Move (Fld : in Field; - Line : in Line_Position; - Column : in Column_Position) + procedure Move (Fld : in Field; + Line : in Line_Position; + Column : in Column_Position) is - function Move (Fld : Field; L, C : C_Int) return C_Int; - pragma Import (C, Move, "move_field"); + function Move (Fld : Field; L, C : C_Int) return C_Int; + pragma Import (C, Move, "move_field"); - Res : constant Eti_Error := Move (Fld, C_Int (Line), C_Int (Column)); + Res : constant Eti_Error := Move (Fld, C_Int (Line), C_Int (Column)); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Move; + end Move; -- | -- |===================================================================== -- | man page form_new.3x @@ -802,39 +804,39 @@ -- | -- | -- | - function Create (Fields : Field_Array_Access) return Form + function Create (Fields : Field_Array_Access) return Form is - function NewForm (Fields : System.Address) return Form; - pragma Import (C, NewForm, "new_form"); + function NewForm (Fields : System.Address) return Form; + pragma Import (C, NewForm, "new_form"); - M : Form; + M : Form; begin - pragma Assert (Fields (Fields'Last) = Null_Field); - if Fields (Fields'Last) /= Null_Field then - raise Form_Exception; + pragma Assert (Fields (Fields'Last) = Null_Field); + if Fields (Fields'Last) /= Null_Field then + raise Form_Exception; else - M := NewForm (Fields (Fields'First)'Address); - if M = Null_Form then - raise Form_Exception; + M := NewForm (Fields (Fields'First)'Address); + if M = Null_Form then + raise Form_Exception; end if; - return M; + return M; end if; - end Create; + end Create; -- | -- | -- | - procedure Delete (Frm : in out Form) + procedure Delete (Frm : in out Form) is - function Free (Frm : Form) return C_Int; - pragma Import (C, Free, "free_form"); + function Free (Frm : Form) return C_Int; + pragma Import (C, Free, "free_form"); - Res : constant Eti_Error := Free (Frm); + Res : constant Eti_Error := Free (Frm); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Frm := Null_Form; - end Delete; + Frm := Null_Form; + end Delete; -- | -- |===================================================================== -- | man page form_opts.3x @@ -842,70 +844,70 @@ -- | -- | -- | - procedure Set_Options (Frm : in Form; - Options : in Form_Option_Set) + procedure Set_Options (Frm : in Form; + Options : in Form_Option_Set) is - function Set_Form_Opts (Frm : Form; - Opt : C_Int) return C_Int; - pragma Import (C, Set_Form_Opts, "set_form_opts"); + function Set_Form_Opts (Frm : Form; + Opt : C_Int) return C_Int; + pragma Import (C, Set_Form_Opts, "set_form_opts"); - Opt : C_Int := FrmOS_2_CInt (Options); - Res : Eti_Error; + Opt : constant C_Int := FrmOS_2_CInt (Options); + Res : Eti_Error; begin - Res := Set_Form_Opts (Frm, Opt); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Form_Opts (Frm, Opt); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Options; + end Set_Options; -- | -- | -- | - procedure Switch_Options (Frm : in Form; - Options : in Form_Option_Set; - On : Boolean := True) + procedure Switch_Options (Frm : in Form; + Options : in Form_Option_Set; + On : Boolean := True) is - function Form_Opts_On (Frm : Form; - Opt : C_Int) return C_Int; - pragma Import (C, Form_Opts_On, "form_opts_on"); - function Form_Opts_Off (Frm : Form; - Opt : C_Int) return C_Int; - pragma Import (C, Form_Opts_Off, "form_opts_off"); - - Err : Eti_Error; - Opt : C_Int := FrmOS_2_CInt (Options); + function Form_Opts_On (Frm : Form; + Opt : C_Int) return C_Int; + pragma Import (C, Form_Opts_On, "form_opts_on"); + function Form_Opts_Off (Frm : Form; + Opt : C_Int) return C_Int; + pragma Import (C, Form_Opts_Off, "form_opts_off"); + + Err : Eti_Error; + Opt : constant C_Int := FrmOS_2_CInt (Options); begin - if On then - Err := Form_Opts_On (Frm, Opt); + if On then + Err := Form_Opts_On (Frm, Opt); else - Err := Form_Opts_Off (Frm, Opt); + Err := Form_Opts_Off (Frm, Opt); end if; - if Err /= E_Ok then - Eti_Exception (Err); + if Err /= E_Ok then + Eti_Exception (Err); end if; - end Switch_Options; + end Switch_Options; -- | -- | -- | - procedure Get_Options (Frm : in Form; - Options : out Form_Option_Set) + procedure Get_Options (Frm : in Form; + Options : out Form_Option_Set) is - function Form_Opts (Frm : Form) return C_Int; - pragma Import (C, Form_Opts, "form_opts"); + function Form_Opts (Frm : Form) return C_Int; + pragma Import (C, Form_Opts, "form_opts"); - Res : C_Int := Form_Opts (Frm); + Res : constant C_Int := Form_Opts (Frm); begin - Options := CInt_2_FrmOS (Res); - end Get_Options; + Options := CInt_2_FrmOS (Res); + end Get_Options; -- | -- | -- | - function Get_Options (Frm : Form := Null_Form) return Form_Option_Set + function Get_Options (Frm : Form := Null_Form) return Form_Option_Set is - Fos : Form_Option_Set; + Fos : Form_Option_Set; begin - Get_Options (Frm, Fos); - return Fos; - end Get_Options; + Get_Options (Frm, Fos); + return Fos; + end Get_Options; -- | -- |===================================================================== -- | man page form_post.3x @@ -913,25 +915,25 @@ -- | -- | -- | - procedure Post (Frm : in Form; - Post : in Boolean := True) + procedure Post (Frm : in Form; + Post : in Boolean := True) is - function M_Post (Frm : Form) return C_Int; - pragma Import (C, M_Post, "post_form"); - function M_Unpost (Frm : Form) return C_Int; - pragma Import (C, M_Unpost, "unpost_form"); + function M_Post (Frm : Form) return C_Int; + pragma Import (C, M_Post, "post_form"); + function M_Unpost (Frm : Form) return C_Int; + pragma Import (C, M_Unpost, "unpost_form"); - Res : Eti_Error; + Res : Eti_Error; begin - if Post then - Res := M_Post (Frm); + if Post then + Res := M_Post (Frm); else - Res := M_Unpost (Frm); + Res := M_Unpost (Frm); end if; - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Post; + end Post; -- | -- |===================================================================== -- | man page form_cursor.3x @@ -939,17 +941,17 @@ -- | -- | -- | - procedure Position_Cursor (Frm : Form) + procedure Position_Cursor (Frm : Form) is - function Pos_Form_Cursor (Frm : Form) return C_Int; - pragma Import (C, Pos_Form_Cursor, "pos_form_cursor"); + function Pos_Form_Cursor (Frm : Form) return C_Int; + pragma Import (C, Pos_Form_Cursor, "pos_form_cursor"); - Res : constant Eti_Error := Pos_Form_Cursor (Frm); + Res : constant Eti_Error := Pos_Form_Cursor (Frm); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Position_Cursor; + end Position_Cursor; -- | -- |===================================================================== -- | man page form_data.3x @@ -957,35 +959,35 @@ -- | -- | -- | - function Data_Ahead (Frm : Form) return Boolean + function Data_Ahead (Frm : Form) return Boolean is - function Ahead (Frm : Form) return C_Int; - pragma Import (C, Ahead, "data_ahead"); + function Ahead (Frm : Form) return C_Int; + pragma Import (C, Ahead, "data_ahead"); - Res : constant C_Int := Ahead (Frm); + Res : constant C_Int := Ahead (Frm); begin - if Res = Curses_False then + if Res = Curses_False then return False; else return True; end if; - end Data_Ahead; + end Data_Ahead; -- | -- | -- | - function Data_Behind (Frm : Form) return Boolean + function Data_Behind (Frm : Form) return Boolean is - function Behind (Frm : Form) return C_Int; - pragma Import (C, Behind, "data_behind"); + function Behind (Frm : Form) return C_Int; + pragma Import (C, Behind, "data_behind"); - Res : constant C_Int := Behind (Frm); + Res : constant C_Int := Behind (Frm); begin - if Res = Curses_False then + if Res = Curses_False then return False; else return True; end if; - end Data_Behind; + end Data_Behind; -- | -- |===================================================================== -- | man page form_driver.3x @@ -993,29 +995,29 @@ -- | -- | -- | - function Driver (Frm : Form; - Key : Key_Code) return Driver_Result + function Driver (Frm : Form; + Key : Key_Code) return Driver_Result is - function Frm_Driver (Frm : Form; Key : C_Int) return C_Int; - pragma Import (C, Frm_Driver, "form_driver"); + function Frm_Driver (Frm : Form; Key : C_Int) return C_Int; + pragma Import (C, Frm_Driver, "form_driver"); - R : Eti_Error := Frm_Driver (Frm, C_Int (Key)); + R : constant Eti_Error := Frm_Driver (Frm, C_Int (Key)); begin - if R /= E_Ok then - if R = E_Unknown_Command then - return Unknown_Request; - elsif R = E_Invalid_Field then - return Invalid_Field; - elsif R = E_Request_Denied then - return Request_Denied; + if R /= E_Ok then + if R = E_Unknown_Command then + return Unknown_Request; + elsif R = E_Invalid_Field then + return Invalid_Field; + elsif R = E_Request_Denied then + return Request_Denied; else - Eti_Exception (R); - return Form_Ok; + Eti_Exception (R); + return Form_Ok; end if; else - return Form_Ok; + return Form_Ok; end if; - end Driver; + end Driver; -- | -- |===================================================================== -- | man page form_page.3x @@ -1023,77 +1025,77 @@ -- | -- | -- | - procedure Set_Current (Frm : in Form; - Fld : in Field) + procedure Set_Current (Frm : in Form; + Fld : in Field) is - function Set_Current_Fld (Frm : Form; Fld : Field) return C_Int; - pragma Import (C, Set_Current_Fld, "set_current_field"); + function Set_Current_Fld (Frm : Form; Fld : Field) return C_Int; + pragma Import (C, Set_Current_Fld, "set_current_field"); - Res : constant Eti_Error := Set_Current_Fld (Frm, Fld); + Res : constant Eti_Error := Set_Current_Fld (Frm, Fld); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Current; + end Set_Current; -- | -- | -- | - function Current (Frm : in Form) return Field + function Current (Frm : in Form) return Field is - function Current_Fld (Frm : Form) return Field; - pragma Import (C, Current_Fld, "current_field"); + function Current_Fld (Frm : Form) return Field; + pragma Import (C, Current_Fld, "current_field"); - Fld : constant Field := Current_Fld (Frm); + Fld : constant Field := Current_Fld (Frm); begin - if Fld = Null_Field then - raise Form_Exception; + if Fld = Null_Field then + raise Form_Exception; end if; - return Fld; - end Current; + return Fld; + end Current; -- | -- | -- | - procedure Set_Page (Frm : in Form; - Page : in Page_Number := Page_Number'First) + procedure Set_Page (Frm : in Form; + Page : in Page_Number := Page_Number'First) is - function Set_Frm_Page (Frm : Form; Pg : C_Int) return C_Int; - pragma Import (C, Set_Frm_Page, "set_form_page"); + function Set_Frm_Page (Frm : Form; Pg : C_Int) return C_Int; + pragma Import (C, Set_Frm_Page, "set_form_page"); - Res : constant Eti_Error := Set_Frm_Page (Frm, C_Int (Page)); + Res : constant Eti_Error := Set_Frm_Page (Frm, C_Int (Page)); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Page; + end Set_Page; -- | -- | -- | - function Page (Frm : Form) return Page_Number + function Page (Frm : Form) return Page_Number is - function Get_Page (Frm : Form) return C_Int; - pragma Import (C, Get_Page, "form_page"); + function Get_Page (Frm : Form) return C_Int; + pragma Import (C, Get_Page, "form_page"); - P : constant C_Int := Get_Page (Frm); + P : constant C_Int := Get_Page (Frm); begin - if P < 0 then - raise Form_Exception; + if P < 0 then + raise Form_Exception; else - return Page_Number (P); + return Page_Number (P); end if; - end Page; + end Page; - function Get_Index (Fld : Field) return Positive + function Get_Index (Fld : Field) return Positive is - function Get_Fieldindex (Fld : Field) return C_Int; - pragma Import (C, Get_Fieldindex, "field_index"); + function Get_Fieldindex (Fld : Field) return C_Int; + pragma Import (C, Get_Fieldindex, "field_index"); - Res : constant C_Int := Get_Fieldindex (Fld); + Res : constant C_Int := Get_Fieldindex (Fld); begin - if Res = Curses_Err then - raise Form_Exception; + if Res = Curses_Err then + raise Form_Exception; end if; - return Positive (Natural (Res) + Positive'First); - end Get_Index; + return Positive (Natural (Res) + Positive'First); + end Get_Index; -- | -- |===================================================================== @@ -1102,64 +1104,64 @@ -- | -- | -- | - procedure Set_New_Page (Fld : in Field; - New_Page : in Boolean := True) + procedure Set_New_Page (Fld : in Field; + New_Page : in Boolean := True) is - function Set_Page (Fld : Field; Flg : C_Int) return C_Int; - pragma Import (C, Set_Page, "set_new_page"); + function Set_Page (Fld : Field; Flg : C_Int) return C_Int; + pragma Import (C, Set_Page, "set_new_page"); - Res : constant Eti_Error := Set_Page (Fld, Boolean'Pos (New_Page)); + Res : constant Eti_Error := Set_Page (Fld, Boolean'Pos (New_Page)); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_New_Page; + end Set_New_Page; -- | -- | -- | - function Is_New_Page (Fld : Field) return Boolean + function Is_New_Page (Fld : Field) return Boolean is - function Is_New (Fld : Field) return C_Int; - pragma Import (C, Is_New, "new_page"); + function Is_New (Fld : Field) return C_Int; + pragma Import (C, Is_New, "new_page"); - Res : constant C_Int := Is_New (Fld); + Res : constant C_Int := Is_New (Fld); begin - if Res = Curses_False then + if Res = Curses_False then return False; else return True; end if; - end Is_New_Page; + end Is_New_Page; - procedure Free (FA : in out Field_Array_Access; - Free_Fields : in Boolean := False) + procedure Free (FA : in out Field_Array_Access; + Free_Fields : in Boolean := False) is - procedure Release is new Ada.Unchecked_Deallocation - (Field_Array, Field_Array_Access); + procedure Release is new Ada.Unchecked_Deallocation + (Field_Array, Field_Array_Access); begin - if FA /= null and then Free_Fields then - for I in FA'First .. (FA'Last - 1) loop - if (FA (I) /= Null_Field) then - Delete (FA (I)); + if FA /= null and then Free_Fields then + for I in FA'First .. (FA'Last - 1) loop + if FA (I) /= Null_Field then + Delete (FA (I)); end if; end loop; end if; - Release (FA); - end Free; + Release (FA); + end Free; -- |===================================================================== - function Default_Field_Options return Field_Option_Set + function Default_Field_Options return Field_Option_Set is begin - return Get_Options (Null_Field); - end Default_Field_Options; + return Get_Options (Null_Field); + end Default_Field_Options; - function Default_Form_Options return Form_Option_Set + function Default_Form_Options return Form_Option_Set is begin - return Get_Options (Null_Form); - end Default_Form_Options; + return Get_Options (Null_Form); + end Default_Form_Options; -end Terminal_Interface.Curses.Forms; +end Terminal_Interface.Curses.Forms; diff --git a/doc/html/ada/terminal_interface-curses-forms__ads.htm b/doc/html/ada/terminal_interface-curses-forms__ads.htm index 9bb9772f..f06515f4 100644 --- a/doc/html/ada/terminal_interface-curses-forms__ads.htm +++ b/doc/html/ada/terminal_interface-curses-forms__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-forms.ads

    File : terminal_interface-curses-forms.ads


    @@ -57,32 +58,31 @@ Space : Character renames Ada.Characters.Latin_1.Space; - type Field is private; + type Field is private; type Form is private; - Null_Field : constant Field; + Null_Field : constant Field; Null_Form : constant Form; - type Field_Justification is (None, - Left, - Center, + type Field_Justification is (None, + Left, + Center, Right); pragma Warnings (Off); type Field_Option_Set is record - Visible : Boolean; - Active : Boolean; - Public : Boolean; - Edit : Boolean; - Wrap : Boolean; - Blank : Boolean; - Auto_Skip : Boolean; - Null_Ok : Boolean; - Pass_Ok : Boolean; - Static : Boolean; - end record; - pragma Pack (Field_Option_Set); + Visible : Boolean; + Active : Boolean; + Public : Boolean; + Edit : Boolean; + Wrap : Boolean; + Blank : Boolean; + Auto_Skip : Boolean; + Null_Ok : Boolean; + Pass_Ok : Boolean; + Static : Boolean; + end record; pragma Convention (C, Field_Option_Set); for Field_Option_Set use @@ -111,10 +111,9 @@ pragma Warnings (Off); type Form_Option_Set is record - NL_Overload : Boolean; + NL_Overload : Boolean; BS_Overload : Boolean; - end record; - pragma Pack (Form_Option_Set); + end record; pragma Convention (C, Form_Option_Set); for Form_Option_Set use @@ -139,7 +138,7 @@ type Field_Array_Access is access Field_Array; - procedure Free (FA : in out Field_Array_Access; + procedure Free (FA : in out Field_Array_Access; Free_Fields : in Boolean := False); -- Release the memory for an allocated field array -- If Free_Fields is True, call Delete() for all the fields in @@ -148,139 +147,139 @@ subtype Form_Request_Code is Key_Code range (Key_Max + 1) .. (Key_Max + 57); -- The prefix F_ stands for "Form Request" - F_Next_Page : constant Form_Request_Code := Key_Max + 1; - F_Previous_Page : constant Form_Request_Code := Key_Max + 2; - F_First_Page : constant Form_Request_Code := Key_Max + 3; + F_Next_Page : constant Form_Request_Code := Key_Max + 1; + F_Previous_Page : constant Form_Request_Code := Key_Max + 2; + F_First_Page : constant Form_Request_Code := Key_Max + 3; F_Last_Page : constant Form_Request_Code := Key_Max + 4; - F_Next_Field : constant Form_Request_Code := Key_Max + 5; - F_Previous_Field : constant Form_Request_Code := Key_Max + 6; - F_First_Field : constant Form_Request_Code := Key_Max + 7; - F_Last_Field : constant Form_Request_Code := Key_Max + 8; - F_Sorted_Next_Field : constant Form_Request_Code := Key_Max + 9; - F_Sorted_Previous_Field : constant Form_Request_Code := Key_Max + 10; - F_Sorted_First_Field : constant Form_Request_Code := Key_Max + 11; - F_Sorted_Last_Field : constant Form_Request_Code := Key_Max + 12; - F_Left_Field : constant Form_Request_Code := Key_Max + 13; - F_Right_Field : constant Form_Request_Code := Key_Max + 14; - F_Up_Field : constant Form_Request_Code := Key_Max + 15; + F_Next_Field : constant Form_Request_Code := Key_Max + 5; + F_Previous_Field : constant Form_Request_Code := Key_Max + 6; + F_First_Field : constant Form_Request_Code := Key_Max + 7; + F_Last_Field : constant Form_Request_Code := Key_Max + 8; + F_Sorted_Next_Field : constant Form_Request_Code := Key_Max + 9; + F_Sorted_Previous_Field : constant Form_Request_Code := Key_Max + 10; + F_Sorted_First_Field : constant Form_Request_Code := Key_Max + 11; + F_Sorted_Last_Field : constant Form_Request_Code := Key_Max + 12; + F_Left_Field : constant Form_Request_Code := Key_Max + 13; + F_Right_Field : constant Form_Request_Code := Key_Max + 14; + F_Up_Field : constant Form_Request_Code := Key_Max + 15; F_Down_Field : constant Form_Request_Code := Key_Max + 16; - F_Next_Char : constant Form_Request_Code := Key_Max + 17; - F_Previous_Char : constant Form_Request_Code := Key_Max + 18; - F_Next_Line : constant Form_Request_Code := Key_Max + 19; - F_Previous_Line : constant Form_Request_Code := Key_Max + 20; - F_Next_Word : constant Form_Request_Code := Key_Max + 21; - F_Previous_Word : constant Form_Request_Code := Key_Max + 22; - F_Begin_Field : constant Form_Request_Code := Key_Max + 23; - F_End_Field : constant Form_Request_Code := Key_Max + 24; - F_Begin_Line : constant Form_Request_Code := Key_Max + 25; - F_End_Line : constant Form_Request_Code := Key_Max + 26; - F_Left_Char : constant Form_Request_Code := Key_Max + 27; - F_Right_Char : constant Form_Request_Code := Key_Max + 28; - F_Up_Char : constant Form_Request_Code := Key_Max + 29; + F_Next_Char : constant Form_Request_Code := Key_Max + 17; + F_Previous_Char : constant Form_Request_Code := Key_Max + 18; + F_Next_Line : constant Form_Request_Code := Key_Max + 19; + F_Previous_Line : constant Form_Request_Code := Key_Max + 20; + F_Next_Word : constant Form_Request_Code := Key_Max + 21; + F_Previous_Word : constant Form_Request_Code := Key_Max + 22; + F_Begin_Field : constant Form_Request_Code := Key_Max + 23; + F_End_Field : constant Form_Request_Code := Key_Max + 24; + F_Begin_Line : constant Form_Request_Code := Key_Max + 25; + F_End_Line : constant Form_Request_Code := Key_Max + 26; + F_Left_Char : constant Form_Request_Code := Key_Max + 27; + F_Right_Char : constant Form_Request_Code := Key_Max + 28; + F_Up_Char : constant Form_Request_Code := Key_Max + 29; F_Down_Char : constant Form_Request_Code := Key_Max + 30; - F_New_Line : constant Form_Request_Code := Key_Max + 31; - F_Insert_Char : constant Form_Request_Code := Key_Max + 32; - F_Insert_Line : constant Form_Request_Code := Key_Max + 33; - F_Delete_Char : constant Form_Request_Code := Key_Max + 34; - F_Delete_Previous : constant Form_Request_Code := Key_Max + 35; - F_Delete_Line : constant Form_Request_Code := Key_Max + 36; - F_Delete_Word : constant Form_Request_Code := Key_Max + 37; - F_Clear_EOL : constant Form_Request_Code := Key_Max + 38; - F_Clear_EOF : constant Form_Request_Code := Key_Max + 39; - F_Clear_Field : constant Form_Request_Code := Key_Max + 40; - F_Overlay_Mode : constant Form_Request_Code := Key_Max + 41; + F_New_Line : constant Form_Request_Code := Key_Max + 31; + F_Insert_Char : constant Form_Request_Code := Key_Max + 32; + F_Insert_Line : constant Form_Request_Code := Key_Max + 33; + F_Delete_Char : constant Form_Request_Code := Key_Max + 34; + F_Delete_Previous : constant Form_Request_Code := Key_Max + 35; + F_Delete_Line : constant Form_Request_Code := Key_Max + 36; + F_Delete_Word : constant Form_Request_Code := Key_Max + 37; + F_Clear_EOL : constant Form_Request_Code := Key_Max + 38; + F_Clear_EOF : constant Form_Request_Code := Key_Max + 39; + F_Clear_Field : constant Form_Request_Code := Key_Max + 40; + F_Overlay_Mode : constant Form_Request_Code := Key_Max + 41; F_Insert_Mode : constant Form_Request_Code := Key_Max + 42; -- Vertical Scrolling - F_ScrollForward_Line : constant Form_Request_Code := Key_Max + 43; - F_ScrollBackward_Line : constant Form_Request_Code := Key_Max + 44; - F_ScrollForward_Page : constant Form_Request_Code := Key_Max + 45; - F_ScrollBackward_Page : constant Form_Request_Code := Key_Max + 46; - F_ScrollForward_HalfPage : constant Form_Request_Code := Key_Max + 47; + F_ScrollForward_Line : constant Form_Request_Code := Key_Max + 43; + F_ScrollBackward_Line : constant Form_Request_Code := Key_Max + 44; + F_ScrollForward_Page : constant Form_Request_Code := Key_Max + 45; + F_ScrollBackward_Page : constant Form_Request_Code := Key_Max + 46; + F_ScrollForward_HalfPage : constant Form_Request_Code := Key_Max + 47; F_ScrollBackward_HalfPage : constant Form_Request_Code := Key_Max + 48; -- Horizontal Scrolling - F_HScrollForward_Char : constant Form_Request_Code := Key_Max + 49; - F_HScrollBackward_Char : constant Form_Request_Code := Key_Max + 50; - F_HScrollForward_Line : constant Form_Request_Code := Key_Max + 51; - F_HScrollBackward_Line : constant Form_Request_Code := Key_Max + 52; - F_HScrollForward_HalfLine : constant Form_Request_Code := Key_Max + 53; + F_HScrollForward_Char : constant Form_Request_Code := Key_Max + 49; + F_HScrollBackward_Char : constant Form_Request_Code := Key_Max + 50; + F_HScrollForward_Line : constant Form_Request_Code := Key_Max + 51; + F_HScrollBackward_Line : constant Form_Request_Code := Key_Max + 52; + F_HScrollForward_HalfLine : constant Form_Request_Code := Key_Max + 53; F_HScrollBackward_HalfLine : constant Form_Request_Code := Key_Max + 54; - F_Validate_Field : constant Form_Request_Code := Key_Max + 55; - F_Next_Choice : constant Form_Request_Code := Key_Max + 56; + F_Validate_Field : constant Form_Request_Code := Key_Max + 55; + F_Next_Choice : constant Form_Request_Code := Key_Max + 56; F_Previous_Choice : constant Form_Request_Code := Key_Max + 57; -- For those who like the old 'C' style request names - REQ_NEXT_PAGE : Form_Request_Code renames F_Next_Page; - REQ_PREV_PAGE : Form_Request_Code renames F_Previous_Page; - REQ_FIRST_PAGE : Form_Request_Code renames F_First_Page; + REQ_NEXT_PAGE : Form_Request_Code renames F_Next_Page; + REQ_PREV_PAGE : Form_Request_Code renames F_Previous_Page; + REQ_FIRST_PAGE : Form_Request_Code renames F_First_Page; REQ_LAST_PAGE : Form_Request_Code renames F_Last_Page; - REQ_NEXT_FIELD : Form_Request_Code renames F_Next_Field; - REQ_PREV_FIELD : Form_Request_Code renames F_Previous_Field; - REQ_FIRST_FIELD : Form_Request_Code renames F_First_Field; - REQ_LAST_FIELD : Form_Request_Code renames F_Last_Field; - REQ_SNEXT_FIELD : Form_Request_Code renames F_Sorted_Next_Field; - REQ_SPREV_FIELD : Form_Request_Code renames F_Sorted_Previous_Field; - REQ_SFIRST_FIELD : Form_Request_Code renames F_Sorted_First_Field; - REQ_SLAST_FIELD : Form_Request_Code renames F_Sorted_Last_Field; - REQ_LEFT_FIELD : Form_Request_Code renames F_Left_Field; - REQ_RIGHT_FIELD : Form_Request_Code renames F_Right_Field; - REQ_UP_FIELD : Form_Request_Code renames F_Up_Field; + REQ_NEXT_FIELD : Form_Request_Code renames F_Next_Field; + REQ_PREV_FIELD : Form_Request_Code renames F_Previous_Field; + REQ_FIRST_FIELD : Form_Request_Code renames F_First_Field; + REQ_LAST_FIELD : Form_Request_Code renames F_Last_Field; + REQ_SNEXT_FIELD : Form_Request_Code renames F_Sorted_Next_Field; + REQ_SPREV_FIELD : Form_Request_Code renames F_Sorted_Previous_Field; + REQ_SFIRST_FIELD : Form_Request_Code renames F_Sorted_First_Field; + REQ_SLAST_FIELD : Form_Request_Code renames F_Sorted_Last_Field; + REQ_LEFT_FIELD : Form_Request_Code renames F_Left_Field; + REQ_RIGHT_FIELD : Form_Request_Code renames F_Right_Field; + REQ_UP_FIELD : Form_Request_Code renames F_Up_Field; REQ_DOWN_FIELD : Form_Request_Code renames F_Down_Field; - REQ_NEXT_CHAR : Form_Request_Code renames F_Next_Char; - REQ_PREV_CHAR : Form_Request_Code renames F_Previous_Char; - REQ_NEXT_LINE : Form_Request_Code renames F_Next_Line; - REQ_PREV_LINE : Form_Request_Code renames F_Previous_Line; - REQ_NEXT_WORD : Form_Request_Code renames F_Next_Word; - REQ_PREV_WORD : Form_Request_Code renames F_Previous_Word; - REQ_BEG_FIELD : Form_Request_Code renames F_Begin_Field; - REQ_END_FIELD : Form_Request_Code renames F_End_Field; - REQ_BEG_LINE : Form_Request_Code renames F_Begin_Line; - REQ_END_LINE : Form_Request_Code renames F_End_Line; - REQ_LEFT_CHAR : Form_Request_Code renames F_Left_Char; - REQ_RIGHT_CHAR : Form_Request_Code renames F_Right_Char; - REQ_UP_CHAR : Form_Request_Code renames F_Up_Char; + REQ_NEXT_CHAR : Form_Request_Code renames F_Next_Char; + REQ_PREV_CHAR : Form_Request_Code renames F_Previous_Char; + REQ_NEXT_LINE : Form_Request_Code renames F_Next_Line; + REQ_PREV_LINE : Form_Request_Code renames F_Previous_Line; + REQ_NEXT_WORD : Form_Request_Code renames F_Next_Word; + REQ_PREV_WORD : Form_Request_Code renames F_Previous_Word; + REQ_BEG_FIELD : Form_Request_Code renames F_Begin_Field; + REQ_END_FIELD : Form_Request_Code renames F_End_Field; + REQ_BEG_LINE : Form_Request_Code renames F_Begin_Line; + REQ_END_LINE : Form_Request_Code renames F_End_Line; + REQ_LEFT_CHAR : Form_Request_Code renames F_Left_Char; + REQ_RIGHT_CHAR : Form_Request_Code renames F_Right_Char; + REQ_UP_CHAR : Form_Request_Code renames F_Up_Char; REQ_DOWN_CHAR : Form_Request_Code renames F_Down_Char; - REQ_NEW_LINE : Form_Request_Code renames F_New_Line; - REQ_INS_CHAR : Form_Request_Code renames F_Insert_Char; - REQ_INS_LINE : Form_Request_Code renames F_Insert_Line; - REQ_DEL_CHAR : Form_Request_Code renames F_Delete_Char; - REQ_DEL_PREV : Form_Request_Code renames F_Delete_Previous; - REQ_DEL_LINE : Form_Request_Code renames F_Delete_Line; - REQ_DEL_WORD : Form_Request_Code renames F_Delete_Word; - REQ_CLR_EOL : Form_Request_Code renames F_Clear_EOL; - REQ_CLR_EOF : Form_Request_Code renames F_Clear_EOF; - REQ_CLR_FIELD : Form_Request_Code renames F_Clear_Field; - REQ_OVL_MODE : Form_Request_Code renames F_Overlay_Mode; + REQ_NEW_LINE : Form_Request_Code renames F_New_Line; + REQ_INS_CHAR : Form_Request_Code renames F_Insert_Char; + REQ_INS_LINE : Form_Request_Code renames F_Insert_Line; + REQ_DEL_CHAR : Form_Request_Code renames F_Delete_Char; + REQ_DEL_PREV : Form_Request_Code renames F_Delete_Previous; + REQ_DEL_LINE : Form_Request_Code renames F_Delete_Line; + REQ_DEL_WORD : Form_Request_Code renames F_Delete_Word; + REQ_CLR_EOL : Form_Request_Code renames F_Clear_EOL; + REQ_CLR_EOF : Form_Request_Code renames F_Clear_EOF; + REQ_CLR_FIELD : Form_Request_Code renames F_Clear_Field; + REQ_OVL_MODE : Form_Request_Code renames F_Overlay_Mode; REQ_INS_MODE : Form_Request_Code renames F_Insert_Mode; - REQ_SCR_FLINE : Form_Request_Code renames F_ScrollForward_Line; - REQ_SCR_BLINE : Form_Request_Code renames F_ScrollBackward_Line; - REQ_SCR_FPAGE : Form_Request_Code renames F_ScrollForward_Page; - REQ_SCR_BPAGE : Form_Request_Code renames F_ScrollBackward_Page; - REQ_SCR_FHPAGE : Form_Request_Code renames F_ScrollForward_HalfPage; + REQ_SCR_FLINE : Form_Request_Code renames F_ScrollForward_Line; + REQ_SCR_BLINE : Form_Request_Code renames F_ScrollBackward_Line; + REQ_SCR_FPAGE : Form_Request_Code renames F_ScrollForward_Page; + REQ_SCR_BPAGE : Form_Request_Code renames F_ScrollBackward_Page; + REQ_SCR_FHPAGE : Form_Request_Code renames F_ScrollForward_HalfPage; REQ_SCR_BHPAGE : Form_Request_Code renames F_ScrollBackward_HalfPage; - REQ_SCR_FCHAR : Form_Request_Code renames F_HScrollForward_Char; - REQ_SCR_BCHAR : Form_Request_Code renames F_HScrollBackward_Char; - REQ_SCR_HFLINE : Form_Request_Code renames F_HScrollForward_Line; - REQ_SCR_HBLINE : Form_Request_Code renames F_HScrollBackward_Line; - REQ_SCR_HFHALF : Form_Request_Code renames F_HScrollForward_HalfLine; + REQ_SCR_FCHAR : Form_Request_Code renames F_HScrollForward_Char; + REQ_SCR_BCHAR : Form_Request_Code renames F_HScrollBackward_Char; + REQ_SCR_HFLINE : Form_Request_Code renames F_HScrollForward_Line; + REQ_SCR_HBLINE : Form_Request_Code renames F_HScrollBackward_Line; + REQ_SCR_HFHALF : Form_Request_Code renames F_HScrollForward_HalfLine; REQ_SCR_HBHALF : Form_Request_Code renames F_HScrollBackward_HalfLine; - REQ_VALIDATION : Form_Request_Code renames F_Validate_Field; - REQ_NEXT_CHOICE : Form_Request_Code renames F_Next_Choice; + REQ_VALIDATION : Form_Request_Code renames F_Validate_Field; + REQ_NEXT_CHOICE : Form_Request_Code renames F_Next_Choice; REQ_PREV_CHOICE : Form_Request_Code renames F_Previous_Choice; - procedure Request_Name (Key : in Form_Request_Code; + procedure Request_Name (Key : in Form_Request_Code; Name : out String); function Request_Name (Key : Form_Request_Code) return String; @@ -297,22 +296,22 @@ -- |===================================================================== -- #1A NAME="AFU_1"#2| - function Create (Height : Line_Count; - Width : Column_Count; - Top : Line_Position; - Left : Column_Position; - Off_Screen : Natural := 0; + function Create (Height : Line_Count; + Width : Column_Count; + Top : Line_Position; + Left : Column_Position; + Off_Screen : Natural := 0; More_Buffers : Buffer_Number := Buffer_Number'First) return Field; -- AKA: new_field() -- An overloaded Create is defined later. Pragma Inline appears there. -- #1A NAME="AFU_2"#2| - function New_Field (Height : Line_Count; - Width : Column_Count; - Top : Line_Position; - Left : Column_Position; - Off_Screen : Natural := 0; + function New_Field (Height : Line_Count; + Width : Column_Count; + Top : Line_Position; + Left : Column_Position; + Off_Screen : Natural := 0; More_Buffers : Buffer_Number := Buffer_Number'First) return Field renames Create; -- AKA: new_field() @@ -325,15 +324,15 @@ -- An overloaded Delete is defined later. Pragma Inline appears there. -- #1A NAME="AFU_4"#2| - function Duplicate (Fld : Field; - Top : Line_Position; + function Duplicate (Fld : Field; + Top : Line_Position; Left : Column_Position) return Field; -- AKA: dup_field() pragma Inline (Duplicate); -- #1A NAME="AFU_5"#2| - function Link (Fld : Field; - Top : Line_Position; + function Link (Fld : Field; + Top : Line_Position; Left : Column_Position) return Field; -- AKA: link_field() pragma Inline (Link); @@ -343,7 +342,7 @@ -- |===================================================================== -- #1A NAME="AFU_6"#2| - procedure Set_Justification (Fld : in Field; + procedure Set_Justification (Fld : in Field; Just : in Field_Justification := None); -- AKA: set_field_just() pragma Inline (Set_Justification); @@ -359,28 +358,28 @@ -- #1A NAME="AFU_8"#2| procedure Set_Buffer - (Fld : in Field; - Buffer : in Buffer_Number := Buffer_Number'First; + (Fld : in Field; + Buffer : in Buffer_Number := Buffer_Number'First; Str : in String); -- AKA: set_field_buffer() -- Not inlined -- #1A NAME="AFU_9"#2| procedure Get_Buffer - (Fld : in Field; - Buffer : in Buffer_Number := Buffer_Number'First; + (Fld : in Field; + Buffer : in Buffer_Number := Buffer_Number'First; Str : out String); -- AKA: field_buffer() function Get_Buffer - (Fld : in Field; + (Fld : in Field; Buffer : in Buffer_Number := Buffer_Number'First) return String; -- AKA: field_buffer() -- Same but as function pragma Inline (Get_Buffer); -- #1A NAME="AFU_10"#2| - procedure Set_Status (Fld : in Field; + procedure Set_Status (Fld : in Field; Status : in Boolean := True); -- AKA: set_field_status() pragma Inline (Set_Status); @@ -391,7 +390,7 @@ pragma Inline (Changed); -- #1A NAME="AFU_12"#2| - procedure Set_Maximum_Size (Fld : in Field; + procedure Set_Maximum_Size (Fld : in Field; Max : in Natural := 0); -- AKA: set_field_max() pragma Inline (Set_Maximum_Size); @@ -401,21 +400,21 @@ -- |===================================================================== -- #1A NAME="AFU_13"#2| - procedure Set_Options (Fld : in Field; + procedure Set_Options (Fld : in Field; Options : in Field_Option_Set); -- AKA: set_field_opts() -- An overloaded version is defined later. Pragma Inline appears there -- #1A NAME="AFU_14"#2| - procedure Switch_Options (Fld : in Field; - Options : in Field_Option_Set; + procedure Switch_Options (Fld : in Field; + Options : in Field_Option_Set; On : Boolean := True); -- AKA: field_opts_on() -- AKA: field_opts_off() -- An overloaded version is defined later. Pragma Inline appears there -- #1A NAME="AFU_15"#2| - procedure Get_Options (Fld : in Field; + procedure Get_Options (Fld : in Field; Options : out Field_Option_Set); -- AKA: field_opts() @@ -431,52 +430,52 @@ -- #1A NAME="AFU_17"#2| procedure Set_Foreground - (Fld : in Field; - Fore : in Character_Attribute_Set := Normal_Video; + (Fld : in Field; + Fore : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA: set_field_fore() pragma Inline (Set_Foreground); -- #1A NAME="AFU_18"#2| - procedure Foreground (Fld : in Field; + procedure Foreground (Fld : in Field; Fore : out Character_Attribute_Set); -- AKA: field_fore() -- #1A NAME="AFU_19"#2| - procedure Foreground (Fld : in Field; - Fore : out Character_Attribute_Set; + procedure Foreground (Fld : in Field; + Fore : out Character_Attribute_Set; Color : out Color_Pair); -- AKA: field_fore() pragma Inline (Foreground); -- #1A NAME="AFU_20"#2| procedure Set_Background - (Fld : in Field; - Back : in Character_Attribute_Set := Normal_Video; + (Fld : in Field; + Back : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA: set_field_back() pragma Inline (Set_Background); -- #1A NAME="AFU_21"#2| - procedure Background (Fld : in Field; + procedure Background (Fld : in Field; Back : out Character_Attribute_Set); -- AKA: field_back() -- #1A NAME="AFU_22"#2| - procedure Background (Fld : in Field; - Back : out Character_Attribute_Set; + procedure Background (Fld : in Field; + Back : out Character_Attribute_Set; Color : out Color_Pair); -- AKA: field_back() pragma Inline (Background); -- #1A NAME="AFU_23"#2| - procedure Set_Pad_Character (Fld : in Field; + procedure Set_Pad_Character (Fld : in Field; Pad : in Character := Space); -- AKA: set_field_pad() pragma Inline (Set_Pad_Character); -- #1A NAME="AFU_24"#2| - procedure Pad_Character (Fld : in Field; + procedure Pad_Character (Fld : in Field; Pad : out Character); -- AKA: field_pad() pragma Inline (Pad_Character); @@ -486,20 +485,20 @@ -- |===================================================================== -- #1A NAME="AFU_25"#2| - procedure Info (Fld : in Field; - Lines : out Line_Count; - Columns : out Column_Count; - First_Row : out Line_Position; - First_Column : out Column_Position; - Off_Screen : out Natural; + procedure Info (Fld : in Field; + Lines : out Line_Count; + Columns : out Column_Count; + First_Row : out Line_Position; + First_Column : out Column_Position; + Off_Screen : out Natural; Additional_Buffers : out Buffer_Number); -- AKA: field_info() pragma Inline (Info); -- #1A NAME="AFU_26"#2| - procedure Dynamic_Info (Fld : in Field; - Lines : out Line_Count; - Columns : out Column_Count; + procedure Dynamic_Info (Fld : in Field; + Lines : out Line_Count; + Columns : out Column_Count; Max : out Natural); -- AKA: dynamic_field_info() pragma Inline (Dynamic_Info); @@ -509,7 +508,7 @@ -- |===================================================================== -- #1A NAME="AFU_27"#2| - procedure Set_Window (Frm : in Form; + procedure Set_Window (Frm : in Form; Win : in Window); -- AKA: set_form_win() pragma Inline (Set_Window); @@ -520,7 +519,7 @@ pragma Inline (Get_Window); -- #1A NAME="AFU_29"#2| - procedure Set_Sub_Window (Frm : in Form; + procedure Set_Sub_Window (Frm : in Form; Win : in Window); -- AKA: set_form_sub() pragma Inline (Set_Sub_Window); @@ -531,8 +530,8 @@ pragma Inline (Get_Sub_Window); -- #1A NAME="AFU_31"#2| - procedure Scale (Frm : in Form; - Lines : out Line_Count; + procedure Scale (Frm : in Form; + Lines : out Line_Count; Columns : out Column_Count); -- AKA: scale_form() pragma Inline (Scale); @@ -545,25 +544,25 @@ pragma Convention (C, Form_Hook_Function); -- #1A NAME="AFU_32"#2| - procedure Set_Field_Init_Hook (Frm : in Form; + procedure Set_Field_Init_Hook (Frm : in Form; Proc : in Form_Hook_Function); -- AKA: set_field_init() pragma Inline (Set_Field_Init_Hook); -- #1A NAME="AFU_33"#2| - procedure Set_Field_Term_Hook (Frm : in Form; + procedure Set_Field_Term_Hook (Frm : in Form; Proc : in Form_Hook_Function); -- AKA: set_field_term() pragma Inline (Set_Field_Term_Hook); -- #1A NAME="AFU_34"#2| - procedure Set_Form_Init_Hook (Frm : in Form; + procedure Set_Form_Init_Hook (Frm : in Form; Proc : in Form_Hook_Function); -- AKA: set_form_init() pragma Inline (Set_Form_Init_Hook); -- #1A NAME="AFU_35"#2| - procedure Set_Form_Term_Hook (Frm : in Form; + procedure Set_Form_Term_Hook (Frm : in Form; Proc : in Form_Hook_Function); -- AKA: set_form_term() pragma Inline (Set_Form_Term_Hook); @@ -593,19 +592,19 @@ -- |===================================================================== -- #1A NAME="AFU_40"#2| - procedure Redefine (Frm : in Form; + procedure Redefine (Frm : in Form; Flds : in Field_Array_Access); -- AKA: set_form_fields() pragma Inline (Redefine); -- #1A NAME="AFU_41"#2| - procedure Set_Fields (Frm : in Form; + procedure Set_Fields (Frm : in Form; Flds : in Field_Array_Access) renames Redefine; -- AKA: set_form_fields() pragma Inline (Set_Fields); -- #1A NAME="AFU_42"#2| - function Fields (Frm : Form; + function Fields (Frm : Form; Index : Positive) return Field; -- AKA: form_fields() pragma Inline (Fields); @@ -616,8 +615,8 @@ pragma Inline (Field_Count); -- #1A NAME="AFU_44"#2| - procedure Move (Fld : in Field; - Line : in Line_Position; + procedure Move (Fld : in Field; + Line : in Line_Position; Column : in Column_Position); -- AKA: move_field() pragma Inline (Move); @@ -648,21 +647,21 @@ -- |===================================================================== -- #1A NAME="AFU_48"#2| - procedure Set_Options (Frm : in Form; + procedure Set_Options (Frm : in Form; Options : in Form_Option_Set); -- AKA: set_form_opts() pragma Inline (Set_Options); -- #1A NAME="AFU_49"#2| - procedure Switch_Options (Frm : in Form; - Options : in Form_Option_Set; + procedure Switch_Options (Frm : in Form; + Options : in Form_Option_Set; On : Boolean := True); -- AKA: form_opts_on() -- AKA: form_opts_off() pragma Inline (Switch_Options); -- #1A NAME="AFU_50"#2| - procedure Get_Options (Frm : in Form; + procedure Get_Options (Frm : in Form; Options : out Form_Option_Set); -- AKA: form_opts() @@ -676,7 +675,7 @@ -- |===================================================================== -- #1A NAME="AFU_52"#2| - procedure Post (Frm : in Form; + procedure Post (Frm : in Form; Post : in Boolean := True); -- AKA: post_form() -- AKA: unpost_form() @@ -709,13 +708,13 @@ -- | Man page form_driver.3x -- |===================================================================== - type Driver_Result is (Form_Ok, - Request_Denied, - Unknown_Request, + type Driver_Result is (Form_Ok, + Request_Denied, + Unknown_Request, Invalid_Field); -- #1A NAME="AFU_56"#2| - function Driver (Frm : Form; + function Driver (Frm : Form; Key : Key_Code) return Driver_Result; -- AKA: form_driver() -- Driver not inlined @@ -727,7 +726,7 @@ type Page_Number is new Natural; -- #1A NAME="AFU_57"#2| - procedure Set_Current (Frm : in Form; + procedure Set_Current (Frm : in Form; Fld : in Field); -- AKA: set_current_field() pragma Inline (Set_Current); @@ -738,7 +737,7 @@ pragma Inline (Current); -- #1A NAME="AFU_59"#2| - procedure Set_Page (Frm : in Form; + procedure Set_Page (Frm : in Form; Page : in Page_Number := Page_Number'First); -- AKA: set_form_page() pragma Inline (Set_Page); @@ -761,7 +760,7 @@ -- |===================================================================== -- #1A NAME="AFU_62"#2| - procedure Set_New_Page (Fld : in Field; + procedure Set_New_Page (Fld : in Field; New_Page : in Boolean := True); -- AKA: set_new_page() pragma Inline (Set_New_Page); @@ -778,10 +777,10 @@ ------------------------------------------------------------------------------ private - type Field is new System.Storage_Elements.Integer_Address; + type Field is new System.Storage_Elements.Integer_Address; type Form is new System.Storage_Elements.Integer_Address; - Null_Field : constant Field := 0; + Null_Field : constant Field := 0; Null_Form : constant Form := 0; end Terminal_Interface.Curses.Forms; diff --git a/doc/html/ada/terminal_interface-curses-menus-item_user_data__adb.htm b/doc/html/ada/terminal_interface-curses-menus-item_user_data__adb.htm index e2e694cf..6e6f93ab 100644 --- a/doc/html/ada/terminal_interface-curses-menus-item_user_data__adb.htm +++ b/doc/html/ada/terminal_interface-curses-menus-item_user_data__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-menus-item_user_data.adb

    File : terminal_interface-curses-menus-item_user_data.adb


    @@ -42,41 +43,41 @@ -- @Revision: 1.11 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Menus.Item_User_Data is +package body Terminal_Interface.Curses.Menus.Item_User_Data is - use type Interfaces.C.int; + use type Interfaces.C.int; - procedure Set_User_Data (Itm : in Item; - Data : in User_Access) + procedure Set_User_Data (Itm : in Item; + Data : in User_Access) is - function Set_Item_Userptr (Itm : Item; - Addr : User_Access) return C_Int; - pragma Import (C, Set_Item_Userptr, "set_item_userptr"); + function Set_Item_Userptr (Itm : Item; + Addr : User_Access) return C_Int; + pragma Import (C, Set_Item_Userptr, "set_item_userptr"); - Res : constant Eti_Error := Set_Item_Userptr (Itm, Data); + Res : constant Eti_Error := Set_Item_Userptr (Itm, Data); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_User_Data; + end Set_User_Data; - function Get_User_Data (Itm : in Item) return User_Access + function Get_User_Data (Itm : in Item) return User_Access is - function Item_Userptr (Itm : Item) return User_Access; - pragma Import (C, Item_Userptr, "item_userptr"); + function Item_Userptr (Itm : Item) return User_Access; + pragma Import (C, Item_Userptr, "item_userptr"); begin - return Item_Userptr (Itm); - end Get_User_Data; + return Item_Userptr (Itm); + end Get_User_Data; - procedure Get_User_Data (Itm : in Item; - Data : out User_Access) + procedure Get_User_Data (Itm : in Item; + Data : out User_Access) is begin - Data := Get_User_Data (Itm); - end Get_User_Data; + Data := Get_User_Data (Itm); + end Get_User_Data; -end Terminal_Interface.Curses.Menus.Item_User_Data; +end Terminal_Interface.Curses.Menus.Item_User_Data; diff --git a/doc/html/ada/terminal_interface-curses-menus-item_user_data__ads.htm b/doc/html/ada/terminal_interface-curses-menus-item_user_data__ads.htm index 38a06f20..dc1dad55 100644 --- a/doc/html/ada/terminal_interface-curses-menus-item_user_data__ads.htm +++ b/doc/html/ada/terminal_interface-curses-menus-item_user_data__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-menus-item_user_data.ads

    File : terminal_interface-curses-menus-item_user_data.ads


    @@ -45,8 +46,8 @@ ------------------------------------------------------------------------------ generic - type User is limited private; - type User_Access is access User; + type User is limited private; + type User_Access is access User; package Terminal_Interface.Curses.Menus.Item_User_Data is pragma Preelaborate (Terminal_Interface.Curses.Menus.Item_User_Data); @@ -59,13 +60,13 @@ -- |===================================================================== -- #1A NAME="AFU_1"#2| - procedure Set_User_Data (Itm : in Item; + procedure Set_User_Data (Itm : in Item; Data : in User_Access); -- AKA: set_item_userptr pragma Inline (Set_User_Data); -- #1A NAME="AFU_2"#2| - procedure Get_User_Data (Itm : in Item; + procedure Get_User_Data (Itm : in Item; Data : out User_Access); -- AKA: item_userptr diff --git a/doc/html/ada/terminal_interface-curses-menus-menu_user_data__adb.htm b/doc/html/ada/terminal_interface-curses-menus-menu_user_data__adb.htm index be124612..77d45a72 100644 --- a/doc/html/ada/terminal_interface-curses-menus-menu_user_data__adb.htm +++ b/doc/html/ada/terminal_interface-curses-menus-menu_user_data__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-menus-menu_user_data.adb

    File : terminal_interface-curses-menus-menu_user_data.adb


    @@ -42,40 +43,40 @@ -- @Revision: 1.12 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.Menus.Menu_User_Data is +package body Terminal_Interface.Curses.Menus.Menu_User_Data is - use type Interfaces.C.int; + use type Interfaces.C.int; - procedure Set_User_Data (Men : in Menu; - Data : in User_Access) + procedure Set_User_Data (Men : in Menu; + Data : in User_Access) is - function Set_Menu_Userptr (Men : Menu; - Data : User_Access) return C_Int; - pragma Import (C, Set_Menu_Userptr, "set_menu_userptr"); + function Set_Menu_Userptr (Men : Menu; + Data : User_Access) return C_Int; + pragma Import (C, Set_Menu_Userptr, "set_menu_userptr"); - Res : constant Eti_Error := Set_Menu_Userptr (Men, Data); + Res : constant Eti_Error := Set_Menu_Userptr (Men, Data); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_User_Data; + end Set_User_Data; - function Get_User_Data (Men : in Menu) return User_Access + function Get_User_Data (Men : in Menu) return User_Access is - function Menu_Userptr (Men : Menu) return User_Access; - pragma Import (C, Menu_Userptr, "menu_userptr"); + function Menu_Userptr (Men : Menu) return User_Access; + pragma Import (C, Menu_Userptr, "menu_userptr"); begin - return Menu_Userptr (Men); - end Get_User_Data; + return Menu_Userptr (Men); + end Get_User_Data; - procedure Get_User_Data (Men : in Menu; - Data : out User_Access) + procedure Get_User_Data (Men : in Menu; + Data : out User_Access) is begin - Data := Get_User_Data (Men); - end Get_User_Data; + Data := Get_User_Data (Men); + end Get_User_Data; -end Terminal_Interface.Curses.Menus.Menu_User_Data; +end Terminal_Interface.Curses.Menus.Menu_User_Data; diff --git a/doc/html/ada/terminal_interface-curses-menus-menu_user_data__ads.htm b/doc/html/ada/terminal_interface-curses-menus-menu_user_data__ads.htm index 5a4bab9d..8eb56535 100644 --- a/doc/html/ada/terminal_interface-curses-menus-menu_user_data__ads.htm +++ b/doc/html/ada/terminal_interface-curses-menus-menu_user_data__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-menus-menu_user_data.ads

    File : terminal_interface-curses-menus-menu_user_data.ads


    @@ -45,8 +46,8 @@ ------------------------------------------------------------------------------ generic - type User is limited private; - type User_Access is access User; + type User is limited private; + type User_Access is access User; package Terminal_Interface.Curses.Menus.Menu_User_Data is pragma Preelaborate (Terminal_Interface.Curses.Menus.Menu_User_Data); @@ -55,13 +56,13 @@ -- |===================================================================== -- #1A NAME="AFU_1"#2| - procedure Set_User_Data (Men : in Menu; + procedure Set_User_Data (Men : in Menu; Data : in User_Access); -- AKA: set_menu_userptr pragma Inline (Set_User_Data); -- #1A NAME="AFU_2"#2| - procedure Get_User_Data (Men : in Menu; + procedure Get_User_Data (Men : in Menu; Data : out User_Access); -- AKA: menu_userptr diff --git a/doc/html/ada/terminal_interface-curses-menus__adb.htm b/doc/html/ada/terminal_interface-curses-menus__adb.htm index 376052a4..428f57dc 100644 --- a/doc/html/ada/terminal_interface-curses-menus__adb.htm +++ b/doc/html/ada/terminal_interface-curses-menus__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-menus.adb

    File : terminal_interface-curses-menus.adb


    @@ -11,7 +12,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -39,988 +40,989 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.22 @ +-- @Revision: 1.25 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Unchecked_Deallocation; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -with Interfaces.C; use Interfaces.C; -with Interfaces.C.Strings; use Interfaces.C.Strings; -with Interfaces.C.Pointers; +with Interfaces.C; use Interfaces.C; +with Interfaces.C.Strings; use Interfaces.C.Strings; +with Interfaces.C.Pointers; with Ada.Unchecked_Conversion; -package body Terminal_Interface.Curses.Menus is +package body Terminal_Interface.Curses.Menus is - type C_Item_Array is array (Natural range <>) of aliased Item; - package I_Array is new - Interfaces.C.Pointers (Natural, Item, C_Item_Array, Null_Item); + type C_Item_Array is array (Natural range <>) of aliased Item; + package I_Array is new + Interfaces.C.Pointers (Natural, Item, C_Item_Array, Null_Item); use type System.Bit_Order; - subtype chars_ptr is Interfaces.C.Strings.chars_ptr; + subtype chars_ptr is Interfaces.C.Strings.chars_ptr; - function MOS_2_CInt is new - Ada.Unchecked_Conversion (Menu_Option_Set, - C_Int); + function MOS_2_CInt is new + Ada.Unchecked_Conversion (Menu_Option_Set, + C_Int); - function CInt_2_MOS is new - Ada.Unchecked_Conversion (C_Int, - Menu_Option_Set); + function CInt_2_MOS is new + Ada.Unchecked_Conversion (C_Int, + Menu_Option_Set); - function IOS_2_CInt is new - Ada.Unchecked_Conversion (Item_Option_Set, - C_Int); + function IOS_2_CInt is new + Ada.Unchecked_Conversion (Item_Option_Set, + C_Int); - function CInt_2_IOS is new - Ada.Unchecked_Conversion (C_Int, - Item_Option_Set); + function CInt_2_IOS is new + Ada.Unchecked_Conversion (C_Int, + Item_Option_Set); ------------------------------------------------------------------------------ - procedure Request_Name (Key : in Menu_Request_Code; - Name : out String) + procedure Request_Name (Key : in Menu_Request_Code; + Name : out String) is - function Request_Name (Key : C_Int) return chars_ptr; - pragma Import (C, Request_Name, "menu_request_name"); + function Request_Name (Key : C_Int) return chars_ptr; + pragma Import (C, Request_Name, "menu_request_name"); begin - Fill_String (Request_Name (C_Int (Key)), Name); - end Request_Name; + Fill_String (Request_Name (C_Int (Key)), Name); + end Request_Name; - function Request_Name (Key : Menu_Request_Code) return String + function Request_Name (Key : Menu_Request_Code) return String is - function Request_Name (Key : C_Int) return chars_ptr; - pragma Import (C, Request_Name, "menu_request_name"); + function Request_Name (Key : C_Int) return chars_ptr; + pragma Import (C, Request_Name, "menu_request_name"); begin - return Fill_String (Request_Name (C_Int (Key))); - end Request_Name; + return Fill_String (Request_Name (C_Int (Key))); + end Request_Name; - function Create (Name : String; - Description : String := "") return Item + function Create (Name : String; + Description : String := "") return Item is - type Char_Ptr is access all Interfaces.C.char; - function Newitem (Name, Desc : Char_Ptr) return Item; - pragma Import (C, Newitem, "new_item"); + type Char_Ptr is access all Interfaces.C.char; + function Newitem (Name, Desc : Char_Ptr) return Item; + pragma Import (C, Newitem, "new_item"); - type Name_String is new char_array (0 .. Name'Length); - type Name_String_Ptr is access Name_String; - pragma Controlled (Name_String_Ptr); + type Name_String is new char_array (0 .. Name'Length); + type Name_String_Ptr is access Name_String; + pragma Controlled (Name_String_Ptr); - type Desc_String is new char_array (0 .. Description'Length); - type Desc_String_Ptr is access Desc_String; - pragma Controlled (Desc_String_Ptr); + type Desc_String is new char_array (0 .. Description'Length); + type Desc_String_Ptr is access Desc_String; + pragma Controlled (Desc_String_Ptr); - Name_Str : Name_String_Ptr := new Name_String; - Desc_Str : Desc_String_Ptr := new Desc_String; - Name_Len, Desc_Len : size_t; - Result : Item; + Name_Str : constant Name_String_Ptr := new Name_String; + Desc_Str : constant Desc_String_Ptr := new Desc_String; + Name_Len, Desc_Len : size_t; + Result : Item; begin - To_C (Name, Name_Str.all, Name_Len); - To_C (Description, Desc_Str.all, Desc_Len); - Result := Newitem (Name_Str.all (Name_Str.all'First)'Access, - Desc_Str.all (Desc_Str.all'First)'Access); - if Result = Null_Item then - raise Eti_System_Error; + To_C (Name, Name_Str.all, Name_Len); + To_C (Description, Desc_Str.all, Desc_Len); + Result := Newitem (Name_Str.all (Name_Str.all'First)'Access, + Desc_Str.all (Desc_Str.all'First)'Access); + if Result = Null_Item then + raise Eti_System_Error; end if; - return Result; - end Create; + return Result; + end Create; - procedure Delete (Itm : in out Item) + procedure Delete (Itm : in out Item) is - function Descname (Itm : Item) return chars_ptr; - pragma Import (C, Descname, "item_description"); - function Itemname (Itm : Item) return chars_ptr; - pragma Import (C, Itemname, "item_name"); + function Descname (Itm : Item) return chars_ptr; + pragma Import (C, Descname, "item_description"); + function Itemname (Itm : Item) return chars_ptr; + pragma Import (C, Itemname, "item_name"); - function Freeitem (Itm : Item) return C_Int; - pragma Import (C, Freeitem, "free_item"); + function Freeitem (Itm : Item) return C_Int; + pragma Import (C, Freeitem, "free_item"); - Res : Eti_Error; - Ptr : chars_ptr; + Res : Eti_Error; + Ptr : chars_ptr; begin - Ptr := Descname (Itm); - if Ptr /= Null_Ptr then - Interfaces.C.Strings.Free (Ptr); + Ptr := Descname (Itm); + if Ptr /= Null_Ptr then + Interfaces.C.Strings.Free (Ptr); end if; - Ptr := Itemname (Itm); - if Ptr /= Null_Ptr then - Interfaces.C.Strings.Free (Ptr); + Ptr := Itemname (Itm); + if Ptr /= Null_Ptr then + Interfaces.C.Strings.Free (Ptr); end if; - Res := Freeitem (Itm); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Freeitem (Itm); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Itm := Null_Item; - end Delete; + Itm := Null_Item; + end Delete; ------------------------------------------------------------------------------- - procedure Set_Value (Itm : in Item; - Value : in Boolean := True) + procedure Set_Value (Itm : in Item; + Value : in Boolean := True) is - function Set_Item_Val (Itm : Item; - Val : C_Int) return C_Int; - pragma Import (C, Set_Item_Val, "set_item_value"); + function Set_Item_Val (Itm : Item; + Val : C_Int) return C_Int; + pragma Import (C, Set_Item_Val, "set_item_value"); - Res : constant Eti_Error := Set_Item_Val (Itm, Boolean'Pos (Value)); + Res : constant Eti_Error := Set_Item_Val (Itm, Boolean'Pos (Value)); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Value; + end Set_Value; - function Value (Itm : Item) return Boolean + function Value (Itm : Item) return Boolean is - function Item_Val (Itm : Item) return C_Int; - pragma Import (C, Item_Val, "item_value"); + function Item_Val (Itm : Item) return C_Int; + pragma Import (C, Item_Val, "item_value"); begin - if Item_Val (Itm) = Curses_False then + if Item_Val (Itm) = Curses_False then return False; else return True; end if; - end Value; + end Value; ------------------------------------------------------------------------------- - function Visible (Itm : Item) return Boolean + function Visible (Itm : Item) return Boolean is - function Item_Vis (Itm : Item) return C_Int; - pragma Import (C, Item_Vis, "item_visible"); + function Item_Vis (Itm : Item) return C_Int; + pragma Import (C, Item_Vis, "item_visible"); begin - if Item_Vis (Itm) = Curses_False then + if Item_Vis (Itm) = Curses_False then return False; else return True; end if; - end Visible; + end Visible; ------------------------------------------------------------------------------- - procedure Set_Options (Itm : in Item; - Options : in Item_Option_Set) + procedure Set_Options (Itm : in Item; + Options : in Item_Option_Set) is - function Set_Item_Opts (Itm : Item; - Opt : C_Int) return C_Int; - pragma Import (C, Set_Item_Opts, "set_item_opts"); + function Set_Item_Opts (Itm : Item; + Opt : C_Int) return C_Int; + pragma Import (C, Set_Item_Opts, "set_item_opts"); - Opt : C_Int := IOS_2_CInt (Options); - Res : Eti_Error; + Opt : constant C_Int := IOS_2_CInt (Options); + Res : Eti_Error; begin - Res := Set_Item_Opts (Itm, Opt); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Item_Opts (Itm, Opt); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Options; + end Set_Options; - procedure Switch_Options (Itm : in Item; - Options : in Item_Option_Set; - On : Boolean := True) + procedure Switch_Options (Itm : in Item; + Options : in Item_Option_Set; + On : Boolean := True) is - function Item_Opts_On (Itm : Item; - Opt : C_Int) return C_Int; - pragma Import (C, Item_Opts_On, "item_opts_on"); - function Item_Opts_Off (Itm : Item; - Opt : C_Int) return C_Int; - pragma Import (C, Item_Opts_Off, "item_opts_off"); + function Item_Opts_On (Itm : Item; + Opt : C_Int) return C_Int; + pragma Import (C, Item_Opts_On, "item_opts_on"); + function Item_Opts_Off (Itm : Item; + Opt : C_Int) return C_Int; + pragma Import (C, Item_Opts_Off, "item_opts_off"); - Opt : C_Int := IOS_2_CInt (Options); - Err : Eti_Error; + Opt : constant C_Int := IOS_2_CInt (Options); + Err : Eti_Error; begin - if On then - Err := Item_Opts_On (Itm, Opt); + if On then + Err := Item_Opts_On (Itm, Opt); else - Err := Item_Opts_Off (Itm, Opt); + Err := Item_Opts_Off (Itm, Opt); end if; - if Err /= E_Ok then - Eti_Exception (Err); + if Err /= E_Ok then + Eti_Exception (Err); end if; - end Switch_Options; + end Switch_Options; - procedure Get_Options (Itm : in Item; - Options : out Item_Option_Set) + procedure Get_Options (Itm : in Item; + Options : out Item_Option_Set) is - function Item_Opts (Itm : Item) return C_Int; - pragma Import (C, Item_Opts, "item_opts"); + function Item_Opts (Itm : Item) return C_Int; + pragma Import (C, Item_Opts, "item_opts"); - Res : C_Int := Item_Opts (Itm); + Res : constant C_Int := Item_Opts (Itm); begin - Options := CInt_2_IOS (Res); - end Get_Options; + Options := CInt_2_IOS (Res); + end Get_Options; - function Get_Options (Itm : Item := Null_Item) return Item_Option_Set + function Get_Options (Itm : Item := Null_Item) return Item_Option_Set is - Ios : Item_Option_Set; + Ios : Item_Option_Set; begin - Get_Options (Itm, Ios); - return Ios; - end Get_Options; + Get_Options (Itm, Ios); + return Ios; + end Get_Options; ------------------------------------------------------------------------------- - procedure Name (Itm : in Item; - Name : out String) + procedure Name (Itm : in Item; + Name : out String) is - function Itemname (Itm : Item) return chars_ptr; - pragma Import (C, Itemname, "item_name"); + function Itemname (Itm : Item) return chars_ptr; + pragma Import (C, Itemname, "item_name"); begin - Fill_String (Itemname (Itm), Name); - end Name; + Fill_String (Itemname (Itm), Name); + end Name; - function Name (Itm : in Item) return String + function Name (Itm : in Item) return String is - function Itemname (Itm : Item) return chars_ptr; - pragma Import (C, Itemname, "item_name"); + function Itemname (Itm : Item) return chars_ptr; + pragma Import (C, Itemname, "item_name"); begin - return Fill_String (Itemname (Itm)); - end Name; + return Fill_String (Itemname (Itm)); + end Name; - procedure Description (Itm : in Item; - Description : out String) + procedure Description (Itm : in Item; + Description : out String) is - function Descname (Itm : Item) return chars_ptr; - pragma Import (C, Descname, "item_description"); + function Descname (Itm : Item) return chars_ptr; + pragma Import (C, Descname, "item_description"); begin - Fill_String (Descname (Itm), Description); - end Description; + Fill_String (Descname (Itm), Description); + end Description; - function Description (Itm : in Item) return String + function Description (Itm : in Item) return String is - function Descname (Itm : Item) return chars_ptr; - pragma Import (C, Descname, "item_description"); + function Descname (Itm : Item) return chars_ptr; + pragma Import (C, Descname, "item_description"); begin - return Fill_String (Descname (Itm)); - end Description; + return Fill_String (Descname (Itm)); + end Description; ------------------------------------------------------------------------------- - procedure Set_Current (Men : in Menu; - Itm : in Item) + procedure Set_Current (Men : in Menu; + Itm : in Item) is - function Set_Curr_Item (Men : Menu; - Itm : Item) return C_Int; - pragma Import (C, Set_Curr_Item, "set_current_item"); + function Set_Curr_Item (Men : Menu; + Itm : Item) return C_Int; + pragma Import (C, Set_Curr_Item, "set_current_item"); - Res : constant Eti_Error := Set_Curr_Item (Men, Itm); + Res : constant Eti_Error := Set_Curr_Item (Men, Itm); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Current; + end Set_Current; - function Current (Men : Menu) return Item + function Current (Men : Menu) return Item is - function Curr_Item (Men : Menu) return Item; - pragma Import (C, Curr_Item, "current_item"); + function Curr_Item (Men : Menu) return Item; + pragma Import (C, Curr_Item, "current_item"); - Res : constant Item := Curr_Item (Men); + Res : constant Item := Curr_Item (Men); begin - if Res = Null_Item then - raise Menu_Exception; + if Res = Null_Item then + raise Menu_Exception; end if; - return Res; - end Current; + return Res; + end Current; - procedure Set_Top_Row (Men : in Menu; - Line : in Line_Position) + procedure Set_Top_Row (Men : in Menu; + Line : in Line_Position) is - function Set_Toprow (Men : Menu; - Line : C_Int) return C_Int; - pragma Import (C, Set_Toprow, "set_top_row"); + function Set_Toprow (Men : Menu; + Line : C_Int) return C_Int; + pragma Import (C, Set_Toprow, "set_top_row"); - Res : constant Eti_Error := Set_Toprow (Men, C_Int (Line)); + Res : constant Eti_Error := Set_Toprow (Men, C_Int (Line)); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Top_Row; + end Set_Top_Row; - function Top_Row (Men : Menu) return Line_Position + function Top_Row (Men : Menu) return Line_Position is - function Toprow (Men : Menu) return C_Int; - pragma Import (C, Toprow, "top_row"); + function Toprow (Men : Menu) return C_Int; + pragma Import (C, Toprow, "top_row"); - Res : constant C_Int := Toprow (Men); + Res : constant C_Int := Toprow (Men); begin - if Res = Curses_Err then - raise Menu_Exception; + if Res = Curses_Err then + raise Menu_Exception; end if; - return Line_Position (Res); - end Top_Row; + return Line_Position (Res); + end Top_Row; - function Get_Index (Itm : Item) return Positive + function Get_Index (Itm : Item) return Positive is - function Get_Itemindex (Itm : Item) return C_Int; - pragma Import (C, Get_Itemindex, "item_index"); + function Get_Itemindex (Itm : Item) return C_Int; + pragma Import (C, Get_Itemindex, "item_index"); - Res : constant C_Int := Get_Itemindex (Itm); + Res : constant C_Int := Get_Itemindex (Itm); begin - if Res = Curses_Err then - raise Menu_Exception; + if Res = Curses_Err then + raise Menu_Exception; end if; - return Positive (Natural (Res) + Positive'First); - end Get_Index; + return Positive (Natural (Res) + Positive'First); + end Get_Index; ------------------------------------------------------------------------------- - procedure Post (Men : in Menu; - Post : in Boolean := True) + procedure Post (Men : in Menu; + Post : in Boolean := True) is - function M_Post (Men : Menu) return C_Int; - pragma Import (C, M_Post, "post_menu"); - function M_Unpost (Men : Menu) return C_Int; - pragma Import (C, M_Unpost, "unpost_menu"); + function M_Post (Men : Menu) return C_Int; + pragma Import (C, M_Post, "post_menu"); + function M_Unpost (Men : Menu) return C_Int; + pragma Import (C, M_Unpost, "unpost_menu"); - Res : Eti_Error; + Res : Eti_Error; begin - if Post then - Res := M_Post (Men); + if Post then + Res := M_Post (Men); else - Res := M_Unpost (Men); + Res := M_Unpost (Men); end if; - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Post; + end Post; ------------------------------------------------------------------------------- - procedure Set_Options (Men : in Menu; - Options : in Menu_Option_Set) + procedure Set_Options (Men : in Menu; + Options : in Menu_Option_Set) is - function Set_Menu_Opts (Men : Menu; - Opt : C_Int) return C_Int; - pragma Import (C, Set_Menu_Opts, "set_menu_opts"); + function Set_Menu_Opts (Men : Menu; + Opt : C_Int) return C_Int; + pragma Import (C, Set_Menu_Opts, "set_menu_opts"); - Opt : C_Int := MOS_2_CInt (Options); - Res : Eti_Error; + Opt : constant C_Int := MOS_2_CInt (Options); + Res : Eti_Error; begin - Res := Set_Menu_Opts (Men, Opt); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Menu_Opts (Men, Opt); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Options; + end Set_Options; - procedure Switch_Options (Men : in Menu; - Options : in Menu_Option_Set; - On : in Boolean := True) + procedure Switch_Options (Men : in Menu; + Options : in Menu_Option_Set; + On : in Boolean := True) is - function Menu_Opts_On (Men : Menu; - Opt : C_Int) return C_Int; - pragma Import (C, Menu_Opts_On, "menu_opts_on"); - function Menu_Opts_Off (Men : Menu; - Opt : C_Int) return C_Int; - pragma Import (C, Menu_Opts_Off, "menu_opts_off"); + function Menu_Opts_On (Men : Menu; + Opt : C_Int) return C_Int; + pragma Import (C, Menu_Opts_On, "menu_opts_on"); + function Menu_Opts_Off (Men : Menu; + Opt : C_Int) return C_Int; + pragma Import (C, Menu_Opts_Off, "menu_opts_off"); - Opt : C_Int := MOS_2_CInt (Options); - Err : Eti_Error; + Opt : constant C_Int := MOS_2_CInt (Options); + Err : Eti_Error; begin - if On then - Err := Menu_Opts_On (Men, Opt); + if On then + Err := Menu_Opts_On (Men, Opt); else - Err := Menu_Opts_Off (Men, Opt); + Err := Menu_Opts_Off (Men, Opt); end if; - if Err /= E_Ok then - Eti_Exception (Err); + if Err /= E_Ok then + Eti_Exception (Err); end if; - end Switch_Options; + end Switch_Options; - procedure Get_Options (Men : in Menu; - Options : out Menu_Option_Set) + procedure Get_Options (Men : in Menu; + Options : out Menu_Option_Set) is - function Menu_Opts (Men : Menu) return C_Int; - pragma Import (C, Menu_Opts, "menu_opts"); + function Menu_Opts (Men : Menu) return C_Int; + pragma Import (C, Menu_Opts, "menu_opts"); - Res : C_Int := Menu_Opts (Men); + Res : constant C_Int := Menu_Opts (Men); begin - Options := CInt_2_MOS (Res); - end Get_Options; + Options := CInt_2_MOS (Res); + end Get_Options; - function Get_Options (Men : Menu := Null_Menu) return Menu_Option_Set + function Get_Options (Men : Menu := Null_Menu) return Menu_Option_Set is - Mos : Menu_Option_Set; + Mos : Menu_Option_Set; begin - Get_Options (Men, Mos); - return Mos; - end Get_Options; + Get_Options (Men, Mos); + return Mos; + end Get_Options; ------------------------------------------------------------------------------- - procedure Set_Window (Men : in Menu; - Win : in Window) + procedure Set_Window (Men : in Menu; + Win : in Window) is - function Set_Menu_Win (Men : Menu; - Win : Window) return C_Int; - pragma Import (C, Set_Menu_Win, "set_menu_win"); + function Set_Menu_Win (Men : Menu; + Win : Window) return C_Int; + pragma Import (C, Set_Menu_Win, "set_menu_win"); - Res : constant Eti_Error := Set_Menu_Win (Men, Win); + Res : constant Eti_Error := Set_Menu_Win (Men, Win); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Window; + end Set_Window; - function Get_Window (Men : Menu) return Window + function Get_Window (Men : Menu) return Window is - function Menu_Win (Men : Menu) return Window; - pragma Import (C, Menu_Win, "menu_win"); + function Menu_Win (Men : Menu) return Window; + pragma Import (C, Menu_Win, "menu_win"); - W : constant Window := Menu_Win (Men); + W : constant Window := Menu_Win (Men); begin - return W; - end Get_Window; + return W; + end Get_Window; - procedure Set_Sub_Window (Men : in Menu; - Win : in Window) + procedure Set_Sub_Window (Men : in Menu; + Win : in Window) is - function Set_Menu_Sub (Men : Menu; - Win : Window) return C_Int; - pragma Import (C, Set_Menu_Sub, "set_menu_sub"); + function Set_Menu_Sub (Men : Menu; + Win : Window) return C_Int; + pragma Import (C, Set_Menu_Sub, "set_menu_sub"); - Res : constant Eti_Error := Set_Menu_Sub (Men, Win); + Res : constant Eti_Error := Set_Menu_Sub (Men, Win); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Sub_Window; + end Set_Sub_Window; - function Get_Sub_Window (Men : Menu) return Window + function Get_Sub_Window (Men : Menu) return Window is - function Menu_Sub (Men : Menu) return Window; - pragma Import (C, Menu_Sub, "menu_sub"); + function Menu_Sub (Men : Menu) return Window; + pragma Import (C, Menu_Sub, "menu_sub"); - W : constant Window := Menu_Sub (Men); + W : constant Window := Menu_Sub (Men); begin - return W; - end Get_Sub_Window; + return W; + end Get_Sub_Window; - procedure Scale (Men : in Menu; - Lines : out Line_Count; - Columns : out Column_Count) + procedure Scale (Men : in Menu; + Lines : out Line_Count; + Columns : out Column_Count) is - type C_Int_Access is access all C_Int; - function M_Scale (Men : Menu; - Yp, Xp : C_Int_Access) return C_Int; - pragma Import (C, M_Scale, "scale_menu"); + type C_Int_Access is access all C_Int; + function M_Scale (Men : Menu; + Yp, Xp : C_Int_Access) return C_Int; + pragma Import (C, M_Scale, "scale_menu"); - X, Y : aliased C_Int; - Res : constant Eti_Error := M_Scale (Men, Y'Access, X'Access); + X, Y : aliased C_Int; + Res : constant Eti_Error := M_Scale (Men, Y'Access, X'Access); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Lines := Line_Count (Y); - Columns := Column_Count (X); - end Scale; + Lines := Line_Count (Y); + Columns := Column_Count (X); + end Scale; ------------------------------------------------------------------------------- - procedure Position_Cursor (Men : Menu) + procedure Position_Cursor (Men : Menu) is - function Pos_Menu_Cursor (Men : Menu) return C_Int; - pragma Import (C, Pos_Menu_Cursor, "pos_menu_cursor"); + function Pos_Menu_Cursor (Men : Menu) return C_Int; + pragma Import (C, Pos_Menu_Cursor, "pos_menu_cursor"); - Res : constant Eti_Error := Pos_Menu_Cursor (Men); + Res : constant Eti_Error := Pos_Menu_Cursor (Men); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Position_Cursor; + end Position_Cursor; ------------------------------------------------------------------------------- - procedure Set_Mark (Men : in Menu; - Mark : in String) - is - type Char_Ptr is access all Interfaces.C.char; - function Set_Mark (Men : Menu; - Mark : Char_Ptr) return C_Int; - pragma Import (C, Set_Mark, "set_menu_mark"); - - Txt : char_array (0 .. Mark'Length); - Len : size_t; - Res : Eti_Error; - begin - To_C (Mark, Txt, Len); - Res := Set_Mark (Men, Txt (Txt'First)'Access); - if Res /= E_Ok then - Eti_Exception (Res); + procedure Set_Mark (Men : in Menu; + Mark : in String) + is + type Char_Ptr is access all Interfaces.C.char; + function Set_Mark (Men : Menu; + Mark : Char_Ptr) return C_Int; + pragma Import (C, Set_Mark, "set_menu_mark"); + + Txt : char_array (0 .. Mark'Length); + Len : size_t; + Res : Eti_Error; + begin + To_C (Mark, Txt, Len); + Res := Set_Mark (Men, Txt (Txt'First)'Access); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Mark; + end Set_Mark; - procedure Mark (Men : in Menu; - Mark : out String) + procedure Mark (Men : in Menu; + Mark : out String) is - function Get_Menu_Mark (Men : Menu) return chars_ptr; - pragma Import (C, Get_Menu_Mark, "menu_mark"); + function Get_Menu_Mark (Men : Menu) return chars_ptr; + pragma Import (C, Get_Menu_Mark, "menu_mark"); begin - Fill_String (Get_Menu_Mark (Men), Mark); - end Mark; + Fill_String (Get_Menu_Mark (Men), Mark); + end Mark; - function Mark (Men : Menu) return String + function Mark (Men : Menu) return String is - function Get_Menu_Mark (Men : Menu) return chars_ptr; - pragma Import (C, Get_Menu_Mark, "menu_mark"); + function Get_Menu_Mark (Men : Menu) return chars_ptr; + pragma Import (C, Get_Menu_Mark, "menu_mark"); begin - return Fill_String (Get_Menu_Mark (Men)); - end Mark; + return Fill_String (Get_Menu_Mark (Men)); + end Mark; ------------------------------------------------------------------------------- - procedure Set_Foreground - (Men : in Menu; - Fore : in Character_Attribute_Set := Normal_Video; - Color : in Color_Pair := Color_Pair'First) - is - function Set_Menu_Fore (Men : Menu; - Attr : C_Chtype) return C_Int; - pragma Import (C, Set_Menu_Fore, "set_menu_fore"); - - Ch : constant Attributed_Character := (Ch => Character'First, - Color => Color, - Attr => Fore); - Res : constant Eti_Error := Set_Menu_Fore (Men, AttrChar_To_Chtype (Ch)); - begin - if Res /= E_Ok then - Eti_Exception (Res); + procedure Set_Foreground + (Men : in Menu; + Fore : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) + is + function Set_Menu_Fore (Men : Menu; + Attr : C_Chtype) return C_Int; + pragma Import (C, Set_Menu_Fore, "set_menu_fore"); + + Ch : constant Attributed_Character := (Ch => Character'First, + Color => Color, + Attr => Fore); + Res : constant Eti_Error := Set_Menu_Fore (Men, AttrChar_To_Chtype (Ch)); + begin + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Foreground; + end Set_Foreground; - procedure Foreground (Men : in Menu; - Fore : out Character_Attribute_Set) + procedure Foreground (Men : in Menu; + Fore : out Character_Attribute_Set) is - function Menu_Fore (Men : Menu) return C_Chtype; - pragma Import (C, Menu_Fore, "menu_fore"); + function Menu_Fore (Men : Menu) return C_Chtype; + pragma Import (C, Menu_Fore, "menu_fore"); begin - Fore := Chtype_To_AttrChar (Menu_Fore (Men)).Attr; - end Foreground; + Fore := Chtype_To_AttrChar (Menu_Fore (Men)).Attr; + end Foreground; - procedure Foreground (Men : in Menu; - Fore : out Character_Attribute_Set; - Color : out Color_Pair) + procedure Foreground (Men : in Menu; + Fore : out Character_Attribute_Set; + Color : out Color_Pair) is - function Menu_Fore (Men : Menu) return C_Chtype; - pragma Import (C, Menu_Fore, "menu_fore"); + function Menu_Fore (Men : Menu) return C_Chtype; + pragma Import (C, Menu_Fore, "menu_fore"); begin - Fore := Chtype_To_AttrChar (Menu_Fore (Men)).Attr; - Color := Chtype_To_AttrChar (Menu_Fore (Men)).Color; - end Foreground; + Fore := Chtype_To_AttrChar (Menu_Fore (Men)).Attr; + Color := Chtype_To_AttrChar (Menu_Fore (Men)).Color; + end Foreground; - procedure Set_Background - (Men : in Menu; - Back : in Character_Attribute_Set := Normal_Video; - Color : in Color_Pair := Color_Pair'First) + procedure Set_Background + (Men : in Menu; + Back : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) is - function Set_Menu_Back (Men : Menu; - Attr : C_Chtype) return C_Int; - pragma Import (C, Set_Menu_Back, "set_menu_back"); + function Set_Menu_Back (Men : Menu; + Attr : C_Chtype) return C_Int; + pragma Import (C, Set_Menu_Back, "set_menu_back"); - Ch : constant Attributed_Character := (Ch => Character'First, - Color => Color, - Attr => Back); - Res : constant Eti_Error := Set_Menu_Back (Men, AttrChar_To_Chtype (Ch)); + Ch : constant Attributed_Character := (Ch => Character'First, + Color => Color, + Attr => Back); + Res : constant Eti_Error := Set_Menu_Back (Men, AttrChar_To_Chtype (Ch)); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Background; + end Set_Background; - procedure Background (Men : in Menu; - Back : out Character_Attribute_Set) + procedure Background (Men : in Menu; + Back : out Character_Attribute_Set) is - function Menu_Back (Men : Menu) return C_Chtype; - pragma Import (C, Menu_Back, "menu_back"); + function Menu_Back (Men : Menu) return C_Chtype; + pragma Import (C, Menu_Back, "menu_back"); begin - Back := Chtype_To_AttrChar (Menu_Back (Men)).Attr; - end Background; + Back := Chtype_To_AttrChar (Menu_Back (Men)).Attr; + end Background; - procedure Background (Men : in Menu; - Back : out Character_Attribute_Set; - Color : out Color_Pair) + procedure Background (Men : in Menu; + Back : out Character_Attribute_Set; + Color : out Color_Pair) is - function Menu_Back (Men : Menu) return C_Chtype; - pragma Import (C, Menu_Back, "menu_back"); + function Menu_Back (Men : Menu) return C_Chtype; + pragma Import (C, Menu_Back, "menu_back"); begin - Back := Chtype_To_AttrChar (Menu_Back (Men)).Attr; - Color := Chtype_To_AttrChar (Menu_Back (Men)).Color; - end Background; + Back := Chtype_To_AttrChar (Menu_Back (Men)).Attr; + Color := Chtype_To_AttrChar (Menu_Back (Men)).Color; + end Background; - procedure Set_Grey (Men : in Menu; - Grey : in Character_Attribute_Set := Normal_Video; - Color : in Color_Pair := Color_Pair'First) + procedure Set_Grey (Men : in Menu; + Grey : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) is - function Set_Menu_Grey (Men : Menu; - Attr : C_Chtype) return C_Int; - pragma Import (C, Set_Menu_Grey, "set_menu_grey"); + function Set_Menu_Grey (Men : Menu; + Attr : C_Chtype) return C_Int; + pragma Import (C, Set_Menu_Grey, "set_menu_grey"); - Ch : constant Attributed_Character := (Ch => Character'First, - Color => Color, - Attr => Grey); + Ch : constant Attributed_Character := (Ch => Character'First, + Color => Color, + Attr => Grey); - Res : constant Eti_Error := Set_Menu_Grey (Men, AttrChar_To_Chtype (Ch)); + Res : constant Eti_Error := Set_Menu_Grey (Men, AttrChar_To_Chtype (Ch)); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Grey; + end Set_Grey; - procedure Grey (Men : in Menu; - Grey : out Character_Attribute_Set) + procedure Grey (Men : in Menu; + Grey : out Character_Attribute_Set) is - function Menu_Grey (Men : Menu) return C_Chtype; - pragma Import (C, Menu_Grey, "menu_grey"); + function Menu_Grey (Men : Menu) return C_Chtype; + pragma Import (C, Menu_Grey, "menu_grey"); begin - Grey := Chtype_To_AttrChar (Menu_Grey (Men)).Attr; - end Grey; + Grey := Chtype_To_AttrChar (Menu_Grey (Men)).Attr; + end Grey; - procedure Grey (Men : in Menu; - Grey : out Character_Attribute_Set; - Color : out Color_Pair) + procedure Grey (Men : in Menu; + Grey : out Character_Attribute_Set; + Color : out Color_Pair) is - function Menu_Grey (Men : Menu) return C_Chtype; - pragma Import (C, Menu_Grey, "menu_grey"); + function Menu_Grey (Men : Menu) return C_Chtype; + pragma Import (C, Menu_Grey, "menu_grey"); begin - Grey := Chtype_To_AttrChar (Menu_Grey (Men)).Attr; - Color := Chtype_To_AttrChar (Menu_Grey (Men)).Color; - end Grey; + Grey := Chtype_To_AttrChar (Menu_Grey (Men)).Attr; + Color := Chtype_To_AttrChar (Menu_Grey (Men)).Color; + end Grey; - procedure Set_Pad_Character (Men : in Menu; - Pad : in Character := Space) + procedure Set_Pad_Character (Men : in Menu; + Pad : in Character := Space) is - function Set_Menu_Pad (Men : Menu; - Ch : C_Int) return C_Int; - pragma Import (C, Set_Menu_Pad, "set_menu_pad"); + function Set_Menu_Pad (Men : Menu; + Ch : C_Int) return C_Int; + pragma Import (C, Set_Menu_Pad, "set_menu_pad"); - Res : constant Eti_Error := Set_Menu_Pad (Men, - C_Int (Character'Pos (Pad))); + Res : constant Eti_Error := Set_Menu_Pad (Men, + C_Int (Character'Pos (Pad))); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Pad_Character; + end Set_Pad_Character; - procedure Pad_Character (Men : in Menu; - Pad : out Character) + procedure Pad_Character (Men : in Menu; + Pad : out Character) is - function Menu_Pad (Men : Menu) return C_Int; - pragma Import (C, Menu_Pad, "menu_pad"); + function Menu_Pad (Men : Menu) return C_Int; + pragma Import (C, Menu_Pad, "menu_pad"); begin - Pad := Character'Val (Menu_Pad (Men)); - end Pad_Character; + Pad := Character'Val (Menu_Pad (Men)); + end Pad_Character; ------------------------------------------------------------------------------- - procedure Set_Spacing (Men : in Menu; - Descr : in Column_Position := 0; - Row : in Line_Position := 0; - Col : in Column_Position := 0) - is - function Set_Spacing (Men : Menu; - D, R, C : C_Int) return C_Int; - pragma Import (C, Set_Spacing, "set_menu_spacing"); - - Res : constant Eti_Error := Set_Spacing (Men, - C_Int (Descr), - C_Int (Row), - C_Int (Col)); - begin - if Res /= E_Ok then - Eti_Exception (Res); + procedure Set_Spacing (Men : in Menu; + Descr : in Column_Position := 0; + Row : in Line_Position := 0; + Col : in Column_Position := 0) + is + function Set_Spacing (Men : Menu; + D, R, C : C_Int) return C_Int; + pragma Import (C, Set_Spacing, "set_menu_spacing"); + + Res : constant Eti_Error := Set_Spacing (Men, + C_Int (Descr), + C_Int (Row), + C_Int (Col)); + begin + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Spacing; - - procedure Spacing (Men : in Menu; - Descr : out Column_Position; - Row : out Line_Position; - Col : out Column_Position) - is - type C_Int_Access is access all C_Int; - function Get_Spacing (Men : Menu; - D, R, C : C_Int_Access) return C_Int; - pragma Import (C, Get_Spacing, "menu_spacing"); - - D, R, C : aliased C_Int; - Res : constant Eti_Error := Get_Spacing (Men, - D'Access, - R'Access, - C'Access); - begin - if Res /= E_Ok then - Eti_Exception (Res); + end Set_Spacing; + + procedure Spacing (Men : in Menu; + Descr : out Column_Position; + Row : out Line_Position; + Col : out Column_Position) + is + type C_Int_Access is access all C_Int; + function Get_Spacing (Men : Menu; + D, R, C : C_Int_Access) return C_Int; + pragma Import (C, Get_Spacing, "menu_spacing"); + + D, R, C : aliased C_Int; + Res : constant Eti_Error := Get_Spacing (Men, + D'Access, + R'Access, + C'Access); + begin + if Res /= E_Ok then + Eti_Exception (Res); else - Descr := Column_Position (D); - Row := Line_Position (R); - Col := Column_Position (C); + Descr := Column_Position (D); + Row := Line_Position (R); + Col := Column_Position (C); end if; - end Spacing; + end Spacing; ------------------------------------------------------------------------------- - function Set_Pattern (Men : Menu; - Text : String) return Boolean - is - type Char_Ptr is access all Interfaces.C.char; - function Set_Pattern (Men : Menu; - Pattern : Char_Ptr) return C_Int; - pragma Import (C, Set_Pattern, "set_menu_pattern"); - - S : char_array (0 .. Text'Length); - L : size_t; - Res : Eti_Error; - begin - To_C (Text, S, L); - Res := Set_Pattern (Men, S (S'First)'Access); - case Res is - when E_No_Match => return False; - when E_Ok => return True; + function Set_Pattern (Men : Menu; + Text : String) return Boolean + is + type Char_Ptr is access all Interfaces.C.char; + function Set_Pattern (Men : Menu; + Pattern : Char_Ptr) return C_Int; + pragma Import (C, Set_Pattern, "set_menu_pattern"); + + S : char_array (0 .. Text'Length); + L : size_t; + Res : Eti_Error; + begin + To_C (Text, S, L); + Res := Set_Pattern (Men, S (S'First)'Access); + case Res is + when E_No_Match => return False; + when E_Ok => return True; when others => - Eti_Exception (Res); + Eti_Exception (Res); return False; end case; - end Set_Pattern; + end Set_Pattern; - procedure Pattern (Men : in Menu; - Text : out String) + procedure Pattern (Men : in Menu; + Text : out String) is - function Get_Pattern (Men : Menu) return chars_ptr; - pragma Import (C, Get_Pattern, "menu_pattern"); + function Get_Pattern (Men : Menu) return chars_ptr; + pragma Import (C, Get_Pattern, "menu_pattern"); begin - Fill_String (Get_Pattern (Men), Text); - end Pattern; + Fill_String (Get_Pattern (Men), Text); + end Pattern; ------------------------------------------------------------------------------- - procedure Set_Format (Men : in Menu; - Lines : in Line_Count; - Columns : in Column_Count) + procedure Set_Format (Men : in Menu; + Lines : in Line_Count; + Columns : in Column_Count) is - function Set_Menu_Fmt (Men : Menu; - Lin : C_Int; - Col : C_Int) return C_Int; - pragma Import (C, Set_Menu_Fmt, "set_menu_format"); + function Set_Menu_Fmt (Men : Menu; + Lin : C_Int; + Col : C_Int) return C_Int; + pragma Import (C, Set_Menu_Fmt, "set_menu_format"); - Res : constant Eti_Error := Set_Menu_Fmt (Men, - C_Int (Lines), - C_Int (Columns)); + Res : constant Eti_Error := Set_Menu_Fmt (Men, + C_Int (Lines), + C_Int (Columns)); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Format; + end Set_Format; - procedure Format (Men : in Menu; - Lines : out Line_Count; - Columns : out Column_Count) + procedure Format (Men : in Menu; + Lines : out Line_Count; + Columns : out Column_Count) is - type C_Int_Access is access all C_Int; - function Menu_Fmt (Men : Menu; - Y, X : C_Int_Access) return C_Int; - pragma Import (C, Menu_Fmt, "menu_format"); + type C_Int_Access is access all C_Int; + function Menu_Fmt (Men : Menu; + Y, X : C_Int_Access) return C_Int; + pragma Import (C, Menu_Fmt, "menu_format"); - L, C : aliased C_Int; - Res : constant Eti_Error := Menu_Fmt (Men, L'Access, C'Access); + L, C : aliased C_Int; + Res : constant Eti_Error := Menu_Fmt (Men, L'Access, C'Access); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); else - Lines := Line_Count (L); - Columns := Column_Count (C); + Lines := Line_Count (L); + Columns := Column_Count (C); end if; - end Format; + end Format; ------------------------------------------------------------------------------- - procedure Set_Item_Init_Hook (Men : in Menu; - Proc : in Menu_Hook_Function) + procedure Set_Item_Init_Hook (Men : in Menu; + Proc : in Menu_Hook_Function) is - function Set_Item_Init (Men : Menu; - Proc : Menu_Hook_Function) return C_Int; - pragma Import (C, Set_Item_Init, "set_item_init"); + function Set_Item_Init (Men : Menu; + Proc : Menu_Hook_Function) return C_Int; + pragma Import (C, Set_Item_Init, "set_item_init"); - Res : constant Eti_Error := Set_Item_Init (Men, Proc); + Res : constant Eti_Error := Set_Item_Init (Men, Proc); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Item_Init_Hook; + end Set_Item_Init_Hook; - procedure Set_Item_Term_Hook (Men : in Menu; - Proc : in Menu_Hook_Function) + procedure Set_Item_Term_Hook (Men : in Menu; + Proc : in Menu_Hook_Function) is - function Set_Item_Term (Men : Menu; - Proc : Menu_Hook_Function) return C_Int; - pragma Import (C, Set_Item_Term, "set_item_term"); + function Set_Item_Term (Men : Menu; + Proc : Menu_Hook_Function) return C_Int; + pragma Import (C, Set_Item_Term, "set_item_term"); - Res : constant Eti_Error := Set_Item_Term (Men, Proc); + Res : constant Eti_Error := Set_Item_Term (Men, Proc); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Item_Term_Hook; + end Set_Item_Term_Hook; - procedure Set_Menu_Init_Hook (Men : in Menu; - Proc : in Menu_Hook_Function) + procedure Set_Menu_Init_Hook (Men : in Menu; + Proc : in Menu_Hook_Function) is - function Set_Menu_Init (Men : Menu; - Proc : Menu_Hook_Function) return C_Int; - pragma Import (C, Set_Menu_Init, "set_menu_init"); + function Set_Menu_Init (Men : Menu; + Proc : Menu_Hook_Function) return C_Int; + pragma Import (C, Set_Menu_Init, "set_menu_init"); - Res : constant Eti_Error := Set_Menu_Init (Men, Proc); + Res : constant Eti_Error := Set_Menu_Init (Men, Proc); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Menu_Init_Hook; + end Set_Menu_Init_Hook; - procedure Set_Menu_Term_Hook (Men : in Menu; - Proc : in Menu_Hook_Function) + procedure Set_Menu_Term_Hook (Men : in Menu; + Proc : in Menu_Hook_Function) is - function Set_Menu_Term (Men : Menu; - Proc : Menu_Hook_Function) return C_Int; - pragma Import (C, Set_Menu_Term, "set_menu_term"); + function Set_Menu_Term (Men : Menu; + Proc : Menu_Hook_Function) return C_Int; + pragma Import (C, Set_Menu_Term, "set_menu_term"); - Res : constant Eti_Error := Set_Menu_Term (Men, Proc); + Res : constant Eti_Error := Set_Menu_Term (Men, Proc); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - end Set_Menu_Term_Hook; + end Set_Menu_Term_Hook; - function Get_Item_Init_Hook (Men : Menu) return Menu_Hook_Function + function Get_Item_Init_Hook (Men : Menu) return Menu_Hook_Function is - function Item_Init (Men : Menu) return Menu_Hook_Function; - pragma Import (C, Item_Init, "item_init"); + function Item_Init (Men : Menu) return Menu_Hook_Function; + pragma Import (C, Item_Init, "item_init"); begin - return Item_Init (Men); - end Get_Item_Init_Hook; + return Item_Init (Men); + end Get_Item_Init_Hook; - function Get_Item_Term_Hook (Men : Menu) return Menu_Hook_Function + function Get_Item_Term_Hook (Men : Menu) return Menu_Hook_Function is - function Item_Term (Men : Menu) return Menu_Hook_Function; - pragma Import (C, Item_Term, "item_term"); + function Item_Term (Men : Menu) return Menu_Hook_Function; + pragma Import (C, Item_Term, "item_term"); begin - return Item_Term (Men); - end Get_Item_Term_Hook; + return Item_Term (Men); + end Get_Item_Term_Hook; - function Get_Menu_Init_Hook (Men : Menu) return Menu_Hook_Function + function Get_Menu_Init_Hook (Men : Menu) return Menu_Hook_Function is - function Menu_Init (Men : Menu) return Menu_Hook_Function; - pragma Import (C, Menu_Init, "menu_init"); + function Menu_Init (Men : Menu) return Menu_Hook_Function; + pragma Import (C, Menu_Init, "menu_init"); begin - return Menu_Init (Men); - end Get_Menu_Init_Hook; + return Menu_Init (Men); + end Get_Menu_Init_Hook; - function Get_Menu_Term_Hook (Men : Menu) return Menu_Hook_Function + function Get_Menu_Term_Hook (Men : Menu) return Menu_Hook_Function is - function Menu_Term (Men : Menu) return Menu_Hook_Function; - pragma Import (C, Menu_Term, "menu_term"); + function Menu_Term (Men : Menu) return Menu_Hook_Function; + pragma Import (C, Menu_Term, "menu_term"); begin - return Menu_Term (Men); - end Get_Menu_Term_Hook; + return Menu_Term (Men); + end Get_Menu_Term_Hook; ------------------------------------------------------------------------------- - procedure Redefine (Men : in Menu; - Items : in Item_Array_Access) + procedure Redefine (Men : in Menu; + Items : in Item_Array_Access) is - function Set_Items (Men : Menu; - Items : System.Address) return C_Int; - pragma Import (C, Set_Items, "set_menu_items"); + function Set_Items (Men : Menu; + Items : System.Address) return C_Int; + pragma Import (C, Set_Items, "set_menu_items"); - Res : Eti_Error; + Res : Eti_Error; begin - pragma Assert (Items (Items'Last) = Null_Item); - if Items (Items'Last) /= Null_Item then - raise Menu_Exception; + pragma Assert (Items (Items'Last) = Null_Item); + if Items (Items'Last) /= Null_Item then + raise Menu_Exception; else - Res := Set_Items (Men, Items.all'Address); - if Res /= E_Ok then - Eti_Exception (Res); + Res := Set_Items (Men, Items.all'Address); + if Res /= E_Ok then + Eti_Exception (Res); end if; end if; - end Redefine; + end Redefine; - function Item_Count (Men : Menu) return Natural + function Item_Count (Men : Menu) return Natural is - function Count (Men : Menu) return C_Int; - pragma Import (C, Count, "item_count"); + function Count (Men : Menu) return C_Int; + pragma Import (C, Count, "item_count"); begin - return Natural (Count (Men)); - end Item_Count; + return Natural (Count (Men)); + end Item_Count; - function Items (Men : Menu; - Index : Positive) return Item + function Items (Men : Menu; + Index : Positive) return Item is - use I_Array; + use I_Array; - function C_Mitems (Men : Menu) return Pointer; - pragma Import (C, C_Mitems, "menu_items"); + function C_Mitems (Men : Menu) return Pointer; + pragma Import (C, C_Mitems, "menu_items"); - P : Pointer := C_Mitems (Men); + P : Pointer := C_Mitems (Men); begin - if P = null or else Index not in 1 .. Item_Count (Men) then - raise Menu_Exception; + if P = null or else Index not in 1 .. Item_Count (Men) then + raise Menu_Exception; else - P := P + ptrdiff_t (C_Int (Index) - 1); - return P.all; + P := P + ptrdiff_t (C_Int (Index) - 1); + return P.all; end if; - end Items; + end Items; ------------------------------------------------------------------------------- - function Create (Items : Item_Array_Access) return Menu + function Create (Items : Item_Array_Access) return Menu is - function Newmenu (Items : System.Address) return Menu; - pragma Import (C, Newmenu, "new_menu"); + function Newmenu (Items : System.Address) return Menu; + pragma Import (C, Newmenu, "new_menu"); - M : Menu; + M : Menu; begin - pragma Assert (Items (Items'Last) = Null_Item); - if Items (Items'Last) /= Null_Item then - raise Menu_Exception; + pragma Assert (Items (Items'Last) = Null_Item); + if Items (Items'Last) /= Null_Item then + raise Menu_Exception; else - M := Newmenu (Items.all'Address); - if M = Null_Menu then - raise Menu_Exception; + M := Newmenu (Items.all'Address); + if M = Null_Menu then + raise Menu_Exception; end if; - return M; + return M; end if; - end Create; + end Create; - procedure Delete (Men : in out Menu) + procedure Delete (Men : in out Menu) is - function Free (Men : Menu) return C_Int; - pragma Import (C, Free, "free_menu"); + function Free (Men : Menu) return C_Int; + pragma Import (C, Free, "free_menu"); - Res : constant Eti_Error := Free (Men); + Res : constant Eti_Error := Free (Men); begin - if Res /= E_Ok then - Eti_Exception (Res); + if Res /= E_Ok then + Eti_Exception (Res); end if; - Men := Null_Menu; - end Delete; + Men := Null_Menu; + end Delete; ------------------------------------------------------------------------------ - function Driver (Men : Menu; - Key : Key_Code) return Driver_Result + function Driver (Men : Menu; + Key : Key_Code) return Driver_Result is - function Driver (Men : Menu; - Key : C_Int) return C_Int; - pragma Import (C, Driver, "menu_driver"); + function Driver (Men : Menu; + Key : C_Int) return C_Int; + pragma Import (C, Driver, "menu_driver"); - R : Eti_Error := Driver (Men, C_Int (Key)); + R : constant Eti_Error := Driver (Men, C_Int (Key)); begin - if R /= E_Ok then - case R is - when E_Unknown_Command => return Unknown_Request; - when E_No_Match => return No_Match; - when E_Request_Denied | - E_Not_Selectable => return Request_Denied; + if R /= E_Ok then + case R is + when E_Unknown_Command => return Unknown_Request; + when E_No_Match => return No_Match; + when E_Request_Denied | + E_Not_Selectable => return Request_Denied; when others => - Eti_Exception (R); + Eti_Exception (R); end case; end if; - return Menu_Ok; - end Driver; + return Menu_Ok; + end Driver; - procedure Free (IA : in out Item_Array_Access; - Free_Items : in Boolean := False) + procedure Free (IA : in out Item_Array_Access; + Free_Items : in Boolean := False) is - procedure Release is new Ada.Unchecked_Deallocation - (Item_Array, Item_Array_Access); + procedure Release is new Ada.Unchecked_Deallocation + (Item_Array, Item_Array_Access); begin - if IA /= null and then Free_Items then - for I in IA'First .. (IA'Last - 1) loop - if (IA (I) /= Null_Item) then - Delete (IA (I)); + if IA /= null and then Free_Items then + for I in IA'First .. (IA'Last - 1) loop + if IA (I) /= Null_Item then + Delete (IA (I)); end if; end loop; end if; - Release (IA); - end Free; + Release (IA); + end Free; ------------------------------------------------------------------------------- - function Default_Menu_Options return Menu_Option_Set + function Default_Menu_Options return Menu_Option_Set is begin - return Get_Options (Null_Menu); - end Default_Menu_Options; + return Get_Options (Null_Menu); + end Default_Menu_Options; - function Default_Item_Options return Item_Option_Set + function Default_Item_Options return Item_Option_Set is begin - return Get_Options (Null_Item); - end Default_Item_Options; + return Get_Options (Null_Item); + end Default_Item_Options; ------------------------------------------------------------------------------- -end Terminal_Interface.Curses.Menus; +end Terminal_Interface.Curses.Menus; diff --git a/doc/html/ada/terminal_interface-curses-menus__ads.htm b/doc/html/ada/terminal_interface-curses-menus__ads.htm index 4d5f290a..537c4ac5 100644 --- a/doc/html/ada/terminal_interface-curses-menus__ads.htm +++ b/doc/html/ada/terminal_interface-curses-menus__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-menus.ads

    File : terminal_interface-curses-menus.ads


    @@ -57,57 +58,57 @@ Space : Character renames Ada.Characters.Latin_1.Space; - type Item is private; + type Item is private; type Menu is private; --------------------------- -- Interface constants -- --------------------------- - Null_Item : constant Item; + Null_Item : constant Item; Null_Menu : constant Menu; subtype Menu_Request_Code is Key_Code range (Key_Max + 1) .. (Key_Max + 17); -- The prefix M_ stands for "Menu Request" - M_Left_Item : constant Menu_Request_Code := Key_Max + 1; - M_Right_Item : constant Menu_Request_Code := Key_Max + 2; - M_Up_Item : constant Menu_Request_Code := Key_Max + 3; - M_Down_Item : constant Menu_Request_Code := Key_Max + 4; - M_ScrollUp_Line : constant Menu_Request_Code := Key_Max + 5; - M_ScrollDown_Line : constant Menu_Request_Code := Key_Max + 6; - M_ScrollDown_Page : constant Menu_Request_Code := Key_Max + 7; - M_ScrollUp_Page : constant Menu_Request_Code := Key_Max + 8; - M_First_Item : constant Menu_Request_Code := Key_Max + 9; - M_Last_Item : constant Menu_Request_Code := Key_Max + 10; - M_Next_Item : constant Menu_Request_Code := Key_Max + 11; - M_Previous_Item : constant Menu_Request_Code := Key_Max + 12; - M_Toggle_Item : constant Menu_Request_Code := Key_Max + 13; - M_Clear_Pattern : constant Menu_Request_Code := Key_Max + 14; - M_Back_Pattern : constant Menu_Request_Code := Key_Max + 15; - M_Next_Match : constant Menu_Request_Code := Key_Max + 16; + M_Left_Item : constant Menu_Request_Code := Key_Max + 1; + M_Right_Item : constant Menu_Request_Code := Key_Max + 2; + M_Up_Item : constant Menu_Request_Code := Key_Max + 3; + M_Down_Item : constant Menu_Request_Code := Key_Max + 4; + M_ScrollUp_Line : constant Menu_Request_Code := Key_Max + 5; + M_ScrollDown_Line : constant Menu_Request_Code := Key_Max + 6; + M_ScrollDown_Page : constant Menu_Request_Code := Key_Max + 7; + M_ScrollUp_Page : constant Menu_Request_Code := Key_Max + 8; + M_First_Item : constant Menu_Request_Code := Key_Max + 9; + M_Last_Item : constant Menu_Request_Code := Key_Max + 10; + M_Next_Item : constant Menu_Request_Code := Key_Max + 11; + M_Previous_Item : constant Menu_Request_Code := Key_Max + 12; + M_Toggle_Item : constant Menu_Request_Code := Key_Max + 13; + M_Clear_Pattern : constant Menu_Request_Code := Key_Max + 14; + M_Back_Pattern : constant Menu_Request_Code := Key_Max + 15; + M_Next_Match : constant Menu_Request_Code := Key_Max + 16; M_Previous_Match : constant Menu_Request_Code := Key_Max + 17; -- For those who like the old 'C' names for the request codes - REQ_LEFT_ITEM : Menu_Request_Code renames M_Left_Item; - REQ_RIGHT_ITEM : Menu_Request_Code renames M_Right_Item; - REQ_UP_ITEM : Menu_Request_Code renames M_Up_Item; - REQ_DOWN_ITEM : Menu_Request_Code renames M_Down_Item; - REQ_SCR_ULINE : Menu_Request_Code renames M_ScrollUp_Line; - REQ_SCR_DLINE : Menu_Request_Code renames M_ScrollDown_Line; - REQ_SCR_DPAGE : Menu_Request_Code renames M_ScrollDown_Page; - REQ_SCR_UPAGE : Menu_Request_Code renames M_ScrollUp_Page; - REQ_FIRST_ITEM : Menu_Request_Code renames M_First_Item; - REQ_LAST_ITEM : Menu_Request_Code renames M_Last_Item; - REQ_NEXT_ITEM : Menu_Request_Code renames M_Next_Item; - REQ_PREV_ITEM : Menu_Request_Code renames M_Previous_Item; - REQ_TOGGLE_ITEM : Menu_Request_Code renames M_Toggle_Item; - REQ_CLEAR_PATTERN : Menu_Request_Code renames M_Clear_Pattern; - REQ_BACK_PATTERN : Menu_Request_Code renames M_Back_Pattern; - REQ_NEXT_MATCH : Menu_Request_Code renames M_Next_Match; + REQ_LEFT_ITEM : Menu_Request_Code renames M_Left_Item; + REQ_RIGHT_ITEM : Menu_Request_Code renames M_Right_Item; + REQ_UP_ITEM : Menu_Request_Code renames M_Up_Item; + REQ_DOWN_ITEM : Menu_Request_Code renames M_Down_Item; + REQ_SCR_ULINE : Menu_Request_Code renames M_ScrollUp_Line; + REQ_SCR_DLINE : Menu_Request_Code renames M_ScrollDown_Line; + REQ_SCR_DPAGE : Menu_Request_Code renames M_ScrollDown_Page; + REQ_SCR_UPAGE : Menu_Request_Code renames M_ScrollUp_Page; + REQ_FIRST_ITEM : Menu_Request_Code renames M_First_Item; + REQ_LAST_ITEM : Menu_Request_Code renames M_Last_Item; + REQ_NEXT_ITEM : Menu_Request_Code renames M_Next_Item; + REQ_PREV_ITEM : Menu_Request_Code renames M_Previous_Item; + REQ_TOGGLE_ITEM : Menu_Request_Code renames M_Toggle_Item; + REQ_CLEAR_PATTERN : Menu_Request_Code renames M_Clear_Pattern; + REQ_BACK_PATTERN : Menu_Request_Code renames M_Back_Pattern; + REQ_NEXT_MATCH : Menu_Request_Code renames M_Next_Match; REQ_PREV_MATCH : Menu_Request_Code renames M_Previous_Match; - procedure Request_Name (Key : in Menu_Request_Code; + procedure Request_Name (Key : in Menu_Request_Code; Name : out String); function Request_Name (Key : Menu_Request_Code) return String; @@ -124,14 +125,13 @@ pragma Warnings (Off); type Menu_Option_Set is record - One_Valued : Boolean; - Show_Descriptions : Boolean; - Row_Major_Order : Boolean; - Ignore_Case : Boolean; - Show_Matches : Boolean; + One_Valued : Boolean; + Show_Descriptions : Boolean; + Row_Major_Order : Boolean; + Ignore_Case : Boolean; + Show_Matches : Boolean; Non_Cyclic : Boolean; - end record; - pragma Pack (Menu_Option_Set); + end record; pragma Convention (C, Menu_Option_Set); for Menu_Option_Set use @@ -158,8 +158,7 @@ type Item_Option_Set is record Selectable : Boolean; - end record; - pragma Pack (Item_Option_Set); + end record; pragma Convention (C, Item_Option_Set); for Item_Option_Set use @@ -183,7 +182,7 @@ type Item_Array_Access is access Item_Array; - procedure Free (IA : in out Item_Array_Access; + procedure Free (IA : in out Item_Array_Access; Free_Items : Boolean := False); -- Release the memory for an allocated item array -- If Free_Items is True, call Delete() for all the items in @@ -194,14 +193,14 @@ -- |===================================================================== -- #1A NAME="AFU_1"#2| - function Create (Name : String; + function Create (Name : String; Description : String := "") return Item; -- AKA: new_item() -- Not inlined. -- #1A NAME="AFU_2"#2| - function New_Item (Name : String; - Description : String := "") return Item + function New_Item (Name : String; + Description : String := "") return Item renames Create; -- AKA: new_item() @@ -215,7 +214,7 @@ -- |===================================================================== -- #1A NAME="AFU_4"#2| - procedure Set_Value (Itm : in Item; + procedure Set_Value (Itm : in Item; Value : in Boolean := True); -- AKA: set_item_value() pragma Inline (Set_Value); @@ -239,14 +238,14 @@ -- |===================================================================== -- #1A NAME="AFU_7"#2| - procedure Set_Options (Itm : in Item; + procedure Set_Options (Itm : in Item; Options : in Item_Option_Set); -- AKA: set_item_opts() -- An overloaded Set_Options is defined later. Pragma Inline appears there -- #1A NAME="AFU_8"#2| - procedure Switch_Options (Itm : in Item; - Options : in Item_Option_Set; + procedure Switch_Options (Itm : in Item; + Options : in Item_Option_Set; On : Boolean := True); -- AKA: item_opts_on() -- AKA: item_opts_off() @@ -254,7 +253,7 @@ -- Pragma Inline appears there -- #1A NAME="AFU_9"#2| - procedure Get_Options (Itm : in Item; + procedure Get_Options (Itm : in Item; Options : out Item_Option_Set); -- AKA: item_opts() @@ -268,7 +267,7 @@ -- |===================================================================== -- #1A NAME="AFU_11"#2| - procedure Name (Itm : in Item; + procedure Name (Itm : in Item; Name : out String); -- AKA: item_name() function Name (Itm : Item) return String; @@ -277,7 +276,7 @@ pragma Inline (Name); -- #1A NAME="AFU_12"#2| - procedure Description (Itm : in Item; + procedure Description (Itm : in Item; Description : out String); -- AKA: item_description(); @@ -291,7 +290,7 @@ -- |===================================================================== -- #1A NAME="AFU_13"#2| - procedure Set_Current (Men : in Menu; + procedure Set_Current (Men : in Menu; Itm : in Item); -- AKA: set_current_item() pragma Inline (Set_Current); @@ -302,7 +301,7 @@ pragma Inline (Current); -- #1A NAME="AFU_15"#2| - procedure Set_Top_Row (Men : in Menu; + procedure Set_Top_Row (Men : in Menu; Line : in Line_Position); -- AKA: set_top_row() pragma Inline (Set_Top_Row); @@ -325,7 +324,7 @@ -- |===================================================================== -- #1A NAME="AFU_18"#2| - procedure Post (Men : in Menu; + procedure Post (Men : in Menu; Post : in Boolean := True); -- AKA: post_menu() -- AKA: unpost_menu() @@ -336,21 +335,21 @@ -- |===================================================================== -- #1A NAME="AFU_19"#2| - procedure Set_Options (Men : in Menu; + procedure Set_Options (Men : in Menu; Options : in Menu_Option_Set); -- AKA: set_menu_opts() pragma Inline (Set_Options); -- #1A NAME="AFU_20"#2| - procedure Switch_Options (Men : in Menu; - Options : in Menu_Option_Set; + procedure Switch_Options (Men : in Menu; + Options : in Menu_Option_Set; On : Boolean := True); -- AKA: menu_opts_on() -- AKA: menu_opts_off() pragma Inline (Switch_Options); -- #1A NAME="AFU_21"#2| - procedure Get_Options (Men : in Menu; + procedure Get_Options (Men : in Menu; Options : out Menu_Option_Set); -- AKA: menu_opts() @@ -364,7 +363,7 @@ -- |===================================================================== -- #1A NAME="AFU_23"#2| - procedure Set_Window (Men : in Menu; + procedure Set_Window (Men : in Menu; Win : in Window); -- AKA: set_menu_win() pragma Inline (Set_Window); @@ -375,7 +374,7 @@ pragma Inline (Get_Window); -- #1A NAME="AFU_25"#2| - procedure Set_Sub_Window (Men : in Menu; + procedure Set_Sub_Window (Men : in Menu; Win : in Window); -- AKA: set_menu_sub() pragma Inline (Set_Sub_Window); @@ -386,8 +385,8 @@ pragma Inline (Get_Sub_Window); -- #1A NAME="AFU_27"#2| - procedure Scale (Men : in Menu; - Lines : out Line_Count; + procedure Scale (Men : in Menu; + Lines : out Line_Count; Columns : out Column_Count); -- AKA: scale_menu() pragma Inline (Scale); @@ -406,13 +405,13 @@ -- |===================================================================== -- #1A NAME="AFU_29"#2| - procedure Set_Mark (Men : in Menu; + procedure Set_Mark (Men : in Menu; Mark : in String); -- AKA: set_menu_mark() pragma Inline (Set_Mark); -- #1A NAME="AFU_30"#2| - procedure Mark (Men : in Menu; + procedure Mark (Men : in Menu; Mark : out String); -- AKA: menu_mark() @@ -427,73 +426,73 @@ -- #1A NAME="AFU_31"#2| procedure Set_Foreground - (Men : in Menu; - Fore : in Character_Attribute_Set := Normal_Video; + (Men : in Menu; + Fore : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA: set_menu_fore() pragma Inline (Set_Foreground); -- #1A NAME="AFU_32"#2| - procedure Foreground (Men : in Menu; + procedure Foreground (Men : in Menu; Fore : out Character_Attribute_Set); -- AKA: menu_fore() -- #1A NAME="AFU_33"#2| - procedure Foreground (Men : in Menu; - Fore : out Character_Attribute_Set; + procedure Foreground (Men : in Menu; + Fore : out Character_Attribute_Set; Color : out Color_Pair); -- AKA: menu_fore() pragma Inline (Foreground); -- #1A NAME="AFU_34"#2| procedure Set_Background - (Men : in Menu; - Back : in Character_Attribute_Set := Normal_Video; + (Men : in Menu; + Back : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA: set_menu_back() pragma Inline (Set_Background); -- #1A NAME="AFU_35"#2| - procedure Background (Men : in Menu; + procedure Background (Men : in Menu; Back : out Character_Attribute_Set); -- AKA: menu_back() -- #1A NAME="AFU_36"#2| - procedure Background (Men : in Menu; - Back : out Character_Attribute_Set; + procedure Background (Men : in Menu; + Back : out Character_Attribute_Set; Color : out Color_Pair); -- AKA: menu_back() pragma Inline (Background); -- #1A NAME="AFU_37"#2| procedure Set_Grey - (Men : in Menu; - Grey : in Character_Attribute_Set := Normal_Video; + (Men : in Menu; + Grey : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA: set_menu_grey() pragma Inline (Set_Grey); -- #1A NAME="AFU_38"#2| - procedure Grey (Men : in Menu; + procedure Grey (Men : in Menu; Grey : out Character_Attribute_Set); -- AKA: menu_grey() -- #1A NAME="AFU_39"#2| procedure Grey - (Men : in Menu; - Grey : out Character_Attribute_Set; + (Men : in Menu; + Grey : out Character_Attribute_Set; Color : out Color_Pair); -- AKA: menu_grey() pragma Inline (Grey); -- #1A NAME="AFU_40"#2| - procedure Set_Pad_Character (Men : in Menu; + procedure Set_Pad_Character (Men : in Menu; Pad : in Character := Space); -- AKA: set_menu_pad() pragma Inline (Set_Pad_Character); -- #1A NAME="AFU_41"#2| - procedure Pad_Character (Men : in Menu; + procedure Pad_Character (Men : in Menu; Pad : out Character); -- AKA: menu_pad() pragma Inline (Pad_Character); @@ -503,17 +502,17 @@ -- |===================================================================== -- #1A NAME="AFU_42"#2| - procedure Set_Spacing (Men : in Menu; - Descr : in Column_Position := 0; - Row : in Line_Position := 0; + procedure Set_Spacing (Men : in Menu; + Descr : in Column_Position := 0; + Row : in Line_Position := 0; Col : in Column_Position := 0); -- AKA: set_menu_spacing() pragma Inline (Set_Spacing); -- #1A NAME="AFU_43"#2| - procedure Spacing (Men : in Menu; - Descr : out Column_Position; - Row : out Line_Position; + procedure Spacing (Men : in Menu; + Descr : out Column_Position; + Row : out Line_Position; Col : out Column_Position); -- AKA: menu_spacing() pragma Inline (Spacing); @@ -523,14 +522,14 @@ -- |===================================================================== -- #1A NAME="AFU_44"#2| - function Set_Pattern (Men : Menu; + function Set_Pattern (Men : Menu; Text : String) return Boolean; -- AKA: set_menu_pattern() -- Return TRUE if the pattern matches, FALSE otherwise pragma Inline (Set_Pattern); -- #1A NAME="AFU_45"#2| - procedure Pattern (Men : in Menu; + procedure Pattern (Men : in Menu; Text : out String); -- AKA: menu_pattern() pragma Inline (Pattern); @@ -540,8 +539,8 @@ -- |===================================================================== -- #1A NAME="AFU_46"#2| - procedure Set_Format (Men : in Menu; - Lines : in Line_Count; + procedure Set_Format (Men : in Menu; + Lines : in Line_Count; Columns : in Column_Count); -- Not implemented: 0 argument for Lines or Columns; -- instead use Format to get the current sizes @@ -554,8 +553,8 @@ pragma Inline (Set_Format); -- #1A NAME="AFU_47"#2| - procedure Format (Men : in Menu; - Lines : out Line_Count; + procedure Format (Men : in Menu; + Lines : out Line_Count; Columns : out Column_Count); -- AKA: menu_format() pragma Inline (Format); @@ -568,25 +567,25 @@ pragma Convention (C, Menu_Hook_Function); -- #1A NAME="AFU_48"#2| - procedure Set_Item_Init_Hook (Men : in Menu; + procedure Set_Item_Init_Hook (Men : in Menu; Proc : in Menu_Hook_Function); -- AKA: set_item_init() pragma Inline (Set_Item_Init_Hook); -- #1A NAME="AFU_49"#2| - procedure Set_Item_Term_Hook (Men : in Menu; + procedure Set_Item_Term_Hook (Men : in Menu; Proc : in Menu_Hook_Function); -- AKA: set_item_term() pragma Inline (Set_Item_Term_Hook); -- #1A NAME="AFU_50"#2| - procedure Set_Menu_Init_Hook (Men : in Menu; + procedure Set_Menu_Init_Hook (Men : in Menu; Proc : in Menu_Hook_Function); -- AKA: set_menu_init() pragma Inline (Set_Menu_Init_Hook); -- #1A NAME="AFU_51"#2| - procedure Set_Menu_Term_Hook (Men : in Menu; + procedure Set_Menu_Term_Hook (Men : in Menu; Proc : in Menu_Hook_Function); -- AKA: set_menu_term() pragma Inline (Set_Menu_Term_Hook); @@ -616,17 +615,17 @@ -- |===================================================================== -- #1A NAME="AFU_56"#2| - procedure Redefine (Men : in Menu; + procedure Redefine (Men : in Menu; Items : in Item_Array_Access); -- AKA: set_menu_items() pragma Inline (Redefine); - procedure Set_Items (Men : in Menu; - Items : in Item_Array_Access) renames Redefine; + procedure Set_Items (Men : in Menu; + Items : in Item_Array_Access) renames Redefine; pragma Inline (Set_Items); -- #1A NAME="AFU_57"#2| - function Items (Men : Menu; + function Items (Men : Menu; Index : Positive) return Item; -- AKA: menu_items() pragma Inline (Items); @@ -657,13 +656,13 @@ -- | Man page menu_driver.3x -- |===================================================================== - type Driver_Result is (Menu_Ok, - Request_Denied, - Unknown_Request, + type Driver_Result is (Menu_Ok, + Request_Denied, + Unknown_Request, No_Match); -- #1A NAME="AFU_61"#2| - function Driver (Men : Menu; + function Driver (Men : Menu; Key : Key_Code) return Driver_Result; -- AKA: menu_driver() -- Driver is not inlined @@ -672,10 +671,10 @@ -- Not Implemented: menu_request_name, menu_request_by_name ------------------------------------------------------------------------------- private - type Item is new System.Storage_Elements.Integer_Address; + type Item is new System.Storage_Elements.Integer_Address; type Menu is new System.Storage_Elements.Integer_Address; - Null_Item : constant Item := 0; + Null_Item : constant Item := 0; Null_Menu : constant Menu := 0; end Terminal_Interface.Curses.Menus; diff --git a/doc/html/ada/terminal_interface-curses-mouse__adb.htm b/doc/html/ada/terminal_interface-curses-mouse__adb.htm index 4312cbf1..b63ba32c 100644 --- a/doc/html/ada/terminal_interface-curses-mouse__adb.htm +++ b/doc/html/ada/terminal_interface-curses-mouse__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-mouse.adb

    File : terminal_interface-curses-mouse.adb


    @@ -11,7 +12,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -39,181 +40,187 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.18 @ +-- @Revision: 1.21 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ with System; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -with Interfaces.C; use Interfaces.C; -use Interfaces; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; use Interfaces.C; +use Interfaces; -package body Terminal_Interface.Curses.Mouse is +package body Terminal_Interface.Curses.Mouse is use type System.Bit_Order; - use type Interfaces.C.int; + use type Interfaces.C.int; - function Has_Mouse return Boolean + function Has_Mouse return Boolean is - function Mouse_Avail return C_Int; - pragma Import (C, Mouse_Avail, "_nc_has_mouse"); + function Mouse_Avail return C_Int; + pragma Import (C, Mouse_Avail, "_nc_has_mouse"); begin - if Has_Key (Key_Mouse) or else Mouse_Avail /= 0 then + if Has_Key (Key_Mouse) or else Mouse_Avail /= 0 then return True; else return False; end if; - end Has_Mouse; + end Has_Mouse; - function Get_Mouse return Mouse_Event + function Get_Mouse return Mouse_Event is - type Event_Access is access all Mouse_Event; + type Event_Access is access all Mouse_Event; - function Getmouse (Ev : Event_Access) return C_Int; - pragma Import (C, Getmouse, "getmouse"); + function Getmouse (Ev : Event_Access) return C_Int; + pragma Import (C, Getmouse, "getmouse"); - Event : aliased Mouse_Event; + Event : aliased Mouse_Event; begin - if Getmouse (Event'Access) = Curses_Err then - raise Curses_Exception; + if Getmouse (Event'Access) = Curses_Err then + raise Curses_Exception; end if; - return Event; - end Get_Mouse; + return Event; + end Get_Mouse; - procedure Register_Reportable_Event (Button : in Mouse_Button; - State : in Button_State; - Mask : in out Event_Mask) + procedure Register_Reportable_Event (Button : in Mouse_Button; + State : in Button_State; + Mask : in out Event_Mask) is - Button_Nr : constant Natural := Mouse_Button'Pos (Button); - State_Nr : constant Natural := Button_State'Pos (State); + Button_Nr : constant Natural := Mouse_Button'Pos (Button); + State_Nr : constant Natural := Button_State'Pos (State); begin - if Button in Modifier_Keys and then State /= Pressed then - raise Curses_Exception; + if Button in Modifier_Keys and then State /= Pressed then + raise Curses_Exception; else - if Button in Real_Buttons then - Mask := Mask or ((2 ** (6 * Button_Nr)) ** State_Nr); + if Button in Real_Buttons then + Mask := Mask or ((2 ** (6 * Button_Nr)) ** State_Nr); else - Mask := Mask or (BUTTON_CTRL ** (Button_Nr - 4)); + Mask := Mask or (BUTTON_CTRL ** (Button_Nr - 4)); end if; end if; - end Register_Reportable_Event; + end Register_Reportable_Event; - procedure Register_Reportable_Events (Button : in Mouse_Button; - State : in Button_States; - Mask : in out Event_Mask) + procedure Register_Reportable_Events (Button : in Mouse_Button; + State : in Button_States; + Mask : in out Event_Mask) is begin - for S in Button_States'Range loop - if State (S) then - Register_Reportable_Event (Button, S, Mask); + for S in Button_States'Range loop + if State (S) then + Register_Reportable_Event (Button, S, Mask); end if; end loop; - end Register_Reportable_Events; + end Register_Reportable_Events; - function Start_Mouse (Mask : Event_Mask := All_Events) - return Event_Mask + function Start_Mouse (Mask : Event_Mask := All_Events) + return Event_Mask is - function MMask (M : Event_Mask; - O : access Event_Mask) return Event_Mask; - pragma Import (C, MMask, "mousemask"); - R : Event_Mask; - Old : aliased Event_Mask; + function MMask (M : Event_Mask; + O : access Event_Mask) return Event_Mask; + pragma Import (C, MMask, "mousemask"); + R : Event_Mask; + Old : aliased Event_Mask; begin - R := MMask (Mask, Old'Access); - return Old; - end Start_Mouse; + R := MMask (Mask, Old'Access); + if R = No_Events then + Beep; + end if; + return Old; + end Start_Mouse; - procedure End_Mouse (Mask : in Event_Mask := No_Events) + procedure End_Mouse (Mask : in Event_Mask := No_Events) is begin - null; - end End_Mouse; + if Mask /= No_Events then + Beep; + end if; + end End_Mouse; - procedure Dispatch_Event (Mask : in Event_Mask; - Button : out Mouse_Button; - State : out Button_State); + procedure Dispatch_Event (Mask : in Event_Mask; + Button : out Mouse_Button; + State : out Button_State); - procedure Dispatch_Event (Mask : in Event_Mask; - Button : out Mouse_Button; - State : out Button_State) is - L : Event_Mask; + procedure Dispatch_Event (Mask : in Event_Mask; + Button : out Mouse_Button; + State : out Button_State) is + L : Event_Mask; begin - Button := Alt; -- preset to non real button; - if (Mask and BUTTON1_EVENTS) /= 0 then - Button := Left; - elsif (Mask and BUTTON2_EVENTS) /= 0 then - Button := Middle; - elsif (Mask and BUTTON3_EVENTS) /= 0 then - Button := Right; - elsif (Mask and BUTTON4_EVENTS) /= 0 then - Button := Button4; + Button := Alt; -- preset to non real button; + if (Mask and BUTTON1_EVENTS) /= 0 then + Button := Left; + elsif (Mask and BUTTON2_EVENTS) /= 0 then + Button := Middle; + elsif (Mask and BUTTON3_EVENTS) /= 0 then + Button := Right; + elsif (Mask and BUTTON4_EVENTS) /= 0 then + Button := Button4; end if; - if Button in Real_Buttons then - L := 2 ** (6 * Mouse_Button'Pos (Button)); - for I in Button_State'Range loop - if (Mask and L) /= 0 then - State := I; + if Button in Real_Buttons then + L := 2 ** (6 * Mouse_Button'Pos (Button)); + for I in Button_State'Range loop + if (Mask and L) /= 0 then + State := I; exit; end if; - L := 2 * L; + L := 2 * L; end loop; else - State := Pressed; - if (Mask and BUTTON_CTRL) /= 0 then - Button := Control; - elsif (Mask and BUTTON_SHIFT) /= 0 then - Button := Shift; - elsif (Mask and BUTTON_ALT) /= 0 then - Button := Alt; + State := Pressed; + if (Mask and BUTTON_CTRL) /= 0 then + Button := Control; + elsif (Mask and BUTTON_SHIFT) /= 0 then + Button := Shift; + elsif (Mask and BUTTON_ALT) /= 0 then + Button := Alt; end if; end if; - end Dispatch_Event; + end Dispatch_Event; - procedure Get_Event (Event : in Mouse_Event; - Y : out Line_Position; - X : out Column_Position; - Button : out Mouse_Button; - State : out Button_State) + procedure Get_Event (Event : in Mouse_Event; + Y : out Line_Position; + X : out Column_Position; + Button : out Mouse_Button; + State : out Button_State) is - Mask : constant Event_Mask := Event.Bstate; + Mask : constant Event_Mask := Event.Bstate; begin - X := Column_Position (Event.X); - Y := Line_Position (Event.Y); - Dispatch_Event (Mask, Button, State); - end Get_Event; + X := Column_Position (Event.X); + Y := Line_Position (Event.Y); + Dispatch_Event (Mask, Button, State); + end Get_Event; - procedure Unget_Mouse (Event : in Mouse_Event) + procedure Unget_Mouse (Event : in Mouse_Event) is - function Ungetmouse (Ev : Mouse_Event) return C_Int; - pragma Import (C, Ungetmouse, "ungetmouse"); + function Ungetmouse (Ev : Mouse_Event) return C_Int; + pragma Import (C, Ungetmouse, "ungetmouse"); begin - if Ungetmouse (Event) = Curses_Err then - raise Curses_Exception; + if Ungetmouse (Event) = Curses_Err then + raise Curses_Exception; end if; - end Unget_Mouse; + end Unget_Mouse; - function Enclosed_In_Window (Win : Window := Standard_Window; - Event : Mouse_Event) return Boolean + function Enclosed_In_Window (Win : Window := Standard_Window; + Event : Mouse_Event) return Boolean is - function Wenclose (Win : Window; Y : C_Int; X : C_Int) - return Curses_Bool; - pragma Import (C, Wenclose, "wenclose"); + function Wenclose (Win : Window; Y : C_Int; X : C_Int) + return Curses_Bool; + pragma Import (C, Wenclose, "wenclose"); begin - if Wenclose (Win, C_Int (Event.Y), C_Int (Event.X)) - = Curses_Bool_False then + if Wenclose (Win, C_Int (Event.Y), C_Int (Event.X)) + = Curses_Bool_False then return False; else return True; end if; - end Enclosed_In_Window; + end Enclosed_In_Window; - function Mouse_Interval (Msec : Natural := 200) return Natural + function Mouse_Interval (Msec : Natural := 200) return Natural is - function Mouseinterval (Msec : C_Int) return C_Int; - pragma Import (C, Mouseinterval, "mouseinterval"); + function Mouseinterval (Msec : C_Int) return C_Int; + pragma Import (C, Mouseinterval, "mouseinterval"); begin - return Natural (Mouseinterval (C_Int (Msec))); - end Mouse_Interval; + return Natural (Mouseinterval (C_Int (Msec))); + end Mouse_Interval; -end Terminal_Interface.Curses.Mouse; +end Terminal_Interface.Curses.Mouse; diff --git a/doc/html/ada/terminal_interface-curses-mouse__ads.htm b/doc/html/ada/terminal_interface-curses-mouse__ads.htm index 50edd934..bbcb28e3 100644 --- a/doc/html/ada/terminal_interface-curses-mouse__ads.htm +++ b/doc/html/ada/terminal_interface-curses-mouse__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-mouse.ads

    File : terminal_interface-curses-mouse.ads


    @@ -12,7 +13,7 @@ -- S P E C -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -40,7 +41,8 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.22 @ +-- @Revision: 1.25 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -- mouse binding. @@ -66,31 +68,31 @@ -- REPORT_MOUSE_POSITION (i.e. as a parameter to Register_Reportable_Event -- or Start_Mouse) type Event_Mask is private; - No_Events : constant Event_Mask; + No_Events : constant Event_Mask; All_Events : constant Event_Mask; - type Mouse_Button is (Left, -- aka: Button 1 - Middle, -- aka: Button 2 - Right, -- aka: Button 3 - Button4, -- aka: Button 4 - Control, -- Control Key - Shift, -- Shift Key + type Mouse_Button is (Left, -- aka: Button 1 + Middle, -- aka: Button 2 + Right, -- aka: Button 3 + Button4, -- aka: Button 4 + Control, -- Control Key + Shift, -- Shift Key Alt); -- ALT Key - subtype Real_Buttons is Mouse_Button range Left .. Button4; + subtype Real_Buttons is Mouse_Button range Left .. Button4; subtype Modifier_Keys is Mouse_Button range Control .. Alt; - type Button_State is (Released, - Pressed, - Clicked, - Double_Clicked, + type Button_State is (Released, + Pressed, + Clicked, + Double_Clicked, Triple_Clicked); type Button_States is array (Button_State) of Boolean; pragma Pack (Button_States); All_Clicks : constant Button_States := (Clicked .. Triple_Clicked => True, - others => False); + others => False); All_States : constant Button_States := (others => True); type Mouse_Event is private; @@ -103,8 +105,8 @@ -- Return true if a mouse device is supported, false otherwise. procedure Register_Reportable_Event - (Button : in Mouse_Button; - State : in Button_State; + (Button : in Mouse_Button; + State : in Button_State; Mask : in out Event_Mask); -- Stores the event described by the button and the state in the mask. -- Before you call this the first time, you should init the mask @@ -112,8 +114,8 @@ pragma Inline (Register_Reportable_Event); procedure Register_Reportable_Events - (Button : in Mouse_Button; - State : in Button_States; + (Button : in Mouse_Button; + State : in Button_States; Mask : in out Event_Mask); -- Register all events described by the Button and the State bitmap. -- Before you call this the first time, you should init the mask @@ -124,7 +126,7 @@ -- old mask, that means the event mask value before this call. -- Not Implemented: The library version -- returns a Mouse_Mask that tells which events are reported. - function Start_Mouse (Mask : Event_Mask := All_Events) + function Start_Mouse (Mask : Event_Mask := All_Events) return Event_Mask; -- AKA: mousemask() pragma Inline (Start_Mouse); @@ -138,10 +140,10 @@ -- AKA: getmouse() pragma Inline (Get_Mouse); - procedure Get_Event (Event : in Mouse_Event; - Y : out Line_Position; - X : out Column_Position; - Button : out Mouse_Button; + procedure Get_Event (Event : in Mouse_Event; + Y : out Line_Position; + X : out Column_Position; + Button : out Mouse_Button; State : out Button_State); -- !!! Warning: X and Y are screen coordinates. Due to ripped of lines they -- may not be identical to window coordinates. @@ -155,7 +157,7 @@ pragma Inline (Unget_Mouse); -- #1A NAME="AFU_4"#2| - function Enclosed_In_Window (Win : Window := Standard_Window; + function Enclosed_In_Window (Win : Window := Standard_Window; Event : Mouse_Event) return Boolean; -- AKA: wenclose() -- But : use event instead of screen coordinates. @@ -171,14 +173,13 @@ type Mouse_Event is record - Id : Integer range Integer (Interfaces.C.short'First) .. - Integer (Interfaces.C.short'Last); - X, Y, Z : Integer range Integer (Interfaces.C.int'First) .. - Integer (Interfaces.C.int'Last); - Bstate : Event_Mask; + Id : Integer range Integer (Interfaces.C.short'First) .. + Integer (Interfaces.C.short'Last); + X, Y, Z : Integer range Integer (Interfaces.C.int'First) .. + Integer (Interfaces.C.int'Last); + Bstate : Event_Mask; end record; pragma Convention (C, Mouse_Event); - pragma Pack (Mouse_Event); for Mouse_Event use record @@ -194,42 +195,42 @@ Generation_Bit_Order : constant System.Bit_Order := System.Low_Order_First; -- This constant may be different on your system. - BUTTON1_RELEASED : constant Event_Mask := 8#00000000001#; - BUTTON1_PRESSED : constant Event_Mask := 8#00000000002#; - BUTTON1_CLICKED : constant Event_Mask := 8#00000000004#; - BUTTON1_DOUBLE_CLICKED : constant Event_Mask := 8#00000000010#; - BUTTON1_TRIPLE_CLICKED : constant Event_Mask := 8#00000000020#; - BUTTON1_RESERVED_EVENT : constant Event_Mask := 8#00000000040#; - BUTTON2_RELEASED : constant Event_Mask := 8#00000000100#; - BUTTON2_PRESSED : constant Event_Mask := 8#00000000200#; - BUTTON2_CLICKED : constant Event_Mask := 8#00000000400#; - BUTTON2_DOUBLE_CLICKED : constant Event_Mask := 8#00000001000#; - BUTTON2_TRIPLE_CLICKED : constant Event_Mask := 8#00000002000#; - BUTTON2_RESERVED_EVENT : constant Event_Mask := 8#00000004000#; - BUTTON3_RELEASED : constant Event_Mask := 8#00000010000#; - BUTTON3_PRESSED : constant Event_Mask := 8#00000020000#; - BUTTON3_CLICKED : constant Event_Mask := 8#00000040000#; - BUTTON3_DOUBLE_CLICKED : constant Event_Mask := 8#00000100000#; - BUTTON3_TRIPLE_CLICKED : constant Event_Mask := 8#00000200000#; - BUTTON3_RESERVED_EVENT : constant Event_Mask := 8#00000400000#; - BUTTON4_RELEASED : constant Event_Mask := 8#00001000000#; - BUTTON4_PRESSED : constant Event_Mask := 8#00002000000#; - BUTTON4_CLICKED : constant Event_Mask := 8#00004000000#; - BUTTON4_DOUBLE_CLICKED : constant Event_Mask := 8#00010000000#; - BUTTON4_TRIPLE_CLICKED : constant Event_Mask := 8#00020000000#; - BUTTON4_RESERVED_EVENT : constant Event_Mask := 8#00040000000#; - BUTTON_CTRL : constant Event_Mask := 8#00100000000#; - BUTTON_SHIFT : constant Event_Mask := 8#00200000000#; - BUTTON_ALT : constant Event_Mask := 8#00400000000#; - REPORT_MOUSE_POSITION : constant Event_Mask := 8#01000000000#; - ALL_MOUSE_EVENTS : constant Event_Mask := 8#00777777777#; - BUTTON1_EVENTS : constant Event_Mask := 8#00000000077#; - BUTTON2_EVENTS : constant Event_Mask := 8#00000007700#; - BUTTON3_EVENTS : constant Event_Mask := 8#00000770000#; + BUTTON1_RELEASED : constant Event_Mask := 8#00000000001#; + BUTTON1_PRESSED : constant Event_Mask := 8#00000000002#; + BUTTON1_CLICKED : constant Event_Mask := 8#00000000004#; + BUTTON1_DOUBLE_CLICKED : constant Event_Mask := 8#00000000010#; + BUTTON1_TRIPLE_CLICKED : constant Event_Mask := 8#00000000020#; + BUTTON1_RESERVED_EVENT : constant Event_Mask := 8#00000000040#; + BUTTON2_RELEASED : constant Event_Mask := 8#00000000100#; + BUTTON2_PRESSED : constant Event_Mask := 8#00000000200#; + BUTTON2_CLICKED : constant Event_Mask := 8#00000000400#; + BUTTON2_DOUBLE_CLICKED : constant Event_Mask := 8#00000001000#; + BUTTON2_TRIPLE_CLICKED : constant Event_Mask := 8#00000002000#; + BUTTON2_RESERVED_EVENT : constant Event_Mask := 8#00000004000#; + BUTTON3_RELEASED : constant Event_Mask := 8#00000010000#; + BUTTON3_PRESSED : constant Event_Mask := 8#00000020000#; + BUTTON3_CLICKED : constant Event_Mask := 8#00000040000#; + BUTTON3_DOUBLE_CLICKED : constant Event_Mask := 8#00000100000#; + BUTTON3_TRIPLE_CLICKED : constant Event_Mask := 8#00000200000#; + BUTTON3_RESERVED_EVENT : constant Event_Mask := 8#00000400000#; + BUTTON4_RELEASED : constant Event_Mask := 8#00001000000#; + BUTTON4_PRESSED : constant Event_Mask := 8#00002000000#; + BUTTON4_CLICKED : constant Event_Mask := 8#00004000000#; + BUTTON4_DOUBLE_CLICKED : constant Event_Mask := 8#00010000000#; + BUTTON4_TRIPLE_CLICKED : constant Event_Mask := 8#00020000000#; + BUTTON4_RESERVED_EVENT : constant Event_Mask := 8#00040000000#; + BUTTON_CTRL : constant Event_Mask := 8#00100000000#; + BUTTON_SHIFT : constant Event_Mask := 8#00200000000#; + BUTTON_ALT : constant Event_Mask := 8#00400000000#; + REPORT_MOUSE_POSITION : constant Event_Mask := 8#01000000000#; + ALL_MOUSE_EVENTS : constant Event_Mask := 8#00777777777#; + BUTTON1_EVENTS : constant Event_Mask := 8#00000000077#; + BUTTON2_EVENTS : constant Event_Mask := 8#00000007700#; + BUTTON3_EVENTS : constant Event_Mask := 8#00000770000#; BUTTON4_EVENTS : constant Event_Mask := 8#00077000000#; - No_Events : constant Event_Mask := 0; + No_Events : constant Event_Mask := 0; All_Events : constant Event_Mask := ALL_MOUSE_EVENTS; end Terminal_Interface.Curses.Mouse; diff --git a/doc/html/ada/terminal_interface-curses-panels-user_data__adb.htm b/doc/html/ada/terminal_interface-curses-panels-user_data__adb.htm index 7f9b1674..93fab0c9 100644 --- a/doc/html/ada/terminal_interface-curses-panels-user_data__adb.htm +++ b/doc/html/ada/terminal_interface-curses-panels-user_data__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-panels-user_data.adb

    File : terminal_interface-curses-panels-user_data.adb


    @@ -42,42 +43,42 @@ -- @Revision: 1.11 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C; -with Terminal_Interface.Curses.Aux; -use Terminal_Interface.Curses.Aux; -with Terminal_Interface.Curses.Panels; -use Terminal_Interface.Curses.Panels; +with Interfaces.C; +with Terminal_Interface.Curses.Aux; +use Terminal_Interface.Curses.Aux; +with Terminal_Interface.Curses.Panels; +use Terminal_Interface.Curses.Panels; -package body Terminal_Interface.Curses.Panels.User_Data is +package body Terminal_Interface.Curses.Panels.User_Data is - use type Interfaces.C.int; + use type Interfaces.C.int; - procedure Set_User_Data (Pan : in Panel; - Data : in User_Access) + procedure Set_User_Data (Pan : in Panel; + Data : in User_Access) is - function Set_Panel_Userptr (Pan : Panel; - Addr : User_Access) return C_Int; - pragma Import (C, Set_Panel_Userptr, "set_panel_userptr"); + function Set_Panel_Userptr (Pan : Panel; + Addr : User_Access) return C_Int; + pragma Import (C, Set_Panel_Userptr, "set_panel_userptr"); begin - if Set_Panel_Userptr (Pan, Data) = Curses_Err then - raise Panel_Exception; + if Set_Panel_Userptr (Pan, Data) = Curses_Err then + raise Panel_Exception; end if; - end Set_User_Data; + end Set_User_Data; - function Get_User_Data (Pan : in Panel) return User_Access + function Get_User_Data (Pan : in Panel) return User_Access is - function Panel_Userptr (Pan : Panel) return User_Access; - pragma Import (C, Panel_Userptr, "panel_userptr"); + function Panel_Userptr (Pan : Panel) return User_Access; + pragma Import (C, Panel_Userptr, "panel_userptr"); begin - return Panel_Userptr (Pan); - end Get_User_Data; + return Panel_Userptr (Pan); + end Get_User_Data; - procedure Get_User_Data (Pan : in Panel; - Data : out User_Access) + procedure Get_User_Data (Pan : in Panel; + Data : out User_Access) is begin - Data := Get_User_Data (Pan); - end Get_User_Data; + Data := Get_User_Data (Pan); + end Get_User_Data; -end Terminal_Interface.Curses.Panels.User_Data; +end Terminal_Interface.Curses.Panels.User_Data; diff --git a/doc/html/ada/terminal_interface-curses-panels-user_data__ads.htm b/doc/html/ada/terminal_interface-curses-panels-user_data__ads.htm index 1aa8d914..a65cf68c 100644 --- a/doc/html/ada/terminal_interface-curses-panels-user_data__ads.htm +++ b/doc/html/ada/terminal_interface-curses-panels-user_data__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-panels-user_data.ads

    File : terminal_interface-curses-panels-user_data.ads


    @@ -45,9 +46,9 @@ ------------------------------------------------------------------------------ generic - type User is limited private; - type User_Access is access all User; -package Terminal_Interface.Curses.Panels.User_Data is + type User is limited private; + type User_Access is access all User; +package Terminal_Interface.Curses.Panels.User_Data is pragma Preelaborate (Terminal_Interface.Curses.Panels.User_Data); -- |===================================================================== @@ -55,13 +56,13 @@ -- |===================================================================== -- #1A NAME="AFU_1"#2| - procedure Set_User_Data (Pan : in Panel; + procedure Set_User_Data (Pan : in Panel; Data : in User_Access); -- AKA: set_panel_userptr pragma Inline (Set_User_Data); -- #1A NAME="AFU_2"#2| - procedure Get_User_Data (Pan : in Panel; + procedure Get_User_Data (Pan : in Panel; Data : out User_Access); -- AKA: panel_userptr diff --git a/doc/html/ada/terminal_interface-curses-panels__adb.htm b/doc/html/ada/terminal_interface-curses-panels__adb.htm index ba131bee..85e0a289 100644 --- a/doc/html/ada/terminal_interface-curses-panels__adb.htm +++ b/doc/html/ada/terminal_interface-curses-panels__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-panels.adb

    File : terminal_interface-curses-panels.adb


    @@ -11,7 +12,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -39,131 +40,132 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.10 @ +-- @Revision: 1.13 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -with Interfaces.C; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; -package body Terminal_Interface.Curses.Panels is +package body Terminal_Interface.Curses.Panels is - use type Interfaces.C.int; + use type Interfaces.C.int; - function Create (Win : Window) return Panel + function Create (Win : Window) return Panel is - function Newpanel (Win : Window) return Panel; - pragma Import (C, Newpanel, "new_panel"); + function Newpanel (Win : Window) return Panel; + pragma Import (C, Newpanel, "new_panel"); - Pan : Panel; + Pan : Panel; begin - Pan := Newpanel (Win); - if Pan = Null_Panel then - raise Panel_Exception; + Pan := Newpanel (Win); + if Pan = Null_Panel then + raise Panel_Exception; end if; - return Pan; - end Create; + return Pan; + end Create; - procedure Bottom (Pan : in Panel) + procedure Bottom (Pan : in Panel) is - function Bottompanel (Pan : Panel) return C_Int; - pragma Import (C, Bottompanel, "bottom_panel"); + function Bottompanel (Pan : Panel) return C_Int; + pragma Import (C, Bottompanel, "bottom_panel"); begin - if Bottompanel (Pan) = Curses_Err then - raise Panel_Exception; + if Bottompanel (Pan) = Curses_Err then + raise Panel_Exception; end if; - end Bottom; + end Bottom; - procedure Top (Pan : in Panel) + procedure Top (Pan : in Panel) is - function Toppanel (Pan : Panel) return C_Int; - pragma Import (C, Toppanel, "top_panel"); + function Toppanel (Pan : Panel) return C_Int; + pragma Import (C, Toppanel, "top_panel"); begin - if Toppanel (Pan) = Curses_Err then - raise Panel_Exception; + if Toppanel (Pan) = Curses_Err then + raise Panel_Exception; end if; - end Top; + end Top; - procedure Show (Pan : in Panel) + procedure Show (Pan : in Panel) is - function Showpanel (Pan : Panel) return C_Int; - pragma Import (C, Showpanel, "show_panel"); + function Showpanel (Pan : Panel) return C_Int; + pragma Import (C, Showpanel, "show_panel"); begin - if Showpanel (Pan) = Curses_Err then - raise Panel_Exception; + if Showpanel (Pan) = Curses_Err then + raise Panel_Exception; end if; - end Show; + end Show; - procedure Hide (Pan : in Panel) + procedure Hide (Pan : in Panel) is - function Hidepanel (Pan : Panel) return C_Int; - pragma Import (C, Hidepanel, "hide_panel"); + function Hidepanel (Pan : Panel) return C_Int; + pragma Import (C, Hidepanel, "hide_panel"); begin - if Hidepanel (Pan) = Curses_Err then - raise Panel_Exception; + if Hidepanel (Pan) = Curses_Err then + raise Panel_Exception; end if; - end Hide; + end Hide; - function Get_Window (Pan : Panel) return Window + function Get_Window (Pan : Panel) return Window is - function Panel_Win (Pan : Panel) return Window; - pragma Import (C, Panel_Win, "panel_window"); + function Panel_Win (Pan : Panel) return Window; + pragma Import (C, Panel_Win, "panel_window"); - Win : Window := Panel_Win (Pan); + Win : constant Window := Panel_Win (Pan); begin - if Win = Null_Window then - raise Panel_Exception; + if Win = Null_Window then + raise Panel_Exception; end if; - return Win; - end Get_Window; + return Win; + end Get_Window; - procedure Replace (Pan : in Panel; - Win : in Window) + procedure Replace (Pan : in Panel; + Win : in Window) is - function Replace_Pan (Pan : Panel; - Win : Window) return C_Int; - pragma Import (C, Replace_Pan, "replace_panel"); + function Replace_Pan (Pan : Panel; + Win : Window) return C_Int; + pragma Import (C, Replace_Pan, "replace_panel"); begin - if Replace_Pan (Pan, Win) = Curses_Err then - raise Panel_Exception; + if Replace_Pan (Pan, Win) = Curses_Err then + raise Panel_Exception; end if; - end Replace; + end Replace; - procedure Move (Pan : in Panel; - Line : in Line_Position; - Column : in Column_Position) + procedure Move (Pan : in Panel; + Line : in Line_Position; + Column : in Column_Position) is - function Move (Pan : Panel; - Line : C_Int; - Column : C_Int) return C_Int; - pragma Import (C, Move, "move_panel"); + function Move (Pan : Panel; + Line : C_Int; + Column : C_Int) return C_Int; + pragma Import (C, Move, "move_panel"); begin - if Move (Pan, C_Int (Line), C_Int (Column)) = Curses_Err then - raise Panel_Exception; + if Move (Pan, C_Int (Line), C_Int (Column)) = Curses_Err then + raise Panel_Exception; end if; - end Move; + end Move; - function Is_Hidden (Pan : Panel) return Boolean + function Is_Hidden (Pan : Panel) return Boolean is - function Panel_Hidden (Pan : Panel) return C_Int; - pragma Import (C, Panel_Hidden, "panel_hidden"); + function Panel_Hidden (Pan : Panel) return C_Int; + pragma Import (C, Panel_Hidden, "panel_hidden"); begin - if Panel_Hidden (Pan) = Curses_False then + if Panel_Hidden (Pan) = Curses_False then return False; else return True; end if; - end Is_Hidden; + end Is_Hidden; - procedure Delete (Pan : in out Panel) + procedure Delete (Pan : in out Panel) is - function Del_Panel (Pan : Panel) return C_Int; - pragma Import (C, Del_Panel, "del_panel"); + function Del_Panel (Pan : Panel) return C_Int; + pragma Import (C, Del_Panel, "del_panel"); begin - if Del_Panel (Pan) = Curses_Err then - raise Panel_Exception; + if Del_Panel (Pan) = Curses_Err then + raise Panel_Exception; end if; - Pan := Null_Panel; - end Delete; + Pan := Null_Panel; + end Delete; -end Terminal_Interface.Curses.Panels; +end Terminal_Interface.Curses.Panels; diff --git a/doc/html/ada/terminal_interface-curses-panels__ads.htm b/doc/html/ada/terminal_interface-curses-panels__ads.htm index c16e58f6..7fa7cbb4 100644 --- a/doc/html/ada/terminal_interface-curses-panels__ads.htm +++ b/doc/html/ada/terminal_interface-curses-panels__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-panels.ads

    File : terminal_interface-curses-panels.ads


    @@ -112,14 +113,14 @@ pragma Inline (Panel_Window); -- #1A NAME="AFU_10"#2| - procedure Replace (Pan : in Panel; + procedure Replace (Pan : in Panel; Win : in Window); -- AKA: replace_panel() pragma Inline (Replace); -- #1A NAME="AFU_11"#2| - procedure Move (Pan : in Panel; - Line : in Line_Position; + procedure Move (Pan : in Panel; + Line : in Line_Position; Column : in Column_Position); -- AKA: move_panel() pragma Inline (Move); diff --git a/doc/html/ada/terminal_interface-curses-putwin__adb.htm b/doc/html/ada/terminal_interface-curses-putwin__adb.htm index 57eeba1a..8ff5608f 100644 --- a/doc/html/ada/terminal_interface-curses-putwin__adb.htm +++ b/doc/html/ada/terminal_interface-curses-putwin__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-putwin.adb

    File : terminal_interface-curses-putwin.adb


    @@ -43,40 +44,40 @@ -- Binding Version 01.00 with Ada.Streams.Stream_IO.C_Streams; -with Interfaces.C_Streams; -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C_Streams; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -package body Terminal_Interface.Curses.PutWin is +package body Terminal_Interface.Curses.PutWin is - package ICS renames Interfaces.C_Streams; - package ACS renames Ada.Streams.Stream_IO.C_Streams; - use type C_Int; + package ICS renames Interfaces.C_Streams; + package ACS renames Ada.Streams.Stream_IO.C_Streams; + use type C_Int; - procedure Put_Window (Win : Window; - File : Ada.Streams.Stream_IO.File_Type) is - function putwin (Win : Window; f : ICS.FILEs) return C_Int; - pragma Import (C, putwin, "putwin"); + procedure Put_Window (Win : Window; + File : Ada.Streams.Stream_IO.File_Type) is + function putwin (Win : Window; f : ICS.FILEs) return C_Int; + pragma Import (C, putwin, "putwin"); - R : constant C_Int := putwin (Win, ACS.C_Stream (File)); + R : constant C_Int := putwin (Win, ACS.C_Stream (File)); begin - if R /= Curses_Ok then - raise Curses_Exception; + if R /= Curses_Ok then + raise Curses_Exception; end if; - end Put_Window; + end Put_Window; - function Get_Window (File : Ada.Streams.Stream_IO.File_Type) - return Window is - function getwin (f : ICS.FILEs) return Window; - pragma Import (C, getwin, "getwin"); + function Get_Window (File : Ada.Streams.Stream_IO.File_Type) + return Window is + function getwin (f : ICS.FILEs) return Window; + pragma Import (C, getwin, "getwin"); - W : constant Window := getwin (ACS.C_Stream (File)); + W : constant Window := getwin (ACS.C_Stream (File)); begin - if W = Null_Window then - raise Curses_Exception; + if W = Null_Window then + raise Curses_Exception; else - return W; + return W; end if; - end Get_Window; + end Get_Window; -end Terminal_Interface.Curses.PutWin; +end Terminal_Interface.Curses.PutWin; diff --git a/doc/html/ada/terminal_interface-curses-putwin__ads.htm b/doc/html/ada/terminal_interface-curses-putwin__ads.htm index 8f353d22..9850bff3 100644 --- a/doc/html/ada/terminal_interface-curses-putwin__ads.htm +++ b/doc/html/ada/terminal_interface-curses-putwin__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-putwin.ads

    File : terminal_interface-curses-putwin.ads


    @@ -44,12 +45,12 @@ with Ada.Streams.Stream_IO; -package Terminal_Interface.Curses.PutWin is +package Terminal_Interface.Curses.PutWin is - procedure Put_Window (Win : Window; - File : Ada.Streams.Stream_IO.File_Type); + procedure Put_Window (Win : Window; + File : Ada.Streams.Stream_IO.File_Type); - function Get_Window (File : Ada.Streams.Stream_IO.File_Type) return Window; + function Get_Window (File : Ada.Streams.Stream_IO.File_Type) return Window; -end Terminal_Interface.Curses.PutWin; +end Terminal_Interface.Curses.PutWin; diff --git a/doc/html/ada/terminal_interface-curses-termcap__adb.htm b/doc/html/ada/terminal_interface-curses-termcap__adb.htm index 2756b442..1f9df443 100644 --- a/doc/html/ada/terminal_interface-curses-termcap__adb.htm +++ b/doc/html/ada/terminal_interface-curses-termcap__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-termcap.adb

    File : terminal_interface-curses-termcap.adb


    @@ -11,7 +12,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -39,130 +40,131 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.5 @ +-- @Revision: 1.9 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -with Interfaces.C; use Interfaces.C; -with Interfaces.C.Strings; use Interfaces.C.Strings; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; use Interfaces.C; +with Interfaces.C.Strings; use Interfaces.C.Strings; -package body Terminal_Interface.Curses.Termcap is +package body Terminal_Interface.Curses.Termcap is - function Get_Entry (Name : String) return Boolean + function Get_Entry (Name : String) return Boolean is - function tgetent (name : char_array; val : char_array) - return C_Int; - pragma Import (C, tgetent, "tgetent"); - NameTxt : char_array (0 .. Name'Length); - Length : size_t; - ignored : char_array (0 .. 0) := (0 => nul); - result : C_Int; + function tgetent (name : char_array; val : char_array) + return C_Int; + pragma Import (C, tgetent, "tgetent"); + NameTxt : char_array (0 .. Name'Length); + Length : size_t; + ignored : constant char_array (0 .. 0) := (0 => nul); + result : C_Int; begin - To_C (Name, NameTxt, Length); - result := tgetent (char_array (ignored), NameTxt); - if result = -1 then - raise Curses_Exception; + To_C (Name, NameTxt, Length); + result := tgetent (char_array (ignored), NameTxt); + if result = -1 then + raise Curses_Exception; else - return Boolean'Val (result); + return Boolean'Val (result); end if; - end Get_Entry; + end Get_Entry; ------------------------------------------------------------------------------ - function Get_Flag (Name : String) return Boolean + function Get_Flag (Name : String) return Boolean is - function tgetflag (id : char_array) return C_Int; - pragma Import (C, tgetflag, "tgetflag"); - Txt : char_array (0 .. Name'Length); - Length : size_t; + function tgetflag (id : char_array) return C_Int; + pragma Import (C, tgetflag, "tgetflag"); + Txt : char_array (0 .. Name'Length); + Length : size_t; begin - To_C (Name, Txt, Length); - if tgetflag (Txt) = 0 then + To_C (Name, Txt, Length); + if tgetflag (Txt) = 0 then return False; else return True; end if; - end Get_Flag; + end Get_Flag; ------------------------------------------------------------------------------ - procedure Get_Number (Name : in String; - Value : out Integer; - Result : out Boolean) + procedure Get_Number (Name : in String; + Value : out Integer; + Result : out Boolean) is - function tgetnum (id : char_array) return C_Int; - pragma Import (C, tgetnum, "tgetnum"); - Txt : char_array (0 .. Name'Length); - Length : size_t; + function tgetnum (id : char_array) return C_Int; + pragma Import (C, tgetnum, "tgetnum"); + Txt : char_array (0 .. Name'Length); + Length : size_t; begin - To_C (Name, Txt, Length); - Value := Integer (tgetnum (Txt)); - if Value = -1 then - Result := False; + To_C (Name, Txt, Length); + Value := Integer (tgetnum (Txt)); + if Value = -1 then + Result := False; else - Result := True; + Result := True; end if; - end Get_Number; + end Get_Number; ------------------------------------------------------------------------------ - procedure Get_String (Name : String; - Value : out String; - Result : out Boolean) + procedure Get_String (Name : String; + Value : out String; + Result : out Boolean) is - function tgetstr (id : char_array; - buf : char_array) return chars_ptr; - pragma Import (C, tgetstr, "tgetstr"); - Txt : char_array (0 .. Name'Length); - Length : size_t; - Txt2 : chars_ptr; - type t is new char_array (0 .. 1024); -- does it need to be 1024? - Return_Buffer : t := (0 => nul); + function tgetstr (id : char_array; + buf : char_array) return chars_ptr; + pragma Import (C, tgetstr, "tgetstr"); + Txt : char_array (0 .. Name'Length); + Length : size_t; + Txt2 : chars_ptr; + type t is new char_array (0 .. 1024); -- does it need to be 1024? + Return_Buffer : constant t := (others => nul); begin - To_C (Name, Txt, Length); - Txt2 := tgetstr (Txt, char_array (Return_Buffer)); - if Txt2 = Null_Ptr then - Result := False; + To_C (Name, Txt, Length); + Txt2 := tgetstr (Txt, char_array (Return_Buffer)); + if Txt2 = Null_Ptr then + Result := False; else - Value := Fill_String (Txt2); - Result := True; + Value := Fill_String (Txt2); + Result := True; end if; - end Get_String; + end Get_String; - function Get_String (Name : String) return Boolean + function Get_String (Name : String) return Boolean is - function tgetstr (Id : char_array; - buf : char_array) return chars_ptr; - pragma Import (C, tgetstr, "tgetstr"); - Txt : char_array (0 .. Name'Length); - Length : size_t; - Txt2 : chars_ptr; - type t is new char_array (0 .. 1024); -- does it need to be 1024? - Phony_Txt : t := (0 => nul); + function tgetstr (Id : char_array; + buf : char_array) return chars_ptr; + pragma Import (C, tgetstr, "tgetstr"); + Txt : char_array (0 .. Name'Length); + Length : size_t; + Txt2 : chars_ptr; + type t is new char_array (0 .. 1024); -- does it need to be 1024? + Phony_Txt : constant t := (others => nul); begin - To_C (Name, Txt, Length); - Txt2 := tgetstr (Txt, char_array (Phony_Txt)); - if Txt2 = Null_Ptr then + To_C (Name, Txt, Length); + Txt2 := tgetstr (Txt, char_array (Phony_Txt)); + if Txt2 = Null_Ptr then return False; else return True; end if; - end Get_String; + end Get_String; ------------------------------------------------------------------------------ - function TGoto (Cap : String; - Col : Column_Position; - Row : Line_Position) return Termcap_String is - function tgoto (cap : char_array; - col : C_Int; - row : C_Int) return chars_ptr; - pragma Import (C, tgoto); - Txt : char_array (0 .. Cap'Length); - Length : size_t; + function TGoto (Cap : String; + Col : Column_Position; + Row : Line_Position) return Termcap_String is + function tgoto (cap : char_array; + col : C_Int; + row : C_Int) return chars_ptr; + pragma Import (C, tgoto); + Txt : char_array (0 .. Cap'Length); + Length : size_t; begin - To_C (Cap, Txt, Length); - return Termcap_String (Fill_String - (tgoto (Txt, C_Int (Col), C_Int (Row)))); - end TGoto; + To_C (Cap, Txt, Length); + return Termcap_String (Fill_String + (tgoto (Txt, C_Int (Col), C_Int (Row)))); + end TGoto; -end Terminal_Interface.Curses.Termcap; +end Terminal_Interface.Curses.Termcap; diff --git a/doc/html/ada/terminal_interface-curses-termcap__ads.htm b/doc/html/ada/terminal_interface-curses-termcap__ads.htm index 4fd3ae62..0ccbd20a 100644 --- a/doc/html/ada/terminal_interface-curses-termcap__ads.htm +++ b/doc/html/ada/terminal_interface-curses-termcap__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-termcap.ads

    File : terminal_interface-curses-termcap.ads


    @@ -43,43 +44,43 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ -package Terminal_Interface.Curses.Termcap is - pragma Preelaborate (Terminal_Interface.Curses.Termcap); +package Terminal_Interface.Curses.Termcap is + pragma Preelaborate (Terminal_Interface.Curses.Termcap); -- |===================================================================== -- | Man page curs_termcap.3x -- |===================================================================== -- Not implemented: tputs (see curs_terminfo) - type Termcap_String is new String; + type Termcap_String is new String; -- | - function TGoto (Cap : String; - Col : Column_Position; - Row : Line_Position) return Termcap_String; + function TGoto (Cap : String; + Col : Column_Position; + Row : Line_Position) return Termcap_String; -- AKA: tgoto() -- | - function Get_Entry (Name : String) return Boolean; + function Get_Entry (Name : String) return Boolean; -- AKA: tgetent() -- | - function Get_Flag (Name : String) return Boolean; + function Get_Flag (Name : String) return Boolean; -- AKA: tgetflag() -- | - procedure Get_Number (Name : String; - Value : out Integer; - Result : out Boolean); + procedure Get_Number (Name : String; + Value : out Integer; + Result : out Boolean); -- AKA: tgetnum() -- | - procedure Get_String (Name : String; - Value : out String; - Result : out Boolean); - function Get_String (Name : String) return Boolean; + procedure Get_String (Name : String; + Value : out String; + Result : out Boolean); + function Get_String (Name : String) return Boolean; -- Returns True if the string is found. -- AKA: tgetstr() -end Terminal_Interface.Curses.Termcap; +end Terminal_Interface.Curses.Termcap; diff --git a/doc/html/ada/terminal_interface-curses-terminfo__adb.htm b/doc/html/ada/terminal_interface-curses-terminfo__adb.htm index fdc68efd..57c68ba3 100644 --- a/doc/html/ada/terminal_interface-curses-terminfo__adb.htm +++ b/doc/html/ada/terminal_interface-curses-terminfo__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-terminfo.adb

    File : terminal_interface-curses-terminfo.adb


    @@ -43,124 +44,124 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; -with Interfaces.C; use Interfaces.C; -with Interfaces.C.Strings; use Interfaces.C.Strings; +with Terminal_Interface.Curses.Aux; use Terminal_Interface.Curses.Aux; +with Interfaces.C; use Interfaces.C; +with Interfaces.C.Strings; use Interfaces.C.Strings; with Ada.Unchecked_Conversion; -package body Terminal_Interface.Curses.Terminfo is +package body Terminal_Interface.Curses.Terminfo is - function Is_MinusOne_Pointer (P : in chars_ptr) return Boolean; + function Is_MinusOne_Pointer (P : in chars_ptr) return Boolean; - function Is_MinusOne_Pointer (P : in chars_ptr) return Boolean is - type Weird_Address is new System.Storage_Elements.Integer_Address; - Invalid_Pointer : constant Weird_Address := -1; - function To_Weird is new Ada.Unchecked_Conversion - (Source => chars_ptr, Target => Weird_Address); + function Is_MinusOne_Pointer (P : in chars_ptr) return Boolean is + type Weird_Address is new System.Storage_Elements.Integer_Address; + Invalid_Pointer : constant Weird_Address := -1; + function To_Weird is new Ada.Unchecked_Conversion + (Source => chars_ptr, Target => Weird_Address); begin - if To_Weird (P) = Invalid_Pointer then + if To_Weird (P) = Invalid_Pointer then return True; else return False; end if; - end Is_MinusOne_Pointer; - pragma Inline (Is_MinusOne_Pointer); + end Is_MinusOne_Pointer; + pragma Inline (Is_MinusOne_Pointer); ------------------------------------------------------------------------------ - function Get_Flag (Name : String) return Boolean + function Get_Flag (Name : String) return Boolean is - function tigetflag (id : char_array) return Curses_Bool; - pragma Import (C, tigetflag); - Txt : char_array (0 .. Name'Length); - Length : size_t; + function tigetflag (id : char_array) return Curses_Bool; + pragma Import (C, tigetflag); + Txt : char_array (0 .. Name'Length); + Length : size_t; begin - To_C (Name, Txt, Length); - if tigetflag (Txt) = Curses_Bool (Curses_True) then + To_C (Name, Txt, Length); + if tigetflag (Txt) = Curses_Bool (Curses_True) then return True; else return False; end if; - end Get_Flag; + end Get_Flag; ------------------------------------------------------------------------------ - procedure Get_String (Name : String; - Value : out Terminfo_String; - Result : out Boolean) + procedure Get_String (Name : String; + Value : out Terminfo_String; + Result : out Boolean) is - function tigetstr (id : char_array) return chars_ptr; - pragma Import (C, tigetstr, "tigetstr"); - Txt : char_array (0 .. Name'Length); - Length : size_t; - Txt2 : chars_ptr; + function tigetstr (id : char_array) return chars_ptr; + pragma Import (C, tigetstr, "tigetstr"); + Txt : char_array (0 .. Name'Length); + Length : size_t; + Txt2 : chars_ptr; begin - To_C (Name, Txt, Length); - Txt2 := tigetstr (Txt); - if Txt2 = Null_Ptr then - Result := False; - elsif Is_MinusOne_Pointer (Txt2) then - raise Curses_Exception; + To_C (Name, Txt, Length); + Txt2 := tigetstr (Txt); + if Txt2 = Null_Ptr then + Result := False; + elsif Is_MinusOne_Pointer (Txt2) then + raise Curses_Exception; else - Value := Terminfo_String (Fill_String (Txt2)); - Result := True; + Value := Terminfo_String (Fill_String (Txt2)); + Result := True; end if; - end Get_String; + end Get_String; ------------------------------------------------------------------------------ - function Has_String (Name : String) return Boolean + function Has_String (Name : String) return Boolean is - function tigetstr (id : char_array) return chars_ptr; - pragma Import (C, tigetstr, "tigetstr"); - Txt : char_array (0 .. Name'Length); - Length : size_t; - Txt2 : chars_ptr; + function tigetstr (id : char_array) return chars_ptr; + pragma Import (C, tigetstr, "tigetstr"); + Txt : char_array (0 .. Name'Length); + Length : size_t; + Txt2 : chars_ptr; begin - To_C (Name, Txt, Length); - Txt2 := tigetstr (Txt); - if Txt2 = Null_Ptr then + To_C (Name, Txt, Length); + Txt2 := tigetstr (Txt); + if Txt2 = Null_Ptr then return False; - elsif Is_MinusOne_Pointer (Txt2) then - raise Curses_Exception; + elsif Is_MinusOne_Pointer (Txt2) then + raise Curses_Exception; else return True; end if; - end Has_String; + end Has_String; ------------------------------------------------------------------------------ - function Get_Number (Name : String) return Integer is - function tigetstr (s : char_array) return C_Int; - pragma Import (C, tigetstr); - Txt : char_array (0 .. Name'Length); - Length : size_t; + function Get_Number (Name : String) return Integer is + function tigetstr (s : char_array) return C_Int; + pragma Import (C, tigetstr); + Txt : char_array (0 .. Name'Length); + Length : size_t; begin - To_C (Name, Txt, Length); - return Integer (tigetstr (Txt)); - end Get_Number; + To_C (Name, Txt, Length); + return Integer (tigetstr (Txt)); + end Get_Number; ------------------------------------------------------------------------------ - procedure Put_String (Str : Terminfo_String; - affcnt : Natural := 1; - putc : putctype := null) is - function tputs (str : char_array; - affcnt : C_Int; - putc : putctype) return C_Int; - function putp (str : char_array) return C_Int; - pragma Import (C, tputs); - pragma Import (C, putp); - Txt : char_array (0 .. Str'Length); - Length : size_t; - Err : C_Int; + procedure Put_String (Str : Terminfo_String; + affcnt : Natural := 1; + putc : putctype := null) is + function tputs (str : char_array; + affcnt : C_Int; + putc : putctype) return C_Int; + function putp (str : char_array) return C_Int; + pragma Import (C, tputs); + pragma Import (C, putp); + Txt : char_array (0 .. Str'Length); + Length : size_t; + Err : C_Int; begin - To_C (String (Str), Txt, Length); - if putc = null then - Err := putp (Txt); + To_C (String (Str), Txt, Length); + if putc = null then + Err := putp (Txt); else - Err := tputs (Txt, C_Int (affcnt), putc); + Err := tputs (Txt, C_Int (affcnt), putc); end if; - if Err = Curses_Err then - raise Curses_Exception; + if Err = Curses_Err then + raise Curses_Exception; end if; - end Put_String; + end Put_String; -end Terminal_Interface.Curses.Terminfo; +end Terminal_Interface.Curses.Terminfo; diff --git a/doc/html/ada/terminal_interface-curses-terminfo__ads.htm b/doc/html/ada/terminal_interface-curses-terminfo__ads.htm index 4cd242a7..f5c534e4 100644 --- a/doc/html/ada/terminal_interface-curses-terminfo__ads.htm +++ b/doc/html/ada/terminal_interface-curses-terminfo__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-terminfo.ads

    File : terminal_interface-curses-terminfo.ads


    @@ -43,10 +44,10 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Interfaces.C; +with Interfaces.C; -package Terminal_Interface.Curses.Terminfo is - pragma Preelaborate (Terminal_Interface.Curses.Terminfo); +package Terminal_Interface.Curses.Terminfo is + pragma Preelaborate (Terminal_Interface.Curses.Terminfo); -- |===================================================================== -- | Man page curs_terminfo.3x @@ -55,32 +56,32 @@ -- restartterm, tparm, putp, vidputs, vidattr, -- mvcur - type Terminfo_String is new String; + type Terminfo_String is new String; -- | - procedure Get_String (Name : String; - Value : out Terminfo_String; - Result : out Boolean); - function Has_String (Name : String) return Boolean; + procedure Get_String (Name : String; + Value : out Terminfo_String; + Result : out Boolean); + function Has_String (Name : String) return Boolean; -- AKA: tigetstr() -- | - function Get_Flag (Name : String) return Boolean; + function Get_Flag (Name : String) return Boolean; -- AKA: tigetflag() -- | - function Get_Number (Name : String) return Integer; + function Get_Number (Name : String) return Integer; -- AKA: tigetnum() - type putctype is access function (c : Interfaces.C.int) - return Interfaces.C.int; - pragma Convention (C, putctype); + type putctype is access function (c : Interfaces.C.int) + return Interfaces.C.int; + pragma Convention (C, putctype); -- | - procedure Put_String (Str : Terminfo_String; - affcnt : Natural := 1; - putc : putctype := null); + procedure Put_String (Str : Terminfo_String; + affcnt : Natural := 1; + putc : putctype := null); -- AKA: tputs() -end Terminal_Interface.Curses.Terminfo; +end Terminal_Interface.Curses.Terminfo; diff --git a/doc/html/ada/terminal_interface-curses-text_io-aux__adb.htm b/doc/html/ada/terminal_interface-curses-text_io-aux__adb.htm index 09cbf10a..30ae2ce2 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-aux__adb.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-aux__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-aux.adb

    File : terminal_interface-curses-text_io-aux.adb


    @@ -42,92 +43,92 @@ -- @Revision: 1.11 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -package body Terminal_Interface.Curses.Text_IO.Aux is +package body Terminal_Interface.Curses.Text_IO.Aux is - procedure Put_Buf - (Win : in Window; - Buf : in String; - Width : in Field; - Signal : in Boolean := True; - Ljust : in Boolean := False) + procedure Put_Buf + (Win : in Window; + Buf : in String; + Width : in Field; + Signal : in Boolean := True; + Ljust : in Boolean := False) is - L : Field; - Len : Field; - W : Field := Width; - LC : Line_Count; - CC : Column_Count; - Y : Line_Position; - X : Column_Position; + L : Field; + Len : Field; + W : Field := Width; + LC : Line_Count; + CC : Column_Count; + Y : Line_Position; + X : Column_Position; - procedure Output (From, To : Field); + procedure Output (From, To : Field); - procedure Output (From, To : Field) + procedure Output (From, To : Field) is begin - if Len > 0 then - if W = 0 then - W := Len; + if Len > 0 then + if W = 0 then + W := Len; end if; - if Len > W then + if Len > W then -- LRM A10.6 (7) says this - W := Len; + W := Len; end if; - pragma Assert (Len <= W); - Get_Size (Win, LC, CC); - if Column_Count (Len) > CC then - if Signal then - raise Layout_Error; + pragma Assert (Len <= W); + Get_Size (Win, LC, CC); + if Column_Count (Len) > CC then + if Signal then + raise Layout_Error; else return; end if; else - if Len < W and then not Ljust then + if Len < W and then not Ljust then declare - Filler : constant String (1 .. (W - Len)) + Filler : constant String (1 .. (W - Len)) := (others => ' '); begin - Put (Win, Filler); + Put (Win, Filler); end; end if; - Get_Cursor_Position (Win, Y, X); - if (X + Column_Position (Len)) > CC then - New_Line (Win); + Get_Cursor_Position (Win, Y, X); + if (X + Column_Position (Len)) > CC then + New_Line (Win); end if; - Put (Win, Buf (From .. To)); - if Len < W and then Ljust then + Put (Win, Buf (From .. To)); + if Len < W and then Ljust then declare - Filler : constant String (1 .. (W - Len)) + Filler : constant String (1 .. (W - Len)) := (others => ' '); begin - Put (Win, Filler); + Put (Win, Filler); end; end if; end if; end if; - end Output; + end Output; begin - pragma Assert (Win /= Null_Window); - if Ljust then - L := 1; - for I in 1 .. Buf'Length loop - exit when Buf (L) = ' '; - L := L + 1; + pragma Assert (Win /= Null_Window); + if Ljust then + L := 1; + for I in 1 .. Buf'Length loop + exit when Buf (L) = ' '; + L := L + 1; end loop; - Len := L - 1; - Output (1, Len); + Len := L - 1; + Output (1, Len); else -- input buffer is not left justified - L := Buf'Length; - for I in 1 .. Buf'Length loop - exit when Buf (L) = ' '; - L := L - 1; + L := Buf'Length; + for I in 1 .. Buf'Length loop + exit when Buf (L) = ' '; + L := L - 1; end loop; - Len := Buf'Length - L; - Output (L + 1, Buf'Length); + Len := Buf'Length - L; + Output (L + 1, Buf'Length); end if; - end Put_Buf; + end Put_Buf; -end Terminal_Interface.Curses.Text_IO.Aux; +end Terminal_Interface.Curses.Text_IO.Aux; diff --git a/doc/html/ada/terminal_interface-curses-text_io-aux__ads.htm b/doc/html/ada/terminal_interface-curses-text_io-aux__ads.htm index c64199ee..9dbb494b 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-aux__ads.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-aux__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-aux.ads

    File : terminal_interface-curses-text_io-aux.ads


    @@ -42,19 +43,19 @@ -- @Revision: 1.12 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -private package Terminal_Interface.Curses.Text_IO.Aux is +private package Terminal_Interface.Curses.Text_IO.Aux is -- pragma Preelaborate (Aux); -- This routine is called from the Text_IO output routines for numeric -- and enumeration types. -- - procedure Put_Buf - (Win : in Window; -- The output window - Buf : in String; -- The buffer containing the text - Width : in Field; -- The width of the output field - Signal : in Boolean := True; -- If true, we raise Layout_Error - Ljust : in Boolean := False); -- The Buf is left justified + procedure Put_Buf + (Win : in Window; -- The output window + Buf : in String; -- The buffer containing the text + Width : in Field; -- The width of the output field + Signal : in Boolean := True; -- If true, we raise Layout_Error + Ljust : in Boolean := False); -- The Buf is left justified -end Terminal_Interface.Curses.Text_IO.Aux; +end Terminal_Interface.Curses.Text_IO.Aux; diff --git a/doc/html/ada/terminal_interface-curses-text_io-complex_io__adb.htm b/doc/html/ada/terminal_interface-curses-text_io-complex_io__adb.htm index d746d072..ce5f059d 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-complex_io__adb.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-complex_io__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-complex_io.adb

    File : terminal_interface-curses-text_io-complex_io.adb


    @@ -42,37 +43,37 @@ -- @Revision: 1.10 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -with Terminal_Interface.Curses.Text_IO.Float_IO; +with Terminal_Interface.Curses.Text_IO.Float_IO; -package body Terminal_Interface.Curses.Text_IO.Complex_IO is +package body Terminal_Interface.Curses.Text_IO.Complex_IO is - package FIO is new - Terminal_Interface.Curses.Text_IO.Float_IO (Complex_Types.Real'Base); + package FIO is new + Terminal_Interface.Curses.Text_IO.Float_IO (Complex_Types.Real'Base); - procedure Put - (Win : in Window; - Item : in Complex; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp) + procedure Put + (Win : in Window; + Item : in Complex; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) is begin - Put (Win, '('); - FIO.Put (Win, Item.Re, Fore, Aft, Exp); - Put (Win, ','); - FIO.Put (Win, Item.Im, Fore, Aft, Exp); - Put (Win, ')'); - end Put; + Put (Win, '('); + FIO.Put (Win, Item.Re, Fore, Aft, Exp); + Put (Win, ','); + FIO.Put (Win, Item.Im, Fore, Aft, Exp); + Put (Win, ')'); + end Put; - procedure Put - (Item : in Complex; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp) + procedure Put + (Item : in Complex; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) is begin - Put (Get_Window, Item, Fore, Aft, Exp); - end Put; + Put (Get_Window, Item, Fore, Aft, Exp); + end Put; -end Terminal_Interface.Curses.Text_IO.Complex_IO; +end Terminal_Interface.Curses.Text_IO.Complex_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-complex_io__ads.htm b/doc/html/ada/terminal_interface-curses-text_io-complex_io__ads.htm index fda930e8..f8ab75b4 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-complex_io__ads.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-complex_io__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-complex_io.ads

    File : terminal_interface-curses-text_io-complex_io.ads


    @@ -45,31 +46,31 @@ with Ada.Numerics.Generic_Complex_Types; generic - with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (<>); + with package Complex_Types is new Ada.Numerics.Generic_Complex_Types (<>); -package Terminal_Interface.Curses.Text_IO.Complex_IO is +package Terminal_Interface.Curses.Text_IO.Complex_IO is - use Complex_Types; + use Complex_Types; - Default_Fore : Field := 2; - Default_Aft : Field := Real'Digits - 1; - Default_Exp : Field := 3; + Default_Fore : Field := 2; + Default_Aft : Field := Real'Digits - 1; + Default_Exp : Field := 3; - procedure Put - (Win : in Window; - Item : in Complex; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp); + procedure Put + (Win : in Window; + Item : in Complex; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); - procedure Put - (Item : in Complex; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp); + procedure Put + (Item : in Complex; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); private pragma Inline (Put); -end Terminal_Interface.Curses.Text_IO.Complex_IO; +end Terminal_Interface.Curses.Text_IO.Complex_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-decimal_io__adb.htm b/doc/html/ada/terminal_interface-curses-text_io-decimal_io__adb.htm index c353ad59..94c7e87f 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-decimal_io__adb.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-decimal_io__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-decimal_io.adb

    File : terminal_interface-curses-text_io-decimal_io.adb


    @@ -43,38 +44,38 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Text_IO; -with Terminal_Interface.Curses.Text_IO.Aux; +with Terminal_Interface.Curses.Text_IO.Aux; -package body Terminal_Interface.Curses.Text_IO.Decimal_IO is +package body Terminal_Interface.Curses.Text_IO.Decimal_IO is - package Aux renames Terminal_Interface.Curses.Text_IO.Aux; - package DIO is new Ada.Text_IO.Decimal_IO (Num); + package Aux renames Terminal_Interface.Curses.Text_IO.Aux; + package DIO is new Ada.Text_IO.Decimal_IO (Num); - procedure Put - (Win : in Window; - Item : in Num; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp) + procedure Put + (Win : in Window; + Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) is - Buf : String (1 .. Field'Last); - Len : Field := Fore + 1 + Aft; + Buf : String (1 .. Field'Last); + Len : Field := Fore + 1 + Aft; begin - if Exp > 0 then - Len := Len + 1 + Exp; + if Exp > 0 then + Len := Len + 1 + Exp; end if; - DIO.Put (Buf, Item, Aft, Exp); - Aux.Put_Buf (Win, Buf, Len, False); - end Put; + DIO.Put (Buf, Item, Aft, Exp); + Aux.Put_Buf (Win, Buf, Len, False); + end Put; - procedure Put - (Item : in Num; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp) is + procedure Put + (Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) is begin - Put (Get_Window, Item, Fore, Aft, Exp); - end Put; + Put (Get_Window, Item, Fore, Aft, Exp); + end Put; -end Terminal_Interface.Curses.Text_IO.Decimal_IO; +end Terminal_Interface.Curses.Text_IO.Decimal_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-decimal_io__ads.htm b/doc/html/ada/terminal_interface-curses-text_io-decimal_io__ads.htm index 3675631b..78fa1c8f 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-decimal_io__ads.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-decimal_io__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-decimal_io.ads

    File : terminal_interface-curses-text_io-decimal_io.ads


    @@ -43,29 +44,29 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ generic - type Num is delta <> digits <>; + type Num is delta <> digits <>; -package Terminal_Interface.Curses.Text_IO.Decimal_IO is +package Terminal_Interface.Curses.Text_IO.Decimal_IO is - Default_Fore : Field := Num'Fore; - Default_Aft : Field := Num'Aft; - Default_Exp : Field := 0; + Default_Fore : Field := Num'Fore; + Default_Aft : Field := Num'Aft; + Default_Exp : Field := 0; - procedure Put - (Win : in Window; - Item : in Num; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp); + procedure Put + (Win : in Window; + Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); - procedure Put - (Item : in Num; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp); + procedure Put + (Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); private pragma Inline (Put); -end Terminal_Interface.Curses.Text_IO.Decimal_IO; +end Terminal_Interface.Curses.Text_IO.Decimal_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__adb.htm b/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__adb.htm index 3dea5ff9..78402d19 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__adb.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-enumeration_io.adb

    File : terminal_interface-curses-text_io-enumeration_io.adb


    @@ -44,42 +45,42 @@ ------------------------------------------------------------------------------ with Ada.Text_IO; with Ada.Characters.Handling; use Ada.Characters.Handling; -with Terminal_Interface.Curses.Text_IO.Aux; +with Terminal_Interface.Curses.Text_IO.Aux; -package body Terminal_Interface.Curses.Text_IO.Enumeration_IO is +package body Terminal_Interface.Curses.Text_IO.Enumeration_IO is - package Aux renames Terminal_Interface.Curses.Text_IO.Aux; - package EIO is new Ada.Text_IO.Enumeration_IO (Enum); + package Aux renames Terminal_Interface.Curses.Text_IO.Aux; + package EIO is new Ada.Text_IO.Enumeration_IO (Enum); - procedure Put - (Win : in Window; - Item : in Enum; - Width : in Field := Default_Width; - Set : in Type_Set := Default_Setting) + procedure Put + (Win : in Window; + Item : in Enum; + Width : in Field := Default_Width; + Set : in Type_Set := Default_Setting) is - Buf : String (1 .. Field'Last); - Tset : Ada.Text_IO.Type_Set; + Buf : String (1 .. Field'Last); + Tset : Ada.Text_IO.Type_Set; begin - if Set /= Mixed_Case then - Tset := Ada.Text_IO.Type_Set'Val (Type_Set'Pos (Set)); + if Set /= Mixed_Case then + Tset := Ada.Text_IO.Type_Set'Val (Type_Set'Pos (Set)); else - Tset := Ada.Text_IO.Lower_Case; + Tset := Ada.Text_IO.Lower_Case; end if; - EIO.Put (Buf, Item, Tset); - if Set = Mixed_Case then - Buf (Buf'First) := To_Upper (Buf (Buf'First)); + EIO.Put (Buf, Item, Tset); + if Set = Mixed_Case then + Buf (Buf'First) := To_Upper (Buf (Buf'First)); end if; - Aux.Put_Buf (Win, Buf, Width, True, True); - end Put; + Aux.Put_Buf (Win, Buf, Width, True, True); + end Put; - procedure Put - (Item : in Enum; - Width : in Field := Default_Width; - Set : in Type_Set := Default_Setting) + procedure Put + (Item : in Enum; + Width : in Field := Default_Width; + Set : in Type_Set := Default_Setting) is begin - Put (Get_Window, Item, Width, Set); - end Put; + Put (Get_Window, Item, Width, Set); + end Put; -end Terminal_Interface.Curses.Text_IO.Enumeration_IO; +end Terminal_Interface.Curses.Text_IO.Enumeration_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__ads.htm b/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__ads.htm index 52f78f7d..6ade4e28 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__ads.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-enumeration_io__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-enumeration_io.ads

    File : terminal_interface-curses-text_io-enumeration_io.ads


    @@ -43,26 +44,26 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ generic - type Enum is (<>); + type Enum is (<>); -package Terminal_Interface.Curses.Text_IO.Enumeration_IO is +package Terminal_Interface.Curses.Text_IO.Enumeration_IO is - Default_Width : Field := 0; - Default_Setting : Type_Set := Mixed_Case; + Default_Width : Field := 0; + Default_Setting : Type_Set := Mixed_Case; - procedure Put - (Win : in Window; - Item : in Enum; - Width : in Field := Default_Width; - Set : in Type_Set := Default_Setting); + procedure Put + (Win : in Window; + Item : in Enum; + Width : in Field := Default_Width; + Set : in Type_Set := Default_Setting); - procedure Put - (Item : in Enum; - Width : in Field := Default_Width; - Set : in Type_Set := Default_Setting); + procedure Put + (Item : in Enum; + Width : in Field := Default_Width; + Set : in Type_Set := Default_Setting); private pragma Inline (Put); -end Terminal_Interface.Curses.Text_IO.Enumeration_IO; +end Terminal_Interface.Curses.Text_IO.Enumeration_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-fixed_io__adb.htm b/doc/html/ada/terminal_interface-curses-text_io-fixed_io__adb.htm index d6023c16..7d285b11 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-fixed_io__adb.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-fixed_io__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-fixed_io.adb

    File : terminal_interface-curses-text_io-fixed_io.adb


    @@ -43,38 +44,38 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Text_IO; -with Terminal_Interface.Curses.Text_IO.Aux; +with Terminal_Interface.Curses.Text_IO.Aux; -package body Terminal_Interface.Curses.Text_IO.Fixed_IO is +package body Terminal_Interface.Curses.Text_IO.Fixed_IO is - package Aux renames Terminal_Interface.Curses.Text_IO.Aux; - package FIXIO is new Ada.Text_IO.Fixed_IO (Num); + package Aux renames Terminal_Interface.Curses.Text_IO.Aux; + package FIXIO is new Ada.Text_IO.Fixed_IO (Num); - procedure Put - (Win : in Window; - Item : in Num; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp) + procedure Put + (Win : in Window; + Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) is - Buf : String (1 .. Field'Last); - Len : Field := Fore + 1 + Aft; + Buf : String (1 .. Field'Last); + Len : Field := Fore + 1 + Aft; begin - if Exp > 0 then - Len := Len + 1 + Exp; + if Exp > 0 then + Len := Len + 1 + Exp; end if; - FIXIO.Put (Buf, Item, Aft, Exp); - Aux.Put_Buf (Win, Buf, Len, False); - end Put; + FIXIO.Put (Buf, Item, Aft, Exp); + Aux.Put_Buf (Win, Buf, Len, False); + end Put; - procedure Put - (Item : in Num; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp) is + procedure Put + (Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) is begin - Put (Get_Window, Item, Fore, Aft, Exp); - end Put; + Put (Get_Window, Item, Fore, Aft, Exp); + end Put; -end Terminal_Interface.Curses.Text_IO.Fixed_IO; +end Terminal_Interface.Curses.Text_IO.Fixed_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-fixed_io__ads.htm b/doc/html/ada/terminal_interface-curses-text_io-fixed_io__ads.htm index 812d80e7..02aecf06 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-fixed_io__ads.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-fixed_io__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-fixed_io.ads

    File : terminal_interface-curses-text_io-fixed_io.ads


    @@ -43,29 +44,29 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ generic - type Num is delta <>; + type Num is delta <>; -package Terminal_Interface.Curses.Text_IO.Fixed_IO is +package Terminal_Interface.Curses.Text_IO.Fixed_IO is - Default_Fore : Field := Num'Fore; - Default_Aft : Field := Num'Aft; - Default_Exp : Field := 0; + Default_Fore : Field := Num'Fore; + Default_Aft : Field := Num'Aft; + Default_Exp : Field := 0; - procedure Put - (Win : in Window; - Item : in Num; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp); + procedure Put + (Win : in Window; + Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); - procedure Put - (Item : in Num; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp); + procedure Put + (Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); private pragma Inline (Put); -end Terminal_Interface.Curses.Text_IO.Fixed_IO; +end Terminal_Interface.Curses.Text_IO.Fixed_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-float_io__adb.htm b/doc/html/ada/terminal_interface-curses-text_io-float_io__adb.htm index 75769aba..48ae17aa 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-float_io__adb.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-float_io__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-float_io.adb

    File : terminal_interface-curses-text_io-float_io.adb


    @@ -43,39 +44,39 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Text_IO; -with Terminal_Interface.Curses.Text_IO.Aux; +with Terminal_Interface.Curses.Text_IO.Aux; -package body Terminal_Interface.Curses.Text_IO.Float_IO is +package body Terminal_Interface.Curses.Text_IO.Float_IO is - package Aux renames Terminal_Interface.Curses.Text_IO.Aux; - package FIO is new Ada.Text_IO.Float_IO (Num); + package Aux renames Terminal_Interface.Curses.Text_IO.Aux; + package FIO is new Ada.Text_IO.Float_IO (Num); - procedure Put - (Win : in Window; - Item : in Num; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp) + procedure Put + (Win : in Window; + Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) is - Buf : String (1 .. Field'Last); - Len : Field := Fore + 1 + Aft; + Buf : String (1 .. Field'Last); + Len : Field := Fore + 1 + Aft; begin - if Exp > 0 then - Len := Len + 1 + Exp; + if Exp > 0 then + Len := Len + 1 + Exp; end if; - FIO.Put (Buf, Item, Aft, Exp); - Aux.Put_Buf (Win, Buf, Len, False); - end Put; + FIO.Put (Buf, Item, Aft, Exp); + Aux.Put_Buf (Win, Buf, Len, False); + end Put; - procedure Put - (Item : in Num; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp) + procedure Put + (Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp) is begin - Put (Get_Window, Item, Fore, Aft, Exp); - end Put; + Put (Get_Window, Item, Fore, Aft, Exp); + end Put; -end Terminal_Interface.Curses.Text_IO.Float_IO; +end Terminal_Interface.Curses.Text_IO.Float_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-float_io__ads.htm b/doc/html/ada/terminal_interface-curses-text_io-float_io__ads.htm index bb8abaf4..b56b8be1 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-float_io__ads.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-float_io__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-float_io.ads

    File : terminal_interface-curses-text_io-float_io.ads


    @@ -43,29 +44,29 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ generic - type Num is digits <>; + type Num is digits <>; -package Terminal_Interface.Curses.Text_IO.Float_IO is +package Terminal_Interface.Curses.Text_IO.Float_IO is - Default_Fore : Field := 2; - Default_Aft : Field := Num'Digits - 1; - Default_Exp : Field := 3; + Default_Fore : Field := 2; + Default_Aft : Field := Num'Digits - 1; + Default_Exp : Field := 3; - procedure Put - (Win : in Window; - Item : in Num; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp); + procedure Put + (Win : in Window; + Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); - procedure Put - (Item : in Num; - Fore : in Field := Default_Fore; - Aft : in Field := Default_Aft; - Exp : in Field := Default_Exp); + procedure Put + (Item : in Num; + Fore : in Field := Default_Fore; + Aft : in Field := Default_Aft; + Exp : in Field := Default_Exp); private pragma Inline (Put); -end Terminal_Interface.Curses.Text_IO.Float_IO; +end Terminal_Interface.Curses.Text_IO.Float_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-integer_io__adb.htm b/doc/html/ada/terminal_interface-curses-text_io-integer_io__adb.htm index 69c32157..ce2a28e3 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-integer_io__adb.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-integer_io__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-integer_io.adb

    File : terminal_interface-curses-text_io-integer_io.adb


    @@ -43,33 +44,33 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Text_IO; -with Terminal_Interface.Curses.Text_IO.Aux; +with Terminal_Interface.Curses.Text_IO.Aux; -package body Terminal_Interface.Curses.Text_IO.Integer_IO is +package body Terminal_Interface.Curses.Text_IO.Integer_IO is - package Aux renames Terminal_Interface.Curses.Text_IO.Aux; - package IIO is new Ada.Text_IO.Integer_IO (Num); + package Aux renames Terminal_Interface.Curses.Text_IO.Aux; + package IIO is new Ada.Text_IO.Integer_IO (Num); - procedure Put - (Win : in Window; - Item : in Num; - Width : in Field := Default_Width; - Base : in Number_Base := Default_Base) + procedure Put + (Win : in Window; + Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base) is - Buf : String (1 .. Field'Last); + Buf : String (1 .. Field'Last); begin - IIO.Put (Buf, Item, Base); - Aux.Put_Buf (Win, Buf, Width); - end Put; + IIO.Put (Buf, Item, Base); + Aux.Put_Buf (Win, Buf, Width); + end Put; - procedure Put - (Item : in Num; - Width : in Field := Default_Width; - Base : in Number_Base := Default_Base) + procedure Put + (Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base) is begin - Put (Get_Window, Item, Width, Base); - end Put; + Put (Get_Window, Item, Width, Base); + end Put; -end Terminal_Interface.Curses.Text_IO.Integer_IO; +end Terminal_Interface.Curses.Text_IO.Integer_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-integer_io__ads.htm b/doc/html/ada/terminal_interface-curses-text_io-integer_io__ads.htm index a06d5316..e3be5545 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-integer_io__ads.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-integer_io__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-integer_io.ads

    File : terminal_interface-curses-text_io-integer_io.ads


    @@ -43,26 +44,26 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ generic - type Num is range <>; + type Num is range <>; -package Terminal_Interface.Curses.Text_IO.Integer_IO is +package Terminal_Interface.Curses.Text_IO.Integer_IO is - Default_Width : Field := Num'Width; - Default_Base : Number_Base := 10; + Default_Width : Field := Num'Width; + Default_Base : Number_Base := 10; - procedure Put - (Win : in Window; - Item : in Num; - Width : in Field := Default_Width; - Base : in Number_Base := Default_Base); + procedure Put + (Win : in Window; + Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base); - procedure Put - (Item : in Num; - Width : in Field := Default_Width; - Base : in Number_Base := Default_Base); + procedure Put + (Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base); private pragma Inline (Put); -end Terminal_Interface.Curses.Text_IO.Integer_IO; +end Terminal_Interface.Curses.Text_IO.Integer_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-modular_io__adb.htm b/doc/html/ada/terminal_interface-curses-text_io-modular_io__adb.htm index a960b2d0..33600097 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-modular_io__adb.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-modular_io__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-modular_io.adb

    File : terminal_interface-curses-text_io-modular_io.adb


    @@ -43,33 +44,33 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ with Ada.Text_IO; -with Terminal_Interface.Curses.Text_IO.Aux; +with Terminal_Interface.Curses.Text_IO.Aux; -package body Terminal_Interface.Curses.Text_IO.Modular_IO is +package body Terminal_Interface.Curses.Text_IO.Modular_IO is - package Aux renames Terminal_Interface.Curses.Text_IO.Aux; - package MIO is new Ada.Text_IO.Modular_IO (Num); + package Aux renames Terminal_Interface.Curses.Text_IO.Aux; + package MIO is new Ada.Text_IO.Modular_IO (Num); - procedure Put - (Win : in Window; - Item : in Num; - Width : in Field := Default_Width; - Base : in Number_Base := Default_Base) + procedure Put + (Win : in Window; + Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base) is - Buf : String (1 .. Field'Last); + Buf : String (1 .. Field'Last); begin - MIO.Put (Buf, Item, Base); - Aux.Put_Buf (Win, Buf, Width); - end Put; + MIO.Put (Buf, Item, Base); + Aux.Put_Buf (Win, Buf, Width); + end Put; - procedure Put - (Item : in Num; - Width : in Field := Default_Width; - Base : in Number_Base := Default_Base) + procedure Put + (Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base) is begin - Put (Get_Window, Item, Width, Base); - end Put; + Put (Get_Window, Item, Width, Base); + end Put; -end Terminal_Interface.Curses.Text_IO.Modular_IO; +end Terminal_Interface.Curses.Text_IO.Modular_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io-modular_io__ads.htm b/doc/html/ada/terminal_interface-curses-text_io-modular_io__ads.htm index e5d6ef8a..8ab3f514 100644 --- a/doc/html/ada/terminal_interface-curses-text_io-modular_io__ads.htm +++ b/doc/html/ada/terminal_interface-curses-text_io-modular_io__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io-modular_io.ads

    File : terminal_interface-curses-text_io-modular_io.ads


    @@ -43,26 +44,26 @@ -- Binding Version 01.00 ------------------------------------------------------------------------------ generic - type Num is mod <>; + type Num is mod <>; -package Terminal_Interface.Curses.Text_IO.Modular_IO is +package Terminal_Interface.Curses.Text_IO.Modular_IO is - Default_Width : Field := Num'Width; - Default_Base : Number_Base := 10; + Default_Width : Field := Num'Width; + Default_Base : Number_Base := 10; - procedure Put - (Win : in Window; - Item : in Num; - Width : in Field := Default_Width; - Base : in Number_Base := Default_Base); + procedure Put + (Win : in Window; + Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base); - procedure Put - (Item : in Num; - Width : in Field := Default_Width; - Base : in Number_Base := Default_Base); + procedure Put + (Item : in Num; + Width : in Field := Default_Width; + Base : in Number_Base := Default_Base); private pragma Inline (Put); -end Terminal_Interface.Curses.Text_IO.Modular_IO; +end Terminal_Interface.Curses.Text_IO.Modular_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io__adb.htm b/doc/html/ada/terminal_interface-curses-text_io__adb.htm index edf46182..cca6461d 100644 --- a/doc/html/ada/terminal_interface-curses-text_io__adb.htm +++ b/doc/html/ada/terminal_interface-curses-text_io__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io.adb

    File : terminal_interface-curses-text_io.adb


    @@ -11,7 +12,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -39,41 +40,42 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.14 @ +-- @Revision: 1.17 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -package body Terminal_Interface.Curses.Text_IO is +package body Terminal_Interface.Curses.Text_IO is - Default_Window : Window := Null_Window; + Default_Window : Window := Null_Window; - procedure Set_Window (Win : in Window) + procedure Set_Window (Win : in Window) is begin - Default_Window := Win; - end Set_Window; + Default_Window := Win; + end Set_Window; - function Get_Window return Window + function Get_Window return Window is begin - if Default_Window = Null_Window then - return Standard_Window; + if Default_Window = Null_Window then + return Standard_Window; else - return Default_Window; + return Default_Window; end if; - end Get_Window; - pragma Inline (Get_Window); + end Get_Window; + pragma Inline (Get_Window); - procedure Flush (Win : in Window) + procedure Flush (Win : in Window) is begin - Refresh (Win); - end Flush; + Refresh (Win); + end Flush; - procedure Flush + procedure Flush is begin - Flush (Get_Window); - end Flush; + Flush (Get_Window); + end Flush; -------------------------------------------- -- Specification of line and page lengths -- @@ -84,258 +86,258 @@ -- A scroll-window is interpreted as an page with unbounded page length, -- i.e. it returns the conventional 0 as page length. - function Line_Length (Win : in Window) return Count + function Line_Length (Win : in Window) return Count is - N_Lines : Line_Count; - N_Cols : Column_Count; + N_Lines : Line_Count; + N_Cols : Column_Count; begin - Get_Size (Win, N_Lines, N_Cols); - if Natural (N_Cols) > Natural (Count'Last) then - raise Layout_Error; - end if; - return Count (N_Cols); - end Line_Length; - - function Line_Length return Count + Get_Size (Win, N_Lines, N_Cols); + -- if Natural (N_Cols) > Natural (Count'Last) then + -- raise Layout_Error; + -- end if; + return Count (N_Cols); + end Line_Length; + + function Line_Length return Count is begin - return Line_Length (Get_Window); - end Line_Length; + return Line_Length (Get_Window); + end Line_Length; - function Page_Length (Win : in Window) return Count + function Page_Length (Win : in Window) return Count is - N_Lines : Line_Count; - N_Cols : Column_Count; + N_Lines : Line_Count; + N_Cols : Column_Count; begin - if Scrolling_Allowed (Win) then + if Scrolling_Allowed (Win) then return 0; else - Get_Size (Win, N_Lines, N_Cols); - if Natural (N_Lines) > Natural (Count'Last) then - raise Layout_Error; - end if; - return Count (N_Lines); + Get_Size (Win, N_Lines, N_Cols); + -- if Natural (N_Lines) > Natural (Count'Last) then + -- raise Layout_Error; + -- end if; + return Count (N_Lines); end if; - end Page_Length; + end Page_Length; - function Page_Length return Count + function Page_Length return Count is begin - return Page_Length (Get_Window); - end Page_Length; + return Page_Length (Get_Window); + end Page_Length; ------------------------------------ -- Column, Line, and Page Control -- ------------------------------------ - procedure New_Line (Win : in Window; Spacing : in Positive_Count := 1) + procedure New_Line (Win : in Window; Spacing : in Positive_Count := 1) is - P_Size : constant Count := Page_Length (Win); + P_Size : constant Count := Page_Length (Win); begin - if Spacing not in Positive_Count then + if Spacing not in Positive_Count then raise Constraint_Error; end if; - for I in 1 .. Spacing loop - if P_Size > 0 and then Line (Win) >= P_Size then - New_Page (Win); + for I in 1 .. Spacing loop + if P_Size > 0 and then Line (Win) >= P_Size then + New_Page (Win); else - Add (Win, ASCII.LF); + Add (Win, ASCII.LF); end if; end loop; - end New_Line; + end New_Line; - procedure New_Line (Spacing : in Positive_Count := 1) + procedure New_Line (Spacing : in Positive_Count := 1) is begin - New_Line (Get_Window, Spacing); - end New_Line; + New_Line (Get_Window, Spacing); + end New_Line; - procedure New_Page (Win : in Window) + procedure New_Page (Win : in Window) is begin - Clear (Win); - end New_Page; + Clear (Win); + end New_Page; - procedure New_Page + procedure New_Page is begin - New_Page (Get_Window); - end New_Page; + New_Page (Get_Window); + end New_Page; - procedure Set_Col (Win : in Window; To : in Positive_Count) + procedure Set_Col (Win : in Window; To : in Positive_Count) is - Y : Line_Position; - X1 : Column_Position; - X2 : Column_Position; - N : Natural; + Y : Line_Position; + X1 : Column_Position; + X2 : Column_Position; + N : Natural; begin - if To not in Positive_Count then + if To not in Positive_Count then raise Constraint_Error; end if; - Get_Cursor_Position (Win, Y, X1); - N := Natural (To); N := N - 1; - X2 := Column_Position (N); - if X1 > X2 then - New_Line (Win, 1); - X1 := 0; + Get_Cursor_Position (Win, Y, X1); + N := Natural (To); N := N - 1; + X2 := Column_Position (N); + if X1 > X2 then + New_Line (Win, 1); + X1 := 0; end if; - if X1 < X2 then + if X1 < X2 then declare - Filler : constant String (Integer (X1) .. (Integer (X2) - 1)) + Filler : constant String (Integer (X1) .. (Integer (X2) - 1)) := (others => ' '); begin - Put (Win, Filler); + Put (Win, Filler); end; end if; - end Set_Col; + end Set_Col; - procedure Set_Col (To : in Positive_Count) + procedure Set_Col (To : in Positive_Count) is begin - Set_Col (Get_Window, To); - end Set_Col; + Set_Col (Get_Window, To); + end Set_Col; - procedure Set_Line (Win : in Window; To : in Positive_Count) + procedure Set_Line (Win : in Window; To : in Positive_Count) is - Y1 : Line_Position; - Y2 : Line_Position; - X : Column_Position; - N : Natural; + Y1 : Line_Position; + Y2 : Line_Position; + X : Column_Position; + N : Natural; begin - if To not in Positive_Count then + if To not in Positive_Count then raise Constraint_Error; end if; - Get_Cursor_Position (Win, Y1, X); - N := Natural (To); N := N - 1; - Y2 := Line_Position (N); - if Y2 < Y1 then - New_Page (Win); - Y1 := 0; + Get_Cursor_Position (Win, Y1, X); + N := Natural (To); N := N - 1; + Y2 := Line_Position (N); + if Y2 < Y1 then + New_Page (Win); + Y1 := 0; end if; - if Y1 < Y2 then - New_Line (Win, Positive_Count (Y2 - Y1)); + if Y1 < Y2 then + New_Line (Win, Positive_Count (Y2 - Y1)); end if; - end Set_Line; + end Set_Line; - procedure Set_Line (To : in Positive_Count) + procedure Set_Line (To : in Positive_Count) is begin - Set_Line (Get_Window, To); - end Set_Line; + Set_Line (Get_Window, To); + end Set_Line; - function Col (Win : in Window) return Positive_Count + function Col (Win : in Window) return Positive_Count is - Y : Line_Position; - X : Column_Position; - N : Natural; + Y : Line_Position; + X : Column_Position; + N : Natural; begin - Get_Cursor_Position (Win, Y, X); - N := Natural (X); N := N + 1; - if N > Natural (Count'Last) then - raise Layout_Error; - end if; - return Positive_Count (N); - end Col; - - function Col return Positive_Count + Get_Cursor_Position (Win, Y, X); + N := Natural (X); N := N + 1; + -- if N > Natural (Count'Last) then + -- raise Layout_Error; + -- end if; + return Positive_Count (N); + end Col; + + function Col return Positive_Count is begin - return Col (Get_Window); - end Col; + return Col (Get_Window); + end Col; - function Line (Win : in Window) return Positive_Count + function Line (Win : in Window) return Positive_Count is - Y : Line_Position; - X : Column_Position; - N : Natural; + Y : Line_Position; + X : Column_Position; + N : Natural; begin - Get_Cursor_Position (Win, Y, X); - N := Natural (Y); N := N + 1; - if N > Natural (Count'Last) then - raise Layout_Error; - end if; - return Positive_Count (N); - end Line; - - function Line return Positive_Count + Get_Cursor_Position (Win, Y, X); + N := Natural (Y); N := N + 1; + -- if N > Natural (Count'Last) then + -- raise Layout_Error; + -- end if; + return Positive_Count (N); + end Line; + + function Line return Positive_Count is begin - return Line (Get_Window); - end Line; + return Line (Get_Window); + end Line; ----------------------- -- Characters Output -- ----------------------- - procedure Put (Win : in Window; Item : in Character) + procedure Put (Win : in Window; Item : in Character) is - P_Size : constant Count := Page_Length (Win); - Y : Line_Position; - X : Column_Position; - L : Line_Count; - C : Column_Count; + P_Size : constant Count := Page_Length (Win); + Y : Line_Position; + X : Column_Position; + L : Line_Count; + C : Column_Count; begin - if P_Size > 0 then - Get_Cursor_Position (Win, Y, X); - Get_Size (Win, L, C); - if (Y + 1) = L and then (X + 1) = C then - New_Page (Win); + if P_Size > 0 then + Get_Cursor_Position (Win, Y, X); + Get_Size (Win, L, C); + if (Y + 1) = L and then (X + 1) = C then + New_Page (Win); end if; end if; - Add (Win, Item); - end Put; + Add (Win, Item); + end Put; - procedure Put (Item : in Character) + procedure Put (Item : in Character) is begin - Put (Get_Window, Item); - end Put; + Put (Get_Window, Item); + end Put; -------------------- -- Strings-Output -- -------------------- - procedure Put (Win : in Window; Item : in String) + procedure Put (Win : in Window; Item : in String) is - P_Size : constant Count := Page_Length (Win); - Y : Line_Position; - X : Column_Position; - L : Line_Count; - C : Column_Count; + P_Size : constant Count := Page_Length (Win); + Y : Line_Position; + X : Column_Position; + L : Line_Count; + C : Column_Count; begin - if P_Size > 0 then - Get_Cursor_Position (Win, Y, X); - Get_Size (Win, L, C); - if (Y + 1) = L and then (X + 1 + Item'Length) >= C then - New_Page (Win); + if P_Size > 0 then + Get_Cursor_Position (Win, Y, X); + Get_Size (Win, L, C); + if (Y + 1) = L and then (X + 1 + Item'Length) >= C then + New_Page (Win); end if; end if; - Add (Win, Item); - end Put; + Add (Win, Item); + end Put; - procedure Put (Item : in String) + procedure Put (Item : in String) is begin - Put (Get_Window, Item); - end Put; + Put (Get_Window, Item); + end Put; - procedure Put_Line - (Win : in Window; - Item : in String) + procedure Put_Line + (Win : in Window; + Item : in String) is begin - Put (Win, Item); - New_Line (Win, 1); - end Put_Line; + Put (Win, Item); + New_Line (Win, 1); + end Put_Line; - procedure Put_Line - (Item : in String) + procedure Put_Line + (Item : in String) is begin - Put_Line (Get_Window, Item); - end Put_Line; + Put_Line (Get_Window, Item); + end Put_Line; -end Terminal_Interface.Curses.Text_IO; +end Terminal_Interface.Curses.Text_IO; diff --git a/doc/html/ada/terminal_interface-curses-text_io__ads.htm b/doc/html/ada/terminal_interface-curses-text_io__ads.htm index c18a3804..dca55d24 100644 --- a/doc/html/ada/terminal_interface-curses-text_io__ads.htm +++ b/doc/html/ada/terminal_interface-curses-text_io__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-text_io.ads

    File : terminal_interface-curses-text_io.ads


    @@ -45,29 +46,29 @@ with Ada.Text_IO; with Ada.IO_Exceptions; -package Terminal_Interface.Curses.Text_IO is +package Terminal_Interface.Curses.Text_IO is use type Ada.Text_IO.Count; - subtype Count is Ada.Text_IO.Count; - subtype Positive_Count is Count range 1 .. Count'Last; + subtype Count is Ada.Text_IO.Count; + subtype Positive_Count is Count range 1 .. Count'Last; - subtype Field is Ada.Text_IO.Field; - subtype Number_Base is Integer range 2 .. 16; + subtype Field is Ada.Text_IO.Field; + subtype Number_Base is Integer range 2 .. 16; - type Type_Set is (Lower_Case, Upper_Case, Mixed_Case); + type Type_Set is (Lower_Case, Upper_Case, Mixed_Case); -- For most of the routines you will see a version without a Window -- type parameter. They will operate on a default window, which can -- be set by the user. It is initially equal to Standard_Window. - procedure Set_Window (Win : in Window); + procedure Set_Window (Win : in Window); -- Set Win as the default window - function Get_Window return Window; + function Get_Window return Window; -- Get the current default window - procedure Flush (Win : in Window); - procedure Flush; + procedure Flush (Win : in Window); + procedure Flush; -------------------------------------------- -- Specification of line and page lengths -- @@ -78,64 +79,64 @@ -- A scroll-window is interpreted as an page with unbounded page length, -- i.e. it returns the conventional 0 as page length. - function Line_Length (Win : in Window) return Count; - function Line_Length return Count; + function Line_Length (Win : in Window) return Count; + function Line_Length return Count; - function Page_Length (Win : in Window) return Count; - function Page_Length return Count; + function Page_Length (Win : in Window) return Count; + function Page_Length return Count; ------------------------------------ -- Column, Line, and Page Control -- ------------------------------------ - procedure New_Line (Win : in Window; Spacing : in Positive_Count := 1); - procedure New_Line (Spacing : in Positive_Count := 1); + procedure New_Line (Win : in Window; Spacing : in Positive_Count := 1); + procedure New_Line (Spacing : in Positive_Count := 1); - procedure New_Page (Win : in Window); - procedure New_Page; + procedure New_Page (Win : in Window); + procedure New_Page; - procedure Set_Col (Win : in Window; To : in Positive_Count); - procedure Set_Col (To : in Positive_Count); + procedure Set_Col (Win : in Window; To : in Positive_Count); + procedure Set_Col (To : in Positive_Count); - procedure Set_Line (Win : in Window; To : in Positive_Count); - procedure Set_Line (To : in Positive_Count); + procedure Set_Line (Win : in Window; To : in Positive_Count); + procedure Set_Line (To : in Positive_Count); - function Col (Win : in Window) return Positive_Count; - function Col return Positive_Count; + function Col (Win : in Window) return Positive_Count; + function Col return Positive_Count; - function Line (Win : in Window) return Positive_Count; - function Line return Positive_Count; + function Line (Win : in Window) return Positive_Count; + function Line return Positive_Count; ----------------------- -- Characters-Output -- ----------------------- - procedure Put (Win : in Window; Item : in Character); - procedure Put (Item : in Character); + procedure Put (Win : in Window; Item : in Character); + procedure Put (Item : in Character); -------------------- -- Strings-Output -- -------------------- - procedure Put (Win : in Window; Item : in String); - procedure Put (Item : in String); + procedure Put (Win : in Window; Item : in String); + procedure Put (Item : in String); - procedure Put_Line - (Win : in Window; - Item : in String); + procedure Put_Line + (Win : in Window; + Item : in String); - procedure Put_Line - (Item : in String); + procedure Put_Line + (Item : in String); -- Exceptions - Status_Error : exception renames Ada.IO_Exceptions.Status_Error; - Mode_Error : exception renames Ada.IO_Exceptions.Mode_Error; - Name_Error : exception renames Ada.IO_Exceptions.Name_Error; - Use_Error : exception renames Ada.IO_Exceptions.Use_Error; - Device_Error : exception renames Ada.IO_Exceptions.Device_Error; - End_Error : exception renames Ada.IO_Exceptions.End_Error; - Data_Error : exception renames Ada.IO_Exceptions.Data_Error; - Layout_Error : exception renames Ada.IO_Exceptions.Layout_Error; + Status_Error : exception renames Ada.IO_Exceptions.Status_Error; + Mode_Error : exception renames Ada.IO_Exceptions.Mode_Error; + Name_Error : exception renames Ada.IO_Exceptions.Name_Error; + Use_Error : exception renames Ada.IO_Exceptions.Use_Error; + Device_Error : exception renames Ada.IO_Exceptions.Device_Error; + End_Error : exception renames Ada.IO_Exceptions.End_Error; + Data_Error : exception renames Ada.IO_Exceptions.Data_Error; + Layout_Error : exception renames Ada.IO_Exceptions.Layout_Error; -end Terminal_Interface.Curses.Text_IO; +end Terminal_Interface.Curses.Text_IO; diff --git a/doc/html/ada/terminal_interface-curses-trace__adb.htm b/doc/html/ada/terminal_interface-curses-trace__adb.htm index cbba24a0..04dae6b9 100644 --- a/doc/html/ada/terminal_interface-curses-trace__adb.htm +++ b/doc/html/ada/terminal_interface-curses-trace__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-trace.adb

    File : terminal_interface-curses-trace.adb


    @@ -11,7 +12,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 2000 Free Software Foundation, Inc. -- +-- Copyright (c) 2000,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -39,21 +40,21 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.4 @ +-- @Revision: 1.5 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -package body Terminal_Interface.Curses.Trace is +package body Terminal_Interface.Curses.Trace is - procedure Trace_On (x : Trace_Attribute_Set) is + procedure Trace_On (x : Trace_Attribute_Set) is begin null; - end Trace_On; + end Trace_On; - procedure Trace_Put (str : String) is + procedure Trace_Put (str : String) is begin null; - end Trace_Put; + end Trace_Put; -end Terminal_Interface.Curses.Trace; +end Terminal_Interface.Curses.Trace; diff --git a/doc/html/ada/terminal_interface-curses-trace__ads.htm b/doc/html/ada/terminal_interface-curses-trace__ads.htm index e741efd4..936924c0 100644 --- a/doc/html/ada/terminal_interface-curses-trace__ads.htm +++ b/doc/html/ada/terminal_interface-curses-trace__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses-trace.ads

    File : terminal_interface-curses-trace.ads


    @@ -50,20 +51,19 @@ pragma Warnings (Off); type Trace_Attribute_Set is record - Times : Boolean; - Tputs : Boolean; - Update : Boolean; - Cursor_Move : Boolean; - Character_Output : Boolean; - Calls : Boolean; - Virtual_Puts : Boolean; - Input_Events : Boolean; - TTY_State : Boolean; - Internal_Calls : Boolean; - Character_Calls : Boolean; + Times : Boolean; + Tputs : Boolean; + Update : Boolean; + Cursor_Move : Boolean; + Character_Output : Boolean; + Calls : Boolean; + Virtual_Puts : Boolean; + Input_Events : Boolean; + TTY_State : Boolean; + Internal_Calls : Boolean; + Character_Calls : Boolean; Termcap_TermInfo : Boolean; - end record; - pragma Pack (Trace_Attribute_Set); + end record; pragma Convention (C, Trace_Attribute_Set); for Trace_Attribute_Set use @@ -95,7 +95,7 @@ Update => True, Cursor_Move => True, Character_Output => True, - others => False); + others => False); Trace_Maximum : constant Trace_Attribute_Set := (others => True); ------------------------------------------------------------------------------ @@ -116,4 +116,4 @@ pragma Import (C, Current_Trace_Setting, "_nc_tracing"); end Terminal_Interface.Curses.Trace; - \ No newline at end of file + diff --git a/doc/html/ada/terminal_interface-curses__adb.htm b/doc/html/ada/terminal_interface-curses__adb.htm index c3080358..5081cf62 100644 --- a/doc/html/ada/terminal_interface-curses__adb.htm +++ b/doc/html/ada/terminal_interface-curses__adb.htm @@ -1,3 +1,4 @@ + terminal_interface-curses.adb

    File : terminal_interface-curses.adb


    @@ -11,7 +12,7 @@ -- B O D Y -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -39,2527 +40,2534 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.29 @ +-- @Revision: 1.32 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ with System; -with Terminal_Interface.Curses.Aux; -with Interfaces.C; use Interfaces.C; -with Interfaces.C.Strings; use Interfaces.C.Strings; -with Interfaces.C.Pointers; +with Terminal_Interface.Curses.Aux; +with Interfaces.C; use Interfaces.C; +with Interfaces.C.Strings; use Interfaces.C.Strings; +with Interfaces.C.Pointers; with Ada.Characters.Handling; use Ada.Characters.Handling; with Ada.Strings.Fixed; with Ada.Unchecked_Conversion; -package body Terminal_Interface.Curses is +package body Terminal_Interface.Curses is - use Aux; + use Aux; use type System.Bit_Order; - package ASF renames Ada.Strings.Fixed; + package ASF renames Ada.Strings.Fixed; - type chtype_array is array (size_t range <>) - of aliased Attributed_Character; - pragma Convention (C, chtype_array); + type chtype_array is array (size_t range <>) + of aliased Attributed_Character; + pragma Convention (C, chtype_array); ------------------------------------------------------------------------------ generic - type Element is (<>); - function W_Get_Element (Win : in Window; - Offset : in Natural) return Element; + type Element is (<>); + function W_Get_Element (Win : in Window; + Offset : in Natural) return Element; - function W_Get_Element (Win : in Window; - Offset : in Natural) return Element is - type E_Array is array (Natural range <>) of aliased Element; - package C_E_Array is new - Interfaces.C.Pointers (Natural, Element, E_Array, Element'Val (0)); - use C_E_Array; + function W_Get_Element (Win : in Window; + Offset : in Natural) return Element is + type E_Array is array (Natural range <>) of aliased Element; + package C_E_Array is new + Interfaces.C.Pointers (Natural, Element, E_Array, Element'Val (0)); + use C_E_Array; - function To_Pointer is new - Ada.Unchecked_Conversion (Window, Pointer); + function To_Pointer is new + Ada.Unchecked_Conversion (Window, Pointer); - P : Pointer := To_Pointer (Win); + P : Pointer := To_Pointer (Win); begin - if Win = Null_Window then - raise Curses_Exception; + if Win = Null_Window then + raise Curses_Exception; else - P := P + ptrdiff_t (Offset); - return P.all; + P := P + ptrdiff_t (Offset); + return P.all; end if; end W_Get_Element; - function W_Get_Int is new W_Get_Element (C_Int); - function W_Get_Short is new W_Get_Element (C_Short); - function W_Get_Byte is new W_Get_Element (Interfaces.C.unsigned_char); + function W_Get_Int is new W_Get_Element (C_Int); + function W_Get_Short is new W_Get_Element (C_Short); + function W_Get_Byte is new W_Get_Element (Interfaces.C.unsigned_char); - function Get_Flag (Win : Window; - Offset : Natural) return Boolean; + function Get_Flag (Win : Window; + Offset : Natural) return Boolean; - function Get_Flag (Win : Window; - Offset : Natural) return Boolean + function Get_Flag (Win : Window; + Offset : Natural) return Boolean is - Res : C_Int; + Res : C_Int; begin - case Sizeof_bool is - when 1 => Res := C_Int (W_Get_Byte (Win, Offset)); - when 2 => Res := C_Int (W_Get_Short (Win, Offset)); - when 4 => Res := C_Int (W_Get_Int (Win, Offset)); - when others => raise Curses_Exception; + case Sizeof_bool is + when 1 => Res := C_Int (W_Get_Byte (Win, Offset)); + when 2 => Res := C_Int (W_Get_Short (Win, Offset)); + when 4 => Res := C_Int (W_Get_Int (Win, Offset)); + when others => raise Curses_Exception; end case; - case Res is + case Res is when 0 => return False; when others => return True; end case; - end Get_Flag; + end Get_Flag; ------------------------------------------------------------------------------ - function Key_Name (Key : in Real_Key_Code) return String + function Key_Name (Key : in Real_Key_Code) return String is - function Keyname (K : C_Int) return chars_ptr; - pragma Import (C, Keyname, "keyname"); + function Keyname (K : C_Int) return chars_ptr; + pragma Import (C, Keyname, "keyname"); - Ch : Character; + Ch : Character; begin - if Key <= Character'Pos (Character'Last) then - Ch := Character'Val (Key); - if Is_Control (Ch) then - return Un_Control (Attributed_Character'(Ch => Ch, - Color => Color_Pair'First, - Attr => Normal_Video)); - elsif Is_Graphic (Ch) then + if Key <= Character'Pos (Character'Last) then + Ch := Character'Val (Key); + if Is_Control (Ch) then + return Un_Control (Attributed_Character'(Ch => Ch, + Color => Color_Pair'First, + Attr => Normal_Video)); + elsif Is_Graphic (Ch) then declare - S : String (1 .. 1); + S : String (1 .. 1); begin - S (1) := Ch; - return S; + S (1) := Ch; + return S; end; else return ""; end if; else - return Fill_String (Keyname (C_Int (Key))); + return Fill_String (Keyname (C_Int (Key))); end if; - end Key_Name; + end Key_Name; - procedure Key_Name (Key : in Real_Key_Code; - Name : out String) + procedure Key_Name (Key : in Real_Key_Code; + Name : out String) is begin - ASF.Move (Key_Name (Key), Name); - end Key_Name; + ASF.Move (Key_Name (Key), Name); + end Key_Name; ------------------------------------------------------------------------------ - procedure Init_Screen + procedure Init_Screen is - function Initscr return Window; - pragma Import (C, Initscr, "initscr"); + function Initscr return Window; + pragma Import (C, Initscr, "initscr"); - W : Window; + W : Window; begin - W := Initscr; - if W = Null_Window then - raise Curses_Exception; + W := Initscr; + if W = Null_Window then + raise Curses_Exception; end if; - end Init_Screen; + end Init_Screen; - procedure End_Windows + procedure End_Windows is - function Endwin return C_Int; - pragma Import (C, Endwin, "endwin"); + function Endwin return C_Int; + pragma Import (C, Endwin, "endwin"); begin - if Endwin = Curses_Err then - raise Curses_Exception; + if Endwin = Curses_Err then + raise Curses_Exception; end if; - end End_Windows; + end End_Windows; - function Is_End_Window return Boolean + function Is_End_Window return Boolean is - function Isendwin return Curses_Bool; - pragma Import (C, Isendwin, "isendwin"); + function Isendwin return Curses_Bool; + pragma Import (C, Isendwin, "isendwin"); begin - if Isendwin = Curses_Bool_False then + if Isendwin = Curses_Bool_False then return False; else return True; end if; - end Is_End_Window; + end Is_End_Window; ------------------------------------------------------------------------------ - procedure Move_Cursor (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position) + procedure Move_Cursor (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position) is - function Wmove (Win : Window; - Line : C_Int; - Column : C_Int - ) return C_Int; - pragma Import (C, Wmove, "wmove"); + function Wmove (Win : Window; + Line : C_Int; + Column : C_Int + ) return C_Int; + pragma Import (C, Wmove, "wmove"); begin - if Wmove (Win, C_Int (Line), C_Int (Column)) = Curses_Err then - raise Curses_Exception; + if Wmove (Win, C_Int (Line), C_Int (Column)) = Curses_Err then + raise Curses_Exception; end if; - end Move_Cursor; + end Move_Cursor; ------------------------------------------------------------------------------ - procedure Add (Win : in Window := Standard_Window; - Ch : in Attributed_Character) + procedure Add (Win : in Window := Standard_Window; + Ch : in Attributed_Character) is - function Waddch (W : Window; - Ch : C_Chtype) return C_Int; - pragma Import (C, Waddch, "waddch"); + function Waddch (W : Window; + Ch : C_Chtype) return C_Int; + pragma Import (C, Waddch, "waddch"); begin - if Waddch (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then - raise Curses_Exception; + if Waddch (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then + raise Curses_Exception; end if; - end Add; + end Add; - procedure Add (Win : in Window := Standard_Window; - Ch : in Character) + procedure Add (Win : in Window := Standard_Window; + Ch : in Character) is begin - Add (Win, - Attributed_Character'(Ch => Ch, - Color => Color_Pair'First, - Attr => Normal_Video)); - end Add; + Add (Win, + Attributed_Character'(Ch => Ch, + Color => Color_Pair'First, + Attr => Normal_Video)); + end Add; - procedure Add - (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Ch : in Attributed_Character) + procedure Add + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Ch : in Attributed_Character) is - function mvwaddch (W : Window; - Y : C_Int; - X : C_Int; - Ch : C_Chtype) return C_Int; - pragma Import (C, mvwaddch, "mvwaddch"); + function mvwaddch (W : Window; + Y : C_Int; + X : C_Int; + Ch : C_Chtype) return C_Int; + pragma Import (C, mvwaddch, "mvwaddch"); begin - if mvwaddch (Win, C_Int (Line), - C_Int (Column), - AttrChar_To_Chtype (Ch)) = Curses_Err then - raise Curses_Exception; + if mvwaddch (Win, C_Int (Line), + C_Int (Column), + AttrChar_To_Chtype (Ch)) = Curses_Err then + raise Curses_Exception; end if; - end Add; + end Add; - procedure Add - (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Ch : in Character) + procedure Add + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Ch : in Character) is begin - Add (Win, - Line, - Column, - Attributed_Character'(Ch => Ch, - Color => Color_Pair'First, - Attr => Normal_Video)); - end Add; + Add (Win, + Line, + Column, + Attributed_Character'(Ch => Ch, + Color => Color_Pair'First, + Attr => Normal_Video)); + end Add; - procedure Add_With_Immediate_Echo - (Win : in Window := Standard_Window; - Ch : in Attributed_Character) + procedure Add_With_Immediate_Echo + (Win : in Window := Standard_Window; + Ch : in Attributed_Character) is - function Wechochar (W : Window; - Ch : C_Chtype) return C_Int; - pragma Import (C, Wechochar, "wechochar"); + function Wechochar (W : Window; + Ch : C_Chtype) return C_Int; + pragma Import (C, Wechochar, "wechochar"); begin - if Wechochar (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then - raise Curses_Exception; + if Wechochar (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then + raise Curses_Exception; end if; - end Add_With_Immediate_Echo; + end Add_With_Immediate_Echo; - procedure Add_With_Immediate_Echo - (Win : in Window := Standard_Window; - Ch : in Character) + procedure Add_With_Immediate_Echo + (Win : in Window := Standard_Window; + Ch : in Character) is begin - Add_With_Immediate_Echo - (Win, - Attributed_Character'(Ch => Ch, - Color => Color_Pair'First, - Attr => Normal_Video)); - end Add_With_Immediate_Echo; + Add_With_Immediate_Echo + (Win, + Attributed_Character'(Ch => Ch, + Color => Color_Pair'First, + Attr => Normal_Video)); + end Add_With_Immediate_Echo; ------------------------------------------------------------------------------ - function Create (Number_Of_Lines : Line_Count; - Number_Of_Columns : Column_Count; - First_Line_Position : Line_Position; - First_Column_Position : Column_Position) return Window - is - function Newwin (Number_Of_Lines : C_Int; - Number_Of_Columns : C_Int; - First_Line_Position : C_Int; - First_Column_Position : C_Int) return Window; - pragma Import (C, Newwin, "newwin"); - - W : Window; - begin - W := Newwin (C_Int (Number_Of_Lines), - C_Int (Number_Of_Columns), - C_Int (First_Line_Position), - C_Int (First_Column_Position)); - if W = Null_Window then - raise Curses_Exception; - end if; - return W; - end Create; - - procedure Delete (Win : in out Window) - is - function Wdelwin (W : Window) return C_Int; - pragma Import (C, Wdelwin, "delwin"); - begin - if Wdelwin (Win) = Curses_Err then - raise Curses_Exception; + function Create (Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window + is + function Newwin (Number_Of_Lines : C_Int; + Number_Of_Columns : C_Int; + First_Line_Position : C_Int; + First_Column_Position : C_Int) return Window; + pragma Import (C, Newwin, "newwin"); + + W : Window; + begin + W := Newwin (C_Int (Number_Of_Lines), + C_Int (Number_Of_Columns), + C_Int (First_Line_Position), + C_Int (First_Column_Position)); + if W = Null_Window then + raise Curses_Exception; + end if; + return W; + end Create; + + procedure Delete (Win : in out Window) + is + function Wdelwin (W : Window) return C_Int; + pragma Import (C, Wdelwin, "delwin"); + begin + if Wdelwin (Win) = Curses_Err then + raise Curses_Exception; end if; - Win := Null_Window; - end Delete; + Win := Null_Window; + end Delete; - function Sub_Window - (Win : Window := Standard_Window; - Number_Of_Lines : Line_Count; - Number_Of_Columns : Column_Count; - First_Line_Position : Line_Position; - First_Column_Position : Column_Position) return Window + function Sub_Window + (Win : Window := Standard_Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window is - function Subwin - (Win : Window; - Number_Of_Lines : C_Int; - Number_Of_Columns : C_Int; - First_Line_Position : C_Int; - First_Column_Position : C_Int) return Window; - pragma Import (C, Subwin, "subwin"); + function Subwin + (Win : Window; + Number_Of_Lines : C_Int; + Number_Of_Columns : C_Int; + First_Line_Position : C_Int; + First_Column_Position : C_Int) return Window; + pragma Import (C, Subwin, "subwin"); - W : Window; + W : Window; begin - W := Subwin (Win, - C_Int (Number_Of_Lines), - C_Int (Number_Of_Columns), - C_Int (First_Line_Position), - C_Int (First_Column_Position)); - if W = Null_Window then - raise Curses_Exception; + W := Subwin (Win, + C_Int (Number_Of_Lines), + C_Int (Number_Of_Columns), + C_Int (First_Line_Position), + C_Int (First_Column_Position)); + if W = Null_Window then + raise Curses_Exception; end if; - return W; - end Sub_Window; + return W; + end Sub_Window; - function Derived_Window - (Win : Window := Standard_Window; - Number_Of_Lines : Line_Count; - Number_Of_Columns : Column_Count; - First_Line_Position : Line_Position; - First_Column_Position : Column_Position) return Window + function Derived_Window + (Win : Window := Standard_Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window is - function Derwin - (Win : Window; - Number_Of_Lines : C_Int; - Number_Of_Columns : C_Int; - First_Line_Position : C_Int; - First_Column_Position : C_Int) return Window; - pragma Import (C, Derwin, "derwin"); + function Derwin + (Win : Window; + Number_Of_Lines : C_Int; + Number_Of_Columns : C_Int; + First_Line_Position : C_Int; + First_Column_Position : C_Int) return Window; + pragma Import (C, Derwin, "derwin"); - W : Window; + W : Window; begin - W := Derwin (Win, - C_Int (Number_Of_Lines), - C_Int (Number_Of_Columns), - C_Int (First_Line_Position), - C_Int (First_Column_Position)); - if W = Null_Window then - raise Curses_Exception; + W := Derwin (Win, + C_Int (Number_Of_Lines), + C_Int (Number_Of_Columns), + C_Int (First_Line_Position), + C_Int (First_Column_Position)); + if W = Null_Window then + raise Curses_Exception; end if; - return W; - end Derived_Window; + return W; + end Derived_Window; - function Duplicate (Win : Window) return Window + function Duplicate (Win : Window) return Window is - function Dupwin (Win : Window) return Window; - pragma Import (C, Dupwin, "dupwin"); + function Dupwin (Win : Window) return Window; + pragma Import (C, Dupwin, "dupwin"); - W : Window := Dupwin (Win); + W : constant Window := Dupwin (Win); begin - if W = Null_Window then - raise Curses_Exception; + if W = Null_Window then + raise Curses_Exception; end if; - return W; - end Duplicate; + return W; + end Duplicate; - procedure Move_Window (Win : in Window; - Line : in Line_Position; - Column : in Column_Position) + procedure Move_Window (Win : in Window; + Line : in Line_Position; + Column : in Column_Position) is - function Mvwin (Win : Window; - Line : C_Int; - Column : C_Int) return C_Int; - pragma Import (C, Mvwin, "mvwin"); + function Mvwin (Win : Window; + Line : C_Int; + Column : C_Int) return C_Int; + pragma Import (C, Mvwin, "mvwin"); begin - if Mvwin (Win, C_Int (Line), C_Int (Column)) = Curses_Err then - raise Curses_Exception; + if Mvwin (Win, C_Int (Line), C_Int (Column)) = Curses_Err then + raise Curses_Exception; end if; - end Move_Window; + end Move_Window; - procedure Move_Derived_Window (Win : in Window; - Line : in Line_Position; - Column : in Column_Position) + procedure Move_Derived_Window (Win : in Window; + Line : in Line_Position; + Column : in Column_Position) is - function Mvderwin (Win : Window; - Line : C_Int; - Column : C_Int) return C_Int; - pragma Import (C, Mvderwin, "mvderwin"); + function Mvderwin (Win : Window; + Line : C_Int; + Column : C_Int) return C_Int; + pragma Import (C, Mvderwin, "mvderwin"); begin - if Mvderwin (Win, C_Int (Line), C_Int (Column)) = Curses_Err then - raise Curses_Exception; + if Mvderwin (Win, C_Int (Line), C_Int (Column)) = Curses_Err then + raise Curses_Exception; end if; - end Move_Derived_Window; + end Move_Derived_Window; - procedure Set_Synch_Mode (Win : in Window := Standard_Window; - Mode : in Boolean := False) + procedure Set_Synch_Mode (Win : in Window := Standard_Window; + Mode : in Boolean := False) is - function Syncok (Win : Window; - Mode : Curses_Bool) return C_Int; - pragma Import (C, Syncok, "syncok"); + function Syncok (Win : Window; + Mode : Curses_Bool) return C_Int; + pragma Import (C, Syncok, "syncok"); begin - if Syncok (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then - raise Curses_Exception; + if Syncok (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then + raise Curses_Exception; end if; - end Set_Synch_Mode; + end Set_Synch_Mode; ------------------------------------------------------------------------------ - procedure Add (Win : in Window := Standard_Window; - Str : in String; - Len : in Integer := -1) + procedure Add (Win : in Window := Standard_Window; + Str : in String; + Len : in Integer := -1) is - function Waddnstr (Win : Window; - Str : char_array; - Len : C_Int := -1) return C_Int; - pragma Import (C, Waddnstr, "waddnstr"); + function Waddnstr (Win : Window; + Str : char_array; + Len : C_Int := -1) return C_Int; + pragma Import (C, Waddnstr, "waddnstr"); - Txt : char_array (0 .. Str'Length); - Length : size_t; + Txt : char_array (0 .. Str'Length); + Length : size_t; begin - To_C (Str, Txt, Length); - if Waddnstr (Win, Txt, C_Int (Len)) = Curses_Err then - raise Curses_Exception; + To_C (Str, Txt, Length); + if Waddnstr (Win, Txt, C_Int (Len)) = Curses_Err then + raise Curses_Exception; end if; - end Add; + end Add; - procedure Add - (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Str : in String; - Len : in Integer := -1) + procedure Add + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : in String; + Len : in Integer := -1) is begin - Move_Cursor (Win, Line, Column); - Add (Win, Str, Len); - end Add; + Move_Cursor (Win, Line, Column); + Add (Win, Str, Len); + end Add; ------------------------------------------------------------------------------ - procedure Add - (Win : in Window := Standard_Window; - Str : in Attributed_String; - Len : in Integer := -1) + procedure Add + (Win : in Window := Standard_Window; + Str : in Attributed_String; + Len : in Integer := -1) is - function Waddchnstr (Win : Window; - Str : chtype_array; - Len : C_Int := -1) return C_Int; - pragma Import (C, Waddchnstr, "waddchnstr"); + function Waddchnstr (Win : Window; + Str : chtype_array; + Len : C_Int := -1) return C_Int; + pragma Import (C, Waddchnstr, "waddchnstr"); - Txt : chtype_array (0 .. Str'Length); + Txt : chtype_array (0 .. Str'Length); begin - for Length in 1 .. size_t (Str'Length) loop - Txt (Length - 1) := Str (Natural (Length)); + for Length in 1 .. size_t (Str'Length) loop + Txt (Length - 1) := Str (Natural (Length)); end loop; - Txt (Str'Length) := Default_Character; - if Waddchnstr (Win, - Txt, - C_Int (Len)) = Curses_Err then - raise Curses_Exception; + Txt (Str'Length) := Default_Character; + if Waddchnstr (Win, + Txt, + C_Int (Len)) = Curses_Err then + raise Curses_Exception; end if; - end Add; + end Add; - procedure Add - (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Str : in Attributed_String; - Len : in Integer := -1) + procedure Add + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : in Attributed_String; + Len : in Integer := -1) is begin - Move_Cursor (Win, Line, Column); - Add (Win, Str, Len); - end Add; + Move_Cursor (Win, Line, Column); + Add (Win, Str, Len); + end Add; ------------------------------------------------------------------------------ - procedure Border - (Win : in Window := Standard_Window; - Left_Side_Symbol : in Attributed_Character := Default_Character; - Right_Side_Symbol : in Attributed_Character := Default_Character; - Top_Side_Symbol : in Attributed_Character := Default_Character; - Bottom_Side_Symbol : in Attributed_Character := Default_Character; - Upper_Left_Corner_Symbol : in Attributed_Character := Default_Character; - Upper_Right_Corner_Symbol : in Attributed_Character := Default_Character; - Lower_Left_Corner_Symbol : in Attributed_Character := Default_Character; - Lower_Right_Corner_Symbol : in Attributed_Character := Default_Character) - is - function Wborder (W : Window; - LS : C_Chtype; - RS : C_Chtype; - TS : C_Chtype; - BS : C_Chtype; - ULC : C_Chtype; - URC : C_Chtype; - LLC : C_Chtype; - LRC : C_Chtype) return C_Int; - pragma Import (C, Wborder, "wborder"); - begin - if Wborder (Win, - AttrChar_To_Chtype (Left_Side_Symbol), - AttrChar_To_Chtype (Right_Side_Symbol), - AttrChar_To_Chtype (Top_Side_Symbol), - AttrChar_To_Chtype (Bottom_Side_Symbol), - AttrChar_To_Chtype (Upper_Left_Corner_Symbol), - AttrChar_To_Chtype (Upper_Right_Corner_Symbol), - AttrChar_To_Chtype (Lower_Left_Corner_Symbol), - AttrChar_To_Chtype (Lower_Right_Corner_Symbol) - ) = Curses_Err + procedure Border + (Win : in Window := Standard_Window; + Left_Side_Symbol : in Attributed_Character := Default_Character; + Right_Side_Symbol : in Attributed_Character := Default_Character; + Top_Side_Symbol : in Attributed_Character := Default_Character; + Bottom_Side_Symbol : in Attributed_Character := Default_Character; + Upper_Left_Corner_Symbol : in Attributed_Character := Default_Character; + Upper_Right_Corner_Symbol : in Attributed_Character := Default_Character; + Lower_Left_Corner_Symbol : in Attributed_Character := Default_Character; + Lower_Right_Corner_Symbol : in Attributed_Character := Default_Character) + is + function Wborder (W : Window; + LS : C_Chtype; + RS : C_Chtype; + TS : C_Chtype; + BS : C_Chtype; + ULC : C_Chtype; + URC : C_Chtype; + LLC : C_Chtype; + LRC : C_Chtype) return C_Int; + pragma Import (C, Wborder, "wborder"); + begin + if Wborder (Win, + AttrChar_To_Chtype (Left_Side_Symbol), + AttrChar_To_Chtype (Right_Side_Symbol), + AttrChar_To_Chtype (Top_Side_Symbol), + AttrChar_To_Chtype (Bottom_Side_Symbol), + AttrChar_To_Chtype (Upper_Left_Corner_Symbol), + AttrChar_To_Chtype (Upper_Right_Corner_Symbol), + AttrChar_To_Chtype (Lower_Left_Corner_Symbol), + AttrChar_To_Chtype (Lower_Right_Corner_Symbol) + ) = Curses_Err then - raise Curses_Exception; + raise Curses_Exception; end if; - end Border; + end Border; - procedure Box - (Win : in Window := Standard_Window; - Vertical_Symbol : in Attributed_Character := Default_Character; - Horizontal_Symbol : in Attributed_Character := Default_Character) + procedure Box + (Win : in Window := Standard_Window; + Vertical_Symbol : in Attributed_Character := Default_Character; + Horizontal_Symbol : in Attributed_Character := Default_Character) is begin - Border (Win, - Vertical_Symbol, Vertical_Symbol, - Horizontal_Symbol, Horizontal_Symbol); - end Box; + Border (Win, + Vertical_Symbol, Vertical_Symbol, + Horizontal_Symbol, Horizontal_Symbol); + end Box; - procedure Horizontal_Line - (Win : in Window := Standard_Window; - Line_Size : in Natural; - Line_Symbol : in Attributed_Character := Default_Character) + procedure Horizontal_Line + (Win : in Window := Standard_Window; + Line_Size : in Natural; + Line_Symbol : in Attributed_Character := Default_Character) is - function Whline (W : Window; - Ch : C_Chtype; - Len : C_Int) return C_Int; - pragma Import (C, Whline, "whline"); + function Whline (W : Window; + Ch : C_Chtype; + Len : C_Int) return C_Int; + pragma Import (C, Whline, "whline"); begin - if Whline (Win, - AttrChar_To_Chtype (Line_Symbol), - C_Int (Line_Size)) = Curses_Err then - raise Curses_Exception; + if Whline (Win, + AttrChar_To_Chtype (Line_Symbol), + C_Int (Line_Size)) = Curses_Err then + raise Curses_Exception; end if; - end Horizontal_Line; + end Horizontal_Line; - procedure Vertical_Line - (Win : in Window := Standard_Window; - Line_Size : in Natural; - Line_Symbol : in Attributed_Character := Default_Character) + procedure Vertical_Line + (Win : in Window := Standard_Window; + Line_Size : in Natural; + Line_Symbol : in Attributed_Character := Default_Character) is - function Wvline (W : Window; - Ch : C_Chtype; - Len : C_Int) return C_Int; - pragma Import (C, Wvline, "wvline"); + function Wvline (W : Window; + Ch : C_Chtype; + Len : C_Int) return C_Int; + pragma Import (C, Wvline, "wvline"); begin - if Wvline (Win, - AttrChar_To_Chtype (Line_Symbol), - C_Int (Line_Size)) = Curses_Err then - raise Curses_Exception; + if Wvline (Win, + AttrChar_To_Chtype (Line_Symbol), + C_Int (Line_Size)) = Curses_Err then + raise Curses_Exception; end if; - end Vertical_Line; + end Vertical_Line; ------------------------------------------------------------------------------ - function Get_Keystroke (Win : Window := Standard_Window) - return Real_Key_Code + function Get_Keystroke (Win : Window := Standard_Window) + return Real_Key_Code is - function Wgetch (W : Window) return C_Int; - pragma Import (C, Wgetch, "wgetch"); + function Wgetch (W : Window) return C_Int; + pragma Import (C, Wgetch, "wgetch"); - C : constant C_Int := Wgetch (Win); + C : constant C_Int := Wgetch (Win); begin - if C = Curses_Err then - return Key_None; + if C = Curses_Err then + return Key_None; else - return Real_Key_Code (C); + return Real_Key_Code (C); end if; - end Get_Keystroke; + end Get_Keystroke; - procedure Undo_Keystroke (Key : in Real_Key_Code) + procedure Undo_Keystroke (Key : in Real_Key_Code) is - function Ungetch (Ch : C_Int) return C_Int; - pragma Import (C, Ungetch, "ungetch"); + function Ungetch (Ch : C_Int) return C_Int; + pragma Import (C, Ungetch, "ungetch"); begin - if Ungetch (C_Int (Key)) = Curses_Err then - raise Curses_Exception; + if Ungetch (C_Int (Key)) = Curses_Err then + raise Curses_Exception; end if; - end Undo_Keystroke; + end Undo_Keystroke; - function Has_Key (Key : Special_Key_Code) return Boolean + function Has_Key (Key : Special_Key_Code) return Boolean is - function Haskey (Key : C_Int) return C_Int; - pragma Import (C, Haskey, "has_key"); + function Haskey (Key : C_Int) return C_Int; + pragma Import (C, Haskey, "has_key"); begin - if Haskey (C_Int (Key)) = Curses_False then + if Haskey (C_Int (Key)) = Curses_False then return False; else return True; end if; - end Has_Key; + end Has_Key; - function Is_Function_Key (Key : Special_Key_Code) return Boolean + function Is_Function_Key (Key : Special_Key_Code) return Boolean is - L : constant Special_Key_Code := Special_Key_Code (Natural (Key_F0) + - Natural (Function_Key_Number'Last)); + L : constant Special_Key_Code := Special_Key_Code (Natural (Key_F0) + + Natural (Function_Key_Number'Last)); begin - if (Key >= Key_F0) and then (Key <= L) then + if (Key >= Key_F0) and then (Key <= L) then return True; else return False; end if; - end Is_Function_Key; + end Is_Function_Key; - function Function_Key (Key : Real_Key_Code) - return Function_Key_Number + function Function_Key (Key : Real_Key_Code) + return Function_Key_Number is begin - if Is_Function_Key (Key) then - return Function_Key_Number (Key - Key_F0); + if Is_Function_Key (Key) then + return Function_Key_Number (Key - Key_F0); else raise Constraint_Error; end if; - end Function_Key; + end Function_Key; - function Function_Key_Code (Key : Function_Key_Number) return Real_Key_Code + function Function_Key_Code (Key : Function_Key_Number) return Real_Key_Code is begin - return Real_Key_Code (Natural (Key_F0) + Natural (Key)); - end Function_Key_Code; + return Real_Key_Code (Natural (Key_F0) + Natural (Key)); + end Function_Key_Code; ------------------------------------------------------------------------------ - procedure Standout (Win : Window := Standard_Window; - On : Boolean := True) + procedure Standout (Win : Window := Standard_Window; + On : Boolean := True) is - function wstandout (Win : Window) return C_Int; - pragma Import (C, wstandout, "wstandout"); - function wstandend (Win : Window) return C_Int; - pragma Import (C, wstandend, "wstandend"); + function wstandout (Win : Window) return C_Int; + pragma Import (C, wstandout, "wstandout"); + function wstandend (Win : Window) return C_Int; + pragma Import (C, wstandend, "wstandend"); - Err : C_Int; + Err : C_Int; begin - if On then - Err := wstandout (Win); + if On then + Err := wstandout (Win); else - Err := wstandend (Win); + Err := wstandend (Win); end if; - if Err = Curses_Err then - raise Curses_Exception; + if Err = Curses_Err then + raise Curses_Exception; end if; - end Standout; + end Standout; - procedure Switch_Character_Attribute - (Win : in Window := Standard_Window; - Attr : in Character_Attribute_Set := Normal_Video; - On : in Boolean := True) + procedure Switch_Character_Attribute + (Win : in Window := Standard_Window; + Attr : in Character_Attribute_Set := Normal_Video; + On : in Boolean := True) is - function Wattron (Win : Window; - C_Attr : C_AttrType) return C_Int; - pragma Import (C, Wattron, "wattr_on"); - function Wattroff (Win : Window; - C_Attr : C_AttrType) return C_Int; - pragma Import (C, Wattroff, "wattr_off"); + function Wattron (Win : Window; + C_Attr : C_AttrType) return C_Int; + pragma Import (C, Wattron, "wattr_on"); + function Wattroff (Win : Window; + C_Attr : C_AttrType) return C_Int; + pragma Import (C, Wattroff, "wattr_off"); -- In Ada we use the On Boolean to control whether or not we want to -- switch on or off the attributes in the set. - Err : C_Int; - AC : constant Attributed_Character := (Ch => Character'First, - Color => Color_Pair'First, - Attr => Attr); + Err : C_Int; + AC : constant Attributed_Character := (Ch => Character'First, + Color => Color_Pair'First, + Attr => Attr); begin - if On then - Err := Wattron (Win, AttrChar_To_AttrType (AC)); + if On then + Err := Wattron (Win, AttrChar_To_AttrType (AC)); else - Err := Wattroff (Win, AttrChar_To_AttrType (AC)); + Err := Wattroff (Win, AttrChar_To_AttrType (AC)); end if; - if Err = Curses_Err then - raise Curses_Exception; + if Err = Curses_Err then + raise Curses_Exception; end if; - end Switch_Character_Attribute; + end Switch_Character_Attribute; - procedure Set_Character_Attributes - (Win : in Window := Standard_Window; - Attr : in Character_Attribute_Set := Normal_Video; - Color : in Color_Pair := Color_Pair'First) + procedure Set_Character_Attributes + (Win : in Window := Standard_Window; + Attr : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) is - function Wattrset (Win : Window; - C_Attr : C_AttrType) return C_Int; - pragma Import (C, Wattrset, "wattrset"); -- ??? wattr_set + function Wattrset (Win : Window; + C_Attr : C_AttrType) return C_Int; + pragma Import (C, Wattrset, "wattrset"); -- ??? wattr_set begin - if Wattrset (Win, - AttrChar_To_AttrType (Attributed_Character' + if Wattrset (Win, + AttrChar_To_AttrType (Attributed_Character' (Ch => Character'First, - Color => Color, - Attr => Attr))) = Curses_Err then - raise Curses_Exception; + Color => Color, + Attr => Attr))) = Curses_Err then + raise Curses_Exception; end if; - end Set_Character_Attributes; + end Set_Character_Attributes; - function Get_Character_Attribute (Win : Window := Standard_Window) - return Character_Attribute_Set + function Get_Character_Attribute (Win : Window := Standard_Window) + return Character_Attribute_Set is - function Wattrget (Win : Window; - Atr : access C_AttrType; - Col : access C_Short; - Opt : System.Address) return C_Int; - pragma Import (C, Wattrget, "wattr_get"); + function Wattrget (Win : Window; + Atr : access C_AttrType; + Col : access C_Short; + Opt : System.Address) return C_Int; + pragma Import (C, Wattrget, "wattr_get"); - Attr : aliased C_AttrType; - Col : aliased C_Short; - Res : constant C_Int := Wattrget (Win, Attr'Access, Col'Access, + Attr : aliased C_AttrType; + Col : aliased C_Short; + Res : constant C_Int := Wattrget (Win, Attr'Access, Col'Access, System.Null_Address); - Ch : Attributed_Character; + Ch : Attributed_Character; begin - if Res = Curses_Ok then - Ch := AttrType_To_AttrChar (Attr); - return Ch.Attr; + if Res = Curses_Ok then + Ch := AttrType_To_AttrChar (Attr); + return Ch.Attr; else - raise Curses_Exception; + raise Curses_Exception; end if; - end Get_Character_Attribute; + end Get_Character_Attribute; - function Get_Character_Attribute (Win : Window := Standard_Window) - return Color_Pair + function Get_Character_Attribute (Win : Window := Standard_Window) + return Color_Pair is - function Wattrget (Win : Window; - Atr : access C_AttrType; - Col : access C_Short; - Opt : System.Address) return C_Int; - pragma Import (C, Wattrget, "wattr_get"); + function Wattrget (Win : Window; + Atr : access C_AttrType; + Col : access C_Short; + Opt : System.Address) return C_Int; + pragma Import (C, Wattrget, "wattr_get"); - Attr : aliased C_AttrType; - Col : aliased C_Short; - Res : constant C_Int := Wattrget (Win, Attr'Access, Col'Access, + Attr : aliased C_AttrType; + Col : aliased C_Short; + Res : constant C_Int := Wattrget (Win, Attr'Access, Col'Access, System.Null_Address); - Ch : Attributed_Character; + Ch : Attributed_Character; begin - if Res = Curses_Ok then - Ch := AttrType_To_AttrChar (Attr); - return Ch.Color; + if Res = Curses_Ok then + Ch := AttrType_To_AttrChar (Attr); + return Ch.Color; else - raise Curses_Exception; + raise Curses_Exception; end if; - end Get_Character_Attribute; + end Get_Character_Attribute; - procedure Set_Color (Win : in Window := Standard_Window; - Pair : in Color_Pair) + procedure Set_Color (Win : in Window := Standard_Window; + Pair : in Color_Pair) is - function Wset_Color (Win : Window; - Color : C_Short; - Opts : C_Void_Ptr) return C_Int; - pragma Import (C, Wset_Color, "wcolor_set"); + function Wset_Color (Win : Window; + Color : C_Short; + Opts : C_Void_Ptr) return C_Int; + pragma Import (C, Wset_Color, "wcolor_set"); begin - if Wset_Color (Win, - C_Short (Pair), - C_Void_Ptr (System.Null_Address)) = Curses_Err then - raise Curses_Exception; + if Wset_Color (Win, + C_Short (Pair), + C_Void_Ptr (System.Null_Address)) = Curses_Err then + raise Curses_Exception; end if; - end Set_Color; + end Set_Color; - procedure Change_Attributes - (Win : in Window := Standard_Window; - Count : in Integer := -1; - Attr : in Character_Attribute_Set := Normal_Video; - Color : in Color_Pair := Color_Pair'First) + procedure Change_Attributes + (Win : in Window := Standard_Window; + Count : in Integer := -1; + Attr : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) is - function Wchgat (Win : Window; - Cnt : C_Int; - Attr : C_AttrType; - Color : C_Short; - Opts : System.Address := System.Null_Address) - return C_Int; - pragma Import (C, Wchgat, "wchgat"); + function Wchgat (Win : Window; + Cnt : C_Int; + Attr : C_AttrType; + Color : C_Short; + Opts : System.Address := System.Null_Address) + return C_Int; + pragma Import (C, Wchgat, "wchgat"); - Ch : constant Attributed_Character := - (Ch => Character'First, Color => Color_Pair'First, Attr => Attr); + Ch : constant Attributed_Character := + (Ch => Character'First, Color => Color_Pair'First, Attr => Attr); begin - if Wchgat (Win, C_Int (Count), AttrChar_To_AttrType (Ch), - C_Short (Color)) = Curses_Err then - raise Curses_Exception; + if Wchgat (Win, C_Int (Count), AttrChar_To_AttrType (Ch), + C_Short (Color)) = Curses_Err then + raise Curses_Exception; end if; - end Change_Attributes; + end Change_Attributes; - procedure Change_Attributes - (Win : in Window := Standard_Window; - Line : in Line_Position := Line_Position'First; - Column : in Column_Position := Column_Position'First; - Count : in Integer := -1; - Attr : in Character_Attribute_Set := Normal_Video; - Color : in Color_Pair := Color_Pair'First) + procedure Change_Attributes + (Win : in Window := Standard_Window; + Line : in Line_Position := Line_Position'First; + Column : in Column_Position := Column_Position'First; + Count : in Integer := -1; + Attr : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) is begin - Move_Cursor (Win, Line, Column); - Change_Attributes (Win, Count, Attr, Color); - end Change_Attributes; + Move_Cursor (Win, Line, Column); + Change_Attributes (Win, Count, Attr, Color); + end Change_Attributes; ------------------------------------------------------------------------------ - procedure Beep + procedure Beep is - function Beeper return C_Int; - pragma Import (C, Beeper, "beep"); + function Beeper return C_Int; + pragma Import (C, Beeper, "beep"); begin - if Beeper = Curses_Err then - raise Curses_Exception; + if Beeper = Curses_Err then + raise Curses_Exception; end if; - end Beep; + end Beep; - procedure Flash_Screen + procedure Flash_Screen is - function Flash return C_Int; - pragma Import (C, Flash, "flash"); + function Flash return C_Int; + pragma Import (C, Flash, "flash"); begin - if Flash = Curses_Err then - raise Curses_Exception; + if Flash = Curses_Err then + raise Curses_Exception; end if; - end Flash_Screen; + end Flash_Screen; ------------------------------------------------------------------------------ - procedure Set_Cbreak_Mode (SwitchOn : in Boolean := True) + procedure Set_Cbreak_Mode (SwitchOn : in Boolean := True) is - function Cbreak return C_Int; - pragma Import (C, Cbreak, "cbreak"); - function NoCbreak return C_Int; - pragma Import (C, NoCbreak, "nocbreak"); + function Cbreak return C_Int; + pragma Import (C, Cbreak, "cbreak"); + function NoCbreak return C_Int; + pragma Import (C, NoCbreak, "nocbreak"); - Err : C_Int; + Err : C_Int; begin - if SwitchOn then - Err := Cbreak; + if SwitchOn then + Err := Cbreak; else - Err := NoCbreak; + Err := NoCbreak; end if; - if Err = Curses_Err then - raise Curses_Exception; + if Err = Curses_Err then + raise Curses_Exception; end if; - end Set_Cbreak_Mode; + end Set_Cbreak_Mode; - procedure Set_Raw_Mode (SwitchOn : in Boolean := True) + procedure Set_Raw_Mode (SwitchOn : in Boolean := True) is - function Raw return C_Int; - pragma Import (C, Raw, "raw"); - function NoRaw return C_Int; - pragma Import (C, NoRaw, "noraw"); + function Raw return C_Int; + pragma Import (C, Raw, "raw"); + function NoRaw return C_Int; + pragma Import (C, NoRaw, "noraw"); - Err : C_Int; + Err : C_Int; begin - if SwitchOn then - Err := Raw; + if SwitchOn then + Err := Raw; else - Err := NoRaw; + Err := NoRaw; end if; - if Err = Curses_Err then - raise Curses_Exception; + if Err = Curses_Err then + raise Curses_Exception; end if; - end Set_Raw_Mode; + end Set_Raw_Mode; - procedure Set_Echo_Mode (SwitchOn : in Boolean := True) + procedure Set_Echo_Mode (SwitchOn : in Boolean := True) is - function Echo return C_Int; - pragma Import (C, Echo, "echo"); - function NoEcho return C_Int; - pragma Import (C, NoEcho, "noecho"); + function Echo return C_Int; + pragma Import (C, Echo, "echo"); + function NoEcho return C_Int; + pragma Import (C, NoEcho, "noecho"); - Err : C_Int; + Err : C_Int; begin - if SwitchOn then - Err := Echo; + if SwitchOn then + Err := Echo; else - Err := NoEcho; + Err := NoEcho; end if; - if Err = Curses_Err then - raise Curses_Exception; + if Err = Curses_Err then + raise Curses_Exception; end if; - end Set_Echo_Mode; + end Set_Echo_Mode; - procedure Set_Meta_Mode (Win : in Window := Standard_Window; - SwitchOn : in Boolean := True) + procedure Set_Meta_Mode (Win : in Window := Standard_Window; + SwitchOn : in Boolean := True) is - function Meta (W : Window; Mode : Curses_Bool) return C_Int; - pragma Import (C, Meta, "meta"); + function Meta (W : Window; Mode : Curses_Bool) return C_Int; + pragma Import (C, Meta, "meta"); begin - if Meta (Win, Curses_Bool (Boolean'Pos (SwitchOn))) = Curses_Err then - raise Curses_Exception; + if Meta (Win, Curses_Bool (Boolean'Pos (SwitchOn))) = Curses_Err then + raise Curses_Exception; end if; - end Set_Meta_Mode; + end Set_Meta_Mode; - procedure Set_KeyPad_Mode (Win : in Window := Standard_Window; - SwitchOn : in Boolean := True) + procedure Set_KeyPad_Mode (Win : in Window := Standard_Window; + SwitchOn : in Boolean := True) is - function Keypad (W : Window; Mode : Curses_Bool) return C_Int; - pragma Import (C, Keypad, "keypad"); + function Keypad (W : Window; Mode : Curses_Bool) return C_Int; + pragma Import (C, Keypad, "keypad"); begin - if Keypad (Win, Curses_Bool (Boolean'Pos (SwitchOn))) = Curses_Err then - raise Curses_Exception; + if Keypad (Win, Curses_Bool (Boolean'Pos (SwitchOn))) = Curses_Err then + raise Curses_Exception; end if; - end Set_KeyPad_Mode; + end Set_KeyPad_Mode; - function Get_KeyPad_Mode (Win : in Window := Standard_Window) + function Get_KeyPad_Mode (Win : in Window := Standard_Window) return Boolean is begin - return Get_Flag (Win, Offset_use_keypad); - end Get_KeyPad_Mode; + return Get_Flag (Win, Offset_use_keypad); + end Get_KeyPad_Mode; - procedure Half_Delay (Amount : in Half_Delay_Amount) + procedure Half_Delay (Amount : in Half_Delay_Amount) is - function Halfdelay (Amount : C_Int) return C_Int; - pragma Import (C, Halfdelay, "halfdelay"); + function Halfdelay (Amount : C_Int) return C_Int; + pragma Import (C, Halfdelay, "halfdelay"); begin - if Halfdelay (C_Int (Amount)) = Curses_Err then - raise Curses_Exception; + if Halfdelay (C_Int (Amount)) = Curses_Err then + raise Curses_Exception; end if; - end Half_Delay; + end Half_Delay; - procedure Set_Flush_On_Interrupt_Mode - (Win : in Window := Standard_Window; - Mode : in Boolean := True) + procedure Set_Flush_On_Interrupt_Mode + (Win : in Window := Standard_Window; + Mode : in Boolean := True) is - function Intrflush (Win : Window; Mode : Curses_Bool) return C_Int; - pragma Import (C, Intrflush, "intrflush"); + function Intrflush (Win : Window; Mode : Curses_Bool) return C_Int; + pragma Import (C, Intrflush, "intrflush"); begin - if Intrflush (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then - raise Curses_Exception; + if Intrflush (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then + raise Curses_Exception; end if; - end Set_Flush_On_Interrupt_Mode; + end Set_Flush_On_Interrupt_Mode; - procedure Set_Queue_Interrupt_Mode - (Win : in Window := Standard_Window; - Flush : in Boolean := True) + procedure Set_Queue_Interrupt_Mode + (Win : in Window := Standard_Window; + Flush : in Boolean := True) is - procedure Qiflush; - pragma Import (C, Qiflush, "qiflush"); - procedure No_Qiflush; - pragma Import (C, No_Qiflush, "noqiflush"); + procedure Qiflush; + pragma Import (C, Qiflush, "qiflush"); + procedure No_Qiflush; + pragma Import (C, No_Qiflush, "noqiflush"); begin - if Flush then - Qiflush; + if Win = Null_Window then + raise Curses_Exception; + end if; + if Flush then + Qiflush; else - No_Qiflush; + No_Qiflush; end if; - end Set_Queue_Interrupt_Mode; + end Set_Queue_Interrupt_Mode; - procedure Set_NoDelay_Mode - (Win : in Window := Standard_Window; - Mode : in Boolean := False) + procedure Set_NoDelay_Mode + (Win : in Window := Standard_Window; + Mode : in Boolean := False) is - function Nodelay (Win : Window; Mode : Curses_Bool) return C_Int; - pragma Import (C, Nodelay, "nodelay"); + function Nodelay (Win : Window; Mode : Curses_Bool) return C_Int; + pragma Import (C, Nodelay, "nodelay"); begin - if Nodelay (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then - raise Curses_Exception; + if Nodelay (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then + raise Curses_Exception; end if; - end Set_NoDelay_Mode; + end Set_NoDelay_Mode; - procedure Set_Timeout_Mode (Win : in Window := Standard_Window; - Mode : in Timeout_Mode; - Amount : in Natural) + procedure Set_Timeout_Mode (Win : in Window := Standard_Window; + Mode : in Timeout_Mode; + Amount : in Natural) is - function Wtimeout (Win : Window; Amount : C_Int) return C_Int; - pragma Import (C, Wtimeout, "wtimeout"); + function Wtimeout (Win : Window; Amount : C_Int) return C_Int; + pragma Import (C, Wtimeout, "wtimeout"); - Time : C_Int; + Time : C_Int; begin - case Mode is - when Blocking => Time := -1; - when Non_Blocking => Time := 0; - when Delayed => - if Amount = 0 then + case Mode is + when Blocking => Time := -1; + when Non_Blocking => Time := 0; + when Delayed => + if Amount = 0 then raise Constraint_Error; end if; - Time := C_Int (Amount); + Time := C_Int (Amount); end case; - if Wtimeout (Win, Time) = Curses_Err then - raise Curses_Exception; + if Wtimeout (Win, Time) = Curses_Err then + raise Curses_Exception; end if; - end Set_Timeout_Mode; + end Set_Timeout_Mode; - procedure Set_Escape_Timer_Mode - (Win : in Window := Standard_Window; - Timer_Off : in Boolean := False) + procedure Set_Escape_Timer_Mode + (Win : in Window := Standard_Window; + Timer_Off : in Boolean := False) is - function Notimeout (Win : Window; Mode : Curses_Bool) return C_Int; - pragma Import (C, Notimeout, "notimeout"); + function Notimeout (Win : Window; Mode : Curses_Bool) return C_Int; + pragma Import (C, Notimeout, "notimeout"); begin - if Notimeout (Win, Curses_Bool (Boolean'Pos (Timer_Off))) - = Curses_Err then - raise Curses_Exception; + if Notimeout (Win, Curses_Bool (Boolean'Pos (Timer_Off))) + = Curses_Err then + raise Curses_Exception; end if; - end Set_Escape_Timer_Mode; + end Set_Escape_Timer_Mode; ------------------------------------------------------------------------------ - procedure Set_NL_Mode (SwitchOn : in Boolean := True) + procedure Set_NL_Mode (SwitchOn : in Boolean := True) is - function NL return C_Int; - pragma Import (C, NL, "nl"); - function NoNL return C_Int; - pragma Import (C, NoNL, "nonl"); + function NL return C_Int; + pragma Import (C, NL, "nl"); + function NoNL return C_Int; + pragma Import (C, NoNL, "nonl"); - Err : C_Int; + Err : C_Int; begin - if SwitchOn then - Err := NL; + if SwitchOn then + Err := NL; else - Err := NoNL; + Err := NoNL; end if; - if Err = Curses_Err then - raise Curses_Exception; + if Err = Curses_Err then + raise Curses_Exception; end if; - end Set_NL_Mode; + end Set_NL_Mode; - procedure Clear_On_Next_Update - (Win : in Window := Standard_Window; - Do_Clear : in Boolean := True) + procedure Clear_On_Next_Update + (Win : in Window := Standard_Window; + Do_Clear : in Boolean := True) is - function Clear_Ok (W : Window; Flag : Curses_Bool) return C_Int; - pragma Import (C, Clear_Ok, "clearok"); + function Clear_Ok (W : Window; Flag : Curses_Bool) return C_Int; + pragma Import (C, Clear_Ok, "clearok"); begin - if Clear_Ok (Win, Curses_Bool (Boolean'Pos (Do_Clear))) = Curses_Err then - raise Curses_Exception; + if Clear_Ok (Win, Curses_Bool (Boolean'Pos (Do_Clear))) = Curses_Err then + raise Curses_Exception; end if; - end Clear_On_Next_Update; + end Clear_On_Next_Update; - procedure Use_Insert_Delete_Line - (Win : in Window := Standard_Window; - Do_Idl : in Boolean := True) + procedure Use_Insert_Delete_Line + (Win : in Window := Standard_Window; + Do_Idl : in Boolean := True) is - function IDL_Ok (W : Window; Flag : Curses_Bool) return C_Int; - pragma Import (C, IDL_Ok, "idlok"); + function IDL_Ok (W : Window; Flag : Curses_Bool) return C_Int; + pragma Import (C, IDL_Ok, "idlok"); begin - if IDL_Ok (Win, Curses_Bool (Boolean'Pos (Do_Idl))) = Curses_Err then - raise Curses_Exception; + if IDL_Ok (Win, Curses_Bool (Boolean'Pos (Do_Idl))) = Curses_Err then + raise Curses_Exception; end if; - end Use_Insert_Delete_Line; + end Use_Insert_Delete_Line; - procedure Use_Insert_Delete_Character - (Win : in Window := Standard_Window; - Do_Idc : in Boolean := True) + procedure Use_Insert_Delete_Character + (Win : in Window := Standard_Window; + Do_Idc : in Boolean := True) is - function IDC_Ok (W : Window; Flag : Curses_Bool) return C_Int; - pragma Import (C, IDC_Ok, "idcok"); + function IDC_Ok (W : Window; Flag : Curses_Bool) return C_Int; + pragma Import (C, IDC_Ok, "idcok"); begin - if IDC_Ok (Win, Curses_Bool (Boolean'Pos (Do_Idc))) = Curses_Err then - raise Curses_Exception; + if IDC_Ok (Win, Curses_Bool (Boolean'Pos (Do_Idc))) = Curses_Err then + raise Curses_Exception; end if; - end Use_Insert_Delete_Character; + end Use_Insert_Delete_Character; - procedure Leave_Cursor_After_Update - (Win : in Window := Standard_Window; - Do_Leave : in Boolean := True) + procedure Leave_Cursor_After_Update + (Win : in Window := Standard_Window; + Do_Leave : in Boolean := True) is - function Leave_Ok (W : Window; Flag : Curses_Bool) return C_Int; - pragma Import (C, Leave_Ok, "leaveok"); + function Leave_Ok (W : Window; Flag : Curses_Bool) return C_Int; + pragma Import (C, Leave_Ok, "leaveok"); begin - if Leave_Ok (Win, Curses_Bool (Boolean'Pos (Do_Leave))) = Curses_Err then - raise Curses_Exception; + if Leave_Ok (Win, Curses_Bool (Boolean'Pos (Do_Leave))) = Curses_Err then + raise Curses_Exception; end if; - end Leave_Cursor_After_Update; + end Leave_Cursor_After_Update; - procedure Immediate_Update_Mode - (Win : in Window := Standard_Window; - Mode : in Boolean := False) + procedure Immediate_Update_Mode + (Win : in Window := Standard_Window; + Mode : in Boolean := False) is - function Immedok (Win : Window; Mode : Curses_Bool) return C_Int; - pragma Import (C, Immedok, "immedok"); + function Immedok (Win : Window; Mode : Curses_Bool) return C_Int; + pragma Import (C, Immedok, "immedok"); begin - if Immedok (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then - raise Curses_Exception; + if Immedok (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then + raise Curses_Exception; end if; - end Immediate_Update_Mode; + end Immediate_Update_Mode; - procedure Allow_Scrolling - (Win : in Window := Standard_Window; - Mode : in Boolean := False) + procedure Allow_Scrolling + (Win : in Window := Standard_Window; + Mode : in Boolean := False) is - function Scrollok (Win : Window; Mode : Curses_Bool) return C_Int; - pragma Import (C, Scrollok, "scrollok"); + function Scrollok (Win : Window; Mode : Curses_Bool) return C_Int; + pragma Import (C, Scrollok, "scrollok"); begin - if Scrollok (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then - raise Curses_Exception; + if Scrollok (Win, Curses_Bool (Boolean'Pos (Mode))) = Curses_Err then + raise Curses_Exception; end if; - end Allow_Scrolling; + end Allow_Scrolling; - function Scrolling_Allowed (Win : Window := Standard_Window) + function Scrolling_Allowed (Win : Window := Standard_Window) return Boolean is begin - return Get_Flag (Win, Offset_scroll); - end Scrolling_Allowed; + return Get_Flag (Win, Offset_scroll); + end Scrolling_Allowed; - procedure Set_Scroll_Region - (Win : in Window := Standard_Window; - Top_Line : in Line_Position; - Bottom_Line : in Line_Position) + procedure Set_Scroll_Region + (Win : in Window := Standard_Window; + Top_Line : in Line_Position; + Bottom_Line : in Line_Position) is - function Wsetscrreg (Win : Window; - Lin : C_Int; - Col : C_Int) return C_Int; - pragma Import (C, Wsetscrreg, "wsetscrreg"); + function Wsetscrreg (Win : Window; + Lin : C_Int; + Col : C_Int) return C_Int; + pragma Import (C, Wsetscrreg, "wsetscrreg"); begin - if Wsetscrreg (Win, C_Int (Top_Line), C_Int (Bottom_Line)) - = Curses_Err then - raise Curses_Exception; + if Wsetscrreg (Win, C_Int (Top_Line), C_Int (Bottom_Line)) + = Curses_Err then + raise Curses_Exception; end if; - end Set_Scroll_Region; + end Set_Scroll_Region; ------------------------------------------------------------------------------ - procedure Update_Screen + procedure Update_Screen is - function Do_Update return C_Int; - pragma Import (C, Do_Update, "doupdate"); + function Do_Update return C_Int; + pragma Import (C, Do_Update, "doupdate"); begin - if Do_Update = Curses_Err then - raise Curses_Exception; + if Do_Update = Curses_Err then + raise Curses_Exception; end if; - end Update_Screen; + end Update_Screen; - procedure Refresh (Win : in Window := Standard_Window) + procedure Refresh (Win : in Window := Standard_Window) is - function Wrefresh (W : Window) return C_Int; - pragma Import (C, Wrefresh, "wrefresh"); + function Wrefresh (W : Window) return C_Int; + pragma Import (C, Wrefresh, "wrefresh"); begin - if Wrefresh (Win) = Curses_Err then - raise Curses_Exception; + if Wrefresh (Win) = Curses_Err then + raise Curses_Exception; end if; - end Refresh; + end Refresh; - procedure Refresh_Without_Update - (Win : in Window := Standard_Window) + procedure Refresh_Without_Update + (Win : in Window := Standard_Window) is - function Wnoutrefresh (W : Window) return C_Int; - pragma Import (C, Wnoutrefresh, "wnoutrefresh"); + function Wnoutrefresh (W : Window) return C_Int; + pragma Import (C, Wnoutrefresh, "wnoutrefresh"); begin - if Wnoutrefresh (Win) = Curses_Err then - raise Curses_Exception; + if Wnoutrefresh (Win) = Curses_Err then + raise Curses_Exception; end if; - end Refresh_Without_Update; + end Refresh_Without_Update; - procedure Redraw (Win : in Window := Standard_Window) + procedure Redraw (Win : in Window := Standard_Window) is - function Redrawwin (Win : Window) return C_Int; - pragma Import (C, Redrawwin, "redrawwin"); + function Redrawwin (Win : Window) return C_Int; + pragma Import (C, Redrawwin, "redrawwin"); begin - if Redrawwin (Win) = Curses_Err then - raise Curses_Exception; + if Redrawwin (Win) = Curses_Err then + raise Curses_Exception; end if; - end Redraw; + end Redraw; - procedure Redraw - (Win : in Window := Standard_Window; - Begin_Line : in Line_Position; - Line_Count : in Positive) + procedure Redraw + (Win : in Window := Standard_Window; + Begin_Line : in Line_Position; + Line_Count : in Positive) is - function Wredrawln (Win : Window; First : C_Int; Cnt : C_Int) - return C_Int; - pragma Import (C, Wredrawln, "wredrawln"); + function Wredrawln (Win : Window; First : C_Int; Cnt : C_Int) + return C_Int; + pragma Import (C, Wredrawln, "wredrawln"); begin - if Wredrawln (Win, - C_Int (Begin_Line), - C_Int (Line_Count)) = Curses_Err then - raise Curses_Exception; + if Wredrawln (Win, + C_Int (Begin_Line), + C_Int (Line_Count)) = Curses_Err then + raise Curses_Exception; end if; - end Redraw; + end Redraw; ------------------------------------------------------------------------------ - procedure Erase (Win : in Window := Standard_Window) + procedure Erase (Win : in Window := Standard_Window) is - function Werase (W : Window) return C_Int; - pragma Import (C, Werase, "werase"); + function Werase (W : Window) return C_Int; + pragma Import (C, Werase, "werase"); begin - if Werase (Win) = Curses_Err then - raise Curses_Exception; + if Werase (Win) = Curses_Err then + raise Curses_Exception; end if; - end Erase; + end Erase; - procedure Clear (Win : in Window := Standard_Window) + procedure Clear (Win : in Window := Standard_Window) is - function Wclear (W : Window) return C_Int; - pragma Import (C, Wclear, "wclear"); + function Wclear (W : Window) return C_Int; + pragma Import (C, Wclear, "wclear"); begin - if Wclear (Win) = Curses_Err then - raise Curses_Exception; + if Wclear (Win) = Curses_Err then + raise Curses_Exception; end if; - end Clear; + end Clear; - procedure Clear_To_End_Of_Screen (Win : in Window := Standard_Window) + procedure Clear_To_End_Of_Screen (Win : in Window := Standard_Window) is - function Wclearbot (W : Window) return C_Int; - pragma Import (C, Wclearbot, "wclrtobot"); + function Wclearbot (W : Window) return C_Int; + pragma Import (C, Wclearbot, "wclrtobot"); begin - if Wclearbot (Win) = Curses_Err then - raise Curses_Exception; + if Wclearbot (Win) = Curses_Err then + raise Curses_Exception; end if; - end Clear_To_End_Of_Screen; + end Clear_To_End_Of_Screen; - procedure Clear_To_End_Of_Line (Win : in Window := Standard_Window) + procedure Clear_To_End_Of_Line (Win : in Window := Standard_Window) is - function Wcleareol (W : Window) return C_Int; - pragma Import (C, Wcleareol, "wclrtoeol"); + function Wcleareol (W : Window) return C_Int; + pragma Import (C, Wcleareol, "wclrtoeol"); begin - if Wcleareol (Win) = Curses_Err then - raise Curses_Exception; + if Wcleareol (Win) = Curses_Err then + raise Curses_Exception; end if; - end Clear_To_End_Of_Line; + end Clear_To_End_Of_Line; ------------------------------------------------------------------------------ - procedure Set_Background - (Win : in Window := Standard_Window; - Ch : in Attributed_Character) + procedure Set_Background + (Win : in Window := Standard_Window; + Ch : in Attributed_Character) is - procedure WBackground (W : in Window; Ch : in C_Chtype); - pragma Import (C, WBackground, "wbkgdset"); + procedure WBackground (W : in Window; Ch : in C_Chtype); + pragma Import (C, WBackground, "wbkgdset"); begin - WBackground (Win, AttrChar_To_Chtype (Ch)); - end Set_Background; + WBackground (Win, AttrChar_To_Chtype (Ch)); + end Set_Background; - procedure Change_Background - (Win : in Window := Standard_Window; - Ch : in Attributed_Character) + procedure Change_Background + (Win : in Window := Standard_Window; + Ch : in Attributed_Character) is - function WChangeBkgd (W : Window; Ch : C_Chtype) return C_Int; - pragma Import (C, WChangeBkgd, "wbkgd"); + function WChangeBkgd (W : Window; Ch : C_Chtype) return C_Int; + pragma Import (C, WChangeBkgd, "wbkgd"); begin - if WChangeBkgd (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then - raise Curses_Exception; + if WChangeBkgd (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then + raise Curses_Exception; end if; - end Change_Background; + end Change_Background; - function Get_Background (Win : Window := Standard_Window) - return Attributed_Character + function Get_Background (Win : Window := Standard_Window) + return Attributed_Character is - function Wgetbkgd (Win : Window) return C_Chtype; - pragma Import (C, Wgetbkgd, "getbkgd"); + function Wgetbkgd (Win : Window) return C_Chtype; + pragma Import (C, Wgetbkgd, "getbkgd"); begin - return Chtype_To_AttrChar (Wgetbkgd (Win)); - end Get_Background; + return Chtype_To_AttrChar (Wgetbkgd (Win)); + end Get_Background; ------------------------------------------------------------------------------ - procedure Change_Lines_Status (Win : in Window := Standard_Window; - Start : in Line_Position; - Count : in Positive; - State : in Boolean) + procedure Change_Lines_Status (Win : in Window := Standard_Window; + Start : in Line_Position; + Count : in Positive; + State : in Boolean) is - function Wtouchln (Win : Window; - Sta : C_Int; - Cnt : C_Int; - Chg : C_Int) return C_Int; - pragma Import (C, Wtouchln, "wtouchln"); + function Wtouchln (Win : Window; + Sta : C_Int; + Cnt : C_Int; + Chg : C_Int) return C_Int; + pragma Import (C, Wtouchln, "wtouchln"); begin - if Wtouchln (Win, C_Int (Start), C_Int (Count), - C_Int (Boolean'Pos (State))) = Curses_Err then - raise Curses_Exception; + if Wtouchln (Win, C_Int (Start), C_Int (Count), + C_Int (Boolean'Pos (State))) = Curses_Err then + raise Curses_Exception; end if; - end Change_Lines_Status; + end Change_Lines_Status; - procedure Touch (Win : in Window := Standard_Window) + procedure Touch (Win : in Window := Standard_Window) is - Y : Line_Position; - X : Column_Position; + Y : Line_Position; + X : Column_Position; begin - Get_Size (Win, Y, X); - Change_Lines_Status (Win, 0, Positive (Y), True); - end Touch; + Get_Size (Win, Y, X); + Change_Lines_Status (Win, 0, Positive (Y), True); + end Touch; - procedure Untouch (Win : in Window := Standard_Window) + procedure Untouch (Win : in Window := Standard_Window) is - Y : Line_Position; - X : Column_Position; + Y : Line_Position; + X : Column_Position; begin - Get_Size (Win, Y, X); - Change_Lines_Status (Win, 0, Positive (Y), False); - end Untouch; + Get_Size (Win, Y, X); + Change_Lines_Status (Win, 0, Positive (Y), False); + end Untouch; - procedure Touch (Win : in Window := Standard_Window; - Start : in Line_Position; - Count : in Positive) + procedure Touch (Win : in Window := Standard_Window; + Start : in Line_Position; + Count : in Positive) is begin - Change_Lines_Status (Win, Start, Count, True); - end Touch; + Change_Lines_Status (Win, Start, Count, True); + end Touch; - function Is_Touched - (Win : Window := Standard_Window; - Line : Line_Position) return Boolean + function Is_Touched + (Win : Window := Standard_Window; + Line : Line_Position) return Boolean is - function WLineTouched (W : Window; L : C_Int) return Curses_Bool; - pragma Import (C, WLineTouched, "is_linetouched"); + function WLineTouched (W : Window; L : C_Int) return Curses_Bool; + pragma Import (C, WLineTouched, "is_linetouched"); begin - if WLineTouched (Win, C_Int (Line)) = Curses_Bool_False then + if WLineTouched (Win, C_Int (Line)) = Curses_Bool_False then return False; else return True; end if; - end Is_Touched; + end Is_Touched; - function Is_Touched - (Win : Window := Standard_Window) return Boolean + function Is_Touched + (Win : Window := Standard_Window) return Boolean is - function WWinTouched (W : Window) return Curses_Bool; - pragma Import (C, WWinTouched, "is_wintouched"); + function WWinTouched (W : Window) return Curses_Bool; + pragma Import (C, WWinTouched, "is_wintouched"); begin - if WWinTouched (Win) = Curses_Bool_False then + if WWinTouched (Win) = Curses_Bool_False then return False; else return True; end if; - end Is_Touched; + end Is_Touched; ------------------------------------------------------------------------------ - procedure Copy - (Source_Window : in Window; - Destination_Window : in Window; - Source_Top_Row : in Line_Position; - Source_Left_Column : in Column_Position; - Destination_Top_Row : in Line_Position; - Destination_Left_Column : in Column_Position; - Destination_Bottom_Row : in Line_Position; - Destination_Right_Column : in Column_Position; - Non_Destructive_Mode : in Boolean := True) - is - function Copywin (Src : Window; - Dst : Window; - Str : C_Int; - Slc : C_Int; - Dtr : C_Int; - Dlc : C_Int; - Dbr : C_Int; - Drc : C_Int; - Ndm : C_Int) return C_Int; - pragma Import (C, Copywin, "copywin"); - begin - if Copywin (Source_Window, - Destination_Window, - C_Int (Source_Top_Row), - C_Int (Source_Left_Column), - C_Int (Destination_Top_Row), - C_Int (Destination_Left_Column), - C_Int (Destination_Bottom_Row), - C_Int (Destination_Right_Column), - Boolean'Pos (Non_Destructive_Mode) - ) = Curses_Err then - raise Curses_Exception; - end if; - end Copy; - - procedure Overwrite - (Source_Window : in Window; - Destination_Window : in Window) - is - function Overwrite (Src : Window; Dst : Window) return C_Int; - pragma Import (C, Overwrite, "overwrite"); - begin - if Overwrite (Source_Window, Destination_Window) = Curses_Err then - raise Curses_Exception; - end if; - end Overwrite; - - procedure Overlay - (Source_Window : in Window; - Destination_Window : in Window) - is - function Overlay (Src : Window; Dst : Window) return C_Int; - pragma Import (C, Overlay, "overlay"); - begin - if Overlay (Source_Window, Destination_Window) = Curses_Err then - raise Curses_Exception; - end if; - end Overlay; + procedure Copy + (Source_Window : in Window; + Destination_Window : in Window; + Source_Top_Row : in Line_Position; + Source_Left_Column : in Column_Position; + Destination_Top_Row : in Line_Position; + Destination_Left_Column : in Column_Position; + Destination_Bottom_Row : in Line_Position; + Destination_Right_Column : in Column_Position; + Non_Destructive_Mode : in Boolean := True) + is + function Copywin (Src : Window; + Dst : Window; + Str : C_Int; + Slc : C_Int; + Dtr : C_Int; + Dlc : C_Int; + Dbr : C_Int; + Drc : C_Int; + Ndm : C_Int) return C_Int; + pragma Import (C, Copywin, "copywin"); + begin + if Copywin (Source_Window, + Destination_Window, + C_Int (Source_Top_Row), + C_Int (Source_Left_Column), + C_Int (Destination_Top_Row), + C_Int (Destination_Left_Column), + C_Int (Destination_Bottom_Row), + C_Int (Destination_Right_Column), + Boolean'Pos (Non_Destructive_Mode) + ) = Curses_Err then + raise Curses_Exception; + end if; + end Copy; + + procedure Overwrite + (Source_Window : in Window; + Destination_Window : in Window) + is + function Overwrite (Src : Window; Dst : Window) return C_Int; + pragma Import (C, Overwrite, "overwrite"); + begin + if Overwrite (Source_Window, Destination_Window) = Curses_Err then + raise Curses_Exception; + end if; + end Overwrite; + + procedure Overlay + (Source_Window : in Window; + Destination_Window : in Window) + is + function Overlay (Src : Window; Dst : Window) return C_Int; + pragma Import (C, Overlay, "overlay"); + begin + if Overlay (Source_Window, Destination_Window) = Curses_Err then + raise Curses_Exception; + end if; + end Overlay; ------------------------------------------------------------------------------ - procedure Insert_Delete_Lines - (Win : in Window := Standard_Window; - Lines : in Integer := 1) -- default is to insert one line above + procedure Insert_Delete_Lines + (Win : in Window := Standard_Window; + Lines : in Integer := 1) -- default is to insert one line above is - function Winsdelln (W : Window; N : C_Int) return C_Int; - pragma Import (C, Winsdelln, "winsdelln"); + function Winsdelln (W : Window; N : C_Int) return C_Int; + pragma Import (C, Winsdelln, "winsdelln"); begin - if Winsdelln (Win, C_Int (Lines)) = Curses_Err then - raise Curses_Exception; + if Winsdelln (Win, C_Int (Lines)) = Curses_Err then + raise Curses_Exception; end if; - end Insert_Delete_Lines; + end Insert_Delete_Lines; - procedure Delete_Line (Win : in Window := Standard_Window) + procedure Delete_Line (Win : in Window := Standard_Window) is begin - Insert_Delete_Lines (Win, -1); - end Delete_Line; + Insert_Delete_Lines (Win, -1); + end Delete_Line; - procedure Insert_Line (Win : in Window := Standard_Window) + procedure Insert_Line (Win : in Window := Standard_Window) is begin - Insert_Delete_Lines (Win, 1); - end Insert_Line; + Insert_Delete_Lines (Win, 1); + end Insert_Line; ------------------------------------------------------------------------------ - procedure Get_Size - (Win : in Window := Standard_Window; - Number_Of_Lines : out Line_Count; - Number_Of_Columns : out Column_Count) + procedure Get_Size + (Win : in Window := Standard_Window; + Number_Of_Lines : out Line_Count; + Number_Of_Columns : out Column_Count) is -- Please note: in ncurses they are one off. -- This might be different in other implementations of curses - Y : C_Int := C_Int (W_Get_Short (Win, Offset_maxy)) + C_Int (Offset_XY); - X : C_Int := C_Int (W_Get_Short (Win, Offset_maxx)) + C_Int (Offset_XY); - begin - Number_Of_Lines := Line_Count (Y); - Number_Of_Columns := Column_Count (X); - end Get_Size; - - procedure Get_Window_Position - (Win : in Window := Standard_Window; - Top_Left_Line : out Line_Position; - Top_Left_Column : out Column_Position) - is - Y : C_Short := W_Get_Short (Win, Offset_begy); - X : C_Short := W_Get_Short (Win, Offset_begx); - begin - Top_Left_Line := Line_Position (Y); - Top_Left_Column := Column_Position (X); - end Get_Window_Position; - - procedure Get_Cursor_Position - (Win : in Window := Standard_Window; - Line : out Line_Position; - Column : out Column_Position) - is - Y : C_Short := W_Get_Short (Win, Offset_cury); - X : C_Short := W_Get_Short (Win, Offset_curx); - begin - Line := Line_Position (Y); - Column := Column_Position (X); - end Get_Cursor_Position; - - procedure Get_Origin_Relative_To_Parent - (Win : in Window; - Top_Left_Line : out Line_Position; - Top_Left_Column : out Column_Position; - Is_Not_A_Subwindow : out Boolean) - is - Y : C_Int := W_Get_Int (Win, Offset_pary); - X : C_Int := W_Get_Int (Win, Offset_parx); - begin - if Y = -1 then - Top_Left_Line := Line_Position'Last; - Top_Left_Column := Column_Position'Last; - Is_Not_A_Subwindow := True; + Y : constant C_Int := C_Int (W_Get_Short (Win, Offset_maxy)) + + C_Int (Offset_XY); + X : constant C_Int := C_Int (W_Get_Short (Win, Offset_maxx)) + + C_Int (Offset_XY); + begin + Number_Of_Lines := Line_Count (Y); + Number_Of_Columns := Column_Count (X); + end Get_Size; + + procedure Get_Window_Position + (Win : in Window := Standard_Window; + Top_Left_Line : out Line_Position; + Top_Left_Column : out Column_Position) + is + Y : constant C_Short := W_Get_Short (Win, Offset_begy); + X : constant C_Short := W_Get_Short (Win, Offset_begx); + begin + Top_Left_Line := Line_Position (Y); + Top_Left_Column := Column_Position (X); + end Get_Window_Position; + + procedure Get_Cursor_Position + (Win : in Window := Standard_Window; + Line : out Line_Position; + Column : out Column_Position) + is + Y : constant C_Short := W_Get_Short (Win, Offset_cury); + X : constant C_Short := W_Get_Short (Win, Offset_curx); + begin + Line := Line_Position (Y); + Column := Column_Position (X); + end Get_Cursor_Position; + + procedure Get_Origin_Relative_To_Parent + (Win : in Window; + Top_Left_Line : out Line_Position; + Top_Left_Column : out Column_Position; + Is_Not_A_Subwindow : out Boolean) + is + Y : constant C_Int := W_Get_Int (Win, Offset_pary); + X : constant C_Int := W_Get_Int (Win, Offset_parx); + begin + if Y = -1 then + Top_Left_Line := Line_Position'Last; + Top_Left_Column := Column_Position'Last; + Is_Not_A_Subwindow := True; else - Top_Left_Line := Line_Position (Y); - Top_Left_Column := Column_Position (X); - Is_Not_A_Subwindow := False; + Top_Left_Line := Line_Position (Y); + Top_Left_Column := Column_Position (X); + Is_Not_A_Subwindow := False; end if; - end Get_Origin_Relative_To_Parent; + end Get_Origin_Relative_To_Parent; ------------------------------------------------------------------------------ - function New_Pad (Lines : Line_Count; - Columns : Column_Count) return Window - is - function Newpad (Lines : C_Int; Columns : C_Int) return Window; - pragma Import (C, Newpad, "newpad"); - - W : Window; - begin - W := Newpad (C_Int (Lines), C_Int (Columns)); - if W = Null_Window then - raise Curses_Exception; - end if; - return W; - end New_Pad; - - function Sub_Pad - (Pad : Window; - Number_Of_Lines : Line_Count; - Number_Of_Columns : Column_Count; - First_Line_Position : Line_Position; - First_Column_Position : Column_Position) return Window - is - function Subpad - (Pad : Window; - Number_Of_Lines : C_Int; - Number_Of_Columns : C_Int; - First_Line_Position : C_Int; - First_Column_Position : C_Int) return Window; - pragma Import (C, Subpad, "subpad"); - - W : Window; - begin - W := Subpad (Pad, - C_Int (Number_Of_Lines), - C_Int (Number_Of_Columns), - C_Int (First_Line_Position), - C_Int (First_Column_Position)); - if W = Null_Window then - raise Curses_Exception; - end if; - return W; - end Sub_Pad; - - procedure Refresh - (Pad : in Window; - Source_Top_Row : in Line_Position; - Source_Left_Column : in Column_Position; - Destination_Top_Row : in Line_Position; - Destination_Left_Column : in Column_Position; - Destination_Bottom_Row : in Line_Position; - Destination_Right_Column : in Column_Position) - is - function Prefresh - (Pad : Window; - Source_Top_Row : C_Int; - Source_Left_Column : C_Int; - Destination_Top_Row : C_Int; - Destination_Left_Column : C_Int; - Destination_Bottom_Row : C_Int; - Destination_Right_Column : C_Int) return C_Int; - pragma Import (C, Prefresh, "prefresh"); - begin - if Prefresh (Pad, - C_Int (Source_Top_Row), - C_Int (Source_Left_Column), - C_Int (Destination_Top_Row), - C_Int (Destination_Left_Column), - C_Int (Destination_Bottom_Row), - C_Int (Destination_Right_Column)) = Curses_Err then - raise Curses_Exception; - end if; - end Refresh; - - procedure Refresh_Without_Update - (Pad : in Window; - Source_Top_Row : in Line_Position; - Source_Left_Column : in Column_Position; - Destination_Top_Row : in Line_Position; - Destination_Left_Column : in Column_Position; - Destination_Bottom_Row : in Line_Position; - Destination_Right_Column : in Column_Position) - is - function Pnoutrefresh - (Pad : Window; - Source_Top_Row : C_Int; - Source_Left_Column : C_Int; - Destination_Top_Row : C_Int; - Destination_Left_Column : C_Int; - Destination_Bottom_Row : C_Int; - Destination_Right_Column : C_Int) return C_Int; - pragma Import (C, Pnoutrefresh, "pnoutrefresh"); - begin - if Pnoutrefresh (Pad, - C_Int (Source_Top_Row), - C_Int (Source_Left_Column), - C_Int (Destination_Top_Row), - C_Int (Destination_Left_Column), - C_Int (Destination_Bottom_Row), - C_Int (Destination_Right_Column)) = Curses_Err then - raise Curses_Exception; - end if; - end Refresh_Without_Update; - - procedure Add_Character_To_Pad_And_Echo_It - (Pad : in Window; - Ch : in Attributed_Character) - is - function Pechochar (Pad : Window; Ch : C_Chtype) - return C_Int; - pragma Import (C, Pechochar, "pechochar"); - begin - if Pechochar (Pad, AttrChar_To_Chtype (Ch)) = Curses_Err then - raise Curses_Exception; - end if; - end Add_Character_To_Pad_And_Echo_It; - - procedure Add_Character_To_Pad_And_Echo_It - (Pad : in Window; - Ch : in Character) - is - begin - Add_Character_To_Pad_And_Echo_It - (Pad, - Attributed_Character'(Ch => Ch, - Color => Color_Pair'First, - Attr => Normal_Video)); - end Add_Character_To_Pad_And_Echo_It; + function New_Pad (Lines : Line_Count; + Columns : Column_Count) return Window + is + function Newpad (Lines : C_Int; Columns : C_Int) return Window; + pragma Import (C, Newpad, "newpad"); + + W : Window; + begin + W := Newpad (C_Int (Lines), C_Int (Columns)); + if W = Null_Window then + raise Curses_Exception; + end if; + return W; + end New_Pad; + + function Sub_Pad + (Pad : Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; + First_Column_Position : Column_Position) return Window + is + function Subpad + (Pad : Window; + Number_Of_Lines : C_Int; + Number_Of_Columns : C_Int; + First_Line_Position : C_Int; + First_Column_Position : C_Int) return Window; + pragma Import (C, Subpad, "subpad"); + + W : Window; + begin + W := Subpad (Pad, + C_Int (Number_Of_Lines), + C_Int (Number_Of_Columns), + C_Int (First_Line_Position), + C_Int (First_Column_Position)); + if W = Null_Window then + raise Curses_Exception; + end if; + return W; + end Sub_Pad; + + procedure Refresh + (Pad : in Window; + Source_Top_Row : in Line_Position; + Source_Left_Column : in Column_Position; + Destination_Top_Row : in Line_Position; + Destination_Left_Column : in Column_Position; + Destination_Bottom_Row : in Line_Position; + Destination_Right_Column : in Column_Position) + is + function Prefresh + (Pad : Window; + Source_Top_Row : C_Int; + Source_Left_Column : C_Int; + Destination_Top_Row : C_Int; + Destination_Left_Column : C_Int; + Destination_Bottom_Row : C_Int; + Destination_Right_Column : C_Int) return C_Int; + pragma Import (C, Prefresh, "prefresh"); + begin + if Prefresh (Pad, + C_Int (Source_Top_Row), + C_Int (Source_Left_Column), + C_Int (Destination_Top_Row), + C_Int (Destination_Left_Column), + C_Int (Destination_Bottom_Row), + C_Int (Destination_Right_Column)) = Curses_Err then + raise Curses_Exception; + end if; + end Refresh; + + procedure Refresh_Without_Update + (Pad : in Window; + Source_Top_Row : in Line_Position; + Source_Left_Column : in Column_Position; + Destination_Top_Row : in Line_Position; + Destination_Left_Column : in Column_Position; + Destination_Bottom_Row : in Line_Position; + Destination_Right_Column : in Column_Position) + is + function Pnoutrefresh + (Pad : Window; + Source_Top_Row : C_Int; + Source_Left_Column : C_Int; + Destination_Top_Row : C_Int; + Destination_Left_Column : C_Int; + Destination_Bottom_Row : C_Int; + Destination_Right_Column : C_Int) return C_Int; + pragma Import (C, Pnoutrefresh, "pnoutrefresh"); + begin + if Pnoutrefresh (Pad, + C_Int (Source_Top_Row), + C_Int (Source_Left_Column), + C_Int (Destination_Top_Row), + C_Int (Destination_Left_Column), + C_Int (Destination_Bottom_Row), + C_Int (Destination_Right_Column)) = Curses_Err then + raise Curses_Exception; + end if; + end Refresh_Without_Update; + + procedure Add_Character_To_Pad_And_Echo_It + (Pad : in Window; + Ch : in Attributed_Character) + is + function Pechochar (Pad : Window; Ch : C_Chtype) + return C_Int; + pragma Import (C, Pechochar, "pechochar"); + begin + if Pechochar (Pad, AttrChar_To_Chtype (Ch)) = Curses_Err then + raise Curses_Exception; + end if; + end Add_Character_To_Pad_And_Echo_It; + + procedure Add_Character_To_Pad_And_Echo_It + (Pad : in Window; + Ch : in Character) + is + begin + Add_Character_To_Pad_And_Echo_It + (Pad, + Attributed_Character'(Ch => Ch, + Color => Color_Pair'First, + Attr => Normal_Video)); + end Add_Character_To_Pad_And_Echo_It; ------------------------------------------------------------------------------ - procedure Scroll (Win : in Window := Standard_Window; - Amount : in Integer := 1) + procedure Scroll (Win : in Window := Standard_Window; + Amount : in Integer := 1) is - function Wscrl (Win : Window; N : C_Int) return C_Int; - pragma Import (C, Wscrl, "wscrl"); + function Wscrl (Win : Window; N : C_Int) return C_Int; + pragma Import (C, Wscrl, "wscrl"); begin - if Wscrl (Win, C_Int (Amount)) = Curses_Err then - raise Curses_Exception; + if Wscrl (Win, C_Int (Amount)) = Curses_Err then + raise Curses_Exception; end if; - end Scroll; + end Scroll; ------------------------------------------------------------------------------ - procedure Delete_Character (Win : in Window := Standard_Window) + procedure Delete_Character (Win : in Window := Standard_Window) is - function Wdelch (Win : Window) return C_Int; - pragma Import (C, Wdelch, "wdelch"); + function Wdelch (Win : Window) return C_Int; + pragma Import (C, Wdelch, "wdelch"); begin - if Wdelch (Win) = Curses_Err then - raise Curses_Exception; + if Wdelch (Win) = Curses_Err then + raise Curses_Exception; end if; - end Delete_Character; + end Delete_Character; - procedure Delete_Character - (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position) + procedure Delete_Character + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position) is - function Mvwdelch (Win : Window; - Lin : C_Int; - Col : C_Int) return C_Int; - pragma Import (C, Mvwdelch, "mvwdelch"); + function Mvwdelch (Win : Window; + Lin : C_Int; + Col : C_Int) return C_Int; + pragma Import (C, Mvwdelch, "mvwdelch"); begin - if Mvwdelch (Win, C_Int (Line), C_Int (Column)) = Curses_Err then - raise Curses_Exception; + if Mvwdelch (Win, C_Int (Line), C_Int (Column)) = Curses_Err then + raise Curses_Exception; end if; - end Delete_Character; + end Delete_Character; ------------------------------------------------------------------------------ - function Peek (Win : Window := Standard_Window) - return Attributed_Character + function Peek (Win : Window := Standard_Window) + return Attributed_Character is - function Winch (Win : Window) return C_Chtype; - pragma Import (C, Winch, "winch"); + function Winch (Win : Window) return C_Chtype; + pragma Import (C, Winch, "winch"); begin - return Chtype_To_AttrChar (Winch (Win)); - end Peek; + return Chtype_To_AttrChar (Winch (Win)); + end Peek; - function Peek - (Win : Window := Standard_Window; - Line : Line_Position; - Column : Column_Position) return Attributed_Character + function Peek + (Win : Window := Standard_Window; + Line : Line_Position; + Column : Column_Position) return Attributed_Character is - function Mvwinch (Win : Window; - Lin : C_Int; - Col : C_Int) return C_Chtype; - pragma Import (C, Mvwinch, "mvwinch"); + function Mvwinch (Win : Window; + Lin : C_Int; + Col : C_Int) return C_Chtype; + pragma Import (C, Mvwinch, "mvwinch"); begin - return Chtype_To_AttrChar (Mvwinch (Win, C_Int (Line), C_Int (Column))); - end Peek; + return Chtype_To_AttrChar (Mvwinch (Win, C_Int (Line), C_Int (Column))); + end Peek; ------------------------------------------------------------------------------ - procedure Insert (Win : in Window := Standard_Window; - Ch : in Attributed_Character) + procedure Insert (Win : in Window := Standard_Window; + Ch : in Attributed_Character) is - function Winsch (Win : Window; Ch : C_Chtype) return C_Int; - pragma Import (C, Winsch, "winsch"); + function Winsch (Win : Window; Ch : C_Chtype) return C_Int; + pragma Import (C, Winsch, "winsch"); begin - if Winsch (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then - raise Curses_Exception; + if Winsch (Win, AttrChar_To_Chtype (Ch)) = Curses_Err then + raise Curses_Exception; end if; - end Insert; + end Insert; - procedure Insert - (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Ch : in Attributed_Character) + procedure Insert + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Ch : in Attributed_Character) is - function Mvwinsch (Win : Window; - Lin : C_Int; - Col : C_Int; - Ch : C_Chtype) return C_Int; - pragma Import (C, Mvwinsch, "mvwinsch"); + function Mvwinsch (Win : Window; + Lin : C_Int; + Col : C_Int; + Ch : C_Chtype) return C_Int; + pragma Import (C, Mvwinsch, "mvwinsch"); begin - if Mvwinsch (Win, - C_Int (Line), - C_Int (Column), - AttrChar_To_Chtype (Ch)) = Curses_Err then - raise Curses_Exception; + if Mvwinsch (Win, + C_Int (Line), + C_Int (Column), + AttrChar_To_Chtype (Ch)) = Curses_Err then + raise Curses_Exception; end if; - end Insert; + end Insert; ------------------------------------------------------------------------------ - procedure Insert (Win : in Window := Standard_Window; - Str : in String; - Len : in Integer := -1) - is - function Winsnstr (Win : Window; - Str : char_array; - Len : Integer := -1) return C_Int; - pragma Import (C, Winsnstr, "winsnstr"); - - Txt : char_array (0 .. Str'Length); - Length : size_t; - begin - To_C (Str, Txt, Length); - if Winsnstr (Win, Txt, Len) = Curses_Err then - raise Curses_Exception; - end if; - end Insert; - - procedure Insert - (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Str : in String; - Len : in Integer := -1) - is - function Mvwinsnstr (Win : Window; - Line : C_Int; - Column : C_Int; - Str : char_array; - Len : C_Int) return C_Int; - pragma Import (C, Mvwinsnstr, "mvwinsnstr"); - - Txt : char_array (0 .. Str'Length); - Length : size_t; - begin - To_C (Str, Txt, Length); - if Mvwinsnstr (Win, C_Int (Line), C_Int (Column), Txt, C_Int (Len)) - = Curses_Err then - raise Curses_Exception; - end if; - end Insert; + procedure Insert (Win : in Window := Standard_Window; + Str : in String; + Len : in Integer := -1) + is + function Winsnstr (Win : Window; + Str : char_array; + Len : Integer := -1) return C_Int; + pragma Import (C, Winsnstr, "winsnstr"); + + Txt : char_array (0 .. Str'Length); + Length : size_t; + begin + To_C (Str, Txt, Length); + if Winsnstr (Win, Txt, Len) = Curses_Err then + raise Curses_Exception; + end if; + end Insert; + + procedure Insert + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : in String; + Len : in Integer := -1) + is + function Mvwinsnstr (Win : Window; + Line : C_Int; + Column : C_Int; + Str : char_array; + Len : C_Int) return C_Int; + pragma Import (C, Mvwinsnstr, "mvwinsnstr"); + + Txt : char_array (0 .. Str'Length); + Length : size_t; + begin + To_C (Str, Txt, Length); + if Mvwinsnstr (Win, C_Int (Line), C_Int (Column), Txt, C_Int (Len)) + = Curses_Err then + raise Curses_Exception; + end if; + end Insert; ------------------------------------------------------------------------------ - procedure Peek (Win : in Window := Standard_Window; - Str : out String; - Len : in Integer := -1) + procedure Peek (Win : in Window := Standard_Window; + Str : out String; + Len : in Integer := -1) is - function Winnstr (Win : Window; - Str : char_array; - Len : C_Int) return C_Int; - pragma Import (C, Winnstr, "winnstr"); + function Winnstr (Win : Window; + Str : char_array; + Len : C_Int) return C_Int; + pragma Import (C, Winnstr, "winnstr"); - N : Integer := Len; - Txt : char_array (0 .. Str'Length); - Cnt : Natural; + N : Integer := Len; + Txt : char_array (0 .. Str'Length); + Cnt : Natural; begin - if N < 0 then - N := Str'Length; + if N < 0 then + N := Str'Length; end if; - if N > Str'Length then + if N > Str'Length then raise Constraint_Error; end if; - Txt (0) := Interfaces.C.char'First; - if Winnstr (Win, Txt, C_Int (N)) = Curses_Err then - raise Curses_Exception; + Txt (0) := Interfaces.C.char'First; + if Winnstr (Win, Txt, C_Int (N)) = Curses_Err then + raise Curses_Exception; end if; - To_Ada (Txt, Str, Cnt, True); - if Cnt < Str'Length then - Str ((Str'First + Cnt) .. Str'Last) := (others => ' '); + To_Ada (Txt, Str, Cnt, True); + if Cnt < Str'Length then + Str ((Str'First + Cnt) .. Str'Last) := (others => ' '); end if; - end Peek; + end Peek; - procedure Peek - (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Str : out String; - Len : in Integer := -1) + procedure Peek + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : out String; + Len : in Integer := -1) is begin - Move_Cursor (Win, Line, Column); - Peek (Win, Str, Len); - end Peek; + Move_Cursor (Win, Line, Column); + Peek (Win, Str, Len); + end Peek; ------------------------------------------------------------------------------ - procedure Peek - (Win : in Window := Standard_Window; - Str : out Attributed_String; - Len : in Integer := -1) + procedure Peek + (Win : in Window := Standard_Window; + Str : out Attributed_String; + Len : in Integer := -1) is - function Winchnstr (Win : Window; - Str : chtype_array; -- out - Len : C_Int) return C_Int; - pragma Import (C, Winchnstr, "winchnstr"); + function Winchnstr (Win : Window; + Str : chtype_array; -- out + Len : C_Int) return C_Int; + pragma Import (C, Winchnstr, "winchnstr"); - N : Integer := Len; - Txt : chtype_array (0 .. Str'Length) := (0 => Default_Character); - Cnt : Natural := 0; + N : Integer := Len; + Txt : constant chtype_array (0 .. Str'Length) + := (0 => Default_Character); + Cnt : Natural := 0; begin - if N < 0 then - N := Str'Length; + if N < 0 then + N := Str'Length; end if; - if N > Str'Length then + if N > Str'Length then raise Constraint_Error; end if; - if Winchnstr (Win, Txt, C_Int (N)) = Curses_Err then - raise Curses_Exception; + if Winchnstr (Win, Txt, C_Int (N)) = Curses_Err then + raise Curses_Exception; end if; - for To in Str'Range loop - exit when Txt (size_t (Cnt)) = Default_Character; - Str (To) := Txt (size_t (Cnt)); - Cnt := Cnt + 1; + for To in Str'Range loop + exit when Txt (size_t (Cnt)) = Default_Character; + Str (To) := Txt (size_t (Cnt)); + Cnt := Cnt + 1; end loop; - if Cnt < Str'Length then - Str ((Str'First + Cnt) .. Str'Last) := + if Cnt < Str'Length then + Str ((Str'First + Cnt) .. Str'Last) := (others => (Ch => ' ', - Color => Color_Pair'First, - Attr => Normal_Video)); + Color => Color_Pair'First, + Attr => Normal_Video)); end if; - end Peek; + end Peek; - procedure Peek - (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Str : out Attributed_String; - Len : in Integer := -1) + procedure Peek + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : out Attributed_String; + Len : in Integer := -1) is begin - Move_Cursor (Win, Line, Column); - Peek (Win, Str, Len); - end Peek; + Move_Cursor (Win, Line, Column); + Peek (Win, Str, Len); + end Peek; ------------------------------------------------------------------------------ - procedure Get (Win : in Window := Standard_Window; - Str : out String; - Len : in Integer := -1) + procedure Get (Win : in Window := Standard_Window; + Str : out String; + Len : in Integer := -1) is - function Wgetnstr (Win : Window; - Str : char_array; - Len : C_Int) return C_Int; - pragma Import (C, Wgetnstr, "wgetnstr"); + function Wgetnstr (Win : Window; + Str : char_array; + Len : C_Int) return C_Int; + pragma Import (C, Wgetnstr, "wgetnstr"); - N : Integer := Len; - Txt : char_array (0 .. Str'Length); - Cnt : Natural; + N : Integer := Len; + Txt : char_array (0 .. Str'Length); + Cnt : Natural; begin - if N < 0 then - N := Str'Length; + if N < 0 then + N := Str'Length; end if; - if N > Str'Length then + if N > Str'Length then raise Constraint_Error; end if; - Txt (0) := Interfaces.C.char'First; - if Wgetnstr (Win, Txt, C_Int (N)) = Curses_Err then - raise Curses_Exception; + Txt (0) := Interfaces.C.char'First; + if Wgetnstr (Win, Txt, C_Int (N)) = Curses_Err then + raise Curses_Exception; end if; - To_Ada (Txt, Str, Cnt, True); - if Cnt < Str'Length then - Str ((Str'First + Cnt) .. Str'Last) := (others => ' '); + To_Ada (Txt, Str, Cnt, True); + if Cnt < Str'Length then + Str ((Str'First + Cnt) .. Str'Last) := (others => ' '); end if; - end Get; + end Get; - procedure Get - (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Str : out String; - Len : in Integer := -1) + procedure Get + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : out String; + Len : in Integer := -1) is begin - Move_Cursor (Win, Line, Column); - Get (Win, Str, Len); - end Get; + Move_Cursor (Win, Line, Column); + Get (Win, Str, Len); + end Get; ------------------------------------------------------------------------------ - procedure Init_Soft_Label_Keys - (Format : in Soft_Label_Key_Format := Three_Two_Three) + procedure Init_Soft_Label_Keys + (Format : in Soft_Label_Key_Format := Three_Two_Three) is - function Slk_Init (Fmt : C_Int) return C_Int; - pragma Import (C, Slk_Init, "slk_init"); + function Slk_Init (Fmt : C_Int) return C_Int; + pragma Import (C, Slk_Init, "slk_init"); begin - if Slk_Init (Soft_Label_Key_Format'Pos (Format)) = Curses_Err then - raise Curses_Exception; + if Slk_Init (Soft_Label_Key_Format'Pos (Format)) = Curses_Err then + raise Curses_Exception; end if; - end Init_Soft_Label_Keys; + end Init_Soft_Label_Keys; - procedure Set_Soft_Label_Key (Label : in Label_Number; - Text : in String; - Fmt : in Label_Justification := Left) + procedure Set_Soft_Label_Key (Label : in Label_Number; + Text : in String; + Fmt : in Label_Justification := Left) is - function Slk_Set (Label : C_Int; - Txt : char_array; - Fmt : C_Int) return C_Int; - pragma Import (C, Slk_Set, "slk_set"); + function Slk_Set (Label : C_Int; + Txt : char_array; + Fmt : C_Int) return C_Int; + pragma Import (C, Slk_Set, "slk_set"); - Txt : char_array (0 .. Text'Length); - Len : size_t; + Txt : char_array (0 .. Text'Length); + Len : size_t; begin - To_C (Text, Txt, Len); - if Slk_Set (C_Int (Label), Txt, - C_Int (Label_Justification'Pos (Fmt))) = Curses_Err then - raise Curses_Exception; + To_C (Text, Txt, Len); + if Slk_Set (C_Int (Label), Txt, + C_Int (Label_Justification'Pos (Fmt))) = Curses_Err then + raise Curses_Exception; end if; - end Set_Soft_Label_Key; + end Set_Soft_Label_Key; - procedure Refresh_Soft_Label_Keys + procedure Refresh_Soft_Label_Keys is - function Slk_Refresh return C_Int; - pragma Import (C, Slk_Refresh, "slk_refresh"); + function Slk_Refresh return C_Int; + pragma Import (C, Slk_Refresh, "slk_refresh"); begin - if Slk_Refresh = Curses_Err then - raise Curses_Exception; + if Slk_Refresh = Curses_Err then + raise Curses_Exception; end if; - end Refresh_Soft_Label_Keys; + end Refresh_Soft_Label_Keys; - procedure Refresh_Soft_Label_Keys_Without_Update + procedure Refresh_Soft_Label_Keys_Without_Update is - function Slk_Noutrefresh return C_Int; - pragma Import (C, Slk_Noutrefresh, "slk_noutrefresh"); + function Slk_Noutrefresh return C_Int; + pragma Import (C, Slk_Noutrefresh, "slk_noutrefresh"); begin - if Slk_Noutrefresh = Curses_Err then - raise Curses_Exception; + if Slk_Noutrefresh = Curses_Err then + raise Curses_Exception; end if; - end Refresh_Soft_Label_Keys_Without_Update; + end Refresh_Soft_Label_Keys_Without_Update; - procedure Get_Soft_Label_Key (Label : in Label_Number; - Text : out String) + procedure Get_Soft_Label_Key (Label : in Label_Number; + Text : out String) is - function Slk_Label (Label : C_Int) return chars_ptr; - pragma Import (C, Slk_Label, "slk_label"); + function Slk_Label (Label : C_Int) return chars_ptr; + pragma Import (C, Slk_Label, "slk_label"); begin - Fill_String (Slk_Label (C_Int (Label)), Text); - end Get_Soft_Label_Key; + Fill_String (Slk_Label (C_Int (Label)), Text); + end Get_Soft_Label_Key; - function Get_Soft_Label_Key (Label : in Label_Number) return String + function Get_Soft_Label_Key (Label : in Label_Number) return String is - function Slk_Label (Label : C_Int) return chars_ptr; - pragma Import (C, Slk_Label, "slk_label"); + function Slk_Label (Label : C_Int) return chars_ptr; + pragma Import (C, Slk_Label, "slk_label"); begin - return Fill_String (Slk_Label (C_Int (Label))); - end Get_Soft_Label_Key; + return Fill_String (Slk_Label (C_Int (Label))); + end Get_Soft_Label_Key; - procedure Clear_Soft_Label_Keys + procedure Clear_Soft_Label_Keys is - function Slk_Clear return C_Int; - pragma Import (C, Slk_Clear, "slk_clear"); + function Slk_Clear return C_Int; + pragma Import (C, Slk_Clear, "slk_clear"); begin - if Slk_Clear = Curses_Err then - raise Curses_Exception; + if Slk_Clear = Curses_Err then + raise Curses_Exception; end if; - end Clear_Soft_Label_Keys; + end Clear_Soft_Label_Keys; - procedure Restore_Soft_Label_Keys + procedure Restore_Soft_Label_Keys is - function Slk_Restore return C_Int; - pragma Import (C, Slk_Restore, "slk_restore"); + function Slk_Restore return C_Int; + pragma Import (C, Slk_Restore, "slk_restore"); begin - if Slk_Restore = Curses_Err then - raise Curses_Exception; + if Slk_Restore = Curses_Err then + raise Curses_Exception; end if; - end Restore_Soft_Label_Keys; + end Restore_Soft_Label_Keys; - procedure Touch_Soft_Label_Keys + procedure Touch_Soft_Label_Keys is - function Slk_Touch return C_Int; - pragma Import (C, Slk_Touch, "slk_touch"); + function Slk_Touch return C_Int; + pragma Import (C, Slk_Touch, "slk_touch"); begin - if Slk_Touch = Curses_Err then - raise Curses_Exception; + if Slk_Touch = Curses_Err then + raise Curses_Exception; end if; - end Touch_Soft_Label_Keys; + end Touch_Soft_Label_Keys; - procedure Switch_Soft_Label_Key_Attributes - (Attr : in Character_Attribute_Set; - On : in Boolean := True) + procedure Switch_Soft_Label_Key_Attributes + (Attr : in Character_Attribute_Set; + On : in Boolean := True) is - function Slk_Attron (Ch : C_Chtype) return C_Int; - pragma Import (C, Slk_Attron, "slk_attron"); - function Slk_Attroff (Ch : C_Chtype) return C_Int; - pragma Import (C, Slk_Attroff, "slk_attroff"); + function Slk_Attron (Ch : C_Chtype) return C_Int; + pragma Import (C, Slk_Attron, "slk_attron"); + function Slk_Attroff (Ch : C_Chtype) return C_Int; + pragma Import (C, Slk_Attroff, "slk_attroff"); - Err : C_Int; - Ch : constant Attributed_Character := (Ch => Character'First, - Attr => Attr, - Color => Color_Pair'First); + Err : C_Int; + Ch : constant Attributed_Character := (Ch => Character'First, + Attr => Attr, + Color => Color_Pair'First); begin - if On then - Err := Slk_Attron (AttrChar_To_Chtype (Ch)); + if On then + Err := Slk_Attron (AttrChar_To_Chtype (Ch)); else - Err := Slk_Attroff (AttrChar_To_Chtype (Ch)); + Err := Slk_Attroff (AttrChar_To_Chtype (Ch)); end if; - if Err = Curses_Err then - raise Curses_Exception; + if Err = Curses_Err then + raise Curses_Exception; end if; - end Switch_Soft_Label_Key_Attributes; + end Switch_Soft_Label_Key_Attributes; - procedure Set_Soft_Label_Key_Attributes - (Attr : in Character_Attribute_Set := Normal_Video; - Color : in Color_Pair := Color_Pair'First) + procedure Set_Soft_Label_Key_Attributes + (Attr : in Character_Attribute_Set := Normal_Video; + Color : in Color_Pair := Color_Pair'First) is - function Slk_Attrset (Ch : C_Chtype) return C_Int; - pragma Import (C, Slk_Attrset, "slk_attrset"); + function Slk_Attrset (Ch : C_Chtype) return C_Int; + pragma Import (C, Slk_Attrset, "slk_attrset"); - Ch : constant Attributed_Character := (Ch => Character'First, - Attr => Attr, - Color => Color); + Ch : constant Attributed_Character := (Ch => Character'First, + Attr => Attr, + Color => Color); begin - if Slk_Attrset (AttrChar_To_Chtype (Ch)) = Curses_Err then - raise Curses_Exception; + if Slk_Attrset (AttrChar_To_Chtype (Ch)) = Curses_Err then + raise Curses_Exception; end if; - end Set_Soft_Label_Key_Attributes; + end Set_Soft_Label_Key_Attributes; - function Get_Soft_Label_Key_Attributes return Character_Attribute_Set + function Get_Soft_Label_Key_Attributes return Character_Attribute_Set is - function Slk_Attr return C_Chtype; - pragma Import (C, Slk_Attr, "slk_attr"); + function Slk_Attr return C_Chtype; + pragma Import (C, Slk_Attr, "slk_attr"); - Attr : constant C_Chtype := Slk_Attr; + Attr : constant C_Chtype := Slk_Attr; begin - return Chtype_To_AttrChar (Attr).Attr; - end Get_Soft_Label_Key_Attributes; + return Chtype_To_AttrChar (Attr).Attr; + end Get_Soft_Label_Key_Attributes; - function Get_Soft_Label_Key_Attributes return Color_Pair + function Get_Soft_Label_Key_Attributes return Color_Pair is - function Slk_Attr return C_Chtype; - pragma Import (C, Slk_Attr, "slk_attr"); + function Slk_Attr return C_Chtype; + pragma Import (C, Slk_Attr, "slk_attr"); - Attr : constant C_Chtype := Slk_Attr; + Attr : constant C_Chtype := Slk_Attr; begin - return Chtype_To_AttrChar (Attr).Color; - end Get_Soft_Label_Key_Attributes; + return Chtype_To_AttrChar (Attr).Color; + end Get_Soft_Label_Key_Attributes; - procedure Set_Soft_Label_Key_Color (Pair : in Color_Pair) + procedure Set_Soft_Label_Key_Color (Pair : in Color_Pair) is - function Slk_Color (Color : in C_Short) return C_Int; - pragma Import (C, Slk_Color, "slk_color"); + function Slk_Color (Color : in C_Short) return C_Int; + pragma Import (C, Slk_Color, "slk_color"); begin - if Slk_Color (C_Short (Pair)) = Curses_Err then - raise Curses_Exception; + if Slk_Color (C_Short (Pair)) = Curses_Err then + raise Curses_Exception; end if; - end Set_Soft_Label_Key_Color; + end Set_Soft_Label_Key_Color; ------------------------------------------------------------------------------ - procedure Enable_Key (Key : in Special_Key_Code; - Enable : in Boolean := True) + procedure Enable_Key (Key : in Special_Key_Code; + Enable : in Boolean := True) is - function Keyok (Keycode : C_Int; - On_Off : Curses_Bool) return C_Int; - pragma Import (C, Keyok, "keyok"); + function Keyok (Keycode : C_Int; + On_Off : Curses_Bool) return C_Int; + pragma Import (C, Keyok, "keyok"); begin - if Keyok (C_Int (Key), Curses_Bool (Boolean'Pos (Enable))) - = Curses_Err then - raise Curses_Exception; + if Keyok (C_Int (Key), Curses_Bool (Boolean'Pos (Enable))) + = Curses_Err then + raise Curses_Exception; end if; - end Enable_Key; + end Enable_Key; ------------------------------------------------------------------------------ - procedure Define_Key (Definition : in String; - Key : in Special_Key_Code) + procedure Define_Key (Definition : in String; + Key : in Special_Key_Code) is - function Defkey (Def : char_array; - Key : C_Int) return C_Int; - pragma Import (C, Defkey, "define_key"); + function Defkey (Def : char_array; + Key : C_Int) return C_Int; + pragma Import (C, Defkey, "define_key"); - Txt : char_array (0 .. Definition'Length); - Length : size_t; + Txt : char_array (0 .. Definition'Length); + Length : size_t; begin - To_C (Definition, Txt, Length); - if Defkey (Txt, C_Int (Key)) = Curses_Err then - raise Curses_Exception; + To_C (Definition, Txt, Length); + if Defkey (Txt, C_Int (Key)) = Curses_Err then + raise Curses_Exception; end if; - end Define_Key; + end Define_Key; ------------------------------------------------------------------------------ - procedure Un_Control (Ch : in Attributed_Character; - Str : out String) + procedure Un_Control (Ch : in Attributed_Character; + Str : out String) is - function Unctrl (Ch : C_Chtype) return chars_ptr; - pragma Import (C, Unctrl, "unctrl"); + function Unctrl (Ch : C_Chtype) return chars_ptr; + pragma Import (C, Unctrl, "unctrl"); begin - Fill_String (Unctrl (AttrChar_To_Chtype (Ch)), Str); - end Un_Control; + Fill_String (Unctrl (AttrChar_To_Chtype (Ch)), Str); + end Un_Control; - function Un_Control (Ch : in Attributed_Character) return String + function Un_Control (Ch : in Attributed_Character) return String is - function Unctrl (Ch : C_Chtype) return chars_ptr; - pragma Import (C, Unctrl, "unctrl"); + function Unctrl (Ch : C_Chtype) return chars_ptr; + pragma Import (C, Unctrl, "unctrl"); begin - return Fill_String (Unctrl (AttrChar_To_Chtype (Ch))); - end Un_Control; + return Fill_String (Unctrl (AttrChar_To_Chtype (Ch))); + end Un_Control; - procedure Delay_Output (Msecs : in Natural) + procedure Delay_Output (Msecs : in Natural) is - function Delayoutput (Msecs : C_Int) return C_Int; - pragma Import (C, Delayoutput, "delay_output"); + function Delayoutput (Msecs : C_Int) return C_Int; + pragma Import (C, Delayoutput, "delay_output"); begin - if Delayoutput (C_Int (Msecs)) = Curses_Err then - raise Curses_Exception; + if Delayoutput (C_Int (Msecs)) = Curses_Err then + raise Curses_Exception; end if; - end Delay_Output; + end Delay_Output; - procedure Flush_Input + procedure Flush_Input is - function Flushinp return C_Int; - pragma Import (C, Flushinp, "flushinp"); + function Flushinp return C_Int; + pragma Import (C, Flushinp, "flushinp"); begin - if Flushinp = Curses_Err then -- docu says that never happens, but... - raise Curses_Exception; + if Flushinp = Curses_Err then -- docu says that never happens, but... + raise Curses_Exception; end if; - end Flush_Input; + end Flush_Input; ------------------------------------------------------------------------------ - function Baudrate return Natural + function Baudrate return Natural is - function Baud return C_Int; - pragma Import (C, Baud, "baudrate"); + function Baud return C_Int; + pragma Import (C, Baud, "baudrate"); begin - return Natural (Baud); - end Baudrate; + return Natural (Baud); + end Baudrate; - function Erase_Character return Character + function Erase_Character return Character is - function Erasechar return C_Int; - pragma Import (C, Erasechar, "erasechar"); + function Erasechar return C_Int; + pragma Import (C, Erasechar, "erasechar"); begin - return Character'Val (Erasechar); - end Erase_Character; + return Character'Val (Erasechar); + end Erase_Character; - function Kill_Character return Character + function Kill_Character return Character is - function Killchar return C_Int; - pragma Import (C, Killchar, "killchar"); + function Killchar return C_Int; + pragma Import (C, Killchar, "killchar"); begin - return Character'Val (Killchar); - end Kill_Character; + return Character'Val (Killchar); + end Kill_Character; - function Has_Insert_Character return Boolean + function Has_Insert_Character return Boolean is - function Has_Ic return Curses_Bool; - pragma Import (C, Has_Ic, "has_ic"); + function Has_Ic return Curses_Bool; + pragma Import (C, Has_Ic, "has_ic"); begin - if Has_Ic = Curses_Bool_False then + if Has_Ic = Curses_Bool_False then return False; else return True; end if; - end Has_Insert_Character; + end Has_Insert_Character; - function Has_Insert_Line return Boolean + function Has_Insert_Line return Boolean is - function Has_Il return Curses_Bool; - pragma Import (C, Has_Il, "has_il"); + function Has_Il return Curses_Bool; + pragma Import (C, Has_Il, "has_il"); begin - if Has_Il = Curses_Bool_False then + if Has_Il = Curses_Bool_False then return False; else return True; end if; - end Has_Insert_Line; + end Has_Insert_Line; - function Supported_Attributes return Character_Attribute_Set + function Supported_Attributes return Character_Attribute_Set is - function Termattrs return C_Chtype; - pragma Import (C, Termattrs, "termattrs"); + function Termattrs return C_Chtype; + pragma Import (C, Termattrs, "termattrs"); - Ch : constant Attributed_Character := Chtype_To_AttrChar (Termattrs); + Ch : constant Attributed_Character := Chtype_To_AttrChar (Termattrs); begin - return Ch.Attr; - end Supported_Attributes; + return Ch.Attr; + end Supported_Attributes; - procedure Long_Name (Name : out String) + procedure Long_Name (Name : out String) is - function Longname return chars_ptr; - pragma Import (C, Longname, "longname"); + function Longname return chars_ptr; + pragma Import (C, Longname, "longname"); begin - Fill_String (Longname, Name); - end Long_Name; + Fill_String (Longname, Name); + end Long_Name; - function Long_Name return String + function Long_Name return String is - function Longname return chars_ptr; - pragma Import (C, Longname, "longname"); + function Longname return chars_ptr; + pragma Import (C, Longname, "longname"); begin - return Fill_String (Longname); - end Long_Name; + return Fill_String (Longname); + end Long_Name; - procedure Terminal_Name (Name : out String) + procedure Terminal_Name (Name : out String) is - function Termname return chars_ptr; - pragma Import (C, Termname, "termname"); + function Termname return chars_ptr; + pragma Import (C, Termname, "termname"); begin - Fill_String (Termname, Name); - end Terminal_Name; + Fill_String (Termname, Name); + end Terminal_Name; - function Terminal_Name return String + function Terminal_Name return String is - function Termname return chars_ptr; - pragma Import (C, Termname, "termname"); + function Termname return chars_ptr; + pragma Import (C, Termname, "termname"); begin - return Fill_String (Termname); - end Terminal_Name; + return Fill_String (Termname); + end Terminal_Name; ------------------------------------------------------------------------------ - procedure Init_Pair (Pair : in Redefinable_Color_Pair; - Fore : in Color_Number; - Back : in Color_Number) + procedure Init_Pair (Pair : in Redefinable_Color_Pair; + Fore : in Color_Number; + Back : in Color_Number) is - function Initpair (Pair : C_Short; - Fore : C_Short; - Back : C_Short) return C_Int; - pragma Import (C, Initpair, "init_pair"); + function Initpair (Pair : C_Short; + Fore : C_Short; + Back : C_Short) return C_Int; + pragma Import (C, Initpair, "init_pair"); begin - if Integer (Pair) >= Number_Of_Color_Pairs then + if Integer (Pair) >= Number_Of_Color_Pairs then raise Constraint_Error; end if; - if Integer (Fore) >= Number_Of_Colors or else - Integer (Back) >= Number_Of_Colors then raise Constraint_Error; + if Integer (Fore) >= Number_Of_Colors or else + Integer (Back) >= Number_Of_Colors then raise Constraint_Error; end if; - if Initpair (C_Short (Pair), C_Short (Fore), C_Short (Back)) - = Curses_Err then - raise Curses_Exception; + if Initpair (C_Short (Pair), C_Short (Fore), C_Short (Back)) + = Curses_Err then + raise Curses_Exception; end if; - end Init_Pair; + end Init_Pair; - procedure Pair_Content (Pair : in Color_Pair; - Fore : out Color_Number; - Back : out Color_Number) + procedure Pair_Content (Pair : in Color_Pair; + Fore : out Color_Number; + Back : out Color_Number) is - type C_Short_Access is access all C_Short; - function Paircontent (Pair : C_Short; - Fp : C_Short_Access; - Bp : C_Short_Access) return C_Int; - pragma Import (C, Paircontent, "pair_content"); + type C_Short_Access is access all C_Short; + function Paircontent (Pair : C_Short; + Fp : C_Short_Access; + Bp : C_Short_Access) return C_Int; + pragma Import (C, Paircontent, "pair_content"); - F, B : aliased C_Short; + F, B : aliased C_Short; begin - if Paircontent (C_Short (Pair), F'Access, B'Access) = Curses_Err then - raise Curses_Exception; + if Paircontent (C_Short (Pair), F'Access, B'Access) = Curses_Err then + raise Curses_Exception; else - Fore := Color_Number (F); - Back := Color_Number (B); + Fore := Color_Number (F); + Back := Color_Number (B); end if; - end Pair_Content; + end Pair_Content; - function Has_Colors return Boolean + function Has_Colors return Boolean is - function Hascolors return Curses_Bool; - pragma Import (C, Hascolors, "has_colors"); + function Hascolors return Curses_Bool; + pragma Import (C, Hascolors, "has_colors"); begin - if Hascolors = Curses_Bool_False then + if Hascolors = Curses_Bool_False then return False; else return True; end if; - end Has_Colors; + end Has_Colors; - procedure Init_Color (Color : in Color_Number; - Red : in RGB_Value; - Green : in RGB_Value; - Blue : in RGB_Value) + procedure Init_Color (Color : in Color_Number; + Red : in RGB_Value; + Green : in RGB_Value; + Blue : in RGB_Value) is - function Initcolor (Col : C_Short; - Red : C_Short; - Green : C_Short; - Blue : C_Short) return C_Int; - pragma Import (C, Initcolor, "init_color"); + function Initcolor (Col : C_Short; + Red : C_Short; + Green : C_Short; + Blue : C_Short) return C_Int; + pragma Import (C, Initcolor, "init_color"); begin - if Initcolor (C_Short (Color), C_Short (Red), C_Short (Green), - C_Short (Blue)) = Curses_Err then - raise Curses_Exception; + if Initcolor (C_Short (Color), C_Short (Red), C_Short (Green), + C_Short (Blue)) = Curses_Err then + raise Curses_Exception; end if; - end Init_Color; + end Init_Color; - function Can_Change_Color return Boolean + function Can_Change_Color return Boolean is - function Canchangecolor return Curses_Bool; - pragma Import (C, Canchangecolor, "can_change_color"); + function Canchangecolor return Curses_Bool; + pragma Import (C, Canchangecolor, "can_change_color"); begin - if Canchangecolor = Curses_Bool_False then + if Canchangecolor = Curses_Bool_False then return False; else return True; end if; - end Can_Change_Color; + end Can_Change_Color; - procedure Color_Content (Color : in Color_Number; - Red : out RGB_Value; - Green : out RGB_Value; - Blue : out RGB_Value) + procedure Color_Content (Color : in Color_Number; + Red : out RGB_Value; + Green : out RGB_Value; + Blue : out RGB_Value) is - type C_Short_Access is access all C_Short; + type C_Short_Access is access all C_Short; - function Colorcontent (Color : C_Short; R, G, B : C_Short_Access) - return C_Int; - pragma Import (C, Colorcontent, "color_content"); + function Colorcontent (Color : C_Short; R, G, B : C_Short_Access) + return C_Int; + pragma Import (C, Colorcontent, "color_content"); - R, G, B : aliased C_Short; + R, G, B : aliased C_Short; begin - if Colorcontent (C_Short (Color), R'Access, G'Access, B'Access) = - Curses_Err then - raise Curses_Exception; + if Colorcontent (C_Short (Color), R'Access, G'Access, B'Access) = + Curses_Err then + raise Curses_Exception; else - Red := RGB_Value (R); - Green := RGB_Value (G); - Blue := RGB_Value (B); + Red := RGB_Value (R); + Green := RGB_Value (G); + Blue := RGB_Value (B); end if; - end Color_Content; + end Color_Content; ------------------------------------------------------------------------------ - procedure Save_Curses_Mode (Mode : in Curses_Mode) + procedure Save_Curses_Mode (Mode : in Curses_Mode) is - function Def_Prog_Mode return C_Int; - pragma Import (C, Def_Prog_Mode, "def_prog_mode"); - function Def_Shell_Mode return C_Int; - pragma Import (C, Def_Shell_Mode, "def_shell_mode"); + function Def_Prog_Mode return C_Int; + pragma Import (C, Def_Prog_Mode, "def_prog_mode"); + function Def_Shell_Mode return C_Int; + pragma Import (C, Def_Shell_Mode, "def_shell_mode"); - Err : C_Int; + Err : C_Int; begin - case Mode is - when Curses => Err := Def_Prog_Mode; - when Shell => Err := Def_Shell_Mode; + case Mode is + when Curses => Err := Def_Prog_Mode; + when Shell => Err := Def_Shell_Mode; end case; - if Err = Curses_Err then - raise Curses_Exception; + if Err = Curses_Err then + raise Curses_Exception; end if; - end Save_Curses_Mode; + end Save_Curses_Mode; - procedure Reset_Curses_Mode (Mode : in Curses_Mode) + procedure Reset_Curses_Mode (Mode : in Curses_Mode) is - function Reset_Prog_Mode return C_Int; - pragma Import (C, Reset_Prog_Mode, "reset_prog_mode"); - function Reset_Shell_Mode return C_Int; - pragma Import (C, Reset_Shell_Mode, "reset_shell_mode"); + function Reset_Prog_Mode return C_Int; + pragma Import (C, Reset_Prog_Mode, "reset_prog_mode"); + function Reset_Shell_Mode return C_Int; + pragma Import (C, Reset_Shell_Mode, "reset_shell_mode"); - Err : C_Int; + Err : C_Int; begin - case Mode is - when Curses => Err := Reset_Prog_Mode; - when Shell => Err := Reset_Shell_Mode; + case Mode is + when Curses => Err := Reset_Prog_Mode; + when Shell => Err := Reset_Shell_Mode; end case; - if Err = Curses_Err then - raise Curses_Exception; + if Err = Curses_Err then + raise Curses_Exception; end if; - end Reset_Curses_Mode; + end Reset_Curses_Mode; - procedure Save_Terminal_State + procedure Save_Terminal_State is - function Savetty return C_Int; - pragma Import (C, Savetty, "savetty"); + function Savetty return C_Int; + pragma Import (C, Savetty, "savetty"); begin - if Savetty = Curses_Err then - raise Curses_Exception; + if Savetty = Curses_Err then + raise Curses_Exception; end if; - end Save_Terminal_State; + end Save_Terminal_State; - procedure Reset_Terminal_State + procedure Reset_Terminal_State is - function Resetty return C_Int; - pragma Import (C, Resetty, "resetty"); + function Resetty return C_Int; + pragma Import (C, Resetty, "resetty"); begin - if Resetty = Curses_Err then - raise Curses_Exception; + if Resetty = Curses_Err then + raise Curses_Exception; end if; - end Reset_Terminal_State; + end Reset_Terminal_State; - procedure Rip_Off_Lines (Lines : in Integer; - Proc : in Stdscr_Init_Proc) + procedure Rip_Off_Lines (Lines : in Integer; + Proc : in Stdscr_Init_Proc) is - function Ripoffline (Lines : C_Int; - Proc : Stdscr_Init_Proc) return C_Int; - pragma Import (C, Ripoffline, "_nc_ripoffline"); + function Ripoffline (Lines : C_Int; + Proc : Stdscr_Init_Proc) return C_Int; + pragma Import (C, Ripoffline, "_nc_ripoffline"); begin - if Ripoffline (C_Int (Lines), Proc) = Curses_Err then - raise Curses_Exception; + if Ripoffline (C_Int (Lines), Proc) = Curses_Err then + raise Curses_Exception; end if; - end Rip_Off_Lines; + end Rip_Off_Lines; - procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility) + procedure Set_Cursor_Visibility (Visibility : in out Cursor_Visibility) is - function Curs_Set (Curs : C_Int) return C_Int; - pragma Import (C, Curs_Set, "curs_set"); + function Curs_Set (Curs : C_Int) return C_Int; + pragma Import (C, Curs_Set, "curs_set"); - Res : C_Int; + Res : C_Int; begin - Res := Curs_Set (Cursor_Visibility'Pos (Visibility)); - if Res /= Curses_Err then - Visibility := Cursor_Visibility'Val (Res); + Res := Curs_Set (Cursor_Visibility'Pos (Visibility)); + if Res /= Curses_Err then + Visibility := Cursor_Visibility'Val (Res); end if; - end Set_Cursor_Visibility; + end Set_Cursor_Visibility; - procedure Nap_Milli_Seconds (Ms : in Natural) + procedure Nap_Milli_Seconds (Ms : in Natural) is - function Napms (Ms : C_Int) return C_Int; - pragma Import (C, Napms, "napms"); + function Napms (Ms : C_Int) return C_Int; + pragma Import (C, Napms, "napms"); begin - if Napms (C_Int (Ms)) = Curses_Err then - raise Curses_Exception; + if Napms (C_Int (Ms)) = Curses_Err then + raise Curses_Exception; end if; - end Nap_Milli_Seconds; + end Nap_Milli_Seconds; ------------------------------------------------------------------------------ - function Standard_Window return Window + function Standard_Window return Window is - Stdscr : Window; - pragma Import (C, Stdscr, "stdscr"); + Stdscr : Window; + pragma Import (C, Stdscr, "stdscr"); begin - return Stdscr; - end Standard_Window; + return Stdscr; + end Standard_Window; - function Lines return Line_Count + function Lines return Line_Count is - C_Lines : C_Int; - pragma Import (C, C_Lines, "LINES"); + C_Lines : C_Int; + pragma Import (C, C_Lines, "LINES"); begin - return Line_Count (C_Lines); - end Lines; + return Line_Count (C_Lines); + end Lines; - function Columns return Column_Count + function Columns return Column_Count is - C_Columns : C_Int; - pragma Import (C, C_Columns, "COLS"); + C_Columns : C_Int; + pragma Import (C, C_Columns, "COLS"); begin - return Column_Count (C_Columns); - end Columns; + return Column_Count (C_Columns); + end Columns; - function Tab_Size return Natural + function Tab_Size return Natural is - C_Tab_Size : C_Int; - pragma Import (C, C_Tab_Size, "TABSIZE"); + C_Tab_Size : C_Int; + pragma Import (C, C_Tab_Size, "TABSIZE"); begin - return Natural (C_Tab_Size); - end Tab_Size; + return Natural (C_Tab_Size); + end Tab_Size; - function Number_Of_Colors return Natural + function Number_Of_Colors return Natural is - C_Number_Of_Colors : C_Int; - pragma Import (C, C_Number_Of_Colors, "COLORS"); + C_Number_Of_Colors : C_Int; + pragma Import (C, C_Number_Of_Colors, "COLORS"); begin - return Natural (C_Number_Of_Colors); - end Number_Of_Colors; + return Natural (C_Number_Of_Colors); + end Number_Of_Colors; - function Number_Of_Color_Pairs return Natural + function Number_Of_Color_Pairs return Natural is - C_Number_Of_Color_Pairs : C_Int; - pragma Import (C, C_Number_Of_Color_Pairs, "COLOR_PAIRS"); + C_Number_Of_Color_Pairs : C_Int; + pragma Import (C, C_Number_Of_Color_Pairs, "COLOR_PAIRS"); begin - return Natural (C_Number_Of_Color_Pairs); - end Number_Of_Color_Pairs; + return Natural (C_Number_Of_Color_Pairs); + end Number_Of_Color_Pairs; ------------------------------------------------------------------------------ - procedure Transform_Coordinates - (W : in Window := Standard_Window; - Line : in out Line_Position; - Column : in out Column_Position; - Dir : in Transform_Direction := From_Screen) - is - type Int_Access is access all C_Int; - function Transform (W : Window; - Y, X : Int_Access; - Dir : Curses_Bool) return C_Int; - pragma Import (C, Transform, "wmouse_trafo"); - - X : aliased C_Int := C_Int (Column); - Y : aliased C_Int := C_Int (Line); - D : Curses_Bool := Curses_Bool_False; - R : C_Int; - begin - if Dir = To_Screen then - D := 1; - end if; - R := Transform (W, Y'Access, X'Access, D); - if R = Curses_False then - raise Curses_Exception; + procedure Transform_Coordinates + (W : in Window := Standard_Window; + Line : in out Line_Position; + Column : in out Column_Position; + Dir : in Transform_Direction := From_Screen) + is + type Int_Access is access all C_Int; + function Transform (W : Window; + Y, X : Int_Access; + Dir : Curses_Bool) return C_Int; + pragma Import (C, Transform, "wmouse_trafo"); + + X : aliased C_Int := C_Int (Column); + Y : aliased C_Int := C_Int (Line); + D : Curses_Bool := Curses_Bool_False; + R : C_Int; + begin + if Dir = To_Screen then + D := 1; + end if; + R := Transform (W, Y'Access, X'Access, D); + if R = Curses_False then + raise Curses_Exception; else - Line := Line_Position (Y); - Column := Column_Position (X); + Line := Line_Position (Y); + Column := Column_Position (X); end if; - end Transform_Coordinates; + end Transform_Coordinates; ------------------------------------------------------------------------------ - procedure Use_Default_Colors is - function C_Use_Default_Colors return C_Int; - pragma Import (C, C_Use_Default_Colors, "use_default_colors"); - Err : constant C_Int := C_Use_Default_Colors; + procedure Use_Default_Colors is + function C_Use_Default_Colors return C_Int; + pragma Import (C, C_Use_Default_Colors, "use_default_colors"); + Err : constant C_Int := C_Use_Default_Colors; begin - if Err = Curses_Err then - raise Curses_Exception; + if Err = Curses_Err then + raise Curses_Exception; end if; - end Use_Default_Colors; + end Use_Default_Colors; - procedure Assume_Default_Colors (Fore : Color_Number := Default_Color; - Back : Color_Number := Default_Color) + procedure Assume_Default_Colors (Fore : Color_Number := Default_Color; + Back : Color_Number := Default_Color) is - function C_Assume_Default_Colors (Fore : C_Int; - Back : C_Int) return C_Int; - pragma Import (C, C_Assume_Default_Colors, "assume_default_colors"); + function C_Assume_Default_Colors (Fore : C_Int; + Back : C_Int) return C_Int; + pragma Import (C, C_Assume_Default_Colors, "assume_default_colors"); - Err : constant C_Int := C_Assume_Default_Colors (C_Int (Fore), - C_Int (Black)); + Err : constant C_Int := C_Assume_Default_Colors (C_Int (Fore), + C_Int (Back)); begin - if Err = Curses_Err then - raise Curses_Exception; + if Err = Curses_Err then + raise Curses_Exception; end if; - end Assume_Default_Colors; + end Assume_Default_Colors; ------------------------------------------------------------------------------ - function Curses_Version return String + function Curses_Version return String is - function curses_versionC return chars_ptr; - pragma Import (C, curses_versionC, "curses_version"); - Result : constant chars_ptr := curses_versionC; + function curses_versionC return chars_ptr; + pragma Import (C, curses_versionC, "curses_version"); + Result : constant chars_ptr := curses_versionC; begin - return Fill_String (Result); - end Curses_Version; + return Fill_String (Result); + end Curses_Version; ------------------------------------------------------------------------------ - function Use_Extended_Names (Enable : Boolean) return Boolean + function Use_Extended_Names (Enable : Boolean) return Boolean is - function use_extended_namesC (e : Curses_Bool) return C_Int; - pragma Import (C, use_extended_namesC, "use_extended_names"); + function use_extended_namesC (e : Curses_Bool) return C_Int; + pragma Import (C, use_extended_namesC, "use_extended_names"); - Res : constant C_Int := - use_extended_namesC (Curses_Bool (Boolean'Pos (Enable))); + Res : constant C_Int := + use_extended_namesC (Curses_Bool (Boolean'Pos (Enable))); begin - if Res = C_Int (Curses_Bool_False) then + if Res = C_Int (Curses_Bool_False) then return False; else return True; end if; - end Use_Extended_Names; + end Use_Extended_Names; ------------------------------------------------------------------------------ - procedure Screen_Dump_To_File (Filename : in String) + procedure Screen_Dump_To_File (Filename : in String) is - function scr_dump (f : char_array) return C_Int; - pragma Import (C, scr_dump, "scr_dump"); - Txt : char_array (0 .. Filename'Length); - Length : size_t; + function scr_dump (f : char_array) return C_Int; + pragma Import (C, scr_dump, "scr_dump"); + Txt : char_array (0 .. Filename'Length); + Length : size_t; begin - To_C (Filename, Txt, Length); - if Curses_Err = scr_dump (Txt) then - raise Curses_Exception; + To_C (Filename, Txt, Length); + if Curses_Err = scr_dump (Txt) then + raise Curses_Exception; end if; - end Screen_Dump_To_File; + end Screen_Dump_To_File; - procedure Screen_Restore_From_File (Filename : in String) + procedure Screen_Restore_From_File (Filename : in String) is - function scr_restore (f : char_array) return C_Int; - pragma Import (C, scr_restore, "scr_restore"); - Txt : char_array (0 .. Filename'Length); - Length : size_t; + function scr_restore (f : char_array) return C_Int; + pragma Import (C, scr_restore, "scr_restore"); + Txt : char_array (0 .. Filename'Length); + Length : size_t; begin - To_C (Filename, Txt, Length); - if Curses_Err = scr_restore (Txt) then - raise Curses_Exception; + To_C (Filename, Txt, Length); + if Curses_Err = scr_restore (Txt) then + raise Curses_Exception; end if; - end Screen_Restore_From_File; + end Screen_Restore_From_File; - procedure Screen_Init_From_File (Filename : in String) + procedure Screen_Init_From_File (Filename : in String) is - function scr_init (f : char_array) return C_Int; - pragma Import (C, scr_init, "scr_init"); - Txt : char_array (0 .. Filename'Length); - Length : size_t; + function scr_init (f : char_array) return C_Int; + pragma Import (C, scr_init, "scr_init"); + Txt : char_array (0 .. Filename'Length); + Length : size_t; begin - To_C (Filename, Txt, Length); - if Curses_Err = scr_init (Txt) then - raise Curses_Exception; + To_C (Filename, Txt, Length); + if Curses_Err = scr_init (Txt) then + raise Curses_Exception; end if; - end Screen_Init_From_File; + end Screen_Init_From_File; - procedure Screen_Set_File (Filename : in String) + procedure Screen_Set_File (Filename : in String) is - function scr_set (f : char_array) return C_Int; - pragma Import (C, scr_set, "scr_set"); - Txt : char_array (0 .. Filename'Length); - Length : size_t; + function scr_set (f : char_array) return C_Int; + pragma Import (C, scr_set, "scr_set"); + Txt : char_array (0 .. Filename'Length); + Length : size_t; begin - To_C (Filename, Txt, Length); - if Curses_Err = scr_set (Txt) then - raise Curses_Exception; + To_C (Filename, Txt, Length); + if Curses_Err = scr_set (Txt) then + raise Curses_Exception; end if; - end Screen_Set_File; + end Screen_Set_File; ------------------------------------------------------------------------------ - procedure Resize (Win : Window := Standard_Window; - Number_Of_Lines : Line_Count; - Number_Of_Columns : Column_Count) is - function wresize (win : Window; - lines : C_Int; - columns : C_Int) return C_Int; - pragma Import (C, wresize); - begin - if wresize (Win, - C_Int (Number_Of_Lines), - C_Int (Number_Of_Columns)) = Curses_Err then - raise Curses_Exception; - end if; - end Resize; + procedure Resize (Win : Window := Standard_Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count) is + function wresize (win : Window; + lines : C_Int; + columns : C_Int) return C_Int; + pragma Import (C, wresize); + begin + if wresize (Win, + C_Int (Number_Of_Lines), + C_Int (Number_Of_Columns)) = Curses_Err then + raise Curses_Exception; + end if; + end Resize; ------------------------------------------------------------------------------ -end Terminal_Interface.Curses; +end Terminal_Interface.Curses; diff --git a/doc/html/ada/terminal_interface-curses__ads.htm b/doc/html/ada/terminal_interface-curses__ads.htm index b45b93c8..42d64753 100644 --- a/doc/html/ada/terminal_interface-curses__ads.htm +++ b/doc/html/ada/terminal_interface-curses__ads.htm @@ -1,3 +1,4 @@ + terminal_interface-curses.ads

    File : terminal_interface-curses.ads


    @@ -12,7 +13,7 @@ -- S P E C -- -- -- ------------------------------------------------------------------------------ --- Copyright (c) 1998 Free Software Foundation, Inc. -- +-- Copyright (c) 1998,2004 Free Software Foundation, Inc. -- -- -- -- Permission is hereby granted, free of charge, to any person obtaining a -- -- copy of this software and associated documentation files (the -- @@ -40,28 +41,29 @@ ------------------------------------------------------------------------------ -- Author: Juergen Pfeifer, 1996 -- Version Control: --- @Revision: 1.31 @ +-- @Revision: 1.35 @ +-- @Date: 2004/08/21 21:37:00 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -- curses binding. -- This module is generated. Please don't change it manually! -- Run the generator instead. -- | -with System.Storage_Elements; +with System.Storage_Elements; with Interfaces.C; -- We need this for some assertions. package Terminal_Interface.Curses is pragma Preelaborate (Terminal_Interface.Curses); pragma Linker_Options ("-lncurses"); - NC_Major_Version : constant := 5; -- Major version of the library - NC_Minor_Version : constant := 3; -- Minor version of the library - NC_Version : constant String := "5.3"; -- Version of library + NC_Major_Version : constant := 5; -- Major version of the library + NC_Minor_Version : constant := 5; -- Minor version of the library + NC_Version : constant String := "5.5"; -- Version of library type Window is private; Null_Window : constant Window; - type Line_Position is new Natural; -- line coordinate + type Line_Position is new Natural; -- line coordinate type Column_Position is new Natural; -- column coordinate subtype Line_Count is Line_Position range 1 .. Line_Position'Last; @@ -69,11 +71,12 @@ subtype Column_Count is Column_Position range 1 .. Column_Position'Last; -- Type to count columns. We do not allow null windows, so must be positive - type Key_Code is new Natural; + type Key_Code is new Integer; -- That is anything including real characters, special keys and logical -- request codes. - subtype Real_Key_Code is Key_Code range 0 .. 8#777#; + -- FIXME: The "-1" should be Curses_Err + subtype Real_Key_Code is Key_Code range -1 .. 8#777#; -- This are the codes that potentially represent a real keystroke. -- Not all codes may be possible on a specific terminal. To check the -- availability of a special key, the Has_Key function is provided. @@ -88,123 +91,123 @@ -- Constants for function- and special keys -- - Key_None : constant Special_Key_Code := 8#400#; - Key_Code_Yes : constant Special_Key_Code := 8#400#; - Key_Min : constant Special_Key_Code := 8#401#; - Key_Break : constant Special_Key_Code := 8#401#; - Key_Cursor_Down : constant Special_Key_Code := 8#402#; - Key_Cursor_Up : constant Special_Key_Code := 8#403#; - Key_Cursor_Left : constant Special_Key_Code := 8#404#; - Key_Cursor_Right : constant Special_Key_Code := 8#405#; - Key_Home : constant Special_Key_Code := 8#406#; - Key_Backspace : constant Special_Key_Code := 8#407#; - Key_F0 : constant Special_Key_Code := 8#410#; - Key_F1 : constant Special_Key_Code := 8#411#; - Key_F2 : constant Special_Key_Code := 8#412#; - Key_F3 : constant Special_Key_Code := 8#413#; - Key_F4 : constant Special_Key_Code := 8#414#; - Key_F5 : constant Special_Key_Code := 8#415#; - Key_F6 : constant Special_Key_Code := 8#416#; - Key_F7 : constant Special_Key_Code := 8#417#; - Key_F8 : constant Special_Key_Code := 8#420#; - Key_F9 : constant Special_Key_Code := 8#421#; - Key_F10 : constant Special_Key_Code := 8#422#; - Key_F11 : constant Special_Key_Code := 8#423#; - Key_F12 : constant Special_Key_Code := 8#424#; - Key_F13 : constant Special_Key_Code := 8#425#; - Key_F14 : constant Special_Key_Code := 8#426#; - Key_F15 : constant Special_Key_Code := 8#427#; - Key_F16 : constant Special_Key_Code := 8#430#; - Key_F17 : constant Special_Key_Code := 8#431#; - Key_F18 : constant Special_Key_Code := 8#432#; - Key_F19 : constant Special_Key_Code := 8#433#; - Key_F20 : constant Special_Key_Code := 8#434#; - Key_F21 : constant Special_Key_Code := 8#435#; - Key_F22 : constant Special_Key_Code := 8#436#; - Key_F23 : constant Special_Key_Code := 8#437#; - Key_F24 : constant Special_Key_Code := 8#440#; - Key_Delete_Line : constant Special_Key_Code := 8#510#; - Key_Insert_Line : constant Special_Key_Code := 8#511#; - Key_Delete_Char : constant Special_Key_Code := 8#512#; - Key_Insert_Char : constant Special_Key_Code := 8#513#; - Key_Exit_Insert_Mode : constant Special_Key_Code := 8#514#; - Key_Clear_Screen : constant Special_Key_Code := 8#515#; - Key_Clear_End_Of_Screen : constant Special_Key_Code := 8#516#; - Key_Clear_End_Of_Line : constant Special_Key_Code := 8#517#; - Key_Scroll_1_Forward : constant Special_Key_Code := 8#520#; - Key_Scroll_1_Backward : constant Special_Key_Code := 8#521#; - Key_Next_Page : constant Special_Key_Code := 8#522#; - Key_Previous_Page : constant Special_Key_Code := 8#523#; - Key_Set_Tab : constant Special_Key_Code := 8#524#; - Key_Clear_Tab : constant Special_Key_Code := 8#525#; - Key_Clear_All_Tabs : constant Special_Key_Code := 8#526#; - Key_Enter_Or_Send : constant Special_Key_Code := 8#527#; - Key_Soft_Reset : constant Special_Key_Code := 8#530#; - Key_Reset : constant Special_Key_Code := 8#531#; - Key_Print : constant Special_Key_Code := 8#532#; - Key_Bottom : constant Special_Key_Code := 8#533#; - Key_Upper_Left_Of_Keypad : constant Special_Key_Code := 8#534#; - Key_Upper_Right_Of_Keypad : constant Special_Key_Code := 8#535#; - Key_Center_Of_Keypad : constant Special_Key_Code := 8#536#; - Key_Lower_Left_Of_Keypad : constant Special_Key_Code := 8#537#; - Key_Lower_Right_Of_Keypad : constant Special_Key_Code := 8#540#; - Key_Back_Tab : constant Special_Key_Code := 8#541#; - Key_Beginning : constant Special_Key_Code := 8#542#; - Key_Cancel : constant Special_Key_Code := 8#543#; - Key_Close : constant Special_Key_Code := 8#544#; - Key_Command : constant Special_Key_Code := 8#545#; - Key_Copy : constant Special_Key_Code := 8#546#; - Key_Create : constant Special_Key_Code := 8#547#; - Key_End : constant Special_Key_Code := 8#550#; - Key_Exit : constant Special_Key_Code := 8#551#; - Key_Find : constant Special_Key_Code := 8#552#; - Key_Help : constant Special_Key_Code := 8#553#; - Key_Mark : constant Special_Key_Code := 8#554#; - Key_Message : constant Special_Key_Code := 8#555#; - Key_Move : constant Special_Key_Code := 8#556#; - Key_Next : constant Special_Key_Code := 8#557#; - Key_Open : constant Special_Key_Code := 8#560#; - Key_Options : constant Special_Key_Code := 8#561#; - Key_Previous : constant Special_Key_Code := 8#562#; - Key_Redo : constant Special_Key_Code := 8#563#; - Key_Reference : constant Special_Key_Code := 8#564#; - Key_Refresh : constant Special_Key_Code := 8#565#; - Key_Replace : constant Special_Key_Code := 8#566#; - Key_Restart : constant Special_Key_Code := 8#567#; - Key_Resume : constant Special_Key_Code := 8#570#; - Key_Save : constant Special_Key_Code := 8#571#; - Key_Shift_Begin : constant Special_Key_Code := 8#572#; - Key_Shift_Cancel : constant Special_Key_Code := 8#573#; - Key_Shift_Command : constant Special_Key_Code := 8#574#; - Key_Shift_Copy : constant Special_Key_Code := 8#575#; - Key_Shift_Create : constant Special_Key_Code := 8#576#; - Key_Shift_Delete_Char : constant Special_Key_Code := 8#577#; - Key_Shift_Delete_Line : constant Special_Key_Code := 8#600#; - Key_Select : constant Special_Key_Code := 8#601#; - Key_Shift_End : constant Special_Key_Code := 8#602#; - Key_Shift_Clear_End_Of_Line : constant Special_Key_Code := 8#603#; - Key_Shift_Exit : constant Special_Key_Code := 8#604#; - Key_Shift_Find : constant Special_Key_Code := 8#605#; - Key_Shift_Help : constant Special_Key_Code := 8#606#; - Key_Shift_Home : constant Special_Key_Code := 8#607#; - Key_Shift_Insert_Char : constant Special_Key_Code := 8#610#; - Key_Shift_Cursor_Left : constant Special_Key_Code := 8#611#; - Key_Shift_Message : constant Special_Key_Code := 8#612#; - Key_Shift_Move : constant Special_Key_Code := 8#613#; - Key_Shift_Next_Page : constant Special_Key_Code := 8#614#; - Key_Shift_Options : constant Special_Key_Code := 8#615#; - Key_Shift_Previous_Page : constant Special_Key_Code := 8#616#; - Key_Shift_Print : constant Special_Key_Code := 8#617#; - Key_Shift_Redo : constant Special_Key_Code := 8#620#; - Key_Shift_Replace : constant Special_Key_Code := 8#621#; - Key_Shift_Cursor_Right : constant Special_Key_Code := 8#622#; - Key_Shift_Resume : constant Special_Key_Code := 8#623#; - Key_Shift_Save : constant Special_Key_Code := 8#624#; - Key_Shift_Suspend : constant Special_Key_Code := 8#625#; - Key_Shift_Undo : constant Special_Key_Code := 8#626#; - Key_Suspend : constant Special_Key_Code := 8#627#; - Key_Undo : constant Special_Key_Code := 8#630#; - Key_Mouse : constant Special_Key_Code := 8#631#; + Key_None : constant Special_Key_Code := 8#400#; + Key_Code_Yes : constant Special_Key_Code := 8#400#; + Key_Min : constant Special_Key_Code := 8#401#; + Key_Break : constant Special_Key_Code := 8#401#; + Key_Cursor_Down : constant Special_Key_Code := 8#402#; + Key_Cursor_Up : constant Special_Key_Code := 8#403#; + Key_Cursor_Left : constant Special_Key_Code := 8#404#; + Key_Cursor_Right : constant Special_Key_Code := 8#405#; + Key_Home : constant Special_Key_Code := 8#406#; + Key_Backspace : constant Special_Key_Code := 8#407#; + Key_F0 : constant Special_Key_Code := 8#410#; + Key_F1 : constant Special_Key_Code := 8#411#; + Key_F2 : constant Special_Key_Code := 8#412#; + Key_F3 : constant Special_Key_Code := 8#413#; + Key_F4 : constant Special_Key_Code := 8#414#; + Key_F5 : constant Special_Key_Code := 8#415#; + Key_F6 : constant Special_Key_Code := 8#416#; + Key_F7 : constant Special_Key_Code := 8#417#; + Key_F8 : constant Special_Key_Code := 8#420#; + Key_F9 : constant Special_Key_Code := 8#421#; + Key_F10 : constant Special_Key_Code := 8#422#; + Key_F11 : constant Special_Key_Code := 8#423#; + Key_F12 : constant Special_Key_Code := 8#424#; + Key_F13 : constant Special_Key_Code := 8#425#; + Key_F14 : constant Special_Key_Code := 8#426#; + Key_F15 : constant Special_Key_Code := 8#427#; + Key_F16 : constant Special_Key_Code := 8#430#; + Key_F17 : constant Special_Key_Code := 8#431#; + Key_F18 : constant Special_Key_Code := 8#432#; + Key_F19 : constant Special_Key_Code := 8#433#; + Key_F20 : constant Special_Key_Code := 8#434#; + Key_F21 : constant Special_Key_Code := 8#435#; + Key_F22 : constant Special_Key_Code := 8#436#; + Key_F23 : constant Special_Key_Code := 8#437#; + Key_F24 : constant Special_Key_Code := 8#440#; + Key_Delete_Line : constant Special_Key_Code := 8#510#; + Key_Insert_Line : constant Special_Key_Code := 8#511#; + Key_Delete_Char : constant Special_Key_Code := 8#512#; + Key_Insert_Char : constant Special_Key_Code := 8#513#; + Key_Exit_Insert_Mode : constant Special_Key_Code := 8#514#; + Key_Clear_Screen : constant Special_Key_Code := 8#515#; + Key_Clear_End_Of_Screen : constant Special_Key_Code := 8#516#; + Key_Clear_End_Of_Line : constant Special_Key_Code := 8#517#; + Key_Scroll_1_Forward : constant Special_Key_Code := 8#520#; + Key_Scroll_1_Backward : constant Special_Key_Code := 8#521#; + Key_Next_Page : constant Special_Key_Code := 8#522#; + Key_Previous_Page : constant Special_Key_Code := 8#523#; + Key_Set_Tab : constant Special_Key_Code := 8#524#; + Key_Clear_Tab : constant Special_Key_Code := 8#525#; + Key_Clear_All_Tabs : constant Special_Key_Code := 8#526#; + Key_Enter_Or_Send : constant Special_Key_Code := 8#527#; + Key_Soft_Reset : constant Special_Key_Code := 8#530#; + Key_Reset : constant Special_Key_Code := 8#531#; + Key_Print : constant Special_Key_Code := 8#532#; + Key_Bottom : constant Special_Key_Code := 8#533#; + Key_Upper_Left_Of_Keypad : constant Special_Key_Code := 8#534#; + Key_Upper_Right_Of_Keypad : constant Special_Key_Code := 8#535#; + Key_Center_Of_Keypad : constant Special_Key_Code := 8#536#; + Key_Lower_Left_Of_Keypad : constant Special_Key_Code := 8#537#; + Key_Lower_Right_Of_Keypad : constant Special_Key_Code := 8#540#; + Key_Back_Tab : constant Special_Key_Code := 8#541#; + Key_Beginning : constant Special_Key_Code := 8#542#; + Key_Cancel : constant Special_Key_Code := 8#543#; + Key_Close : constant Special_Key_Code := 8#544#; + Key_Command : constant Special_Key_Code := 8#545#; + Key_Copy : constant Special_Key_Code := 8#546#; + Key_Create : constant Special_Key_Code := 8#547#; + Key_End : constant Special_Key_Code := 8#550#; + Key_Exit : constant Special_Key_Code := 8#551#; + Key_Find : constant Special_Key_Code := 8#552#; + Key_Help : constant Special_Key_Code := 8#553#; + Key_Mark : constant Special_Key_Code := 8#554#; + Key_Message : constant Special_Key_Code := 8#555#; + Key_Move : constant Special_Key_Code := 8#556#; + Key_Next : constant Special_Key_Code := 8#557#; + Key_Open : constant Special_Key_Code := 8#560#; + Key_Options : constant Special_Key_Code := 8#561#; + Key_Previous : constant Special_Key_Code := 8#562#; + Key_Redo : constant Special_Key_Code := 8#563#; + Key_Reference : constant Special_Key_Code := 8#564#; + Key_Refresh : constant Special_Key_Code := 8#565#; + Key_Replace : constant Special_Key_Code := 8#566#; + Key_Restart : constant Special_Key_Code := 8#567#; + Key_Resume : constant Special_Key_Code := 8#570#; + Key_Save : constant Special_Key_Code := 8#571#; + Key_Shift_Begin : constant Special_Key_Code := 8#572#; + Key_Shift_Cancel : constant Special_Key_Code := 8#573#; + Key_Shift_Command : constant Special_Key_Code := 8#574#; + Key_Shift_Copy : constant Special_Key_Code := 8#575#; + Key_Shift_Create : constant Special_Key_Code := 8#576#; + Key_Shift_Delete_Char : constant Special_Key_Code := 8#577#; + Key_Shift_Delete_Line : constant Special_Key_Code := 8#600#; + Key_Select : constant Special_Key_Code := 8#601#; + Key_Shift_End : constant Special_Key_Code := 8#602#; + Key_Shift_Clear_End_Of_Line : constant Special_Key_Code := 8#603#; + Key_Shift_Exit : constant Special_Key_Code := 8#604#; + Key_Shift_Find : constant Special_Key_Code := 8#605#; + Key_Shift_Help : constant Special_Key_Code := 8#606#; + Key_Shift_Home : constant Special_Key_Code := 8#607#; + Key_Shift_Insert_Char : constant Special_Key_Code := 8#610#; + Key_Shift_Cursor_Left : constant Special_Key_Code := 8#611#; + Key_Shift_Message : constant Special_Key_Code := 8#612#; + Key_Shift_Move : constant Special_Key_Code := 8#613#; + Key_Shift_Next_Page : constant Special_Key_Code := 8#614#; + Key_Shift_Options : constant Special_Key_Code := 8#615#; + Key_Shift_Previous_Page : constant Special_Key_Code := 8#616#; + Key_Shift_Print : constant Special_Key_Code := 8#617#; + Key_Shift_Redo : constant Special_Key_Code := 8#620#; + Key_Shift_Replace : constant Special_Key_Code := 8#621#; + Key_Shift_Cursor_Right : constant Special_Key_Code := 8#622#; + Key_Shift_Resume : constant Special_Key_Code := 8#623#; + Key_Shift_Save : constant Special_Key_Code := 8#624#; + Key_Shift_Suspend : constant Special_Key_Code := 8#625#; + Key_Shift_Undo : constant Special_Key_Code := 8#626#; + Key_Suspend : constant Special_Key_Code := 8#627#; + Key_Undo : constant Special_Key_Code := 8#630#; + Key_Mouse : constant Special_Key_Code := 8#631#; Key_Resize : constant Special_Key_Code := 8#632#; Key_Max : constant Special_Key_Code @@ -218,114 +221,113 @@ -- For those who like to use the original key names we produce them were -- they differ from the original. Please note that they may differ in -- lower/upper case. - KEY_DOWN : Special_Key_Code renames Key_Cursor_Down; - KEY_UP : Special_Key_Code renames Key_Cursor_Up; - KEY_LEFT : Special_Key_Code renames Key_Cursor_Left; - KEY_RIGHT : Special_Key_Code renames Key_Cursor_Right; - KEY_DL : Special_Key_Code renames Key_Delete_Line; - KEY_IL : Special_Key_Code renames Key_Insert_Line; - KEY_DC : Special_Key_Code renames Key_Delete_Char; - KEY_IC : Special_Key_Code renames Key_Insert_Char; - KEY_EIC : Special_Key_Code renames Key_Exit_Insert_Mode; - KEY_CLEAR : Special_Key_Code renames Key_Clear_Screen; - KEY_EOS : Special_Key_Code renames Key_Clear_End_Of_Screen; - KEY_EOL : Special_Key_Code renames Key_Clear_End_Of_Line; - KEY_SF : Special_Key_Code renames Key_Scroll_1_Forward; - KEY_SR : Special_Key_Code renames Key_Scroll_1_Backward; - KEY_NPAGE : Special_Key_Code renames Key_Next_Page; - KEY_PPAGE : Special_Key_Code renames Key_Previous_Page; - KEY_STAB : Special_Key_Code renames Key_Set_Tab; - KEY_CTAB : Special_Key_Code renames Key_Clear_Tab; - KEY_CATAB : Special_Key_Code renames Key_Clear_All_Tabs; - KEY_ENTER : Special_Key_Code renames Key_Enter_Or_Send; - KEY_SRESET : Special_Key_Code renames Key_Soft_Reset; - KEY_LL : Special_Key_Code renames Key_Bottom; - KEY_A1 : Special_Key_Code renames Key_Upper_Left_Of_Keypad; - KEY_A3 : Special_Key_Code renames Key_Upper_Right_Of_Keypad; - KEY_B2 : Special_Key_Code renames Key_Center_Of_Keypad; - KEY_C1 : Special_Key_Code renames Key_Lower_Left_Of_Keypad; - KEY_C3 : Special_Key_Code renames Key_Lower_Right_Of_Keypad; - KEY_BTAB : Special_Key_Code renames Key_Back_Tab; - KEY_BEG : Special_Key_Code renames Key_Beginning; - KEY_SBEG : Special_Key_Code renames Key_Shift_Begin; - KEY_SCANCEL : Special_Key_Code renames Key_Shift_Cancel; - KEY_SCOMMAND : Special_Key_Code renames Key_Shift_Command; - KEY_SCOPY : Special_Key_Code renames Key_Shift_Copy; - KEY_SCREATE : Special_Key_Code renames Key_Shift_Create; - KEY_SDC : Special_Key_Code renames Key_Shift_Delete_Char; - KEY_SDL : Special_Key_Code renames Key_Shift_Delete_Line; - KEY_SEND : Special_Key_Code renames Key_Shift_End; - KEY_SEOL : Special_Key_Code renames Key_Shift_Clear_End_Of_Line; - KEY_SEXIT : Special_Key_Code renames Key_Shift_Exit; - KEY_SFIND : Special_Key_Code renames Key_Shift_Find; - KEY_SHELP : Special_Key_Code renames Key_Shift_Help; - KEY_SHOME : Special_Key_Code renames Key_Shift_Home; - KEY_SIC : Special_Key_Code renames Key_Shift_Insert_Char; - KEY_SLEFT : Special_Key_Code renames Key_Shift_Cursor_Left; - KEY_SMESSAGE : Special_Key_Code renames Key_Shift_Message; - KEY_SMOVE : Special_Key_Code renames Key_Shift_Move; - KEY_SNEXT : Special_Key_Code renames Key_Shift_Next_Page; - KEY_SOPTIONS : Special_Key_Code renames Key_Shift_Options; - KEY_SPREVIOUS : Special_Key_Code renames Key_Shift_Previous_Page; - KEY_SPRINT : Special_Key_Code renames Key_Shift_Print; - KEY_SREDO : Special_Key_Code renames Key_Shift_Redo; - KEY_SREPLACE : Special_Key_Code renames Key_Shift_Replace; - KEY_SRIGHT : Special_Key_Code renames Key_Shift_Cursor_Right; - KEY_SRSUME : Special_Key_Code renames Key_Shift_Resume; - KEY_SSAVE : Special_Key_Code renames Key_Shift_Save; - KEY_SSUSPEND : Special_Key_Code renames Key_Shift_Suspend; + KEY_DOWN : Special_Key_Code renames Key_Cursor_Down; + KEY_UP : Special_Key_Code renames Key_Cursor_Up; + KEY_LEFT : Special_Key_Code renames Key_Cursor_Left; + KEY_RIGHT : Special_Key_Code renames Key_Cursor_Right; + KEY_DL : Special_Key_Code renames Key_Delete_Line; + KEY_IL : Special_Key_Code renames Key_Insert_Line; + KEY_DC : Special_Key_Code renames Key_Delete_Char; + KEY_IC : Special_Key_Code renames Key_Insert_Char; + KEY_EIC : Special_Key_Code renames Key_Exit_Insert_Mode; + KEY_CLEAR : Special_Key_Code renames Key_Clear_Screen; + KEY_EOS : Special_Key_Code renames Key_Clear_End_Of_Screen; + KEY_EOL : Special_Key_Code renames Key_Clear_End_Of_Line; + KEY_SF : Special_Key_Code renames Key_Scroll_1_Forward; + KEY_SR : Special_Key_Code renames Key_Scroll_1_Backward; + KEY_NPAGE : Special_Key_Code renames Key_Next_Page; + KEY_PPAGE : Special_Key_Code renames Key_Previous_Page; + KEY_STAB : Special_Key_Code renames Key_Set_Tab; + KEY_CTAB : Special_Key_Code renames Key_Clear_Tab; + KEY_CATAB : Special_Key_Code renames Key_Clear_All_Tabs; + KEY_ENTER : Special_Key_Code renames Key_Enter_Or_Send; + KEY_SRESET : Special_Key_Code renames Key_Soft_Reset; + KEY_LL : Special_Key_Code renames Key_Bottom; + KEY_A1 : Special_Key_Code renames Key_Upper_Left_Of_Keypad; + KEY_A3 : Special_Key_Code renames Key_Upper_Right_Of_Keypad; + KEY_B2 : Special_Key_Code renames Key_Center_Of_Keypad; + KEY_C1 : Special_Key_Code renames Key_Lower_Left_Of_Keypad; + KEY_C3 : Special_Key_Code renames Key_Lower_Right_Of_Keypad; + KEY_BTAB : Special_Key_Code renames Key_Back_Tab; + KEY_BEG : Special_Key_Code renames Key_Beginning; + KEY_SBEG : Special_Key_Code renames Key_Shift_Begin; + KEY_SCANCEL : Special_Key_Code renames Key_Shift_Cancel; + KEY_SCOMMAND : Special_Key_Code renames Key_Shift_Command; + KEY_SCOPY : Special_Key_Code renames Key_Shift_Copy; + KEY_SCREATE : Special_Key_Code renames Key_Shift_Create; + KEY_SDC : Special_Key_Code renames Key_Shift_Delete_Char; + KEY_SDL : Special_Key_Code renames Key_Shift_Delete_Line; + KEY_SEND : Special_Key_Code renames Key_Shift_End; + KEY_SEOL : Special_Key_Code renames Key_Shift_Clear_End_Of_Line; + KEY_SEXIT : Special_Key_Code renames Key_Shift_Exit; + KEY_SFIND : Special_Key_Code renames Key_Shift_Find; + KEY_SHELP : Special_Key_Code renames Key_Shift_Help; + KEY_SHOME : Special_Key_Code renames Key_Shift_Home; + KEY_SIC : Special_Key_Code renames Key_Shift_Insert_Char; + KEY_SLEFT : Special_Key_Code renames Key_Shift_Cursor_Left; + KEY_SMESSAGE : Special_Key_Code renames Key_Shift_Message; + KEY_SMOVE : Special_Key_Code renames Key_Shift_Move; + KEY_SNEXT : Special_Key_Code renames Key_Shift_Next_Page; + KEY_SOPTIONS : Special_Key_Code renames Key_Shift_Options; + KEY_SPREVIOUS : Special_Key_Code renames Key_Shift_Previous_Page; + KEY_SPRINT : Special_Key_Code renames Key_Shift_Print; + KEY_SREDO : Special_Key_Code renames Key_Shift_Redo; + KEY_SREPLACE : Special_Key_Code renames Key_Shift_Replace; + KEY_SRIGHT : Special_Key_Code renames Key_Shift_Cursor_Right; + KEY_SRSUME : Special_Key_Code renames Key_Shift_Resume; + KEY_SSAVE : Special_Key_Code renames Key_Shift_Save; + KEY_SSUSPEND : Special_Key_Code renames Key_Shift_Suspend; KEY_SUNDO : Special_Key_Code renames Key_Shift_Undo; ------------------------------------------------------------------------------ - type Color_Number is range -1 .. Integer (Interfaces.C.short'Last); + type Color_Number is range -1 .. Integer (Interfaces.C.short'Last); for Color_Number'Size use Interfaces.C.short'Size; -- (n)curses uses a short for the color index -- The model is, that a Color_Number is an index into an array of -- (potentially) definable colors. Some of those indices are -- predefined (see below), although they may not really exist. - Default_Color : constant Color_Number := -1; - Black : constant Color_Number := 0; - Red : constant Color_Number := 1; - Green : constant Color_Number := 2; - Yellow : constant Color_Number := 3; - Blue : constant Color_Number := 4; - Magenta : constant Color_Number := 5; - Cyan : constant Color_Number := 6; + Default_Color : constant Color_Number := -1; + Black : constant Color_Number := 0; + Red : constant Color_Number := 1; + Green : constant Color_Number := 2; + Yellow : constant Color_Number := 3; + Blue : constant Color_Number := 4; + Magenta : constant Color_Number := 5; + Cyan : constant Color_Number := 6; White : constant Color_Number := 7; - type RGB_Value is range 0 .. Integer (Interfaces.C.short'Last); + type RGB_Value is range 0 .. Integer (Interfaces.C.short'Last); for RGB_Value'Size use Interfaces.C.short'Size; -- Some system may allow to redefine a color by setting RGB values. - type Color_Pair is range 0 .. 255; + type Color_Pair is range 0 .. 255; for Color_Pair'Size use 8; subtype Redefinable_Color_Pair is Color_Pair range 1 .. 255; -- (n)curses reserves 1 Byte for the color-pair number. Color Pair 0 - -- is fixed (Black & White). A color pair is simply a combination of + -- is fixed (Black & White). A color pair is simply a combination of -- two colors described by Color_Numbers, one for the foreground and -- the other for the background type Character_Attribute_Set is record - Stand_Out : Boolean; - Under_Line : Boolean; - Reverse_Video : Boolean; - Blink : Boolean; - Dim_Character : Boolean; - Bold_Character : Boolean; - Alternate_Character_Set : Boolean; - Invisible_Character : Boolean; - Protected_Character : Boolean; - Horizontal : Boolean; - Left : Boolean; - Low : Boolean; - Right : Boolean; - Top : Boolean; + Stand_Out : Boolean; + Under_Line : Boolean; + Reverse_Video : Boolean; + Blink : Boolean; + Dim_Character : Boolean; + Bold_Character : Boolean; + Alternate_Character_Set : Boolean; + Invisible_Character : Boolean; + Protected_Character : Boolean; + Horizontal : Boolean; + Left : Boolean; + Low : Boolean; + Right : Boolean; + Top : Boolean; Vertical : Boolean; - end record; - pragma Pack (Character_Attribute_Set); + end record; pragma Convention (C, Character_Attribute_Set); for Character_Attribute_Set use @@ -355,9 +357,9 @@ type Attributed_Character is record - Attr : Character_Attribute_Set; - Color : Color_Pair; - Ch : Character; + Attr : Character_Attribute_Set; + Color : Color_Pair; + Ch : Character; end record; pragma Convention (C, Attributed_Character); -- This is the counterpart for the chtype in C. @@ -373,7 +375,7 @@ -- different on your system. Default_Character : constant Attributed_Character - := (Ch => Character'First, + := (Ch => Character'First, Color => Color_Pair'First, Attr => (others => False)); -- preelaboratable Normal_Video @@ -384,25 +386,25 @@ ------------------ -- Exceptions -- ------------------ - Curses_Exception : exception; + Curses_Exception : exception; Wrong_Curses_Version : exception; -- Those exceptions are raised by the ETI (Extended Terminal Interface) -- subpackets for Menu and Forms handling. -- - Eti_System_Error : exception; - Eti_Bad_Argument : exception; - Eti_Posted : exception; - Eti_Connected : exception; - Eti_Bad_State : exception; - Eti_No_Room : exception; - Eti_Not_Posted : exception; - Eti_Unknown_Command : exception; - Eti_No_Match : exception; - Eti_Not_Selectable : exception; - Eti_Not_Connected : exception; - Eti_Request_Denied : exception; - Eti_Invalid_Field : exception; + Eti_System_Error : exception; + Eti_Bad_Argument : exception; + Eti_Posted : exception; + Eti_Connected : exception; + Eti_Bad_State : exception; + Eti_No_Room : exception; + Eti_Not_Posted : exception; + Eti_Unknown_Command : exception; + Eti_No_Match : exception; + Eti_Not_Selectable : exception; + Eti_Not_Connected : exception; + Eti_Request_Denied : exception; + Eti_Invalid_Field : exception; Eti_Current : exception; -------------------------------------------------------------------------- @@ -413,7 +415,7 @@ -- this is to use functions. -------------------------------------------------------------------------- - function Lines return Line_Count; + function Lines return Line_Count; pragma Inline (Lines); function Columns return Column_Count; @@ -437,37 +439,37 @@ -- You must use this constants as indices into the ACS_Map array -- to get the corresponding attributed character at runtime. -- - ACS_Upper_Left_Corner : constant Character := 'l'; - ACS_Lower_Left_Corner : constant Character := 'm'; - ACS_Upper_Right_Corner : constant Character := 'k'; - ACS_Lower_Right_Corner : constant Character := 'j'; - ACS_Left_Tee : constant Character := 't'; - ACS_Right_Tee : constant Character := 'u'; - ACS_Bottom_Tee : constant Character := 'v'; - ACS_Top_Tee : constant Character := 'w'; - ACS_Horizontal_Line : constant Character := 'q'; - ACS_Vertical_Line : constant Character := 'x'; - ACS_Plus_Symbol : constant Character := 'n'; - ACS_Scan_Line_1 : constant Character := 'o'; - ACS_Scan_Line_9 : constant Character := 's'; - ACS_Diamond : constant Character := Character'Val (96); - ACS_Checker_Board : constant Character := 'a'; - ACS_Degree : constant Character := 'f'; - ACS_Plus_Minus : constant Character := 'g'; - ACS_Bullet : constant Character := '~'; - ACS_Left_Arrow : constant Character := ','; - ACS_Right_Arrow : constant Character := '+'; - ACS_Down_Arrow : constant Character := '.'; - ACS_Up_Arrow : constant Character := '-'; - ACS_Board_Of_Squares : constant Character := 'h'; - ACS_Lantern : constant Character := 'i'; - ACS_Solid_Block : constant Character := '0'; - ACS_Scan_Line_3 : constant Character := 'p'; - ACS_Scan_Line_7 : constant Character := 'r'; - ACS_Less_Or_Equal : constant Character := 'y'; - ACS_Greater_Or_Equal : constant Character := 'z'; - ACS_PI : constant Character := '{'; - ACS_Not_Equal : constant Character := '|'; + ACS_Upper_Left_Corner : constant Character := 'l'; + ACS_Lower_Left_Corner : constant Character := 'm'; + ACS_Upper_Right_Corner : constant Character := 'k'; + ACS_Lower_Right_Corner : constant Character := 'j'; + ACS_Left_Tee : constant Character := 't'; + ACS_Right_Tee : constant Character := 'u'; + ACS_Bottom_Tee : constant Character := 'v'; + ACS_Top_Tee : constant Character := 'w'; + ACS_Horizontal_Line : constant Character := 'q'; + ACS_Vertical_Line : constant Character := 'x'; + ACS_Plus_Symbol : constant Character := 'n'; + ACS_Scan_Line_1 : constant Character := 'o'; + ACS_Scan_Line_9 : constant Character := 's'; + ACS_Diamond : constant Character := Character'Val (96); + ACS_Checker_Board : constant Character := 'a'; + ACS_Degree : constant Character := 'f'; + ACS_Plus_Minus : constant Character := 'g'; + ACS_Bullet : constant Character := '~'; + ACS_Left_Arrow : constant Character := ','; + ACS_Right_Arrow : constant Character := '+'; + ACS_Down_Arrow : constant Character := '.'; + ACS_Up_Arrow : constant Character := '-'; + ACS_Board_Of_Squares : constant Character := 'h'; + ACS_Lantern : constant Character := 'i'; + ACS_Solid_Block : constant Character := '0'; + ACS_Scan_Line_3 : constant Character := 'p'; + ACS_Scan_Line_7 : constant Character := 'r'; + ACS_Less_Or_Equal : constant Character := 'y'; + ACS_Greater_Or_Equal : constant Character := 'z'; + ACS_PI : constant Character := '{'; + ACS_Not_Equal : constant Character := '|'; ACS_Sterling : constant Character := '}'; -- |===================================================================== @@ -486,14 +488,14 @@ -- #1A NAME="AFU_3"#2| procedure Init_Windows renames Init_Screen; -- AKA: initscr() - pragma Inline (Init_Screen); + pragma Inline (Init_Screen); pragma Inline (Init_Windows); -- #1A NAME="AFU_4"#2| procedure End_Windows; -- AKA: endwin() procedure End_Screen renames End_Windows; - pragma Inline (End_Windows); + pragma Inline (End_Windows); pragma Inline (End_Screen); -- #1A NAME="AFU_5"#2| @@ -506,8 +508,8 @@ -- |===================================================================== -- #1A NAME="AFU_6"#2| - procedure Move_Cursor (Win : in Window := Standard_Window; - Line : in Line_Position; + procedure Move_Cursor (Win : in Window := Standard_Window; + Line : in Line_Position; Column : in Column_Position); -- AKA: wmove() -- AKA: move() @@ -518,42 +520,42 @@ -- |===================================================================== -- #1A NAME="AFU_7"#2| - procedure Add (Win : in Window := Standard_Window; + procedure Add (Win : in Window := Standard_Window; Ch : in Attributed_Character); -- AKA: waddch() -- AKA: addch() - procedure Add (Win : in Window := Standard_Window; + procedure Add (Win : in Window := Standard_Window; Ch : in Character); -- Add a single character at the current logical cursor position to -- the window. Use the current windows attributes. -- #1A NAME="AFU_8"#2| procedure Add - (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; Ch : in Attributed_Character); -- AKA: mvwaddch() -- AKA: mvaddch() procedure Add - (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; + (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; Ch : in Character); -- Move to the position and add a single character into the window -- There are more Add routines, so the Inline pragma follows later -- #1A NAME="AFU_9"#2| procedure Add_With_Immediate_Echo - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Ch : in Attributed_Character); -- AKA: wechochar() -- AKA: echochar() procedure Add_With_Immediate_Echo - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Ch : in Character); -- Add a character and do an immediate refresh of the screen. pragma Inline (Add_With_Immediate_Echo); @@ -565,9 +567,9 @@ -- #1A NAME="AFU_10"#2| function Create - (Number_Of_Lines : Line_Count; - Number_Of_Columns : Column_Count; - First_Line_Position : Line_Position; + (Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; First_Column_Position : Column_Position) return Window; -- Not Implemented: Default Number_Of_Lines, Number_Of_Columns -- the C version lets them be 0, see the man page. @@ -575,9 +577,9 @@ pragma Inline (Create); function New_Window - (Number_Of_Lines : Line_Count; - Number_Of_Columns : Column_Count; - First_Line_Position : Line_Position; + (Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; First_Column_Position : Column_Position) return Window renames Create; pragma Inline (New_Window); @@ -590,20 +592,20 @@ -- #1A NAME="AFU_12"#2| function Sub_Window - (Win : Window := Standard_Window; - Number_Of_Lines : Line_Count; - Number_Of_Columns : Column_Count; - First_Line_Position : Line_Position; + (Win : Window := Standard_Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; First_Column_Position : Column_Position) return Window; -- AKA: subwin() pragma Inline (Sub_Window); -- #1A NAME="AFU_13"#2| function Derived_Window - (Win : Window := Standard_Window; - Number_Of_Lines : Line_Count; - Number_Of_Columns : Column_Count; - First_Line_Position : Line_Position; + (Win : Window := Standard_Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; First_Column_Position : Column_Position) return Window; -- AKA: derwin() pragma Inline (Derived_Window); @@ -614,15 +616,15 @@ pragma Inline (Duplicate); -- #1A NAME="AFU_15"#2| - procedure Move_Window (Win : in Window; - Line : in Line_Position; + procedure Move_Window (Win : in Window; + Line : in Line_Position; Column : in Column_Position); -- AKA: mvwin() pragma Inline (Move_Window); -- #1A NAME="AFU_16"#2| - procedure Move_Derived_Window (Win : in Window; - Line : in Line_Position; + procedure Move_Derived_Window (Win : in Window; + Line : in Line_Position; Column : in Column_Position); -- AKA: mvderwin() pragma Inline (Move_Derived_Window); @@ -638,7 +640,7 @@ pragma Import (C, Synchronize_Downwards, "wsyncdown"); -- #1A NAME="AFU_19"#2| - procedure Set_Synch_Mode (Win : in Window := Standard_Window; + procedure Set_Synch_Mode (Win : in Window := Standard_Window; Mode : in Boolean := False); -- AKA: syncok() pragma Inline (Set_Synch_Mode); @@ -648,8 +650,8 @@ -- |===================================================================== -- #1A NAME="AFU_20"#2| - procedure Add (Win : in Window := Standard_Window; - Str : in String; + procedure Add (Win : in Window := Standard_Window; + Str : in String; Len : in Integer := -1); -- AKA: waddnstr() -- AKA: waddstr() @@ -657,10 +659,10 @@ -- AKA: addstr() -- #1A NAME="AFU_21"#2| - procedure Add (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Str : in String; + procedure Add (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : in String; Len : in Integer := -1); -- AKA: mvwaddnstr() -- AKA: mvwaddstr() @@ -672,8 +674,8 @@ -- |===================================================================== -- #1A NAME="AFU_22"#2| - procedure Add (Win : in Window := Standard_Window; - Str : in Attributed_String; + procedure Add (Win : in Window := Standard_Window; + Str : in Attributed_String; Len : in Integer := -1); -- AKA: waddchnstr() -- AKA: waddchstr() @@ -681,10 +683,10 @@ -- AKA: addchstr() -- #1A NAME="AFU_23"#2| - procedure Add (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Str : in Attributed_String; + procedure Add (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : in Attributed_String; Len : in Integer := -1); -- AKA: mvwaddchnstr() -- AKA: mvwaddchstr() @@ -700,14 +702,14 @@ -- #1A NAME="AFU_24"#2| procedure Border - (Win : in Window := Standard_Window; - Left_Side_Symbol : in Attributed_Character := Default_Character; - Right_Side_Symbol : in Attributed_Character := Default_Character; - Top_Side_Symbol : in Attributed_Character := Default_Character; - Bottom_Side_Symbol : in Attributed_Character := Default_Character; - Upper_Left_Corner_Symbol : in Attributed_Character := Default_Character; - Upper_Right_Corner_Symbol : in Attributed_Character := Default_Character; - Lower_Left_Corner_Symbol : in Attributed_Character := Default_Character; + (Win : in Window := Standard_Window; + Left_Side_Symbol : in Attributed_Character := Default_Character; + Right_Side_Symbol : in Attributed_Character := Default_Character; + Top_Side_Symbol : in Attributed_Character := Default_Character; + Bottom_Side_Symbol : in Attributed_Character := Default_Character; + Upper_Left_Corner_Symbol : in Attributed_Character := Default_Character; + Upper_Right_Corner_Symbol : in Attributed_Character := Default_Character; + Lower_Left_Corner_Symbol : in Attributed_Character := Default_Character; Lower_Right_Corner_Symbol : in Attributed_Character := Default_Character ); -- AKA: wborder() @@ -716,16 +718,16 @@ -- #1A NAME="AFU_25"#2| procedure Box - (Win : in Window := Standard_Window; - Vertical_Symbol : in Attributed_Character := Default_Character; + (Win : in Window := Standard_Window; + Vertical_Symbol : in Attributed_Character := Default_Character; Horizontal_Symbol : in Attributed_Character := Default_Character); -- AKA: box() pragma Inline (Box); -- #1A NAME="AFU_26"#2| procedure Horizontal_Line - (Win : in Window := Standard_Window; - Line_Size : in Natural; + (Win : in Window := Standard_Window; + Line_Size : in Natural; Line_Symbol : in Attributed_Character := Default_Character); -- AKA: whline() -- AKA: hline() @@ -733,8 +735,8 @@ -- #1A NAME="AFU_27"#2| procedure Vertical_Line - (Win : in Window := Standard_Window; - Line_Size : in Natural; + (Win : in Window := Standard_Window; + Line_Size : in Natural; Line_Symbol : in Attributed_Character := Default_Character); -- AKA: wvline() -- AKA: vline() @@ -795,15 +797,15 @@ -- PAIR_NUMBER(c) is the same as c.Color -- #1A NAME="AFU_31"#2| - procedure Standout (Win : Window := Standard_Window; + procedure Standout (Win : Window := Standard_Window; On : Boolean := True); -- AKA: wstandout() -- AKA: wstandend() -- #1A NAME="AFU_32"#2| procedure Switch_Character_Attribute - (Win : in Window := Standard_Window; - Attr : in Character_Attribute_Set := Normal_Video; + (Win : in Window := Standard_Window; + Attr : in Character_Attribute_Set := Normal_Video; On : in Boolean := True); -- if False we switch Off. -- Switches those Attributes set to true in the list. -- AKA: wattron() @@ -813,8 +815,8 @@ -- #1A NAME="AFU_33"#2| procedure Set_Character_Attributes - (Win : in Window := Standard_Window; - Attr : in Character_Attribute_Set := Normal_Video; + (Win : in Window := Standard_Window; + Attr : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA: wattrset() -- AKA: attrset() @@ -833,7 +835,7 @@ pragma Inline (Get_Character_Attribute); -- #1A NAME="AFU_36"#2| - procedure Set_Color (Win : in Window := Standard_Window; + procedure Set_Color (Win : in Window := Standard_Window; Pair : in Color_Pair); -- AKA: wcolor_set() -- AKA: color_set() @@ -841,20 +843,20 @@ -- #1A NAME="AFU_37"#2| procedure Change_Attributes - (Win : in Window := Standard_Window; - Count : in Integer := -1; - Attr : in Character_Attribute_Set := Normal_Video; + (Win : in Window := Standard_Window; + Count : in Integer := -1; + Attr : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA: wchgat() -- AKA: chgat() -- #1A NAME="AFU_38"#2| procedure Change_Attributes - (Win : in Window := Standard_Window; - Line : in Line_Position := Line_Position'First; - Column : in Column_Position := Column_Position'First; - Count : in Integer := -1; - Attr : in Character_Attribute_Set := Normal_Video; + (Win : in Window := Standard_Window; + Line : in Line_Position := Line_Position'First; + Column : in Column_Position := Column_Position'First; + Count : in Integer := -1; + Attr : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA: mvwchgat() -- AKA: mvchgat() @@ -899,13 +901,13 @@ pragma Inline (Set_Echo_Mode); -- #1A NAME="AFU_44"#2| - procedure Set_Meta_Mode (Win : in Window := Standard_Window; + procedure Set_Meta_Mode (Win : in Window := Standard_Window; SwitchOn : in Boolean := True); -- AKA: meta() pragma Inline (Set_Meta_Mode); -- #1A NAME="AFU_45"#2| - procedure Set_KeyPad_Mode (Win : in Window := Standard_Window; + procedure Set_KeyPad_Mode (Win : in Window := Standard_Window; SwitchOn : in Boolean := True); -- AKA: keypad() pragma Inline (Set_KeyPad_Mode); @@ -924,14 +926,14 @@ -- #1A NAME="AFU_47"#2| procedure Set_Flush_On_Interrupt_Mode - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Mode : in Boolean := True); -- AKA: intrflush() pragma Inline (Set_Flush_On_Interrupt_Mode); -- #1A NAME="AFU_48"#2| procedure Set_Queue_Interrupt_Mode - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Flush : in Boolean := True); -- AKA: qiflush() -- AKA: noqiflush() @@ -939,7 +941,7 @@ -- #1A NAME="AFU_49"#2| procedure Set_NoDelay_Mode - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Mode : in Boolean := False); -- AKA: nodelay() pragma Inline (Set_NoDelay_Mode); @@ -947,8 +949,8 @@ type Timeout_Mode is (Blocking, Non_Blocking, Delayed); -- #1A NAME="AFU_50"#2| - procedure Set_Timeout_Mode (Win : in Window := Standard_Window; - Mode : in Timeout_Mode; + procedure Set_Timeout_Mode (Win : in Window := Standard_Window; + Mode : in Timeout_Mode; Amount : in Natural); -- in Milliseconds -- AKA: wtimeout() -- AKA: timeout() @@ -960,7 +962,7 @@ -- #1A NAME="AFU_51"#2| procedure Set_Escape_Timer_Mode - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Timer_Off : in Boolean := False); -- AKA: notimeout() pragma Inline (Set_Escape_Timer_Mode); @@ -977,42 +979,42 @@ -- #1A NAME="AFU_53"#2| procedure Clear_On_Next_Update - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Do_Clear : in Boolean := True); -- AKA: clearok() pragma Inline (Clear_On_Next_Update); -- #1A NAME="AFU_54"#2| procedure Use_Insert_Delete_Line - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Do_Idl : in Boolean := True); -- AKA: idlok() pragma Inline (Use_Insert_Delete_Line); -- #1A NAME="AFU_55"#2| procedure Use_Insert_Delete_Character - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Do_Idc : in Boolean := True); -- AKA: idcok() pragma Inline (Use_Insert_Delete_Character); -- #1A NAME="AFU_56"#2| procedure Leave_Cursor_After_Update - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Do_Leave : in Boolean := True); -- AKA: leaveok() pragma Inline (Leave_Cursor_After_Update); -- #1A NAME="AFU_57"#2| procedure Immediate_Update_Mode - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Mode : in Boolean := False); -- AKA: immedok() pragma Inline (Immediate_Update_Mode); -- #1A NAME="AFU_58"#2| procedure Allow_Scrolling - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Mode : in Boolean := False); -- AKA: scrollok() pragma Inline (Allow_Scrolling); @@ -1023,8 +1025,8 @@ -- #1A NAME="AFU_59"#2| procedure Set_Scroll_Region - (Win : in Window := Standard_Window; - Top_Line : in Line_Position; + (Win : in Window := Standard_Window; + Top_Line : in Line_Position; Bottom_Line : in Line_Position); -- AKA: wsetscrreg() -- AKA: setscrreg() @@ -1058,8 +1060,8 @@ -- AKA: redrawwin() -- #1A NAME="AFU_64"#2| - procedure Redraw (Win : in Window := Standard_Window; - Begin_Line : in Line_Position; + procedure Redraw (Win : in Window := Standard_Window; + Begin_Line : in Line_Position; Line_Count : in Positive); -- AKA: wredrawln() pragma Inline (Redraw); @@ -1104,7 +1106,7 @@ -- because in C it is common to see bkgdset(A_BOLD) or -- bkgdset(COLOR_PAIR(n)) procedure Set_Background - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Ch : in Attributed_Character); -- AKA: wbkgdset() -- AKA: bkgdset() @@ -1112,7 +1114,7 @@ -- #1A NAME="AFU_70"#2| procedure Change_Background - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Ch : in Attributed_Character); -- AKA: wbkgd() -- AKA: bkgd() @@ -1120,7 +1122,7 @@ -- #1A NAME="AFU_71"#2| -- ? wbkgdget is not listed in curs_bkgd, getbkgd is thpough. - function Get_Background (Win : Window := Standard_Window) + function Get_Background (Win : Window := Standard_Window) return Attributed_Character; -- AKA: wbkgdget() -- AKA: bkgdget() @@ -1140,22 +1142,22 @@ -- AKA: touchwin() -- #1A NAME="AFU_74"#2| - procedure Touch (Win : in Window := Standard_Window; - Start : in Line_Position; + procedure Touch (Win : in Window := Standard_Window; + Start : in Line_Position; Count : in Positive); -- AKA: touchline() pragma Inline (Touch); -- #1A NAME="AFU_75"#2| - procedure Change_Lines_Status (Win : in Window := Standard_Window; - Start : in Line_Position; - Count : in Positive; + procedure Change_Lines_Status (Win : in Window := Standard_Window; + Start : in Line_Position; + Count : in Positive; State : in Boolean); -- AKA: wtouchln() pragma Inline (Change_Lines_Status); -- #1A NAME="AFU_76"#2| - function Is_Touched (Win : Window := Standard_Window; + function Is_Touched (Win : Window := Standard_Window; Line : Line_Position) return Boolean; -- AKA: is_linetouched() @@ -1170,26 +1172,26 @@ -- #1A NAME="AFU_78"#2| procedure Copy - (Source_Window : in Window; - Destination_Window : in Window; - Source_Top_Row : in Line_Position; - Source_Left_Column : in Column_Position; - Destination_Top_Row : in Line_Position; - Destination_Left_Column : in Column_Position; - Destination_Bottom_Row : in Line_Position; - Destination_Right_Column : in Column_Position; + (Source_Window : in Window; + Destination_Window : in Window; + Source_Top_Row : in Line_Position; + Source_Left_Column : in Column_Position; + Destination_Top_Row : in Line_Position; + Destination_Left_Column : in Column_Position; + Destination_Bottom_Row : in Line_Position; + Destination_Right_Column : in Column_Position; Non_Destructive_Mode : in Boolean := True); -- AKA: copywin() pragma Inline (Copy); -- #1A NAME="AFU_79"#2| - procedure Overwrite (Source_Window : in Window; + procedure Overwrite (Source_Window : in Window; Destination_Window : in Window); -- AKA: overwrite() pragma Inline (Overwrite); -- #1A NAME="AFU_80"#2| - procedure Overlay (Source_Window : in Window; + procedure Overlay (Source_Window : in Window; Destination_Window : in Window); -- AKA: overlay() pragma Inline (Overlay); @@ -1200,7 +1202,7 @@ -- #1A NAME="AFU_81"#2| procedure Insert_Delete_Lines - (Win : in Window := Standard_Window; + (Win : in Window := Standard_Window; Lines : in Integer := 1); -- default is to insert one line above -- AKA: winsdelln() -- AKA: insdelln() @@ -1224,33 +1226,33 @@ -- #1A NAME="AFU_84"#2| procedure Get_Size - (Win : in Window := Standard_Window; - Number_Of_Lines : out Line_Count; + (Win : in Window := Standard_Window; + Number_Of_Lines : out Line_Count; Number_Of_Columns : out Column_Count); -- AKA: getmaxyx() pragma Inline (Get_Size); -- #1A NAME="AFU_85"#2| procedure Get_Window_Position - (Win : in Window := Standard_Window; - Top_Left_Line : out Line_Position; + (Win : in Window := Standard_Window; + Top_Left_Line : out Line_Position; Top_Left_Column : out Column_Position); -- AKA: getbegyx() pragma Inline (Get_Window_Position); -- #1A NAME="AFU_86"#2| procedure Get_Cursor_Position - (Win : in Window := Standard_Window; - Line : out Line_Position; + (Win : in Window := Standard_Window; + Line : out Line_Position; Column : out Column_Position); -- AKA: getyx() pragma Inline (Get_Cursor_Position); -- #1A NAME="AFU_87"#2| procedure Get_Origin_Relative_To_Parent - (Win : in Window; - Top_Left_Line : out Line_Position; - Top_Left_Column : out Column_Position; + (Win : in Window; + Top_Left_Line : out Line_Position; + Top_Left_Column : out Column_Position; Is_Not_A_Subwindow : out Boolean); -- AKA: getparyx() -- Instead of placing -1 in the coordinates as return, we use a boolean @@ -1262,53 +1264,53 @@ -- |===================================================================== -- #1A NAME="AFU_88"#2| - function New_Pad (Lines : Line_Count; + function New_Pad (Lines : Line_Count; Columns : Column_Count) return Window; -- AKA: newpad() pragma Inline (New_Pad); -- #1A NAME="AFU_89"#2| function Sub_Pad - (Pad : Window; - Number_Of_Lines : Line_Count; - Number_Of_Columns : Column_Count; - First_Line_Position : Line_Position; + (Pad : Window; + Number_Of_Lines : Line_Count; + Number_Of_Columns : Column_Count; + First_Line_Position : Line_Position; First_Column_Position : Column_Position) return Window; -- AKA: subpad() pragma Inline (Sub_Pad); -- #1A NAME="AFU_90"#2| procedure Refresh - (Pad : in Window; - Source_Top_Row : in Line_Position; - Source_Left_Column : in Column_Position; - Destination_Top_Row : in Line_Position; - Destination_Left_Column : in Column_Position; - Destination_Bottom_Row : in Line_Position; + (Pad : in Window; + Source_Top_Row : in Line_Position; + Source_Left_Column : in Column_Position; + Destination_Top_Row : in Line_Position; + Destination_Left_Column : in Column_Position; + Destination_Bottom_Row : in Line_Position; Destination_Right_Column : in Column_Position); -- AKA: prefresh() pragma Inline (Refresh); -- #1A NAME="AFU_91"#2| procedure Refresh_Without_Update - (Pad : in Window; - Source_Top_Row : in Line_Position; - Source_Left_Column : in Column_Position; - Destination_Top_Row : in Line_Position; - Destination_Left_Column : in Column_Position; - Destination_Bottom_Row : in Line_Position; + (Pad : in Window; + Source_Top_Row : in Line_Position; + Source_Left_Column : in Column_Position; + Destination_Top_Row : in Line_Position; + Destination_Left_Column : in Column_Position; + Destination_Bottom_Row : in Line_Position; Destination_Right_Column : in Column_Position); -- AKA: pnoutrefresh() pragma Inline (Refresh_Without_Update); -- #1A NAME="AFU_92"#2| procedure Add_Character_To_Pad_And_Echo_It - (Pad : in Window; + (Pad : in Window; Ch : in Attributed_Character); -- AKA: pechochar() procedure Add_Character_To_Pad_And_Echo_It - (Pad : in Window; + (Pad : in Window; Ch : in Character); pragma Inline (Add_Character_To_Pad_And_Echo_It); @@ -1317,7 +1319,7 @@ -- |===================================================================== -- #1A NAME="AFU_93"#2| - procedure Scroll (Win : in Window := Standard_Window; + procedure Scroll (Win : in Window := Standard_Window; Amount : in Integer := 1); -- AKA: wscrl() -- AKA: scroll() @@ -1335,8 +1337,8 @@ -- #1A NAME="AFU_95"#2| procedure Delete_Character - (Win : in Window := Standard_Window; - Line : in Line_Position; + (Win : in Window := Standard_Window; + Line : in Line_Position; Column : in Column_Position); -- AKA: mvwdelch() -- AKA: mvdelch() @@ -1347,15 +1349,15 @@ -- |===================================================================== -- #1A NAME="AFU_96"#2| - function Peek (Win : Window := Standard_Window) + function Peek (Win : Window := Standard_Window) return Attributed_Character; -- AKA: inch() -- AKA: winch() -- #1A NAME="AFU_97"#2| function Peek - (Win : Window := Standard_Window; - Line : Line_Position; + (Win : Window := Standard_Window; + Line : Line_Position; Column : Column_Position) return Attributed_Character; -- AKA: mvwinch() -- AKA: mvinch() @@ -1366,15 +1368,15 @@ -- |===================================================================== -- #1A NAME="AFU_98"#2| - procedure Insert (Win : in Window := Standard_Window; + procedure Insert (Win : in Window := Standard_Window; Ch : in Attributed_Character); -- AKA: winsch() -- AKA: insch() -- #1A NAME="AFU_99"#2| - procedure Insert (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; + procedure Insert (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; Ch : in Attributed_Character); -- AKA: mvwinsch() -- AKA: mvinsch() @@ -1384,8 +1386,8 @@ -- |===================================================================== -- #1A NAME="AFU_100"#2| - procedure Insert (Win : in Window := Standard_Window; - Str : in String; + procedure Insert (Win : in Window := Standard_Window; + Str : in String; Len : in Integer := -1); -- AKA: winsnstr() -- AKA: winsstr() @@ -1393,10 +1395,10 @@ -- AKA: insstr() -- #1A NAME="AFU_101"#2| - procedure Insert (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Str : in String; + procedure Insert (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : in String; Len : in Integer := -1); -- AKA: mvwinsnstr() -- AKA: mvwinsstr() @@ -1409,8 +1411,8 @@ -- |===================================================================== -- #1A NAME="AFU_102"#2| - procedure Peek (Win : in Window := Standard_Window; - Str : out String; + procedure Peek (Win : in Window := Standard_Window; + Str : out String; Len : in Integer := -1); -- AKA: winnstr() -- AKA: winstr() @@ -1418,10 +1420,10 @@ -- AKA: instr() -- #1A NAME="AFU_103"#2| - procedure Peek (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Str : out String; + procedure Peek (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : out String; Len : in Integer := -1); -- AKA: mvwinnstr() -- AKA: mvwinstr() @@ -1433,8 +1435,8 @@ -- |===================================================================== -- #1A NAME="AFU_104"#2| - procedure Peek (Win : in Window := Standard_Window; - Str : out Attributed_String; + procedure Peek (Win : in Window := Standard_Window; + Str : out Attributed_String; Len : in Integer := -1); -- AKA: winchnstr() -- AKA: winchstr() @@ -1442,10 +1444,10 @@ -- AKA: inchstr() -- #1A NAME="AFU_105"#2| - procedure Peek (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Str : out Attributed_String; + procedure Peek (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : out Attributed_String; Len : in Integer := -1); -- AKA: mvwinchnstr() -- AKA: mvwinchstr() @@ -1458,8 +1460,8 @@ -- |===================================================================== -- #1A NAME="AFU_106"#2| - procedure Get (Win : in Window := Standard_Window; - Str : out String; + procedure Get (Win : in Window := Standard_Window; + Str : out String; Len : in Integer := -1); -- AKA: wgetnstr() -- AKA: wgetstr() @@ -1469,10 +1471,10 @@ -- overflows. -- #1A NAME="AFU_107"#2| - procedure Get (Win : in Window := Standard_Window; - Line : in Line_Position; - Column : in Column_Position; - Str : out String; + procedure Get (Win : in Window := Standard_Window; + Line : in Line_Position; + Column : in Column_Position; + Str : out String; Len : in Integer := -1); -- AKA: mvwgetnstr() -- AKA: mvwgetstr() @@ -1486,11 +1488,11 @@ -- Not Implemented: slk_attr_on, slk_attr_off, slk_attr_set - type Soft_Label_Key_Format is (Three_Two_Three, - Four_Four, - PC_Style, -- ncurses specific - PC_Style_With_Index); -- " - type Label_Number is new Positive range 1 .. 12; + type Soft_Label_Key_Format is (Three_Two_Three, + Four_Four, + PC_Style, -- ncurses specific + PC_Style_With_Index); -- " + type Label_Number is new Positive range 1 .. 12; type Label_Justification is (Left, Centered, Right); -- #1A NAME="AFU_108"#2| @@ -1500,8 +1502,8 @@ pragma Inline (Init_Soft_Label_Keys); -- #1A NAME="AFU_109"#2| - procedure Set_Soft_Label_Key (Label : in Label_Number; - Text : in String; + procedure Set_Soft_Label_Key (Label : in Label_Number; + Text : in String; Fmt : in Label_Justification := Left); -- AKA: slk_set() -- We don't inline this procedure @@ -1517,7 +1519,7 @@ pragma Inline (Refresh_Soft_Label_Keys_Without_Update); -- #1A NAME="AFU_112"#2| - procedure Get_Soft_Label_Key (Label : in Label_Number; + procedure Get_Soft_Label_Key (Label : in Label_Number; Text : out String); -- AKA: slk_label() @@ -1544,7 +1546,7 @@ -- #1A NAME="AFU_117"#2| procedure Switch_Soft_Label_Key_Attributes - (Attr : in Character_Attribute_Set; + (Attr : in Character_Attribute_Set; On : in Boolean := True); -- AKA: slk_attron() -- AKA: slk_attroff() @@ -1552,7 +1554,7 @@ -- #1A NAME="AFU_118"#2| procedure Set_Soft_Label_Key_Attributes - (Attr : in Character_Attribute_Set := Normal_Video; + (Attr : in Character_Attribute_Set := Normal_Video; Color : in Color_Pair := Color_Pair'First); -- AKA: slk_attrset() pragma Inline (Set_Soft_Label_Key_Attributes); @@ -1581,7 +1583,7 @@ -- |===================================================================== -- #1A NAME="AFU_122"#2| - procedure Enable_Key (Key : in Special_Key_Code; + procedure Enable_Key (Key : in Special_Key_Code; Enable : in Boolean := True); -- AKA: keyok() pragma Inline (Enable_Key); @@ -1591,7 +1593,7 @@ -- |===================================================================== -- #1A NAME="AFU_123"#2| - procedure Define_Key (Definition : in String; + procedure Define_Key (Definition : in String; Key : in Special_Key_Code); -- AKA: define_key() pragma Inline (Define_Key); @@ -1605,7 +1607,7 @@ -- -- #1A NAME="AFU_124"#2| - procedure Key_Name (Key : in Real_Key_Code; + procedure Key_Name (Key : in Real_Key_Code; Name : out String); -- AKA: keyname() -- The external name for a real keystroke. @@ -1617,7 +1619,7 @@ -- We don't inline this routine -- #1A NAME="AFU_126"#2| - procedure Un_Control (Ch : in Attributed_Character; + procedure Un_Control (Ch : in Attributed_Character; Str : out String); -- AKA: unctrl() @@ -1707,15 +1709,15 @@ pragma Import (C, Start_Color, "start_color"); -- #1A NAME="AFU_141"#2| - procedure Init_Pair (Pair : in Redefinable_Color_Pair; - Fore : in Color_Number; + procedure Init_Pair (Pair : in Redefinable_Color_Pair; + Fore : in Color_Number; Back : in Color_Number); -- AKA: init_pair() pragma Inline (Init_Pair); -- #1A NAME="AFU_142"#2| - procedure Pair_Content (Pair : in Color_Pair; - Fore : out Color_Number; + procedure Pair_Content (Pair : in Color_Pair; + Fore : out Color_Number; Back : out Color_Number); -- AKA: pair_content() pragma Inline (Pair_Content); @@ -1726,9 +1728,9 @@ pragma Inline (Has_Colors); -- #1A NAME="AFU_144"#2| - procedure Init_Color (Color : in Color_Number; - Red : in RGB_Value; - Green : in RGB_Value; + procedure Init_Color (Color : in Color_Number; + Red : in RGB_Value; + Green : in RGB_Value; Blue : in RGB_Value); -- AKA: init_color() pragma Inline (Init_Color); @@ -1739,9 +1741,9 @@ pragma Inline (Can_Change_Color); -- #1A NAME="AFU_146"#2| - procedure Color_Content (Color : in Color_Number; - Red : out RGB_Value; - Green : out RGB_Value; + procedure Color_Content (Color : in Color_Number; + Red : out RGB_Value; + Green : out RGB_Value; Blue : out RGB_Value); -- AKA: color_content() pragma Inline (Color_Content); @@ -1776,15 +1778,15 @@ pragma Inline (Reset_Terminal_State); type Stdscr_Init_Proc is access - function (Win : Window; - Columns : Column_Count) return Integer; + function (Win : Window; + Columns : Column_Count) return Integer; pragma Convention (C, Stdscr_Init_Proc); -- N.B.: the return value is actually ignored, but it seems to be -- a good practice to return 0 if you think all went fine -- and -1 otherwise. -- #1A NAME="AFU_151"#2| - procedure Rip_Off_Lines (Lines : in Integer; + procedure Rip_Off_Lines (Lines : in Integer; Proc : in Stdscr_Init_Proc); -- AKA: ripoffline() -- N.B.: to be more precise, this uses a ncurses specific enhancement of @@ -1810,9 +1812,9 @@ -- |===================================================================== type Transform_Direction is (From_Screen, To_Screen); procedure Transform_Coordinates - (W : in Window := Standard_Window; - Line : in out Line_Position; - Column : in out Column_Position; + (W : in Window := Standard_Window; + Line : in out Line_Position; + Column : in out Column_Position; Dir : in Transform_Direction := From_Screen); -- This procedure transforms screen coordinates into coordinates relative -- to the window and vice versa, depending on the Dir parameter. @@ -1831,7 +1833,7 @@ pragma Inline (Use_Default_Colors); -- #1A NAME="AFU_155"#2| - procedure Assume_Default_Colors (Fore : Color_Number := Default_Color; + procedure Assume_Default_Colors (Fore : Color_Number := Default_Color; Back : Color_Number := Default_Color); -- AKA: assume_default_colors() pragma Inline (Assume_Default_Colors); @@ -1899,8 +1901,8 @@ -- |===================================================================== -- #1A NAME="AFU_162"#2| - procedure Resize (Win : Window := Standard_Window; - Number_Of_Lines : Line_Count; + procedure Resize (Win : Window := Standard_Window; + Number_Of_Lines : Line_Count; Number_Of_Columns : Column_Count); -- AKA: wresize() @@ -1911,28 +1913,28 @@ -- The next constants are generated and may be different on your -- architecture. -- - Offset_maxy : constant Natural := 2; -- short - Offset_maxx : constant Natural := 3; -- short - Offset_begy : constant Natural := 4; -- short - Offset_begx : constant Natural := 5; -- short - Offset_cury : constant Natural := 0; -- short - Offset_curx : constant Natural := 1; -- short - Offset_yoffset : constant Natural := 36; -- short - Offset_pary : constant Natural := 13; -- int - Offset_parx : constant Natural := 12; -- int - Offset_notimeout : constant Natural := 24; -- char - Offset_clear : constant Natural := 25; -- char - Offset_leaveok : constant Natural := 26; -- char - Offset_scroll : constant Natural := 27; -- char - Offset_idlok : constant Natural := 28; -- char - Offset_idcok : constant Natural := 29; -- char - Offset_immed : constant Natural := 30; -- char - Offset_sync : constant Natural := 31; -- char - Offset_use_keypad : constant Natural := 32; -- char - Sizeof_bool : constant Natural := 1; -- bool + Offset_maxy : constant Natural := 2; -- short + Offset_maxx : constant Natural := 3; -- short + Offset_begy : constant Natural := 4; -- short + Offset_begx : constant Natural := 5; -- short + Offset_cury : constant Natural := 0; -- short + Offset_curx : constant Natural := 1; -- short + Offset_yoffset : constant Natural := 36; -- short + Offset_pary : constant Natural := 13; -- int + Offset_parx : constant Natural := 12; -- int + Offset_notimeout : constant Natural := 24; -- char + Offset_clear : constant Natural := 25; -- char + Offset_leaveok : constant Natural := 26; -- char + Offset_scroll : constant Natural := 27; -- char + Offset_idlok : constant Natural := 28; -- char + Offset_idcok : constant Natural := 29; -- char + Offset_immed : constant Natural := 30; -- char + Offset_sync : constant Natural := 31; -- char + Offset_use_keypad : constant Natural := 32; -- char + Sizeof_bool : constant Natural := 1; -- bool Offset_XY : constant Natural := 1; -- int - type Curses_Bool is mod 2 ** Interfaces.C.char'Size; + type Curses_Bool is mod 2 ** Interfaces.C.char'Size; Curses_Bool_False : constant Curses_Bool := 0; end Terminal_Interface.Curses; diff --git a/doc/html/ada/terminal_interface__ads.htm b/doc/html/ada/terminal_interface__ads.htm index 4557d5b9..7a229213 100644 --- a/doc/html/ada/terminal_interface__ads.htm +++ b/doc/html/ada/terminal_interface__ads.htm @@ -1,3 +1,4 @@ + terminal_interface.ads

    File : terminal_interface.ads


    @@ -42,12 +43,12 @@ -- @Revision: 1.12 @ -- Binding Version 01.00 ------------------------------------------------------------------------------ -package Terminal_Interface is - pragma Pure (Terminal_Interface); +package Terminal_Interface is + pragma Pure (Terminal_Interface); -- -- Everything is in the child units -- -end Terminal_Interface; +end Terminal_Interface; diff --git a/doc/html/announce.html b/doc/html/announce.html index caecbd72..d85b72f7 100644 --- a/doc/html/announce.html +++ b/doc/html/announce.html @@ -1,16 +1,16 @@ -Announcing ncurses 5.4 +Announcing ncurses 5.5 -

    Announcing ncurses 5.4

    +

    Announcing ncurses 5.5

    The ncurses (new curses) library is a free software emulation of curses in System V Release 4.0, and more. It uses terminfo format, @@ -19,8 +19,8 @@ and multiple highlights and forms characters and function-key mapping, and has all the other SYSV-curses enhancements over BSD curses.

    In mid-June 1995, the maintainer of 4.4BSD curses declared that he -considered 4.4BSD curses obsolete, and is encouraging the keepers of -Unix releases such as BSD/OS, freeBSD and netBSD to switch over to +considered 4.4BSD curses obsolete, and encouraged the keepers of +Unix releases such as BSD/OS, FreeBSD and NetBSD to switch over to ncurses.

    The ncurses code was developed under GNU/Linux. @@ -42,198 +42,186 @@ the GNU distribution site

    Release Notes

    -This release is designed to be upward compatible from ncurses 5.0 and 5.3; +This release is designed to be upward compatible from ncurses 5.0 through 5.4; very few applications will require recompilation, depending on the platform. -These are the highlights from the change-log since ncurses 5.3 release. +These are the highlights from the change-log since ncurses 5.4 release.

    Interface changes:

      -
    • add the remaining functions for X/Open curses wide-character - support. -
        -
      • pecho_wchar() -
      • slk_wset() -
      - These are only available if the library is configured using the - --enable-widec option. - -
    • write getyx() and related 2-return macros in terms of - getcury(), - getcurx(), etc. - -
    • simplify ifdef for bool declaration in curses.h - -
    • modify ifdef's in curses.h that disabled use of - __attribute__() for g++, since recent versions - implement the cases which ncurses uses. - -
    • add key_defined() function, to tell which keycode a - string is bound to. +
    • terminfo installs "xterm-new" as "xterm" entry rather than + "xterm-old" (aka xterm-r6). + +
    • terminfo data is installed using the tic -x option (few systems + still use ncurses 4.2). + +
    • modify C++ binding to work with newer C++ compilers by providing + initializers and using modern casts. Old-style header names are + still used in this release to allow compiling with not-so-old + compilers. + +
    • modify parameter type in c++ binding for insch() and mvwinsch() to + be consistent with underlying ncurses library (was char, is chtype). + +
    • change NCursesWindow::err_handler() to a virtual function. + +
    • form and menu libraries now work with wide-character data. + Applications which bypassed the form library and manipulated the + FIELD.buf data directly will not work properly with libformw, + since that no longer points to an array of char. The + set_field_buffer() and field_buffer() functions translate to/from + the actual field data. + + +
    • add symbol to curses.h which can be used to suppress include of + stdbool.h, e.g., +
      +                #define NCURSES_ENABLE_STDBOOL_H 0
      +                #include <curses.h>
      +          
      + +
    • change SP->_current_attr to a pointer, adjust ifdef's to ensure + that libtinfo.so and libtinfow.so have the same ABI. The reason + for this is that the corresponding data which belongs to the + upper-level ncurses library has a different size in each model. + +
    • winnstr() now returns multibyte character strings for the + wide-character configuration. + +
    • assume_default_colors() no longer requires that + use_default_colors() be called first. + +
    • data_ahead() now works with wide-characters. + +
    • slk_set() and slk_wset() now accept and store multibyte or + multicolumn characters. + +
    • start_color() now returns OK if colors have + already been started. + start_color() also returns ERR if it cannot allocate memory. + +
    • pair_content() now returns -1 for consistency with init_pair() + if it corresponds to the default-color. + +
    • unctrl() now returns null if its parameter does not correspond + to an unsigned char. +
    New features and improvements:
    • library
        -
      • implement logic in lib_mouse.c to handle position reports which - are generated when XFree86 xterm is initialized with private - modes 1002 or 1003. These are returned to the application as the - REPORT_MOUSE_POSITION mask, which was not implemented. -
      • modify soft-key initialization to use A_REVERSE if A_STANDOUT - would not be shown when colors are used, i.e., if ncv#1 is set in - the terminfo as is done in "screen". -
      • add configure option for FreeBSD sysmouse, --with-sysmouse, and - implement library support for that. +
      • environment variable NCURSES_NO_UTF8_ACS supports + miscellaneous terminal emulators which ignore alternate + character set escape sequences when in UTF-8 mode. + +
      • modify initialization of key lookup table so that if an extended + capability (tic -x) string is defined, and its name begins with 'k', + ncurses will automatically treat it as a key. + +
      • change GPM initialization, using dl library to load it + dynamically at runtime. + +
      • form, menu and panel libraries support debug-tracing. +
      -
    • programs: +
    • add NCURSES-Programming-HOWTO.html by Pradeep Padala + (see http://tldp.org/HOWTO/NCURSES-Programming-HOWTO/). -
        -
      • tack: +
      • programs: +
      • infocmp:
          -
        • allow it to run from fallback terminfo data. -
        • reset colors after each color test, correct a place - where exit_standout_mode was used instead of - exit_attribute_mode. -
        • improve bce test by making it set colors other - than black on white. +
        • The -i option now matches 8-bit controls against its table + entries, e.g., so it can analyze the xterm-8bit entry. + +
        • add "-x" option to infocmp like tic's "-x", for use in "-F" + comparisons. This modifies infocmp to only report extended + capabilities if the -x option is given, making this more + consistent with tic. Some scripts may break, since infocmp + previous gave this information without an option. +
      • tic:
          -
        • handle a case where an entry has no - description, and capabilities begin on the same line as the entry - name. -
        • allow a terminfo entry with a leading 2-character name. -
        • improved warnings when suppressing items to fit in termcap's - 1023-byte limit. -
        • add check for multiple "tc=" clauses in a termcap. -
        • correct logic for resolving "use=" clauses - allow infocmp and tic to show cancelled capabilities. -
        • check for incomplete line-drawing character mapping. -
        • check for missing/empty/illegal terminfo name. -
        -
      • tput: -
          -
        • modify tput to use the same parameter analysis as tparm() does, - to provide for user-defined strings, e.g., for xterm title, a - corresponding capability might be - title=\E]2;%p1%s^G, +
        • modify termcap-parsing to retain 2-character aliases at the + beginning of an entry if the "-x" option is used in tic. + +
        • filter out long extended names when translating to termcap + format. Only two characters are permissible for termcap + capability names. + +
        • correct translation of "%%" in terminfo format to termcap, + e.g., using "tic -C". + +
        • modify the "-c -v" options to ignore delays when comparing + strings. Also modify it to ignore a canceled sgr string, + e.g., for terminals which cannot properly combine attributes + in one control sequence. + +
        • add a check for improperly ended strings, i.e., where a + following line begins in column 1. + +
        • add a check in tic for terminfo entries having an sgr0 but no + sgr string. This confuses Tru64 and HPUX curses when combined + with color, e.g., making them leave line-drawing characters in + odd places. + +
        • add check (with debug configuration) that provides about the + runtime changes that would be made to sgr0 for termcap + applications. +
      • tset:
          -
        • use the system's default values for CKILL and other default - control characters. -
        • correct interchanged defaults for kill and interrupt - characters, which caused it to report unnecessarily. + +
        • add -c and -w options to allow user to suppress ncurses' + resizing of the terminal emulator window in the special case + where it is not able to detect the true size. +
        -
    Major bug fixes:
      -
    • prevent recursion in wgetch() via wgetnstr() if the connection - cannot be switched between cooked/raw modes because it is not a TTY. -
    • correct a case in _nc_remove_string(), used by - define_key(), to avoid infinite loop if the given string - happens to be a substring of other strings which are assigned to keys. +
    • improve logic in tgetent() which adjusts the termcap "me" string + to work with ISO-2022 string used in xterm-new. + This is a feature that was incompletely implemented in ncurses 5.3. + ncurses attempts to provide termcap clients with the portion of + the sgr0 (termcap "me") string that does not reset line-drawing. -
    • modify logic of acsc to use the original character if no mapping is - defined, rather than a null. +
    • cells in the WINDOW which are continuations of a multicolumn + character are encoded differently, making repainting more + reliable. -
    • several improvements for handling multi-cell display of wide - characters. -
        -
      • modify setcchar() to allow converting control characters to complex - characters. -
      • correct handling of multibyte characters in waddch_literal() which - force wrapping because they are started too late on the line. -
      • modify setcchar() to allow for wchar_t input strings that have - more than one spacing character. -
      +
    • amend change to setupterm() in ncurses 5.4 (20030405) which would + reuse the value of cur_term if the same output was selected. This + now reuses it only when setupterm() is called from tgetent(), + which has no notion of separate SCREENs. Note that tgetent() must + be called after initscr() or newterm() to use this feature. -
    • other fixes for wide-character support: -
        -
      • rewrote lib_acs.c to allow PutAttrChar() to decide how to render - alternate-characters, i.e., to work with Linux console and UTF-8 - locale. -
      • implement a workaround so that line-drawing works with screen's - crippled UTF-8 support (tested with 3.9.13). This only works with - the wide-character support (--enable-widec); the normal library - will simply suppress line-drawing when running in a UTF-8 locale in - screen. -
      • corrections to lib_get_wstr.c: -
          -
        • null-terminate buffer passed to setcchar(), which occasionally - failed. -
        • map special characters such as erase- and kill-characters into - key-codes so those will work as expected even if they are not - mentioned in the terminfo. -
        -
      +
    • make setcchar() now works when its wchar_t* parameter is + pointing to a string which contains more data than can be converted. -
    • modify setupterm() to check if the terminfo and - terminal-modes have already been read. This ensures that it does not - reinvoke def_prog_mode() when an application calls more - than one function, such as tgetent() and - initscr(). +
    • win_wchnstr() now works for more than one cell. -
    • fix form_driver() cases for REQ_CLR_EOF, REQ_CLR_EOL, REQ_DEL_CHAR, - REQ_DEL_PREV and REQ_NEW_LINE, which did not ensure the cursor was at - the editing position before making modifications. +
    • resizeterm() now processes all levels of window hierarchy. -
    • correct keybound(), which reported definitions in the - wrong table, i.e., the list of definitions which are disabled by - keyok(). +
    • disable GPM mouse support when $TERM happens to be prefixed with + "xterm". Gpm_Open() would otherwise assert that it can deal with + mouse events in this case. -
    • fixes related to safe_sprintf.c: -
        -
      • correct an allocation size in safe_sprintf.c for the "*" format - code. -
      • correct safe_sprintf.c to not return a null pointer if the format - happens to be an empty string. -
      • make return value from _nc_printf_string() consistent. Before, - depending on whether --enable-safe-sprintf was used, it might not - be cached for reallocating. -
      +
    • add SP->_screen_acs_map[], used to ensure that mapping of missing + line-drawing characters is handled properly. For example, ACS_DARROW + is absent from xterm-new, and it was coincidentally displayed the + same as ACS_BTEE. -
    • other low-level improvements to the optimization code include: -
        -
      • if the output is a socket or other non-tty device, use 1 - millisecond - for the cost in mvcur; previously it was 9 milliseconds because the - baudrate was not known. -
      • modify lib_getch.c to avoid recursion via wgetnstr() when the - input - is not a tty and consequently mode-changes do not work. -
      • fix several places in tack/pad.c which tested and used the - parameter- and parameterless strings inconsistently. -
      • change several tputs() calls in scrolling code to use putp(), to - enable padding which may be needed for some terminals. -
      • improve mvcur() by checking if it is safe to move when video - attributes are set (msgr), and if not, reset/restore attributes - within that function rather than doing it separately in the GoTo() - function in tty_update.c. -
      • use tputs() rather than putp() in a few cases in tty_update.c - since the corresponding delays are proportional to the number of - lines affected: repeat_char, clr_eos, change_scroll_region. -
      - -
    • correct line/column reference in adjust_window(), needed to make - special windows such as curscr track properly when resizing. - -
    • fix a potential recursion between napms() and _nc_timed_wait() - -
    • rewrote lib_insch.c, combining it with lib_insstr.c so both handle - tab and other control characters consistently. - -
    • do not try to open gpm mouse driver if standard output is not a - tty; the gpm library does not make this check.
    Portability: @@ -242,97 +230,85 @@ Portability:
    • new options:
      -
      --with-abi-version option. -
      addresses platforms where packagers have diverged from - ncurses ABI numbering. -
      --with-manpage-format=catonly -
      addresses - behavior of BSDI, allow install of man+cat files on NetBSD, - whose behavior has diverged by requiring both to be present. -
      --with-manpage-aliases -
      extends - "--with-manpage-aliases" to provide the option of generating - ".so" files rather than symbolic links for manpage aliases. -
      --with-rel-version -
      workaround to force - libtool on Darwin generate the "same" library names as with - the "--with-shared" option. The Darwin ld program does not - work well with a zero as the minor-version value. -
      --with-trace -
      simplifies defining TRACE to incorporate trace() in libraries. +
      --enable-largefile +
      set compiler and linker flags to use largefile support. + +
      --enable-ext-colors +
      Allow encoding of 256 foreground + and background colors, e.g., with the xterm-256color or + xterm-88color terminfo entries. + This requires ABI 6 because it changes the size of cchar_t. + +
      --enable-ext-mouse +
      This defines NCURSES_MOUSE_VERSION 2, and modifies the encoding of + mouse events to support wheel mice, which may transmit buttons + 4 and 5. This works with xterm and similar terminal + emulators. + This requires ABI 6 because it changes the encoding of + mouse events. + +
      --with-chtype +
      overriding of the non-LP64 model's use of chtype + +
      --with-mmask-t +
      overriding of the non-LP64 model's use of mmask_t + +
      --without-xterm-new +
      Installs "xterm-old" as the "xterm" entry of the terminfo + database. +
      - + +
    • The --with-termlib option now accepts a value which sets + the name of the terminfo library. This would allow a packager to + build libtinfow.so renamed to coincide with libtinfo.so +
    • fixes/improvements for cross-compiling: - -
        -
      • allow BUILD_CC and related configure script variables to be - overridden from the environment. -
      • use AC_CHECK_TOOL to get proper values for AR and LD for cross - compiling. -
      • use $cross_compiling variable in configure script - rather than comparing $host_alias and - $target alias, since "host" is traditionally misused - in autoconf to refer to the target platform. -
      • modify run_tic.in to avoid using wrong shared libraries when - cross-compiling. -
      - -
    • fixes for Mac OS X: -
        -
      • fix a redefinition of $RANLIB in the configure - script when libtool is used. -
      • modify MKlib_gen.sh to avoid passing "#" tokens through the C - preprocessor. This works around Mac OS X's preprocessor, which - insists on adding a blank on each side of the token. -
      - -
    • workarounds for broken tools: +
        -
      • add configure check for wchar_t and wint_t types, rather than - rely on preprocessor definitions. Also work around for gcc - fixinclude bug which creates a shadow copy of - curses.h if it sees these symbols apparently typedef'd. -
      • modify configure script to omit -Winline for gcc 3.3, since - that feature is broken. -
      • several script fixes to work around the ironically named - POSIXLY_CORRECT feature of GNU sed 4.0. -
      • modify configure script to avoid using "head -1", which does - not work if POSIXLY_CORRECT (sic) is set. -
      • update configure script to reflect fix for - AC_PROG_GCC_TRADITIONAL, which is broken in autoconf 2.5x for Mac - OS X 10.2.3. -
      • repair check for missing C++ compiler, which is broken in - autoconf 2.5x by hardcoding it to g++. +
      • suppress $suffix in misc/run_tic.sh when cross-compiling. + This allows cross-compiles to use the host's tic program to + handle the "make install.data" step. + +
      • correct BUILD_CPPFLAGS substitution in ncurses/Makefile.in, to allow + cross-compiling from a separate directory tree. +
      - -
    • corrected ifdef's relating to configure check for wchar_t, etc. -
    • remove configure script check to allow -Wconversion for older - versions of gcc -
    • modify configure script to accommodate libtool 1.5, as well as - add an parameter to the "--with-libtool" option which can specify - the pathname of libtool. -
    • change several sed scripts to avoid using "\+" since it is not a - BRE (basic regular expression). One instance caused terminfo.5 to - be misformatted on FreeBSD. -
    • use '%' as sed substitute delimiter in run_tic script to avoid - problems with pathname delimiters such as ':' and '@'. -
    • add -D_XOPEN_SOURCE=500 if needed when configuring with - "--enable-widec", to get mbstate_t declaration on HPUX - 11.11. +
  • library:
      -
    • adjust include-options in CF_ETIP_DEFINES to avoid missing - ncurses_dll.h, fixing special definitions that may be needed for - etip.h. -
    • modify CF_LIB_SUFFIX for Itanium releases of HP-UX, which use a - ".so" suffix. -
    • improve ifdef's to guard against redefinition of wchar_t and wint_t - in curses.h. -
    • remove an #undef for KEY_EVENT from curses.tail used in the - experimental NCURSES_WGETCH_EVENTS feature. The #undef confuses - Debian dpkg's build script. + +
    • add ifdef's for _LP64 in curses.h to avoid using wasteful + 64-bits for chtype and mmask_t, but add configure option + --disable-lp64 in case anyone used that configuration. + +
    • modify C++ binding to use some C internal functions to make it + compile properly on Solaris (and other platforms). + +
    • remove check in newwin() that prevents allocating windows that + extend beyond the screen (Solaris does this). + +
    • check for nl_langinfo(CODESET), use it if available. + This replaces ad hoc tests of environment variables to + check if the terminal is setup for UTF-8 encoding. + Applications which do not call setlocale() + should be corrected, to make them work properly with + UTF-8 encoding. +
      + In particular, applications which assume (and + do not call setlocale()) that + Latin-1 codes are printable will no longer work in + a UTF-8 locale since the ad hoc check of environment + variables to see if the locale was UTF-8 is not used + when nl_langinfo(CODESET) is available. + +
    • use setlocale() to query the program's current locale rather + than using getenv(). This supports applications which rely + upon legacy treatment of 8-bit characters when the locale is + not initialized. +
    diff --git a/doc/html/man/captoinfo.1m.html b/doc/html/man/captoinfo.1m.html index 0b406690..f64f91da 100644 --- a/doc/html/man/captoinfo.1m.html +++ b/doc/html/man/captoinfo.1m.html @@ -2,7 +2,7 @@ @@ -41,7 +41,7 @@
     
    -captoinfo(1m)                                       captoinfo(1m)
    +captoinfo(1m)                                             captoinfo(1m)
     
     
     
    @@ -100,6 +100,7 @@
            has not mistakenly translated  a  completely  unknown  and
            random capability and/or syntax error.
     
    +
            Nonstd   Std    From           Terminfo
             name    name                 capability
            -----------------------------------------------
    @@ -115,8 +116,8 @@
            GE       ae     XENIX   exit_alt_charset_mode
            GS       as     XENIX   enter_alt_charset_mode
            HM       kh     XENIX   key_home
    -       LD       kL     XENIX   key_dl
     
    +       LD       kL     XENIX   key_dl
            PD       kN     XENIX   key_npage
            PN       po     XENIX   prtr_off
            PS       pf     XENIX   prtr_on
    @@ -137,6 +138,7 @@
            bilities for forms drawing, designed to take advantage  of
            the IBM PC high-half graphics.  They were as follows:
     
    +
            Cap          Graphic
            -----------------------------
            G2    upper left
    @@ -172,6 +174,7 @@
            minfo but incompatible with the SVr4 format. The following
            AIX extensions are automatically translated:
     
    +
             IBM    XSI
            -------------
            ksel    kslt
    @@ -179,6 +182,7 @@
            font0   s0ds
            font1   s1ds
            font2   s2ds
    +
            font3   s3ds
     
            Additionally, the AIX box1 capability  will  be  automati-
    @@ -211,7 +215,7 @@
     
     
     
    -                                                    captoinfo(1m)
    +                                                          captoinfo(1m)
     

    diff --git a/doc/html/man/clear.1.html b/doc/html/man/clear.1.html index d692180f..f2bd1d3a 100644 --- a/doc/html/man/clear.1.html +++ b/doc/html/man/clear.1.html @@ -40,7 +40,7 @@
     
    -clear(1)                                                 clear(1)
    +clear(1)                                                       clear(1)
     
     
     
    @@ -68,7 +68,7 @@
     
     
     
    -                                                         clear(1)
    +                                                               clear(1)
     

    diff --git a/doc/html/man/curs_add_wch.3x.html b/doc/html/man/curs_add_wch.3x.html index 564c4600..02cbae7f 100644 --- a/doc/html/man/curs_add_wch.3x.html +++ b/doc/html/man/curs_add_wch.3x.html @@ -40,7 +40,7 @@
     
    -curs_add_wch(3x)                                 curs_add_wch(3x)
    +curs_add_wch(3x)                                       curs_add_wch(3x)
     
     
     
    @@ -130,7 +130,7 @@
     
     
     
    -                                                 curs_add_wch(3x)
    +                                                       curs_add_wch(3x)
     

    diff --git a/doc/html/man/curs_add_wchstr.3x.html b/doc/html/man/curs_add_wchstr.3x.html index 343a69b8..11d93b1d 100644 --- a/doc/html/man/curs_add_wchstr.3x.html +++ b/doc/html/man/curs_add_wchstr.3x.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -curs_add_wchstr(3x)                           curs_add_wchstr(3x)
    +curs_add_wchstr(3x)                                 curs_add_wchstr(3x)
     
     
     
    @@ -83,7 +83,7 @@
            riage  return characters), they do not advance the current
            cursor position, they do not expand other control  charac-
            ters  to  ^-escapes,  and  they  truncate the string if it
    -       crosses the right margin, rather then wrapping  it  around
    +       crosses the right margin, rather than wrapping  it  around
            to the new line.
     
            These  routines  end  successfully  on encountering a null
    @@ -112,11 +112,11 @@
     
     

    SEE ALSO

    -       curses(3x), curs_addchstr(3x) curs_addwstr(3x)
    +       curses(3x), curs_addchstr(3x), curs_addwstr(3x)
     
     
     
    -                                              curs_add_wchstr(3x)
    +                                                    curs_add_wchstr(3x)
     

    diff --git a/doc/html/man/curs_addch.3x.html b/doc/html/man/curs_addch.3x.html index 301f3007..d5ce2fe2 100644 --- a/doc/html/man/curs_addch.3x.html +++ b/doc/html/man/curs_addch.3x.html @@ -2,7 +2,7 @@ @@ -41,7 +41,7 @@
     
    -curs_addch(3x)                                     curs_addch(3x)
    +curs_addch(3x)                                           curs_addch(3x)
     
     
     
    @@ -115,6 +115,7 @@
            replacement for it (but see the EXTENSIONS section below).
            The names are taken from VT100 nomenclature.
     
    +
            Name           Default   Description
            --------------------------------------------------
            ACS_BLOCK      #         solid square block
    @@ -183,6 +184,10 @@
            The  TABSIZE  variable  is implemented in some versions of
            curses, but is not part of X/Open curses.
     
    +       If ch is a carriage return, the cursor  is  moved  to  the
    +       beginning  of the current row of the window.  This is true
    +       of other implementations, but is not documented.
    +
     
     

    SEE ALSO

    @@ -191,7 +196,7 @@
     
     
     
    -                                                   curs_addch(3x)
    +                                                         curs_addch(3x)
     

    diff --git a/doc/html/man/curs_addchstr.3x.html b/doc/html/man/curs_addchstr.3x.html index 486f247d..dae7b70a 100644 --- a/doc/html/man/curs_addchstr.3x.html +++ b/doc/html/man/curs_addchstr.3x.html @@ -1,7 +1,7 @@ @@ -40,15 +40,15 @@
     
    -curs_addchstr(3x)                               curs_addchstr(3x)
    +curs_addchstr(3x)                                     curs_addchstr(3x)
     
     
     
     
     

    NAME

    -       addchstr,  addchnstr,  waddchstr,  waddchnstr, mvaddchstr,
    -       mvaddchnstr, mvwaddchstr, mvwaddchnstr - add a  string  of
    +       addchstr, addchnstr, waddchstr, waddchnstr, mvaddchstr,
    +       mvaddchnstr, mvwaddchstr, mvwaddchnstr - add a string of
            characters (and attributes) to a curses window
     
     
    @@ -78,13 +78,13 @@
            ters that will fit on the line.
     
            The window cursor is not advanced, and these routines work
    -       faster than waddnstr.  On the other hand, they don't  per-
    +       faster than waddnstr.  On the other hand, they do not per-
            form  any  kind  of  checking  (such  as  for the newline,
    -       backspace, or  carriage  return  characters),  they  don't
    -       advance  the  current  cursor  position, they don't expand
    -       other control characters to ^-escapes, and  they  truncate
    -       the  string  if  it  crosses the right margin, rather then
    -       wrapping it around to the new line.
    +       backspace, or carriage return characters), they do not ad-
    +       vance the current cursor position, they do not expand oth-
    +       er control characters to ^-escapes, and they truncate  the
    +       string  if  it crosses the right margin, rather then wrap-
    +       ping it around to the new line.
     
     
     
    @@ -94,6 +94,9 @@ other than ERR") upon successful completion, unless other- wise noted in the preceding routine descriptions. + X/Open does not define any error conditions. This imple- + mentation returns an error if the window pointer is null. +

    NOTES

    @@ -102,8 +105,8 @@
     
     

    PORTABILITY

    -       All  these  entry  points  are described in the XSI Curses
    -       standard, Issue 4.
    +       These  entry  points are described in the XSI Curses stan-
    +       dard, Issue 4.
     
     
     
    @@ -112,7 +115,7 @@ - curs_addchstr(3x) + curs_addchstr(3x)
    diff --git a/doc/html/man/curs_addstr.3x.html b/doc/html/man/curs_addstr.3x.html index 57ebeb6c..ccc93a3e 100644 --- a/doc/html/man/curs_addstr.3x.html +++ b/doc/html/man/curs_addstr.3x.html @@ -1,7 +1,7 @@ @@ -40,15 +40,15 @@
     
    -curs_addstr(3x)                                   curs_addstr(3x)
    +curs_addstr(3x)                                         curs_addstr(3x)
     
     
     
     
     

    NAME

    -       addstr,  addnstr,  waddstr, waddnstr, mvaddstr, mvaddnstr,
    -       mvwaddstr, mvwaddnstr - add a string of  characters  to  a
    +       addstr, addnstr, waddstr, waddnstr, mvaddstr, mvaddnstr,
    +       mvwaddstr, mvwaddnstr - add a string of characters to a
            curses window and advance cursor
     
     
    @@ -68,9 +68,9 @@
     
     

    DESCRIPTION

    -       These  routines  write  the characters of the (null-termi-
    -       nated) character string str on the given  window.   It  is
    -       similar  to  calling waddch once for each character in the
    +       These routines write the characters of the (null-terminat-
    +       ed) character string str on the given window.  It is simi-
    +       lar  to  calling  waddch  once  for  each character in the
            string.  The four routines with n  as  the  last  argument
            write  at  most n characters.  If n is -1, then the entire
            string will be added, up to the maximum number of  charac-
    @@ -84,6 +84,11 @@
            success  (the  SVr4 manuals specify only "an integer value
            other than ERR") upon successful completion.
     
    +       X/Open does not define any error conditions.  This  imple-
    +       mentation  returns  an error if the window pointer is null
    +       or if the string pointer is null or if  the  corresponding
    +       calls to waddch return an error.
    +
     
     

    NOTES

    @@ -93,9 +98,9 @@
     
     

    PORTABILITY

    -       All  these  entry  points  are described in the XSI Curses
    -       standard, Issue 4.  The XSI errors EILSEQ  and  EOVERFLOW,
    -       associated  with  extended-level  conformance, are not yet
    +       All these entry points are described  in  the  XSI  Curses
    +       standard,  Issue  4.  The XSI errors EILSEQ and EOVERFLOW,
    +       associated with extended-level conformance,  are  not  yet
            detected.
     
     
    @@ -105,7 +110,7 @@
     
     
     
    -                                                  curs_addstr(3x)
    +                                                        curs_addstr(3x)
     

    diff --git a/doc/html/man/curs_addwstr.3x.html b/doc/html/man/curs_addwstr.3x.html index 38e95897..5bfd04e6 100644 --- a/doc/html/man/curs_addwstr.3x.html +++ b/doc/html/man/curs_addwstr.3x.html @@ -1,7 +1,7 @@ @@ -40,14 +40,14 @@
     
    -curs_addwstr(3x)                                 curs_addwstr(3x)
    +curs_addwstr(3x)                                       curs_addwstr(3x)
     
     
     
     
     

    NAME

    -       addwstr,   addnwstr,   waddwstr,   waddnwstr,   mvaddwstr,
    +       addwstr, addnwstr, waddwstr, waddnwstr, mvaddwstr,
            mvaddnwstr, mvwaddwstr, mvwaddnwstr - add a string of wide
            characters to a curses window and advance cursor
     
    @@ -68,10 +68,10 @@
     
     

    DESCRIPTION

    -       These  routines  write  the characters of the (null-termi-
    -       nated) wchar_tcharacter string wstr on the  given  window.
    -       It  is  similar to constructing a cchar_t for each wchar_t
    -       in the string, then calling  wadd_wch  for  the  resulting
    +       These routines write the characters of the (null-terminat-
    +       ed) wchar_t character string wstr on the given window.  It
    +       is  similar  to constructing a cchar_t for each wchar_t in
    +       the  string,  then  calling  wadd_wch  for  the  resulting
            cchar_t.
     
            The mv routines perform cursor movement once, before writ-
    @@ -109,7 +109,7 @@
     
     
     
    -                                                 curs_addwstr(3x)
    +                                                       curs_addwstr(3x)
     

    diff --git a/doc/html/man/curs_attr.3x.html b/doc/html/man/curs_attr.3x.html index 80ddcc99..c8aefaea 100644 --- a/doc/html/man/curs_attr.3x.html +++ b/doc/html/man/curs_attr.3x.html @@ -2,7 +2,7 @@ @@ -41,19 +41,19 @@
     
    -curs_attr(3x)                                       curs_attr(3x)
    +curs_attr(3x)                                             curs_attr(3x)
     
     
     
     
     

    NAME

    -       attroff,  wattroff,  attron,  wattron,  attrset, wattrset,
    -       color_set,  wcolor_set,  standend,  wstandend,   standout,
    -       wstandout,   attr_get,   wattr_get,  attr_off,  wattr_off,
    -       attr_on, wattr_on,  attr_set,  wattr_set,  chgat,  wchgat,
    -       mvchgat, mvwchgat, PAIR_NUMBER - curses character and win-
    -       dow attribute control routines
    +       attroff, wattroff, attron, wattron, attrset, wattrset,
    +       color_set, wcolor_set, standend, wstandend, standout,
    +       wstandout, attr_get, wattr_get, attr_off, wattr_off,
    +       attr_on, wattr_on, attr_set, wattr_set, chgat, wchgat,
    +       mvchgat, mvwchgat, PAIR_NUMBER - curses character and
    +       window attribute control routines
     
     
     
    @@ -96,9 +96,9 @@

    DESCRIPTION

            These  routines  manipulate  the current attributes of the
            named window.  The current attributes of a window apply to
    -       all  characters that are written into the window with wad-
    -       dch, waddstr and wprintw.  Attributes are  a  property  of
    -       the  character,  and  move  with the character through any
    +       all characters that are written into the window with wadd-
    +       ch, waddstr and wprintw.  Attributes are a property of the
    +       character,   and  move  with  the  character  through  any
            scrolling and insert/delete line/character operations.  To
            the  extent  possible,  they  are displayed as appropriate
            modifications to the graphic rendition of  characters  put
    @@ -113,8 +113,8 @@
            same as attrset(A_NORMAL) or attrset(0), that is, it turns
            off all attributes.
     
    -       The  attrset  and  related  routines  do  not  affect  the
    -       attributes  used when erasing portions of the window.  See
    +       The attrset and related routines do  not  affect  the  at-
    +       tributes  used  when  erasing portions of the window.  See
            curs_bkgd(3x) for functions which  modify  the  attributes
            used for erasing and clearing.
     
    @@ -138,19 +138,20 @@
            the way to the end of the current line.  The wchgat  func-
            tion generalizes this to any window; the mvwchgat function
            does a cursor move before acting.  In these functions, the
    -       color  argument  is  a  color-pair  index (as in the first
    -       argument of  init_pair,  see  curs_color(3x)).   The  opts
    -       argument  is  not  presently used, but is reserved for the
    -       future (leave it NULL).  Note that changing the attributes
    -       does  not  imply that a subsequent refresh will update the
    -       screen to match, since the character values are not  modi-
    -       fied.   Use  touchwin  to  force  the  screen to match the
    -       updated attributes.
    +       color  argument is a color-pair index (as in the first ar-
    +       gument of init_pair, see curs_color(3x)).  The opts  argu-
    +       ment is not presently used, but is reserved for the future
    +       (leave it NULL).  Note that changing the  attributes  does
    +       not imply that a subsequent refresh will update the screen
    +       to match, since the character  values  are  not  modified.
    +       Use  touchwin to force the screen to match the updated at-
    +       tributes.
     
        Attributes
            The following video attributes, defined in <curses.h>, can
            be passed to the routines attron, attroff, and attrset, or
    -       OR'ed with the characters passed to addch.
    +       OR'd with the characters passed to addch.
    +
     
             A_NORMAL        Normal display (no highlight)
             A_STANDOUT      Best highlighting mode of the terminal.
    @@ -181,27 +182,35 @@
            Note  that  attroff,  wattroff,  attron, wattron, attrset,
            wattrset, standend and standout may be macros.
     
    +       COLOR_PAIR values can only be OR'd with attributes if  the
    +       pair  number  is  less  than 256.  The alternate functions
    +       such as color_set can pass a color  pair  value  directly.
    +       However,  ncurses  ABI 4 and 5 simply OR this value within
    +       the alternate functions.  You must use ncurses  ABI  6  to
    +       support more than 256 color pairs.
    +
     
     

    PORTABILITY

    -       All these functions are supported in the XSI Curses  stan-
    -       dard,  Issue  4.   The standard defined the dedicated type
    -       for highlights, attr_t,  which  is  not  defined  in  SVr4
    -       curses. The functions taking attr_t arguments are not sup-
    -       ported under SVr4.
    -
    -       The XSI Curses standard states  that  whether  the  tradi-
    -       tional  functions  attron/attroff/attrset  can  manipulate
    -       attributes other than A_BLINK, A_BOLD,  A_DIM,  A_REVERSE,
    -       A_STANDOUT,  or  A_UNDERLINE is "unspecified".  Under this
    -       implementation as well as  SVr4  curses,  these  functions
    -       correctly  manipulate  all other highlights (specifically,
    +       These  functions are supported in the XSI Curses standard,
    +       Issue 4.  The standard  defined  the  dedicated  type  for
    +       highlights,  attr_t,  which is not defined in SVr4 curses.
    +       The functions taking attr_t arguments  are  not  supported
    +       under SVr4.
    +
    +       The XSI Curses standard states that whether the tradition-
    +       al functions  attron/attroff/attrset  can  manipulate  at-
    +       tributes  other  than  A_BLINK,  A_BOLD, A_DIM, A_REVERSE,
    +       A_STANDOUT, or A_UNDERLINE is "unspecified".   Under  this
    +       implementation  as  well  as  SVr4 curses, these functions
    +       correctly manipulate all other  highlights  (specifically,
            A_ALTCHARSET, A_PROTECT, and A_INVIS).
     
    -       XSI Curses added the new entry points, attr_get,  attr_on,
    -       attr_off,   attr_set,   wattr_on,   wattr_off,  wattr_get,
    -       wattr_set.  These are intended to work with a  new  series
    -       of highlight macros prefixed with WA_.
    +       XSI  Curses added the new entry points, attr_get, attr_on,
    +       attr_off, attr_set, wattr_on, wattr_off,  wattr_get,  wat-
    +       tr_set.   These  are intended to work with a new series of
    +       highlight macros prefixed with WA_.
    +
     
             WA_NORMAL       Normal display (no highlight)
             WA_STANDOUT     Best highlighting mode of the terminal.
    @@ -213,13 +222,26 @@
             WA_ALTCHARSET   Alternate character set
     
            The XSI curses standard specifies that each pair of corre-
    -       sponding A_ and WA_-using functions operates on  the  same
    +       sponding  A_  and WA_-using functions operates on the same
            current-highlight information.
     
            The XSI standard extended conformance level adds new high-
            lights A_HORIZONTAL, A_LEFT, A_LOW, A_RIGHT, A_TOP, A_VER-
    -       TICAL  (and  corresponding WA_ macros for each) which this
    -       curses does not yet support.
    +       TICAL (and corresponding WA_ macros for each)  which  this
    +       implementation does not yet support.
    +
    +
    +
    +

    RETURN VALUE

    +       All  routines  return the integer OK on success, or ERR on
    +       failure.
    +
    +       X/Open does not define any error conditions.
    +
    +       This implementation returns an error if the window pointer
    +       is  null.  The wcolor_set function returns an error if the
    +       color  pair  parameter  is  outside  the   range   0..COL-
    +       OR_PAIRS-1.
     
     
     
    @@ -229,7 +251,7 @@ - curs_attr(3x) + curs_attr(3x)
    diff --git a/doc/html/man/curs_beep.3x.html b/doc/html/man/curs_beep.3x.html index 089f8aab..271acc1a 100644 --- a/doc/html/man/curs_beep.3x.html +++ b/doc/html/man/curs_beep.3x.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -curs_beep(3x)                                       curs_beep(3x)
    +curs_beep(3x)                                             curs_beep(3x)
     
     
     
    @@ -84,7 +84,7 @@
     
     

    PORTABILITY

    -       These functions are defined in the  XSI  Curses  standard,
    +       These functions are described in the XSI Curses  standard,
            Issue  4.  Like SVr4, it specifies that they always return
            OK.
     
    @@ -95,7 +95,7 @@
     
     
     
    -                                                    curs_beep(3x)
    +                                                          curs_beep(3x)
     

    diff --git a/doc/html/man/curs_bkgd.3x.html b/doc/html/man/curs_bkgd.3x.html index cbb09047..e73f90f9 100644 --- a/doc/html/man/curs_bkgd.3x.html +++ b/doc/html/man/curs_bkgd.3x.html @@ -40,7 +40,7 @@
     
    -curs_bkgd(3x)                                       curs_bkgd(3x)
    +curs_bkgd(3x)                                             curs_bkgd(3x)
     
     
     
    @@ -120,7 +120,7 @@
     
     
     
    -                                                    curs_bkgd(3x)
    +                                                          curs_bkgd(3x)
     

    diff --git a/doc/html/man/curs_bkgrnd.3x.html b/doc/html/man/curs_bkgrnd.3x.html index 6424ae28..d83bd633 100644 --- a/doc/html/man/curs_bkgrnd.3x.html +++ b/doc/html/man/curs_bkgrnd.3x.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -curs_bkgrnd(3x)                                   curs_bkgrnd(3x)
    +curs_bkgrnd(3x)                                         curs_bkgrnd(3x)
     
     
     
    @@ -118,7 +118,7 @@
     
     
     
    -                                                  curs_bkgrnd(3x)
    +                                                        curs_bkgrnd(3x)
     

    diff --git a/doc/html/man/curs_border.3x.html b/doc/html/man/curs_border.3x.html index 49176f3a..5a93d889 100644 --- a/doc/html/man/curs_border.3x.html +++ b/doc/html/man/curs_border.3x.html @@ -1,7 +1,7 @@ @@ -40,16 +40,16 @@
     
    -curs_border(3x)                                   curs_border(3x)
    +curs_border(3x)                                         curs_border(3x)
     
     
     
     
     

    NAME

    -       border,  wborder,  box, hline, whline, vline, wvline, mvh-
    -       line, mvwhline, mvvline, mvwvline - create curses borders,
    -       horizontal and vertical lines
    +       border, wborder, box, hline, whline, vline, wvline,
    +       mvhline, mvwhline, mvvline, mvwvline - create curses
    +       borders, horizontal and vertical lines
     
     
     
    @@ -118,6 +118,9 @@ says "or a non-negative integer if immedok is set", but this appears to be an error. + X/Open does not define any error conditions. This imple- + mentation returns an error if the window pointer is null. +

    NOTES

    @@ -141,7 +144,7 @@
     
     
     
    -                                                  curs_border(3x)
    +                                                        curs_border(3x)
     

    diff --git a/doc/html/man/curs_border_set.3x.html b/doc/html/man/curs_border_set.3x.html index 1e93b1f9..415e8103 100644 --- a/doc/html/man/curs_border_set.3x.html +++ b/doc/html/man/curs_border_set.3x.html @@ -1,7 +1,7 @@ @@ -40,15 +40,15 @@
     
    -curs_border_set(3x)                           curs_border_set(3x)
    +curs_border_set(3x)                                 curs_border_set(3x)
     
     
     
     
     

    NAME

    -       border_set,  wborder_set,  box_set, hline_set, whline_set,
    -       mvhline_set,    mvwhline_set,    vline_set,    wvline_set,
    +       border_set, wborder_set, box_set, hline_set, whline_set,
    +       mvhline_set, mvwhline_set, vline_set, wvline_set,
            mvvline_set, mvwvline_set - create curses borders or lines
            using complex characters and renditions
     
    @@ -158,6 +158,9 @@
            Upon successful completion,  these  functions  return  OK.
            Otherwise, they return ERR.
     
    +       Functions  using  a window parameter return an error if it
    +       is null.
    +
     
     

    SEE ALSO

    @@ -165,7 +168,7 @@
     
     
     
    -                                              curs_border_set(3x)
    +                                                    curs_border_set(3x)
     

    diff --git a/doc/html/man/curs_clear.3x.html b/doc/html/man/curs_clear.3x.html index 6838d5b9..e70f7757 100644 --- a/doc/html/man/curs_clear.3x.html +++ b/doc/html/man/curs_clear.3x.html @@ -1,7 +1,7 @@ @@ -40,15 +40,15 @@
     
    -curs_clear(3x)                                     curs_clear(3x)
    +curs_clear(3x)                                           curs_clear(3x)
     
     
     
     
     

    NAME

    -       erase,  werase,  clear,  wclear, clrtobot, wclrtobot, clr-
    -       toeol, wclrtoeol - clear all or part of a curses window
    +       erase, werase, clear, wclear, clrtobot, wclrtobot,
    +       clrtoeol, wclrtoeol - clear all or part of a curses window
     
     
     
    @@ -67,21 +67,21 @@

    DESCRIPTION

    -       The erase and werase routines copy blanks to  every  posi-
    +       The  erase  and werase routines copy blanks to every posi-
            tion in the window, clearing the screen.
     
    -       The  clear  and wclear routines are like erase and werase,
    -       but they also call clearok, so that the screen is  cleared
    -       completely  on  the  next call to wrefresh for that window
    +       The clear and wclear routines are like erase  and  werase,
    +       but  they also call clearok, so that the screen is cleared
    +       completely on the next call to wrefresh  for  that  window
            and repainted from scratch.
     
    -       The clrtobot and wclrtobot routines erase from the  cursor
    +       The  clrtobot and wclrtobot routines erase from the cursor
            to the end of screen.  That is, they erase all lines below
    -       the cursor in the window.  Also, the current line  to  the
    +       the  cursor  in the window.  Also, the current line to the
            right of the cursor, inclusive, is erased.
     
            The clrtoeol and wclrtoeol routines erase the current line
    -       to the right of the cursor, inclusive, to the end  of  the
    +       to  the  right of the cursor, inclusive, to the end of the
            current line.
     
            Blanks created by erasure have the current background ren-
    @@ -90,9 +90,13 @@
     
     

    RETURN VALUE

    -       All routines return the integer  OK.   The  SVr4.0  manual
    -       says  "or  a  non-negative integer if immedok is set", but
    -       this appears to be an error.
    +       All  routines  return the integer OK on success and ERR on
    +       failure.  The SVr4.0 manual says "or a non-negative  inte-
    +       ger if immedok is set", but this appears to be an error.
    +
    +       X/Open  defines  no error conditions.  In this implementa-
    +       tion, functions using a window pointer parameter return an
    +       error if it is null.
     
     
     
    @@ -103,15 +107,21 @@

    PORTABILITY

    -       These  functions are described in the XSI Curses standard,
    -       Issue 4.  The standard specifies that they return  ERR  on
    +       These functions are described in the XSI Curses  standard,
    +       Issue  4.   The standard specifies that they return ERR on
            failure, but specifies no error conditions.
     
    -       Some  historic  curses  implementations had, as an undocu-
    -       mented feature,  the  ability  to  do  the  equivalent  of
    -       clearok(...,  1)  by saying touchwin(stdscr) or clear(std-
    +       Some historic curses implementations had,  as  an  undocu-
    +       mented  feature,  the  ability  to  do  the  equivalent of
    +       clearok(..., 1) by saying touchwin(stdscr)  or  clear(std-
            scr).  This will not work under ncurses.
     
    +       This  implementation, and others such as Solaris, sets the
    +       current position to 0,0 after  erasing  via  werase()  and
    +       wclear().   That fact is not documented in other implemen-
    +       tations, and may not be true of implementations which were
    +       not derived from SVr4 source.
    +
     
     

    SEE ALSO

    @@ -119,7 +129,7 @@
     
     
     
    -                                                   curs_clear(3x)
    +                                                         curs_clear(3x)
     

    diff --git a/doc/html/man/curs_color.3x.html b/doc/html/man/curs_color.3x.html index eda9d7ec..8840f1df 100644 --- a/doc/html/man/curs_color.3x.html +++ b/doc/html/man/curs_color.3x.html @@ -1,7 +1,7 @@ @@ -40,15 +40,15 @@
     
    -curs_color(3x)                                     curs_color(3x)
    +curs_color(3x)                                           curs_color(3x)
     
     
     
     
     

    NAME

    -       start_color,     init_pair,     init_color,    has_colors,
    -       can_change_color, color_content, pair_content,  COLOR_PAIR
    +       start_color, init_pair, init_color, has_colors,
    +       can_change_color, color_content, pair_content, COLOR_PAIR
            - curses color manipulation routines
     
     
    @@ -68,8 +68,8 @@
     

    DESCRIPTION

        Overview
    -       curses support color attributes  on  terminals  with  that
    -       capability.   To  use  these  routines start_color must be
    +       curses support color attributes on terminals with that ca-
    +       pability.   To  use  these  routines  start_color  must be
            called, usually right after initscr.   Colors  are  always
            used  in pairs (referred to as color-pairs).  A color-pair
            consists of a foreground  color  (for  characters)  and  a
    @@ -77,100 +77,90 @@
            ters are displayed).  A programmer  initializes  a  color-
            pair  with  the routine init_pair.  After it has been ini-
            tialized, COLOR_PAIR(n), a macro  defined  in  <curses.h>,
    -       can be used as a new video attribute.
    -
    -       If  a  terminal  is capable of redefining colors, the pro-
    -       grammer can use the routine init_color to change the defi-
    -       nition   of   a   color.    The  routines  has_colors  and
    -       can_change_color  return  TRUE  or  FALSE,  depending   on
    -       whether  the  terminal  has color capabilities and whether
    -       the  programmer  can  change  the  colors.   The   routine
    -       color_content  allows  a programmer to extract the amounts
    -       of red, green,  and  blue  components  in  an  initialized
    -       color.   The  routine  pair_content allows a programmer to
    -       find out how a given color-pair is currently defined.
    +       can  be  used  as a new video attribute.  If a terminal is
    +       capable of redefining colors, the programmer can  use  the
    +       routine  init_color  to  change the definition of a color.
    +       The routines has_colors and can_change_color  return  TRUE
    +       or  FALSE, depending on whether the terminal has color ca-
    +       pabilities and whether the programmer can change the  col-
    +       ors.  The routine color_content allows a programmer to ex-
    +       tract the amounts of red, green, and blue components in an
    +       initialized color.  The routine pair_content allows a pro-
    +       grammer to find out how a given  color-pair  is  currently
    +       defined.
     
        Routine Descriptions
            The start_color routine requires no arguments.  It must be
    -       called  if  the programmer wants to use colors, and before
    -       any other color manipulation routine  is  called.   It  is
    -       good  practice  to  call this routine right after initscr.
    -       start_color initializes eight basic  colors  (black,  red,
    -       green,  yellow,  blue,  magenta, cyan, and white), and two
    -       global variables,  COLORS  and  COLOR_PAIRS  (respectively
    -       defining  the maximum number of colors and color-pairs the
    +       called if the programmer wants to use colors,  and  before
    +       any  other  color  manipulation  routine is called.  It is
    +       good practice to call this routine  right  after  initscr.
    +       start_color  initializes  eight  basic colors (black, red,
    +       green, yellow, blue, magenta, cyan, and  white),  and  two
    +       global  variables,  COLORS  and  COLOR_PAIRS (respectively
    +       defining the maximum number of colors and color-pairs  the
            terminal can support).  It also restores the colors on the
            terminal to the values they had when the terminal was just
    -       turned on.
    -
    -       The init_pair routine changes the definition of  a  color-
    -       pair.   It takes three arguments: the number of the color-
    -       pair to be changed, the foreground color number,  and  the
    -       background color number.  For portable applications:
    +       turned  on.   The init_pair routine changes the definition
    +       of a color-pair.  It takes three arguments: the number  of
    +       the color-pair to be changed, the foreground color number,
    +       and the background color number.   For  portable  applica-
    +       tions:
     
            -    The value of the first argument must be between 1 and
                 COLOR_PAIRS-1.
     
            -    The value of the second and third arguments  must  be
    -            between  0  and  COLORS (the 0 color pair is wired to
    -            white on black and cannot be changed).
    +            between  0 and COLORS.  Color pair 0 is assumed to be
    +            white on black, but is actually whatever the terminal
    +            implements before color is initialized.  It cannot be
    +            modified by the application.
     
            If the color-pair was previously initialized,  the  screen
            is  refreshed  and  all occurrences of that color-pair are
    -       changed to the new definition.
    -
    -       As an extension, ncurses allows you to set  color  pair  0
    -       via  the  assume_default_colors routine, or to specify the
    -       use of default colors  (color  number  -1)  if  you  first
    -       invoke the use_default_colors routine.
    -
    -       The  init_color routine changes the definition of a color.
    -       It takes four arguments: the number of  the  color  to  be
    -       changed  followed  by three RGB values (for the amounts of
    -       red, green, and blue components).  The value of the  first
    -       argument  must  be between 0 and COLORS.  (See the section
    -       Colors for the default color index.)   Each  of  the  last
    -       three  arguments must be a value between 0 and 1000.  When
    -       init_color is used, all occurrences of that color  on  the
    -       screen immediately change to the new definition.
    -
    -       The  has_colors routine requires no arguments.  It returns
    -       TRUE if the terminal can manipulate colors; otherwise,  it
    -       returns FALSE.  This routine facilitates writing terminal-
    +       changed to the new definition.  As an  extension,  ncurses
    +       allows you to set color pair 0 via the assume_default_col-
    +       ors routine, or to specify the use of default colors (col-
    +       or  number  -1) if you first invoke the use_default_colors
    +       routine.  The init_color routine changes the definition of
    +       a color.  It takes four arguments: the number of the color
    +       to be changed  followed  by  three  RGB  values  (for  the
    +       amounts of red, green, and blue components).  The value of
    +       the first argument must be between 0 and COLORS.  (See the
    +       section  Colors for the default color index.)  Each of the
    +       last three arguments must be a value between 0  and  1000.
    +       When  init_color is used, all occurrences of that color on
    +       the screen immediately change to the new definition.   The
    +       has_colors routine requires no arguments.  It returns TRUE
    +       if the terminal can manipulate colors; otherwise,  it  re-
    +       turns  FALSE.   This routine facilitates writing terminal-
            independent programs.  For example, a programmer  can  use
    -       it  to  decide  whether  to  use color or some other video
    -       attribute.
    -
    -       The can_change_color routine requires  no  arguments.   It
    -       returns  TRUE  if  the  terminal  supports  colors and can
    -       change their definitions; other, it returns  FALSE.   This
    -       routine facilitates writing terminal-independent programs.
    -
    -       The color_content routine gives programmers a way to  find
    -       the intensity of the red, green, and blue (RGB) components
    -       in a color.  It requires four arguments: the color number,
    -       and  three addresses of shorts for storing the information
    -       about the amounts of red, green, and  blue  components  in
    -       the  given color.  The value of the first argument must be
    -       between 0 and COLORS.  The values that are stored  at  the
    -       addresses  pointed  to  by  the  last  three arguments are
    -       between 0 (no component) and 1000 (maximum amount of  com-
    -       ponent).
    -
    -       The  pair_content  routine  allows programmers to find out
    -       what colors a given color-pair consists of.   It  requires
    -       three  arguments: the color-pair number, and two addresses
    -       of shorts for storing the foreground  and  the  background
    -       color  numbers.   The  value of the first argument must be
    -       between 1 and COLOR_PAIRS-1.  The values that  are  stored
    -       at  the addresses pointed to by the second and third argu-
    -       ments are between 0 and COLORS.
    +       it  to decide whether to use color or some other video at-
    +       tribute.  The can_change_color routine requires  no  argu-
    +       ments.   It  returns  TRUE if the terminal supports colors
    +       and can change their definitions; other, it returns FALSE.
    +       This routine facilitates writing terminal-independent pro-
    +       grams.  The color_content routine gives programmers a  way
    +       to  find  the  intensity of the red, green, and blue (RGB)
    +       components in a color.  It requires  four  arguments:  the
    +       color  number,  and  three addresses of shorts for storing
    +       the information about the amounts of red, green, and  blue
    +       components in the given color.  The value of the first ar-
    +       gument must be between 0 and COLORS.  The values that  are
    +       stored at the addresses pointed to by the last three argu-
    +       ments are between  0  (no  component)  and  1000  (maximum
    +       amount  of  component).   The  pair_content routine allows
    +       programmers to find out what  colors  a  given  color-pair
    +       consists  of.  It requires three arguments: the color-pair
    +       number, and two addresses of shorts for storing the  fore-
    +       ground and the background color numbers.  The value of the
    +       first argument must be between 1 and  COLOR_PAIRS-1.   The
    +       values  that are stored at the addresses pointed to by the
    +       second and third arguments are between 0 and COLORS.
     
        Colors
            In <curses.h> the following macros are defined.  These are
            the  default colors.  curses also assumes that COLOR_BLACK
            is the default background color for all terminals.
    -
                  COLOR_BLACK
                  COLOR_RED
                  COLOR_GREEN
    @@ -184,39 +174,54 @@
     

    RETURN VALUE

            The routines can_change_color()  and  has_colors()  return
    -       TRUE or FALSE.
    -
    -       All other routines return the integer ERR upon failure and
    -       an OK (SVr4 specifies only "an integer  value  other  than
    -       ERR") upon successful completion.
    +       TRUE  or FALSE.  All other routines return the integer ERR
    +       upon failure and an OK (SVr4 specifies  only  "an  integer
    +       value other than ERR") upon successful completion.
    +
    +       X/Open  defines  no error conditions.  This implementation
    +       will return ERR on attempts to use  color  values  outside
    +       the range 0 to COLORS-1 (except for the default colors ex-
    +       tension), or use color pairs outside the range 0  to  COL-
    +       OR_PAIR-1.  Color values used in init_color must be in the
    +       range 0 to 1000.  An error is returned from all  functions
    +       if the terminal has not been initialized.  An error is re-
    +       turned from  secondary  functions  such  as  init_pair  if
    +       start_color was not called.
    +
    +              init_color
    +                   returns an error if the terminal does not sup-
    +                   port  this  feature,  e.g.,  if  the  initial-
    +                   ize_color capability is absent from the termi-
    +                   nal description.
    +
    +              start_color
    +                   returns an error If the color table cannot  be
    +                   allocated.
     
     
     

    NOTES

            In  the  ncurses implementation, there is a separate color
    -       activation flag, color palette,  color  pairs  table,  and
    -       associated  COLORS and COLOR_PAIRS counts for each screen;
    +       activation flag, color palette, color pairs table, and as-
    +       sociated  COLORS  and  COLOR_PAIRS counts for each screen;
            the start_color function only affects the current  screen.
            The SVr4/XSI interface is not really designed with this in
            mind, and historical  implementations  may  use  a  single
    -       shared color palette.
    -
    -       Note that setting an implicit background color via a color
    -       pair affects only character cells that a  character  write
    -       operation  explicitly  touches.   To change the background
    -       color used when parts of a window are blanked  by  erasing
    -       or scrolling operations, see curs_bkgd(3x).
    -
    -       Several  caveats  apply  on 386 and 486 machines with VGA-
    -       compatible graphics:
    -
    -       -    COLOR_YELLOW is actually brown.  To get  yellow,  use
    +       shared color palette.  Note that setting an implicit back-
    +       ground color via a color pair affects only character cells
    +       that  a  character write operation explicitly touches.  To
    +       change the background color used when parts  of  a  window
    +       are  blanked  by  erasing  or  scrolling  operations,  see
    +       curs_bkgd(3x).  Several caveats apply on 386 and  486  ma-
    +       chines with VGA-compatible graphics:
    +
    +       -    COLOR_YELLOW  is  actually brown.  To get yellow, use
                 COLOR_YELLOW combined with the A_BOLD attribute.
     
    -       -    The  A_BLINK  attribute  should  in  theory cause the
    -            background to go bright.  This often fails  to  work,
    -            and  even  some cards for which it mostly works (such
    -            as the Paradise and compatibles) do the  wrong  thing
    +       -    The A_BLINK attribute  should  in  theory  cause  the
    +            background  to  go bright.  This often fails to work,
    +            and even some cards for which it mostly  works  (such
    +            as  the  Paradise and compatibles) do the wrong thing
                 when you try to set a bright "yellow" background (you
                 get a blinking yellow foreground instead).
     
    @@ -225,28 +230,31 @@
     
     

    PORTABILITY

    -       This implementation satisfies XSI Curses's  minimum  maxi-
    +       This  implementation  satisfies XSI Curses's minimum maxi-
            mums for COLORS and COLOR_PAIRS.
     
    -       The  init_pair  routine  accepts  negative values of fore-
    -       ground   and   background    color    to    support    the
    -       use_default_colors extension, but only if that routine has
    -       been first invoked.
    +       The init_pair routine accepts  negative  values  of  fore-
    +       ground   and  background  color  to  support  the  use_de-
    +       fault_colors extension, but only if that routine has  been
    +       first invoked.
     
    -       The assumption that COLOR_BLACK is the default  background
    -       color   for  all  terminals  can  be  modified  using  the
    -       assume_default_colors extension,
    +       The  assumption that COLOR_BLACK is the default background
    +       color for all terminals can  be  modified  using  the  as-
    +       sume_default_colors extension.
     
    +       This  implementation  checks  the  pointers, e.g., for the
    +       values returned by  color_content  and  pair_content,  and
    +       will treat those as optional parameters when null.
     
     
     

    SEE ALSO

    -       curses(3x), curs_initscr(3x), curs_attr(3x),  default_col-
    +       curses(3x),  curs_initscr(3x), curs_attr(3x), default_col-
            ors(3x)
     
     
     
    -                                                   curs_color(3x)
    +                                                         curs_color(3x)
     

    diff --git a/doc/html/man/curs_delch.3x.html b/doc/html/man/curs_delch.3x.html index 6c2e8632..f723f68f 100644 --- a/doc/html/man/curs_delch.3x.html +++ b/doc/html/man/curs_delch.3x.html @@ -40,7 +40,7 @@
     
    -curs_delch(3x)                                     curs_delch(3x)
    +curs_delch(3x)                                           curs_delch(3x)
     
     
     
    @@ -97,7 +97,7 @@
     
     
     
    -                                                   curs_delch(3x)
    +                                                         curs_delch(3x)
     

    diff --git a/doc/html/man/curs_deleteln.3x.html b/doc/html/man/curs_deleteln.3x.html index 7f609254..5b98ca68 100644 --- a/doc/html/man/curs_deleteln.3x.html +++ b/doc/html/man/curs_deleteln.3x.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -curs_deleteln(3x)                               curs_deleteln(3x)
    +curs_deleteln(3x)                                     curs_deleteln(3x)
     
     
     
    @@ -87,6 +87,10 @@
            (SVr4 specifies only "an integer value  other  than  ERR")
            upon successful completion.
     
    +       X/Open  defines  no error conditions.  In this implementa-
    +       tion, if  the  window  parameter  is  null,  an  error  is
    +       returned.
    +
     
     

    PORTABILITY

    @@ -111,7 +115,7 @@
     
     
     
    -                                                curs_deleteln(3x)
    +                                                      curs_deleteln(3x)
     

    diff --git a/doc/html/man/curs_extend.3x.html b/doc/html/man/curs_extend.3x.html index ccb182b0..60bb563a 100644 --- a/doc/html/man/curs_extend.3x.html +++ b/doc/html/man/curs_extend.3x.html @@ -1,7 +1,7 @@ @@ -41,7 +41,7 @@
     
    -curs_extend(3x)                                   curs_extend(3x)
    +curs_extend(3x)                                         curs_extend(3x)
     
     
     
    @@ -101,7 +101,7 @@
     
     
     
    -                                                  curs_extend(3x)
    +                                                        curs_extend(3x)
     

    diff --git a/doc/html/man/curs_get_wch.3x.html b/doc/html/man/curs_get_wch.3x.html index ba9f1230..f205b89d 100644 --- a/doc/html/man/curs_get_wch.3x.html +++ b/doc/html/man/curs_get_wch.3x.html @@ -40,7 +40,7 @@
     
    -curs_get_wch(3x)                                 curs_get_wch(3x)
    +curs_get_wch(3x)                                       curs_get_wch(3x)
     
     
     
    @@ -140,7 +140,7 @@
     
     
     
    -                                                 curs_get_wch(3x)
    +                                                       curs_get_wch(3x)
     

    diff --git a/doc/html/man/curs_get_wstr.3x.html b/doc/html/man/curs_get_wstr.3x.html index 4adca85b..98c230ea 100644 --- a/doc/html/man/curs_get_wstr.3x.html +++ b/doc/html/man/curs_get_wstr.3x.html @@ -1,7 +1,7 @@ @@ -40,15 +40,15 @@
     
    -curs_get_wstr(3x)                               curs_get_wstr(3x)
    +curs_get_wstr(3x)                                     curs_get_wstr(3x)
     
     
     
     
     

    NAME

    -       get_wstr,  getn_wstr,  wget_wstr,  wgetn_wstr, mvget_wstr,
    -       mvgetn_wstr, mvwget_wstr, mvwgetn_wstr - get an  array  of
    +       get_wstr, getn_wstr, wget_wstr, wgetn_wstr, mvget_wstr,
    +       mvgetn_wstr, mvwget_wstr, mvwgetn_wstr - get an array of
            wide characters from a curses terminal keyboard
     
     
    @@ -74,8 +74,8 @@
            tion is represented by WEOF, as defined in <wchar.h>.  The
            newline  and end-of-line conditions are represented by the
            \n wchar_t value.  In all instances, the end of the string
    -       is  terminated  by  a  null  wchar_t.   The routine places
    -       resulting values in the area pointed to by wstr.
    +       is  terminated  by a null wchar_t.  The routine places re-
    +       sulting values in the area pointed to by wstr.
     
            The user's erase and kill characters are interpreted.   If
            keypad   mode   is   on   for  the  window,  KEY_LEFT  and
    @@ -122,6 +122,13 @@
            All of these functions return OK upon  successful  comple-
            tion.  Otherwise, they return ERR.
     
    +       Functions  using  a window parameter return an error if it
    +       is null.
    +
    +              wgetn_wstr
    +                   returns an error if  the  associated  call  to
    +                   wget_wch failed.
    +
     
     

    PORTABILITY

    @@ -130,8 +137,8 @@
            implementation  returns ERR if the window pointer is null,
            or if the lower-level wget_wch call returns  an  ERR.   In
            the  latter  case,  an  ERR  return  without other data is
    -       treated as an  end-of-file  condition,  and  the  returned
    -       array contains a WEOF followed by a null wchar_t.
    +       treated as an end-of-file condition, and the returned  ar-
    +       ray contains a WEOF followed by a null wchar_t.
     
            X/Open  curses  documents these functions to pass an array
            of wchar_t, but all of the vendors  implement  this  using
    @@ -144,7 +151,7 @@
     
     
     
    -                                                curs_get_wstr(3x)
    +                                                      curs_get_wstr(3x)
     

    diff --git a/doc/html/man/curs_getcchar.3x.html b/doc/html/man/curs_getcchar.3x.html index 5a5d8375..9f8ca2f0 100644 --- a/doc/html/man/curs_getcchar.3x.html +++ b/doc/html/man/curs_getcchar.3x.html @@ -40,7 +40,7 @@
     
    -curs_getcchar(3x)                               curs_getcchar(3x)
    +curs_getcchar(3x)                                     curs_getcchar(3x)
     
     
     
    @@ -142,7 +142,7 @@
     
     
     
    -                                                curs_getcchar(3x)
    +                                                      curs_getcchar(3x)
     

    diff --git a/doc/html/man/curs_getch.3x.html b/doc/html/man/curs_getch.3x.html index 9b7b9d9c..e96ff12b 100644 --- a/doc/html/man/curs_getch.3x.html +++ b/doc/html/man/curs_getch.3x.html @@ -2,7 +2,7 @@ @@ -41,14 +41,14 @@
     
    -curs_getch(3x)                                     curs_getch(3x)
    +curs_getch(3x)                                           curs_getch(3x)
     
     
     
     
     

    NAME

    -       getch,  wgetch,  mvgetch, mvwgetch, ungetch, has_key - get
    +       getch, wgetch, mvgetch, mvwgetch, ungetch, has_key - get
            (or push back) characters from curses terminal keyboard
     
     
    @@ -70,8 +70,8 @@
            character  from the window.  In no-delay mode, if no input
            is waiting, the value ERR is returned.  In delay mode, the
            program  waits until the system passes text through to the
    -       program.  Depending on the  setting  of  cbreak,  this  is
    -       after one character (cbreak mode), or after the first new-
    +       program.  Depending on the setting of cbreak, this is  af-
    +       ter  one  character (cbreak mode), or after the first new-
            line (nocbreak mode).  In  half-delay  mode,  the  program
            waits  until a character is typed or the specified timeout
            has been reached.
    @@ -81,31 +81,30 @@
            lowing rules: If the character is the current erase  char-
            acter,  left  arrow, or backspace, the cursor is moved one
            space to the left and that screen position is erased as if
    -       delch  had  been  called.   If  the character value is any
    -       other KEY_ define, the user is alerted with a  beep  call.
    +       delch had been called.  If the character value is any oth-
    +       er KEY_ define, the user is  alerted  with  a  beep  call.
            Otherwise the character is simply output to the screen.
     
            If the window is not a pad, and it has been moved or modi-
            fied since the last call to  wrefresh,  wrefresh  will  be
            called before another character is read.
     
    -       If  keypad  is  TRUE,  and  a function key is pressed, the
    -       token for that function key is returned instead of the raw
    -       characters.    Possible   function  keys  are  defined  in
    -       <curses.h> as macros with  values  outside  the  range  of
    -       8-bit  characters  whose  names  begin  with KEY_. Thus, a
    -       variable intended to hold the return value of  a  function
    -       key must be of short size or larger.
    +       If  keypad is TRUE, and a function key is pressed, the to-
    +       ken for that function key is returned instead of  the  raw
    +       characters.   Possible function keys are defined in <curs-
    +       es.h> as macros with values outside  the  range  of  8-bit
    +       characters  whose  names begin with KEY_. Thus, a variable
    +       intended to hold the return value of a function  key  must
    +       be of short size or larger.
     
            When a character that could be the beginning of a function
    -       key is received (which,  on  modern  terminals,  means  an
    -       escape  character), curses sets a timer.  If the remainder
    -       of the sequence does not come  in  within  the  designated
    -       time,  the  character  is  passed  through; otherwise, the
    -       function key value is returned.   For  this  reason,  many
    -       terminals  experience  a  delay  between  the  time a user
    -       presses the escape key and the escape is returned  to  the
    -       program.
    +       key is received (which, on modern terminals, means an  es-
    +       cape character), curses sets a timer.  If the remainder of
    +       the sequence does not come in within the designated  time,
    +       the  character  is passed through; otherwise, the function
    +       key value is returned.  For this  reason,  many  terminals
    +       experience a delay between the time a user presses the es-
    +       cape key and the escape is returned to the program.
     
            The ungetch routine places ch back onto the input queue to
            be returned by the next call to wgetch.  There is just one
    @@ -113,14 +112,14 @@
     
     
        Function Keys
    -       The  following function keys, defined in <curses.h>, might
    -       be returned by getch if keypad  has  been  enabled.   Note
    -       that  not  all  of  these are necessarily supported on any
    +       The following function keys, defined in <curses.h>,  might
    +       be  returned  by  getch  if keypad has been enabled.  Note
    +       that not all of these are  necessarily  supported  on  any
            particular terminal.
     
    -            Name            Key name
     
    -                   KEY_BREAK       Break key
    +            Name            Key name
    +            KEY_BREAK       Break key
                 KEY_DOWN        The four arrow keys ...
                 KEY_UP
                 KEY_LEFT
    @@ -178,10 +177,10 @@
                 KEY_REFERENCE   Ref(erence) key
                 KEY_REFRESH     Refresh key
                 KEY_REPLACE     Replace key
    -
                 KEY_RESIZE      Screen resized
                 KEY_RESTART     Restart key
                 KEY_RESUME      Resume key
    +
                 KEY_SAVE        Save key
                 KEY_SBEG        Shifted beginning key
                 KEY_SCANCEL     Shifted cancel key
    @@ -217,6 +216,7 @@
     
            Keypad is arranged like this:
     
    +
                              +-----+------+-------+
                              | A1  |  up  |  A3   |
                              +-----+------+-------+
    @@ -227,17 +227,28 @@
            The has_key routine takes a key value from the above list,
            and returns TRUE or FALSE according to whether the current
            terminal type recognizes a key with that value.  Note that
    -       a few values do  not  correspond  to  a  real  key,  e.g.,
    -       KEY_RESIZE and KEY_MOUSE.
    +       a  few  values  do  not  correspond  to  a real key, e.g.,
    +       KEY_RESIZE and KEY_MOUSE.  See resizeterm(3x) for more de-
    +       tails  about  KEY_RESIZE, and curs_mouse(3x) for a discus-
    +       sion of KEY_MOUSE.
     
     
     
     

    RETURN VALUE

    -       All  routines  return  the integer ERR upon failure and an
    +       All routines return the integer ERR upon  failure  and  an
            integer value other than ERR (OK in the case of ungetch())
            upon successful completion.
     
    +              ungetch
    +                   returns an error if there is no more  room  in
    +                   the FIFO.
    +
    +              wgetch
    +                   returns  an  error  if  the  window pointer is
    +                   null, or if its timeout expires without having
    +                   any data.
    +
     
     

    NOTES

    @@ -247,19 +258,19 @@
            ing function-key sequence.
     
            Note that some keys may be the same as commonly used  con-
    -       trol keys, e.g., KEY_ENTER versus control/M, KEY_BACKSPACE
    +       trol keys, e.g., KEY_ENTER versus control/M, KEY_BACKSPACE
            versus control/H.  Some curses implementations may  differ
            according  to  whether  they treat these control keys spe-
            cially (and ignore the terminfo), or use the terminfo def-
            initions.   Ncurses  uses  the terminfo definition.  If it
    -       says  that  KEY_ENTER  is  control/M,  getch  will  return
    -       KEY_ENTER when you press control/M.
    +       says  that  KEY_ENTER  is  control/M,  getch  will  return
    +       KEY_ENTER when you press control/M.
     
            When  using  getch, wgetch, mvgetch, or mvwgetch, nocbreak
            mode (nocbreak) and echo mode (echo) should not be used at
            the  same  time.  Depending on the state of the tty driver
    -       when each character is  typed,  the  program  may  produce
    -       undesirable results.
    +       when each character is typed, the program may produce  un-
    +       desirable results.
     
            Note that getch, mvgetch, and mvwgetch may be macros.
     
    @@ -282,38 +293,38 @@
     
            The  echo  behavior of these functions on input of KEY_ or
            backspace characters was not specified in the  SVr4  docu-
    -       mentation.   This  description  is  adopted  from  the XSI
    -       Curses standard.
    +       mentation.  This description is adopted from the XSI Curs-
    +       es standard.
     
            The behavior of getch and friends in the presence of  han-
            dled  signals  is  unspecified  in the SVr4 and XSI Curses
            documentation.  Under historical  curses  implementations,
    -       it  varied  depending  on  whether  the operating system's
    -       implementation of  handled  signal  receipt  interrupts  a
    +       it  varied depending on whether the operating system's im-
    +       plementation  of  handled  signal  receipt  interrupts   a
            read(2)  call in progress or not, and also (in some imple-
            mentations) depending on whether an input timeout or  non-
            blocking mode has been set.
     
            Programmers concerned about portability should be prepared
    -       for either of two  cases:  (a)  signal  receipt  does  not
    -       interrupt  getch;  (b) signal receipt interrupts getch and
    +       for either of two cases: (a) signal receipt does  not  in-
    +       terrupt  getch;  (b)  signal  receipt interrupts getch and
            causes it to return ERR with errno set  to  EINTR.   Under
            the  ncurses  implementation, handled signals never inter-
            rupt getch.
     
            The has_key function is unique to ncurses.   We  recommend
    -       that   any   code  using  it  be  conditionalized  on  the
    -       NCURSES_VERSION feature macro.
    +       that  any  code  using it be conditionalized on the NCURS-
    +       ES_VERSION feature macro.
     
     
     

    SEE ALSO

            curses(3x),        curs_inopts(3x),        curs_mouse(3x),
    -       curs_move(3x), curs_refresh(3x).  resizeterm(3x).
    +       curs_move(3x), curs_refresh(3x), resizeterm(3x).
     
     
     
    -                                                   curs_getch(3x)
    +                                                         curs_getch(3x)
     

    diff --git a/doc/html/man/curs_getstr.3x.html b/doc/html/man/curs_getstr.3x.html index 066f81bc..fd264d28 100644 --- a/doc/html/man/curs_getstr.3x.html +++ b/doc/html/man/curs_getstr.3x.html @@ -1,7 +1,7 @@ @@ -40,15 +40,15 @@
     
    -curs_getstr(3x)                                   curs_getstr(3x)
    +curs_getstr(3x)                                         curs_getstr(3x)
     
     
     
     
     

    NAME

    -       getstr,  getnstr,  wgetstr, wgetnstr, mvgetstr, mvgetnstr,
    -       mvwgetstr, mvwgetnstr  -  accept  character  strings  from
    +       getstr, getnstr, wgetstr, wgetnstr, mvgetstr, mvgetnstr,
    +       mvwgetstr, mvwgetnstr - accept character strings from
            curses terminal keyboard
     
     
    @@ -71,15 +71,15 @@
            The  function getstr is equivalent to a series of calls to
            getch, until a newline or carriage return is received (the
            terminating  character  is  not  included  in the returned
    -       string).  The  resulting  value  is  placed  in  the  area
    -       pointed to by the character pointer str.
    +       string).  The resulting value is placed in the area point-
    +       ed to by the character pointer str.
     
            wgetnstr  reads  at  most  n characters, thus preventing a
    -       possible overflow of the input  buffer.   Any  attempt  to
    -       enter  more characters (other than the terminating newline
    -       or carriage return) causes a  beep.   Function  keys  also
    -       cause  a beep and are ignored.  The getnstr function reads
    -       from the stdscr default window.
    +       possible overflow of the input buffer.  Any attempt to en-
    +       ter more characters (other than the terminating newline or
    +       carriage return) causes a beep.  Function keys also  cause
    +       a  beep  and are ignored.  The getnstr function reads from
    +       the stdscr default window.
     
            The user's erase and kill characters are interpreted.   If
            keypad   mode   is   on   for  the  window,  KEY_LEFT  and
    @@ -97,6 +97,12 @@
            (SVr4 specifies only "an integer value  other  than  ERR")
            upon successful completion.
     
    +       X/Open defines no error conditions.
    +
    +       In this implementation, these functions return an error if
    +       the window pointer is null,  or  if  its  timeout  expires
    +       without having any data.
    +
     
     

    NOTES

    @@ -107,9 +113,9 @@
     

    PORTABILITY

            These  functions are described in the XSI Curses standard,
            Issue 4.  They  read  single-byte  characters  only.   The
    -       standard  does  not  define  any  error  conditions.  This
    -       implementation returns ERR if the window pointer is  null,
    -       or if the lower-level wgetch call returns an ERR.
    +       standard  does  not define any error conditions.  This im-
    +       plementation returns ERR if the window pointer is null, or
    +       if the lower-level wgetch call returns an ERR.
     
            SVr3  and early SVr4 curses implementations did not reject
            function keys; the SVr4.0 documentation claimed that "spe-
    @@ -120,8 +126,8 @@
            useful  (being,  in  fact, the low-order eight bits of the
            key's KEY_ value).
     
    -       The functions getnstr, mvgetnstr, and mvwgetnstr were pre-
    -       sent but not documented in SVr4.
    +       The functions  getnstr,  mvgetnstr,  and  mvwgetnstr  were
    +       present but not documented in SVr4.
     
     
     
    @@ -130,7 +136,7 @@ - curs_getstr(3x) + curs_getstr(3x)

    diff --git a/doc/html/man/curs_getyx.3x.html b/doc/html/man/curs_getyx.3x.html index 5ccfc05d..ac010120 100644 --- a/doc/html/man/curs_getyx.3x.html +++ b/doc/html/man/curs_getyx.3x.html @@ -40,7 +40,7 @@
     
    -curs_getyx(3x)                                     curs_getyx(3x)
    +curs_getyx(3x)                                           curs_getyx(3x)
     
     
     
    @@ -105,7 +105,7 @@
     
     
     
    -                                                   curs_getyx(3x)
    +                                                         curs_getyx(3x)
     

    diff --git a/doc/html/man/curs_in_wch.3x.html b/doc/html/man/curs_in_wch.3x.html index 3c06a9b9..7673f317 100644 --- a/doc/html/man/curs_in_wch.3x.html +++ b/doc/html/man/curs_in_wch.3x.html @@ -40,7 +40,7 @@
     
    -curs_in_wch(3x)                                   curs_in_wch(3x)
    +curs_in_wch(3x)                                         curs_in_wch(3x)
     
     
     
    @@ -94,7 +94,7 @@
     
     
     
    -                                                  curs_in_wch(3x)
    +                                                        curs_in_wch(3x)
     

    diff --git a/doc/html/man/curs_in_wchstr.3x.html b/doc/html/man/curs_in_wchstr.3x.html index 4347004f..bbc2a568 100644 --- a/doc/html/man/curs_in_wchstr.3x.html +++ b/doc/html/man/curs_in_wchstr.3x.html @@ -1,7 +1,7 @@ @@ -40,17 +40,17 @@
     
    -curs_in_wchstr(3x)                             curs_in_wchstr(3x)
    +curs_in_wchstr(3x)                                   curs_in_wchstr(3x)
     
     
     
     
     

    NAME

    -       in_wchstr,  in_wchnstr, win_wchstr, win_wchnstr, mvin_wch-
    -       str, mvin_wchnstr, mvwin_wchstr, mvwin_wchnstr  -  get  an
    -       array  of  complex characters and renditions from a curses
    -       window
    +       in_wchstr, in_wchnstr, win_wchstr, win_wchnstr,
    +       mvin_wchstr, mvin_wchnstr, mvwin_wchstr, mvwin_wchnstr -
    +       get an array of complex characters and renditions from a
    +       curses window
     
     
     
    @@ -104,12 +104,12 @@

    SEE ALSO

    -       Functions:   curses(3x),  curs_in_wch(3x)  curs_instr(3x),
    +       Functions:  curses(3x),  curs_in_wch(3x),  curs_instr(3x),
            curs_inwstr(3x)
     
     
     
    -                                               curs_in_wchstr(3x)
    +                                                     curs_in_wchstr(3x)
     

    diff --git a/doc/html/man/curs_inch.3x.html b/doc/html/man/curs_inch.3x.html index e966923d..8db494d2 100644 --- a/doc/html/man/curs_inch.3x.html +++ b/doc/html/man/curs_inch.3x.html @@ -41,7 +41,7 @@
     
    -curs_inch(3x)                                       curs_inch(3x)
    +curs_inch(3x)                                             curs_inch(3x)
     
     
     
    @@ -76,6 +76,7 @@
            The  following  bit-masks  may  be  AND-ed with characters
            returned by winch.
     
    +
            A_CHARTEXT     Bit-mask to extract character
            A_ATTRIBUTES   Bit-mask to extract attributes
            A_COLOR        Bit-mask to extract color-pair field information
    @@ -98,7 +99,7 @@
     
     
     
    -                                                    curs_inch(3x)
    +                                                          curs_inch(3x)
     

    diff --git a/doc/html/man/curs_inchstr.3x.html b/doc/html/man/curs_inchstr.3x.html index 2af744e2..3b0cbbe4 100644 --- a/doc/html/man/curs_inchstr.3x.html +++ b/doc/html/man/curs_inchstr.3x.html @@ -1,7 +1,7 @@ @@ -40,15 +40,15 @@
     
    -curs_inchstr(3x)                                 curs_inchstr(3x)
    +curs_inchstr(3x)                                       curs_inchstr(3x)
     
     
     
     
     

    NAME

    -       inchstr,   inchnstr,   winchstr,   winchnstr,   mvinchstr,
    -       mvinchnstr, mvwinchstr, mvwinchnstr  -  get  a  string  of
    +       inchstr, inchnstr, winchstr, winchnstr, mvinchstr,
    +       mvinchnstr, mvwinchstr, mvwinchnstr - get a string of
            characters (and attributes) from a curses window
     
     
    @@ -87,6 +87,10 @@
            (the number of  characters  retrieved,  exclusive  of  the
            trailing 0).
     
    +       No  error  conditions are defined.  If the chstr parameter
    +       is null, no data is returned, and the return value is  ze-
    +       ro.
    +
     
     

    NOTES

    @@ -111,7 +115,7 @@
     
     
     
    -                                                 curs_inchstr(3x)
    +                                                       curs_inchstr(3x)
     

    diff --git a/doc/html/man/curs_initscr.3x.html b/doc/html/man/curs_initscr.3x.html index f8ba9ac6..f5fd5441 100644 --- a/doc/html/man/curs_initscr.3x.html +++ b/doc/html/man/curs_initscr.3x.html @@ -1,7 +1,7 @@ @@ -40,14 +40,14 @@
     
    -curs_initscr(3x)                                 curs_initscr(3x)
    +curs_initscr(3x)                                       curs_initscr(3x)
     
     
     
     
     

    NAME

    -       initscr,  newterm, endwin, isendwin, set_term, delscreen -
    +       initscr, newterm, endwin, isendwin, set_term, delscreen -
            curses screen initialization and manipulation routines
     
     
    @@ -73,10 +73,10 @@
     
            The initscr code determines the terminal type and initial-
            izes  all curses data structures.  initscr also causes the
    -       first call to refresh to  clear  the  screen.   If  errors
    -       occur,  initscr  writes  an  appropriate  error message to
    -       standard error and exits; otherwise, a pointer is returned
    -       to stdscr.
    +       first call to refresh to clear the screen.  If errors  oc-
    +       cur,  initscr writes an appropriate error message to stan-
    +       dard error and exits; otherwise, a pointer is returned  to
    +       stdscr.
     
            A  program  that  outputs to more than one terminal should
            use the newterm  routine  for  each  terminal  instead  of
    @@ -95,10 +95,10 @@
            same  terminal, the first terminal referred to must be the
            last one for which endwin is called.
     
    -       A program should always  call  endwin  before  exiting  or
    -       escaping  from  curses  mode  temporarily.   This  routine
    -       restores tty modes, moves the cursor to  the  lower  left-
    -       hand corner of the screen and resets the terminal into the
    +       A program should always call endwin before exiting or  es-
    +       caping  from  curses  mode  temporarily.  This routine re-
    +       stores tty modes, moves the cursor to the lower  left-hand
    +       corner  of  the  screen  and  resets the terminal into the
            proper non-visual mode.  Calling refresh or doupdate after
            a  temporary  escape  causes  the program to resume visual
            mode.
    @@ -111,8 +111,8 @@
            terminals.   The screen reference new becomes the new cur-
            rent terminal.  The previous terminal is returned  by  the
            routine.   This  is  the  only  routine  which manipulates
    -       SCREEN  pointers;  all  other  routines  affect  only  the
    -       current terminal.
    +       SCREEN pointers; all other routines affect only  the  cur-
    +       rent terminal.
     
            The  delscreen  routine  frees storage associated with the
            SCREEN data structure.  The endwin  routine  does  not  do
    @@ -127,6 +127,10 @@
     
            Routines that return pointers always return NULL on error.
     
    +       X/Open defines no error conditions.  In  this  implementa-
    +       tion  endwin returns an error if the terminal was not ini-
    +       tialized.
    +
     
     

    NOTES

    @@ -152,7 +156,7 @@
     
     
     
    -                                                 curs_initscr(3x)
    +                                                       curs_initscr(3x)
     

    diff --git a/doc/html/man/curs_inopts.3x.html b/doc/html/man/curs_inopts.3x.html index 3e4b434f..7eec3eda 100644 --- a/doc/html/man/curs_inopts.3x.html +++ b/doc/html/man/curs_inopts.3x.html @@ -1,7 +1,7 @@ @@ -40,16 +40,16 @@
     
    -curs_inopts(3x)                                   curs_inopts(3x)
    +curs_inopts(3x)                                         curs_inopts(3x)
     
     
     
     
     

    NAME

    -       cbreak, nocbreak, echo, noecho, halfdelay, intrflush, key-
    -       pad, meta,  nodelay,  notimeout,  raw,  noraw,  noqiflush,
    -       qiflush,  timeout,  wtimeout,  typeahead  -  curses  input
    +       cbreak, nocbreak, echo, noecho, halfdelay, intrflush,
    +       keypad, meta, nodelay, notimeout, raw, noraw, noqiflush,
    +       qiflush, timeout, wtimeout, typeahead - curses input
            options
     
     
    @@ -81,8 +81,8 @@
            Normally, the tty driver buffers typed characters until  a
            newline  or  carriage return is typed.  The cbreak routine
            disables line buffering and erase/kill  character-process-
    -       ing  (interrupt  and  flow  control  characters  are unaf-
    -       fected), making characters typed by the  user  immediately
    +       ing  (interrupt  and flow control characters are unaffect-
    +       ed), making  characters  typed  by  the  user  immediately
            available  to  the  program.  The nocbreak routine returns
            the terminal to normal (cooked) mode.
     
    @@ -95,31 +95,31 @@
     
            The  echo  and  noecho routines control whether characters
            typed by the user are echoed by getch as they  are  typed.
    -       Echoing  by  the  tty  driver is always disabled, but ini-
    -       tially getch is in echo  mode,  so  characters  typed  are
    -       echoed.  Authors of most interactive programs prefer to do
    -       their own echoing in a controlled area of the  screen,  or
    -       not  to  echo  at  all, so they disable echoing by calling
    -       noecho.  [See curs_getch(3x) for a discussion of how these
    -       routines interact with cbreak and nocbreak.]
    +       Echoing by the tty driver is always disabled, but initial-
    +       ly getch is in echo mode, so characters typed are  echoed.
    +       Authors  of  most  interactive programs prefer to do their
    +       own echoing in a controlled area of the screen, or not  to
    +       echo  at  all,  so they disable echoing by calling noecho.
    +       [See curs_getch(3x) for a discussion of how these routines
    +       interact with cbreak and nocbreak.]
     
            The  halfdelay  routine is used for half-delay mode, which
            is similar to cbreak mode in that characters typed by  the
            user  are  immediately available to the program.  However,
    -       after blocking  for  tenths  tenths  of  seconds,  ERR  is
    -       returned  if  nothing has been typed.  The value of tenths
    +       after blocking for tenths tenths of seconds,  ERR  is  re-
    +       turned  if  nothing  has  been typed.  The value of tenths
            must be a number between 1 and 255.  Use nocbreak to leave
            half-delay mode.
     
            If  the intrflush option is enabled, (bf is TRUE), when an
            interrupt key  is  pressed  on  the  keyboard  (interrupt,
            break,  quit)  all  output in the tty driver queue will be
    -       flushed, giving the  effect  of  faster  response  to  the
    -       interrupt,  but  causing  curses to have the wrong idea of
    -       what is on the  screen.   Disabling  (bf  is  FALSE),  the
    -       option  prevents the flush.  The default for the option is
    -       inherited from the tty driver settings.  The window  argu-
    -       ment is ignored.
    +       flushed, giving the effect of faster response to  the  in-
    +       terrupt, but causing curses to have the wrong idea of what
    +       is on the screen.  Disabling (bf  is  FALSE),  the  option
    +       prevents  the flush.  The default for the option is inher-
    +       ited from the tty driver settings.  The window argument is
    +       ignored.
     
            The  keypad option enables the keypad of the user's termi-
            nal.  If enabled (bf is TRUE), the user can press a  func-
    @@ -128,21 +128,21 @@
            If  disabled (bf is FALSE), curses does not treat function
            keys specially and the program has to interpret the escape
            sequences  itself.   If  the keypad in the terminal can be
    -       turned on  (made  to  transmit)  and  off  (made  to  work
    -       locally),  turning on this option causes the terminal key-
    -       pad to be turned on when wgetch is  called.   The  default
    -       value for keypad is false.
    +       turned on (made to transmit) and off (made to work  local-
    +       ly),  turning on this option causes the terminal keypad to
    +       be turned on when wgetch is called.  The default value for
    +       keypad is false.
     
            Initially, whether the terminal returns 7 or 8 significant
    -       bits on input depends on  the  control  mode  of  the  tty
    -       driver  [see  termio(7)].  To force 8 bits to be returned,
    -       invoke meta(win, TRUE); this is equivalent,  under  POSIX,
    -       to  setting the CS8 flag on the terminal.  To force 7 bits
    -       to be returned, invoke meta(win, FALSE); this  is  equiva-
    -       lent,  under  POSIX, to setting the CS7 flag on the termi-
    -       nal.  The window argument, win, is always ignored.  If the
    -       terminfo capabilities smm (meta_on) and rmm (meta_off) are
    -       defined for the terminal, smm is sent to the terminal when
    +       bits on input depends on the control mode of the tty driv-
    +       er  [see  termio(7)].  To force 8 bits to be returned, in-
    +       voke meta(win, TRUE); this is equivalent, under POSIX,  to
    +       setting  the CS8 flag on the terminal.  To force 7 bits to
    +       be returned, invoke meta(win, FALSE); this is  equivalent,
    +       under POSIX, to setting the CS7 flag on the terminal.  The
    +       window argument, win, is always ignored.  If the  terminfo
    +       capabilities  smm (meta_on) and rmm (meta_off) are defined
    +       for the  terminal,  smm  is  sent  to  the  terminal  when
            meta(win,  TRUE)  is called and rmm is sent when meta(win,
            FALSE) is called.
     
    @@ -153,15 +153,15 @@
            While interpreting an input escape sequence, wgetch sets a
            timer  while  waiting  for the next character.  If notime-
            out(win, TRUE) is called,  then  wgetch  does  not  set  a
    -       timer.   The  purpose  of  the timeout is to differentiate
    -       between sequences received from a function key  and  those
    +       timer.  The purpose of the timeout is to differentiate be-
    +       tween sequences received from a  function  key  and  those
            typed by a user.
     
            The  raw and noraw routines place the terminal into or out
            of raw mode.  Raw mode is similar to cbreak mode, in  that
    -       characters  typed  are  immediately  passed through to the
    -       user program.  The differences are that in raw  mode,  the
    -       interrupt,  quit, suspend, and flow control characters are
    +       characters typed are immediately passed through to the us-
    +       er program.  The differences are that in raw mode, the in-
    +       terrupt,  quit,  suspend,  and flow control characters are
            all passed through uninterpreted, instead of generating  a
            signal.   The  behavior  of the BREAK key depends on other
            bits in the tty driver that are not set by curses.
    @@ -176,14 +176,14 @@
     
            The timeout and wtimeout routines  set  blocking  or  non-
            blocking  read  for a given window.  If delay is negative,
    -       blocking  read  is  used  (i.e.,  waits  indefinitely  for
    -       input).   If delay is zero, then non-blocking read is used
    +       blocking read is used (i.e., waits  indefinitely  for  in-
    +       put).   If  delay  is zero, then non-blocking read is used
            (i.e., read returns ERR if no input is waiting).  If delay
            is  positive, then read blocks for delay milliseconds, and
            returns ERR if there is still no input.  Hence, these rou-
            tines  provide the same functionality as nodelay, plus the
    -       additional capability of being  able  to  block  for  only
    -       delay milliseconds (where delay is positive).
    +       additional capability of being able to block for only  de-
    +       lay milliseconds (where delay is positive).
     
            The  curses library does ``line-breakout optimization'' by
            looking for  typeahead  periodically  while  updating  the
    @@ -205,6 +205,15 @@
            than  ERR")  upon  successful completion, unless otherwise
            noted in the preceding routine descriptions.
     
    +       X/Open does not define any error conditions.  In this  im-
    +       plementation,  functions  with a window parameter will re-
    +       turn an error if it is null.  Any function will  also  re-
    +       turn an error if the terminal was not initialized.  Also,
    +
    +              halfdelay
    +                   returns  an  error if its parameter is outside
    +                   the range 1..255.
    +
     
     

    PORTABILITY

    @@ -216,8 +225,8 @@
            that  the  echo bit is cleared when curses initializes the
            terminal state.  BSD curses differed from  this  slightly;
            it left the echo bit on at initialization, but the BSD raw
    -       call turned it off as a side-effect.  For  best  portabil-
    -       ity,  set echo or noecho explicitly just after initializa-
    +       call turned it off as a side-effect.  For best  portabili-
    +       ty,  set  echo or noecho explicitly just after initializa-
            tion, even if your program remains in cooked mode.
     
     
    @@ -241,7 +250,7 @@
     
     
     
    -                                                  curs_inopts(3x)
    +                                                        curs_inopts(3x)
     

    diff --git a/doc/html/man/curs_ins_wch.3x.html b/doc/html/man/curs_ins_wch.3x.html index ed0ab4db..9da6970f 100644 --- a/doc/html/man/curs_ins_wch.3x.html +++ b/doc/html/man/curs_ins_wch.3x.html @@ -40,7 +40,7 @@
     
    -curs_ins_wch(3x)                                 curs_ins_wch(3x)
    +curs_ins_wch(3x)                                       curs_ins_wch(3x)
     
     
     
    @@ -89,7 +89,7 @@
     
     
     
    -                                                 curs_ins_wch(3x)
    +                                                       curs_ins_wch(3x)
     

    diff --git a/doc/html/man/curs_ins_wstr.3x.html b/doc/html/man/curs_ins_wstr.3x.html index c2a128c2..3d818704 100644 --- a/doc/html/man/curs_ins_wstr.3x.html +++ b/doc/html/man/curs_ins_wstr.3x.html @@ -1,7 +1,7 @@ @@ -40,15 +40,15 @@
     
    -curs_ins_wstr(3x)                               curs_ins_wstr(3x)
    +curs_ins_wstr(3x)                                     curs_ins_wstr(3x)
     
     
     
     
     

    NAME

    -       ins_wstr,  ins_nwstr,  wins_wstr,  wins_nwstr, mvins_wstr,
    -       mvins_nwstr, mvwins_wstr, mvwins_nwstr -  insert  a  wide-
    +       ins_wstr, ins_nwstr, wins_wstr, wins_nwstr, mvins_wstr,
    +       mvins_nwstr, mvwins_wstr, mvwins_nwstr - insert a wide-
            character string into a curses window
     
     
    @@ -114,7 +114,7 @@
     
     
     
    -                                                curs_ins_wstr(3x)
    +                                                      curs_ins_wstr(3x)
     

    diff --git a/doc/html/man/curs_insch.3x.html b/doc/html/man/curs_insch.3x.html index 70db3ae3..ed909f31 100644 --- a/doc/html/man/curs_insch.3x.html +++ b/doc/html/man/curs_insch.3x.html @@ -40,7 +40,7 @@
     
    -curs_insch(3x)                                     curs_insch(3x)
    +curs_insch(3x)                                           curs_insch(3x)
     
     
     
    @@ -99,7 +99,7 @@
     
     
     
    -                                                   curs_insch(3x)
    +                                                         curs_insch(3x)
     

    diff --git a/doc/html/man/curs_insstr.3x.html b/doc/html/man/curs_insstr.3x.html index b169a795..78d77435 100644 --- a/doc/html/man/curs_insstr.3x.html +++ b/doc/html/man/curs_insstr.3x.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -curs_insstr(3x)                                   curs_insstr(3x)
    +curs_insstr(3x)                                         curs_insstr(3x)
     
     
     
    @@ -71,22 +71,14 @@
            These  routines insert a character string (as many charac-
            ters as will fit on the line) before the  character  under
            the cursor.  All characters to the right of the cursor are
    -       shifted right, with the possibility of the rightmost char-
    +       shifted right with the possibility of the rightmost  char-
            acters  on  the line being lost.  The cursor position does
    -       not change (after moving to y, x, if specified). The  four
    -       routines with n as the last argument insert a leading sub-
    -       string of at most n characters.  If n<=0, then the  entire
    -       string is inserted.
    -
    -       If  a  character in str is a tab, newline, carriage return
    -       or backspace, the cursor is moved appropriately within the
    -       window.   A  newline  also  does a clrtoeol before moving.
    -       Tabs are considered to be at every eighth  column.   If  a
    -       character in str is another control character, it is drawn
    -       in the ^X notation.  Calling winch after adding a  control
    -       character (and moving to it, if necessary) does not return
    -       the control character, but instead returns a character  in
    -       the ^-representation of the control character.
    +       not change (after moving to  y,  x,  if  specified).   The
    +       functions  with  n  as  the last argument insert a leading
    +       substring of at most n  characters.   If  n<=0,  then  the
    +       entire string is inserted.
    +
    +       Special characters are handled as in addch.
     
     
     
    @@ -96,6 +88,10 @@ than ERR") upon successful completion, unless otherwise noted in the preceding routine descriptions. + X/Open defines no error conditions. In this implementa- + tion, if the window parameter is null or the str parameter + is null, an error is returned. +

    NOTES

    @@ -105,20 +101,22 @@
     

    PORTABILITY

            These functions are described in the XSI Curses  standard,
    -       Issue  4,  which  adds  const qualifiers to the arguments.
    -       The XSI Curses error  conditions  EILSEQ  and  EILOVERFLOW
    -       associated  with  extended-level  conformance  are not yet
    -       detected (this implementation does not  yet  support  XPG4
    -       multibyte characters).
    +       Issue 4, which adds const qualifiers to the arguments.
    +
    +       The  Single  Unix  Specification,  Version  2  states that
    +       insnstr and winsnstr perform wrapping.  This  is  probably
    +       an error, since it makes this group of functions inconsis-
    +       tent.  Also, no implementation of  curses  documents  this
    +       inconsistency.
     
     
     

    SEE ALSO

    -       curses(3x), curs_clear(3x), curs_inch(3x).
    +       curses(3x), unctrl(3x), curs_clear(3x), curs_inch(3x).
     
     
     
    -                                                  curs_insstr(3x)
    +                                                        curs_insstr(3x)
     

    diff --git a/doc/html/man/curs_instr.3x.html b/doc/html/man/curs_instr.3x.html index a560ae6e..c0b34cec 100644 --- a/doc/html/man/curs_instr.3x.html +++ b/doc/html/man/curs_instr.3x.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -curs_instr(3x)                                     curs_instr(3x)
    +curs_instr(3x)                                           curs_instr(3x)
     
     
     
    @@ -82,6 +82,10 @@
            All  of the functions return ERR upon failure, or the num-
            ber of characters actually read into the string.
     
    +       X/Open defines no error conditions.  In  this  implementa-
    +       tion, if the window parameter is null or the str parameter
    +       is null, a zero is returned.
    +
     
     

    NOTES

    @@ -90,14 +94,11 @@
     
     

    PORTABILITY

    -       The XSI Curses error  conditions  EILSEQ  and  EILOVERFLOW
    -       associated  with  extended-level  conformance  are not yet
    -       detected (this implementation does not  yet  support  XPG4
    -       multibyte  characters).   SVr4 does not document whether a
    -       length limit includes or excludes the trailing NUL.
    -
    -       The ncurses library extends the XSI description by  allow-
    -       ing  a  negative value for n.  In this case, the functions
    +       SVr4 does not document whether a length limit includes  or
    +       excludes the trailing NUL.
    +
    +       The  ncurses library extends the XSI description by allow-
    +       ing a negative value for n.  In this case,  the  functions
            return the string ending at the right margin.
     
     
    @@ -108,7 +109,7 @@
     
     
     
    -                                                   curs_instr(3x)
    +                                                         curs_instr(3x)
     

    diff --git a/doc/html/man/curs_inwstr.3x.html b/doc/html/man/curs_inwstr.3x.html index 34672b46..224c6d57 100644 --- a/doc/html/man/curs_inwstr.3x.html +++ b/doc/html/man/curs_inwstr.3x.html @@ -1,7 +1,7 @@ -curs_inwstr 3 +curs_inwstr 3x -

    curs_inwstr 3

    +

    curs_inwstr 3x


     
    -curs_inwstr(3)                                     curs_inwstr(3)
    +curs_inwstr(3x)                                         curs_inwstr(3x)
     
     
     
    @@ -100,7 +100,7 @@
     
     
     
    -                                                   curs_inwstr(3)
    +                                                        curs_inwstr(3x)
     

    diff --git a/doc/html/man/curs_kernel.3x.html b/doc/html/man/curs_kernel.3x.html index 6ee8d583..11f41d31 100644 --- a/doc/html/man/curs_kernel.3x.html +++ b/doc/html/man/curs_kernel.3x.html @@ -1,7 +1,7 @@ @@ -40,16 +40,16 @@
     
    -curs_kernel(3x)                                   curs_kernel(3x)
    +curs_kernel(3x)                                         curs_kernel(3x)
     
     
     
     
     

    NAME

    -       def_prog_mode,       def_shell_mode,      reset_prog_mode,
    -       reset_shell_mode, resetty, savetty, getsyx, setsyx, ripof-
    -       fline, curs_set, napms - low-level curses routines
    +       def_prog_mode, def_shell_mode, reset_prog_mode,
    +       reset_shell_mode, resetty, savetty, getsyx, setsyx,
    +       ripoffline, curs_set, napms - low-level curses routines
     
     
     
    @@ -77,10 +77,10 @@ The def_prog_mode and def_shell_mode routines save the current terminal modes as the "program" (in curses) or - "shell" (not in curses) state for use by the - reset_prog_mode and reset_shell_mode routines. This is - done automatically by initscr. There is one such save - area for each screen context allocated by newterm(). + "shell" (not in curses) state for use by the re- + set_prog_mode and reset_shell_mode routines. This is done + automatically by initscr. There is one such save area for + each screen context allocated by newterm(). The reset_prog_mode and reset_shell_mode routines restore the terminal to "program" (in curses) or "shell" (out of @@ -96,22 +96,22 @@ The getsyx routine returns the current coordinates of the virtual screen cursor in y and x. If leaveok is currently TRUE, then -1,-1 is returned. If lines have been removed - from the top of the screen, using ripoffline, y and x - include these lines; therefore, y and x should be used - only as arguments for setsyx. + from the top of the screen, using ripoffline, y and x in- + clude these lines; therefore, y and x should be used only + as arguments for setsyx. The setsyx routine sets the virtual screen cursor to y, x. If y and x are both -1, then leaveok is set. The two rou- - tines getsyx and setsyx are designed to be used by a - library routine, which manipulates curses windows but does + tines getsyx and setsyx are designed to be used by a li- + brary routine, which manipulates curses windows but does not want to change the current position of the program's - cursor. The library routine would call getsyx at the - beginning, do its manipulation of its own windows, do a + cursor. The library routine would call getsyx at the be- + ginning, do its manipulation of its own windows, do a wnoutrefresh on its windows, call setsyx, and then call doupdate. - The ripoffline routine provides access to the same facil- - ity that slk_init [see curs_slk(3x)] uses to reduce the + The ripoffline routine provides access to the same facili- + ty that slk_init [see curs_slk(3x)] uses to reduce the size of the screen. ripoffline must be called before initscr or newterm is called. If line is positive, a line is removed from the top of stdscr; if line is negative, a @@ -128,21 +128,36 @@ ripoffline can be called up to five times before calling initscr or newterm. - The curs_set routine sets the cursor state is set to - invisible, normal, or very visible for visibility equal to + The curs_set routine sets the cursor state is set to in- + visible, normal, or very visible for visibility equal to 0, 1, or 2 respectively. If the terminal supports the - visibility requested, the previous cursor state is - returned; otherwise, ERR is returned. + visibility requested, the previous cursor state is re- + turned; otherwise, ERR is returned. The napms routine is used to sleep for ms milliseconds.

    RETURN VALUE

    -       Except for curs_set,  these  routines  always  return  OK.
    -       curs_set  returns the previous cursor state, or ERR if the
    +       Except for curs_set, these routines always return OK.
    +
    +       curs_set returns the previous cursor state, or ERR if  the
            requested visibility is not supported.
     
    +       X/Open  defines  no error conditions.  In this implementa-
    +       tion
    +
    +              def_prog_mode, def_shell_mode, reset_prog_mode, re-
    +              set_shell_mode
    +                   return an error if the terminal was  not  ini-
    +                   tialized,  or  if  the  I/O call to obtain the
    +                   terminal settings fails.
    +
    +              ripoffline
    +                   returns an error  if  the  maximum  number  of
    +                   ripped-off  lines exceeds the maximum (NRIPS =
    +                   5).
    +
     
     

    NOTES

    @@ -174,12 +189,12 @@
     
     

    SEE ALSO

    -       curses(3x),       curs_initscr(3x),      curs_outopts(3x),
    -       curs_refresh(3x), curs_scr_dump(3x), curs_slk(3x)
    +       curses(3x),  curs_initscr(3x),  curs_outopts(3x), curs_re-
    +       fresh(3x), curs_scr_dump(3x), curs_slk(3x)
     
     
     
    -                                                  curs_kernel(3x)
    +                                                        curs_kernel(3x)
     

    diff --git a/doc/html/man/curs_mouse.3x.html b/doc/html/man/curs_mouse.3x.html index a471fc6f..522c1a7c 100644 --- a/doc/html/man/curs_mouse.3x.html +++ b/doc/html/man/curs_mouse.3x.html @@ -2,7 +2,7 @@ @@ -41,15 +41,15 @@
     
    -curs_mouse(3x)                                     curs_mouse(3x)
    +curs_mouse(3x)                                           curs_mouse(3x)
     
     
     
     
     

    NAME

    -       getmouse,  ungetmouse,  mousemask,  wenclose, mouse_trafo,
    -       wmouse_trafo,  mouseinterval  -  mouse  interface  through
    +       getmouse, ungetmouse, mousemask, wenclose, mouse_trafo,
    +       wmouse_trafo, mouseinterval - mouse interface through
            curses
     
     
    @@ -83,8 +83,8 @@
            pseudo-key values in the wgetch input stream.
     
            To  make mouse events visible, use the mousemask function.
    -       This will  set  the  mouse  events  to  be  reported.   By
    -       default,  no mouse events are reported.  The function will
    +       This will set the mouse events to  be  reported.   By  de-
    +       fault,  no  mouse  events are reported.  The function will
            return a mask to indicate which  of  the  specified  mouse
            events  can be reported; on complete failure it returns 0.
            If oldmask is non-NULL, this function fills the  indicated
    @@ -95,7 +95,8 @@
            the  mouse pointer; setting a nonzero mask may turn it on.
            Whether this happens is device-dependent.
     
    -       Here are the mouse event type masks:
    +       Here are the mouse event type masks which may be defined:
    +
     
            Name                     Description
            ---------------------------------------------------------------------
    @@ -104,34 +105,45 @@
            BUTTON1_CLICKED          mouse button 1 clicked
            BUTTON1_DOUBLE_CLICKED   mouse button 1 double clicked
            BUTTON1_TRIPLE_CLICKED   mouse button 1 triple clicked
    +       ---------------------------------------------------------------------
            BUTTON2_PRESSED          mouse button 2 down
            BUTTON2_RELEASED         mouse button 2 up
            BUTTON2_CLICKED          mouse button 2 clicked
            BUTTON2_DOUBLE_CLICKED   mouse button 2 double clicked
            BUTTON2_TRIPLE_CLICKED   mouse button 2 triple clicked
    +       ---------------------------------------------------------------------
    +
            BUTTON3_PRESSED          mouse button 3 down
            BUTTON3_RELEASED         mouse button 3 up
            BUTTON3_CLICKED          mouse button 3 clicked
    -
            BUTTON3_DOUBLE_CLICKED   mouse button 3 double clicked
            BUTTON3_TRIPLE_CLICKED   mouse button 3 triple clicked
    +       ---------------------------------------------------------------------
            BUTTON4_PRESSED          mouse button 4 down
            BUTTON4_RELEASED         mouse button 4 up
            BUTTON4_CLICKED          mouse button 4 clicked
            BUTTON4_DOUBLE_CLICKED   mouse button 4 double clicked
            BUTTON4_TRIPLE_CLICKED   mouse button 4 triple clicked
    +       ---------------------------------------------------------------------
    +       BUTTON5_PRESSED          mouse button 5 down
    +       BUTTON5_RELEASED         mouse button 5 up
    +       BUTTON5_CLICKED          mouse button 5 clicked
    +       BUTTON5_DOUBLE_CLICKED   mouse button 5 double clicked
    +       BUTTON5_TRIPLE_CLICKED   mouse button 5 triple clicked
    +       ---------------------------------------------------------------------
            BUTTON_SHIFT             shift was down during button state change
            BUTTON_CTRL              control was down during button state change
            BUTTON_ALT               alt was down during button state change
            ALL_MOUSE_EVENTS         report all button state changes
            REPORT_MOUSE_POSITION    report mouse movement
    +       ---------------------------------------------------------------------
     
            Once a class of mouse events have been made visible  in  a
    -       window,  calling  the  wgetch  function on that window may
    -       return KEY_MOUSE as an indicator that a  mouse  event  has
    -       been queued.  To read the event data and pop the event off
    -       the queue, call getmouse.  This function will return OK if
    -       a mouse event is actually visible in the given window, ERR
    +       window, calling the wgetch function on that window may re-
    +       turn KEY_MOUSE as an indicator that a mouse event has been
    +       queued.   To read the event data and pop the event off the
    +       queue, call getmouse.  This function will return OK  if  a
    +       mouse  event  is actually visible in the given window, ERR
            otherwise.  When getmouse returns OK, the  data  deposited
            as  y  and  x  in  the event structure coordinates will be
            screen-relative character-cell coordinates.  The  returned
    @@ -139,9 +151,9 @@
            event type.
     
            The ungetmouse function behaves  analogously  to  ungetch.
    -       It  pushes  a  KEY_MOUSE  event  onto the input queue, and
    -       associates with  that  event  the  given  state  data  and
    -       screen-relative character-cell coordinates.
    +       It  pushes a KEY_MOUSE event onto the input queue, and as-
    +       sociates with that event the given state data and  screen-
    +       relative character-cell coordinates.
     
            The  wenclose  function  tests  whether  a  given  pair of
            screen-relative character-cell coordinates is enclosed  by
    @@ -153,15 +165,15 @@
            dinates from stdscr-relative coordinates  to  screen-rela-
            tive  coordinates  or  vice  versa.  Please remember, that
            stdscr-relative coordinates are not  always  identical  to
    -       screen-relative   coordinates  due  to  the  mechanism  to
    -       reserve lines on top or bottom of  the  screen  for  other
    -       purposes (ripoff() call, see also slk_...  functions).  If
    +       screen-relative  coordinates  due  to the mechanism to re-
    +       serve lines on top or bottom of the screen for other  pur-
    +       poses  (ripoff()  call,  see also slk_...  functions).  If
            the parameter to_screen is TRUE, the pointers pY, pX  must
            reference  the coordinates of a location inside the window
            win.  They are converted  to  screen-relative  coordinates
            and  returned through the pointers.  If the conversion was
    -       successful, the function returns  TRUE.   If  one  of  the
    -       parameters was NULL or the location is not inside the win-
    +       successful, the function returns TRUE.  If one of the  pa-
    +       rameters  was  NULL or the location is not inside the win-
            dow, FALSE is returned.  If to_screen is FALSE, the point-
            ers  pY,  pX  must  reference screen-relative coordinates.
            They are converted to stdscr-relative coordinates  if  the
    @@ -173,25 +185,39 @@
            successful.
     
            The mouseinterval function sets the maximum time (in thou-
    -       sands  of  a  second)  that  can  elapse between press and
    -       release events for them to be recognized as a click.   Use
    -       mouseinterval(-1) to disable click resolution.  This func-
    -       tion returns the previous interval value.  The default  is
    -       one sixth of a second.
    -
    -       Note  that  mouse  events will be ignored when input is in
    +       sands  of  a second) that can elapse between press and re-
    +       lease events for them to be recognized as  a  click.   Use
    +       mouseinterval(0)  to disable click resolution.  This func-
    +       tion returns the previous interval value.  Use mouseinter-
    +       val(-1)  to  obtain the interval without altering it.  The
    +       default is one sixth of a second.
    +
    +       Note that mouse events will be ignored when  input  is  in
            cooked mode, and will cause an error beep when cooked mode
    -       is  being simulated in a window by a function such as get-
    +       is being simulated in a window by a function such as  get-
            str that expects a linefeed for input-loop termination.
     
     
     

    RETURN VALUE

    -       getmouse, ungetmouse and mouseinterval return the  integer
    -       ERR upon failure or OK upon successful completion.  mouse-
    -       mask returns the mask of reportable events.  wenclose  and
    -       wmouse_trafo are boolean functions returning TRUE or FALSE
    -       depending on their test result.
    +       getmouse  and ungetmouse return the integer ERR upon fail-
    +       ure or OK upon successful completion.
    +
    +              getmouse
    +                   returns an error.  If no mouse driver was ini-
    +                   tialized, or if the mask parameter is zero,
    +
    +              ungetmouse
    +                   returns an error if the FIFO is full.
    +
    +       mousemask returns the mask of reportable events.
    +
    +       mouseinterval  returns the previous interval value, unless
    +       the terminal was not initialized.  In that  case,  it  re-
    +       turns the maximum interval value (166).
    +
    +       wenclose  and wmouse_trafo are boolean functions returning
    +       TRUE or FALSE depending on their test result.
     
     
     
    @@ -202,17 +228,25 @@ The feature macro NCURSES_MOUSE_VERSION is provided so the preprocessor can be used to test whether these features - are present (its value is 1). If the interface is - changed, the value of NCURSES_MOUSE_VERSION will be incre- - mented. + are present. If the interface is changed, the value of + NCURSES_MOUSE_VERSION will be incremented. These values + for NCURSES_MOUSE_VERSION may be specified when configur- + ing ncurses: + + 1 has definitions for reserved events. The mask + uses 28 bits. + + 2 adds definitions for button 5, removes the defi- + nitions for reserved events. The mask uses 29 + bits. The order of the MEVENT structure members is not guaran- teed. Additional fields may be added to the structure in the future. - Under ncurses(3x), these calls are implemented using - either xterm's built-in mouse-tracking API or platform- - specific drivers including + Under ncurses(3x), these calls are implemented using ei- + ther xterm's built-in mouse-tracking API or platform-spe- + cific drivers including Alessandro Rubini's gpm server. FreeBSD sysmouse OS/2 EMX @@ -240,9 +274,9 @@ Mouse events under xterm will not be detected correctly in a window with its keypad bit off, since they are inter- - preted as a variety of function key. Your terminfo - description must have kmous set to "\E[M" (the beginning - of the response from xterm for mouse clicks). + preted as a variety of function key. Your terminfo de- + scription must have kmous set to "\E[M" (the beginning of + the response from xterm for mouse clicks). Because there are no standard terminal responses that would serve to identify terminals which support the xterm @@ -258,7 +292,7 @@ - curs_mouse(3x) + curs_mouse(3x)
    diff --git a/doc/html/man/curs_move.3x.html b/doc/html/man/curs_move.3x.html index 230874b4..3aeeb4a7 100644 --- a/doc/html/man/curs_move.3x.html +++ b/doc/html/man/curs_move.3x.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -curs_move(3x)                                       curs_move(3x)
    +curs_move(3x)                                             curs_move(3x)
     
     
     
    @@ -73,6 +73,9 @@
            fies only "an integer value other than ERR") upon success-
            ful completion.
     
    +       Specifically,  they  return an error if the window pointer
    +       is null, or if the position is outside the window.
    +
     
     

    NOTES

    @@ -81,12 +84,8 @@
     
     

    PORTABILITY

    -       These  functions are described in the XSI Curses standard,
    -       Issue 4.  The standard specifies that if (y,x) is within a
    -       multi-column  character,  the cursor is moved to the first
    -       column of that  character;  however,  this  implementation
    -       does  not  yet  support  the  extended-level XSI multibyte
    -       characters.
    +       These functions are described in the XSI Curses  standard,
    +       Issue 4.
     
     
     
    @@ -95,7 +94,7 @@ - curs_move(3x) + curs_move(3x)
    diff --git a/doc/html/man/curs_outopts.3x.html b/doc/html/man/curs_outopts.3x.html index ae728815..1ff83a94 100644 --- a/doc/html/man/curs_outopts.3x.html +++ b/doc/html/man/curs_outopts.3x.html @@ -1,7 +1,7 @@ @@ -40,14 +40,14 @@
     
    -curs_outopts(3x)                                 curs_outopts(3x)
    +curs_outopts(3x)                                       curs_outopts(3x)
     
     
     
     
     

    NAME

    -       clearok,   idlok,   idcok,  immedok,  leaveok,  setscrreg,
    +       clearok, idlok, idcok, immedok, leaveok, setscrreg,
            wsetscrreg, scrollok, nl, nonl - curses output options
     
     
    @@ -71,8 +71,8 @@
     

    DESCRIPTION

            These routines set options that change the style of output
            within  curses.   All  options are initially FALSE, unless
    -       otherwise stated.  It  is  not  necessary  to  turn  these
    -       options off before calling endwin.
    +       otherwise stated.  It is not necessary to turn  these  op-
    +       tions off before calling endwin.
     
            If  clearok is called with TRUE as argument, the next call
            to wrefresh with this window will clear  the  screen  com-
    @@ -106,30 +106,29 @@
            the window image, such as the ones caused by waddch, wclr-
            tobot,  wscrl,  etc.,  automatically  cause a call to wre-
            fresh.  However, it may degrade performance  considerably,
    -       due  to  repeated  calls  to  wrefresh.  It is disabled by
    -       default.
    +       due  to repeated calls to wrefresh.  It is disabled by de-
    +       fault.
     
            Normally, the hardware cursor is left at the  location  of
    -       the  window  cursor  being  refreshed.  The leaveok option
    -       allows the cursor to be left wherever the  update  happens
    -       to leave it.  It is useful for applications where the cur-
    -       sor is not used, since it  reduces  the  need  for  cursor
    -       motions.
    +       the window cursor being refreshed.  The leaveok option al-
    +       lows the cursor to be left wherever the update happens  to
    +       leave  it.  It is useful for applications where the cursor
    +       is not used, since it reduces the need for cursor motions.
     
            The  setscrreg  and wsetscrreg routines allow the applica-
            tion programmer to set a software scrolling  region  in  a
            window.   top  and bot are the line numbers of the top and
            bottom margin of the scrolling region.  (Line 0 is the top
    -       line  of  the  window.)   If  this option and scrollok are
    -       enabled, an attempt to move off  the  bottom  margin  line
    -       causes  all  lines  in  the scrolling region to scroll one
    -       line in the direction of the first line.  Only the text of
    -       the window is scrolled.  (Note that this has nothing to do
    +       line  of the window.)  If this option and scrollok are en-
    +       abled, an attempt to move off the bottom margin line caus-
    +       es all lines in the scrolling region to scroll one line in
    +       the direction of the first line.  Only  the  text  of  the
    +       window  is  scrolled.   (Note  that this has nothing to do
            with the use of a physical scrolling region capability  in
            the terminal, like that in the VT100.  If idlok is enabled
    -       and  the  terminal  has  either  a  scrolling  region   or
    -       insert/delete  line capability, they will probably be used
    -       by the output routines.)
    +       and the terminal has either  a  scrolling  region  or  in-
    +       sert/delete line capability, they will probably be used by
    +       the output routines.)
     
            The scrollok option controls what happens when the  cursor
            of  a  window  is  moved  off  the  edge  of the window or
    @@ -159,6 +158,23 @@
            cess and ERR upon failure.  All other routines that return
            an integer always return OK.
     
    +       X/Open does not define any error conditions.
    +
    +       In this implementation, those functions that have a window
    +       pointer will return an error  if  the  window  pointer  is
    +       null.
    +
    +              wclrtoeol
    +                   returns  an  error  if  the cursor position is
    +                   about to wrap.
    +
    +              wsetscrreg
    +                   returns an error if the scrolling region  lim-
    +                   its extend outside the window.
    +
    +       X/Open  does not define any error conditions.  This imple-
    +       mentation returns an error if the window pointer is  null.
    +
     
     

    PORTABILITY

    @@ -171,7 +187,7 @@
            translations;  AT&T  curses (at least as late as SVr1) did
            not.  We choose to do so, on the theory that a  programmer
            requesting  raw  input wants a clean (ideally 8-bit clean)
    -       connection that the operating system does not mess with.
    +       connection that the operating system will not alter.
     
            Some historic curses implementations had,  as  an  undocu-
            mented  feature,  the  ability  to  do  the  equivalent of
    @@ -206,7 +222,7 @@
     
     
     
    -                                                 curs_outopts(3x)
    +                                                       curs_outopts(3x)
     

    diff --git a/doc/html/man/curs_overlay.3x.html b/doc/html/man/curs_overlay.3x.html index f6f6b8f5..6b77631b 100644 --- a/doc/html/man/curs_overlay.3x.html +++ b/doc/html/man/curs_overlay.3x.html @@ -1,7 +1,7 @@ @@ -40,15 +40,15 @@
     
    -curs_overlay(3x)                                 curs_overlay(3x)
    +curs_overlay(3x)                                       curs_overlay(3x)
     
     
     
     
     

    NAME

    -       overlay, overwrite, copywin - overlay and manipulate over-
    -       lapped curses windows
    +       overlay, overwrite, copywin - overlay and manipulate
    +       overlapped curses windows
     
     
     
    @@ -86,6 +86,11 @@ and OK (SVr4 only specifies "an integer value other than ERR") upon successful completion. + X/Open defines no error conditions. In this implementa- + tion, copywin, overlay and overwrite return an error if + either of the window pointers are null, or if some part of + the window would be placed off-screen. +

    NOTES

    @@ -106,7 +111,7 @@
     
     
     
    -                                                 curs_overlay(3x)
    +                                                       curs_overlay(3x)
     

    diff --git a/doc/html/man/curs_pad.3x.html b/doc/html/man/curs_pad.3x.html index 77e534c1..e4971813 100644 --- a/doc/html/man/curs_pad.3x.html +++ b/doc/html/man/curs_pad.3x.html @@ -1,7 +1,7 @@ @@ -40,14 +40,14 @@
     
    -curs_pad(3x)                                         curs_pad(3x)
    +curs_pad(3x)                                               curs_pad(3x)
     
     
     
     
     

    NAME

    -       newpad,   subpad,   prefresh,   pnoutrefresh,   pechochar,
    +       newpad, subpad, prefresh, pnoutrefresh, pechochar,
            pecho_wchar - create and display curses pads
     
     
    @@ -74,10 +74,10 @@
            it is not restricted by the screen size, and is not neces-
            sarily associated with a particular part  of  the  screen.
            Pads can be used when a large window is needed, and only a
    -       part of the window will be on  the  screen  at  one  time.
    -       Automatic refreshes of pads (e.g., from scrolling or echo-
    -       ing of input) do not occur.  It is not legal to call  wre-
    -       fresh  with a pad as an argument; the routines prefresh or
    +       part of the window will be on the screen at one time.  Au-
    +       tomatic refreshes of pads (e.g., from scrolling or echoing
    +       of input) do not occur.  It is not legal to call  wrefresh
    +       with  a  pad  as  an  argument;  the  routines prefresh or
            pnoutrefresh should be called instead.   Note  that  these
            routines require additional parameters to specify the part
            of the pad to be displayed and the location on the  screen
    @@ -89,9 +89,9 @@
            screen coordinates, the window is  at  position  (begin_x,
            begin_y)  on the pad.  The window is made in the middle of
            the window orig, so that changes made to one window affect
    -       both  windows.   During  the  use of this routine, it will
    -       often be necessary to call touchwin or touchline  on  orig
    -       before calling prefresh.
    +       both windows.  During the use of this routine, it will of-
    +       ten be necessary to call touchwin or touchline on orig be-
    +       fore calling prefresh.
     
            The  prefresh  and  pnoutrefresh routines are analogous to
            wrefresh and wnoutrefresh except that they relate to  pads
    @@ -105,8 +105,8 @@
            culated from the screen coordinates, since the  rectangles
            must  be  the same size.  Both rectangles must be entirely
            contained within their  respective  structures.   Negative
    -       values  of  pminrow,  pmincol,  sminrow,  or  smincol  are
    -       treated as if they were zero.
    +       values of pminrow, pmincol, sminrow, or smincol are treat-
    +       ed as if they were zero.
     
            The pechochar routine is functionally equivalent to a call
            to  addch  followed by a call to refresh, a call to waddch
    @@ -114,10 +114,10 @@
            lowed  by  a  call to prefresh.  The knowledge that only a
            single character is being output is taken into  considera-
            tion  and, for non-control characters, a considerable per-
    -       formance gain  might  be  seen  by  using  these  routines
    -       instead  of  their equivalents.  In the case of pechochar,
    -       the last location of the pad on the screen is  reused  for
    -       the arguments to prefresh.
    +       formance gain might be seen by using  these  routines  in-
    +       stead of their equivalents.  In the case of pechochar, the
    +       last location of the pad on the screen is reused  for  the
    +       arguments to prefresh.
     
            The  pecho_wchar  function is the analogous wide-character
            form of pechochar.  It outputs one character to a pad  and
    @@ -134,6 +134,26 @@
            Routines that return pointers return NULL  on  error,  and
            set errno to ENOMEM.
     
    +       X/Open  does not define any error conditions.  In this im-
    +       plementation
    +
    +              prefresh and pnoutrefresh
    +                   return an error if the window pointer is null,
    +                   or if the window is not really a pad or if the
    +                   area to refresh extends off-screen or  if  the
    +                   minimum coordinates are greater than the maxi-
    +                   mum.
    +
    +              pechochar
    +                   returns an error if the window is not really a
    +                   pad,  and the associated call to wechochar re-
    +                   turns an error.
    +
    +              pecho_wchar
    +                   returns an error if the window is not really a
    +                   pad,  and  the  associated call to wecho_wchar
    +                   returns an error.
    +
     
     

    NOTES

    @@ -142,18 +162,18 @@
     
     

    PORTABILITY

    -       The  XSI  Curses  standard,  Issue 4 describes these func-
    +       The XSI Curses standard, Issue  4  describes  these  func-
            tions.
     
     
     

    SEE ALSO

    -       curses(3x),       curs_refresh(3x),        curs_touch(3x),
    -       curs_addch(3x).
    +       curses(3x),  curs_refresh(3x),  curs_touch(3x),  curs_add-
    +       ch(3x).
     
     
     
    -                                                     curs_pad(3x)
    +                                                           curs_pad(3x)
     

    diff --git a/doc/html/man/curs_print.3x.html b/doc/html/man/curs_print.3x.html index fc160e49..4261dbe3 100644 --- a/doc/html/man/curs_print.3x.html +++ b/doc/html/man/curs_print.3x.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -curs_print(3x)                                     curs_print(3x)
    +curs_print(3x)                                           curs_print(3x)
     
     
     
    @@ -82,7 +82,7 @@
            following:
     
            ENODEV
    -            Capabilities for printer redirection don't exist.
    +            Capabilities for printer redirection do not exist.
     
            ENOMEM
                 Couldn't allocate sufficient  memory  to  buffer  the
    @@ -111,7 +111,7 @@
     
     
     
    -                                                   curs_print(3x)
    +                                                         curs_print(3x)
     

    diff --git a/doc/html/man/curs_printw.3x.html b/doc/html/man/curs_printw.3x.html index 498da06c..d9fe3600 100644 --- a/doc/html/man/curs_printw.3x.html +++ b/doc/html/man/curs_printw.3x.html @@ -1,7 +1,7 @@ @@ -40,14 +40,14 @@
     
    -curs_printw(3x)                                   curs_printw(3x)
    +curs_printw(3x)                                         curs_printw(3x)
     
     
     
     
     

    NAME

    -       printw,  wprintw, mvprintw, mvwprintw, vwprintw, vw_printw
    +       printw, wprintw, mvprintw, mvwprintw, vwprintw, vw_printw
            - print formatted output in curses windows
     
     
    @@ -86,18 +86,23 @@
            and  OK  (SVr4 only specifies "an integer value other than
            ERR") upon successful completion.
     
    +       X/Open defines no error conditions.  In  this  implementa-
    +       tion,  an  error  may  be  returned  if it cannot allocate
    +       enough memory for the buffer used to format  the  results.
    +       It will return an error if the window pointer is null.
    +
     
     

    PORTABILITY

    -       The XSI Curses standard, Issue  4  describes  these  func-
    -       tions.   The  function vwprintw is marked TO BE WITHDRAWN,
    -       and is to be replaced by a function  vw_printw  using  the
    +       The  XSI  Curses  standard,  Issue 4 describes these func-
    +       tions.  The function vwprintw is marked TO  BE  WITHDRAWN,
    +       and  is  to  be replaced by a function vw_printw using the
            <stdarg.h> interface.  The Single Unix Specification, Ver-
    -       sion 2 states that vw_printw   is  preferred  to  vwprintw
    -       since  the  latter  requires  including <varargs.h>, which
    -       cannot be used in  the  same  file  as  <stdarg.h>.   This
    -       implementation  uses  <stdarg.h>  for  both,  because that
    -       header is included in <curses.h>.
    +       sion  2  states  that  vw_printw  is preferred to vwprintw
    +       since the latter  requires  including  <varargs.h>,  which
    +       cannot  be  used in the same file as <stdarg.h>.  This im-
    +       plementation uses <stdarg.h> for both, because that header
    +       is included in <curses.h>.
     
     
     
    @@ -106,7 +111,7 @@ - curs_printw(3x) + curs_printw(3x)
    diff --git a/doc/html/man/curs_refresh.3x.html b/doc/html/man/curs_refresh.3x.html index 60c5e332..e169d954 100644 --- a/doc/html/man/curs_refresh.3x.html +++ b/doc/html/man/curs_refresh.3x.html @@ -1,7 +1,7 @@ @@ -40,14 +40,14 @@
     
    -curs_refresh(3x)                                 curs_refresh(3x)
    +curs_refresh(3x)                                       curs_refresh(3x)
     
     
     
     
     

    NAME

    -       doupdate,  redrawwin,  refresh,  wnoutrefresh,  wredrawln,
    +       doupdate, redrawwin, refresh, wnoutrefresh, wredrawln,
            wrefresh - refresh curses windows and lines
     
     
    @@ -76,51 +76,62 @@
            minal is left at the location of the cursor for that  win-
            dow.
     
    -       The  wnoutrefresh  and  doupdate  routines  allow multiple
    -       updates with more  efficiency  than  wrefresh  alone.   In
    -       addition  to  all  the window structures, curses keeps two
    -       data structures representing the terminal screen: a physi-
    -       cal screen, describing what is actually on the screen, and
    -       a virtual screen, describing what the programmer wants  to
    +       The  wnoutrefresh and doupdate routines allow multiple up-
    +       dates with more efficiency than wrefresh alone.  In  addi-
    +       tion  to  all the window structures, curses keeps two data
    +       structures representing the terminal  screen:  a  physical
    +       screen,  describing  what is actually on the screen, and a
    +       virtual screen, describing what the  programmer  wants  to
            have on the screen.
     
            The  routine wrefresh works by first calling wnoutrefresh,
            which copies the named window to the virtual  screen,  and
            then  calling  doupdate, which compares the virtual screen
            to the physical screen and does the actual update.  If the
    -       programmer  wishes  to  output  several windows at once, a
    -       series of calls to wrefresh results in  alternating  calls
    -       to  wnoutrefresh  and  doupdate, causing several bursts of
    -       output to the screen.  By first calling  wnoutrefresh  for
    -       each  window,  it  is then possible to call doupdate once,
    -       resulting in only one burst of output,  with  fewer  total
    -       characters transmitted and less CPU time used.  If the win
    -       argument to wrefresh is the global  variable  curscr,  the
    -       screen  is immediately cleared and repainted from scratch.
    +       programmer wishes to output several windows at once, a se-
    +       ries of calls to wrefresh results in alternating calls  to
    +       wnoutrefresh  and doupdate, causing several bursts of out-
    +       put to the screen.  By first calling wnoutrefresh for each
    +       window, it is then possible to call doupdate once, result-
    +       ing in only one burst of output, with fewer total  charac-
    +       ters transmitted and less CPU time used.  If the win argu-
    +       ment to wrefresh is the global variable curscr, the screen
    +       is immediately cleared and repainted from scratch.
     
            The phrase "copies the named window to the virtual screen"
    -       above  is  ambiguous.   What  actually happens is that all
    -       touched (changed) lines in the window are  copied  to  the
    -       virtual  screen.   This affects programs that use overlap-
    -       ping windows; it means that if two  windows  overlap,  you
    -       can  refresh  them  in either order and the overlap region
    +       above is ambiguous.  What actually  happens  is  that  all
    +       touched  (changed)  lines  in the window are copied to the
    +       virtual screen.  This affects programs that  use  overlap-
    +       ping  windows;  it  means that if two windows overlap, you
    +       can refresh them in either order and  the  overlap  region
            will be modified only when it is explicitly changed.  (But
    -       see  the  section on PORTABILITY below for a warning about
    +       see the section on PORTABILITY below for a  warning  about
            exploiting this behavior.)
     
            The wredrawln routine indicates to curses that some screen
    -       lines  are corrupted and should be thrown away before any-
    -       thing is written over  them.   It  touches  the  indicated
    -       lines  (marking  them  changed).   The routine redrawwin()
    +       lines are corrupted and should be thrown away before  any-
    +       thing  is  written  over  them.   It touches the indicated
    +       lines (marking them  changed).   The  routine  redrawwin()
            touches the entire window.
     
     
     

    RETURN VALUE

    -       Routines that return an integer return ERR  upon  failure,
    -       and  OK  (SVr4 only specifies "an integer value other than
    +       Routines  that  return an integer return ERR upon failure,
    +       and OK (SVr4 only specifies "an integer value  other  than
            ERR") upon successful completion.
     
    +       X/Open  does not define any error conditions.  In this im-
    +       plementation
    +
    +              wnoutrefresh
    +                   returns an error  if  the  window  pointer  is
    +                   null, or if the window is really a pad.
    +
    +              wredrawln
    +                   returns  an  error  if  the associated call to
    +                   touchln returns an error.
    +
     
     

    NOTES

    @@ -137,9 +148,9 @@
            has never been well-documented in historic curses versions
            (including SVr4).  It might be unwise to  rely  on  either
            behavior  in  programs  that  might have to be linked with
    -       other curses implementations.   Instead,  you  can  do  an
    -       explicit  touchwin()  before  the  wnoutrefresh()  call to
    -       guarantee an entire-contents copy anywhere.
    +       other curses implementations.  Instead, you can do an  ex-
    +       plicit  touchwin() before the wnoutrefresh() call to guar-
    +       antee an entire-contents copy anywhere.
     
     
     
    @@ -148,7 +159,7 @@ - curs_refresh(3x) + curs_refresh(3x)
    diff --git a/doc/html/man/curs_scanw.3x.html b/doc/html/man/curs_scanw.3x.html index dd2aae38..a832d73d 100644 --- a/doc/html/man/curs_scanw.3x.html +++ b/doc/html/man/curs_scanw.3x.html @@ -40,7 +40,7 @@
     
    -curs_scanw(3x)                                     curs_scanw(3x)
    +curs_scanw(3x)                                           curs_scanw(3x)
     
     
     
    @@ -118,7 +118,7 @@
     
     
     
    -                                                   curs_scanw(3x)
    +                                                         curs_scanw(3x)
     

    diff --git a/doc/html/man/curs_scr_dump.3x.html b/doc/html/man/curs_scr_dump.3x.html index 615b1287..8be145e8 100644 --- a/doc/html/man/curs_scr_dump.3x.html +++ b/doc/html/man/curs_scr_dump.3x.html @@ -1,7 +1,7 @@ @@ -40,14 +40,14 @@
     
    -curs_scr_dump(3x)                               curs_scr_dump(3x)
    +curs_scr_dump(3x)                                     curs_scr_dump(3x)
     
     
     
     
     

    NAME

    -       scr_dump,  scr_restore, scr_init, scr_set - read (write) a
    +       scr_dump, scr_restore, scr_init, scr_set - read (write) a
            curses screen from (to) a file
     
     
    @@ -73,15 +73,15 @@
     
            The scr_init routine reads in the contents of filename and
            uses  them  to initialize the curses data structures about
    -       what the terminal currently has on  its  screen.   If  the
    -       data  is  determined  to  be  valid, curses bases its next
    -       update of the  screen  on  this  information  rather  than
    -       clearing  the  screen and starting from scratch.  scr_init
    -       is used after initscr or a system call to share the screen
    -       with  another  process which has done a scr_dump after its
    -       endwin call.  The data is declared invalid if the terminfo
    -       capabilities  rmcup  and nrrmc exist; also if the terminal
    -       has been written to since the preceding scr_dump call.
    +       what the terminal currently has on its screen.  If the da-
    +       ta is determined to be valid, curses bases its next update
    +       of the screen on this information rather than clearing the
    +       screen  and starting from scratch.  scr_init is used after
    +       initscr or a system call to share the screen with  another
    +       process  which  has done a scr_dump after its endwin call.
    +       The data is declared invalid if the terminfo  capabilities
    +       rmcup and nrrmc exist; also if the terminal has been writ-
    +       ten to since the preceding scr_dump call.
     
            The scr_set routine is a combination  of  scr_restore  and
            scr_init.   It  tells  the program that the information in
    @@ -98,6 +98,10 @@
            All  routines  return  the integer ERR upon failure and OK
            upon success.
     
    +       X/Open defines no error conditions.  In  this  implementa-
    +       tion,  each  will  return  an  error if the file cannot be
    +       opened.
    +
     
     

    NOTES

    @@ -112,7 +116,7 @@
     
            The SVr4 docs merely say under scr_init that the dump data
            is  also  considered invalid "if the time-stamp of the tty
    -       is old" but don't define "old".
    +       is old" but do not define "old".
     
     
     
    @@ -122,7 +126,7 @@ - curs_scr_dump(3x) + curs_scr_dump(3x)
    diff --git a/doc/html/man/curs_scroll.3x.html b/doc/html/man/curs_scroll.3x.html index 0570dadb..375205d9 100644 --- a/doc/html/man/curs_scroll.3x.html +++ b/doc/html/man/curs_scroll.3x.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -curs_scroll(3x)                                   curs_scroll(3x)
    +curs_scroll(3x)                                         curs_scroll(3x)
     
     
     
    @@ -83,6 +83,12 @@
            specifies "an integer value other than ERR") upon success-
            ful completion.
     
    +       X/Open defines no error conditions.
    +
    +       This implementation returns an error if the window pointer
    +       is  null,  or  if  scrolling is not enabled in the window,
    +       e.g., with scrollok.
    +
     
     

    NOTES

    @@ -93,13 +99,13 @@
            entire screen "is"  performed,  not  "may  be"  performed.
            This  implementation  deliberately does not guarantee that
            this will occur, to leave open the possibility of  smarter
    -       optimization  of  multiple  scroll  actions  on  the  next
    -       update.
    +       optimization  of  multiple  scroll actions on the next up-
    +       date.
     
            Neither the SVr4 nor the XSI documentation specify whether
            the current attribute or current color-pair of blanks gen-
    -       erated by the  scroll  function  is  zeroed.   Under  this
    -       implementation it is.
    +       erated by the scroll function is zeroed.  Under  this  im-
    +       plementation it is.
     
     
     
    @@ -114,7 +120,7 @@ - curs_scroll(3x) + curs_scroll(3x)
    diff --git a/doc/html/man/curs_slk.3x.html b/doc/html/man/curs_slk.3x.html index 72ceb115..d2f0d98c 100644 --- a/doc/html/man/curs_slk.3x.html +++ b/doc/html/man/curs_slk.3x.html @@ -1,7 +1,7 @@ @@ -40,18 +40,18 @@
     
    -curs_slk(3x)                                         curs_slk(3x)
    +curs_slk(3x)                                               curs_slk(3x)
     
     
     
     
     

    NAME

    -       slk_init,     slk_set,    slk_refresh,    slk_noutrefresh,
    -       slk_label, slk_clear, slk_restore, slk_touch,  slk_attron,
    -       slk_attrset,   slk_attroff,   slk_attr_on,   slk_attr_set,
    -       slk_attr_off, slk_attr, slk_color - curses soft label rou-
    -       tines
    +       slk_init, slk_set, slk_refresh, slk_noutrefresh,
    +       slk_label, slk_clear, slk_restore, slk_touch, slk_attron,
    +       slk_attrset, slk_attroff, slk_attr_on, slk_attr_set,
    +       slk_attr_off, slk_attr, slk_color - curses soft label
    +       routines
     
     
     
    @@ -85,8 +85,8 @@ line of stdscr, reducing the size of stdscr and the vari- able LINES. curses standardizes on eight labels of up to eight characters each. In addition to this, the ncurses - implementation supports a mode where it simulates 12 - labels of up to five characters each. This is most common + implementation supports a mode where it simulates 12 la- + bels of up to five characters each. This is most common for todays PC like enduser devices. Please note that ncurses simulates this mode by taking over up to two lines at the bottom of the screen, it doesn't try to use any @@ -142,10 +142,48 @@

    RETURN VALUE

            These routines return ERR upon failure and OK (SVr4 speci-
            fies only "an integer value other than ERR") upon success-
    -       ful  completion.  slk_attr  returns the attribute used for
    -       the soft keys.
    +       ful completion.
     
    -       slk_label returns NULL on error.
    +       X/Open  defines  no error conditions.  In this implementa-
    +       tion
    +
    +              slk_attr
    +                   returns the attribute used for the soft  keys.
    +
    +              slk_attroff, slk_attron, slk_clear,
    +              slk_noutrefresh, slk_refresh, slk_touch
    +                   return  an  error if the terminal or the soft-
    +                   keys were not initialized.
    +
    +              slk_attrset
    +                   returns an error if the terminal or the  soft-
    +                   keys were not initialized.
    +
    +              slk_attr_set
    +                   returns  an error if the terminal or the soft-
    +                   keys were not initialized, or the  color  pair
    +                   is outside the range 0..COLOR_PAIRS-1, or opts
    +                   is not null.
    +
    +              slk_color
    +                   returns an error if the terminal or the  soft-
    +                   keys  were  not initialized, or the color pair
    +                   is outside the range 0..COLOR_PAIRS-1.
    +
    +              slk_init
    +                   returns an error if the  format  parameter  is
    +                   outside the range 0..3.
    +
    +              slk_label
    +                   returns NULL on error.
    +
    +              slk_set
    +                   returns  an error if the terminal or the soft-
    +                   keys were not initialized, or the  labnum  pa-
    +                   rameter  is outside the range of label counts,
    +                   or if the  format  parameter  is  outside  the
    +                   range 0..2, or if memory for the labels cannot
    +                   be allocated.
     
     
     
    @@ -157,21 +195,21 @@

    PORTABILITY

            The  XSI  Curses  standard, Issue 4, describes these func-
    -       tions.  It changes the argument  type  of  the  attribute-
    -       manipulation     functions     slk_attron,    slk_attroff,
    -       slk_attrset to be attr_t, and adds const  qualifiers.  The
    -       format  codes  2  and  3  for  slk_init() and the function
    -       slk_attr are specific to ncurses.
    +       tions.  It changes the argument type of the  attribute-ma-
    +       nipulation  functions slk_attron, slk_attroff, slk_attrset
    +       to be attr_t, and adds const qualifiers. The format  codes
    +       2  and 3 for slk_init() and the function slk_attr are spe-
    +       cific to ncurses.
     
     
     

    SEE ALSO

    -       curses(3x),        curs_attr(3x),        curs_initscr(3x),
    -       curs_refresh(3x)
    +       curses(3x),  curs_attr(3x),   curs_initscr(3x),   curs_re-
    +       fresh(3x)
     
     
     
    -                                                     curs_slk(3x)
    +                                                           curs_slk(3x)
     

    diff --git a/doc/html/man/curs_termattrs.3x.html b/doc/html/man/curs_termattrs.3x.html index 8b508a05..9b9cdae9 100644 --- a/doc/html/man/curs_termattrs.3x.html +++ b/doc/html/man/curs_termattrs.3x.html @@ -40,7 +40,7 @@
     
    -curs_termattrs(3x)                             curs_termattrs(3x)
    +curs_termattrs(3x)                                   curs_termattrs(3x)
     
     
     
    @@ -150,7 +150,7 @@
     
     
     
    -                                               curs_termattrs(3x)
    +                                                     curs_termattrs(3x)
     

    diff --git a/doc/html/man/curs_termcap.3x.html b/doc/html/man/curs_termcap.3x.html index d9145631..9a168994 100644 --- a/doc/html/man/curs_termcap.3x.html +++ b/doc/html/man/curs_termcap.3x.html @@ -40,7 +40,7 @@
     
    -curs_termcap(3x)                                 curs_termcap(3x)
    +curs_termcap(3x)                                       curs_termcap(3x)
     
     
     
    @@ -115,9 +115,9 @@
     

    RETURN VALUE

            Except where explicitly noted,  routines  that  return  an
    -       integer  return  ERR upon failure and OK (SVr4 only speci-
    -       fies "an integer value other than  ERR")  upon  successful
    -       completion.
    +       integer   return  ERR  upon  failure  and  OK  (SVr4  only
    +       specifies "an integer value other than ERR") upon success-
    +       ful completion.
     
            Routines that return pointers return NULL on error.
     
    @@ -176,7 +176,7 @@
     
     
     
    -                                                 curs_termcap(3x)
    +                                                       curs_termcap(3x)
     

    diff --git a/doc/html/man/curs_terminfo.3x.html b/doc/html/man/curs_terminfo.3x.html index 724a4be8..14361b32 100644 --- a/doc/html/man/curs_terminfo.3x.html +++ b/doc/html/man/curs_terminfo.3x.html @@ -1,7 +1,7 @@ @@ -40,16 +40,16 @@
     
    -curs_terminfo(3x)                               curs_terminfo(3x)
    +curs_terminfo(3x)                                     curs_terminfo(3x)
     
     
     
     
     

    NAME

    -       del_curterm,  mvcur,  putp, restartterm, set_curterm, set-
    -       term, setupterm,  tigetflag,  tigetnum,  tigetstr,  tparm,
    -       tputs,  vid_attr,  vid_puts,  vidattr,  vidputs  -  curses
    +       del_curterm, mvcur, putp, restartterm, set_curterm,
    +       setterm, setupterm, tigetflag, tigetnum, tigetstr, tparm,
    +       tputs, vid_attr, vid_puts, vidattr, vidputs - curses
            interfaces to terminfo database
     
     
    @@ -84,8 +84,8 @@
            tion  keys.   For all other functionality, curses routines
            are more suitable and their use is recommended.
     
    -       Initially,  setupterm  should  be   called.    Note   that
    -       setupterm  is automatically called by initscr and newterm.
    +       Initially, setupterm should  be  called.   Note  that  se-
    +       tupterm  is  automatically  called by initscr and newterm.
            This  defines  the  set  of  terminal-dependent  variables
            [listed in terminfo(5)].  The terminfo variables lines and
            columns  are  initialized  by  setupterm  as  follows:  If
    @@ -105,14 +105,14 @@
            strings [including the output of tparm] should be  printed
            with  tputs or putp.  Call the reset_shell_mode to restore
            the tty modes before exiting [see curs_kernel(3x)].   Pro-
    -       grams   which   use   cursor   addressing   should  output
    -       enter_ca_mode upon startup and should output  exit_ca_mode
    +       grams  which  use  cursor  addressing  should  output  en-
    +       ter_ca_mode upon startup and  should  output  exit_ca_mode
            before  exiting.   Programs  desiring shell escapes should
            call
     
            reset_shell_mode and output exit_ca_mode before the  shell
    -       is   called  and  should  output  enter_ca_mode  and  call
    -       reset_prog_mode after returning from the shell.
    +       is  called  and  should  output enter_ca_mode and call re-
    +       set_prog_mode after returning from the shell.
     
            The setupterm routine reads in the terminfo database, ini-
            tializing the terminfo structures, but does not set up the
    @@ -121,8 +121,8 @@
            the environment variable TERM is used.  All output  is  to
            file  descriptor  fildes  which is initialized for output.
            If errret is not null, then setupterm returns  OK  or  ERR
    -       and  stores  a  status  value in the integer pointed to by
    -       errret.  A return value of OK combined with status of 1 in
    +       and stores a status value in the integer pointed to by er-
    +       rret.  A return value of OK combined with status of  1  in
            errret is normal.  If ERR is returned, examine errret:
     
                   1    means that the terminal is hardcopy, cannot be
    @@ -160,8 +160,8 @@
            The  del_curterm  routine  frees  the  space pointed to by
            oterm and makes it available for further use.  If oterm is
            the  same  as  cur_term, references to any of the terminfo
    -       boolean, numeric,  and  string  variables  thereafter  may
    -       refer  to invalid memory locations until another setupterm
    +       boolean, numeric, and string variables thereafter may  re-
    +       fer  to  invalid  memory locations until another setupterm
            has been called.
     
            The  restartterm  routine  is  similar  to  setupterm  and
    @@ -207,8 +207,8 @@
            that argument.
     
            The mvcur routine provides low-level  cursor  motion.   It
    -       takes   effect   immediately  (rather  than  at  the  next
    -       refresh).
    +       takes  effect  immediately  (rather  than  at the next re-
    +       fresh).
     
            The tigetflag, tigetnum and tigetstr routines  return  the
            value of the capability corresponding to the terminfo cap-
    @@ -219,8 +219,8 @@
            from the terminal description.
     
            The tigetnum routine returns the value -2  if  capname  is
    -       not  a  numeric  capability,  or  -1  if it is canceled or
    -       absent from the terminal description.
    +       not  a  numeric capability, or -1 if it is canceled or ab-
    +       sent from the terminal description.
     
            The tigetstr routine returns the value (char *)-1 if  cap-
            name is not a string capability, or 0 if it is canceled or
    @@ -250,6 +250,23 @@
     
            Routines that return pointers always return NULL on error.
     
    +       X/Open defines no error conditions.  In  this  implementa-
    +       tion
    +
    +              del_curterm
    +                   returns  an error if its terminal parameter is
    +                   null.
    +
    +              restartterm
    +                   returns an error if the associated call to se-
    +                   tupterm returns an error.
    +
    +              setupterm
    +                   returns  an error if it cannot allocate enough
    +                   memory, or create the initial windows (stdscr,
    +                   curscr,  newscr).   Other error conditions are
    +                   documented above.
    +
     
     

    NOTES

    @@ -297,7 +314,7 @@
     
     
     
    -                                                curs_terminfo(3x)
    +                                                      curs_terminfo(3x)
     

    diff --git a/doc/html/man/curs_touch.3x.html b/doc/html/man/curs_touch.3x.html index 64f83cdc..52660dba 100644 --- a/doc/html/man/curs_touch.3x.html +++ b/doc/html/man/curs_touch.3x.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -curs_touch(3x)                                     curs_touch(3x)
    +curs_touch(3x)                                           curs_touch(3x)
     
     
     
    @@ -95,15 +95,30 @@
            unless otherwise noted in the preceding  routine  descrip-
            tions.
     
    +       X/Open  does not define any error conditions.  In this im-
    +       plementation
    +
    +              is_linetouched
    +                   returns an error  if  the  window  pointer  is
    +                   null,  or  if  the  line number is outside the
    +                   window.  Note that ERR is distinct  from  TRUE
    +                   and  FALSE, which are the normal return values
    +                   of this function.
    +
    +              wtouchln
    +                   returns an error  if  the  window  pointer  is
    +                   null,  or  if  the  line number is outside the
    +                   window.
    +
     
     

    PORTABILITY

    -       The  XSI  Curses  standard,  Issue 4 describes these func-
    +       The XSI Curses standard, Issue  4  describes  these  func-
            tions.
     
    -       Some historic curses implementations had,  as  an  undocu-
    -       mented  feature,  the  ability  to  do  the  equivalent of
    -       clearok(..., 1) by saying touchwin(stdscr)  or  clear(std-
    +       Some  historic  curses  implementations had, as an undocu-
    +       mented feature,  the  ability  to  do  the  equivalent  of
    +       clearok(...,  1)  by saying touchwin(stdscr) or clear(std-
            scr).  This will not work under ncurses.
     
     
    @@ -118,7 +133,7 @@
     
     
     
    -                                                   curs_touch(3x)
    +                                                         curs_touch(3x)
     

    diff --git a/doc/html/man/curs_trace.3x.html b/doc/html/man/curs_trace.3x.html index ee7065c1..8c3c5553 100644 --- a/doc/html/man/curs_trace.3x.html +++ b/doc/html/man/curs_trace.3x.html @@ -1,7 +1,7 @@ @@ -40,21 +40,22 @@
     
    -curs_trace(3x)                                     curs_trace(3x)
    +curs_trace(3x)                                           curs_trace(3x)
     
     
     
     
     

    NAME

    -       _tracef,      _tracedump,     _traceattr,     _traceattr2,
    -       _nc_tracebits,  _tracechar,  _tracechtype,  _tracechtype2,
    +       _tracef, _tracedump, _traceattr, _traceattr2,
    +       _nc_tracebits, _tracechar, _tracechtype, _tracechtype2,
            _tracemouse, trace - curses debugging routines
     
     
     

    SYNOPSIS

            #include <curses.h>
    +
            void _tracef(const char *format, ...);
            void _tracedump(const char *label, WINDOW *win);
            char *_traceattr(attr_t attr);
    @@ -69,12 +70,12 @@
     
     

    DESCRIPTION

    -       The  trace  routines  are  used  for debugging the ncurses
    -       libraries, as well as applications which use  the  ncurses
    -       libraries.   These  functions  are normally available only
    -       with the debugging library libncurses_g.a, but may be com-
    -       piled into any model (shared, static, profile) by defining
    -       the symbol TRACE.
    +       The  trace routines are used for debugging the ncurses li-
    +       braries, as well as applications which use the ncurses li-
    +       braries.  These functions are normally available only with
    +       the debugging library libncurses_g.a, but may be  compiled
    +       into  any  model (shared, static, profile) by defining the
    +       symbol TRACE.
     
            The principal parts of this interface are the  trace  rou-
            tine which selectively enables different tracing features,
    @@ -106,8 +107,8 @@
     
            TRACE_ORDINARY
                 trace all update actions.  The  old  and  new  screen
    -            contents  are  written  to  the  trace  file for each
    -            refresh.
    +            contents  are  written to the trace file for each re-
    +            fresh.
     
            TRACE_CALLS
                 trace all curses calls.  The parameters for each call
    @@ -138,9 +139,9 @@
                 maximum trace level,  enables  all  of  the  separate
                 trace features.
     
    -            Some  tracing features are enabled whenever the trace
    -            parameter is nonzero.  Some  features  overlap.   The
    -            specific names are used as a guideline.
    +       Some  tracing  features are enabled whenever the trace pa-
    +       rameter is nonzero.  Some features overlap.  The  specific
    +       names are used as a guideline.
     
     
     
    @@ -163,7 +164,7 @@ - curs_trace(3x) + curs_trace(3x)
    diff --git a/doc/html/man/curs_util.3x.html b/doc/html/man/curs_util.3x.html index 2557f86d..760298dc 100644 --- a/doc/html/man/curs_util.3x.html +++ b/doc/html/man/curs_util.3x.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -curs_util(3x)                                       curs_util(3x)
    +curs_util(3x)                                             curs_util(3x)
     
     
     
    @@ -48,7 +48,7 @@
     

    NAME

            delay_output, filter, flushinp, getwin, key_name, keyname,
    -       putwin, unctrl, use_env, wunctrl  -  miscellaneous  curses
    +       putwin, unctrl, use_env, wunctrl - miscellaneous curses
            utility routines
     
     
    @@ -71,9 +71,9 @@
     

    DESCRIPTION

            The  unctrl  routine returns a character string which is a
    -       printable representation  of  the  character  c,  ignoring
    -       attributes.   Control  characters  are displayed in the ^X
    -       notation.  Printing characters are displayed as  is.   The
    +       printable representation of the character c, ignoring  at-
    +       tributes.   Control characters are displayed in the ^X no-
    +       tation.  Printing characters are  displayed  as  is.   The
            corresponding  wunctrl  returns a printable representation
            of a wide-character.
     
    @@ -98,9 +98,11 @@
            ment, the values of lines and  columns  specified  in  the
            terminfo  database will be used, even if environment vari-
            ables LINES and COLUMNS (used by default) are set,  or  if
    -       curses  is  running  in  a  window  (in which case default
    -       behavior would be to use the  window  size  if  LINES  and
    -       COLUMNS are not set).
    +       curses  is  running in a window (in which case default be-
    +       havior would be to  use  the  window  size  if  LINES  and
    +       COLUMNS  are not set).  Note that setting LINES or COLUMNS
    +       overrides the corresponding size  which  may  be  obtained
    +       from the operating system.
     
            The  putwin routine writes all data associated with window
            win into the file to which filep points.  This information
    @@ -124,27 +126,48 @@
     
     

    RETURN VALUE

    -       Except for  flushinp,  routines  that  return  an  integer
    -       return  ERR  upon  failure and OK (SVr4 specifies only "an
    -       integer value other than ERR") upon successful completion.
    -
    -       flushinp always returns OK.
    +       Except for flushinp, routines that return an  integer  re-
    +       turn  ERR upon failure and OK (SVr4 specifies only "an in-
    +       teger value other than ERR") upon successful completion.
     
            Routines that return pointers return NULL on error.
     
    +       X/Open does not define any error conditions.  In this  im-
    +       plementation
    +
    +              flushinp
    +                   returns  an error if the terminal was not ini-
    +                   tialized.
    +
    +              putwin
    +                   returns an  error  if  the  associated  fwrite
    +                   calls return an error.
    +
     
     

    PORTABILITY

            The  XSI  Curses  standard,  Issue 4 describes these func-
            tions.  It states that unctrl and wunctrl  will  return  a
    -       null  pointer  if  unsuccessful,  but  does not define any
    -       error conditions.
    +       null  pointer if unsuccessful, but does not define any er-
    +       ror conditions.
     
            The SVr4 documentation describes the action of filter only
            in  the  vaguest  terms.   The description here is adapted
            from the XSI Curses standard (which erroneously  fails  to
            describe the disabling of cuu).
     
    +       The  strings returned by unctrl in this implementation are
    +       determined at compile time, showing C1 controls  from  the
    +       upper-128  codes with a `~' prefix rather than `^'.  Other
    +       implementations typically show both sets of control  char-
    +       acters  with  `^',  and may strip the parameter to 7 bits.
    +       This implementation uses 8 bits but does  not  modify  the
    +       string to reflect locale.
    +
    +       The  keyname function may return the names of user-defined
    +       string capabilities which are defined in the terminfo  en-
    +       try via the -x option of tic.
    +
     
     

    SEE ALSO

    @@ -153,7 +176,7 @@
     
     
     
    -                                                    curs_util(3x)
    +                                                          curs_util(3x)
     

    diff --git a/doc/html/man/curs_window.3x.html b/doc/html/man/curs_window.3x.html index fcd400c7..ddada875 100644 --- a/doc/html/man/curs_window.3x.html +++ b/doc/html/man/curs_window.3x.html @@ -1,7 +1,7 @@ @@ -40,15 +40,15 @@
     
    -curs_window(3x)                                   curs_window(3x)
    +curs_window(3x)                                         curs_window(3x)
     
     
     
     
     

    NAME

    -       newwin,  delwin,  mvwin, subwin, derwin, mvderwin, dupwin,
    -       wsyncup, syncok, wcursyncup,  wsyncdown  -  create  curses
    +       newwin, delwin, mvwin, subwin, derwin, mvderwin, dupwin,
    +       wsyncup, syncok, wcursyncup, wsyncdown - create curses
            windows
     
     
    @@ -81,9 +81,9 @@
            to  LINES - begin_y and COLS - begin_x.  A new full-screen
            window is created by calling newwin(0,0,0,0).
     
    -       Calling delwin deletes the named window, freeing all  mem-
    -       ory  associated  with  it  (it does not actually erase the
    -       window's screen image).  Subwindows must be deleted before
    +       Calling delwin deletes the named window, freeing all memo-
    +       ry associated with it (it does not actually erase the win-
    +       dow's screen image).  Subwindows must  be  deleted  before
            the main window can be deleted.
     
            Calling mvwin moves the window so that the upper left-hand
    @@ -108,10 +108,10 @@
            dow orig rather than the screen.  There is  no  difference
            between the subwindows and the derived windows.
     
    -       Calling  mvderwin  moves  a  derived window (or subwindow)
    -       inside its parent window.  The screen-relative  parameters
    -       of  the  window  are not changed.  This routine is used to
    -       display different parts of the parent window at  the  same
    +       Calling mvderwin moves a derived window (or subwindow) in-
    +       side its parent window.  The screen-relative parameters of
    +       the  window are not changed.  This routine is used to dis-
    +       play different parts of the  parent  window  at  the  same
            physical position on the screen.
     
            Calling  dupwin  creates  an exact duplicate of the window
    @@ -119,8 +119,8 @@
     
            Calling wsyncup touches all locations in ancestors of  win
            that  are changed in win.  If syncok is called with second
    -       argument TRUE then wsyncup is called  automatically  when-
    -       ever there is a change in the window.
    +       argument TRUE then wsyncup is called automatically whenev-
    +       er there is a change in the window.
     
            The  wsyncdown  routine  touches each location in win that
            has been touched in any of  its  ancestor  windows.   This
    @@ -134,19 +134,44 @@
     
     

    RETURN VALUE

    -       Routines that return an integer  return  the  integer  ERR
    -       upon failure and OK (SVr4 only specifies "an integer value
    +       Routines that return an integer return the integer ERR up-
    +       on  failure  and OK (SVr4 only specifies "an integer value
            other than ERR") upon successful completion.
     
    -       delwin returns the integer ERR upon failure  and  OK  upon
    -       successful completion.
    -
            Routines that return pointers return NULL on error.
     
    +       X/Open defines no error conditions.  In  this  implementa-
    +       tion
    +
    +              delwin
    +                   returns  an  error  if  the  window pointer is
    +                   null, or if the window is the parent of anoth-
    +                   er window.
    +
    +                   This  implementation  also maintains a list of
    +                   windows, and checks that the pointer passed to
    +                   delwin  is  one  that it created, returning an
    +                   error if it was not..
    +
    +              mvderwin
    +                   returns an error  if  the  window  pointer  is
    +                   null,  or  if some part of the window would be
    +                   placed off-screen.
    +
    +              mvwin
    +                   returns an error  if  the  window  pointer  is
    +                   null,  or if the window is really a pad, or if
    +                   some part of the window would be  placed  off-
    +                   screen.
    +
    +              syncok
    +                   returns  an  error  if  the  window pointer is
    +                   null.
    +
     
     

    NOTES

    -       If  many small changes are made to the window, the wsyncup
    +       If many small changes are made to the window, the  wsyncup
            option could degrade performance.
     
            Note that syncok may be a macro.
    @@ -154,22 +179,22 @@
     
     

    BUGS

    -       The subwindow functions (subwin, derwin,  mvderwin,  wsyn-
    -       cup,  wsyncdown,  wcursyncup,  syncok)  are  flaky, incom-
    -       pletely implemented, and not well tested.
    +       The  subwindow  functions (subwin, derwin, mvderwin, wsyn-
    +       cup, wsyncdown, wcursyncup, syncok) are flaky, incomplete-
    +       ly implemented, and not well tested.
     
    -       The System V curses documentation is  very  unclear  about
    +       The  System  V  curses documentation is very unclear about
            what wsyncup and wsyncdown actually do.  It seems to imply
    -       that they are only supposed to touch exactly  those  lines
    +       that  they  are only supposed to touch exactly those lines
            that are affected by ancestor changes.  The language here,
    -       and the behavior of the  curses  implementation,  is  pat-
    -       terned  on the XPG4 curses standard.  The weaker XPG4 spec
    +       and  the  behavior  of  the curses implementation, is pat-
    +       terned on the XPG4 curses standard.  The weaker XPG4  spec
            may result in slower updates.
     
     
     

    PORTABILITY

    -       The XSI Curses standard, Issue  4  describes  these  func-
    +       The  XSI  Curses  standard,  Issue 4 describes these func-
            tions.
     
     
    @@ -179,7 +204,7 @@
     
     
     
    -                                                  curs_window(3x)
    +                                                        curs_window(3x)
     

    diff --git a/doc/html/man/default_colors.3x.html b/doc/html/man/default_colors.3x.html index 019624cb..b4db8a5e 100644 --- a/doc/html/man/default_colors.3x.html +++ b/doc/html/man/default_colors.3x.html @@ -1,7 +1,7 @@ @@ -41,7 +41,7 @@
     
    -default_colors(3x)                             default_colors(3x)
    +default_colors(3x)                                   default_colors(3x)
     
     
     
    @@ -125,12 +125,35 @@
            accepts negative arguments to specify  default  foreground
            or background colors.
     
    +       The  use_default_colors()  function  was  added to support
    +       ded.  This is a full-screen application which uses  curses
    +       to  manage only part of the screen.  The bottom portion of
    +       the screen, which is of adjustable size, is left uncolored
    +       to  display the results from shell commands.  The top por-
    +       tion of the screen colors filenames using  a  scheme  like
    +       the  "color  ls" programs.  Attempting to manage the back-
    +       ground color of the screen for this application would give
    +       unsatisfactory  results  for  a  variety of reasons.  This
    +       extension was devised after noting that color  xterm  (and
    +       similar  programs)  provides a background color which does
    +       not necessarily correspond to  any  of  the  ANSI  colors.
    +       While  a special terminfo entry could be constructed using
    +       nine colors, there was no mechanism provided within curses
    +       to  account for the related orig_pair and back_color_erase
    +       capabilities.
    +
    +       The assume_default_colors() function was added to solve  a
    +       different  problem:  support  for applications which would
    +       use  environment  variables  and  other  configuration  to
    +       bypass  curses'  notion  of the terminal's default colors,
    +       setting specific values.
    +
     
     

    PORTABILITY

    -       These  routines  are  specific  to ncurses.  They were not
    -       supported on Version 7, BSD or System  V  implementations.
    -       It  is recommended that any code depending on them be con-
    +       These routines are specific to  ncurses.   They  were  not
    +       supported  on  Version 7, BSD or System V implementations.
    +       It is recommended that any code depending on them be  con-
            ditioned using NCURSES_VERSION.
     
     
    @@ -141,12 +164,12 @@
     
     

    AUTHOR

    -       Thomas Dickey (from an analysis of  the  requirements  for
    +       Thomas  Dickey  (from  an analysis of the requirements for
            color xterm for XFree86 3.1.2C, February 1996).
     
     
     
    -                                               default_colors(3x)
    +                                                     default_colors(3x)
     

    diff --git a/doc/html/man/define_key.3x.html b/doc/html/man/define_key.3x.html index c95817de..53aab98b 100644 --- a/doc/html/man/define_key.3x.html +++ b/doc/html/man/define_key.3x.html @@ -1,7 +1,7 @@ @@ -41,7 +41,7 @@
     
    -define_key(3x)                                     define_key(3x)
    +define_key(3x)                                           define_key(3x)
     
     
     
    @@ -88,7 +88,7 @@
     
     

    SEE ALSO

    -       keyok(3x).
    +       keyok(3x), key_defined(3x).
     
     
     
    @@ -97,7 +97,7 @@ - define_key(3x) + define_key(3x)
    diff --git a/doc/html/man/form.3x.html b/doc/html/man/form.3x.html index 320d2816..a7b1513f 100644 --- a/doc/html/man/form.3x.html +++ b/doc/html/man/form.3x.html @@ -41,7 +41,7 @@
     
    -form(3x)                                                 form(3x)
    +form(3x)                                                       form(3x)
     
     
     
    @@ -84,6 +84,7 @@
            The following table lists each form routine and  the  name
            of the manual page on which it is described.
     
    +
            curses Routine Name    Manual Page Name
            -------------------------------------------------
            current_field          form_page(3x)
    @@ -111,8 +112,8 @@
            form_driver            form_driver(3x)
            form_fields            form_field(3x)
            form_init              form_hook(3x)
    -       form_opts              form_opts(3x)
     
    +       form_opts              form_opts(3x)
            form_opts_off          form_opts(3x)
            form_opts_on           form_opts(3x)
            form_page              form_page(3x)
    @@ -234,7 +235,7 @@
     
     
     
    -                                                         form(3x)
    +                                                               form(3x)
     

    diff --git a/doc/html/man/form_cursor.3x.html b/doc/html/man/form_cursor.3x.html index ac989b00..1e5077b0 100644 --- a/doc/html/man/form_cursor.3x.html +++ b/doc/html/man/form_cursor.3x.html @@ -41,7 +41,7 @@
     
    -form_cursor(3x)                                   form_cursor(3x)
    +form_cursor(3x)                                         form_cursor(3x)
     
     
     
    @@ -107,7 +107,7 @@
     
     
     
    -                                                  form_cursor(3x)
    +                                                        form_cursor(3x)
     

    diff --git a/doc/html/man/form_data.3x.html b/doc/html/man/form_data.3x.html index a411eed4..88d24123 100644 --- a/doc/html/man/form_data.3x.html +++ b/doc/html/man/form_data.3x.html @@ -41,7 +41,7 @@
     
    -form_data(3x)                                       form_data(3x)
    +form_data(3x)                                             form_data(3x)
     
     
     
    @@ -93,7 +93,7 @@
     
     
     
    -                                                    form_data(3x)
    +                                                          form_data(3x)
     

    diff --git a/doc/html/man/form_driver.3x.html b/doc/html/man/form_driver.3x.html index f0d036f3..e3eaea93 100644 --- a/doc/html/man/form_driver.3x.html +++ b/doc/html/man/form_driver.3x.html @@ -40,7 +40,7 @@
     
    -form_driver(3x)                                   form_driver(3x)
    +form_driver(3x)                                         form_driver(3x)
     
     
     
    @@ -308,7 +308,7 @@
     
     
     
    -                                                  form_driver(3x)
    +                                                        form_driver(3x)
     

    diff --git a/doc/html/man/form_field.3x.html b/doc/html/man/form_field.3x.html index 7d41bae2..d8372ef1 100644 --- a/doc/html/man/form_field.3x.html +++ b/doc/html/man/form_field.3x.html @@ -41,7 +41,7 @@
     
    -form_field(3x)                                     form_field(3x)
    +form_field(3x)                                           form_field(3x)
     
     
     
    @@ -130,7 +130,7 @@
     
     
     
    -                                                   form_field(3x)
    +                                                         form_field(3x)
     

    diff --git a/doc/html/man/form_field_attributes.3x.html b/doc/html/man/form_field_attributes.3x.html index 8fc80e0c..f0b35acd 100644 --- a/doc/html/man/form_field_attributes.3x.html +++ b/doc/html/man/form_field_attributes.3x.html @@ -41,7 +41,7 @@
     
    -form_field_attributes(3x)               form_field_attributes(3x)
    +form_field_attributes(3x)                     form_field_attributes(3x)
     
     
     
    @@ -119,7 +119,7 @@
     
     
     
    -                                        form_field_attributes(3x)
    +                                              form_field_attributes(3x)
     

    diff --git a/doc/html/man/form_field_buffer.3x.html b/doc/html/man/form_field_buffer.3x.html index 7ba29ac3..1de81f1b 100644 --- a/doc/html/man/form_field_buffer.3x.html +++ b/doc/html/man/form_field_buffer.3x.html @@ -2,7 +2,7 @@ @@ -41,7 +41,7 @@
     
    -form_field_buffer(3x)                       form_field_buffer(3x)
    +form_field_buffer(3x)                             form_field_buffer(3x)
     
     
     
    @@ -78,7 +78,7 @@
            value out of the buffer and removes the leading and trail-
            ing spaces. Please note also, that  subsequent  operations
            on  the  form  will  probably  change  the  content of the
    -       buffer. So don't use it  for  long  term  storage  of  the
    +       buffer. So do not use it for  long  term  storage  of  the
            entered form data.
     
            The  function  set_field_status sets the associated status
    @@ -118,7 +118,13 @@
     

    NOTES

            The header file <form.h> automatically includes the header
    -       file <curses.h>.
    +       file
    +
    +       When  configured for wide-characters, field_buffer returns
    +       a pointer to temporary storage (allocated and freed by the
    +       library).   The  application  should not attempt to modify
    +       the  data.   It  will  be  freed  on  the  next  call   to
    +       field_buffer to return the same buffer.  <curses.h>.
     
     
     
    @@ -134,7 +140,7 @@ - form_field_buffer(3x) + form_field_buffer(3x)
    diff --git a/doc/html/man/form_field_info.3x.html b/doc/html/man/form_field_info.3x.html index 1d2c6b33..df8d1aac 100644 --- a/doc/html/man/form_field_info.3x.html +++ b/doc/html/man/form_field_info.3x.html @@ -2,7 +2,7 @@ @@ -41,7 +41,7 @@
     
    -form_field_info(3x)                           form_field_info(3x)
    +form_field_info(3x)                                 form_field_info(3x)
     
     
     
    @@ -71,8 +71,8 @@
            The function dynamic_field_info returns the actual size of
            the field, and its maximum possible size.   If  the  field
            has  no  size  limit,  the location addressed by the third
    -       argument will be set to 0.  (A field can be  made  dynamic
    -       by turning off the O_STATIC).
    +       argument will be set to 0.  A field can be made dynamic by
    +       turning off the O_STATIC option with field_opts_off.
     
     
     
    @@ -118,7 +118,7 @@ - form_field_info(3x) + form_field_info(3x)
    diff --git a/doc/html/man/form_field_just.3x.html b/doc/html/man/form_field_just.3x.html index 08444ab6..6912809b 100644 --- a/doc/html/man/form_field_just.3x.html +++ b/doc/html/man/form_field_just.3x.html @@ -41,7 +41,7 @@
     
    -form_field_just(3x)                           form_field_just(3x)
    +form_field_just(3x)                                 form_field_just(3x)
     
     
     
    @@ -109,7 +109,7 @@
     
     
     
    -                                              form_field_just(3x)
    +                                                    form_field_just(3x)
     

    diff --git a/doc/html/man/form_field_new.3x.html b/doc/html/man/form_field_new.3x.html index 4c8e1d48..911c1071 100644 --- a/doc/html/man/form_field_new.3x.html +++ b/doc/html/man/form_field_new.3x.html @@ -41,7 +41,7 @@
     
    -form_field_new(3x)                             form_field_new(3x)
    +form_field_new(3x)                                   form_field_new(3x)
     
     
     
    @@ -130,7 +130,7 @@
     
     
     
    -                                               form_field_new(3x)
    +                                                     form_field_new(3x)
     

    diff --git a/doc/html/man/form_field_opts.3x.html b/doc/html/man/form_field_opts.3x.html index 3eae4302..c574c2bc 100644 --- a/doc/html/man/form_field_opts.3x.html +++ b/doc/html/man/form_field_opts.3x.html @@ -2,7 +2,7 @@ @@ -41,7 +41,7 @@
     
    -form_field_opts(3x)                           form_field_opts(3x)
    +form_field_opts(3x)                                 form_field_opts(3x)
     
     
     
    @@ -94,7 +94,7 @@
                 The field can be edited.
     
            O_WRAP
    -            Words that don't fit on a line  are  wrapped  to  the
    +            Words that do not fit on a line are  wrapped  to  the
                 next line.  Words are blank-separated.
     
            O_BLANK
    @@ -108,7 +108,8 @@
                 Allow a blank field.
     
            O_STATIC
    -            Field buffers are fixed to field's original size.
    +            Field buffers are fixed  to  field's  original  size.
    +            Turn this option off to create a dynamic field.
     
            O_PASSOK
                 Validate field only if modified by user.
    @@ -116,7 +117,7 @@
     
     

    RETURN VALUE

    -       Except for field_opts, each routine  returns  one  of  the
    +       Except  for  field_opts,  each  routine returns one of the
            following:
     
            E_OK The routine succeeded.
    @@ -139,18 +140,18 @@
     
     

    PORTABILITY

    -       These routines emulate the System V forms  library.   They
    +       These  routines  emulate the System V forms library.  They
            were not supported on Version 7 or BSD versions.
     
     
     

    AUTHORS

    -       Juergen  Pfeifer.   Manual  pages  and  adaptation for new
    +       Juergen Pfeifer.  Manual  pages  and  adaptation  for  new
            curses by Eric S. Raymond.
     
     
     
    -                                              form_field_opts(3x)
    +                                                    form_field_opts(3x)
     

    diff --git a/doc/html/man/form_field_userptr.3x.html b/doc/html/man/form_field_userptr.3x.html index 0ec2c5ef..417dd456 100644 --- a/doc/html/man/form_field_userptr.3x.html +++ b/doc/html/man/form_field_userptr.3x.html @@ -41,7 +41,7 @@
     
    -form_field_userptr(3x)                     form_field_userptr(3x)
    +form_field_userptr(3x)                           form_field_userptr(3x)
     
     
     
    @@ -104,7 +104,7 @@
     
     
     
    -                                           form_field_userptr(3x)
    +                                                 form_field_userptr(3x)
     

    diff --git a/doc/html/man/form_field_validation.3x.html b/doc/html/man/form_field_validation.3x.html index 6fe3b475..2b7edd17 100644 --- a/doc/html/man/form_field_validation.3x.html +++ b/doc/html/man/form_field_validation.3x.html @@ -40,7 +40,7 @@
     
    -form_field_validation(3x)               form_field_validation(3x)
    +form_field_validation(3x)                     form_field_validation(3x)
     
     
     
    @@ -185,7 +185,7 @@
     
     
     
    -                                        form_field_validation(3x)
    +                                              form_field_validation(3x)
     

    diff --git a/doc/html/man/form_fieldtype.3x.html b/doc/html/man/form_fieldtype.3x.html index fc220281..e6fc4826 100644 --- a/doc/html/man/form_fieldtype.3x.html +++ b/doc/html/man/form_fieldtype.3x.html @@ -41,7 +41,7 @@
     
    -form_fieldtype(3x)                             form_fieldtype(3x)
    +form_fieldtype(3x)                                   form_fieldtype(3x)
     
     
     
    @@ -166,7 +166,7 @@
     
     
     
    -                                               form_fieldtype(3x)
    +                                                     form_fieldtype(3x)
     

    diff --git a/doc/html/man/form_hook.3x.html b/doc/html/man/form_hook.3x.html index bd092a0c..0697169a 100644 --- a/doc/html/man/form_hook.3x.html +++ b/doc/html/man/form_hook.3x.html @@ -41,7 +41,7 @@
     
    -form_hook(3x)                                       form_hook(3x)
    +form_hook(3x)                                             form_hook(3x)
     
     
     
    @@ -127,7 +127,7 @@
     
     
     
    -                                                    form_hook(3x)
    +                                                          form_hook(3x)
     

    diff --git a/doc/html/man/form_new.3x.html b/doc/html/man/form_new.3x.html index 9b755eb3..1cdf94bf 100644 --- a/doc/html/man/form_new.3x.html +++ b/doc/html/man/form_new.3x.html @@ -41,7 +41,7 @@
     
    -form_new(3x)                                         form_new(3x)
    +form_new(3x)                                               form_new(3x)
     
     
     
    @@ -111,7 +111,7 @@
     
     
     
    -                                                     form_new(3x)
    +                                                           form_new(3x)
     

    diff --git a/doc/html/man/form_new_page.3x.html b/doc/html/man/form_new_page.3x.html index ca031b98..b4ba0ff9 100644 --- a/doc/html/man/form_new_page.3x.html +++ b/doc/html/man/form_new_page.3x.html @@ -41,7 +41,7 @@
     
    -form_new_page(3x)                               form_new_page(3x)
    +form_new_page(3x)                                     form_new_page(3x)
     
     
     
    @@ -108,7 +108,7 @@
     
     
     
    -                                                form_new_page(3x)
    +                                                      form_new_page(3x)
     

    diff --git a/doc/html/man/form_opts.3x.html b/doc/html/man/form_opts.3x.html index 03a462dc..dfe5fc3e 100644 --- a/doc/html/man/form_opts.3x.html +++ b/doc/html/man/form_opts.3x.html @@ -41,7 +41,7 @@
     
    -form_opts(3x)                                       form_opts(3x)
    +form_opts(3x)                                             form_opts(3x)
     
     
     
    @@ -123,7 +123,7 @@
     
     
     
    -                                                    form_opts(3x)
    +                                                          form_opts(3x)
     

    diff --git a/doc/html/man/form_page.3x.html b/doc/html/man/form_page.3x.html index 5409ca8f..dcb77693 100644 --- a/doc/html/man/form_page.3x.html +++ b/doc/html/man/form_page.3x.html @@ -41,7 +41,7 @@
     
    -form_page(3x)                                       form_page(3x)
    +form_page(3x)                                             form_page(3x)
     
     
     
    @@ -128,7 +128,7 @@
     
     
     
    -                                                    form_page(3x)
    +                                                          form_page(3x)
     

    diff --git a/doc/html/man/form_post.3x.html b/doc/html/man/form_post.3x.html index 379e4a8e..bd91cf90 100644 --- a/doc/html/man/form_post.3x.html +++ b/doc/html/man/form_post.3x.html @@ -41,7 +41,7 @@
     
    -form_post(3x)                                       form_post(3x)
    +form_post(3x)                                             form_post(3x)
     
     
     
    @@ -125,7 +125,7 @@
     
     
     
    -                                                    form_post(3x)
    +                                                          form_post(3x)
     

    diff --git a/doc/html/man/form_requestname.3x.html b/doc/html/man/form_requestname.3x.html index 6aeb907c..7d28e4ff 100644 --- a/doc/html/man/form_requestname.3x.html +++ b/doc/html/man/form_requestname.3x.html @@ -41,7 +41,7 @@
     
    -form_requestname(3x)                         form_requestname(3x)
    +form_requestname(3x)                               form_requestname(3x)
     
     
     
    @@ -62,8 +62,8 @@
     

    DESCRIPTION

            The  function form_request_name returns the printable name
            of a form request code.
    -       The function form_request_by_name searches  in  the  name-
    -       table  for  a  request with the given name and returns its
    +       The function form_request_by_name searches in the name-ta-
    +       ble  for  a  request  with  the given name and returns its
            request code. Otherwise E_NO_MATCH is returned.
     
     
    @@ -100,7 +100,7 @@
     
     
     
    -                                             form_requestname(3x)
    +                                                   form_requestname(3x)
     

    diff --git a/doc/html/man/form_userptr.3x.html b/doc/html/man/form_userptr.3x.html index 5f6e0b3d..503275e7 100644 --- a/doc/html/man/form_userptr.3x.html +++ b/doc/html/man/form_userptr.3x.html @@ -41,7 +41,7 @@
     
    -form_userptr(3x)                                 form_userptr(3x)
    +form_userptr(3x)                                       form_userptr(3x)
     
     
     
    @@ -104,7 +104,7 @@
     
     
     
    -                                                 form_userptr(3x)
    +                                                       form_userptr(3x)
     

    diff --git a/doc/html/man/form_win.3x.html b/doc/html/man/form_win.3x.html index 8cb1dcda..8967b91c 100644 --- a/doc/html/man/form_win.3x.html +++ b/doc/html/man/form_win.3x.html @@ -41,7 +41,7 @@
     
    -form_win(3x)                                         form_win(3x)
    +form_win(3x)                                               form_win(3x)
     
     
     
    @@ -128,7 +128,7 @@
     
     
     
    -                                                     form_win(3x)
    +                                                           form_win(3x)
     

    diff --git a/doc/html/man/index.html b/doc/html/man/index.html new file mode 100644 index 00000000..40cbd596 --- /dev/null +++ b/doc/html/man/index.html @@ -0,0 +1,40 @@ + + + + +NCURSES - Manual Pages + + + + +
    + + + diff --git a/doc/html/man/infocmp.1m.html b/doc/html/man/infocmp.1m.html index 26deb7e3..34a0be10 100644 --- a/doc/html/man/infocmp.1m.html +++ b/doc/html/man/infocmp.1m.html @@ -2,7 +2,7 @@ @@ -41,7 +41,7 @@
     
    -infocmp(1m)                                           infocmp(1m)
    +infocmp(1m)                                                 infocmp(1m)
     
     
     
    @@ -53,7 +53,7 @@
     
     

    SYNOPSIS

    -       infocmp [-1CEFGILTVcdegilnpqrtu]
    +       infocmp [-1CEFGILTVcdegilnpqrtux]
                  [-v n] [-s d| i| l| c] [-R subset]
                  [-w width] [-A directory] [-B directory]
                  [termname...]
    @@ -103,6 +103,7 @@
            The -I, -L, and -C options will produce a  source  listing
            for each terminal named.
     
    +
           -I   use the terminfo names
           -L   use the long C variable name listed in <term.h>
           -C   use the termcap names
    @@ -144,6 +145,7 @@
            equivalents, and some terminal types which  commonly  have
            such sequences, are:
     
    +
          terminfo                    termcap   Representative Terminals
          ---------------------------------------------------------------
          %p1%c                       %.        adm
    @@ -280,6 +282,7 @@
                 tions.  Here  is  a  list  of  the  DEC/ANSI  special
                 sequences recognized:
     
    +
                       Action        Meaning
                       -----------------------------------------
                       RIS           full reset
    @@ -288,6 +291,9 @@
                       LL            home-down
                       RSR           reset scroll region
     
    +                  DECSTR        soft reset (VT320)
    +                  S7C1T         7-bit controls (VT220)
    +
                       ISO DEC G0    enable DEC graphics for G0
                       ISO UK G0     enable UK chars for G0
                       ISO US G0     enable US chars for G0
    @@ -299,8 +305,14 @@
                       DECPNM        normal keypad mode
                       DECANSI       enter ANSI mode
     
    +                  ECMA[+-]AM    keyboard action mode
    +                  ECMA[+-]IRM   insert replace mode
    +                  ECMA[+-]SRM   send receive mode
    +                  ECMA[+-]LNM   linefeed mode
    +
                       DEC[+-]CKM    application cursor keys
                       DEC[+-]ANM    set VT52 mode
    +
                       DEC[+-]COLM   132-column mode
                       DEC[+-]SCLM   smooth scroll
                       DEC[+-]SCNM   reverse video mode
    @@ -376,6 +388,10 @@
            -w width
                 changes the output to width characters.
     
    +       -x   print   information  for  user-defined  capabilities.
    +            These are extensions to the terminfo repertoire which
    +            can be loaded using the -x option of tic.
    +
     
     

    FILES

    @@ -412,7 +428,7 @@
     
     
     
    -                                                      infocmp(1m)
    +                                                            infocmp(1m)
     

    diff --git a/doc/html/man/infotocap.1m.html b/doc/html/man/infotocap.1m.html index 2bb2f8b4..2eb151a0 100644 --- a/doc/html/man/infotocap.1m.html +++ b/doc/html/man/infotocap.1m.html @@ -2,7 +2,7 @@ @@ -41,7 +41,7 @@
     
    -infotocap(1m)                                       infotocap(1m)
    +infotocap(1m)                                             infotocap(1m)
     
     
     
    @@ -95,7 +95,7 @@
     
     
     
    -                                                    infotocap(1m)
    +                                                          infotocap(1m)
     

    diff --git a/doc/html/man/key_defined.3x.html b/doc/html/man/key_defined.3x.html index bed92903..3bd0d772 100644 --- a/doc/html/man/key_defined.3x.html +++ b/doc/html/man/key_defined.3x.html @@ -1,7 +1,7 @@ @@ -41,14 +41,14 @@
     
    -key_defined(3x)                                   key_defined(3x)
    +key_defined(3x)                                         key_defined(3x)
     
     
     
     
     

    NAME

    -       define_key - define a keycode
    +       key_defined - check if a keycode is defined
     
     
     
    @@ -92,7 +92,7 @@ - key_defined(3x) + key_defined(3x)

    diff --git a/doc/html/man/keybound.3x.html b/doc/html/man/keybound.3x.html index 667bdf84..5b584482 100644 --- a/doc/html/man/keybound.3x.html +++ b/doc/html/man/keybound.3x.html @@ -41,7 +41,7 @@
     
    -keyok(3x)                                               keyok(3x)
    +keyok(3x)                                                     keyok(3x)
     
     
     
    @@ -94,7 +94,7 @@
     
     
     
    -                                                        keyok(3x)
    +                                                              keyok(3x)
     

    diff --git a/doc/html/man/keyok.3x.html b/doc/html/man/keyok.3x.html index 0213a566..4664220d 100644 --- a/doc/html/man/keyok.3x.html +++ b/doc/html/man/keyok.3x.html @@ -41,7 +41,7 @@
     
    -keyok(3x)                                               keyok(3x)
    +keyok(3x)                                                     keyok(3x)
     
     
     
    @@ -94,7 +94,7 @@
     
     
     
    -                                                        keyok(3x)
    +                                                              keyok(3x)
     

    diff --git a/doc/html/man/menu.3x.html b/doc/html/man/menu.3x.html index fc558ef7..332077c6 100644 --- a/doc/html/man/menu.3x.html +++ b/doc/html/man/menu.3x.html @@ -41,7 +41,7 @@
     
    -menu(3x)                                                 menu(3x)
    +menu(3x)                                                       menu(3x)
     
     
     
    @@ -84,6 +84,7 @@
            The following table lists each menu routine and  the  name
            of the manual page on which it is described.
     
    +
            curses Routine Name    Manual Page Name
            --------------------------------------------
            current_item           mitem_current(3x)
    @@ -111,8 +112,8 @@
            menu_mark              menu_mark(3x)
            menu_opts              menu_opts(3x)
            menu_opts_off          menu_opts(3x)
    -       menu_opts_on           menu_opts(3x)
     
    +       menu_opts_on           menu_opts(3x)
            menu_pad               menu_attributes(3x)
            menu_pattern           menu_pattern(3x)
            menu_request_by_name   menu_requestname(3x)
    @@ -227,7 +228,7 @@
     
     
     
    -                                                         menu(3x)
    +                                                               menu(3x)
     

    diff --git a/doc/html/man/menu_attributes.3x.html b/doc/html/man/menu_attributes.3x.html index 702fdc4a..109051e2 100644 --- a/doc/html/man/menu_attributes.3x.html +++ b/doc/html/man/menu_attributes.3x.html @@ -41,7 +41,7 @@
     
    -menu_attributes(3x)                           menu_attributes(3x)
    +menu_attributes(3x)                                 menu_attributes(3x)
     
     
     
    @@ -128,7 +128,7 @@
     
     
     
    -                                              menu_attributes(3x)
    +                                                    menu_attributes(3x)
     

    diff --git a/doc/html/man/menu_cursor.3x.html b/doc/html/man/menu_cursor.3x.html index 9e08a867..f88c0094 100644 --- a/doc/html/man/menu_cursor.3x.html +++ b/doc/html/man/menu_cursor.3x.html @@ -41,7 +41,7 @@
     
    -menu_cursor(3x)                                   menu_cursor(3x)
    +menu_cursor(3x)                                         menu_cursor(3x)
     
     
     
    @@ -106,7 +106,7 @@
     
     
     
    -                                                  menu_cursor(3x)
    +                                                        menu_cursor(3x)
     

    diff --git a/doc/html/man/menu_driver.3x.html b/doc/html/man/menu_driver.3x.html index fa65d976..a527d179 100644 --- a/doc/html/man/menu_driver.3x.html +++ b/doc/html/man/menu_driver.3x.html @@ -40,7 +40,7 @@
     
    -menu_driver(3x)                                   menu_driver(3x)
    +menu_driver(3x)                                         menu_driver(3x)
     
     
     
    @@ -213,7 +213,7 @@
     
     
     
    -                                                  menu_driver(3x)
    +                                                        menu_driver(3x)
     

    diff --git a/doc/html/man/menu_format.3x.html b/doc/html/man/menu_format.3x.html index b9d1887b..2a7974b8 100644 --- a/doc/html/man/menu_format.3x.html +++ b/doc/html/man/menu_format.3x.html @@ -41,7 +41,7 @@
     
    -menu_format(3x)                                   menu_format(3x)
    +menu_format(3x)                                         menu_format(3x)
     
     
     
    @@ -119,7 +119,7 @@
     
     
     
    -                                                  menu_format(3x)
    +                                                        menu_format(3x)
     

    diff --git a/doc/html/man/menu_hook.3x.html b/doc/html/man/menu_hook.3x.html index ab82cd75..0e49820a 100644 --- a/doc/html/man/menu_hook.3x.html +++ b/doc/html/man/menu_hook.3x.html @@ -41,7 +41,7 @@
     
    -menu_hook(3x)                                       menu_hook(3x)
    +menu_hook(3x)                                             menu_hook(3x)
     
     
     
    @@ -127,7 +127,7 @@
     
     
     
    -                                                    menu_hook(3x)
    +                                                          menu_hook(3x)
     

    diff --git a/doc/html/man/menu_items.3x.html b/doc/html/man/menu_items.3x.html index 701c58af..8e4f364b 100644 --- a/doc/html/man/menu_items.3x.html +++ b/doc/html/man/menu_items.3x.html @@ -41,7 +41,7 @@
     
    -menu_items(3x)                                     menu_items(3x)
    +menu_items(3x)                                           menu_items(3x)
     
     
     
    @@ -126,6 +126,7 @@
     
     
     
    +                                                         menu_items(3x)
     

    diff --git a/doc/html/man/menu_mark.3x.html b/doc/html/man/menu_mark.3x.html index 25388e44..d84303a6 100644 --- a/doc/html/man/menu_mark.3x.html +++ b/doc/html/man/menu_mark.3x.html @@ -41,7 +41,7 @@
     
    -menu_mark(3x)                                       menu_mark(3x)
    +menu_mark(3x)                                             menu_mark(3x)
     
     
     
    @@ -117,7 +117,7 @@
     
     
     
    -                                                    menu_mark(3x)
    +                                                          menu_mark(3x)
     

    diff --git a/doc/html/man/menu_new.3x.html b/doc/html/man/menu_new.3x.html index 7fc2e609..8ec4cf51 100644 --- a/doc/html/man/menu_new.3x.html +++ b/doc/html/man/menu_new.3x.html @@ -41,7 +41,7 @@
     
    -menu_new(3x)                                         menu_new(3x)
    +menu_new(3x)                                               menu_new(3x)
     
     
     
    @@ -111,7 +111,7 @@
     
     
     
    -                                                     menu_new(3x)
    +                                                           menu_new(3x)
     

    diff --git a/doc/html/man/menu_opts.3x.html b/doc/html/man/menu_opts.3x.html index 72666717..0f903c26 100644 --- a/doc/html/man/menu_opts.3x.html +++ b/doc/html/man/menu_opts.3x.html @@ -41,7 +41,7 @@
     
    -menu_opts(3x)                                       menu_opts(3x)
    +menu_opts(3x)                                             menu_opts(3x)
     
     
     
    @@ -137,7 +137,7 @@
     
     
     
    -                                                    menu_opts(3x)
    +                                                          menu_opts(3x)
     

    diff --git a/doc/html/man/menu_pattern.3x.html b/doc/html/man/menu_pattern.3x.html index 84a9de8b..431787c9 100644 --- a/doc/html/man/menu_pattern.3x.html +++ b/doc/html/man/menu_pattern.3x.html @@ -40,7 +40,7 @@
     
    -menu_pattern(3x)                                 menu_pattern(3x)
    +menu_pattern(3x)                                       menu_pattern(3x)
     
     
     
    @@ -116,7 +116,7 @@
     
     
     
    -                                                 menu_pattern(3x)
    +                                                       menu_pattern(3x)
     

    diff --git a/doc/html/man/menu_post.3x.html b/doc/html/man/menu_post.3x.html index 26086cd3..63241ba4 100644 --- a/doc/html/man/menu_post.3x.html +++ b/doc/html/man/menu_post.3x.html @@ -41,7 +41,7 @@
     
    -menu_post(3x)                                       menu_post(3x)
    +menu_post(3x)                                             menu_post(3x)
     
     
     
    @@ -127,7 +127,7 @@
     
     
     
    -                                                    menu_post(3x)
    +                                                          menu_post(3x)
     

    diff --git a/doc/html/man/menu_requestname.3x.html b/doc/html/man/menu_requestname.3x.html index c2f16b3f..93c9e9f1 100644 --- a/doc/html/man/menu_requestname.3x.html +++ b/doc/html/man/menu_requestname.3x.html @@ -41,7 +41,7 @@
     
    -menu_requestname(3x)                         menu_requestname(3x)
    +menu_requestname(3x)                               menu_requestname(3x)
     
     
     
    @@ -62,8 +62,8 @@
     

    DESCRIPTION

            The  function menu_request_name returns the printable name
            of a menu request code.
    -       The function menu_request_by_name searches  in  the  name-
    -       table  for  a  request with the given name and returns its
    +       The function menu_request_by_name searches in the name-ta-
    +       ble  for  a  request  with  the given name and returns its
            request code. Otherwise E_NO_MATCH is returned.
     
     
    @@ -100,7 +100,7 @@
     
     
     
    -                                             menu_requestname(3x)
    +                                                   menu_requestname(3x)
     

    diff --git a/doc/html/man/menu_spacing.3x.html b/doc/html/man/menu_spacing.3x.html index 2ad714d4..736e95cf 100644 --- a/doc/html/man/menu_spacing.3x.html +++ b/doc/html/man/menu_spacing.3x.html @@ -2,7 +2,7 @@ @@ -41,7 +41,7 @@
     
    -menu_spacing(3x)                                 menu_spacing(3x)
    +menu_spacing(3x)                                       menu_spacing(3x)
     
     
     
    @@ -73,7 +73,7 @@
            the  middle  of  this  spacing area the pad character. The
            remaining parts are filled with spaces.  spc_rows controls
            the  number of rows that are used for an item. It must not
    -       be larger than 3. The menu system inserts then blank lines
    +       be larger than 3. The menu system inserts the blank  lines
            between  item rows, these lines will contain the pad char-
            acter in the appropriate positions.  spc_columns  controls
            the number of blanks between columns of items. It must not
    @@ -118,7 +118,7 @@
     
     
     
    -                                                 menu_spacing(3x)
    +                                                       menu_spacing(3x)
     

    diff --git a/doc/html/man/menu_userptr.3x.html b/doc/html/man/menu_userptr.3x.html index 3f0b8bcf..9a51193f 100644 --- a/doc/html/man/menu_userptr.3x.html +++ b/doc/html/man/menu_userptr.3x.html @@ -41,7 +41,7 @@
     
    -menu_userptr(3x)                                 menu_userptr(3x)
    +menu_userptr(3x)                                       menu_userptr(3x)
     
     
     
    @@ -104,7 +104,7 @@
     
     
     
    -                                                 menu_userptr(3x)
    +                                                       menu_userptr(3x)
     

    diff --git a/doc/html/man/menu_win.3x.html b/doc/html/man/menu_win.3x.html index f5930504..f5bcb7c6 100644 --- a/doc/html/man/menu_win.3x.html +++ b/doc/html/man/menu_win.3x.html @@ -41,7 +41,7 @@
     
    -menu_win(3x)                                         menu_win(3x)
    +menu_win(3x)                                               menu_win(3x)
     
     
     
    @@ -128,7 +128,7 @@
     
     
     
    -                                                     menu_win(3x)
    +                                                           menu_win(3x)
     

    diff --git a/doc/html/man/mitem_current.3x.html b/doc/html/man/mitem_current.3x.html index 7a8c22fe..fcaf574c 100644 --- a/doc/html/man/mitem_current.3x.html +++ b/doc/html/man/mitem_current.3x.html @@ -41,7 +41,7 @@
     
    -mitem_current(3x)                               mitem_current(3x)
    +mitem_current(3x)                                     mitem_current(3x)
     
     
     
    @@ -134,7 +134,7 @@
     
     
     
    -                                                mitem_current(3x)
    +                                                      mitem_current(3x)
     

    diff --git a/doc/html/man/mitem_name.3x.html b/doc/html/man/mitem_name.3x.html index aca34ad3..880e068f 100644 --- a/doc/html/man/mitem_name.3x.html +++ b/doc/html/man/mitem_name.3x.html @@ -41,7 +41,7 @@
     
    -mitem_name(3x)                                     mitem_name(3x)
    +mitem_name(3x)                                           mitem_name(3x)
     
     
     
    @@ -95,7 +95,7 @@
     
     
     
    -                                                   mitem_name(3x)
    +                                                         mitem_name(3x)
     

    diff --git a/doc/html/man/mitem_new.3x.html b/doc/html/man/mitem_new.3x.html index 40f6e930..d36dd3db 100644 --- a/doc/html/man/mitem_new.3x.html +++ b/doc/html/man/mitem_new.3x.html @@ -41,7 +41,7 @@
     
    -mitem_new(3x)                                       mitem_new(3x)
    +mitem_new(3x)                                             mitem_new(3x)
     
     
     
    @@ -115,7 +115,7 @@
     
     
     
    -                                                    mitem_new(3x)
    +                                                          mitem_new(3x)
     

    diff --git a/doc/html/man/mitem_opts.3x.html b/doc/html/man/mitem_opts.3x.html index 75ca07d9..f35b7693 100644 --- a/doc/html/man/mitem_opts.3x.html +++ b/doc/html/man/mitem_opts.3x.html @@ -41,7 +41,7 @@
     
    -mitem_opts(3x)                                     mitem_opts(3x)
    +mitem_opts(3x)                                           mitem_opts(3x)
     
     
     
    @@ -115,7 +115,7 @@
     
     
     
    -                                                   mitem_opts(3x)
    +                                                         mitem_opts(3x)
     

    diff --git a/doc/html/man/mitem_userptr.3x.html b/doc/html/man/mitem_userptr.3x.html index 23574613..6f7b7f6d 100644 --- a/doc/html/man/mitem_userptr.3x.html +++ b/doc/html/man/mitem_userptr.3x.html @@ -41,7 +41,7 @@
     
    -mitem_userptr(3x)                               mitem_userptr(3x)
    +mitem_userptr(3x)                                     mitem_userptr(3x)
     
     
     
    @@ -104,7 +104,7 @@
     
     
     
    -                                                mitem_userptr(3x)
    +                                                      mitem_userptr(3x)
     

    diff --git a/doc/html/man/mitem_value.3x.html b/doc/html/man/mitem_value.3x.html index e04780d0..c2246a0a 100644 --- a/doc/html/man/mitem_value.3x.html +++ b/doc/html/man/mitem_value.3x.html @@ -40,7 +40,7 @@
     
    -mitem_value(3x)                                   mitem_value(3x)
    +mitem_value(3x)                                         mitem_value(3x)
     
     
     
    @@ -106,7 +106,7 @@
     
     
     
    -                                                  mitem_value(3x)
    +                                                        mitem_value(3x)
     

    diff --git a/doc/html/man/mitem_visible.3x.html b/doc/html/man/mitem_visible.3x.html index 19a1d854..8d3d0165 100644 --- a/doc/html/man/mitem_visible.3x.html +++ b/doc/html/man/mitem_visible.3x.html @@ -41,7 +41,7 @@
     
    -mitem_visible(3x)                               mitem_visible(3x)
    +mitem_visible(3x)                                     mitem_visible(3x)
     
     
     
    @@ -89,7 +89,7 @@
     
     
     
    -                                                mitem_visible(3x)
    +                                                      mitem_visible(3x)
     

    diff --git a/doc/html/man/ncurses.3x.html b/doc/html/man/ncurses.3x.html index 04905297..27b9d3ef 100644 --- a/doc/html/man/ncurses.3x.html +++ b/doc/html/man/ncurses.3x.html @@ -2,7 +2,7 @@ @@ -41,7 +41,7 @@
     
    -ncurses(3x)                                           ncurses(3x)
    +ncurses(3x)                                                 ncurses(3x)
     
     
     
    @@ -68,31 +68,32 @@
            System V Release 4 UNIX, and the XPG4 curses standard (XSI
            curses)  but the ncurses library is freely redistributable
            in source form.  Differences from the SVr4 curses are sum-
    -       marized  under  the EXTENSIONS and BUGS sections below and
    -       described in detail in the EXTENSIONS and BUGS sections of
    -       individual man pages.
    -
    -       A  program  using  these  routines must be linked with the
    -       -lncurses option, or (if it has been generated)  with  the
    -       debugging  library  -lncurses_g.   (Your system integrator
    -       may also have installed these libraries  under  the  names
    +       marized  under  the  EXTENSIONS  and  PORTABILITY sections
    +       below and described in detail  in  the  respective  EXTEN-
    +       SIONS,  PORTABILITY  and  BUGS  sections of individual man
    +       pages.
    +
    +       A program using these routines must  be  linked  with  the
    +       -lncurses  option,  or (if it has been generated) with the
    +       debugging library -lncurses_g.   (Your  system  integrator
    +       may  also  have  installed these libraries under the names
            -lcurses and -lcurses_g.)  The ncurses_g library generates
            trace logs (in a file called 'trace' in the current direc-
            tory) that describe curses actions.
     
    -       The  ncurses  package supports: overall screen, window and
    +       The ncurses package supports: overall screen,  window  and
            pad manipulation; output to windows and pads; reading ter-
    -       minal  input;  control  over terminal and curses input and
    -       output options; environment query routines; color  manipu-
    +       minal input; control over terminal and  curses  input  and
    +       output  options; environment query routines; color manipu-
            lation; use of soft label keys; terminfo capabilities; and
            access to low-level terminal-manipulation routines.
     
            To initialize the routines, the routine initscr or newterm
    -       must  be called before any of the other routines that deal
    -       with windows and screens are  used.   The  routine  endwin
    +       must be called before any of the other routines that  deal
    +       with  windows  and  screens  are used.  The routine endwin
            must be called before exiting.  To get character-at-a-time
    -       input without echoing (most interactive,  screen  oriented
    -       programs  want  this),  the  following  sequence should be
    +       input  without  echoing (most interactive, screen oriented
    +       programs want this),  the  following  sequence  should  be
            used:
     
                  initscr(); cbreak(); noecho();
    @@ -103,74 +104,74 @@
                  intrflush(stdscr, FALSE);
                  keypad(stdscr, TRUE);
     
    -       Before a curses program is run, the tab stops of the  ter-
    -       minal  should  be  set  and its initialization strings, if
    -       defined, must be output.  This can be  done  by  executing
    +       Before  a curses program is run, the tab stops of the ter-
    +       minal should be set and  its  initialization  strings,  if
    +       defined,  must  be  output.  This can be done by executing
            the tput init command after the shell environment variable
    -       TERM has been exported.  tset(1)  is  usually  responsible
    +       TERM  has  been  exported.  tset(1) is usually responsible
            for doing this.  [See terminfo(5) for further details.]
     
    -       The  ncurses  library  permits manipulation of data struc-
    -       tures, called windows, which can be  thought  of  as  two-
    -       dimensional  arrays of characters representing all or part
    +       The ncurses library permits manipulation  of  data  struc-
    +       tures,  called  windows,  which  can be thought of as two-
    +       dimensional arrays of characters representing all or  part
            of a CRT screen.  A default window called stdscr, which is
    -       the  size of the terminal screen, is supplied.  Others may
    +       the size of the terminal screen, is supplied.  Others  may
            be created with newwin.
     
    -       Note that curses  does  not  handle  overlapping  windows,
    -       that's  done by the panel(3x) library. This means that you
    +       Note  that  curses  does  not  handle overlapping windows,
    +       that's done by the panel(3x) library. This means that  you
            can either use stdscr or divide the screen into tiled win-
    -       dows  and  not  using  stdscr  at all. Mixing the two will
    +       dows and not using stdscr at  all.  Mixing  the  two  will
            result in unpredictable, and undesired, effects.
     
            Windows are referred to by variables declared as WINDOW *.
    -       These   data  structures  are  manipulated  with  routines
    -       described here and elsewhere in the ncurses manual  pages.
    -       Among  which  the  most basic routines are move and addch.
    -       More general versions of these routines are included  with
    -       names  beginning  with  w,  allowing the user to specify a
    +       These  data  structures  are  manipulated  with   routines
    +       described  here and elsewhere in the ncurses manual pages.
    +       Among which the most basic routines are  move  and  addch.
    +       More  general versions of these routines are included with
    +       names beginning with w, allowing the  user  to  specify  a
            window.  The routines not beginning with w affect stdscr.)
     
    -       After  using  routines  to manipulate a window, refresh is
    -       called, telling curses to make the user's CRT screen  look
    -       like  stdscr.   The characters in a window are actually of
    -       type chtype, (character and attribute data) so that  other
    -       information  about  the  character may also be stored with
    +       After using routines to manipulate a  window,  refresh  is
    +       called,  telling curses to make the user's CRT screen look
    +       like stdscr.  The characters in a window are  actually  of
    +       type  chtype, (character and attribute data) so that other
    +       information about the character may also  be  stored  with
            each character.
     
    -       Special windows  called  pads  may  also  be  manipulated.
    +       Special  windows  called  pads  may  also  be manipulated.
            These are windows which are not constrained to the size of
    -       the screen and whose contents need not be completely  dis-
    +       the  screen and whose contents need not be completely dis-
            played.  See curs_pad(3x) for more information.
     
    -       In  addition  to  drawing  characters on the screen, video
    -       attributes and colors may be supported, causing the  char-
    -       acters  to show up in such modes as underlined, in reverse
    -       video, or in color on terminals that support such  display
    +       In addition to drawing characters  on  the  screen,  video
    +       attributes  and colors may be supported, causing the char-
    +       acters to show up in such modes as underlined, in  reverse
    +       video,  or in color on terminals that support such display
            enhancements.  Line drawing characters may be specified to
    -       be output.  On input, curses is  also  able  to  translate
    -       arrow  and  function  keys  that transmit escape sequences
    -       into single values.  The video  attributes,  line  drawing
    -       characters,   and  input  values  use  names,  defined  in
    +       be  output.   On  input,  curses is also able to translate
    +       arrow and function keys  that  transmit  escape  sequences
    +       into  single  values.   The video attributes, line drawing
    +       characters,  and  input  values  use  names,  defined   in
            <curses.h>, such as A_REVERSE, ACS_HLINE, and KEY_LEFT.
     
            If the environment variables LINES and COLUMNS are set, or
    -       if  the program is executing in a window environment, line
    -       and column information in the  environment  will  override
    +       if the program is executing in a window environment,  line
    +       and  column  information  in the environment will override
            information read by terminfo.  This would effect a program
    -       running in an AT&T 630 layer, for example, where the  size
    +       running  in an AT&T 630 layer, for example, where the size
            of a screen is changeable (see ENVIRONMENT).
     
    -       If  the environment variable TERMINFO is defined, any pro-
    -       gram using curses checks for a local  terminal  definition
    -       before  checking  in  the standard place.  For example, if
    +       If the environment variable TERMINFO is defined, any  pro-
    +       gram  using  curses checks for a local terminal definition
    +       before checking in the standard place.   For  example,  if
            TERM is set to att4424, then the compiled terminal defini-
            tion is found in
     
                  /usr/share/terminfo/a/att4424.
     
            (The a is copied from the first letter of att4424 to avoid
    -       creation of huge directories.)  However,  if  TERMINFO  is
    +       creation  of  huge  directories.)  However, if TERMINFO is
            set to $HOME/myterms, curses first checks
     
                  $HOME/myterms/a/att4424,
    @@ -179,54 +180,55 @@
     
                  /usr/share/terminfo/a/att4424.
     
    -       This  is useful for developing experimental definitions or
    +       This is useful for developing experimental definitions  or
            when write permission in /usr/share/terminfo is not avail-
            able.
     
    -       The  integer  variables  LINES  and  COLS  are  defined in
    -       <curses.h> and will be filled in by initscr with the  size
    +       The integer  variables  LINES  and  COLS  are  defined  in
    +       <curses.h>  and will be filled in by initscr with the size
            of the screen.  The constants TRUE and FALSE have the val-
            ues 1 and 0, respectively.
     
    -       The curses routines also  define  the  WINDOW  *  variable
    +       The  curses  routines  also  define  the WINDOW * variable
            curscr which is used for certain low-level operations like
    -       clearing and redrawing a screen containing  garbage.   The
    +       clearing  and  redrawing a screen containing garbage.  The
            curscr can be used in only a few routines.
     
        Routine and Argument Names
    -       Many  curses routines have two or more versions.  The rou-
    +       Many curses routines have two or more versions.  The  rou-
            tines prefixed with w require a window argument.  The rou-
            tines prefixed with p require a pad argument.  Those with-
            out a prefix generally use stdscr.
     
            The routines prefixed with mv require a y and x coordinate
    -       to  move to before performing the appropriate action.  The
    -       mv routines imply a call to move before the  call  to  the
    -       other  routine.  The coordinate y always refers to the row
    -       (of the window), and x always refers to the  column.   The
    +       to move to before performing the appropriate action.   The
    +       mv  routines  imply  a call to move before the call to the
    +       other routine.  The coordinate y always refers to the  row
    +       (of  the  window), and x always refers to the column.  The
            upper left-hand corner is always (0,0), not (1,1).
     
            The routines prefixed with mvw take both a window argument
    -       and x and y coordinates.  The window  argument  is  always
    +       and  x  and  y coordinates.  The window argument is always
            specified before the coordinates.
     
    -       In  each  case, win is the window affected, and pad is the
    +       In each case, win is the window affected, and pad  is  the
            pad affected; win and pad are always pointers to type WIN-
            DOW.
     
            Option setting routines require a Boolean flag bf with the
            value TRUE or FALSE; bf is always of type bool.  The vari-
    -       ables  ch  and attrs below are always of type chtype.  The
    -       types WINDOW, SCREEN, bool,  and  chtype  are  defined  in
    -       <curses.h>.   The  type  TERMINAL  is defined in <term.h>.
    +       ables ch and attrs below are always of type  chtype.   The
    +       types  WINDOW,  SCREEN,  bool,  and  chtype are defined in
    +       <curses.h>.  The type TERMINAL  is  defined  in  <term.h>.
            All other arguments are integers.
     
        Routine Name Index
            The following table lists each curses routine and the name
    -       of  the  manual  page  on which it is described.  Routines
    -       flagged with `*' are ncurses-specific,  not  described  by
    +       of the manual page on which  it  is  described.   Routines
    +       flagged  with  `*'  are ncurses-specific, not described by
            XPG4 or present in SVr4.
     
    +
                   curses Routine Name     Manual Page Name
                   --------------------------------------------
                   COLOR_PAIR              curs_color(3x)
    @@ -242,9 +244,9 @@
                   _tracemouse             curs_trace(3x)*
                   add_wch                 curs_add_wch(3x)
                   add_wchnstr             curs_add_wchstr(3x)
    +
                   add_wchstr              curs_add_wchstr(3x)
                   addch                   curs_addch(3x)
    -
                   addchnstr               curs_addchstr(3x)
                   addchstr                curs_addchstr(3x)
                   addnstr                 curs_addstr(3x)
    @@ -308,9 +310,9 @@
                   getbegyx                curs_getyx(3x)
                   getbkgd                 curs_bkgd(3x)
                   getbkgrnd               curs_bkgrnd(3x)
    +
                   getcchar                curs_getcchar(3x)
                   getch                   curs_getch(3x)
    -
                   getmaxyx                curs_getyx(3x)
                   getmouse                curs_mouse(3x)*
                   getn_wstr               curs_get_wstr(3x)
    @@ -374,9 +376,9 @@
                   mvadd_wch               curs_add_wch(3x)
                   mvadd_wchnstr           curs_add_wchstr(3x)
                   mvadd_wchstr            curs_add_wchstr(3x)
    +
                   mvaddch                 curs_addch(3x)
                   mvaddchnstr             curs_addchstr(3x)
    -
                   mvaddchstr              curs_addchstr(3x)
                   mvaddnstr               curs_addstr(3x)
                   mvaddnwstr              curs_addwstr(3x)
    @@ -440,9 +442,9 @@
                   mvwin_wchstr            curs_in_wchstr(3x)
                   mvwinch                 curs_inch(3x)
                   mvwinchnstr             curs_inchstr(3x)
    +
                   mvwinchstr              curs_inchstr(3x)
                   mvwinnstr               curs_instr(3x)
    -
                   mvwinnwstr              curs_inwstr(3x)
                   mvwins_nwstr            curs_ins_wstr(3x)
                   mvwins_wch              curs_ins_wch(3x)
    @@ -506,9 +508,9 @@
                   slk_attr                curs_slk(3x)*
                   slk_attr_off            curs_slk(3x)
                   slk_attr_on             curs_slk(3x)
    +
                   slk_attr_set            curs_slk(3x)
                   slk_attroff             curs_slk(3x)
    -
                   slk_attron              curs_slk(3x)
                   slk_attrset             curs_slk(3x)
                   slk_clear               curs_slk(3x)
    @@ -572,9 +574,9 @@
                   waddnstr                curs_addstr(3x)
                   waddnwstr               curs_addwstr(3x)
                   waddstr                 curs_addstr(3x)
    +
                   waddwstr                curs_addwstr(3x)
                   wattr_get               curs_attr(3x)
    -
                   wattr_off               curs_attr(3x)
                   wattr_on                curs_attr(3x)
                   wattr_set               curs_attr(3x)
    @@ -638,9 +640,9 @@
                   wsetscrreg              curs_outopts(3x)
                   wstandend               curs_attr(3x)
                   wstandout               curs_attr(3x)
    +
                   wsyncdown               curs_window(3x)
                   wsyncup                 curs_window(3x)
    -
                   wtimeout                curs_inopts(3x)
                   wtouchln                curs_touch(3x)
                   wunctrl                 curs_util(3x)
    @@ -650,14 +652,14 @@
     
     

    RETURN VALUE

    -       Routines  that  return  an integer return ERR upon failure
    -       and an integer value other than ERR upon  successful  com-
    -       pletion,  unless  otherwise  noted in the routine descrip-
    +       Routines that return an integer return  ERR  upon  failure
    +       and  an  integer value other than ERR upon successful com-
    +       pletion, unless otherwise noted in  the  routine  descrip-
            tions.
     
    -       All macros return the  value  of  the  w  version,  except
    +       All  macros  return  the  value  of  the w version, except
            setscrreg, wsetscrreg, getyx, getbegyx, and getmaxyx.  The
    -       return values of setscrreg, wsetscrreg,  getyx,  getbegyx,
    +       return  values  of setscrreg, wsetscrreg, getyx, getbegyx,
            and getmaxyx are undefined (i.e., these should not be used
            as the right-hand side of assignment statements).
     
    @@ -671,66 +673,78 @@
            important ones have been already discussed in detail.
     
            BAUDRATE
    -            The debugging library checks this environment  symbol
    +            The  debugging library checks this environment symbol
                 when the application has redirected output to a file.
    -            The symbol's numeric value is used for the  baudrate.
    +            The  symbol's numeric value is used for the baudrate.
                 If no value is found, ncurses uses 9600.  This allows
    -            testers to construct repeatable test-cases that  take
    +            testers  to construct repeatable test-cases that take
                 into account costs that depend on baudrate.
     
            CC   When set, change occurrences of the command_character
    -            (i.e., the cmdch capability) of the  loaded  terminfo
    -            entries  to  the value of this symbol.  Very few ter-
    +            (i.e.,  the  cmdch capability) of the loaded terminfo
    +            entries to the value of this symbol.  Very  few  ter-
                 minfo entries provide this feature.
     
            COLUMNS
                 Specify  the  width  of  the  screen  in  characters.
    -            Applications  running in a windowing environment usu-
    -            ally are able to obtain the width of  the  window  in
    -            which  they  are  executing.  If neither the $COLUMNS
    -            value nor the terminal's screen  size  is  available,
    -            ncurses  uses  the size which may be specified in the
    +            Applications running in a windowing environment  usu-
    +            ally  are  able  to obtain the width of the window in
    +            which they are executing.   If  neither  the  COLUMNS
    +            value  nor  the  terminal's screen size is available,
    +            ncurses uses the size which may be specified  in  the
                 terminfo database (i.e., the cols capability).
     
    -            It is important that your application use  a  correct
    -            size  for  the  screen.   However, this is not always
    -            possible because your application may be running on a
    -            host  which  does  not honor NAWS (Negotiations About
    -            Window Size), or because you are temporarily  running
    -            as another user.
    -
    -            Either  COLUMNS  or  LINES  symbols  may be specified
    -            independently.  This is mainly useful  to  circumvent
    -            legacy  misfeatures  of  terminal descriptions, e.g.,
    +            It  is  important that your application use a correct
    +            size for the screen.  This  is  not  always  possible
    +            because  your  application  may  be running on a host
    +            which does not honor NAWS (Negotiations About  Window
    +            Size),  or  because  you  are  temporarily running as
    +            another user.  However, setting COLUMNS and/or  LINES
    +            overrides  the  library's  use  of  the  screen  size
    +            obtained from the operating system.
    +
    +            Either COLUMNS or  LINES  symbols  may  be  specified
    +            independently.   This  is mainly useful to circumvent
    +            legacy misfeatures of  terminal  descriptions,  e.g.,
                 xterm which commonly specifies a 65 line screen.  For
    -            best  results, lines and cols should not be specified
    +            best results, lines and cols should not be  specified
                 in a terminal description for terminals which are run
                 as emulations.
     
    -            Use the use_env function to disable this feature.
    +            Use the use_env function to disable all use of exter-
    +            nal environment (including system calls) to determine
    +            the screen size.
     
            ESCDELAY
    -            Specifies  the total time, in milliseconds, for which
    -            ncurses will await  a  character  sequence,  e.g.,  a
    -            function  key.  The default value, 1000 milliseconds,
    +            Specifies the total time, in milliseconds, for  which
    +            ncurses  will  await  a  character  sequence, e.g., a
    +            function key.  The default value, 1000  milliseconds,
                 is enough for most uses.  However, it is made a vari-
                 able to accommodate unusual applications.
     
                 The most common instance where you may wish to change
    -            this value is to work with slow hosts, e.g.,  running
    -            on  a  network.   If  the host cannot read characters
    -            rapidly enough, it will have the same  effect  as  if
    -            the  terminal did not send characters rapidly enough.
    +            this  value is to work with slow hosts, e.g., running
    +            on a network.  If the  host  cannot  read  characters
    +            rapidly  enough,  it  will have the same effect as if
    +            the terminal did not send characters rapidly  enough.
                 The library will still see a timeout.
     
    -            Note that xterm mouse events are built up from  char-
    -            acter  sequences  received  from  the xterm.  If your
    +            Note  that xterm mouse events are built up from char-
    +            acter sequences received from  the  xterm.   If  your
                 application makes heavy use of multiple-clicking, you
    -            may  wish  to lengthen this default value because the
    -            timeout applies to the composed multi-click event  as
    +            may wish to lengthen this default value  because  the
    +            timeout  applies to the composed multi-click event as
                 well as the individual clicks.
     
    -       HOME Tells  ncurses where your home directory is.  That is
    +            In addition to the environment variable, this  imple-
    +            mentation  provides  a  global variable with the same
    +            name.  Portable applications should not rely upon the
    +            presence  of ESCDELAY in either form, but setting the
    +            environment variable rather than the global  variable
    +            does  not  create problems when compiling an applica-
    +            tion.
    +
    +       HOME Tells ncurses where your home directory is.  That  is
                 where  it  may  read  and  write  auxiliary  terminal
                 descriptions:
     
    @@ -738,12 +752,12 @@
                 $HOME/.terminfo
     
            LINES
    -            Like  COLUMNS,  specify  the  height of the screen in
    -            characters.  See COLUMNS for a detailed  description.
    +            Like COLUMNS, specify the height  of  the  screen  in
    +            characters.   See COLUMNS for a detailed description.
     
            MOUSE_BUTTONS_123
                 This applies only to the OS/2 EMX port.  It specifies
    -            the order of buttons on the mouse.   OS/2  numbers  a
    +            the  order  of  buttons on the mouse.  OS/2 numbers a
                 3-button mouse inconsistently from other platforms:
     
                 1 = left
    @@ -751,59 +765,78 @@
                 3 = middle.
     
                 This symbol lets you customize the mouse.  The symbol
    -            must be three numeric digits 1-3 in any order,  e.g.,
    -            123  or  321.   If  it is not specified, ncurses uses
    +            must  be three numeric digits 1-3 in any order, e.g.,
    +            123 or 321.  If it is  not  specified,  ncurses  uses
                 132.
     
            NCURSES_ASSUMED_COLORS
    -            Override the compiled-in assumption that  the  termi-
    -            nal's   default   colors   are   white-on-black  (see
    -            assume_default_colors(3x)).  You may  set  the  fore-
    +            Override  the  compiled-in assumption that the termi-
    +            nal's  default   colors   are   white-on-black   (see
    +            assume_default_colors(3x)).   You  may  set the fore-
                 ground and background color values with this environ-
    -            ment variable by  proving  a  2-element  list:  fore-
    -            ground,background.   For  example, to tell ncurses to
    -            not assume anything about the  colors,  set  this  to
    +            ment  variable  by  proving  a  2-element list: fore-
    +            ground,background.  For example, to tell  ncurses  to
    +            not  assume  anything  about  the colors, set this to
                 "-1,-1".  To make it green-on-black, set it to "2,0".
                 Any positive value from zero to the terminfo max_col-
                 ors value is allowed.
     
            NCURSES_NO_PADDING
    -            Most  of  the  terminal  descriptions in the terminfo
    -            database are written for real  "hardware"  terminals.
    -            Many  people  use  terminal  emulators which run in a
    -            windowing environment and use  curses-based  applica-
    -            tions.   Terminal  emulators can duplicate all of the
    +            Most of the terminal  descriptions  in  the  terminfo
    +            database  are  written for real "hardware" terminals.
    +            Many people use terminal emulators  which  run  in  a
    +            windowing  environment  and use curses-based applica-
    +            tions.  Terminal emulators can duplicate all  of  the
                 important aspects of a hardware terminal, but they do
    -            not  have the same limitations.  The chief limitation
    -            of a hardware terminal from the  standpoint  of  your
    -            application  is  the  management  of  dataflow, i.e.,
    -            timing.  Unless a  hardware  terminal  is  interfaced
    -            into  a  terminal  concentrator (which does flow con-
    -            trol), it (or your application) must manage dataflow,
    -            preventing overruns.  The cheapest solution (no hard-
    -            ware cost) is for your program to do this by  pausing
    -            after  operations that the terminal does slowly, such
    -            as clearing the display.
    -
    -            As a result, many  terminal  descriptions  (including
    -            the  vt100)  have delay times embedded.  You may wish
    -            to use these descriptions, but not want  to  pay  the
    +            not have the same limitations.  The chief  limitation
    +            of  a  hardware  terminal from the standpoint of your
    +            application is the management of dataflow, i.e., tim-
    +            ing.  Unless a hardware terminal is interfaced into a
    +            terminal concentrator (which does flow  control),  it
    +            (or  your application) must manage dataflow, prevent-
    +            ing overruns.  The  cheapest  solution  (no  hardware
    +            cost) is for your program to do this by pausing after
    +            operations that the terminal  does  slowly,  such  as
    +            clearing the display.
    +
    +            As  a  result,  many terminal descriptions (including
    +            the vt100) have delay times embedded.  You  may  wish
    +            to  use  these  descriptions, but not want to pay the
                 performance penalty.
     
    -            Set  the NCURSES_NO_PADDING symbol to disable all but
    -            mandatory padding.  Mandatory padding is  used  as  a
    +            Set the NCURSES_NO_PADDING symbol to disable all  but
    +            mandatory  padding.   Mandatory  padding is used as a
                 part of special control sequences such as flash.
     
            NCURSES_NO_SETBUF
    -            Normally  ncurses enables buffered output during ter-
    -            minal initialization.   This  is  done  (as  in  SVr4
    -            curses)  for  performance  reasons.  For testing pur-
    +            Normally ncurses enables buffered output during  ter-
    +            minal  initialization.   This  is  done  (as  in SVr4
    +            curses) for performance reasons.   For  testing  pur-
                 poses, both of ncurses and certain applications, this
                 feature    is    made    optional.     Setting    the
                 NCURSES_NO_SETBUF variable disables output buffering,
    -            leaving  the  output  in  the  original (usually line
    +            leaving the output  in  the  original  (usually  line
                 buffered) mode.
     
    +       NCURSES_NO_UTF8_ACS
    +            During initialization, the ncurses library checks for
    +            special cases where VT100 line-drawing (and the  cor-
    +            responding   alternate  character  set  capabilities)
    +            described in the terminfo are known  to  be  missing.
    +            Specifically,  when  running  in  a UTF-8 locale, the
    +            Linux console emulator and  the  GNU  screen  program
    +            ignore  these.   Ncurses  checks the TERM environment
    +            variable for these.  For  other  special  cases,  you
    +            should  set  this  environment  variable.  Doing this
    +            tells ncurses to use Unicode values which  correspond
    +            to the VT100 line-drawing glyphs.  That works for the
    +            special cases cited, and is likely to work for termi-
    +            nal emulators.
    +
    +            When  setting  this  variable, you should set it to a
    +            nonzero value.  Setting it to zero (or to  a  nonnum-
    +            ber) disables the special check for Linux and screen.
    +
            NCURSES_TRACE
                 During initialization, the ncurses debugging  library
                 checks  the  NCURSES_TRACE symbol.  If it is defined,
    @@ -877,8 +910,8 @@
     

    FILES

            /usr/share/tabset
                 directory  containing  initialization  files  for the
    -            terminal capability database /usr/share/terminfo ter-
    -            minal capability database
    +            terminal  capability   database   /usr/share/terminfo
    +            terminal capability database
     
     
     
    @@ -914,11 +947,11 @@ ual pages for details. The ncurses library can exploit the capabilities of termi- - nals which implement the ISO-6429 SGR 39 and SGR 49 - controls, which allow an application to reset the terminal - to its original foreground and background colors. From - the users' perspective, the application is able to draw - colored text on a background whose color is set indepen- + nals which implement the ISO-6429 SGR 39 and SGR 49 con- + trols, which allow an application to reset the terminal to + its original foreground and background colors. From the + users' perspective, the application is able to draw col- + ored text on a background whose color is set indepen- dently, providing better control over color contrasts. See the default_colors(3x) manual page for details. @@ -942,8 +975,8 @@ The routine has_key is not part of XPG4, nor is it present in SVr4. See the curs_getch(3x) manual page for details. - The routine slk_attr is not part of XPG4, nor is it pre- - sent in SVr4. See the curs_slk(3x) manual page for + The routine slk_attr is not part of XPG4, nor is it + present in SVr4. See the curs_slk(3x) manual page for details. The routines getmouse, mousemask, ungetmouse, mouseinter- @@ -985,7 +1018,7 @@ - ncurses(3x) + ncurses(3x)

    diff --git a/doc/html/man/panel.3x.html b/doc/html/man/panel.3x.html index 7dd86b97..89c0ee3b 100644 --- a/doc/html/man/panel.3x.html +++ b/doc/html/man/panel.3x.html @@ -40,7 +40,7 @@
     
    -panel(3x)                                               panel(3x)
    +panel(3x)                                                     panel(3x)
     
     
     
    @@ -223,7 +223,7 @@
     
     
     
    -                                                        panel(3x)
    +                                                              panel(3x)
     

    diff --git a/doc/html/man/resizeterm.3x.html b/doc/html/man/resizeterm.3x.html index a7be4795..23b08457 100644 --- a/doc/html/man/resizeterm.3x.html +++ b/doc/html/man/resizeterm.3x.html @@ -1,7 +1,7 @@ @@ -41,7 +41,7 @@
     
    -resizeterm(3x)                                     resizeterm(3x)
    +resizeterm(3x)                                           resizeterm(3x)
     
     
     
    @@ -110,6 +110,13 @@
            that  it should repaint special features such as pads that
            cannot be done automatically.
     
    +       If the environment variables LINES  or  COLUMNS  are  set,
    +       this  overrides  the  library's  use  of  the  window size
    +       obtained from the operating system.  Thus, even if a  SIG-
    +       WINCH  is received, no screen size change may be recorded.
    +       In that case, no KEY_RESIZE is queued for the next call to
    +       getch; an ERR will be returned instead.
    +
     
     

    SEE ALSO

    @@ -123,7 +130,7 @@
     
     
     
    -                                                   resizeterm(3x)
    +                                                         resizeterm(3x)
     

    diff --git a/doc/html/man/term.5.html b/doc/html/man/term.5.html index a0c144cc..e42ddd59 100644 --- a/doc/html/man/term.5.html +++ b/doc/html/man/term.5.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -TERM(5)                                                   TERM(5)
    +TERM(5)                                                         TERM(5)
     
     
     
    @@ -208,7 +208,7 @@
     
     
     
    -                                                          TERM(5)
    +                                                                TERM(5)
     

    diff --git a/doc/html/man/term.7.html b/doc/html/man/term.7.html index 85284e7d..bc4ede4f 100644 --- a/doc/html/man/term.7.html +++ b/doc/html/man/term.7.html @@ -40,7 +40,7 @@
     
    -TERM(7)                                                   TERM(7)
    +TERM(7)                                                         TERM(7)
     
     
     
    @@ -240,7 +240,7 @@
     
     
     
    -                                                          TERM(7)
    +                                                                TERM(7)
     

    diff --git a/doc/html/man/terminfo.5.html b/doc/html/man/terminfo.5.html index 0a503be3..d0d65def 100644 --- a/doc/html/man/terminfo.5.html +++ b/doc/html/man/terminfo.5.html @@ -6,7 +6,7 @@ * Note: this must be run through tbl before nroff. * The magic cookie on the first line triggers this under some man programs. **************************************************************************** - * Copyright (c) 1998-2000,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,10 +32,15 @@ * sale, use or other dealings in this Software without prior written * * authorization. * **************************************************************************** - * @Id: terminfo.head,v 1.10 2002/08/17 23:37:10 tom Exp @ + * @Id: terminfo.head,v 1.12 2004/09/25 19:07:11 tom Exp @ * Head of terminfo man page ends here - * @Id: terminfo.tail,v 1.38 2003/01/05 22:47:05 tom Exp @ + * @Id: terminfo.tail,v 1.42 2005/06/25 22:46:03 tom Exp @ * Beginning of terminfo.tail file + * See "terminfo.head" for copyright. + *.in -2 + *.in +2 + *.in -2 + *.in +2 *.TH --> @@ -49,7 +54,7 @@
     
    -TERMINFO(5)                File Formats               TERMINFO(5)
    +TERMINFO(5)                   File Formats                  TERMINFO(5)
     
     
     
    @@ -86,6 +91,16 @@
            no blanks; the last name may well contain upper  case  and
            blanks for readability.
     
    +       Lines beginning with a `#' in the first column are treated
    +       as comments.  While comment lines are legal at any  point,
    +       the  output  of  captoinfo and infotocap (aliases for tic)
    +       will move comments so they occur only between entries.
    +
    +       Newlines and leading  tabs  may  be  used  for  formatting
    +       entries  for  readability.   These are removed from parsed
    +       entries.  The infocmp -f option relies on this  to  format
    +       if-then-else expressions: the result can be read by tic.
    +
            Terminal names (except for the last, verbose entry) should
            be chosen using the following conventions.  The particular
            piece  of  hardware  making  up the terminal should have a
    @@ -96,6 +111,7 @@
            vt100-w.  The following suffixes should be used where pos-
            sible:
     
    +
           Suffix                  Meaning                   Example
           -nn      Number of lines on the screen            aaa-60
           -np      Number of pages of memory                c100-4p
    @@ -109,6 +125,7 @@
           -rv      Reverse video                            c100-rv
           -s       Enable status line                       vt100-s
           -vb      Use visible bell instead of beep         wy370-vb
    +
           -w       Wide mode (> 80 columns, usually 132)    vt100-w
     
            For  more  on terminal naming conventions, see the term(7)
    @@ -156,6 +173,7 @@
     
            These are the boolean capabilities:
     
    +
                    Variable          Cap-  TCap      Description
                    Booleans          name  Code
            auto_left_margin          bw    bw    cub1 wraps from col-
    @@ -171,6 +189,9 @@
                                                  by overwriting (hp)
            col_addr_glitch           xhpa  YA    only positive motion
                                                  for hpa/mhpa caps
    +
    +
    +
            cpi_changes_res           cpix  YF    changing character
                                                  pitch changes reso-
                                                  lution
    @@ -186,7 +207,6 @@
                                                  strikes with a blank
            generic_type              gn    gn    generic line type
            hard_copy                 hc    hc    hardcopy terminal
    -
            hard_cursor               chts  HC    cursor is hard to
                                                  see
            has_meta_key              km    km    Has a meta key
    @@ -236,6 +256,8 @@
                                                  on the status line
            tilde_glitch              hz    hz    cannot print ~'s
                                                  (hazeltine)
    +
    +
            transparent_underline     ul    ul    underline character
                                                  overstrikes
            xon_xoff                  xon   xo    terminal uses
    @@ -243,6 +265,7 @@
     
            These are the numeric capabilities:
     
    +
                 Variable         Cap-     TCap       Description
                  Numeric         name     Code
            columns               cols     co     number of columns in
    @@ -252,7 +275,6 @@
            label_height          lh       lh     rows in each label
            label_width           lw       lw     columns in each
                                                  label
    -
            lines                 lines    li     number of lines on
                                                  screen or page
            lines_of_memory       lm       lm     lines of memory if >
    @@ -286,6 +308,7 @@
            SVr4.0 term structure, but are not yet documented  in  the
            man page.  They came in with SVr4's printer support.
     
    +
                  Variable         Cap-    TCap       Description
                  Numeric          name    Code
            bit_image_entwining    bitwin  Yo     number of passes for
    @@ -300,6 +323,7 @@
            dot_horz_spacing       spinh   Yc     spacing of dots hor-
                                                  izontally in dots
                                                  per inch
    +
            dot_vert_spacing       spinv   Yb     spacing of pins ver-
                                                  tically in pins per
                                                  inch
    @@ -316,9 +340,6 @@
            output_res_char        orc     Yi     horizontal resolu-
                                                  tion in units per
                                                  line
    -
    -
    -
            output_res_horz_inch   orhi    Yk     horizontal resolu-
                                                  tion in units per
                                                  inch
    @@ -334,6 +355,7 @@
     
            These are the string capabilities:
     
    +
                    Variable          Cap-   TCap     Description
                     String           name   Code
            acs_chars                 acsc   ac   graphics charset
    @@ -366,6 +388,8 @@
                                                  home cursor (P*)
            clr_bol                   el1    cb   Clear to beginning
                                                  of line
    +
    +
            clr_eol                   el     ce   clear to end of line
                                                  (P)
            clr_eos                   ed     cd   clear to end of
    @@ -384,7 +408,6 @@
                                                  cup)
            cursor_invisible          civis  vi   make cursor invisi-
                                                  ble
    -
            cursor_left               cub1   le   move left one space
            cursor_mem_address        mrcup  CM   memory relative cur-
                                                  sor addressing, move
    @@ -432,6 +455,7 @@
            enter_italics_mode        sitm   ZH   Enter italic mode
            enter_leftward_mode       slm    ZI   Start leftward car-
                                                  riage motion
    +
            enter_micro_mode          smicm  ZJ   Start micro-motion
                                                  mode
            enter_near_letter_quality snlq   ZK   Enter NLQ mode
    @@ -450,7 +474,6 @@
            enter_subscript_mode      ssubm  ZN   Enter subscript mode
            enter_superscript_mode    ssupm  ZO   Enter superscript
                                                  mode
    -
            enter_underline_mode      smul   us   begin underline mode
            enter_upward_mode         sum    ZP   Start upward car-
                                                  riage motion
    @@ -498,6 +521,7 @@
                                                  string
            init_2string              is2    is   initialization
                                                  string
    +
            init_3string              is3    i3   initialization
                                                  string
            init_file                 if     if   name of initializa-
    @@ -515,8 +539,6 @@
            insert_padding            ip     ip   insert padding after
                                                  inserted character
            key_a1                    ka1    K1   upper left of keypad
    -
    -
            key_a3                    ka3    K3   upper right of key-
                                                  pad
            key_b2                    kb2    K2   center of keypad
    @@ -565,6 +587,7 @@
            key_f22                   kf22   FC   F22 function key
            key_f23                   kf23   FD   F23 function key
            key_f24                   kf24   FE   F24 function key
    +
            key_f25                   kf25   FF   F25 function key
            key_f26                   kf26   FG   F26 function key
            key_f27                   kf27   FH   F27 function key
    @@ -582,7 +605,6 @@
            key_f38                   kf38   FS   F38 function key
            key_f39                   kf39   FT   F39 function key
            key_f4                    kf4    k4   F4 function key
    -
            key_f40                   kf40   FU   F40 function key
            key_f41                   kf41   FV   F41 function key
            key_f42                   kf42   FW   F42 function key
    @@ -631,6 +653,7 @@
            key_previous              kprv   %8   previous key
            key_print                 kprt   %9   print key
            key_redo                  krdo   %0   redo key
    +
            key_reference             kref   &1   reference key
            key_refresh               krfr   &2   refresh key
            key_replace               krpl   &3   replace key
    @@ -648,7 +671,6 @@
            key_sdl                   kDL    *5   shifted delete-line
                                                  key
            key_select                kslt   *6   select key
    -
            key_send                  kEND   *7   shifted end key
            key_seol                  kEOL   *8   shifted clear-to-
                                                  end-of-line key
    @@ -696,6 +718,8 @@
                                                  key f3 if not f3
            lab_f4                    lf4    l4   label on function
                                                  key f4 if not f4
    +
    +
            lab_f5                    lf5    l5   label on function
                                                  key f5 if not f5
            lab_f6                    lf6    l6   label on function
    @@ -714,7 +738,6 @@
                                                  (8th-bit on)
            micro_column_address      mhpa   ZY   Like column_address
                                                  in micro mode
    -
            micro_down                mcud1  ZZ   Like cursor_down in
                                                  micro mode
            micro_left                mcub1  Za   Like cursor_left in
    @@ -761,6 +784,8 @@
                                                  in micro mode
            pkey_key                  pfkey  pk   program function key
                                                  #1 to type string #2
    +
    +
            pkey_local                pfloc  pl   program function key
                                                  #1 to execute string
                                                  #2
    @@ -779,8 +804,6 @@
            quick_dial                qdial  QD   dial number #1 with-
                                                  out checking
            remove_clock              rmclk  RC   remove clock
    -
    -
            repeat_char               rep    rp   repeat char #1 #2
                                                  times (P*)
            req_for_input             rfi    RF   send next input char
    @@ -828,6 +851,7 @@
                                                  umn
            set_right_margin_parm     smgrp  Zn   Set right margin at
                                                  column #1
    +
            set_tab                   hts    st   set a tab in every
                                                  row, current columns
            set_top_margin            smgt   Zo   Set top margin at
    @@ -845,8 +869,6 @@
                                                  set
            stop_bit_image            rbim   Zs   Stop printing bit
                                                  image graphics
    -
    -
            stop_char_set_def         rcsd   Zt   End definition of
                                                  character set #1
            subscript_characters      subcs  Zu   List of subscript-
    @@ -885,6 +907,7 @@
            SVr4.0  term structure, but were originally not documented
            in the man page.
     
    +
                    Variable          Cap-     TCap    Description
                     String           name     Code
            alt_scancode_esc          scesa    S8   Alternate escape
    @@ -894,6 +917,7 @@
                                                    of same row
            bit_image_newline         binel    Zz   Move to next row
                                                    of the bit image
    +
            bit_image_repeat          birep    Xy   Repeat bit image
                                                    cell #1 #2 times
            char_set_names            csnm     Zy   Produce #1'th item
    @@ -911,8 +935,6 @@
                                                    port
            display_pc_char           dispc    S1   Display PC charac-
                                                    ter #1
    -
    -
            end_bit_image_region      endbi    Yy   End a bit-image
                                                    region
            enter_pc_charset_mode     smpch    S2   Enter PC character
    @@ -961,6 +983,7 @@
                                                    cap).
            set_page_length           slines   YZ   Set page length to
                                                    #1 lines
    +
            set_tb_margin             smgtb    MT   Sets both top and
                                                    bottom margins to
                                                    #1, #2
    @@ -973,12 +996,11 @@
             these, they may not be binary-compatible  with  System  V
             terminfo entries after SVr4.1; beware!
     
    +
                     Variable         Cap-   TCap     Description
                      String          name   Code
             enter_horizontal_hl_mode ehhlm  Xh   Enter horizontal
                                                  highlight mode
    -
    -
             enter_left_hl_mode       elhlm  Xl   Enter left highlight
                                                  mode
             enter_low_hl_mode        elohlm Xo   Enter low highlight
    @@ -1027,11 +1049,11 @@
            space at the beginning of  each  line  except  the  first.
            Comments  may  be  included on lines beginning with ``#''.
            Capabilities in terminfo are of three types: Boolean capa-
    -       bilities which indicate that the terminal has some partic-
    -       ular feature, numeric capabilities giving the size of  the
    -       terminal  or  the  size  of  particular delays, and string
    -       capabilities, which give a sequence which can be  used  to
    -       perform particular terminal operations.
    +       bilities   which  indicate  that  the  terminal  has  some
    +       particular feature, numeric capabilities giving  the  size
    +       of  the  terminal  or  the  size of particular delays, and
    +       string capabilities, which give a sequence  which  can  be
    +       used to perform particular terminal operations.
     
     
        Types of Capabilities
    @@ -1199,14 +1221,14 @@
            "glass-tty" terminals.  Thus  the  model  33  teletype  is
            described as
     
    -     33|tty33|tty|model 33 teletype,
    -     bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,
    +       33|tty33|tty|model 33 teletype,
    +            bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,
     
            while the Lear Siegler ADM-3 is described as
     
    -     adm3|3|lsi adm3,
    -     am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J,
    -     ind=^J, lines#24,
    +       adm3|3|lsi adm3,
    +            am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J,
    +            ind=^J, lines#24,
     
     
        Parameterized Strings
    @@ -1273,306 +1295,320 @@
                 arithmetic (%m is mod): push(pop() op pop())
     
            %& %| %^
    -            bit operations: push(pop() op pop())
    +            bit operations (AND, OR and exclusive-OR): push(pop()
    +            op pop())
     
            %= %> %<
                 logical operations: push(pop() op pop())
     
            %A, %O
    -            logical and & or operations (for conditionals)
    +            logical AND and OR operations (for conditionals)
     
            %! %~
    -            unary operations push(op pop())
    +            unary   operations   (logical  and  bit  complement):
    +            push(op pop())
     
            %i   add 1 to first two parameters (for ANSI terminals)
     
            %? expr %t thenpart %e elsepart %;
    -            if-then-else, %e elsepart is optional.  else-if's are
    -            possible a la Algol 68:
    +            This forms  an  if-then-else.   The  %e  elsepart  is
    +            optional.   Usually  the  %? expr part pushes a value
    +            onto the stack,  and  %t  pops  it  from  the  stack,
    +            testing  if  it  is  nonzero  (true).   If it is zero
    +            (false), control passes to the %e (else) part.
    +
    +            It is possible to form else-if's a la Algol 68:
                 %? c1 %t b1 %e c2 %t b2 %e c3 %t b3 %e c4 %t b4 %e %;
    -            ci are conditions, bi are bodies.
    +
    +            where ci are conditions, bi are bodies.
    +
    +            Use the -f option of tic or infocmp to see the struc-
    +            ture of if-the-else's.  Some strings, e.g.,  sgr  can
    +            be very complicated when written on one line.  The -f
    +            option splits the string into lines  with  the  parts
    +            indented.
     
            Binary operations are in postfix form with the operands in
    -       the  usual  order.   That  is,  to  get  x-5 one would use
    -       "%gx%{5}%-".  %P and %g variables  are  persistent  across
    +       the usual order.  That  is,  to  get  x-5  one  would  use
    +       "%gx%{5}%-".   %P  and  %g variables are persistent across
            escape-string evaluations.
     
            Consider the HP2645, which, to get to row 3 and column 12,
    -       needs to be sent \E&a12c03Y  padded  for  6  milliseconds.
    -       Note  that  the  order of the rows and columns is inverted
    -       here, and that the row and column are printed as two  dig-
    +       needs  to  be  sent  \E&a12c03Y padded for 6 milliseconds.
    +       Note that the order of the rows and  columns  is  inverted
    +       here,  and that the row and column are printed as two dig-
            its.  Thus its cup capability is "cup=6\E&%p2%2dc%p1%2dY".
     
            The Microterm ACT-IV needs the current row and column sent
    -       preceded  by  a ^T, with the row and column simply encoded
    -       in binary, "cup=^T%p1%c%p2%c".  Terminals which  use  "%c"
    -       need  to  be  able  to backspace the cursor (cub1), and to
    +       preceded by a ^T, with the row and column  simply  encoded
    +       in  binary,  "cup=^T%p1%c%p2%c".  Terminals which use "%c"
    +       need to be able to backspace the  cursor  (cub1),  and  to
            move the cursor up one line on the screen (cuu1).  This is
    -       necessary  because it is not always safe to transmit \n ^D
    -       and \r, as the system may change or  discard  them.   (The
    -       library  routines  dealing  with terminfo set tty modes so
    +       necessary because it is not always safe to transmit \n  ^D
    +       and  \r,  as  the system may change or discard them.  (The
    +       library routines dealing with terminfo set  tty  modes  so
            that tabs are never expanded, so \t is safe to send.  This
            turns out to be essential for the Ann Arbor 4080.)
     
            A final example is the LSI ADM-3a, which uses row and col-
            umn  offset  by  a  blank  character,  thus  "cup=\E=%p1%'
    -       '%+%c%p2%'  '%+%c".   After sending `\E=', this pushes the
    -       first parameter, pushes the ASCII value for a space  (32),
    -       adds  them  (pushing  the sum on the stack in place of the
    -       two previous values) and outputs that value as  a  charac-
    -       ter.   Then  the  same  is  done for the second parameter.
    +       '%+%c%p2%' '%+%c".  After sending `\E=', this  pushes  the
    +       first  parameter, pushes the ASCII value for a space (32),
    +       adds them (pushing the sum on the stack in  place  of  the
    +       two  previous  values) and outputs that value as a charac-
    +       ter.  Then the same is  done  for  the  second  parameter.
            More complex arithmetic is possible using the stack.
     
     
        Cursor Motions
            If the terminal has a fast way to home the cursor (to very
    -       upper  left  corner  of  screen) then this can be given as
    -       home; similarly a fast way of getting to the  lower  left-
    -       hand  corner can be given as ll; this may involve going up
    -       with cuu1 from the home position,  but  a  program  should
    -       never  do this itself (unless ll does) because it can make
    -       no assumption about the effect of moving up from the  home
    -       position.   Note  that  the  home  position is the same as
    +       upper left corner of screen) then this  can  be  given  as
    +       home;  similarly  a fast way of getting to the lower left-
    +       hand corner can be given as ll; this may involve going  up
    +       with  cuu1  from  the  home position, but a program should
    +       never do this itself (unless ll does) because it can  make
    +       no  assumption about the effect of moving up from the home
    +       position.  Note that the home  position  is  the  same  as
            addressing to (0,0): to the top left corner of the screen,
    -       not  of  memory.   (Thus, the \EH sequence on HP terminals
    +       not of memory.  (Thus, the \EH sequence  on  HP  terminals
            cannot be used for home.)
     
            If the terminal has row or column absolute cursor address-
    -       ing,  these  can be given as single parameter capabilities
    +       ing, these can be given as single  parameter  capabilities
            hpa (horizontal position absolute) and vpa (vertical posi-
            tion absolute).  Sometimes these are shorter than the more
    -       general two parameter sequence (as with  the  hp2645)  and
    +       general  two  parameter  sequence (as with the hp2645) and
            can be used in preference to cup.  If there are parameter-
    -       ized local motions (e.g., move  n  spaces  to  the  right)
    +       ized  local  motions  (e.g.,  move  n spaces to the right)
            these can be given as cud, cub, cuf, and cuu with a single
    -       parameter indicating how many spaces to move.   These  are
    -       primarily  useful  if the terminal does not have cup, such
    +       parameter  indicating  how many spaces to move.  These are
    +       primarily useful if the terminal does not have  cup,  such
            as the TEKTRONIX 4025.
     
            If the terminal needs to be in a special mode when running
            a program that uses these capabilities, the codes to enter
    -       and exit this mode can be given as smcup and rmcup.   This
    -       arises,  for example, from terminals like the Concept with
    -       more than one page of memory.  If the  terminal  has  only
    -       memory  relative cursor addressing and not screen relative
    +       and  exit this mode can be given as smcup and rmcup.  This
    +       arises, for example, from terminals like the Concept  with
    +       more  than  one  page of memory.  If the terminal has only
    +       memory relative cursor addressing and not screen  relative
            cursor addressing, a one screen-sized window must be fixed
    -       into  the terminal for cursor addressing to work properly.
    +       into the terminal for cursor addressing to work  properly.
            This is also used for the TEKTRONIX 4025, where smcup sets
    -       the  command character to be the one used by terminfo.  If
    -       the smcup sequence will not restore the  screen  after  an
    +       the command character to be the one used by terminfo.   If
    +       the  smcup  sequence  will not restore the screen after an
            rmcup sequence is output (to the state prior to outputting
            rmcup), specify nrrmc.
     
     
        Area Clears
            If the terminal can clear from the current position to the
    -       end  of  the  line,  leaving  the cursor where it is, this
    +       end of the line, leaving the  cursor  where  it  is,  this
            should be given as el.  If the terminal can clear from the
    -       beginning  of  the line to the current position inclusive,
    -       leaving the cursor where it is, this should  be  given  as
    -       el1.   If the terminal can clear from the current position
    -       to the end of the display, then this should  be  given  as
    -       ed.   Ed  is only defined from the first column of a line.
    -       (Thus, it can be simulated by a request to delete a  large
    +       beginning of the line to the current  position  inclusive,
    +       leaving  the  cursor  where it is, this should be given as
    +       el1.  If the terminal can clear from the current  position
    +       to  the  end  of the display, then this should be given as
    +       ed.  Ed is only defined from the first column of  a  line.
    +       (Thus,  it can be simulated by a request to delete a large
            number of lines, if a true ed is not available.)
     
     
        Insert/delete line and vertical motions
    -       If  the terminal can open a new blank line before the line
    -       where the cursor is, this should be given as il1; this  is
    -       done  only  from the first position of a line.  The cursor
    +       If the terminal can open a new blank line before the  line
    +       where  the cursor is, this should be given as il1; this is
    +       done only from the first position of a line.   The  cursor
            must then appear on the newly blank line.  If the terminal
    -       can  delete  the  line  which  the cursor is on, then this
    -       should be given as dl1; this is done only from  the  first
    -       position  on  the line to be deleted.  Versions of il1 and
    -       dl1 which take a single parameter  and  insert  or  delete
    +       can delete the line which the  cursor  is  on,  then  this
    +       should  be  given as dl1; this is done only from the first
    +       position on the line to be deleted.  Versions of  il1  and
    +       dl1  which  take  a  single parameter and insert or delete
            that many lines can be given as il and dl.
     
    -       If  the terminal has a settable scrolling region (like the
    -       vt100) the command to set this can be described  with  the
    -       csr  capability,  which  takes two parameters: the top and
    +       If the terminal has a settable scrolling region (like  the
    +       vt100)  the  command to set this can be described with the
    +       csr capability, which takes two parameters:  the  top  and
            bottom lines of the scrolling region.  The cursor position
            is, alas, undefined after using this command.
     
    -       It  is possible to get the effect of insert or delete line
    +       It is possible to get the effect of insert or delete  line
            using csr on a properly chosen region; the sc and rc (save
    -       and  restore  cursor)  commands may be useful for ensuring
    -       that your synthesized insert/delete string does  not  move
    -       the  cursor.  (Note that the ncurses(3x) library does this
    -       synthesis  automatically,  so   you   need   not   compose
    +       and restore cursor) commands may be  useful  for  ensuring
    +       that  your  synthesized insert/delete string does not move
    +       the cursor.  (Note that the ncurses(3x) library does  this
    +       synthesis   automatically,   so   you   need  not  compose
            insert/delete strings for an entry with csr).
     
            Yet another way to construct insert and delete might be to
    -       use a combination of index with  the  memory-lock  feature
    -       found  on some terminals (like the HP-700/90 series, which
    +       use  a  combination  of index with the memory-lock feature
    +       found on some terminals (like the HP-700/90 series,  which
            however also has insert/delete).
     
    -       Inserting lines at the top or bottom  of  the  screen  can
    -       also  be  done using ri or ind on many terminals without a
    -       true insert/delete line, and is often faster even on  ter-
    -       minals with those features.
    +       Inserting  lines  at  the  top or bottom of the screen can
    +       also be done using ri or ind on many terminals  without  a
    +       true  insert/delete  line,  and  is  often  faster even on
    +       terminals with those features.
     
    -       The  boolean  non_dest_scroll_region should be set if each
    -       scrolling window is effectively a view port on  a  screen-
    -       sized  canvas.   To  test  for  this  capability, create a
    -       scrolling region in the middle of the screen, write  some-
    -       thing  to  the  bottom line, move the cursor to the top of
    +       The boolean non_dest_scroll_region should be set  if  each
    +       scrolling  window  is effectively a view port on a screen-
    +       sized canvas.  To  test  for  this  capability,  create  a
    +       scrolling  region in the middle of the screen, write some-
    +       thing to the bottom line, move the cursor to  the  top  of
            the region, and do ri followed by dl1 or ind.  If the data
    -       scrolled  off  the  bottom  of  the  region  by the ri re-
    -       appears, then scrolling is non-destructive.  System V  and
    -       XSI  Curses  expect that ind, ri, indn, and rin will simu-
    -       late destructive scrolling; their  documentation  cautions
    -       you  not  to  define csr unless this is true.  This curses
    +       scrolled off the bottom  of  the  region  by  the  ri  re-
    +       appears,  then scrolling is non-destructive.  System V and
    +       XSI Curses expect that ind, ri, indn, and rin  will  simu-
    +       late  destructive  scrolling; their documentation cautions
    +       you not to define csr unless this is  true.   This  curses
            implementation is more liberal and will do explicit erases
            after scrolling if ndstr is defined.
     
            If the terminal has the ability to define a window as part
    -       of memory, which all commands affect, it should  be  given
    +       of  memory,  which all commands affect, it should be given
            as the parameterized string wind.  The four parameters are
    -       the starting and ending lines in memory and  the  starting
    +       the  starting  and ending lines in memory and the starting
            and ending columns in memory, in that order.
     
    -       If  the terminal can retain display memory above, then the
    -       da capability should be given; if display  memory  can  be
    -       retained  below,  then db should be given.  These indicate
    -       that deleting a line  or  scrolling  may  bring  non-blank
    -       lines  up  from  below  or that scrolling back with ri may
    +       If the terminal can retain display memory above, then  the
    +       da  capability  should  be given; if display memory can be
    +       retained below, then db should be given.   These  indicate
    +       that  deleting  a  line  or  scrolling may bring non-blank
    +       lines up from below or that scrolling  back  with  ri  may
            bring down non-blank lines.
     
     
        Insert/Delete Character
    -       There are two basic kinds of  intelligent  terminals  with
    -       respect  to insert/delete character which can be described
    -       using terminfo.  The most common  insert/delete  character
    -       operations  affect only the characters on the current line
    -       and shift characters off the  end  of  the  line  rigidly.
    -       Other  terminals,  such  as the Concept 100 and the Perkin
    -       Elmer Owl, make a distinction between  typed  and  untyped
    -       blanks  on  the  screen, shifting upon an insert or delete
    -       only to an untyped blank on the  screen  which  is  either
    -       eliminated,  or  expanded  to two untyped blanks.  You can
    -       determine the kind of terminal you have  by  clearing  the
    -       screen  and  then typing text separated by cursor motions.
    -       Type "abc    def" using local cursor motions (not  spaces)
    +       There  are  two  basic kinds of intelligent terminals with
    +       respect to insert/delete character which can be  described
    +       using  terminfo.   The most common insert/delete character
    +       operations affect only the characters on the current  line
    +       and  shift  characters  off  the  end of the line rigidly.
    +       Other terminals, such as the Concept 100  and  the  Perkin
    +       Elmer  Owl,  make  a distinction between typed and untyped
    +       blanks on the screen, shifting upon an  insert  or  delete
    +       only  to  an  untyped  blank on the screen which is either
    +       eliminated, or expanded to two untyped  blanks.   You  can
    +       determine  the  kind  of terminal you have by clearing the
    +       screen and then typing text separated by  cursor  motions.
    +       Type  "abc    def" using local cursor motions (not spaces)
            between the "abc" and the "def".  Then position the cursor
    -       before the "abc" and put the terminal in insert mode.   If
    -       typing  characters  causes  the  rest of the line to shift
    +       before  the "abc" and put the terminal in insert mode.  If
    +       typing characters causes the rest of  the  line  to  shift
            rigidly and characters to fall off the end, then your ter-
    -       minal  does  not  distinguish  between  blanks and untyped
    -       positions.  If the "abc" shifts over to  the  "def"  which
    -       then  move together around the end of the current line and
    -       onto the next as you insert, you have the second  type  of
    -       terminal,  and should give the capability in, which stands
    +       minal does not  distinguish  between  blanks  and  untyped
    +       positions.   If  the  "abc" shifts over to the "def" which
    +       then move together around the end of the current line  and
    +       onto  the  next as you insert, you have the second type of
    +       terminal, and should give the capability in, which  stands
            for "insert null".  While these are two logically separate
    -       attributes  (one  line  versus multi-line insert mode, and
    -       special treatment of untyped spaces) we have seen no  ter-
    +       attributes (one line versus multi-line  insert  mode,  and
    +       special  treatment of untyped spaces) we have seen no ter-
            minals whose insert mode cannot be described with the sin-
            gle attribute.
     
    -       Terminfo can describe both terminals which have an  insert
    +       Terminfo  can describe both terminals which have an insert
            mode, and terminals which send a simple sequence to open a
    -       blank position on the current  line.   Give  as  smir  the
    -       sequence  to  get  into  insert  mode.   Give  as rmir the
    -       sequence to leave insert  mode.   Now  give  as  ich1  any
    +       blank  position  on  the  current  line.  Give as smir the
    +       sequence to get  into  insert  mode.   Give  as  rmir  the
    +       sequence  to  leave  insert  mode.   Now  give as ich1 any
            sequence needed to be sent just before sending the charac-
    -       ter to be inserted.  Most terminals  with  a  true  insert
    -       mode  will  not give ich1; terminals which send a sequence
    +       ter  to  be  inserted.   Most terminals with a true insert
    +       mode will not give ich1; terminals which send  a  sequence
            to open a screen position should give it here.
     
    -       If your terminal has both, insert mode is usually  prefer-
    -       able  to  ich1.   Technically,  you  should  not give both
    -       unless the terminal actually requires both to be  used  in
    -       combination.   Accordingly,  some  non-curses applications
    -       get confused if both are present; the symptom  is  doubled
    +       If  your terminal has both, insert mode is usually prefer-
    +       able to ich1.   Technically,  you  should  not  give  both
    +       unless  the  terminal actually requires both to be used in
    +       combination.  Accordingly,  some  non-curses  applications
    +       get  confused  if both are present; the symptom is doubled
            characters in an update using insert.  This requirement is
            now rare; most ich sequences do not require previous smir,
            and most smir insert modes do not require ich1 before each
    -       character.  Therefore, the  new  curses  actually  assumes
    -       this  is the case and uses either rmir/smir or ich/ich1 as
    +       character.   Therefore,  the  new  curses actually assumes
    +       this is the case and uses either rmir/smir or ich/ich1  as
            appropriate (but not both).  If you have to write an entry
    -       to  be  used under new curses for a terminal old enough to
    +       to be used under new curses for a terminal old  enough  to
            need both, include the rmir/smir sequences in ich1.
     
            If post insert padding is needed, give this as a number of
    -       milliseconds  in ip (a string option).  Any other sequence
    -       which may need to be sent after  an  insert  of  a  single
    +       milliseconds in ip (a string option).  Any other  sequence
    +       which  may  need  to  be  sent after an insert of a single
            character may also be given in ip.  If your terminal needs
            both to be placed into an `insert mode' and a special code
    -       to  precede  each  inserted character, then both smir/rmir
    -       and ich1 can be given, and both will  be  used.   The  ich
    +       to precede each inserted character,  then  both  smir/rmir
    +       and  ich1  can  be  given, and both will be used.  The ich
            capability, with one parameter, n, will repeat the effects
            of ich1 n times.
     
            If padding is necessary between characters typed while not
    -       in  insert  mode,  give  this  as a number of milliseconds
    +       in insert mode, give this  as  a  number  of  milliseconds
            padding in rmp.
     
    -       It is occasionally  necessary  to  move  around  while  in
    -       insert  mode  to delete characters on the same line (e.g.,
    -       if there is a tab after the insertion position).  If  your
    -       terminal  allows  motion while in insert mode you can give
    -       the capability mir to speed up  inserting  in  this  case.
    -       Omitting  mir  will  affect  only  speed.   Some terminals
    +       It  is  occasionally  necessary  to  move  around while in
    +       insert mode to delete characters on the same  line  (e.g.,
    +       if  there is a tab after the insertion position).  If your
    +       terminal allows motion while in insert mode you  can  give
    +       the  capability  mir  to  speed up inserting in this case.
    +       Omitting mir  will  affect  only  speed.   Some  terminals
            (notably Datamedia's) must not have mir because of the way
            their insert mode works.
     
    -       Finally,  you  can specify dch1 to delete a single charac-
    -       ter, dch with one parameter, n, to  delete  n  characters,
    -       and  delete mode by giving smdc and rmdc to enter and exit
    -       delete mode (any mode the terminal needs to be  placed  in
    +       Finally, you can specify dch1 to delete a  single  charac-
    +       ter,  dch  with  one parameter, n, to delete n characters,
    +       and delete mode by giving smdc and rmdc to enter and  exit
    +       delete  mode  (any mode the terminal needs to be placed in
            for dch1 to work).
     
    -       A  command to erase n characters (equivalent to outputting
    -       n blanks without moving the cursor) can be  given  as  ech
    +       A command to erase n characters (equivalent to  outputting
    +       n  blanks  without  moving the cursor) can be given as ech
            with one parameter.
     
     
        Highlighting, Underlining, and Visible Bells
            If  your  terminal  has  one  or  more  kinds  of  display
    -       attributes, these can be represented in a number  of  dif-
    +       attributes,  these  can be represented in a number of dif-
            ferent ways.  You should choose one display form as stand-
            out mode, representing a good, high contrast, easy-on-the-
    -       eyes,  format  for  highlighting  error messages and other
    -       attention getters.  (If you have a choice,  reverse  video
    -       plus  half-bright  is  good, or reverse video alone.)  The
    -       sequences to enter and exit standout  mode  are  given  as
    -       smso  and  rmso, respectively.  If the code to change into
    -       or out of standout mode  leaves  one  or  even  two  blank
    -       spaces  on the screen, as the TVI 912 and Teleray 1061 do,
    +       eyes, format for highlighting  error  messages  and  other
    +       attention  getters.   (If you have a choice, reverse video
    +       plus half-bright is good, or reverse  video  alone.)   The
    +       sequences  to  enter  and  exit standout mode are given as
    +       smso and rmso, respectively.  If the code to  change  into
    +       or  out  of  standout  mode  leaves  one or even two blank
    +       spaces on the screen, as the TVI 912 and Teleray 1061  do,
            then xmc should be given to tell how many spaces are left.
     
    -       Codes  to  begin  underlining  and  end underlining can be
    -       given as smul and rmul respectively.  If the terminal  has
    -       a  code  to  underline  the current character and move the
    +       Codes to begin underlining  and  end  underlining  can  be
    +       given  as smul and rmul respectively.  If the terminal has
    +       a code to underline the current  character  and  move  the
            cursor one space to the right, such as the Microterm Mime,
            this can be given as uc.
     
    -       Other  capabilities  to  enter  various highlighting modes
    -       include blink (blinking) bold (bold or extra  bright)  dim
    -       (dim  or  half-bright)  invis (blanking or invisible text)
    -       prot (protected) rev (reverse video) sgr0  (turn  off  all
    -       attribute  modes)  smacs  (enter  alternate  character set
    -       mode) and  rmacs  (exit  alternate  character  set  mode).
    -       Turning  on  any of these modes singly may or may not turn
    +       Other capabilities to  enter  various  highlighting  modes
    +       include  blink  (blinking) bold (bold or extra bright) dim
    +       (dim or half-bright) invis (blanking  or  invisible  text)
    +       prot  (protected)  rev  (reverse video) sgr0 (turn off all
    +       attribute modes)  smacs  (enter  alternate  character  set
    +       mode)  and  rmacs  (exit  alternate  character  set mode).
    +       Turning on any of these modes singly may or may  not  turn
            off other modes.
     
    -       If there is a sequence to set  arbitrary  combinations  of
    -       modes,  this should be given as sgr (set attributes), tak-
    -       ing 9 parameters.  Each parameter is either 0 or  nonzero,
    +       If  there  is  a sequence to set arbitrary combinations of
    +       modes, this should be given as sgr (set attributes),  tak-
    +       ing  9 parameters.  Each parameter is either 0 or nonzero,
            as the corresponding attribute is on or off.  The 9 param-
    -       eters are, in order: standout, underline, reverse,  blink,
    -       dim,  bold,  blank, protect, alternate character set.  Not
    -       all modes need be supported by sgr, only those  for  which
    +       eters  are, in order: standout, underline, reverse, blink,
    +       dim, bold, blank, protect, alternate character  set.   Not
    +       all  modes  need be supported by sgr, only those for which
            corresponding separate attribute commands exist.
     
            For example, the DEC vt220 supports most of the modes:
     
    +
                tparm parameter   attribute    escape sequence
     
                none              none         \E[0m
                p1                standout     \E[0;1;7m
                p2                underline    \E[0;4m
    -
                p3                reverse      \E[0;7m
                p4                blink        \E[0;5m
                p5                dim          not available
    @@ -1581,24 +1617,25 @@
                p8                protect      not used
                p9                altcharset   ^O (off) ^N (on)
     
    -       We  begin each escape sequence by turning off any existing
    -       modes, since there is no quick way  to  determine  whether
    +       We begin each escape sequence by turning off any  existing
    +       modes,  since  there  is no quick way to determine whether
            they are active.  Standout is set up to be the combination
    -       of reverse and bold.  The vt220  terminal  has  a  protect
    -       mode,  though  it  is  not commonly used in sgr because it
    -       protects characters on the screen  from  the  host's  era-
    -       sures.   The  altcharset mode also is different in that it
    -       is either ^O or ^N, depending on whether it is off or  on.
    -       If  all  modes  are  turned  on, the resulting sequence is
    +       of  reverse  and  bold.   The vt220 terminal has a protect
    +       mode, though it is not commonly used  in  sgr  because  it
    +       protects  characters  on  the  screen from the host's era-
    +       sures.  The altcharset mode also is different in  that  it
    +       is  either ^O or ^N, depending on whether it is off or on.
    +       If all modes are turned  on,  the  resulting  sequence  is
            \E[0;1;4;5;7;8m^N.
     
    -       Some sequences are common to different modes.   For  exam-
    -       ple,  ;7  is output when either p1 or p3 is true, that is,
    +       Some  sequences  are common to different modes.  For exam-
    +       ple, ;7 is output when either p1 or p3 is true,  that  is,
            if either standout or reverse modes are turned on.
     
    -       Writing out the above sequences, along with  their  depen-
    +       Writing  out  the above sequences, along with their depen-
            dencies yields
     
    +
              sequence    when to output     terminfo translation
     
              \E[0       always              \E[0
    @@ -1606,6 +1643,7 @@
              ;4         if p2               %?%p2%|%t;4%;
              ;5         if p4               %?%p4%|%t;5%;
              ;7         if p1 or p3         %?%p1%p3%|%t;7%;
    +
              ;8         if p7               %?%p7%|%t;8%;
              m          always              m
              ^N or ^O   if p9 ^N, else ^O   %?%p9%t^N%e^O%;
    @@ -1615,216 +1653,223 @@
                sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;
                    %?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;,
     
    -       Remember  that  if  you specify sgr, you must also specify
    -       sgr0.
    -
    -       Terminals with the ``magic cookie'' glitch  (xmc)  deposit
    -       special   ``cookies''   when   they  receive  mode-setting
    -       sequences, which affect the display algorithm rather  than
    -       having  extra  bits  for  each character.  Some terminals,
    -       such as the HP 2621,  automatically  leave  standout  mode
    -       when  they  move to a new line or the cursor is addressed.
    -       Programs using standout mode  should  exit  standout  mode
    -       before  moving the cursor or sending a newline, unless the
    -       msgr capability, asserting that it  is  safe  to  move  in
    +       Remember that if you specify sgr, you  must  also  specify
    +       sgr0.   Also, some implementations rely on sgr being given
    +       if sgr0 is, Not all terminfo entries necessarily  have  an
    +       sgr  string,  however.   Many terminfo entries are derived
    +       from termcap entries which have no sgr string.   The  only
    +       drawback  to  adding  an  sgr  string is that termcap also
    +       assumes that sgr0 does not exit  alternate  character  set
    +       mode.
    +
    +       Terminals  with  the ``magic cookie'' glitch (xmc) deposit
    +       special  ``cookies''  when   they   receive   mode-setting
    +       sequences,  which affect the display algorithm rather than
    +       having extra bits for  each  character.   Some  terminals,
    +       such  as  the  HP  2621, automatically leave standout mode
    +       when they move to a new line or the cursor  is  addressed.
    +       Programs  using  standout  mode  should exit standout mode
    +       before moving the cursor or sending a newline, unless  the
    +       msgr  capability,  asserting  that  it  is safe to move in
            standout mode, is present.
     
    -       If  the terminal has a way of flashing the screen to indi-
    -       cate an error quietly (a bell replacement) then  this  can
    +       If the terminal has a way of flashing the screen to  indi-
    +       cate  an  error quietly (a bell replacement) then this can
            be given as flash; it must not move the cursor.
     
    -       If  the  cursor  needs to be made more visible than normal
    +       If the cursor needs to be made more  visible  than  normal
            when it is not on the bottom line (to make, for example, a
    -       non-blinking  underline  into  an  easier to find block or
    +       non-blinking underline into an easier  to  find  block  or
            blinking underline) give this sequence as cvvis.  If there
    -       is  a  way  to  make the cursor completely invisible, give
    +       is a way to make the  cursor  completely  invisible,  give
            that as civis.  The capability cnorm should be given which
            undoes the effects of both of these modes.
     
            If your terminal correctly generates underlined characters
    -       (with no special codes needed) even  though  it  does  not
    -       overstrike,  then you should give the capability ul.  If a
    -       character overstriking another leaves both  characters  on
    +       (with  no  special  codes  needed) even though it does not
    +       overstrike, then you should give the capability ul.  If  a
    +       character  overstriking  another leaves both characters on
            the screen, specify the capability os.  If overstrikes are
    -       erasable with a blank, then this should  be  indicated  by
    +       erasable  with  a  blank, then this should be indicated by
            giving eo.
     
     
        Keypad and Function Keys
            If the terminal has a keypad that transmits codes when the
    -       keys are pressed, this information  can  be  given.   Note
    +       keys  are  pressed,  this  information can be given.  Note
            that it is not possible to handle terminals where the key-
            pad only works in local (this applies, for example, to the
    -       unshifted  HP  2621  keys).   If  the keypad can be set to
    -       transmit or not transmit, give these  codes  as  smkx  and
    +       unshifted HP 2621 keys).  If the  keypad  can  be  set  to
    +       transmit  or  not  transmit,  give these codes as smkx and
            rmkx.  Otherwise the keypad is assumed to always transmit.
    -       The codes sent by the left arrow, right arrow,  up  arrow,
    -       down  arrow,  and  home keys can be given as kcub1, kcuf1,
    -       kcuu1, kcud1, and khome respectively.  If there are  func-
    -       tion  keys  such  as f0, f1, ..., f10, the codes they send
    -       can be given as kf0, kf1, ..., kf10.  If these  keys  have
    -       labels  other  than the default f0 through f10, the labels
    -       can be given as lf0, lf1, ..., lf10.  The codes  transmit-
    -       ted  by certain other special keys can be given: kll (home
    -       down), kbs  (backspace),  ktbc  (clear  all  tabs),  kctab
    +       The  codes  sent by the left arrow, right arrow, up arrow,
    +       down arrow, and home keys can be given  as  kcub1,  kcuf1,
    +       kcuu1,  kcud1, and khome respectively.  If there are func-
    +       tion keys such as f0, f1, ..., f10, the  codes  they  send
    +       can  be  given as kf0, kf1, ..., kf10.  If these keys have
    +       labels other than the default f0 through f10,  the  labels
    +       can  be given as lf0, lf1, ..., lf10.  The codes transmit-
    +       ted by certain other special keys can be given: kll  (home
    +       down),  kbs  (backspace),  ktbc  (clear  all  tabs), kctab
            (clear the tab stop in this column), kclr (clear screen or
    -       erase key), kdch1 (delete character), kdl1 (delete  line),
    -       krmir  (exit insert mode), kel (clear to end of line), ked
    +       erase  key), kdch1 (delete character), kdl1 (delete line),
    +       krmir (exit insert mode), kel (clear to end of line),  ked
            (clear to end of screen), kich1 (insert character or enter
    -       insert  mode),  kil1  (insert  line), knp (next page), kpp
    -       (previous page), kind (scroll forward/down),  kri  (scroll
    -       backward/up),  khts  (set  a tab stop in this column).  In
    +       insert mode), kil1 (insert line),  knp  (next  page),  kpp
    +       (previous  page),  kind (scroll forward/down), kri (scroll
    +       backward/up), khts (set a tab stop in  this  column).   In
            addition, if the keypad has a 3 by 3 array of keys includ-
    -       ing  the four arrow keys, the other five keys can be given
    -       as ka1, ka3, kb2, kc1, and kc3.   These  keys  are  useful
    +       ing the four arrow keys, the other five keys can be  given
    +       as  ka1,  ka3,  kb2,  kc1, and kc3.  These keys are useful
            when the effects of a 3 by 3 directional pad are needed.
     
    -       Strings  to  program  function keys can be given as pfkey,
    -       pfloc, and pfx.  A string to program screen labels  should
    -       be  specified  as  pln.   Each  of these strings takes two
    -       parameters: the function key number to program (from 0  to
    -       10)  and the string to program it with.  Function key num-
    -       bers out of this range may program  undefined  keys  in  a
    -       terminal  dependent  manner.   The  difference between the
    -       capabilities is that pfkey causes pressing the  given  key
    -       to  be the same as the user typing the given string; pfloc
    +       Strings to program function keys can be  given  as  pfkey,
    +       pfloc,  and pfx.  A string to program screen labels should
    +       be specified as pln.  Each  of  these  strings  takes  two
    +       parameters:  the function key number to program (from 0 to
    +       10) and the string to program it with.  Function key  num-
    +       bers  out  of  this  range may program undefined keys in a
    +       terminal dependent manner.   The  difference  between  the
    +       capabilities  is  that pfkey causes pressing the given key
    +       to be the same as the user typing the given string;  pfloc
            causes the string to be executed by the terminal in local;
    -       and  pfx  causes  the string to be transmitted to the com-
    +       and pfx causes the string to be transmitted  to  the  com-
            puter.
     
            The capabilities nlab, lw and lh define the number of pro-
    -       grammable  screen  labels  and their width and height.  If
    -       there are commands to turn the labels  on  and  off,  give
    -       them  in smln and rmln.  smln is normally output after one
    +       grammable screen labels and their width  and  height.   If
    +       there  are  commands  to  turn the labels on and off, give
    +       them in smln and rmln.  smln is normally output after  one
            or more pln sequences to make sure that the change becomes
            visible.
     
     
        Tabs and Initialization
    -       If  the terminal has hardware tabs, the command to advance
    -       to the next tab stop can be given as ht  (usually  control
    -       I).   A  ``back-tab''  command which moves leftward to the
    +       If the terminal has hardware tabs, the command to  advance
    +       to  the  next tab stop can be given as ht (usually control
    +       I).  A ``back-tab'' command which moves  leftward  to  the
            preceding tab stop can be given as cbt.  By convention, if
    -       the  teletype  modes indicate that tabs are being expanded
    -       by the computer rather than being sent  to  the  terminal,
    -       programs  should  not  use ht or cbt even if they are pre-
    -       sent, since the user may not have the tab  stops  properly
    -       set.   If  the  terminal  has hardware tabs which are ini-
    -       tially set every n spaces when the terminal is powered up,
    -       the  numeric  parameter it is given, showing the number of
    -       spaces the tabs are set to.  This is normally used by  the
    -       tset  command  to  determine  whether  to set the mode for
    -       hardware tab expansion, and whether to set the tab  stops.
    -       If  the  terminal  has tab stops that can be saved in non-
    -       volatile memory, the terminfo description can assume  that
    +       the teletype modes indicate that tabs are  being  expanded
    +       by  the  computer  rather than being sent to the terminal,
    +       programs should not  use  ht  or  cbt  even  if  they  are
    +       present,  since  the user may not have the tab stops prop-
    +       erly set.  If the terminal has  hardware  tabs  which  are
    +       initially  set every n spaces when the terminal is powered
    +       up, the numeric parameter it is given, showing the  number
    +       of  spaces  the tabs are set to.  This is normally used by
    +       the tset command to determine whether to set the mode  for
    +       hardware  tab expansion, and whether to set the tab stops.
    +       If the terminal has tab stops that can be  saved  in  non-
    +       volatile  memory, the terminfo description can assume that
            they are properly set.
     
    -       Other  capabilities include is1, is2, and is3, initializa-
    -       tion strings for the terminal, iprog, the path name  of  a
    -       program  to be run to initialize the terminal, and if, the
    -       name of a file  containing  long  initialization  strings.
    -       These  strings are expected to set the terminal into modes
    -       consistent with the  rest  of  the  terminfo  description.
    +       Other capabilities include is1, is2, and is3,  initializa-
    +       tion  strings  for the terminal, iprog, the path name of a
    +       program to be run to initialize the terminal, and if,  the
    +       name  of  a  file  containing long initialization strings.
    +       These strings are expected to set the terminal into  modes
    +       consistent  with  the  rest  of  the terminfo description.
            They are normally sent to the terminal, by the init option
    -       of the tput program, each time the  user  logs  in.   They
    -       will  be  printed  in the following order: run the program
    -       iprog; output is1; is2; set the margins  using  mgc,  smgl
    -       and  smgr;  set tabs using tbc and hts; print the file if;
    +       of  the  tput  program,  each time the user logs in.  They
    +       will be printed in the following order:  run  the  program
    +       iprog;  output  is1;  is2; set the margins using mgc, smgl
    +       and smgr; set tabs using tbc and hts; print the  file  if;
            and finally output is3.
     
    -       Most initialization is done with  is2.   Special  terminal
    +       Most  initialization  is  done with is2.  Special terminal
            modes can be set up without duplicating strings by putting
    -       the common sequences in is2 and special cases in  is1  and
    -       is3.   A pair of sequences that does a harder reset from a
    -       totally unknown state can be  analogously  given  as  rs1,
    -       rs2,  rf, and rs3, analogous to is2 and if.  These strings
    -       are output by the reset program, which is  used  when  the
    -       terminal  gets into a wedged state.  Commands are normally
    -       placed in rs1, rs2 rs3 and rf only if they produce  annoy-
    -       ing  effects on the screen and are not necessary when log-
    -       ging in.  For example, the command to set the  vt100  into
    -       80-column  mode  would  normally  be  part  of is2, but it
    -       causes an annoying glitch of the screen and  is  not  nor-
    -       mally  needed  since the terminal is usually already in 80
    +       the  common  sequences in is2 and special cases in is1 and
    +       is3.  A pair of sequences that does a harder reset from  a
    +       totally  unknown  state  can  be analogously given as rs1,
    +       rs2, rf, and rs3, analogous to is2 and if.  These  strings
    +       are  output  by  the reset program, which is used when the
    +       terminal gets into a wedged state.  Commands are  normally
    +       placed  in rs1, rs2 rs3 and rf only if they produce annoy-
    +       ing effects on the screen and are not necessary when  log-
    +       ging  in.   For example, the command to set the vt100 into
    +       80-column mode would normally  be  part  of  is2,  but  it
    +       causes  an  annoying  glitch of the screen and is not nor-
    +       mally needed since the terminal is usually already  in  80
            column mode.
     
            If there are commands to set and clear tab stops, they can
    -       be  given  as tbc (clear all tab stops) and hts (set a tab
    -       stop in the current column of every row).  If a more  com-
    -       plex  sequence  is  needed  to  set  the  tabs than can be
    -       described by this, the sequence can be placed  in  is2  or
    +       be given as tbc (clear all tab stops) and hts (set  a  tab
    +       stop  in the current column of every row).  If a more com-
    +       plex sequence is needed  to  set  the  tabs  than  can  be
    +       described  by  this,  the sequence can be placed in is2 or
            if.
     
        Delays and Padding
    -       Many  older  and  slower  terminals  don't  support either
    +       Many older and slower  terminals  do  not  support  either
            XON/XOFF or DTR handshaking, including hard copy terminals
    -       and  some  very  archaic CRTs (including, for example, DEC
    -       VT100s).  These may require padding characters after  cer-
    +       and some very archaic CRTs (including,  for  example,  DEC
    +       VT100s).   These may require padding characters after cer-
            tain cursor motions and screen changes.
     
            If the terminal uses xon/xoff handshaking for flow control
    -       (that is, it automatically emits ^S back to the host  when
    +       (that  is, it automatically emits ^S back to the host when
            its input buffers are close to full), set xon.  This capa-
    -       bility suppresses the emission of padding.  You  can  also
    -       set  it for memory-mapped console devices effectively that
    -       don't have a  speed  limit.   Padding  information  should
    -       still  be  included so that routines can make better deci-
    +       bility  suppresses  the emission of padding.  You can also
    +       set it for memory-mapped console devices effectively  that
    +       do  not  have  a  speed limit.  Padding information should
    +       still be included so that routines can make  better  deci-
            sions about relative costs, but actual pad characters will
            not be transmitted.
     
    -       If  pb (padding baud rate) is given, padding is suppressed
    -       at baud rates below the value of pb.  If the entry has  no
    -       padding  baud rate, then whether padding is emitted or not
    +       If pb (padding baud rate) is given, padding is  suppressed
    +       at  baud rates below the value of pb.  If the entry has no
    +       padding baud rate, then whether padding is emitted or  not
            is completely controlled by xon.
     
    -       If the terminal requires other than a null (zero)  charac-
    -       ter  as  a  pad,  then this can be given as pad.  Only the
    +       If  the terminal requires other than a null (zero) charac-
    +       ter as a pad, then this can be given  as  pad.   Only  the
            first character of the pad string is used.
     
     
        Status Lines
    -       Some terminals have an extra `status line'  which  is  not
    -       normally  used  by  software  (and thus not counted in the
    +       Some  terminals  have  an extra `status line' which is not
    +       normally used by software (and thus  not  counted  in  the
            terminal's lines capability).
     
    -       The simplest case  is  a  status  line  which  is  cursor-
    -       addressable  but  not part of the main scrolling region on
    -       the screen; the Heathkit H19 has a  status  line  of  this
    -       kind,  as  would  a 24-line VT100 with a 23-line scrolling
    -       region set up on initialization.  This situation is  indi-
    +       The  simplest  case  is  a  status  line  which is cursor-
    +       addressable but not part of the main scrolling  region  on
    +       the  screen;  the  Heathkit  H19 has a status line of this
    +       kind, as would a 24-line VT100 with  a  23-line  scrolling
    +       region  set up on initialization.  This situation is indi-
            cated by the hs capability.
     
            Some terminals with status lines need special sequences to
    -       access the status line.   These  may  be  expressed  as  a
    +       access  the  status  line.   These  may  be expressed as a
            string with single parameter tsl which takes the cursor to
    -       a given zero-origin column on the status line.  The  capa-
    -       bility fsl must return to the main-screen cursor positions
    -       before the last tsl.  You may need  to  embed  the  string
    -       values  of sc (save cursor) and rc (restore cursor) in tsl
    -       and fsl to accomplish this.
    -
    -       The status line is normally assumed to be the  same  width
    -       as  the width of the terminal.  If this is untrue, you can
    +       a  given  zero-origin  column  on  the  status  line.  The
    +       capability fsl must return to the main-screen cursor posi-
    +       tions  before  the  last  tsl.   You may need to embed the
    +       string values of sc (save cursor) and rc (restore  cursor)
    +       in tsl and fsl to accomplish this.
    +
    +       The  status  line is normally assumed to be the same width
    +       as the width of the terminal.  If this is untrue, you  can
            specify it with the numeric capability wsl.
     
    -       A command to erase or blank the status line may be  speci-
    +       A  command to erase or blank the status line may be speci-
            fied as dsl.
     
    -       The   boolean   capability  eslok  specifies  that  escape
    +       The  boolean  capability  eslok  specifies   that   escape
            sequences, tabs, etc., work ordinarily in the status line.
     
    -       The  ncurses  implementation does not yet use any of these
    -       capabilities.  They are documented here in case they  ever
    +       The ncurses implementation does not yet use any  of  these
    +       capabilities.   They are documented here in case they ever
            become important.
     
     
        Line Graphics
    -       Many  terminals  have  alternate character sets useful for
    -       forms-drawing.  Terminfo and curses build in  support  for
    -       the  drawing  characters supported by the VT100, with some
    -       characters from the AT&T  4410v1  added.   This  alternate
    +       Many terminals have alternate character  sets  useful  for
    +       forms-drawing.   Terminfo  and curses build in support for
    +       the drawing characters supported by the VT100,  with  some
    +       characters  from  the  AT&T  4410v1 added.  This alternate
            character set may be specified by the acsc capability.
     
    +
                     Glyph             ACS            Ascii      VT100
                      Name             Name           Default    Name
            UK pound sign              ACS_STERLING   f          }
    @@ -1836,7 +1881,6 @@
            bullet                     ACS_BULLET     o          ~
            checker board (stipple)    ACS_CKBOARD    :          a
            degree symbol              ACS_DEGREE     \          f
    -
            diamond                    ACS_DIAMOND    +          `
            greater-than-or-equal-to   ACS_GEQUAL     >          z
            greek pi                   ACS_PI         *          {
    @@ -1861,60 +1905,61 @@
            upper right corner         ACS_URCORNER   +          k
            vertical line              ACS_VLINE      |          x
     
    -       The  best  way to define a new device's graphics set is to
    -       add a column to a copy of this table  for  your  terminal,
    -       giving   the   character   which   (when  emitted  between
    -       smacs/rmacs switches) will be rendered as the  correspond-
    -       ing  graphic.  Then read off the VT100/your terminal char-
    -       acter pairs right to left in sequence;  these  become  the
    +       The best way to define a new device's graphics set  is  to
    +       add  a  column  to a copy of this table for your terminal,
    +       giving  the  character   which   (when   emitted   between
    +       smacs/rmacs  switches) will be rendered as the correspond-
    +       ing graphic.  Then read off the VT100/your terminal  char-
    +       acter  pairs  right  to left in sequence; these become the
            ACSC string.
     
     
        Color Handling
    -       Most  color  terminals are either `Tektronix-like' or `HP-
    -       like'.  Tektronix-like terminals have a predefined set  of
    -       N  colors  (where N usually 8), and can set character-cell
    +       Most color terminals are either `Tektronix-like'  or  `HP-
    +       like'.   Tektronix-like terminals have a predefined set of
    +       N colors (where N usually 8), and can  set  character-cell
            foreground and background characters independently, mixing
    -       them  into  N  * N color-pairs.  On HP-like terminals, the
    +       them into N * N color-pairs.  On  HP-like  terminals,  the
            use must set each color pair up separately (foreground and
    -       background  are  not  independently  settable).   Up  to M
    -       color-pairs may be  set  up  from  2*M  different  colors.
    +       background are  not  independently  settable).   Up  to  M
    +       color-pairs  may  be  set  up  from  2*M different colors.
            ANSI-compatible terminals are Tektronix-like.
     
            Some basic color capabilities are independent of the color
            method.  The numeric capabilities colors and pairs specify
    -       the  maximum numbers of colors and color-pairs that can be
    -       displayed simultaneously.  The op (original  pair)  string
    -       resets  foreground  and background colors to their default
    -       values for the terminal.  The oc string resets all  colors
    -       or  color-pairs  to their default values for the terminal.
    -       Some terminals  (including  many  PC  terminal  emulators)
    -       erase  screen  areas  with  the  current  background color
    -       rather than the power-up default background; these  should
    +       the maximum numbers of colors and color-pairs that can  be
    +       displayed  simultaneously.   The op (original pair) string
    +       resets foreground and background colors to  their  default
    +       values  for the terminal.  The oc string resets all colors
    +       or color-pairs to their default values for  the  terminal.
    +       Some  terminals  (including  many  PC  terminal emulators)
    +       erase screen  areas  with  the  current  background  color
    +       rather  than the power-up default background; these should
            have the boolean capability bce.
     
    -       To  change the current foreground or background color on a
    -       Tektronix-type terminal, use setaf (set  ANSI  foreground)
    -       and  setab  (set ANSI background) or setf (set foreground)
    -       and setb (set background).  These take one parameter,  the
    +       To change the current foreground or background color on  a
    +       Tektronix-type  terminal,  use setaf (set ANSI foreground)
    +       and setab (set ANSI background) or setf  (set  foreground)
    +       and  setb (set background).  These take one parameter, the
            color  number.   The  SVr4  documentation  describes  only
    -       setaf/setab; the XPG4 draft says  that  "If  the  terminal
    +       setaf/setab;  the  XPG4  draft  says that "If the terminal
            supports ANSI escape sequences to set background and fore-
    -       ground, they should be coded as setaf and  setab,  respec-
    -       tively.   If  the terminal supports other escape sequences
    -       to set background and foreground, they should be coded  as
    -       setf  and  setb, respectively.  The vidputs() function and
    -       the refresh functions use setaf  and  setab  if  they  are
    +       ground,  they  should be coded as setaf and setab, respec-
    +       tively.  If the terminal supports other  escape  sequences
    +       to  set background and foreground, they should be coded as
    +       setf and setb, respectively.  The vidputs()  function  and
    +       the  refresh  functions  use  setaf  and setab if they are
            defined."
     
    -       The  setaf/setab  and setf/setb capabilities take a single
    +       The setaf/setab and setf/setb capabilities take  a  single
            numeric argument each.  Argument values 0-7 of setaf/setab
    -       are  portably defined as follows (the middle column is the
    +       are portably defined as follows (the middle column is  the
            symbolic #define available in the header for the curses or
    -       ncurses  libraries).  The terminal hardware is free to map
    -       these as it likes, but  the  RGB  values  indicate  normal
    +       ncurses libraries).  The terminal hardware is free to  map
    +       these  as  it  likes,  but  the RGB values indicate normal
            locations in color space.
     
    +
                  Color       #define       Value       RGB
                  black     COLOR_BLACK       0     0, 0, 0
                  red       COLOR_RED         1     max,0,0
    @@ -1925,8 +1970,10 @@
                  cyan      COLOR_CYAN        6     0,max,max
                  white     COLOR_WHITE       7     max,max,max
     
    -       The  argument  values of setf/setb historically correspond
    +       The argument values of setf/setb  historically  correspond
            to a different mapping, i.e.,
    +
    +
                  Color       #define       Value       RGB
                  black     COLOR_BLACK       0     0, 0, 0
                  blue      COLOR_BLUE        1     0,0,max
    @@ -1937,38 +1984,38 @@
                  yellow    COLOR_YELLOW      6     max,max,0
                  white     COLOR_WHITE       7     max,max,max
            It is important to not confuse the two sets of color capa-
    -       bilities;  otherwise  red/blue will be interchanged on the
    +       bilities; otherwise red/blue will be interchanged  on  the
            display.
     
    -       On an HP-like terminal, use scp with a  color-pair  number
    +       On  an  HP-like terminal, use scp with a color-pair number
            parameter to set which color pair is current.
     
    -       On  a  Tektronix-like  terminal, the capability ccc may be
    -       present to indicate that colors can be modified.   If  so,
    +       On a Tektronix-like terminal, the capability  ccc  may  be
    +       present  to  indicate that colors can be modified.  If so,
            the initc capability will take a color number (0 to colors
    -       - 1)and three more parameters which  describe  the  color.
    +       -  1)and  three  more parameters which describe the color.
            These three parameters default to being interpreted as RGB
    -       (Red, Green, Blue) values.  If the boolean capability  hls
    +       (Red,  Green, Blue) values.  If the boolean capability hls
            is present, they are instead as HLS (Hue, Lightness, Satu-
            ration) indices.  The ranges are terminal-dependent.
     
    -       On an HP-like terminal, initp may give  a  capability  for
    -       changing  a  color-pair value.  It will take seven parame-
    -       ters; a color-pair number (0 to max_pairs -  1),  and  two
    -       triples  describing  first  background and then foreground
    -       colors.  These parameters must be (Red,  Green,  Blue)  or
    +       On  an  HP-like  terminal, initp may give a capability for
    +       changing a color-pair value.  It will take  seven  parame-
    +       ters;  a  color-pair  number (0 to max_pairs - 1), and two
    +       triples describing first background  and  then  foreground
    +       colors.   These  parameters  must be (Red, Green, Blue) or
            (Hue, Lightness, Saturation) depending on hls.
     
    -       On  some  color terminals, colors collide with highlights.
    +       On some color terminals, colors collide  with  highlights.
            You can register these collisions with the ncv capability.
    -       This  is a bit-mask of attributes not to be used when col-
    -       ors are enabled.  The correspondence with  the  attributes
    +       This is a bit-mask of attributes not to be used when  col-
    +       ors  are  enabled.  The correspondence with the attributes
            understood by curses is as follows:
     
    +
                           Attribute      Bit   Decimal
                           A_STANDOUT     0     1
                           A_UNDERLINE    1     2
    -
                           A_REVERSE      2     4
                           A_BLINK        3     8
                           A_DIM          4     16
    @@ -1977,298 +2024,299 @@
                           A_PROTECT      7     128
                           A_ALTCHARSET   8     256
     
    -       For  example,  on  many  IBM  PC  consoles,  the underline
    -       attribute collides with the foreground color blue  and  is
    -       not  available  in  color  mode.  These should have an ncv
    +       For example,  on  many  IBM  PC  consoles,  the  underline
    +       attribute  collides  with the foreground color blue and is
    +       not available in color mode.  These  should  have  an  ncv
            capability of 2.
     
    -       SVr4 curses does nothing with ncv, ncurses  recognizes  it
    +       SVr4  curses  does nothing with ncv, ncurses recognizes it
            and optimizes the output in favor of colors.
     
     
        Miscellaneous
    -       If  the terminal requires other than a null (zero) charac-
    -       ter as a pad, then this can be given  as  pad.   Only  the
    -       first  character of the pad string is used.  If the termi-
    +       If the terminal requires other than a null (zero)  charac-
    +       ter  as  a  pad,  then this can be given as pad.  Only the
    +       first character of the pad string is used.  If the  termi-
            nal does not have a pad character, specify npc.  Note that
    -       ncurses  implements  the  termcap-compatible  PC variable;
    -       though the application may set  this  value  to  something
    -       other  than  a  null,  ncurses will test npc first and use
    +       ncurses implements  the  termcap-compatible  PC  variable;
    +       though  the  application  may  set this value to something
    +       other than a null, ncurses will test  npc  first  and  use
            napms if the terminal has no pad character.
     
    -       If the terminal can move up or down half a line, this  can
    -       be  indicated  with  hu  (half-line  up) and hd (half-line
    +       If  the terminal can move up or down half a line, this can
    +       be indicated with hu  (half-line  up)  and  hd  (half-line
            down).  This is primarily useful for superscripts and sub-
    -       scripts  on  hard-copy terminals.  If a hard-copy terminal
    -       can eject to the next page (form feed), give  this  as  ff
    +       scripts on hard-copy terminals.  If a  hard-copy  terminal
    +       can  eject  to  the next page (form feed), give this as ff
            (usually control L).
     
    -       If  there is a command to repeat a given character a given
    -       number of times (to save time transmitting a large  number
    -       of  identical  characters)  this can be indicated with the
    -       parameterized string rep.   The  first  parameter  is  the
    -       character  to  be repeated and the second is the number of
    -       times to repeat it.  Thus, tparm(repeat_char, 'x', 10)  is
    +       If there is a command to repeat a given character a  given
    +       number  of times (to save time transmitting a large number
    +       of identical characters) this can be  indicated  with  the
    +       parameterized  string  rep.   The  first  parameter is the
    +       character to be repeated and the second is the  number  of
    +       times  to repeat it.  Thus, tparm(repeat_char, 'x', 10) is
            the same as `xxxxxxxxxx'.
     
    -       If  the terminal has a settable command character, such as
    -       the TEKTRONIX 4025, this can be indicated with  cmdch.   A
    +       If the terminal has a settable command character, such  as
    +       the  TEKTRONIX  4025, this can be indicated with cmdch.  A
            prototype command character is chosen which is used in all
    -       capabilities.  This character is given in the cmdch  capa-
    -       bility  to  identify it.  The following convention is sup-
    -       ported on some UNIX systems:  The  environment  is  to  be
    -       searched  for a CC variable, and if found, all occurrences
    +       capabilities.   This character is given in the cmdch capa-
    +       bility to identify it.  The following convention  is  sup-
    +       ported  on  some  UNIX  systems:  The environment is to be
    +       searched for a CC variable, and if found, all  occurrences
            of the prototype character are replaced with the character
            in the environment variable.
     
    -       Terminal  descriptions  that  do  not represent a specific
    +       Terminal descriptions that do  not  represent  a  specific
            kind of known terminal, such as switch, dialup, patch, and
    -       network,  should  include  the  gn (generic) capability so
    -       that programs can complain that they do not  know  how  to
    -       talk  to the terminal.  (This capability does not apply to
    -       virtual  terminal  descriptions  for  which   the   escape
    +       network, should include the  gn  (generic)  capability  so
    +       that  programs  can  complain that they do not know how to
    +       talk to the terminal.  (This capability does not apply  to
    +       virtual   terminal   descriptions  for  which  the  escape
            sequences are known.)
     
    -       If  the  terminal has a ``meta key'' which acts as a shift
    -       key, setting the 8th bit  of  any  character  transmitted,
    -       this  fact  can be indicated with km.  Otherwise, software
    +       If the terminal has a ``meta key'' which acts as  a  shift
    +       key,  setting  the  8th  bit of any character transmitted,
    +       this fact can be indicated with km.   Otherwise,  software
            will assume that the 8th bit is parity and it will usually
    -       be  cleared.   If strings exist to turn this ``meta mode''
    +       be cleared.  If strings exist to turn this  ``meta  mode''
            on and off, they can be given as smm and rmm.
     
    -       If the terminal has more lines of memory than will fit  on
    -       the  screen  at once, the number of lines of memory can be
    -       indicated with lm.  A value of  lm#0  indicates  that  the
    +       If  the terminal has more lines of memory than will fit on
    +       the screen at once, the number of lines of memory  can  be
    +       indicated  with  lm.   A  value of lm#0 indicates that the
            number of lines is not fixed, but that there is still more
            memory than fits on the screen.
     
            If the terminal is one of those supported by the UNIX vir-
    -       tual  terminal  protocol, the terminal number can be given
    +       tual terminal protocol, the terminal number can  be  given
            as vt.
     
            Media copy strings which control an auxiliary printer con-
            nected to the terminal can be given as mc0: print the con-
    -       tents of the screen, mc4: turn off the printer,  and  mc5:
    -       turn  on  the  printer.   When the printer is on, all text
    -       sent to the terminal will be sent to the printer.   It  is
    +       tents  of  the screen, mc4: turn off the printer, and mc5:
    +       turn on the printer.  When the printer  is  on,  all  text
    +       sent  to  the terminal will be sent to the printer.  It is
            undefined whether the text is also displayed on the termi-
            nal screen when the printer is on.  A variation mc5p takes
            one parameter, and leaves the printer on for as many char-
    -       acters as the value  of  the  parameter,  then  turns  the
    -       printer  off.   The  parameter should not exceed 255.  All
    +       acters  as  the  value  of  the  parameter, then turns the
    +       printer off.  The parameter should not  exceed  255.   All
            text,  including  mc4,  is  transparently  passed  to  the
            printer while an mc5p is in effect.
     
     
        Glitches and Braindamage
    -       Hazeltine  terminals, which do not allow `~' characters to
    +       Hazeltine terminals, which do not allow `~' characters  to
            be displayed should indicate hz.
     
            Terminals which ignore a line-feed immediately after an am
            wrap, such as the Concept and vt100, should indicate xenl.
     
    -       If el is required to  get  rid  of  standout  (instead  of
    -       merely  writing  normal  text on top of it), xhp should be
    +       If  el  is  required  to  get  rid of standout (instead of
    +       merely writing normal text on top of it),  xhp  should  be
            given.
     
    -       Teleray terminals, where tabs turn  all  characters  moved
    -       over  to  blanks,  should  indicate xt (destructive tabs).
    -       Note:   the    variable    indicating    this    is    now
    -       `dest_tabs_magic_smso';  in  older  versions,  it was tel-
    +       Teleray  terminals,  where  tabs turn all characters moved
    +       over to blanks, should  indicate  xt  (destructive  tabs).
    +       Note:    the    variable    indicating    this    is   now
    +       `dest_tabs_magic_smso'; in older  versions,  it  was  tel-
            eray_glitch.  This glitch is also taken to mean that it is
    -       not  possible  to  position the cursor on top of a ``magic
    +       not possible to position the cursor on top  of  a  ``magic
            cookie'', that to erase standout mode it is instead neces-
            sary to use delete and insert line.  The ncurses implemen-
            tation ignores this glitch.
     
    -       The Beehive Superbee, which is unable to correctly  trans-
    -       mit  the escape or control C characters, has xsb, indicat-
    -       ing that the f1 key is used for escape and f2 for  control
    -       C.   (Only  certain Superbees have this problem, depending
    -       on the ROM.)  Note that in older terminfo  versions,  this
    -       capability   was   called   `beehive_glitch';  it  is  now
    +       The  Beehive Superbee, which is unable to correctly trans-
    +       mit the escape or control C characters, has xsb,  indicat-
    +       ing  that the f1 key is used for escape and f2 for control
    +       C.  (Only certain Superbees have this  problem,  depending
    +       on  the  ROM.)  Note that in older terminfo versions, this
    +       capability  was  called  `beehive_glitch';   it   is   now
            `no_esc_ctl_c'.
     
    -       Other specific  terminal  problems  may  be  corrected  by
    +       Other  specific  terminal  problems  may  be  corrected by
            adding more capabilities of the form xx.
     
     
        Similar Terminals
            If there are two very similar terminals, one (the variant)
    -       can be defined as being just like  the  other  (the  base)
    -       with  certain  exceptions.  In the definition of the vari-
    -       ant, the string capability use can be given with the  name
    -       of  the  base terminal.  The capabilities given before use
    -       override those in the base type named by  use.   If  there
    -       are  multiple use capabilities, they are merged in reverse
    -       order.  That is, the rightmost use reference is  processed
    -       first,  then the one to its left, and so forth.  Capabili-
    -       ties given explicitly in the entry override those  brought
    +       can  be  defined  as  being just like the other (the base)
    +       with certain exceptions.  In the definition of  the  vari-
    +       ant,  the string capability use can be given with the name
    +       of the base terminal.  The capabilities given  before  use
    +       override  those  in  the base type named by use.  If there
    +       are multiple use capabilities, they are merged in  reverse
    +       order.   That is, the rightmost use reference is processed
    +       first, then the one to its left, and so forth.   Capabili-
    +       ties  given explicitly in the entry override those brought
            in by use references.
     
            A capability can be canceled by placing xx@ to the left of
    -       the use reference that imports it, where xx is  the  capa-
    +       the  use  reference that imports it, where xx is the capa-
            bility.  For example, the entry
     
                        2621-nl, smkx@, rmkx@, use=2621,
     
    -       defines  a  2621-nl  that  does  not have the smkx or rmkx
    -       capabilities, and hence does not turn on the function  key
    -       labels  when in visual mode.  This is useful for different
    +       defines a 2621-nl that does not  have  the  smkx  or  rmkx
    +       capabilities,  and hence does not turn on the function key
    +       labels when in visual mode.  This is useful for  different
            modes for a terminal, or for different user preferences.
     
     
        Pitfalls of Long Entries
    -       Long terminfo entries are unlikely to  be  a  problem;  to
    -       date,  no  entry has even approached terminfo's 4K string-
    -       table maximum.  Unfortunately,  the  termcap  translations
    -       are  much  more  strictly  limited  (to  1K), thus termcap
    -       translations of long terminfo entries can cause  problems.
    -
    -       The  man  pages for 4.3BSD and older versions of tgetent()
    -       instruct the user to allocate a 1K buffer for the  termcap
    -       entry.   The  entry  gets  null-terminated  by the termcap
    -       library, so that makes the maximum safe length for a term-
    -       cap entry 1k-1 (1023) bytes.  Depending on what the appli-
    -       cation and the termcap library being used does, and  where
    -       in  the  termcap  file the terminal type that tgetent() is
    -       searching for is, several bad things can happen.
    -
    -       Some termcap libraries print a warning message or exit  if
    -       they  find  an entry that's longer than 1023 bytes; others
    -       don't; others truncate the entries to  1023  bytes.   Some
    +       Long  terminfo  entries  are  unlikely to be a problem; to
    +       date, no entry has even  approached  terminfo's  4096-byte
    +       string-table maximum.  Unfortunately, the termcap transla-
    +       tions are much more strictly limited (to 1023 bytes), thus
    +       termcap  translations  of  long terminfo entries can cause
    +       problems.
    +
    +       The man pages for 4.3BSD and older versions  of  tgetent()
    +       instruct  the  user to allocate a 1024-byte buffer for the
    +       termcap entry.  The  entry  gets  null-terminated  by  the
    +       termcap library, so that makes the maximum safe length for
    +       a termcap entry 1k-1 (1023) bytes.  Depending on what  the
    +       application  and  the termcap library being used does, and
    +       where in the termcap file the terminal type that tgetent()
    +       is searching for is, several bad things can happen.
    +
    +       Some  termcap libraries print a warning message or exit if
    +       they find an entry that's longer than 1023  bytes;  others
    +       do  not;  others truncate the entries to 1023 bytes.  Some
            application programs allocate more than the recommended 1K
    -       for the termcap entry; others don't.
    +       for the termcap entry; others do not.
     
            Each termcap entry has two important sizes associated with
            it: before "tc" expansion, and after "tc" expansion.  "tc"
    -       is the capability that tacks on another termcap  entry  to
    -       the  end  of  the current one, to add on its capabilities.
    -       If a termcap entry doesn't use the "tc"  capability,  then
    +       is  the  capability that tacks on another termcap entry to
    +       the end of the current one, to add  on  its  capabilities.
    +       If  a termcap entry does not use the "tc" capability, then
            of course the two lengths are the same.
     
    -       The  "before  tc  expansion"  length is the most important
    -       one, because it affects more than just users of that  par-
    -       ticular  terminal.   This is the length of the entry as it
    +       The "before tc expansion" length  is  the  most  important
    +       one,  because it affects more than just users of that par-
    +       ticular terminal.  This is the length of the entry  as  it
            exists in /etc/termcap, minus the backslash-newline pairs,
    -       which tgetent() strips out while reading it.  Some termcap
    -       libraries strip off the final newline,  too  (GNU  termcap
    +       which tgetent() strips out while reading it.  Some termcap
    +       libraries  strip  off  the final newline, too (GNU termcap
            does not).  Now suppose:
     
    -       *    a  termcap  entry  before expansion is more than 1023
    +       *    a termcap entry before expansion is  more  than  1023
                 bytes long,
     
            *    and the application has only allocated a 1k buffer,
     
    -       *    and the termcap library (like the one in  BSD/OS  1.1
    -            and  GNU)  reads  the whole entry into the buffer, no
    -            matter what its length, to see if it's the  entry  it
    +       *    and  the  termcap library (like the one in BSD/OS 1.1
    +            and GNU) reads the whole entry into  the  buffer,  no
    +            matter  what  its length, to see if it's the entry it
                 wants,
     
    -       *    and  tgetent()  is searching for a terminal type that
    +       *    and tgetent() is searching for a terminal  type  that
                 either is the long entry, appears in the termcap file
    -            after  the  long entry, or doesn't appear in the file
    -            at all (so that tgetent() has  to  search  the  whole
    +            after the long entry, or does not appear in the  file
    +            at  all  (so  that  tgetent() has to search the whole
                 termcap file).
     
    -       Then  tgetent()  will overwrite memory, perhaps its stack,
    -       and probably core dump the program.  Programs like  telnet
    -       are  particularly  vulnerable;  modern  telnets pass along
    -       values like the terminal type automatically.  The  results
    -       are  almost  as  undesirable  with a termcap library, like
    -       SunOS 4.1.3 and Ultrix 4.4, that prints  warning  messages
    -       when  it reads an overly long termcap entry.  If a termcap
    -       library truncates long entries,  like  OSF/1  3.0,  it  is
    -       immune  to  dying  here but will return incorrect data for
    +       Then tgetent() will overwrite memory, perhaps  its  stack,
    +       and  probably core dump the program.  Programs like telnet
    +       are particularly vulnerable;  modern  telnets  pass  along
    +       values  like the terminal type automatically.  The results
    +       are almost as undesirable with  a  termcap  library,  like
    +       SunOS  4.1.3  and Ultrix 4.4, that prints warning messages
    +       when it reads an overly long termcap entry.  If a  termcap
    +       library  truncates  long  entries,  like  OSF/1 3.0, it is
    +       immune to dying here but will return  incorrect  data  for
            the terminal.
     
            The "after tc expansion" length will have a similar effect
            to the above, but only for people who actually set TERM to
    -       that terminal type, since tgetent() only does "tc"  expan-
    +       that  terminal type, since tgetent() only does "tc" expan-
            sion once it's found the terminal type it was looking for,
            not while searching.
     
            In summary, a termcap entry that is longer than 1023 bytes
    -       can  cause,  on  various combinations of termcap libraries
    -       and applications, a  core  dump,  warnings,  or  incorrect
    -       operation.   If  it's too long even before "tc" expansion,
    +       can cause, on various combinations  of  termcap  libraries
    +       and  applications,  a  core  dump,  warnings, or incorrect
    +       operation.  If it's too long even before  "tc"  expansion,
            it will have this effect even for users of some other ter-
    -       minal  types and users whose TERM variable does not have a
    +       minal types and users whose TERM variable does not have  a
            termcap entry.
     
            When in -C (translate to termcap) mode, the ncurses imple-
    -       mentation  of tic(1) issues warning messages when the pre-
    -       tc length of a termcap translation is too  long.   The  -c
    -       (check)  option  also checks resolved (after tc expansion)
    +       mentation of tic(1) issues warning messages when the  pre-
    +       tc  length  of  a termcap translation is too long.  The -c
    +       (check) option also checks resolved (after  tc  expansion)
            lengths.
     
        Binary Compatibility
    -       It is not wise to count on portability of binary  terminfo
    -       entries  between commercial UNIX versions.  The problem is
    -       that there are at least two versions  of  terminfo  (under
    +       It  is not wise to count on portability of binary terminfo
    +       entries between commercial UNIX versions.  The problem  is
    +       that  there  are  at least two versions of terminfo (under
            HP-UX and AIX) which diverged from System V terminfo after
    -       SVr1, and have added extension capabilities to the  string
    -       table  that  (in  the binary format) collide with System V
    +       SVr1,  and have added extension capabilities to the string
    +       table that (in the binary format) collide  with  System  V
            and XSI Curses extensions.
     
     
     

    EXTENSIONS

    -       Some SVr4 curses  implementations,  and  all  previous  to
    -       SVr4, don't interpret the %A and %O operators in parameter
    -       strings.
    -
    -       SVr4/XPG4 do not specify whether  msgr  licenses  movement
    -       while  in an alternate-character-set mode (such modes may,
    -       among other things, map CR and NL to characters that don't
    -       trigger   local   motions).   The  ncurses  implementation
    -       ignores msgr in ALTCHARSET mode.  This raises  the  possi-
    -       bility  that  an  XPG4  implementation making the opposite
    -       interpretation may need terminfo entries made for  ncurses
    +       Some  SVr4  curses  implementations,  and  all previous to
    +       SVr4, do not interpret the %A and %O operators in  parame-
    +       ter strings.
    +
    +       SVr4/XPG4  do  not  specify whether msgr licenses movement
    +       while in an alternate-character-set mode (such modes  may,
    +       among  other  things,  map CR and NL to characters that do
    +       not trigger local motions).   The  ncurses  implementation
    +       ignores  msgr  in ALTCHARSET mode.  This raises the possi-
    +       bility that an XPG4  implementation  making  the  opposite
    +       interpretation  may need terminfo entries made for ncurses
            to have msgr turned off.
     
    -       The  ncurses  library handles insert-character and insert-
    +       The ncurses library handles insert-character  and  insert-
            character modes in a slightly non-standard way to get bet-
    -       ter  update  efficiency.   See the Insert/Delete Character
    +       ter update efficiency.  See  the  Insert/Delete  Character
            subsection above.
     
    -       The  parameter  substitutions  for  set_clock   and   dis-
    -       play_clock  are  not  documented in SVr4 or the XSI Curses
    +       The   parameter   substitutions  for  set_clock  and  dis-
    +       play_clock are not documented in SVr4 or  the  XSI  Curses
            standard.  They are deduced from the documentation for the
            AT&T 505 terminal.
     
    -       Be  careful  assigning  the kmous capability.  The ncurses
    -       wants to interpret it as KEY_MOUSE, for use  by  terminals
    -       and  emulators  like  xterm that can return mouse-tracking
    +       Be careful assigning the kmous  capability.   The  ncurses
    +       wants  to  interpret it as KEY_MOUSE, for use by terminals
    +       and emulators like xterm that  can  return  mouse-tracking
            information in the keyboard-input stream.
     
    -       Different commercial ports of terminfo and curses  support
    -       different  subsets of the XSI Curses standard and (in some
    +       Different  commercial ports of terminfo and curses support
    +       different subsets of the XSI Curses standard and (in  some
            cases) different extension sets.  Here is a summary, accu-
            rate as of October 1995:
     
            SVR4, Solaris, ncurses -- These support all SVr4 capabili-
            ties.
     
    -       SGI --  Supports  the  SVr4  set,  adds  one  undocumented
    +       SGI  --  Supports  the  SVr4  set,  adds  one undocumented
            extended string capability (set_pglen).
     
    -       SVr1,  Ultrix -- These support a restricted subset of ter-
    -       minfo capabilities.  The booleans end with  xon_xoff;  the
    -       numerics  with  width_status_line;  and  the  strings with
    +       SVr1, Ultrix -- These support a restricted subset of  ter-
    +       minfo  capabilities.   The booleans end with xon_xoff; the
    +       numerics with  width_status_line;  and  the  strings  with
            prtr_non.
     
    -       HP/UX -- Supports  the  SVr1  subset,  plus  the  SVr[234]
    +       HP/UX  --  Supports  the  SVr1  subset,  plus the SVr[234]
            numerics num_labels, label_height, label_width, plus func-
    -       tion keys 11 through 63,  plus  plab_norm,  label_on,  and
    +       tion  keys  11  through  63, plus plab_norm, label_on, and
            label_off, plus some incompatible extensions in the string
            table.
     
    -       AIX -- Supports the SVr1 subset,  plus  function  keys  11
    -       through  63,  plus  a  number of incompatible string table
    +       AIX  --  Supports  the  SVr1 subset, plus function keys 11
    +       through 63, plus a number  of  incompatible  string  table
            extensions.
     
    -       OSF -- Supports both the SVr4 set and the AIX  extensions.
    +       OSF  -- Supports both the SVr4 set and the AIX extensions.
     
     
     
    @@ -2279,17 +2327,17 @@

    SEE ALSO

    -       tic(1m), curses(3x), printf(3S), term(5).
    +       tic(1m), infocmp(1m), curses(3x), printf(3S), term(5).
     
     
     

    AUTHORS

    -       Zeyd M. Ben-Halim, Eric  S.  Raymond,  Thomas  E.  Dickey.
    +       Zeyd  M.  Ben-Halim,  Eric  S.  Raymond, Thomas E. Dickey.
            Based on pcurses by Pavel Curtis.
     
     
     
    -                                                      TERMINFO(5)
    +                                                            TERMINFO(5)
     

    diff --git a/doc/html/man/tic.1m.html b/doc/html/man/tic.1m.html index 09dc035c..7dcc24ea 100644 --- a/doc/html/man/tic.1m.html +++ b/doc/html/man/tic.1m.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -tic(1m)                                                   tic(1m)
    +tic(1m)                                                         tic(1m)
     
     
     
    @@ -86,7 +86,9 @@
                   rather than discarding them.  Capabilities are com-
                   mented by prefixing them with a period.  This  sets
                   the  -x option, because it treats the commented-out
    -              entries as user-defined names.
    +              entries as user-defined names.  If  the  source  is
    +              termcap,  accept  the 2-character names required by
    +              version 6.  Otherwise these are ignored.
     
            -C     Force source translation to termcap format.   Note:
                   this  differs  from the -C option of infocmp(1m) in
    @@ -111,8 +113,8 @@
                   alias of a terminal matches one of the names in the
                   list, the entry will be written  or  translated  as
                   normal.   Otherwise no output will be generated for
    -              it.  The option value  is  interpreted  as  a  file
    -              containing  the  list if it contains a '/'.  (Note:
    +              it.  The option value is interpreted as a file con-
    +              taining  the  list  if  it  contains a '/'.  (Note:
                   depending on how tic was compiled, this option  may
                   require -I or -C.)
     
    @@ -194,7 +196,9 @@
                   is,  if you supply a capability name which tic does
                   not recognize, it will  infer  its  type  (boolean,
                   number  or  string)  from  the  syntax  and make an
    -              extended table entry for that.
    +              extended table entry for that.  User-defined  capa-
    +              bility  strings  whose  name  begins with ``k'' are
    +              treated as function keys.
     
            file   contains one or more terminfo terminal descriptions
                   in  source format [see terminfo(5)].  Each descrip-
    @@ -215,8 +219,8 @@
     
            8      List of tokens encountered by scanner
     
    -       9      All  values  computed  in  construction of the hash
    -              table
    +       9      All values computed in construction of the hash ta-
    +              ble
     
            If the debug level n is not given, it is taken to be  one.
     
    @@ -301,7 +305,7 @@
     
     
     
    -                                                          tic(1m)
    +                                                                tic(1m)
     

    diff --git a/doc/html/man/toe.1m.html b/doc/html/man/toe.1m.html index 1eb6e729..78a31b69 100644 --- a/doc/html/man/toe.1m.html +++ b/doc/html/man/toe.1m.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -toe(1m)                                                   toe(1m)
    +toe(1m)                                                         toe(1m)
     
     
     
    @@ -107,7 +107,7 @@
     
     
     
    -                                                          toe(1m)
    +                                                                toe(1m)
     

    diff --git a/doc/html/man/tput.1.html b/doc/html/man/tput.1.html index ec8281ab..b00f3f70 100644 --- a/doc/html/man/tput.1.html +++ b/doc/html/man/tput.1.html @@ -2,7 +2,7 @@ @@ -41,7 +41,7 @@
     
    -tput(1)                                                   tput(1)
    +tput(1)                                                         tput(1)
     
     
     
    @@ -68,17 +68,28 @@
            values  of terminal-dependent capabilities and information
            available to the shell (see sh(1)), to initialize or reset
            the  terminal,  or  return  the long name of the requested
    -       terminal type.  tput outputs a  string  if  the  attribute
    -       (capability  name) is of type string, or an integer if the
    -       attribute is of type integer.  If the attribute is of type
    -       boolean, tput simply sets the exit code (0 for TRUE if the
    -       terminal has the capability, 1 for FALSE if it does  not),
    -       and  produces no output.  Before using a value returned on
    -       standard output, the user should test the exit  code  [$?,
    -       see  sh(1)]  to  be sure it is 0.  (See the EXIT CODES and
    -       DIAGNOSTICS sections.)  For a complete list  of  capabili-
    -       ties  and  the  capname  associated  with  each,  see ter-
    -       minfo(1).
    +       terminal type.  The result depends upon  the  capability's
    +       type:
    +
    +              string
    +                   tput writes the string to the standard output.
    +                   No trailing newline is supplied.
    +
    +              integer
    +                   tput writes the decimal value to the  standard
    +                   output, with a trailing newline.
    +
    +              boolean
    +                   tput  simply sets the exit code (0 for TRUE if
    +                   the terminal has the capability, 1  for  FALSE
    +                   if  it  does  not),  and writes nothing to the
    +                   standard output.
    +
    +       Before using a value returned on the standard output,  the
    +       application  should  test  the  exit  code  (e.g., $?, see
    +       sh(1)) to be sure it is 0.  (See the EXIT CODES and  DIAG-
    +       NOSTICS  sections.)   For  a complete list of capabilities
    +       and the capname associated with each, see terminfo(1).
     
            -Ttype indicates the  type  of  terminal.   Normally  this
                   option is unnecessary, because the default is taken
    @@ -88,21 +99,21 @@
                   be queried for the actual screen size.
     
            capname
    -              indicates the attribute from the terminfo database.
    -              When termcap support is compiled  in,  the  termcap
    -              name for the attribute is also accepted.
    -
    -       parms  If the attribute is a string that takes parameters,
    -              the arguments parms will be instantiated  into  the
    -              string.   An all-numeric argument will be passed to
    -              the attribute as a number.
    -
    -              Only a few  terminfo  capabilities  require  string
    -              parameters;  tput  uses  a table to decide which to
    -              pass as strings.  Normally tput uses tparm (3x)  to
    -              perform  the  substitution.   If  no parameters are
    -              given for the attribute,  tput  writes  the  string
    -              without performing the substitution.
    +              indicates   the   capability   from   the  terminfo
    +              database.  When termcap support is compiled in, the
    +              termcap name for the capability is also accepted.
    +
    +       parms  If  the  capability  is a string that takes parame-
    +              ters, the arguments parms will be instantiated into
    +              the string.
    +
    +              Most  parameters  are numbers.  Only a few terminfo
    +              capabilities require string parameters; tput uses a
    +              table to decide which to pass as strings.  Normally
    +              tput uses tparm (3x) to perform  the  substitution.
    +              If no parameters are given for the capability, tput
    +              writes   the   string   without   performing    the
    +              substitution.
     
            -S     allows  more  than one capability per invocation of
                   tput.  The capabilities must be passed to tput from
    @@ -112,9 +123,9 @@
                   and 1 boolean and string exit codes (see  the  EXIT
                   CODES section).
     
    -              Again,  tput  uses  a  table  and  the  presence of
    -              parameters in its input to decide  whether  to  use
    -              tparm (3x), and how to interpret the parameters.
    +              Again, tput uses a table and the presence of param-
    +              eters in its input to decide whether to  use  tparm
    +              (3x), and how to interpret the parameters.
     
            -V     reports  the  version  of ncurses which was used in
                   this program, and exits.
    @@ -222,12 +233,6 @@
            /usr/share/terminfo
                   compiled terminal description database
     
    -       /usr/include/curses.h
    -              curses(3x) header file
    -
    -       /usr/include/term.h
    -              terminfo header file
    -
            /usr/share/tabset/*
                   tab settings for some terminals, in a format appro-
                   priate   to  be  output  to  the  terminal  (escape
    @@ -279,6 +284,7 @@
            tput prints the following error messages and sets the cor-
            responding exit codes.
     
    +
            exit code   error message
            ---------------------------------------------------------------------
            0           (capname  is a numeric variable that is not specified in
    @@ -305,7 +311,7 @@
     
     
     
    -                                                          tput(1)
    +                                                                tput(1)
     

    diff --git a/doc/html/man/tset.1.html b/doc/html/man/tset.1.html index 0910b4ed..940cfc6f 100644 --- a/doc/html/man/tset.1.html +++ b/doc/html/man/tset.1.html @@ -1,7 +1,7 @@ @@ -40,7 +40,7 @@
     
    -tset(1)                                                   tset(1)
    +tset(1)                                                         tset(1)
     
     
     
    @@ -52,9 +52,9 @@
     
     

    SYNOPSIS

    -       tset  [-IQVqrs]  [-]  [-e ch] [-i ch] [-k ch] [-m mapping]
    +       tset  [-IQVcqrsw] [-] [-e ch] [-i ch] [-k ch] [-m mapping]
            [terminal]
    -       reset [-IQVqrs] [-] [-e ch] [-i ch] [-k ch]  [-m  mapping]
    +       reset [-IQVcqrsw] [-] [-e ch] [-i ch] [-k ch] [-m mapping]
            [terminal]
     
     
    @@ -77,23 +77,27 @@
            4. The default terminal type, ``unknown''.
     
            If  the  terminal  type  was not specified on the command-
    -       line, the -m option mappings are then applied  (see  below
    -       for  more information).  Then, if the terminal type begins
    -       with a question mark (``?''), the  user  is  prompted  for
    -       confirmation of the terminal type.  An empty response con-
    -       firms the type, or, another type can be entered to specify
    -       a  new  type.  Once the terminal type has been determined,
    -       the terminfo entry for the terminal is retrieved.   If  no
    -       terminfo entry is found for the type, the user is prompted
    -       for another terminal type.
    -
    -       Once the terminfo entry is  retrieved,  the  window  size,
    -       backspace,  interrupt and line kill characters (among many
    +       line, the -m option mappings are  then  applied  (see  the
    +       section  TERMINAL  TYPE  MAPPING  for  more  information).
    +       Then, if the terminal type begins  with  a  question  mark
    +       (``?''), the user is prompted for confirmation of the ter-
    +       minal type.  An empty  response  confirms  the  type,  or,
    +       another  type  can be entered to specify a new type.  Once
    +       the terminal type has been determined, the terminfo  entry
    +       for  the  terminal  is retrieved.  If no terminfo entry is
    +       found for the type, the user is prompted for another  ter-
    +       minal type.
    +
    +       Once  the  terminfo  entry  is retrieved, the window size,
    +       backspace, interrupt and line kill characters (among  many
            other things) are set and the terminal and tab initializa-
    -       tion  strings  are  sent  to  the  standard  error output.
    -       Finally, if the erase, interrupt and line kill  characters
    -       have  changed,  or  are  not  set to their default values,
    -       their values are displayed to the standard error output.
    +       tion strings  are  sent  to  the  standard  error  output.
    +       Finally,  if the erase, interrupt and line kill characters
    +       have changed, or are not  set  to  their  default  values,
    +       their  values  are displayed to the standard error output.
    +       Use the -c or -w option to select only the  window  sizing
    +       versus  the  other  initialization.   If neither option is
    +       given, both are assumed.
     
            When invoked as reset, tset sets cooked  and  echo  modes,
            turns  off cbreak and raw modes, turns on newline transla-
    @@ -112,34 +116,41 @@
     
            The options are as follows:
     
    -       -q   The  terminal  type is displayed to the standard out-
    -            put, and the terminal is not initialized in any  way.
    -            The option `-' by itself is equivalent but archaic.
    -
    -       -e   Set the erase character to ch.
    +       -c   Set  control  characters and modes.  -e Set the erase
    +            character to ch.
     
            -I   Do  not  send  the  terminal  or  tab  initialization
                 strings to the terminal.
     
    -       -Q   Don't display any values for the erase, interrupt and
    -            line kill characters.
    -
    -       -V   reports the version of ncurses which was used in this
    -            program, and exits.
    -
            -i   Set the interrupt character to ch.
     
            -k   Set the line kill character to ch.
     
    -       -m   Specify a mapping from a port  type  to  a  terminal.
    -            See below for more information.
    +       -m   Specify  a  mapping  from  a port type to a terminal.
    +            See the section TERMINAL TYPE MAPPING for more infor-
    +            mation.
    +
    +       -Q   Do  not  display  any values for the erase, interrupt
    +            and line kill characters.  Normally tset displays the
    +            values  for  control characters which differ from the
    +            system's default values.
    +
    +       -q   The terminal type is displayed to the  standard  out-
    +            put,  and the terminal is not initialized in any way.
    +            The option `-' by itself is equivalent but archaic.
     
            -r   Print the terminal type to the standard error output.
     
    -       -s   Print the sequence of shell  commands  to  initialize
    +       -s   Print  the  sequence  of shell commands to initialize
                 the environment variable TERM to the standard output.
    -            See the section below on setting the environment  for
    -            details.
    +            See  the section SETTING THE ENVIRONMENT for details.
    +
    +       -V   reports the version of ncurses which was used in this
    +            program, and exits.
    +
    +       -w   Resize  the  window  to  match  the  size deduced via
    +            setupterm.   Normally  this  has  no  effect,  unless
    +            setupterm is not able to detect the window size.
     
            The arguments for the -e, -i, and -k options may either be
            entered as actual characters or by using the  `hat'  nota-
    @@ -181,89 +192,88 @@
            that kind of terminal''.
     
            The argument to the -m option consists of an optional port
    -       type,   an   optional  operator,  an  optional  baud  rate
    -       specification, an optional colon (``:'') character  and  a
    -       terminal  type.   The  port type is a string (delimited by
    -       either the operator or the colon character).  The operator
    -       may  be any combination of ``>'', ``<'', ``@'', and ``!'';
    -       ``>'' means greater than, ``<''  means  less  than,  ``@''
    -       means  equal  to  and ``!'' inverts the sense of the test.
    -       The baud rate is specified as a  number  and  is  compared
    -       with  the speed of the standard error output (which should
    -       be the control terminal).  The terminal type is a  string.
    +       type, an optional operator, an optional baud rate specifi-
    +       cation, an optional colon (``:'') character and a terminal
    +       type.   The port type is a string (delimited by either the
    +       operator or the colon character).  The operator may be any
    +       combination of ``>'', ``<'', ``@'', and ``!''; ``>'' means
    +       greater than, ``<'' means less than, ``@'' means equal  to
    +       and ``!'' inverts the sense of the test.  The baud rate is
    +       specified as a number and is compared with  the  speed  of
    +       the  standard  error  output  (which should be the control
    +       terminal).  The terminal type is a string.
     
            If the terminal type is not specified on the command line,
    -       the -m mappings are applied to the terminal type.  If  the
    -       port  type  and  baud rate match the mapping, the terminal
    -       type specified in the mapping replaces the  current  type.
    -       If  more than one mapping is specified, the first applica-
    +       the  -m mappings are applied to the terminal type.  If the
    +       port type and baud rate match the  mapping,  the  terminal
    +       type  specified  in the mapping replaces the current type.
    +       If more than one mapping is specified, the first  applica-
            ble mapping is used.
     
    -       For   example,    consider    the    following    mapping:
    +       For    example,    consider    the    following   mapping:
            dialup>9600:vt100.  The port type is dialup , the operator
    -       is >, the baud rate specification is 9600, and the  termi-
    +       is  >, the baud rate specification is 9600, and the termi-
            nal type is vt100.  The result of this mapping is to spec-
            ify that if the terminal type is dialup, and the baud rate
    -       is  greater  than 9600 baud, a terminal type of vt100 will
    +       is greater than 9600 baud, a terminal type of  vt100  will
            be used.
     
            If no baud rate is specified, the terminal type will match
            any baud rate.  If no port type is specified, the terminal
    -       type  will  match  any  port  type.    For   example,   -m
    +       type   will   match   any  port  type.   For  example,  -m
            dialup:vt100  -m  :?xterm  will  cause  any  dialup  port,
            regardless of baud rate, to match the terminal type vt100,
    -       and  any  non-dialup  port type to match the terminal type
    -       ?xterm.  Note, because of the leading question  mark,  the
    -       user  will be queried on a default port as to whether they
    +       and any non-dialup port type to match  the  terminal  type
    +       ?xterm.   Note,  because of the leading question mark, the
    +       user will be queried on a default port as to whether  they
            are actually using an xterm terminal.
     
    -       No whitespace characters are permitted in  the  -m  option
    -       argument.   Also,  to avoid problems with meta-characters,
    -       it is suggested that the  entire  -m  option  argument  be
    -       placed  within single quote characters, and that csh users
    -       insert a backslash character (``\'') before  any  exclama-
    +       No  whitespace  characters  are permitted in the -m option
    +       argument.  Also, to avoid problems  with  meta-characters,
    +       it  is  suggested  that  the  entire -m option argument be
    +       placed within single quote characters, and that csh  users
    +       insert  a  backslash character (``\'') before any exclama-
            tion marks (``!'').
     
     
     

    HISTORY

    -       The  tset command appeared in BSD 3.0.  The ncurses imple-
    -       mentation was lightly adapted from the 4.4BSD sources  for
    +       The tset command appeared in BSD 3.0.  The ncurses  imple-
    +       mentation  was lightly adapted from the 4.4BSD sources for
            a terminfo environment by Eric S. Raymond <esr@snark.thyr-
            sus.com>.
     
     
     

    COMPATIBILITY

    -       The tset utility has been provided  for  backward-compati-
    -       bility  with  BSD  environments (under most modern UNIXes,
    -       /etc/inittab and getty(1) can set TERM  appropriately  for
    -       each  dial-up  line;  this  obviates  what was tset's most
    -       important use).  This implementation behaves  like  4.4BSD
    +       The  tset  utility has been provided for backward-compati-
    +       bility with BSD environments (under  most  modern  UNIXes,
    +       /etc/inittab  and  getty(1) can set TERM appropriately for
    +       each dial-up line; this  obviates  what  was  tset's  most
    +       important  use).   This implementation behaves like 4.4BSD
            tset, with a few exceptions specified here.
     
    -       The  -S  option  of BSD tset no longer works; it prints an
    +       The -S option of BSD tset no longer works;  it  prints  an
            error message to stderr and dies.  The -s option only sets
    -       TERM,  not  TERMCAP.   Both  these changes are because the
    -       TERMCAP variable is no longer  supported  under  terminfo-
    +       TERM, not TERMCAP.  Both these  changes  are  because  the
    +       TERMCAP  variable  is  no longer supported under terminfo-
            based ncurses, which makes tset -S useless (we made it die
            noisily rather than silently induce lossage).
     
    -       There was an undocumented  4.4BSD  feature  that  invoking
    +       There  was  an  undocumented  4.4BSD feature that invoking
            tset via a link named `TSET` (or via any other name begin-
    -       ning with an upper-case letter) set the  terminal  to  use
    +       ning  with  an  upper-case letter) set the terminal to use
            upper-case only.  This feature has been omitted.
     
    -       The  -A,  -E,  -h, -u and -v options were deleted from the
    -       tset utility in 4.4BSD.  None of them were  documented  in
    -       4.3BSD and all are of limited utility at best.  The -a, -,
    -       and                                                      -
    -       options  are  similarly not documented or useful, but were
    -       retained as they appear to be in widespread  use.   It  is
    -       strongly recommended that any usage of these three options
    -       be changed to use the -m option instead.   The  -n  option
    -       remains,  but has no effect.  The -adnp options are there-
    -       fore omitted from the usage summary above.
    +       The -A, -E, -h, -u and -v options were  deleted  from  the
    +       tset  utility  in 4.4BSD.  None of them were documented in
    +       4.3BSD and all are of limited utility at  best.   The  -a,
    +       -d, and -p options are similarly not documented or useful,
    +       but were retained as they appear to be in widespread  use.
    +       It  is  strongly recommended that any usage of these three
    +       options be changed to use the -m option instead.   The  -n
    +       option  remains, but has no effect.  The -adnp options are
    +       therefore omitted from the usage summary above.
     
            It is still permissible to specify  the  -e,  -i,  and  -k
            options  without arguments, although it is strongly recom-
    @@ -294,13 +304,13 @@
     
     

    SEE ALSO

    -       csh(1), sh(1), stty(1), tty(4), termcap(5), ttys(5), envi-
    -       ron(7)
    +       csh(1), sh(1), stty(1), setupterm(3), tty(4),  termcap(5),
    +       ttys(5), environ(7)
     
     
     
     
    -                                                          tset(1)
    +                                                                tset(1)
     

    diff --git a/doc/html/man/wresize.3x.html b/doc/html/man/wresize.3x.html index 1f19f09a..9367a6df 100644 --- a/doc/html/man/wresize.3x.html +++ b/doc/html/man/wresize.3x.html @@ -41,7 +41,7 @@
     
    -wresize(3x)                                           wresize(3x)
    +wresize(3x)                                                 wresize(3x)
     
     
     
    @@ -97,7 +97,7 @@
     
     
     
    -                                                      wresize(3x)
    +                                                            wresize(3x)
     

    diff --git a/doc/html/ncurses-intro.html b/doc/html/ncurses-intro.html index 89f44dc5..1f09a7c2 100644 --- a/doc/html/ncurses-intro.html +++ b/doc/html/ncurses-intro.html @@ -1,6 +1,6 @@ @@ -687,7 +687,7 @@ the first call to refresh() will clear the screen. If an error occurs a message is written to standard error and the program exits. Otherwise it returns a pointer to stdscr. A few functions may be called before initscr (slk_init(), filter(), -ripofflines(), use_env(), and, if you are using multiple +ripoffline(), use_env(), and, if you are using multiple terminals, newterm().)
    endwin()
    Your program should always call endwin() before exiting or @@ -729,7 +729,7 @@ the terminal, as other routines merely manipulate data structures. wrefresh() copies the named window to the physical terminal screen, taking into account what is already there in order to do optimizations. refresh() does a -refresh of stdscr(). Unless leaveok() has been +refresh of stdscr. Unless leaveok() has been enabled, the physical cursor of the terminal is left at the location of the window's cursor.
    doupdate() and wnoutrefresh(win) @@ -1017,7 +1017,7 @@ guarantee an entire-contents copy anywhere.

    The really clean way to handle this is to use the panels library. If, when you want a screen update, you do update_panels(), it will -do all the necessary wnoutrfresh() calls for whatever panel +do all the necessary wnoutrefresh() calls for whatever panel stacking order you have defined. Then you can do one doupdate() and there will be a single burst of physical I/O that will do all your updates. @@ -1219,10 +1219,10 @@ The general flow of control of a menu program looks like this:

  • Initialize curses.
  • Create the menu items, using new_item().
  • Create the menu using new_menu(). -
  • Post the menu using menu_post(). +
  • Post the menu using post_menu().
  • Refresh the screen.
  • Process user requests via an input loop. -
  • Unpost the menu using menu_unpost(). +
  • Unpost the menu using unpost_menu().
  • Free the menu, using free_menu().
  • Free the items using free_item().
  • Terminate curses. @@ -1305,8 +1305,8 @@ refreshed or erased at post/unpost time. The inner window or By default, both windows are stdscr. You can set them with the functions in menu_win(3x).

    -When you call menu_post(), you write the menu to its -subwindow. When you call menu_unpost(), you erase the +When you call post_menu(), you write the menu to its +subwindow. When you call unpost_menu(), you erase the subwindow, However, neither of these actually modifies the screen. To do that, call wrefresh() or some equivalent. @@ -1438,10 +1438,10 @@ The general flow of control of a form program looks like this:

  • Initialize curses.
  • Create the form fields, using new_field().
  • Create the form using new_form(). -
  • Post the form using form_post(). +
  • Post the form using post_form().
  • Refresh the screen.
  • Process user requests via an input loop. -
  • Unpost the form using form_unpost(). +
  • Unpost the form using unpost_form().
  • Free the form, using free_form().
  • Free the fields using free_field().
  • Terminate curses. @@ -1477,7 +1477,7 @@ the screen (the third and fourth arguments, which must be zero or greater). Note that these coordinates are relative to the form subwindow, which will coincide with stdscr by default but need not be stdscr if you've done an explicit -set_form_window() call.

    +set_form_win() call.

    The fifth argument allows you to specify a number of off-screen rows. If this is zero, the entire field will always be displayed. If it is diff --git a/doc/ncurses-intro.doc b/doc/ncurses-intro.doc index 26bd444b..466c2dff 100644 --- a/doc/ncurses-intro.doc +++ b/doc/ncurses-intro.doc @@ -1,4 +1,3 @@ - Writing Programs with NCURSES by Eric S. Raymond and Zeyd M. Ben-Halim @@ -609,7 +608,7 @@ Function Descriptions refresh() will clear the screen. If an error occurs a message is written to standard error and the program exits. Otherwise it returns a pointer to stdscr. A few functions may be called - before initscr (slk_init(), filter(), ripofflines(), use_env(), + before initscr (slk_init(), filter(), ripoffline(), use_env(), and, if you are using multiple terminals, newterm().) endwin() @@ -651,10 +650,9 @@ Function Descriptions the terminal, as other routines merely manipulate data structures. wrefresh() copies the named window to the physical terminal screen, taking into account what is already there in - order to do optimizations. refresh() does a refresh of - stdscr(). Unless leaveok() has been enabled, the physical - cursor of the terminal is left at the location of the window's - cursor. + order to do optimizations. refresh() does a refresh of stdscr. + Unless leaveok() has been enabled, the physical cursor of the + terminal is left at the location of the window's cursor. doupdate() and wnoutrefresh(win) These two functions allow multiple updates with more efficiency @@ -929,7 +927,7 @@ Compatibility with Older Versions The really clean way to handle this is to use the panels library. If, when you want a screen update, you do update_panels(), it will do all - the necessary wnoutrfresh() calls for whatever panel stacking order + the necessary wnoutrefresh() calls for whatever panel stacking order you have defined. Then you can do one doupdate() and there will be a single burst of physical I/O that will do all your updates. @@ -1115,10 +1113,10 @@ Overview of Menus 1. Initialize curses. 2. Create the menu items, using new_item(). 3. Create the menu using new_menu(). - 4. Post the menu using menu_post(). + 4. Post the menu using post_menu(). 5. Refresh the screen. 6. Process user requests via an input loop. - 7. Unpost the menu using menu_unpost(). + 7. Unpost the menu using unpost_menu(). 8. Free the menu, using free_menu(). 9. Free the items using free_item(). 10. Terminate curses. @@ -1198,8 +1196,8 @@ Menu Windows By default, both windows are stdscr. You can set them with the functions in menu_win(3x). - When you call menu_post(), you write the menu to its subwindow. When - you call menu_unpost(), you erase the subwindow, However, neither of + When you call post_menu(), you write the menu to its subwindow. When + you call unpost_menu(), you erase the subwindow, However, neither of these actually modifies the screen. To do that, call wrefresh() or some equivalent. @@ -1315,10 +1313,10 @@ Overview of Forms 1. Initialize curses. 2. Create the form fields, using new_field(). 3. Create the form using new_form(). - 4. Post the form using form_post(). + 4. Post the form using post_form(). 5. Refresh the screen. 6. Process user requests via an input loop. - 7. Unpost the form using form_unpost(). + 7. Unpost the form using unpost_form(). 8. Free the form, using free_form(). 9. Free the fields using free_field(). 10. Terminate curses. @@ -1350,7 +1348,7 @@ FIELD *new_field(int height, int width, /* new field size */ the screen (the third and fourth arguments, which must be zero or greater). Note that these coordinates are relative to the form subwindow, which will coincide with stdscr by default but need not be - stdscr if you've done an explicit set_form_window() call. + stdscr if you've done an explicit set_form_win() call. The fifth argument allows you to specify a number of off-screen rows. If this is zero, the entire field will always be displayed. If it is @@ -2345,9 +2343,9 @@ int form_opts(FORM *form); /* form to query */ O_NL_OVERLOAD Enable overloading of REQ_NEW_LINE as described in Editing - Requests. The value of this option is ignored on dynamic - fields that have not reached their size limit; these have no - last line, so the circumstances for triggering a REQ_NEXT_FIELD + Requests. The value of this option is ignored on dynamic fields + that have not reached their size limit; these have no last + line, so the circumstances for triggering a REQ_NEXT_FIELD never arise. O_BS_OVERLOAD diff --git a/form/Makefile.in b/form/Makefile.in index ca11c676..4b052da3 100644 --- a/form/Makefile.in +++ b/form/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.40 2003/11/01 22:44:33 tom Exp $ +# $Id: Makefile.in,v 1.41 2004/05/08 19:14:14 tom Exp $ ############################################################################## -# Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -79,8 +79,7 @@ CC = @CC@ CPP = @CPP@ CFLAGS = @CFLAGS@ -CPPFLAGS = @CPPFLAGS@ \ - -DHAVE_CONFIG_H +CPPFLAGS = -I@top_srcdir@/ncurses -DHAVE_CONFIG_H @CPPFLAGS@ CCFLAGS = $(CPPFLAGS) $(CFLAGS) @@ -116,7 +115,7 @@ LINT_OPTS = @LINT_OPTS@ LINT_LIBS = -lform -lncurses @LIBS@ AUTO_SRC = \ - ../include/form.h + ../include/form.h ################################################################################ all \ diff --git a/form/f_trace.c b/form/f_trace.c new file mode 100644 index 00000000..3bb4ccd9 --- /dev/null +++ b/form/f_trace.c @@ -0,0 +1,70 @@ +/**************************************************************************** + * Copyright (c) 2004 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey * + ****************************************************************************/ + +#include "form.priv.h" + +MODULE_ID("$Id: f_trace.c,v 1.1 2004/12/25 23:28:49 tom Exp $") + +NCURSES_EXPORT(FIELD **) +_nc_retrace_field_ptr(FIELD **code) +{ + T((T_RETURN("%p"), code)); + return code; +} + +NCURSES_EXPORT(FIELD *) +_nc_retrace_field(FIELD *code) +{ + T((T_RETURN("%p"), code)); + return code; +} + +NCURSES_EXPORT(FIELDTYPE *) +_nc_retrace_field_type(FIELDTYPE *code) +{ + T((T_RETURN("%p"), code)); + return code; +} + +NCURSES_EXPORT(FORM *) +_nc_retrace_form(FORM *code) +{ + T((T_RETURN("%p"), code)); + return code; +} + +NCURSES_EXPORT(Form_Hook) +_nc_retrace_form_hook(Form_Hook code) +{ + T((T_RETURN("%p"), code)); + return code; +} diff --git a/form/fld_arg.c b/form/fld_arg.c index e1fc2078..f79a157a 100644 --- a/form/fld_arg.c +++ b/form/fld_arg.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,16 +32,16 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_arg.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_arg.c,v 1.11 2004/12/25 22:20:18 tom Exp $") /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int set_fieldtype_arg( | FIELDTYPE *typ, | void * (* const make_arg)(va_list *), | void * (* const copy_arg)(const void *), | void (* const free_arg)(void *) ) -| +| | Description : Connects to the type additional arguments necessary | for a set_field_type call. The various function pointer | arguments are: @@ -61,34 +61,38 @@ MODULE_ID("$Id: fld_arg.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | E_BAD_ARGUMENT - invalid argument +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_fieldtype_arg - (FIELDTYPE * typ, - void * (* const make_arg)(va_list *), - void * (* const copy_arg)(const void *), - void (* const free_arg)(void *)) +set_fieldtype_arg(FIELDTYPE *typ, + void *(*const make_arg)(va_list *), + void *(*const copy_arg)(const void *), + void (*const free_arg) (void *)) { - if ( !typ || !make_arg ) - RETURN(E_BAD_ARGUMENT); + T((T_CALLED("set_fieldtype_arg(%p,%p,%p,%p)"), + typ, make_arg, copy_arg, free_arg)); - typ->status |= _HAS_ARGS; - typ->makearg = make_arg; - typ->copyarg = copy_arg; - typ->freearg = free_arg; - RETURN(E_OK); + if (typ != 0 && make_arg != (void *)0) + { + typ->status |= _HAS_ARGS; + typ->makearg = make_arg; + typ->copyarg = copy_arg; + typ->freearg = free_arg; + RETURN(E_OK); + } + RETURN(E_BAD_ARGUMENT); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : void *field_arg(const FIELD *field) -| +| | Description : Retrieve pointer to the fields argument structure. | | Return Values : Pointer to structure or NULL if none is defined. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void *) -field_arg (const FIELD * field) +field_arg(const FIELD *field) { - return Normalize_Field(field)->arg; + T((T_CALLED("field_arg(%p)"), field)); + returnVoidPtr(Normalize_Field(field)->arg); } /* fld_arg.c ends here */ diff --git a/form/fld_attr.c b/form/fld_attr.c index a7ba7659..c9c08384 100644 --- a/form/fld_attr.c +++ b/form/fld_attr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_attr.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_attr.c,v 1.10 2004/12/11 21:33:15 tom Exp $") /*---------------------------------------------------------------------------- Field-Attribute manipulation routines @@ -42,16 +42,22 @@ MODULE_ID("$Id: fld_attr.c,v 1.7 2003/10/25 15:17:08 tom Exp $") NCURSES_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\ {\ int res = E_BAD_ARGUMENT;\ + T((T_CALLED("set_field_" #name "(%p,%s)"), field, _traceattr(attr)));\ if ( attr==A_NORMAL || ((attr & A_ATTRIBUTES)==attr) )\ {\ Normalize_Field( field );\ - if ((field -> name) != attr)\ - {\ - field -> name = attr;\ - res = _nc_Synchronize_Attributes( field );\ - }\ - else\ - res = E_OK;\ + if (field != 0) \ + { \ + if ((field -> name) != attr)\ + {\ + field -> name = attr;\ + res = _nc_Synchronize_Attributes( field );\ + }\ + else\ + {\ + res = E_OK;\ + }\ + }\ }\ RETURN(res);\ } @@ -60,13 +66,14 @@ NCURSES_IMPEXP int NCURSES_API set_field_ ## name (FIELD * field, chtype attr)\ #define GEN_FIELD_ATTR_GET_FCT( name ) \ NCURSES_IMPEXP chtype NCURSES_API field_ ## name (const FIELD * field)\ {\ - return ( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\ + T((T_CALLED("field_" #name "(%p)"), field));\ + returnAttr( A_ATTRIBUTES & (Normalize_Field( field ) -> name) );\ } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int set_field_fore(FIELD *field, chtype attr) -| +| | Description : Sets the foreground of the field used to display the | field contents. | @@ -74,22 +81,22 @@ NCURSES_IMPEXP chtype NCURSES_API field_ ## name (const FIELD * field)\ | E_BAD_ARGUMENT - invalid attributes | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -GEN_FIELD_ATTR_SET_FCT( fore ) +GEN_FIELD_ATTR_SET_FCT(fore) /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : chtype field_fore(const FIELD *) -| +| | Description : Retrieve fields foreground attribute | | Return Values : The foreground attribute +--------------------------------------------------------------------------*/ -GEN_FIELD_ATTR_GET_FCT( fore ) +GEN_FIELD_ATTR_GET_FCT(fore) /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int set_field_back(FIELD *field, chtype attr) -| +| | Description : Sets the background of the field used to display the | fields extend. | @@ -97,16 +104,16 @@ GEN_FIELD_ATTR_GET_FCT( fore ) | E_BAD_ARGUMENT - invalid attributes | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -GEN_FIELD_ATTR_SET_FCT( back ) +GEN_FIELD_ATTR_SET_FCT(back) /*--------------------------------------------------------------------------- | Facility : libnform -| Function : chtype field_back(const -| +| Function : chtype field_back(const +| | Description : Retrieve fields background attribute | | Return Values : The background attribute +--------------------------------------------------------------------------*/ -GEN_FIELD_ATTR_GET_FCT( back ) +GEN_FIELD_ATTR_GET_FCT(back) /* fld_attr.c ends here */ diff --git a/form/fld_current.c b/form/fld_current.c index f4b308ad..7c3a90af 100644 --- a/form/fld_current.c +++ b/form/fld_current.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,12 +32,12 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_current.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_current.c,v 1.11 2004/12/25 22:40:13 tom Exp $") /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int set_current_field(FORM * form,FIELD * field) -| +| | Description : Set the current field of the form to the specified one. | | Return Values : E_OK - success @@ -48,46 +48,53 @@ MODULE_ID("$Id: fld_current.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_current_field (FORM * form, FIELD * field) +set_current_field(FORM *form, FIELD *field) { int err = E_OK; - if ( !form || !field ) - RETURN(E_BAD_ARGUMENT); - - if ( (form != field->form) || Field_Is_Not_Selectable(field) ) - RETURN(E_REQUEST_DENIED); - - if (!(form->status & _POSTED)) + T((T_CALLED("set_current_field(%p,%p)"), form, field)); + if (form == 0 || field == 0) + { + RETURN(E_BAD_ARGUMENT); + } + else if ((form != field->form) || Field_Is_Not_Selectable(field)) + { + RETURN(E_REQUEST_DENIED); + } + else if ((form->status & _POSTED) == 0) { form->current = field; form->curpage = field->page; - } + } else { - if (form->status & _IN_DRIVER) - err = E_BAD_STATE; + if ((form->status & _IN_DRIVER) != 0) + { + err = E_BAD_STATE; + } else { if (form->current != field) { - if (!_nc_Internal_Validation(form)) - err = E_INVALID_FIELD; + if (!_nc_Internal_Validation(form)) + { + err = E_INVALID_FIELD; + } else { - Call_Hook(form,fieldterm); + Call_Hook(form, fieldterm); if (field->page != form->curpage) { - Call_Hook(form,formterm); - err = _nc_Set_Form_Page(form,field->page,field); - Call_Hook(form,forminit); - } - else + Call_Hook(form, formterm); + err = _nc_Set_Form_Page(form, (int)field->page, field); + Call_Hook(form, forminit); + } + else { - err = _nc_Set_Current_Field(form,field); + err = _nc_Set_Current_Field(form, field); } - Call_Hook(form,fieldinit); - _nc_Refresh_Current_Field(form); + Call_Hook(form, fieldinit); + (void)_nc_Refresh_Current_Field(form); } } } @@ -96,23 +103,24 @@ set_current_field (FORM * form, FIELD * field) } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : FIELD *current_field(const FORM * form) -| +| | Description : Return the current field. | | Return Values : Pointer to the current field. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(FIELD *) -current_field (const FORM * form) +current_field(const FORM *form) { - return Normalize_Form(form)->current; + T((T_CALLED("current_field(%p)"), form)); + returnField(Normalize_Form(form)->current); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int field_index(const FIELD * field) -| +| | Description : Return the index of the field in the field-array of | the form. | @@ -120,9 +128,10 @@ current_field (const FORM * form) | -1 : fieldpointer invalid or field not connected +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -field_index (const FIELD * field) +field_index(const FIELD *field) { - return ( (field && field->form) ? field->index : -1 ); + T((T_CALLED("field_index(%p)"), field)); + returnCode((field != 0 && field->form != 0) ? (int)field->index : -1); } /* fld_current.c ends here */ diff --git a/form/fld_def.c b/form/fld_def.c index 32dc11ee..dc023795 100644 --- a/form/fld_def.c +++ b/form/fld_def.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,291 +32,319 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_def.c,v 1.17 2003/11/08 21:15:02 Jonathon.Gray Exp $") +MODULE_ID("$Id: fld_def.c,v 1.33 2005/04/16 17:31:17 tom Exp $") /* this can't be readonly */ -static FIELD default_field = { - 0, /* status */ - 0, /* rows */ - 0, /* cols */ - 0, /* frow */ - 0, /* fcol */ - 0, /* drows */ - 0, /* dcols */ - 0, /* maxgrow*/ - 0, /* nrow */ - 0, /* nbuf */ - NO_JUSTIFICATION, /* just */ - 0, /* page */ - 0, /* index */ - (int)' ', /* pad */ - A_NORMAL, /* fore */ - A_NORMAL, /* back */ - ALL_FIELD_OPTS, /* opts */ - (FIELD *)0, /* snext */ - (FIELD *)0, /* sprev */ - (FIELD *)0, /* link */ - (FORM *)0, /* form */ - (FIELDTYPE *)0, /* type */ - (char *)0, /* arg */ - (char *)0, /* buf */ - (char *)0 /* usrptr */ +static FIELD default_field = +{ + 0, /* status */ + 0, /* rows */ + 0, /* cols */ + 0, /* frow */ + 0, /* fcol */ + 0, /* drows */ + 0, /* dcols */ + 0, /* maxgrow */ + 0, /* nrow */ + 0, /* nbuf */ + NO_JUSTIFICATION, /* just */ + 0, /* page */ + 0, /* index */ + (int)' ', /* pad */ + A_NORMAL, /* fore */ + A_NORMAL, /* back */ + ALL_FIELD_OPTS, /* opts */ + (FIELD *)0, /* snext */ + (FIELD *)0, /* sprev */ + (FIELD *)0, /* link */ + (FORM *)0, /* form */ + (FIELDTYPE *)0, /* type */ + (char *)0, /* arg */ + (FIELD_CELL *)0, /* buf */ + (char *)0 /* usrptr */ + NCURSES_FIELD_EXTENSION }; -NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field = &default_field; - +NCURSES_EXPORT_VAR(FIELD *) +_nc_Default_Field = &default_field; + /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : TypeArgument *_nc_Make_Argument( | const FIELDTYPE *typ, | va_list *ap, | int *err ) -| +| | Description : Create an argument structure for the specified type. | Use the type-dependent argument list to construct | it. | | Return Values : Pointer to argument structure. Maybe NULL. -| In case of an error in *err an error counter is increased. +| In case of an error in *err an error counter is increased. +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(TypeArgument*) -_nc_Make_Argument -(const FIELDTYPE *typ, va_list *ap, int *err) +NCURSES_EXPORT(TypeArgument *) +_nc_Make_Argument(const FIELDTYPE *typ, va_list *ap, int *err) { - TypeArgument *res = (TypeArgument *)0; + TypeArgument *res = (TypeArgument *)0; TypeArgument *p; - if (typ && (typ->status & _HAS_ARGS)) + if (typ != 0 && (typ->status & _HAS_ARGS) != 0) { - assert(err && ap); - if (typ->status & _LINKED_TYPE) + assert(err != 0 && ap != (va_list *)0); + if ((typ->status & _LINKED_TYPE) != 0) { p = (TypeArgument *)malloc(sizeof(TypeArgument)); - if (p) + + if (p != 0) { - p->left = _nc_Make_Argument(typ->left ,ap,err); - p->right = _nc_Make_Argument(typ->right,ap,err); + p->left = _nc_Make_Argument(typ->left, ap, err); + p->right = _nc_Make_Argument(typ->right, ap, err); return p; } else - *err += 1; - } else + { + *err += 1; + } + } + else { - assert(typ->makearg); - if ( !(res=(TypeArgument *)typ->makearg(ap)) ) - *err += 1; + assert(typ->makearg != (void *)0); + if (!(res = (TypeArgument *)typ->makearg(ap))) + { + *err += 1; + } } } return res; } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : TypeArgument *_nc_Copy_Argument(const FIELDTYPE *typ, | const TypeArgument *argp, | int *err ) -| -| Description : Create a copy of an argument structure for the specified +| +| Description : Create a copy of an argument structure for the specified | type. | | Return Values : Pointer to argument structure. Maybe NULL. -| In case of an error in *err an error counter is increased. +| In case of an error in *err an error counter is increased. +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(TypeArgument*) -_nc_Copy_Argument - (const FIELDTYPE *typ, - const TypeArgument *argp, int *err) +NCURSES_EXPORT(TypeArgument *) +_nc_Copy_Argument(const FIELDTYPE *typ, const TypeArgument *argp, int *err) { TypeArgument *res = (TypeArgument *)0; TypeArgument *p; - if ( typ && (typ->status & _HAS_ARGS) ) + if (typ != 0 && (typ->status & _HAS_ARGS) != 0) { - assert(err && argp); - if (typ->status & _LINKED_TYPE) + assert(err != 0 && argp != 0); + if ((typ->status & _LINKED_TYPE) != 0) { p = (TypeArgument *)malloc(sizeof(TypeArgument)); - if (p) + + if (p != 0) { - p->left = _nc_Copy_Argument(typ,argp->left ,err); - p->right = _nc_Copy_Argument(typ,argp->right,err); + p->left = _nc_Copy_Argument(typ, argp->left, err); + p->right = _nc_Copy_Argument(typ, argp->right, err); return p; } *err += 1; - } - else + } + else { - if (typ->copyarg) + if (typ->copyarg != (void *)0) { - if (!(res = (TypeArgument *)(typ->copyarg((const void *)argp)))) - *err += 1; + if (!(res = (TypeArgument *)(typ->copyarg((const void *)argp)))) + { + *err += 1; + } } else - res = (TypeArgument *)argp; + { + res = (TypeArgument *)argp; + } } } return res; } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : void _nc_Free_Argument(const FIELDTYPE *typ, | TypeArgument * argp ) -| +| | Description : Release memory associated with the argument structure | for the given fieldtype. | | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void) -_nc_Free_Argument -(const FIELDTYPE * typ, TypeArgument * argp) +_nc_Free_Argument(const FIELDTYPE *typ, TypeArgument *argp) { - if (!typ || !(typ->status & _HAS_ARGS)) - return; - - if (typ->status & _LINKED_TYPE) - { - assert(argp); - _nc_Free_Argument(typ->left ,argp->left ); - _nc_Free_Argument(typ->right,argp->right); - free(argp); - } - else + if (typ != 0 && (typ->status & _HAS_ARGS) != 0) { - if (typ->freearg) - typ->freearg((void *)argp); + if ((typ->status & _LINKED_TYPE) != 0) + { + assert(argp != 0); + _nc_Free_Argument(typ->left, argp->left); + _nc_Free_Argument(typ->right, argp->right); + free(argp); + } + else + { + if (typ->freearg != (void *)0) + { + typ->freearg((void *)argp); + } + } } } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : bool _nc_Copy_Type( FIELD *dst, FIELD const *src ) -| +| | Description : Copy argument structure of field src to field dst | | Return Values : TRUE - copy worked | FALSE - error occurred +--------------------------------------------------------------------------*/ NCURSES_EXPORT(bool) -_nc_Copy_Type -(FIELD *dst, FIELD const *src) +_nc_Copy_Type(FIELD *dst, FIELD const *src) { int err = 0; - assert(dst && src); + assert(dst != 0 && src != 0); dst->type = src->type; - dst->arg = (void *)_nc_Copy_Argument(src->type,(TypeArgument *)(src->arg),&err); + dst->arg = (void *)_nc_Copy_Argument(src->type, (TypeArgument *)(src->arg), &err); - if (err) + if (err != 0) { - _nc_Free_Argument(dst->type,(TypeArgument *)(dst->arg)); + _nc_Free_Argument(dst->type, (TypeArgument *)(dst->arg)); dst->type = (FIELDTYPE *)0; - dst->arg = (void *)0; + dst->arg = (void *)0; return FALSE; } else { - if (dst->type) - dst->type->ref++; + if (dst->type != 0) + { + dst->type->ref++; + } return TRUE; } } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : void _nc_Free_Type( FIELD *field ) -| +| | Description : Release Argument structure for this field | | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void) -_nc_Free_Type (FIELD *field) +_nc_Free_Type(FIELD *field) { - assert(field); - if (field->type) - field->type->ref--; - _nc_Free_Argument(field->type,(TypeArgument *)(field->arg)); + assert(field != 0); + if (field->type != 0) + { + field->type->ref--; + } + _nc_Free_Argument(field->type, (TypeArgument *)(field->arg)); } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : FIELD *new_field( int rows, int cols, +| Facility : libnform +| Function : FIELD *new_field( int rows, int cols, | int frow, int fcol, | int nrow, int nbuf ) -| +| | Description : Create a new field with this many 'rows' and 'cols', | starting at 'frow/fcol' in the subwindow of the form. | Allocate 'nrow' off-screen rows and 'nbuf' additional | buffers. If an error occurs, errno is set to -| +| | E_BAD_ARGUMENT - invalid argument | E_SYSTEM_ERROR - system error | | Return Values : Pointer to the new field or NULL if failure. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(FIELD *) -new_field -(int rows, int cols, int frow, int fcol, int nrow, int nbuf) +new_field(int rows, int cols, int frow, int fcol, int nrow, int nbuf) { + static const FIELD_CELL blank = BLANK; + static const FIELD_CELL zeros = ZEROS; + FIELD *New_Field = (FIELD *)0; int err = E_BAD_ARGUMENT; - if (rows>0 && - cols>0 && - frow>=0 && - fcol>=0 && - nrow>=0 && - nbuf>=0 && - ((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */ - (New_Field=(FIELD *)malloc(sizeof(FIELD))) ) + T((T_CALLED("new_field(%d,%d,%d,%d,%d,%d)"), rows, cols, frow, fcol, nrow, nbuf)); + if (rows > 0 && + cols > 0 && + frow >= 0 && + fcol >= 0 && + nrow >= 0 && + nbuf >= 0 && + ((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */ + (New_Field = (FIELD *)malloc(sizeof(FIELD))) != 0) { - *New_Field = default_field; - New_Field->rows = rows; - New_Field->cols = cols; + *New_Field = default_field; + New_Field->rows = rows; + New_Field->cols = cols; New_Field->drows = rows + nrow; New_Field->dcols = cols; - New_Field->frow = frow; - New_Field->fcol = fcol; - New_Field->nrow = nrow; - New_Field->nbuf = nbuf; - New_Field->link = New_Field; + New_Field->frow = frow; + New_Field->fcol = fcol; + New_Field->nrow = nrow; + New_Field->nbuf = nbuf; + New_Field->link = New_Field; + +#if USE_WIDEC_SUPPORT + New_Field->working = newpad(1, Buffer_Length(New_Field) + 1); + New_Field->expanded = (char **)calloc(1 + (unsigned)rows, sizeof(char *)); +#endif - if (_nc_Copy_Type(New_Field,&default_field)) + if (_nc_Copy_Type(New_Field, &default_field)) { size_t len; len = Total_Buffer_Size(New_Field); - if ((New_Field->buf = (char *)malloc(len))) + if ((New_Field->buf = (FIELD_CELL *)malloc(len))) { /* Prefill buffers with blanks and insert terminating zeroes - between buffers */ - int i; + between buffers */ + int i, j; + int cells = Buffer_Length(New_Field); - memset(New_Field->buf,' ',len); - for(i=0;i<=New_Field->nbuf;i++) + for (i = 0; i <= New_Field->nbuf; i++) { - New_Field->buf[(New_Field->drows*New_Field->cols+1)*(i+1)-1] - = '\0'; + FIELD_CELL *buffer = &(New_Field->buf[(cells + 1) * i]); + + for (j = 0; j < cells; ++j) + { + buffer[j] = blank; + } + buffer[j] = zeros; } - return New_Field; + returnField(New_Field); } } } - if (New_Field) + if (New_Field) free_field(New_Field); - - SET_ERROR( err ); - return (FIELD *)0; + + SET_ERROR(err); + returnField((FIELD *)0); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int free_field( FIELD *field ) -| +| | Description : Frees the storage allocated for the field. | | Return Values : E_OK - success @@ -324,28 +352,45 @@ new_field | E_CONNECTED - field is connected +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -free_field (FIELD * field) +free_field(FIELD *field) { - if (!field) - RETURN(E_BAD_ARGUMENT); - - if (field->form) - RETURN(E_CONNECTED); - - if (field == field->link) + T((T_CALLED("free_field(%p)"), field)); + if (!field) { - if (field->buf) + RETURN(E_BAD_ARGUMENT); + } + else if (field->form != 0) + { + RETURN(E_CONNECTED); + } + else if (field == field->link) + { + if (field->buf != 0) free(field->buf); } - else + else { FIELD *f; - for(f=field;f->link != field;f = f->link) - {} + for (f = field; f->link != field; f = f->link) + { + } f->link = field->link; } _nc_Free_Type(field); +#if USE_WIDEC_SUPPORT + if (field->expanded != 0) + { + int n; + + for (n = 0; n <= field->nbuf; ++n) + { + FreeIfNeeded(field->expanded[n]); + } + free(field->expanded); + (void)delwin(field->working); + } +#endif free(field); RETURN(E_OK); } diff --git a/form/fld_dup.c b/form/fld_dup.c index d16e4009..2ffcd367 100644 --- a/form/fld_dup.c +++ b/form/fld_dup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,67 +32,69 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_dup.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_dup.c,v 1.10 2004/12/25 22:24:10 tom Exp $") /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : FIELD *dup_field(FIELD *field, int frow, int fcol) -| +| | Description : Duplicates the field at the specified position. All | field attributes and the buffers are copied. | If an error occurs, errno is set to -| +| | E_BAD_ARGUMENT - invalid argument | E_SYSTEM_ERROR - system error | | Return Values : Pointer to the new field or NULL if failure +--------------------------------------------------------------------------*/ NCURSES_EXPORT(FIELD *) -dup_field (FIELD * field, int frow, int fcol) +dup_field(FIELD *field, int frow, int fcol) { FIELD *New_Field = (FIELD *)0; int err = E_BAD_ARGUMENT; - if (field && (frow>=0) && (fcol>=0) && - ((err=E_SYSTEM_ERROR) != 0) && /* trick : this resets the default error */ - (New_Field=(FIELD *)malloc(sizeof(FIELD))) ) + T((T_CALLED("dup_field(%p,%d,%d)"), field, frow, fcol)); + if (field && (frow >= 0) && (fcol >= 0) && + ((err = E_SYSTEM_ERROR) != 0) && /* trick : this resets the default error */ + (New_Field = (FIELD *)malloc(sizeof(FIELD)))) { - *New_Field = *_nc_Default_Field; - New_Field->frow = frow; - New_Field->fcol = fcol; - New_Field->link = New_Field; - New_Field->rows = field->rows; - New_Field->cols = field->cols; - New_Field->nrow = field->nrow; - New_Field->drows = field->drows; - New_Field->dcols = field->dcols; + *New_Field = *_nc_Default_Field; + New_Field->frow = frow; + New_Field->fcol = fcol; + New_Field->link = New_Field; + New_Field->rows = field->rows; + New_Field->cols = field->cols; + New_Field->nrow = field->nrow; + New_Field->drows = field->drows; + New_Field->dcols = field->dcols; New_Field->maxgrow = field->maxgrow; - New_Field->nbuf = field->nbuf; - New_Field->just = field->just; - New_Field->fore = field->fore; - New_Field->back = field->back; - New_Field->pad = field->pad; - New_Field->opts = field->opts; - New_Field->usrptr = field->usrptr; + New_Field->nbuf = field->nbuf; + New_Field->just = field->just; + New_Field->fore = field->fore; + New_Field->back = field->back; + New_Field->pad = field->pad; + New_Field->opts = field->opts; + New_Field->usrptr = field->usrptr; - if (_nc_Copy_Type(New_Field,field)) + if (_nc_Copy_Type(New_Field, field)) { - size_t len; + size_t i, len; len = Total_Buffer_Size(New_Field); - if ( (New_Field->buf=(char *)malloc(len)) ) + if ((New_Field->buf = (FIELD_CELL *)malloc(len))) { - memcpy(New_Field->buf,field->buf,len); - return New_Field; + for (i = 0; i < len; ++i) + New_Field->buf[i] = field->buf[i]; + returnField(New_Field); } } } - if (New_Field) + if (New_Field) free_field(New_Field); SET_ERROR(err); - return (FIELD *)0; + returnField((FIELD *)0); } /* fld_dup.c ends here */ diff --git a/form/fld_ftchoice.c b/form/fld_ftchoice.c index 5102636f..9237f96d 100644 --- a/form/fld_ftchoice.c +++ b/form/fld_ftchoice.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_ftchoice.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_ftchoice.c,v 1.9 2004/12/11 21:44:57 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -47,12 +47,13 @@ MODULE_ID("$Id: fld_ftchoice.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | E_BAD_ARGUMENT - invalid arguments +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_fieldtype_choice - (FIELDTYPE * typ, - bool (* const next_choice) (FIELD *,const void *), - bool (* const prev_choice) (FIELD *,const void *)) +set_fieldtype_choice(FIELDTYPE *typ, + bool (*const next_choice) (FIELD *, const void *), + bool (*const prev_choice) (FIELD *, const void *)) { - if ( !typ || !next_choice || !prev_choice ) + T((T_CALLED("set_fieldtype_choice(%p,%p,%p)"), typ, next_choice, prev_choice)); + + if (!typ || !next_choice || !prev_choice) RETURN(E_BAD_ARGUMENT); typ->status |= _HAS_CHOICE; diff --git a/form/fld_ftlink.c b/form/fld_ftlink.c index dfd8110e..ce6014db 100644 --- a/form/fld_ftlink.c +++ b/form/fld_ftlink.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_ftlink.c,v 1.8 2003/11/08 20:45:36 tom Exp $") +MODULE_ID("$Id: fld_ftlink.c,v 1.11 2004/12/25 22:24:10 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -49,37 +49,38 @@ MODULE_ID("$Id: fld_ftlink.c,v 1.8 2003/11/08 20:45:36 tom Exp $") | Return Values : Fieldtype pointer or NULL if error occurred. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(FIELDTYPE *) -link_fieldtype -(FIELDTYPE * type1, FIELDTYPE * type2) +link_fieldtype(FIELDTYPE *type1, FIELDTYPE *type2) { FIELDTYPE *nftyp = (FIELDTYPE *)0; - if ( type1 && type2 ) + T((T_CALLED("link_fieldtype(%p,%p)"), type1, type2)); + if (type1 && type2) { nftyp = (FIELDTYPE *)malloc(sizeof(FIELDTYPE)); + if (nftyp) { *nftyp = *_nc_Default_FieldType; nftyp->status |= _LINKED_TYPE; - if ((type1->status & _HAS_ARGS) || (type2->status & _HAS_ARGS) ) + if ((type1->status & _HAS_ARGS) || (type2->status & _HAS_ARGS)) nftyp->status |= _HAS_ARGS; - if ((type1->status & _HAS_CHOICE) || (type2->status & _HAS_CHOICE) ) + if ((type1->status & _HAS_CHOICE) || (type2->status & _HAS_CHOICE)) nftyp->status |= _HAS_CHOICE; - nftyp->left = type1; - nftyp->right = type2; + nftyp->left = type1; + nftyp->right = type2; type1->ref++; type2->ref++; } else { - SET_ERROR( E_SYSTEM_ERROR ); + SET_ERROR(E_SYSTEM_ERROR); } } else { - SET_ERROR( E_BAD_ARGUMENT ); + SET_ERROR(E_BAD_ARGUMENT); } - return nftyp; + returnFieldType(nftyp); } /* fld_ftlink.c ends here */ diff --git a/form/fld_info.c b/form/fld_info.c index bdd2de57..324198c4 100644 --- a/form/fld_info.c +++ b/form/fld_info.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_info.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_info.c,v 1.10 2004/12/11 22:24:57 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -47,24 +47,35 @@ MODULE_ID("$Id: fld_info.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | E_BAD_ARGUMENT - invalid field pointer +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -field_info - (const FIELD *field, - int *rows, int *cols, - int *frow, int *fcol, - int *nrow, int *nbuf) +field_info(const FIELD *field, + int *rows, int *cols, + int *frow, int *fcol, + int *nrow, int *nbuf) { - if (!field) + T((T_CALLED("field_info(%p,%p,%p,%p,%p,%p,%p)"), + field, + rows, cols, + frow, fcol, + nrow, nbuf)); + + if (!field) RETURN(E_BAD_ARGUMENT); - if (rows) *rows = field->rows; - if (cols) *cols = field->cols; - if (frow) *frow = field->frow; - if (fcol) *fcol = field->fcol; - if (nrow) *nrow = field->nrow; - if (nbuf) *nbuf = field->nbuf; + if (rows) + *rows = field->rows; + if (cols) + *cols = field->cols; + if (frow) + *frow = field->frow; + if (fcol) + *fcol = field->fcol; + if (nrow) + *nrow = field->nrow; + if (nbuf) + *nbuf = field->nbuf; RETURN(E_OK); } - + /*--------------------------------------------------------------------------- | Facility : libnform | Function : int dynamic_field_info(const FIELD *field, @@ -78,15 +89,19 @@ field_info | E_BAD_ARGUMENT - invalid argument +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -dynamic_field_info -(const FIELD *field, int *drows, int *dcols, int *maxgrow) +dynamic_field_info(const FIELD *field, int *drows, int *dcols, int *maxgrow) { + T((T_CALLED("dynamic_field_info(%p,%p,%p,%p)"), field, drows, dcols, maxgrow)); + if (!field) RETURN(E_BAD_ARGUMENT); - if (drows) *drows = field->drows; - if (dcols) *dcols = field->dcols; - if (maxgrow) *maxgrow = field->maxgrow; + if (drows) + *drows = field->drows; + if (dcols) + *dcols = field->dcols; + if (maxgrow) + *maxgrow = field->maxgrow; RETURN(E_OK); } diff --git a/form/fld_just.c b/form/fld_just.c index 064a9fbc..e021fb1c 100644 --- a/form/fld_just.c +++ b/form/fld_just.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_just.c,v 1.8 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_just.c,v 1.11 2004/12/11 22:55:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -45,20 +45,22 @@ MODULE_ID("$Id: fld_just.c,v 1.8 2003/10/25 15:17:08 tom Exp $") | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_field_just (FIELD * field, int just) +set_field_just(FIELD *field, int just) { int res = E_BAD_ARGUMENT; - if ((just==NO_JUSTIFICATION) || - (just==JUSTIFY_LEFT) || - (just==JUSTIFY_CENTER) || - (just==JUSTIFY_RIGHT) ) + T((T_CALLED("set_field_just(%p,%d)"), field, just)); + + if ((just == NO_JUSTIFICATION) || + (just == JUSTIFY_LEFT) || + (just == JUSTIFY_CENTER) || + (just == JUSTIFY_RIGHT)) { - Normalize_Field( field ); + Normalize_Field(field); if (field->just != just) { field->just = just; - res = _nc_Synchronize_Attributes( field ); + res = _nc_Synchronize_Attributes(field); } else res = E_OK; @@ -75,9 +77,10 @@ set_field_just (FIELD * field, int just) | Return Values : The justification type. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -field_just (const FIELD * field) +field_just(const FIELD *field) { - return Normalize_Field( field )->just; + T((T_CALLED("field_just(%p)"), field)); + returnCode(Normalize_Field(field)->just); } /* fld_just.c ends here */ diff --git a/form/fld_link.c b/form/fld_link.c index b3cad0c3..f1516640 100644 --- a/form/fld_link.c +++ b/form/fld_link.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_link.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_link.c,v 1.9 2004/12/25 22:24:10 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -49,43 +49,47 @@ MODULE_ID("$Id: fld_link.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | Return Values : Pointer to the new field or NULL if failure +--------------------------------------------------------------------------*/ NCURSES_EXPORT(FIELD *) -link_field (FIELD * field, int frow, int fcol) +link_field(FIELD *field, int frow, int fcol) { FIELD *New_Field = (FIELD *)0; int err = E_BAD_ARGUMENT; - if (field && (frow>=0) && (fcol>=0) && - ((err=E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */ - (New_Field = (FIELD *)malloc(sizeof(FIELD))) ) + T((T_CALLED("link_field(%p,%d,%d)"), field, frow, fcol)); + if (field && (frow >= 0) && (fcol >= 0) && + ((err = E_SYSTEM_ERROR) != 0) && /* trick: this resets the default error */ + (New_Field = (FIELD *)malloc(sizeof(FIELD)))) { - *New_Field = *_nc_Default_Field; - New_Field->frow = frow; - New_Field->fcol = fcol; - New_Field->link = field->link; - field->link = New_Field; - New_Field->buf = field->buf; - New_Field->rows = field->rows; - New_Field->cols = field->cols; - New_Field->nrow = field->nrow; - New_Field->nbuf = field->nbuf; - New_Field->drows = field->drows; - New_Field->dcols = field->dcols; - New_Field->maxgrow= field->maxgrow; - New_Field->just = field->just; - New_Field->fore = field->fore; - New_Field->back = field->back; - New_Field->pad = field->pad; - New_Field->opts = field->opts; + *New_Field = *_nc_Default_Field; + New_Field->frow = frow; + New_Field->fcol = fcol; + + New_Field->link = field->link; + field->link = New_Field; + + New_Field->buf = field->buf; + New_Field->rows = field->rows; + New_Field->cols = field->cols; + New_Field->nrow = field->nrow; + New_Field->nbuf = field->nbuf; + New_Field->drows = field->drows; + New_Field->dcols = field->dcols; + New_Field->maxgrow = field->maxgrow; + New_Field->just = field->just; + New_Field->fore = field->fore; + New_Field->back = field->back; + New_Field->pad = field->pad; + New_Field->opts = field->opts; New_Field->usrptr = field->usrptr; - if (_nc_Copy_Type(New_Field,field)) - return New_Field; + + if (_nc_Copy_Type(New_Field, field)) + returnField(New_Field); } - if (New_Field) + if (New_Field) free_field(New_Field); - SET_ERROR( err ); - return (FIELD *)0; + SET_ERROR(err); + returnField((FIELD *)0); } /* fld_link.c ends here */ diff --git a/form/fld_max.c b/form/fld_max.c index 37521dc1..7f5352e0 100644 --- a/form/fld_max.c +++ b/form/fld_max.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_max.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_max.c,v 1.9 2004/12/11 21:51:54 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -45,17 +45,19 @@ MODULE_ID("$Id: fld_max.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | E_BAD_ARGUMENT - invalid argument +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_max_field (FIELD *field, int maxgrow) +set_max_field(FIELD *field, int maxgrow) { - if (!field || (maxgrow<0)) + T((T_CALLED("set_max_field(%p,%d)"), field, maxgrow)); + + if (!field || (maxgrow < 0)) RETURN(E_BAD_ARGUMENT); else { bool single_line_field = Single_Line_Field(field); - if (maxgrow>0) + if (maxgrow > 0) { - if (( single_line_field && (maxgrow < field->dcols)) || + if ((single_line_field && (maxgrow < field->dcols)) || (!single_line_field && (maxgrow < field->drows))) RETURN(E_BAD_ARGUMENT); } @@ -63,13 +65,13 @@ set_max_field (FIELD *field, int maxgrow) field->status &= ~_MAY_GROW; if (!(field->opts & O_STATIC)) { - if ((maxgrow==0) || - ( single_line_field && (field->dcols < maxgrow)) || + if ((maxgrow == 0) || + (single_line_field && (field->dcols < maxgrow)) || (!single_line_field && (field->drows < maxgrow))) field->status |= _MAY_GROW; } } RETURN(E_OK); } - + /* fld_max.c ends here */ diff --git a/form/fld_move.c b/form/fld_move.c index 245aa7c7..d9ceaaec 100644 --- a/form/fld_move.c +++ b/form/fld_move.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_move.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_move.c,v 1.9 2004/12/11 21:52:44 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,12 +46,14 @@ MODULE_ID("$Id: fld_move.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | E_CONNECTED - field is connected +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -move_field (FIELD *field, int frow, int fcol) +move_field(FIELD *field, int frow, int fcol) { - if ( !field || (frow<0) || (fcol<0) ) + T((T_CALLED("move_field(%p,%d,%d)"), field, frow, fcol)); + + if (!field || (frow < 0) || (fcol < 0)) RETURN(E_BAD_ARGUMENT); - if (field->form) + if (field->form) RETURN(E_CONNECTED); field->frow = frow; @@ -60,4 +62,3 @@ move_field (FIELD *field, int frow, int fcol) } /* fld_move.c ends here */ - diff --git a/form/fld_newftyp.c b/form/fld_newftyp.c index 59cd1a6f..235cd5f5 100644 --- a/form/fld_newftyp.c +++ b/form/fld_newftyp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,49 +32,52 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_newftyp.c,v 1.9 2003/11/08 20:45:36 tom Exp $") +MODULE_ID("$Id: fld_newftyp.c,v 1.13 2004/12/25 22:24:10 tom Exp $") -static FIELDTYPE const default_fieldtype = { - 0, /* status */ - 0L, /* reference count */ - (FIELDTYPE *)0, /* pointer to left operand */ - (FIELDTYPE *)0, /* pointer to right operand */ - NULL, /* makearg function */ - NULL, /* copyarg function */ - NULL, /* freearg function */ - NULL, /* field validation function */ - NULL, /* Character check function */ - NULL, /* enumerate next function */ - NULL /* enumerate previous function */ +static FIELDTYPE const default_fieldtype = +{ + 0, /* status */ + 0L, /* reference count */ + (FIELDTYPE *)0, /* pointer to left operand */ + (FIELDTYPE *)0, /* pointer to right operand */ + NULL, /* makearg function */ + NULL, /* copyarg function */ + NULL, /* freearg function */ + NULL, /* field validation function */ + NULL, /* Character check function */ + NULL, /* enumerate next function */ + NULL /* enumerate previous function */ }; -NCURSES_EXPORT_VAR(const FIELDTYPE*) _nc_Default_FieldType = &default_fieldtype; - +NCURSES_EXPORT_VAR(const FIELDTYPE *) +_nc_Default_FieldType = &default_fieldtype; + /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : FIELDTYPE *new_fieldtype( | bool (* const field_check)(FIELD *,const void *), -| bool (* const char_check) (int, const void *) ) -| +| bool (* const char_check) (int, const void *) ) +| | Description : Create a new fieldtype. The application programmer must | write a field_check and a char_check function and give | them as input to this call. -| If an error occurs, errno is set to +| If an error occurs, errno is set to | E_BAD_ARGUMENT - invalid arguments | E_SYSTEM_ERROR - system error (no memory) | | Return Values : Fieldtype pointer or NULL if error occurred +--------------------------------------------------------------------------*/ NCURSES_EXPORT(FIELDTYPE *) -new_fieldtype ( - bool (* const field_check)(FIELD *,const void *), - bool (* const char_check) (int,const void *) ) +new_fieldtype(bool (*const field_check) (FIELD *, const void *), + bool (*const char_check) (int, const void *)) { FIELDTYPE *nftyp = (FIELDTYPE *)0; - - if ( (field_check) || (char_check) ) + + T((T_CALLED("new_fieldtype(%p,%p)"), field_check, char_check)); + if ((field_check) || (char_check)) { nftyp = (FIELDTYPE *)malloc(sizeof(FIELDTYPE)); + if (nftyp) { *nftyp = default_fieldtype; @@ -83,20 +86,20 @@ new_fieldtype ( } else { - SET_ERROR( E_SYSTEM_ERROR ); + SET_ERROR(E_SYSTEM_ERROR); } } else { - SET_ERROR( E_BAD_ARGUMENT ); + SET_ERROR(E_BAD_ARGUMENT); } - return nftyp; + returnFieldType(nftyp); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int free_fieldtype(FIELDTYPE *typ) -| +| | Description : Release the memory associated with this fieldtype. | | Return Values : E_OK - success @@ -104,12 +107,14 @@ new_fieldtype ( | E_BAD_ARGUMENT - invalid fieldtype pointer +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -free_fieldtype (FIELDTYPE *typ) +free_fieldtype(FIELDTYPE *typ) { + T((T_CALLED("free_fieldtype(%p)"), typ)); + if (!typ) RETURN(E_BAD_ARGUMENT); - if (typ->ref!=0) + if (typ->ref != 0) RETURN(E_CONNECTED); if (typ->status & _RESIDENT) @@ -117,8 +122,10 @@ free_fieldtype (FIELDTYPE *typ) if (typ->status & _LINKED_TYPE) { - if (typ->left ) typ->left->ref--; - if (typ->right) typ->right->ref--; + if (typ->left) + typ->left->ref--; + if (typ->right) + typ->right->ref--; } free(typ); RETURN(E_OK); diff --git a/form/fld_opts.c b/form/fld_opts.c index 575d1722..3c881acf 100644 --- a/form/fld_opts.c +++ b/form/fld_opts.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_opts.c,v 1.9 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_opts.c,v 1.11 2004/12/11 21:55:46 tom Exp $") /*---------------------------------------------------------------------------- Field-Options manipulation routines @@ -51,12 +51,15 @@ MODULE_ID("$Id: fld_opts.c,v 1.9 2003/10/25 15:17:08 tom Exp $") | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_field_opts (FIELD * field, Field_Options opts) +set_field_opts(FIELD *field, Field_Options opts) { int res = E_BAD_ARGUMENT; + + T((T_CALLED("set_field_opts(%p,%d)"), field, opts)); + opts &= ALL_FIELD_OPTS; if (!(opts & ~ALL_FIELD_OPTS)) - res = _nc_Synchronize_Options( Normalize_Field(field), opts ); + res = _nc_Synchronize_Options(Normalize_Field(field), opts); RETURN(res); } @@ -69,9 +72,11 @@ set_field_opts (FIELD * field, Field_Options opts) | Return Values : The options. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(Field_Options) -field_opts (const FIELD * field) +field_opts(const FIELD *field) { - return ALL_FIELD_OPTS & Normalize_Field( field )->opts; + T((T_CALLED("field_opts(%p)"), field)); + + returnCode(ALL_FIELD_OPTS & Normalize_Field(field)->opts); } /*--------------------------------------------------------------------------- @@ -87,15 +92,17 @@ field_opts (const FIELD * field) | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -field_opts_on (FIELD * field, Field_Options opts) +field_opts_on(FIELD *field, Field_Options opts) { int res = E_BAD_ARGUMENT; + T((T_CALLED("field_opts_on(%p,%d)"), field, opts)); + opts &= ALL_FIELD_OPTS; if (!(opts & ~ALL_FIELD_OPTS)) { - Normalize_Field( field ); - res = _nc_Synchronize_Options( field, field->opts | opts ); + Normalize_Field(field); + res = _nc_Synchronize_Options(field, field->opts | opts); } RETURN(res); } @@ -113,17 +120,19 @@ field_opts_on (FIELD * field, Field_Options opts) | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -field_opts_off (FIELD * field, Field_Options opts) +field_opts_off(FIELD *field, Field_Options opts) { int res = E_BAD_ARGUMENT; + T((T_CALLED("field_opts_off(%p,%d)"), field, opts)); + opts &= ALL_FIELD_OPTS; if (!(opts & ~ALL_FIELD_OPTS)) { - Normalize_Field( field ); - res = _nc_Synchronize_Options( field, field->opts & ~opts ); + Normalize_Field(field); + res = _nc_Synchronize_Options(field, field->opts & ~opts); } RETURN(res); -} +} /* fld_opts.c ends here */ diff --git a/form/fld_pad.c b/form/fld_pad.c index 7346973c..63d8ad1c 100644 --- a/form/fld_pad.c +++ b/form/fld_pad.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_pad.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_pad.c,v 1.9 2004/12/11 21:56:49 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,17 +46,19 @@ MODULE_ID("$Id: fld_pad.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_field_pad (FIELD * field, int ch) +set_field_pad(FIELD *field, int ch) { int res = E_BAD_ARGUMENT; - Normalize_Field( field ); - if (isprint((unsigned char)ch)) + T((T_CALLED("set_field_pad(%p,%d)"), field, ch)); + + Normalize_Field(field); + if (isprint(UChar(ch))) { if (field->pad != ch) { field->pad = ch; - res = _nc_Synchronize_Attributes( field ); + res = _nc_Synchronize_Attributes(field); } else res = E_OK; @@ -73,9 +75,11 @@ set_field_pad (FIELD * field, int ch) | Return Values : The pad character. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -field_pad (const FIELD * field) +field_pad(const FIELD *field) { - return Normalize_Field( field )->pad; + T((T_CALLED("field_pad(%p)"), field)); + + returnCode(Normalize_Field(field)->pad); } /* fld_pad.c ends here */ diff --git a/form/fld_page.c b/form/fld_page.c index f99a5e46..e1af4962 100644 --- a/form/fld_page.c +++ b/form/fld_page.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_page.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_page.c,v 1.9 2004/12/11 21:58:19 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -45,13 +45,15 @@ MODULE_ID("$Id: fld_page.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | E_CONNECTED - field is connected +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_new_page (FIELD * field, bool new_page_flag) +set_new_page(FIELD *field, bool new_page_flag) { + T((T_CALLED("set_new_page(%p,%d)"), field, new_page_flag)); + Normalize_Field(field); - if (field->form) + if (field->form) RETURN(E_CONNECTED); - if (new_page_flag) + if (new_page_flag) field->status |= _NEWPAGE; else field->status &= ~_NEWPAGE; @@ -70,9 +72,11 @@ set_new_page (FIELD * field, bool new_page_flag) | FALSE - field doesn't start a new page +--------------------------------------------------------------------------*/ NCURSES_EXPORT(bool) -new_page (const FIELD * field) +new_page(const FIELD *field) { - return (Normalize_Field(field)->status & _NEWPAGE) ? TRUE : FALSE; + T((T_CALLED("new_page(%p)"), field)); + + returnBool((Normalize_Field(field)->status & _NEWPAGE) ? TRUE : FALSE); } /* fld_page.c ends here */ diff --git a/form/fld_stat.c b/form/fld_stat.c index be265b0c..b85b4d55 100644 --- a/form/fld_stat.c +++ b/form/fld_stat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_stat.c,v 1.9 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_stat.c,v 1.11 2004/12/11 22:28:00 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,16 +44,18 @@ MODULE_ID("$Id: fld_stat.c,v 1.9 2003/10/25 15:17:08 tom Exp $") | Return Values : E_OK - success +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_field_status (FIELD * field, bool status) +set_field_status(FIELD *field, bool status) { - Normalize_Field( field ); + T((T_CALLED("set_field_status(%p,%d)"), field, status)); + + Normalize_Field(field); if (status) field->status |= _CHANGED; else field->status &= ~_CHANGED; - return(E_OK); + RETURN(E_OK); } /*--------------------------------------------------------------------------- @@ -67,9 +69,11 @@ set_field_status (FIELD * field, bool status) | FALSE - buffer has not been changed +--------------------------------------------------------------------------*/ NCURSES_EXPORT(bool) -field_status (const FIELD * field) +field_status(const FIELD *field) { - return ((Normalize_Field(field)->status & _CHANGED) ? TRUE : FALSE); + T((T_CALLED("field_status(%p)"), field)); + + returnBool((Normalize_Field(field)->status & _CHANGED) ? TRUE : FALSE); } /* fld_stat.c ends here */ diff --git a/form/fld_type.c b/form/fld_type.c index aa889ea0..c9a3fbe5 100644 --- a/form/fld_type.c +++ b/form/fld_type.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_type.c,v 1.12 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_type.c,v 1.15 2004/12/25 22:24:10 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -46,30 +46,32 @@ MODULE_ID("$Id: fld_type.c,v 1.12 2003/10/25 15:17:08 tom Exp $") | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_field_type (FIELD *field,FIELDTYPE *type, ...) +set_field_type(FIELD *field, FIELDTYPE *type,...) { va_list ap; int res = E_SYSTEM_ERROR; int err = 0; - va_start(ap,type); + T((T_CALLED("set_field_type(%p,%p)"), field, type)); + + va_start(ap, type); Normalize_Field(field); _nc_Free_Type(field); field->type = type; - field->arg = (void *)_nc_Make_Argument(field->type,&ap,&err); + field->arg = (void *)_nc_Make_Argument(field->type, &ap, &err); if (err) { - _nc_Free_Argument(field->type,(TypeArgument *)(field->arg)); + _nc_Free_Argument(field->type, (TypeArgument *)(field->arg)); field->type = (FIELDTYPE *)0; - field->arg = (void *)0; + field->arg = (void *)0; } else { res = E_OK; - if (field->type) + if (field->type) field->type->ref++; } @@ -86,9 +88,10 @@ set_field_type (FIELD *field,FIELDTYPE *type, ...) | Return Values : Pointer to fieldtype of NULL if none is defined. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(FIELDTYPE *) -field_type (const FIELD * field) +field_type(const FIELD *field) { - return Normalize_Field(field)->type; + T((T_CALLED("field_type(%p)"), field)); + returnFieldType(Normalize_Field(field)->type); } /* fld_type.c ends here */ diff --git a/form/fld_user.c b/form/fld_user.c index 19ff5453..323622c7 100644 --- a/form/fld_user.c +++ b/form/fld_user.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fld_user.c,v 1.11 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: fld_user.c,v 1.15 2004/12/25 22:24:50 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,9 +44,11 @@ MODULE_ID("$Id: fld_user.c,v 1.11 2003/10/25 15:17:08 tom Exp $") | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_field_userptr (FIELD * field, void *usrptr) +set_field_userptr(FIELD *field, void *usrptr) { - Normalize_Field( field )->usrptr = usrptr; + T((T_CALLED("set_field_userptr(%p,%p)"), field, usrptr)); + + Normalize_Field(field)->usrptr = usrptr; RETURN(E_OK); } @@ -61,9 +63,10 @@ set_field_userptr (FIELD * field, void *usrptr) | NULL is returned +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void *) -field_userptr (const FIELD *field) +field_userptr(const FIELD *field) { - return Normalize_Field( field )->usrptr; + T((T_CALLED("field_userptr(%p)"), field)); + returnVoidPtr(Normalize_Field(field)->usrptr); } /* fld_user.c ends here */ diff --git a/form/form.h b/form/form.h index d03c819c..a4691a86 100644 --- a/form/form.h +++ b/form/form.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,7 +30,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: form.h,v 0.17 2003/11/08 20:39:08 tom Exp $ */ +/* $Id: form.h,v 0.20 2004/12/04 22:22:10 tom Exp $ */ #ifndef FORM_H #define FORM_H @@ -42,6 +42,14 @@ extern "C" { #endif +#ifndef FORM_PRIV_H +typedef void *FIELD_CELL; +#endif + +#ifndef NCURSES_FIELD_INTERNALS +#define NCURSES_FIELD_INTERNALS /* nothing */ +#endif + typedef int Form_Options; typedef int Field_Options; @@ -50,10 +58,10 @@ typedef int Field_Options; **********/ typedef struct { - short pmin; /* index of first field on page */ - short pmax; /* index of last field on page */ - short smin; /* index of top leftmost field on page */ - short smax; /* index of bottom rightmost field on page */ + short pmin; /* index of first field on page */ + short pmax; /* index of last field on page */ + short smin; /* index of top leftmost field on page */ + short smax; /* index of bottom rightmost field on page */ } _PAGE; /********** @@ -61,31 +69,40 @@ typedef struct { **********/ typedef struct fieldnode { - unsigned short status; /* flags */ - short rows; /* size in rows */ - short cols; /* size in cols */ - short frow; /* first row */ - short fcol; /* first col */ - int drows; /* dynamic rows */ - int dcols; /* dynamic cols */ - int maxgrow; /* maximum field growth */ - int nrow; /* off-screen rows */ - short nbuf; /* additional buffers */ - short just; /* justification */ - short page; /* page on form */ - short index; /* into form -> field */ - int pad; /* pad character */ - chtype fore; /* foreground attribute */ - chtype back; /* background attribute */ - Field_Options opts; /* options */ - struct fieldnode * snext; /* sorted order pointer */ - struct fieldnode * sprev; /* sorted order pointer */ - struct fieldnode * link; /* linked field chain */ - struct formnode * form; /* containing form */ - struct typenode * type; /* field type */ - void * arg; /* argument for type */ - char * buf; /* field buffers */ - void * usrptr; /* user pointer */ + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + short frow; /* first row */ + short fcol; /* first col */ + int drows; /* dynamic rows */ + int dcols; /* dynamic cols */ + int maxgrow; /* maximum field growth */ + int nrow; /* off-screen rows */ + short nbuf; /* additional buffers */ + short just; /* justification */ + short page; /* page on form */ + short index; /* into form -> field */ + int pad; /* pad character */ + chtype fore; /* foreground attribute */ + chtype back; /* background attribute */ + Field_Options opts; /* options */ + struct fieldnode * snext; /* sorted order pointer */ + struct fieldnode * sprev; /* sorted order pointer */ + struct fieldnode * link; /* linked field chain */ + struct formnode * form; /* containing form */ + struct typenode * type; /* field type */ + void * arg; /* argument for type */ + FIELD_CELL * buf; /* field buffers */ + void * usrptr; /* user pointer */ + /* + * The wide-character configuration requires extra information. Because + * there are existing applications that manipulate the members of FIELD + * directly, we cannot make the struct opaque. Offsets of members up to + * this point are the same in the narrow- and wide-character configuration. + * But note that the type of buf depends on the configuration, and is made + * opaque for that reason. + */ + NCURSES_FIELD_INTERNALS } FIELD; /************** @@ -93,20 +110,20 @@ typedef struct fieldnode { **************/ typedef struct typenode { - unsigned short status; /* flags */ - long ref; /* reference count */ - struct typenode * left; /* ptr to operand for | */ - struct typenode * right; /* ptr to operand for | */ + unsigned short status; /* flags */ + long ref; /* reference count */ + struct typenode * left; /* ptr to operand for | */ + struct typenode * right; /* ptr to operand for | */ - void* (*makearg)(va_list *); /* make fieldtype arg */ - void* (*copyarg)(const void *); /* copy fieldtype arg */ - void (*freearg)(void *); /* free fieldtype arg */ + void* (*makearg)(va_list *); /* make fieldtype arg */ + void* (*copyarg)(const void *); /* copy fieldtype arg */ + void (*freearg)(void *); /* free fieldtype arg */ - bool (*fcheck)(FIELD *,const void *); /* field validation */ - bool (*ccheck)(int,const void *); /* character validation */ + bool (*fcheck)(FIELD *,const void *); /* field validation */ + bool (*ccheck)(int,const void *); /* character validation */ - bool (*next)(FIELD *,const void *); /* enumerate next value */ - bool (*prev)(FIELD *,const void *); /* enumerate prev value */ + bool (*next)(FIELD *,const void *); /* enumerate next value */ + bool (*prev)(FIELD *,const void *); /* enumerate prev value */ } FIELDTYPE; @@ -115,29 +132,29 @@ typedef struct typenode { *********/ typedef struct formnode { - unsigned short status; /* flags */ - short rows; /* size in rows */ - short cols; /* size in cols */ - int currow; /* current row in field window*/ - int curcol; /* current col in field window*/ - int toprow; /* in scrollable field window */ - int begincol; /* in horiz. scrollable field */ - short maxfield; /* number of fields */ - short maxpage; /* number of pages */ - short curpage; /* index into page */ - Form_Options opts; /* options */ - WINDOW * win; /* window */ - WINDOW * sub; /* subwindow */ - WINDOW * w; /* window for current field */ - FIELD ** field; /* field [maxfield] */ - FIELD * current; /* current field */ - _PAGE * page; /* page [maxpage] */ - void * usrptr; /* user pointer */ - - void (*forminit)(struct formnode *); - void (*formterm)(struct formnode *); - void (*fieldinit)(struct formnode *); - void (*fieldterm)(struct formnode *); + unsigned short status; /* flags */ + short rows; /* size in rows */ + short cols; /* size in cols */ + int currow; /* current row in field window */ + int curcol; /* current col in field window */ + int toprow; /* in scrollable field window */ + int begincol; /* in horiz. scrollable field */ + short maxfield; /* number of fields */ + short maxpage; /* number of pages */ + short curpage; /* index into page */ + Form_Options opts; /* options */ + WINDOW * win; /* window */ + WINDOW * sub; /* subwindow */ + WINDOW * w; /* window for current field */ + FIELD ** field; /* field [maxfield] */ + FIELD * current; /* current field */ + _PAGE * page; /* page [maxpage] */ + void * usrptr; /* user pointer */ + + void (*forminit)(struct formnode *); + void (*formterm)(struct formnode *); + void (*fieldinit)(struct formnode *); + void (*fieldterm)(struct formnode *); } FORM; @@ -154,20 +171,20 @@ typedef void (*Form_Hook)(FORM *); #define JUSTIFY_RIGHT (3) /* field options */ -#define O_VISIBLE (0x0001) -#define O_ACTIVE (0x0002) -#define O_PUBLIC (0x0004) -#define O_EDIT (0x0008) -#define O_WRAP (0x0010) -#define O_BLANK (0x0020) -#define O_AUTOSKIP (0x0040) -#define O_NULLOK (0x0080) -#define O_PASSOK (0x0100) -#define O_STATIC (0x0200) +#define O_VISIBLE (0x0001U) +#define O_ACTIVE (0x0002U) +#define O_PUBLIC (0x0004U) +#define O_EDIT (0x0008U) +#define O_WRAP (0x0010U) +#define O_BLANK (0x0020U) +#define O_AUTOSKIP (0x0040U) +#define O_NULLOK (0x0080U) +#define O_PASSOK (0x0100U) +#define O_STATIC (0x0200U) /* form options */ -#define O_NL_OVERLOAD (0x0001) -#define O_BS_OVERLOAD (0x0002) +#define O_NL_OVERLOAD (0x0001U) +#define O_BS_OVERLOAD (0x0002U) /* form driver commands */ #define REQ_NEXT_PAGE (KEY_MAX + 1) /* move to next page */ @@ -219,14 +236,14 @@ typedef void (*Form_Hook)(FORM *); #define REQ_SCR_BLINE (KEY_MAX + 44) /* scroll field backward a line */ #define REQ_SCR_FPAGE (KEY_MAX + 45) /* scroll field forward a page */ #define REQ_SCR_BPAGE (KEY_MAX + 46) /* scroll field backward a page */ -#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */ -#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */ -#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */ -#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */ -#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */ -#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */ -#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */ -#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */ +#define REQ_SCR_FHPAGE (KEY_MAX + 47) /* scroll field forward half page */ +#define REQ_SCR_BHPAGE (KEY_MAX + 48) /* scroll field backward half page */ +#define REQ_SCR_FCHAR (KEY_MAX + 49) /* horizontal scroll char */ +#define REQ_SCR_BCHAR (KEY_MAX + 50) /* horizontal scroll char */ +#define REQ_SCR_HFLINE (KEY_MAX + 51) /* horizontal scroll line */ +#define REQ_SCR_HBLINE (KEY_MAX + 52) /* horizontal scroll line */ +#define REQ_SCR_HFHALF (KEY_MAX + 53) /* horizontal scroll half line */ +#define REQ_SCR_HBHALF (KEY_MAX + 54) /* horizontal scroll half line */ #define REQ_VALIDATION (KEY_MAX + 55) /* validate field */ #define REQ_NEXT_CHOICE (KEY_MAX + 56) /* display next field choice */ @@ -255,15 +272,15 @@ extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_INTEGER; extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_NUMERIC; extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_REGEXP; - /************************************ + /************************************ * built-in additional field types * - * They are not defined in SVr4 * + * They are not defined in SVr4 * ************************************/ extern NCURSES_EXPORT_VAR(FIELDTYPE *) TYPE_IPV4; /* Internet IP Version 4 address */ - /*********************** - * Default objects * - ***********************/ + /*********************** + * Default objects * + ***********************/ extern NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form; extern NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field; @@ -273,8 +290,9 @@ extern NCURSES_EXPORT_VAR(FIELD *) _nc_Default_Field; ***********************/ extern NCURSES_EXPORT(FIELDTYPE *) new_fieldtype ( bool (* const field_check)(FIELD *,const void *), - bool (* const char_check)(int,const void *)), - *link_fieldtype(FIELDTYPE *,FIELDTYPE *); + bool (* const char_check)(int,const void *)); +extern NCURSES_EXPORT(FIELDTYPE *) link_fieldtype( + FIELDTYPE *, FIELDTYPE *); extern NCURSES_EXPORT(int) free_fieldtype (FIELDTYPE *); extern NCURSES_EXPORT(int) set_fieldtype_arg (FIELDTYPE *, @@ -326,7 +344,7 @@ extern NCURSES_EXPORT(FIELDTYPE *) field_type (const FIELD *); extern NCURSES_EXPORT(char *) field_buffer (const FIELD *,int); -extern NCURSES_EXPORT(Field_Options) field_opts (const FIELD *); +extern NCURSES_EXPORT(Field_Options) field_opts (const FIELD *); /****************** * FORM routines * diff --git a/form/form.priv.h b/form/form.priv.h index 11d382c0..b43f35c2 100644 --- a/form/form.priv.h +++ b/form/form.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,37 +30,65 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: form.priv.h,v 0.11 2003/11/08 20:38:51 tom Exp $ */ +/* $Id: form.priv.h,v 0.25 2005/03/05 23:47:26 tom Exp $ */ +#ifndef FORM_PRIV_H +#define FORM_PRIV_H 1 + +#include "curses.priv.h" #include "mf_common.h" + +#if USE_WIDEC_SUPPORT +#include +#include + +#ifndef MB_LEN_MAX +#define MB_LEN_MAX 8 /* should be >= MB_CUR_MAX, but that may be a function */ +#endif + +#define FIELD_CELL NCURSES_CH_T + +#define NCURSES_FIELD_INTERNALS char** expanded; WINDOW *working; +#define NCURSES_FIELD_EXTENSION , (char **)0, (WINDOW *)0 + +#else + +#define FIELD_CELL char + +#define NCURSES_FIELD_EXTENSION /* nothing */ + +#endif + #include "form.h" /* form status values */ -#define _OVLMODE (0x04) /* Form is in overlay mode */ -#define _WINDOW_MODIFIED (0x10) /* Current field window has been modified */ -#define _FCHECK_REQUIRED (0x20) /* Current field needs validation */ +#define _OVLMODE (0x04U) /* Form is in overlay mode */ +#define _WINDOW_MODIFIED (0x10U) /* Current field window has been modified */ +#define _FCHECK_REQUIRED (0x20U) /* Current field needs validation */ /* field status values */ -#define _CHANGED (0x01) /* Field has been changed */ -#define _NEWTOP (0x02) /* Vertical scrolling occurred */ -#define _NEWPAGE (0x04) /* field begins new page of form */ -#define _MAY_GROW (0x08) /* dynamic field may still grow */ +#define _CHANGED (0x01U) /* Field has been changed */ +#define _NEWTOP (0x02U) /* Vertical scrolling occurred */ +#define _NEWPAGE (0x04U) /* field begins new page of form */ +#define _MAY_GROW (0x08U) /* dynamic field may still grow */ /* fieldtype status values */ -#define _LINKED_TYPE (0x01) /* Type is a linked type */ -#define _HAS_ARGS (0x02) /* Type has arguments */ -#define _HAS_CHOICE (0x04) /* Type has choice methods */ -#define _RESIDENT (0x08) /* Type is built-in */ +#define _LINKED_TYPE (0x01U) /* Type is a linked type */ +#define _HAS_ARGS (0x02U) /* Type has arguments */ +#define _HAS_CHOICE (0x04U) /* Type has choice methods */ +#define _RESIDENT (0x08U) /* Type is built-in */ /* This are the field options required to be a selectable field in field navigation requests */ #define O_SELECTABLE (O_ACTIVE | O_VISIBLE) /* If form is NULL replace form argument by default-form */ -#define Normalize_Form(form) ((form)=(form)?(form):_nc_Default_Form) +#define Normalize_Form(form) \ + ((form) = (form != 0) ? (form) : _nc_Default_Form) /* If field is NULL replace field argument by default-field */ -#define Normalize_Field(field) ((field)=(field)?(field):_nc_Default_Field) +#define Normalize_Field(field) \ + ((field) = (field != 0) ? (field) : _nc_Default_Field) /* Retrieve forms window */ #define Get_Form_Window(form) \ @@ -71,20 +99,22 @@ /* Calculate the total size of all buffers for this field */ #define Total_Buffer_Size(field) \ - ( (Buffer_Length(field) + 1) * (1+(field)->nbuf) ) + ( (Buffer_Length(field) + 1) * (1+(field)->nbuf) * sizeof(FIELD_CELL) ) /* Logic to determine whether or not a field is single lined */ #define Single_Line_Field(field) \ (((field)->rows + (field)->nrow) == 1) /* Logic to determine whether or not a field is selectable */ -#define Field_Is_Selectable(f) (((f)->opts & O_SELECTABLE)==O_SELECTABLE) -#define Field_Is_Not_Selectable(f) (((f)->opts & O_SELECTABLE)!=O_SELECTABLE) +#define Field_Is_Selectable(f) (((unsigned)((f)->opts) & O_SELECTABLE)==O_SELECTABLE) +#define Field_Is_Not_Selectable(f) (((unsigned)((f)->opts) & O_SELECTABLE)!=O_SELECTABLE) -typedef struct typearg { - struct typearg *left; - struct typearg *right; -} TypeArgument; +typedef struct typearg + { + struct typearg *left; + struct typearg *right; + } +TypeArgument; /* This is a dummy request code (normally invalid) to be used internally with the form_driver() routine to position to the first active field @@ -96,7 +126,7 @@ typedef struct typearg { O_NL_OVERLOAD |\ O_BS_OVERLOAD ) -#define ALL_FIELD_OPTS ( \ +#define ALL_FIELD_OPTS (Field_Options)( \ O_VISIBLE |\ O_ACTIVE |\ O_PUBLIC |\ @@ -108,23 +138,112 @@ typedef struct typearg { O_PASSOK |\ O_STATIC ) - #define C_BLANK ' ' #define is_blank(c) ((c)==C_BLANK) +#define C_ZEROS '\0' + extern NCURSES_EXPORT_VAR(const FIELDTYPE *) _nc_Default_FieldType; -extern NCURSES_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*,va_list*,int*); -extern NCURSES_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*,const TypeArgument*, int*); -extern NCURSES_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*,TypeArgument*); +extern NCURSES_EXPORT(TypeArgument *) _nc_Make_Argument (const FIELDTYPE*, va_list*, int*); +extern NCURSES_EXPORT(TypeArgument *) _nc_Copy_Argument (const FIELDTYPE*, const TypeArgument*, int*); +extern NCURSES_EXPORT(void) _nc_Free_Argument (const FIELDTYPE*, TypeArgument*); extern NCURSES_EXPORT(bool) _nc_Copy_Type (FIELD*, FIELD const *); extern NCURSES_EXPORT(void) _nc_Free_Type (FIELD *); extern NCURSES_EXPORT(int) _nc_Synchronize_Attributes (FIELD*); -extern NCURSES_EXPORT(int) _nc_Synchronize_Options (FIELD*,Field_Options); -extern NCURSES_EXPORT(int) _nc_Set_Form_Page (FORM*,int,FIELD*); +extern NCURSES_EXPORT(int) _nc_Synchronize_Options (FIELD*, Field_Options); +extern NCURSES_EXPORT(int) _nc_Set_Form_Page (FORM*, int, FIELD*); extern NCURSES_EXPORT(int) _nc_Refresh_Current_Field (FORM*); extern NCURSES_EXPORT(FIELD *) _nc_First_Active_Field (FORM*); extern NCURSES_EXPORT(bool) _nc_Internal_Validation (FORM*); -extern NCURSES_EXPORT(int) _nc_Set_Current_Field (FORM*,FIELD*); +extern NCURSES_EXPORT(int) _nc_Set_Current_Field (FORM*, FIELD*); extern NCURSES_EXPORT(int) _nc_Position_Form_Cursor (FORM*); + +#if USE_WIDEC_SUPPORT +extern NCURSES_EXPORT(wchar_t *) _nc_Widen_String(char *, int *); +#endif + +#ifdef TRACE + +#define returnField(code) TRACE_RETURN(code,field) +#define returnFieldPtr(code) TRACE_RETURN(code,field_ptr) +#define returnForm(code) TRACE_RETURN(code,form) +#define returnFieldType(code) TRACE_RETURN(code,field_type) +#define returnFormHook(code) TRACE_RETURN(code,form_hook) + +extern NCURSES_EXPORT(FIELD **) _nc_retrace_field_ptr (FIELD **); +extern NCURSES_EXPORT(FIELD *) _nc_retrace_field (FIELD *); +extern NCURSES_EXPORT(FIELDTYPE *) _nc_retrace_field_type (FIELDTYPE *); +extern NCURSES_EXPORT(FORM *) _nc_retrace_form (FORM *); +extern NCURSES_EXPORT(Form_Hook) _nc_retrace_form_hook (Form_Hook); + +#else /* !TRACE */ + +#define returnFieldPtr(code) return code +#define returnFieldType(code) return code +#define returnField(code) return code +#define returnForm(code) return code +#define returnFormHook(code) return code + +#endif /* TRACE/!TRACE */ + +/* + * Use Check_CTYPE_Field() to simplify FIELDTYPE's that use only the ccheck() + * function. + */ +#if USE_WIDEC_SUPPORT +#define Check_CTYPE_Field(result, buffer, width, ccheck) \ + while (*buffer && *buffer == ' ') \ + buffer++; \ + if (*buffer) \ + { \ + bool blank = FALSE; \ + int len; \ + int n; \ + wchar_t *list = _nc_Widen_String((char *)buffer, &len); \ + if (list != 0) \ + { \ + result = TRUE; \ + for (n = 0; n < len; ++n) \ + { \ + if (blank) \ + { \ + if (list[n] != ' ') \ + { \ + result = FALSE; \ + break; \ + } \ + } \ + else if (list[n] == ' ') \ + { \ + blank = TRUE; \ + result = (n + 1 >= width); \ + } \ + else if (!ccheck(list[n], NULL)) \ + { \ + result = FALSE; \ + break; \ + } \ + } \ + free(list); \ + } \ + } +#else +#define Check_CTYPE_Field(result, buffer, width, ccheck) \ + while (*buffer && *buffer == ' ') \ + buffer++; \ + if (*buffer) \ + { \ + unsigned char *s = buffer; \ + int l = -1; \ + while (*buffer && ccheck(*buffer, NULL)) \ + buffer++; \ + l = (int)(buffer - s); \ + while (*buffer && *buffer == ' ') \ + buffer++; \ + result = ((*buffer || (l < width)) ? FALSE : TRUE); \ + } +#endif + +#endif /* FORM_PRIV_H */ diff --git a/form/frm_cursor.c b/form/frm_cursor.c index 0790d9c5..18dabab2 100644 --- a/form/frm_cursor.c +++ b/form/frm_cursor.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_cursor.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: frm_cursor.c,v 1.9 2004/12/11 22:01:03 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -49,16 +49,18 @@ MODULE_ID("$Id: frm_cursor.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | E_NOT_POSTED - Form is not posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -pos_form_cursor (FORM * form) +pos_form_cursor(FORM *form) { int res; + T((T_CALLED("pos_form_cursor(%p)"), form)); + if (!form) - res = E_BAD_ARGUMENT; + res = E_BAD_ARGUMENT; else { if (!(form->status & _POSTED)) - res = E_NOT_POSTED; + res = E_NOT_POSTED; else res = _nc_Position_Form_Cursor(form); } diff --git a/form/frm_data.c b/form/frm_data.c index 847d7d5a..e52b1bec 100644 --- a/form/frm_data.c +++ b/form/frm_data.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_data.c,v 1.10 2003/11/08 20:38:14 tom Exp $") +MODULE_ID("$Id: frm_data.c,v 1.13 2004/12/11 22:29:28 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -45,10 +45,12 @@ MODULE_ID("$Id: frm_data.c,v 1.10 2003/11/08 20:38:14 tom Exp $") | FALSE - there are no off-screen data behind +--------------------------------------------------------------------------*/ NCURSES_EXPORT(bool) -data_behind (const FORM *form) +data_behind(const FORM *form) { bool result = FALSE; + T((T_CALLED("data_behind(%p)"), form)); + if (form && (form->status & _POSTED) && form->current) { FIELD *field; @@ -56,42 +58,69 @@ data_behind (const FORM *form) field = form->current; if (!Single_Line_Field(field)) { - result = (form->toprow==0) ? FALSE : TRUE; + result = (form->toprow == 0) ? FALSE : TRUE; } else { - result = (form->begincol==0) ? FALSE : TRUE; + result = (form->begincol == 0) ? FALSE : TRUE; } } - return(result); + returnBool(result); } /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static char * After_Last_Non_Pad_Position( -| char *buffer, +| Function : static char * Only_Padding( +| WINDOW *w, | int len, | int pad) | -| Description : Find the last position in the buffer that doesn't +| Description : Test if 'length' cells starting at the current position | contain a padding character. | -| Return Values : The pointer to this position +| Return Values : true if only padding cells are found +--------------------------------------------------------------------------*/ -INLINE -static char * After_Last_Non_Pad_Position(char *buffer, int len, int pad) +INLINE static bool +Only_Padding(WINDOW *w, int len, int pad) { - char *end = buffer + len; - - assert(buffer && len>=0); - while ( (buffer < end) && (*(end-1)==pad) ) - end--; + bool result = TRUE; + int y, x, j; + FIELD_CELL cell; - return end; + getyx(w, y, x); + for (j = 0; j < len; ++j) + { + if (wmove(w, y, x + j) != ERR) + { +#if USE_WIDEC_SUPPORT + if (win_wch(w, &cell) != ERR) + { + if ((chtype)CharOf(cell) != ChCharOf(pad) + || cell.chars[1] != 0) + { + result = FALSE; + break; + } + } +#else + cell = winch(w); + if (ChCharOf(cell) != ChCharOf(pad)) + { + result = FALSE; + break; + } +#endif + } + else + { + /* if an error, return true: no non-padding text found */ + break; + } + } + /* no need to reset the cursor position; caller does this */ + return result; } -#define SMALL_BUFFER_SIZE (80) - /*--------------------------------------------------------------------------- | Facility : libnform | Function : bool data_ahead(const FORM *form) @@ -103,31 +132,21 @@ static char * After_Last_Non_Pad_Position(char *buffer, int len, int pad) | FALSE - there are no off-screen data ahead +--------------------------------------------------------------------------*/ NCURSES_EXPORT(bool) -data_ahead (const FORM *form) +data_ahead(const FORM *form) { bool result = FALSE; + T((T_CALLED("data_ahead(%p)"), form)); + if (form && (form->status & _POSTED) && form->current) { - static char buffer[SMALL_BUFFER_SIZE + 1]; FIELD *field; - bool large_buffer; bool cursor_moved = FALSE; - char *bp; - char *found_content; int pos; field = form->current; assert(form->w); - large_buffer = (field->cols > SMALL_BUFFER_SIZE); - if (large_buffer) - bp = (char *)malloc((size_t)(field->cols) + 1); - else - bp = buffer; - - assert(bp); - if (Single_Line_Field(field)) { int check_len; @@ -136,15 +155,12 @@ data_ahead (const FORM *form) while (pos < field->dcols) { check_len = field->dcols - pos; - if ( check_len >= field->cols ) + if (check_len >= field->cols) check_len = field->cols; cursor_moved = TRUE; - wmove(form->w,0,pos); - winnstr(form->w,bp,check_len); - found_content = - After_Last_Non_Pad_Position(bp,check_len,field->pad); - if (found_content==bp) - pos += field->cols; + wmove(form->w, 0, pos); + if (Only_Padding(form->w, check_len, field->pad)) + pos += field->cols; else { result = TRUE; @@ -158,12 +174,9 @@ data_ahead (const FORM *form) while (pos < field->drows) { cursor_moved = TRUE; - wmove(form->w,pos,0); + wmove(form->w, pos, 0); pos++; - winnstr(form->w,bp,field->cols); - found_content = - After_Last_Non_Pad_Position(bp,field->cols,field->pad); - if (found_content!=bp) + if (!Only_Padding(form->w, field->cols, field->pad)) { result = TRUE; break; @@ -171,13 +184,10 @@ data_ahead (const FORM *form) } } - if (large_buffer) - free(bp); - if (cursor_moved) - wmove(form->w,form->currow,form->curcol); + wmove(form->w, form->currow, form->curcol); } - return(result); + returnBool(result); } /* frm_data.c ends here */ diff --git a/form/frm_def.c b/form/frm_def.c index d49573cd..d654b0b9 100644 --- a/form/frm_def.c +++ b/form/frm_def.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,32 +32,33 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_def.c,v 1.13 2003/11/08 20:37:53 tom Exp $") +MODULE_ID("$Id: frm_def.c,v 1.17 2004/12/25 22:26:01 tom Exp $") /* this can't be readonly */ -static FORM default_form = { - 0, /* status */ - 0, /* rows */ - 0, /* cols */ - 0, /* currow */ - 0, /* curcol */ - 0, /* toprow */ - 0, /* begincol */ - -1, /* maxfield */ - -1, /* maxpage */ - -1, /* curpage */ - ALL_FORM_OPTS, /* opts */ - (WINDOW *)0, /* win */ - (WINDOW *)0, /* sub */ - (WINDOW *)0, /* w */ - (FIELD **)0, /* field */ - (FIELD *)0, /* current */ - (_PAGE *)0, /* page */ - (char *)0, /* usrptr */ - NULL, /* forminit */ - NULL, /* formterm */ - NULL, /* fieldinit */ - NULL /* fieldterm */ +static FORM default_form = +{ + 0, /* status */ + 0, /* rows */ + 0, /* cols */ + 0, /* currow */ + 0, /* curcol */ + 0, /* toprow */ + 0, /* begincol */ + -1, /* maxfield */ + -1, /* maxpage */ + -1, /* curpage */ + ALL_FORM_OPTS, /* opts */ + (WINDOW *)0, /* win */ + (WINDOW *)0, /* sub */ + (WINDOW *)0, /* w */ + (FIELD **)0, /* field */ + (FIELD *)0, /* current */ + (_PAGE *) 0, /* page */ + (char *)0, /* usrptr */ + NULL, /* forminit */ + NULL, /* formterm */ + NULL, /* fieldinit */ + NULL /* fieldterm */ }; NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form; @@ -74,39 +75,40 @@ NCURSES_EXPORT_VAR(FORM *) _nc_Default_Form = &default_form; | | Return Values : New head of sorted fieldlist +--------------------------------------------------------------------------*/ -static FIELD *Insert_Field_By_Position(FIELD *newfield, FIELD *head) +static FIELD * +Insert_Field_By_Position(FIELD *newfield, FIELD *head) { FIELD *current, *newhead; - + assert(newfield); if (!head) - { /* empty list is trivial */ + { /* empty list is trivial */ newhead = newfield->snext = newfield->sprev = newfield; } else { newhead = current = head; - while((current->frow < newfield->frow) || - ((current->frow==newfield->frow) && - (current->fcol < newfield->fcol)) ) + while ((current->frow < newfield->frow) || + ((current->frow == newfield->frow) && + (current->fcol < newfield->fcol))) { current = current->snext; - if (current==head) - { /* We cycled through. Reset head to indicate that */ + if (current == head) + { /* We cycled through. Reset head to indicate that */ head = (FIELD *)0; break; } } - /* we leave the loop with current pointing to the field after newfield*/ - newfield->snext = current; - newfield->sprev = current->sprev; + /* we leave the loop with current pointing to the field after newfield */ + newfield->snext = current; + newfield->sprev = current->sprev; newfield->snext->sprev = newfield; newfield->sprev->snext = newfield; - if (current==head) + if (current == head) newhead = newfield; } - return(newhead); + return (newhead); } /*--------------------------------------------------------------------------- @@ -117,25 +119,26 @@ static FIELD *Insert_Field_By_Position(FIELD *newfield, FIELD *head) | | Return Values : - +--------------------------------------------------------------------------*/ -static void Disconnect_Fields( FORM * form ) +static void +Disconnect_Fields(FORM *form) { if (form->field) { FIELD **fields; - for(fields=form->field;*fields;fields++) + for (fields = form->field; *fields; fields++) { - if (form == (*fields)->form) + if (form == (*fields)->form) (*fields)->form = (FORM *)0; } - + form->rows = form->cols = 0; form->maxfield = form->maxpage = -1; form->field = (FIELD **)0; - if (form->page) + if (form->page) free(form->page); - form->page = (_PAGE *)0; - } + form->page = (_PAGE *) 0; + } } /*--------------------------------------------------------------------------- @@ -149,82 +152,86 @@ static void Disconnect_Fields( FORM * form ) | E_BAD_ARGUMENT - Invalid form pointer or field array | E_SYSTEM_ERROR - not enough memory +--------------------------------------------------------------------------*/ -static int Connect_Fields(FORM * form, FIELD ** fields) +static int +Connect_Fields(FORM *form, FIELD **fields) { int field_cnt, j; int page_nr; int maximum_row_in_field, maximum_col_in_field; _PAGE *pg; - + + T((T_CALLED("Connect_Fields(%p,%p)"), form, fields)); + assert(form); - form->field = fields; + form->field = fields; form->maxfield = 0; - form->maxpage = 0; + form->maxpage = 0; if (!fields) RETURN(E_OK); - + page_nr = 0; /* store formpointer in fields and count pages */ - for(field_cnt=0;fields[field_cnt];field_cnt++) + for (field_cnt = 0; fields[field_cnt]; field_cnt++) { - if (fields[field_cnt]->form) + if (fields[field_cnt]->form) RETURN(E_CONNECTED); - if ( field_cnt==0 || - (fields[field_cnt]->status & _NEWPAGE)) + if (field_cnt == 0 || + (fields[field_cnt]->status & _NEWPAGE)) page_nr++; fields[field_cnt]->form = form; - } - if (field_cnt==0) + } + if (field_cnt == 0) RETURN(E_BAD_ARGUMENT); - + /* allocate page structures */ - if ( (pg = (_PAGE *)malloc(page_nr * sizeof(_PAGE))) != (_PAGE *)0 ) + if ((pg = (_PAGE *) malloc(page_nr * sizeof(_PAGE))) != (_PAGE *) 0) { form->page = pg; } else RETURN(E_SYSTEM_ERROR); - + /* Cycle through fields and calculate page boundaries as well as size of the form */ - for(j=0;jpmin = j; else { if (fields[j]->status & _NEWPAGE) { - pg->pmax = j-1; + pg->pmax = j - 1; pg++; pg->pmin = j; } } - + maximum_row_in_field = fields[j]->frow + fields[j]->rows; maximum_col_in_field = fields[j]->fcol + fields[j]->cols; - - if (form->rows < maximum_row_in_field) + + if (form->rows < maximum_row_in_field) form->rows = maximum_row_in_field; - if (form->cols < maximum_col_in_field) + if (form->cols < maximum_col_in_field) form->cols = maximum_col_in_field; } - - pg->pmax = field_cnt-1; + + pg->pmax = field_cnt - 1; form->maxfield = field_cnt; - form->maxpage = page_nr; - + form->maxpage = page_nr; + /* Sort fields on form pages */ - for(page_nr = 0;page_nr < form->maxpage; page_nr++) + for (page_nr = 0; page_nr < form->maxpage; page_nr++) { FIELD *fld = (FIELD *)0; - for(j = form->page[page_nr].pmin;j <= form->page[page_nr].pmax;j++) + + for (j = form->page[page_nr].pmin; j <= form->page[page_nr].pmax; j++) { fields[j]->index = j; - fields[j]->page = page_nr; - fld = Insert_Field_By_Position(fields[j],fld); + fields[j]->page = page_nr; + fld = Insert_Field_By_Position(fields[j], fld); } form->page[page_nr].smin = fld->index; form->page[page_nr].smax = fld->sprev->index; @@ -242,25 +249,27 @@ static int Connect_Fields(FORM * form, FIELD ** fields) | Return Values : E_OK - success | any other - error occurred +--------------------------------------------------------------------------*/ -INLINE static int Associate_Fields(FORM *form, FIELD **fields) +INLINE static int +Associate_Fields(FORM *form, FIELD **fields) { - int res = Connect_Fields(form,fields); + int res = Connect_Fields(form, fields); + if (res == E_OK) { - if (form->maxpage>0) + if (form->maxpage > 0) { form->curpage = 0; - form_driver(form,FIRST_ACTIVE_MAGIC); + form_driver(form, FIRST_ACTIVE_MAGIC); } else { form->curpage = -1; form->current = (FIELD *)0; - } + } } - return(res); + return (res); } - + /*--------------------------------------------------------------------------- | Facility : libnform | Function : FORM *new_form( FIELD **fields ) @@ -270,16 +279,17 @@ INLINE static int Associate_Fields(FORM *form, FIELD **fields) | Return Values : Pointer to form. NULL if error occurred. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(FORM *) -new_form (FIELD ** fields) -{ +new_form(FIELD **fields) +{ int err = E_SYSTEM_ERROR; FORM *form = (FORM *)malloc(sizeof(FORM)); - + + T((T_CALLED("new_form(%p)"), fields)); if (form) { *form = *_nc_Default_Form; - if ((err=Associate_Fields(form,fields))!=E_OK) + if ((err = Associate_Fields(form, fields)) != E_OK) { free_form(form); form = (FORM *)0; @@ -288,8 +298,8 @@ new_form (FIELD ** fields) if (!form) SET_ERROR(err); - - return(form); + + returnForm(form); } /*--------------------------------------------------------------------------- @@ -303,19 +313,21 @@ new_form (FIELD ** fields) | E_POSTED - form is posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -free_form (FORM * form) +free_form(FORM *form) { - if ( !form ) + T((T_CALLED("free_form(%p)"), form)); + + if (!form) RETURN(E_BAD_ARGUMENT); - if ( form->status & _POSTED) + if (form->status & _POSTED) RETURN(E_POSTED); - - Disconnect_Fields( form ); - if (form->page) + + Disconnect_Fields(form); + if (form->page) free(form->page); free(form); - + RETURN(E_OK); } @@ -330,26 +342,28 @@ free_form (FORM * form) | E_POSTED - form is posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_form_fields (FORM * form, FIELD ** fields) +set_form_fields(FORM *form, FIELD **fields) { FIELD **old; int res; - - if ( !form ) + + T((T_CALLED("set_form_fields(%p,%p)"), form, fields)); + + if (!form) RETURN(E_BAD_ARGUMENT); - if ( form->status & _POSTED ) + if (form->status & _POSTED) RETURN(E_POSTED); - + old = form->field; - Disconnect_Fields( form ); - - if( (res = Associate_Fields( form, fields )) != E_OK ) - Connect_Fields( form, old ); - + Disconnect_Fields(form); + + if ((res = Associate_Fields(form, fields)) != E_OK) + Connect_Fields(form, old); + RETURN(res); } - + /*--------------------------------------------------------------------------- | Facility : libnform | Function : FIELD **form_fields( const FORM *form ) @@ -359,9 +373,10 @@ set_form_fields (FORM * form, FIELD ** fields) | Return Values : Pointer to field array +--------------------------------------------------------------------------*/ NCURSES_EXPORT(FIELD **) -form_fields (const FORM * form) +form_fields(const FORM *form) { - return (Normalize_Form( form )->field); + T((T_CALLED("form_field(%p)"), form)); + returnFieldPtr(Normalize_Form(form)->field); } /*--------------------------------------------------------------------------- @@ -373,9 +388,11 @@ form_fields (const FORM * form) | Return Values : Number of fields, -1 if none are defined +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -field_count (const FORM * form) +field_count(const FORM *form) { - return (Normalize_Form( form )->maxfield); + T((T_CALLED("field_count(%p)"), form)); + + returnCode(Normalize_Form(form)->maxfield); } /* frm_def.c ends here */ diff --git a/form/frm_driver.c b/form/frm_driver.c index 9de28eea..72defd96 100644 --- a/form/frm_driver.c +++ b/form/frm_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,11 +32,11 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_driver.c,v 1.45 2003/12/06 17:22:42 tom Exp $") +MODULE_ID("$Id: frm_driver.c,v 1.71 2005/10/01 19:42:40 tom Exp $") /*---------------------------------------------------------------------------- This is the core module of the form library. It contains the majority - of the driver routines as well as the form_driver function. + of the driver routines as well as the form_driver function. Essentially this module is nearly the whole library. This is because all the functions in this module depends on some others in the module, @@ -53,7 +53,7 @@ MODULE_ID("$Id: frm_driver.c,v 1.45 2003/12/06 17:22:42 tom Exp $") The current field of the form is left and some new field is entered. c) Intra-Field Navigation ( all functions prefixed by IFN_ ) - The current position in the current field is changed. + The current position in the current field is changed. d) Vertical Scrolling ( all functions prefixed by VSC_ ) Essentially this is a specialization of Intra-Field navigation. It has to check for a multi-line field. @@ -87,7 +87,7 @@ The initial implementation tries to stay very close with the behavior of the original SVr4 implementation, although in some areas it is quite clear that this isn't the most appropriate way. As far as possible this sources will allow you to build a forms lib that behaves quite similar -to SVr4, but now and in the future we will give you better options. +to SVr4, but now and in the future we will give you better options. Perhaps at some time we will make this configurable at runtime. */ @@ -98,15 +98,27 @@ Perhaps at some time we will make this configurable at runtime. /* Allow dynamic field growth also when navigating past the end */ #define GROW_IF_NAVIGATE (1) +#if USE_WIDEC_SUPPORT +#define myADDNSTR(w, s, n) wadd_wchnstr(w, s, n) +#define myINSNSTR(w, s, n) wins_wchnstr(w, s, n) +#define myINNSTR(w, s, n) fix_wchnstr(w, s, n) +#define myWCWIDTH(w, y, x) cell_width(w, y, x) +#else +#define myADDNSTR(w, s, n) waddnstr(w, s, n) +#define myINSNSTR(w, s, n) winsnstr(w, s, n) +#define myINNSTR(w, s, n) winnstr(w, s, n) +#define myWCWIDTH(w, y, x) 1 +#endif + /*---------------------------------------------------------------------------- Forward references to some internally used static functions --------------------------------------------------------------------------*/ -static int Inter_Field_Navigation ( int (* const fct) (FORM *), FORM * form ); -static int FN_Next_Field (FORM * form); -static int FN_Previous_Field (FORM * form); +static int Inter_Field_Navigation(int (*const fct) (FORM *), FORM *form); +static int FN_Next_Field(FORM *form); +static int FN_Previous_Field(FORM *form); static int FE_New_Line(FORM *); static int FE_Delete_Previous(FORM *); - + /*---------------------------------------------------------------------------- Macro Definitions. @@ -190,168 +202,308 @@ static int FE_Delete_Previous(FORM *); #define First_Position_In_Current_Field(form) \ (((form)->currow==0) && ((form)->curcol==0)) - #define Minimum(a,b) (((a)<=(b)) ? (a) : (b)) #define Maximum(a,b) (((a)>=(b)) ? (a) : (b)) - + +/*---------------------------------------------------------------------------- + Useful constants + --------------------------------------------------------------------------*/ +static FIELD_CELL myBLANK = BLANK; +static FIELD_CELL myZEROS; + +#ifdef TRACE +static void +check_pos(FORM *form, int lineno) +{ + int y, x; + + if (form && form->w) + { + getyx(form->w, y, x); + if (y != form->currow || x != form->curcol) + { + T(("CHECKPOS %s@%d have position %d,%d vs want %d,%d", + __FILE__, lineno, + y, x, + form->currow, form->curcol)); + } + } +} +#define CHECKPOS(form) check_pos(form, __LINE__) +#else +#define CHECKPOS(form) /* nothing */ +#endif + +/*---------------------------------------------------------------------------- + Wide-character special functions + --------------------------------------------------------------------------*/ +#if USE_WIDEC_SUPPORT +/* like winsnstr */ +static int +wins_wchnstr(WINDOW *w, cchar_t *s, int n) +{ + int code = ERR; + int y, x; + + while (n-- > 0) + { + getyx(w, y, x); + if ((code = wins_wch(w, s++)) != OK) + break; + if ((code = wmove(w, y, x + 1)) != OK) + break; + } + return code; +} + +/* win_wchnstr is inconsistent with winnstr, since it returns OK rather than + * the number of items transferred. + */ +static int +fix_wchnstr(WINDOW *w, cchar_t *s, int n) +{ + win_wchnstr(w, s, n); + return n; +} + +/* + * Returns the column of the base of the given cell. + */ +static int +cell_base(WINDOW *win, int y, int x) +{ + int result = x; + + while (LEGALYX(win, y, x)) + { + cchar_t *data = &(win->_line[y].text[x]); + + if (isWidecBase(CHDEREF(data)) || !isWidecExt(CHDEREF(data))) + { + result = x; + break; + } + --x; + } + return result; +} + +/* + * Returns the number of columns needed for the given cell in a window. + */ +static int +cell_width(WINDOW *win, int y, int x) +{ + int result = 1; + + if (LEGALYX(win, y, x)) + { + cchar_t *data = &(win->_line[y].text[x]); + + if (isWidecExt(CHDEREF(data))) + { + /* recur, providing the number of columns to the next character */ + result = cell_width(win, y, x - 1); + } + else + { + result = wcwidth(CharOf(CHDEREF(data))); + } + } + return result; +} + +/* + * There is no wide-character function such as wdel_wch(), so we must find + * all of the cells that comprise a multi-column character and delete them + * one-by-one. + */ +static void +delete_char(FORM *form) +{ + int cells = cell_width(form->w, form->currow, form->curcol); + + form->curcol = cell_base(form->w, form->currow, form->curcol); + wmove(form->w, form->currow, form->curcol); + while (cells-- > 0) + { + wdelch(form->w); + } +} +#define DeleteChar(form) delete_char(form) +#else +#define DeleteChar(form) \ + wmove((form)->w, (form)->currow, (form)->curcol), \ + wdelch((form)->w) +#endif + /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static char *Get_Start_Of_Data(char * buf, int blen) -| +| | Description : Return pointer to first non-blank position in buffer. | If buffer is empty return pointer to buffer itself. | | Return Values : Pointer to first non-blank position in buffer +--------------------------------------------------------------------------*/ -INLINE static char *Get_Start_Of_Data(char * buf, int blen) +INLINE static FIELD_CELL * +Get_Start_Of_Data(FIELD_CELL *buf, int blen) { - char *p = buf; - char *end = &buf[blen]; + FIELD_CELL *p = buf; + FIELD_CELL *end = &buf[blen]; - assert(buf && blen>=0); - while( (p < end) && is_blank(*p) ) + assert(buf && blen >= 0); + while ((p < end) && ISBLANK(*p)) p++; - return( (p==end) ? buf : p ); + return ((p == end) ? buf : p); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static char *After_End_Of_Data(char * buf, int blen) -| +| | Description : Return pointer after last non-blank position in buffer. | If buffer is empty, return pointer to buffer itself. | -| Return Values : Pointer to position after last non-blank position in +| Return Values : Pointer to position after last non-blank position in | buffer. +--------------------------------------------------------------------------*/ -INLINE static char *After_End_Of_Data(char * buf,int blen) +INLINE static FIELD_CELL * +After_End_Of_Data(FIELD_CELL *buf, int blen) { - char *p = &buf[blen]; - - assert(buf && blen>=0); - while( (p>buf) && is_blank(p[-1]) ) + FIELD_CELL *p = &buf[blen]; + + assert(buf && blen >= 0); + while ((p > buf) && ISBLANK(p[-1])) p--; - return( p ); + return (p); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static char *Get_First_Whitespace_Character( | char * buf, int blen) -| +| | Description : Position to the first whitespace character. | | Return Values : Pointer to first whitespace character in buffer. +--------------------------------------------------------------------------*/ -INLINE static char *Get_First_Whitespace_Character(char * buf, int blen) +INLINE static FIELD_CELL * +Get_First_Whitespace_Character(FIELD_CELL *buf, int blen) { - char *p = buf; - char *end = &p[blen]; - - assert(buf && blen>=0); - while( (p < end) && !is_blank(*p)) + FIELD_CELL *p = buf; + FIELD_CELL *end = &p[blen]; + + assert(buf && blen >= 0); + while ((p < end) && !ISBLANK(*p)) p++; - return( (p==end) ? buf : p ); + return ((p == end) ? buf : p); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static char *After_Last_Whitespace_Character( | char * buf, int blen) -| +| | Description : Get the position after the last whitespace character. | -| Return Values : Pointer to position after last whitespace character in +| Return Values : Pointer to position after last whitespace character in | buffer. +--------------------------------------------------------------------------*/ -INLINE static char *After_Last_Whitespace_Character(char * buf, int blen) +INLINE static FIELD_CELL * +After_Last_Whitespace_Character(FIELD_CELL *buf, int blen) { - char *p = &buf[blen]; - - assert(buf && blen>=0); - while( (p>buf) && !is_blank(p[-1]) ) + FIELD_CELL *p = &buf[blen]; + + assert(buf && blen >= 0); + while ((p > buf) && !ISBLANK(p[-1])) p--; - return( p ); + return (p); } /* Set this to 1 to use the div_t version. This is a good idea if your compiler has an intrinsic div() support. Unfortunately GNU-C has it - not yet. + not yet. N.B.: This only works if form->curcol follows immediately form->currow - and both are of type int. + and both are of type int. */ #define USE_DIV_T (0) /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static void Adjust_Cursor_Position( | FORM * form, const char * pos) -| -| Description : Set current row and column of the form to values +| +| Description : Set current row and column of the form to values | corresponding to the buffer position. | | Return Values : - +--------------------------------------------------------------------------*/ -INLINE static void Adjust_Cursor_Position(FORM * form, const char * pos) +INLINE static void +Adjust_Cursor_Position(FORM *form, const FIELD_CELL *pos) { FIELD *field; int idx; field = form->current; - assert( pos >= field->buf && field->dcols > 0); - idx = (int)( pos - field->buf ); + assert(pos >= field->buf && field->dcols > 0); + idx = (int)(pos - field->buf); #if USE_DIV_T - *((div_t *)&(form->currow)) = div(idx,field->dcols); + *((div_t *) & (form->currow)) = div(idx, field->dcols); #else form->currow = idx / field->dcols; form->curcol = idx - field->cols * form->currow; -#endif - if ( field->drows < form->currow ) +#endif + if (field->drows < form->currow) form->currow = 0; } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static void Buffer_To_Window( | const FIELD * field, | WINDOW * win) -| +| | Description : Copy the buffer to the window. If it is a multi-line | field, the buffer is split to the lines of the | window without any editing. | | Return Values : - +--------------------------------------------------------------------------*/ -static void Buffer_To_Window(const FIELD * field, WINDOW * win) +static void +Buffer_To_Window(const FIELD *field, WINDOW *win) { int width, height; + int y, x; int len; int row; - char *pBuffer; + FIELD_CELL *pBuffer; assert(win && field); - width = getmaxx(win); + getyx(win, y, x); + width = getmaxx(win); height = getmaxy(win); - for(row=0, pBuffer=field->buf; - row < height; - row++, pBuffer += width ) + for (row = 0, pBuffer = field->buf; + row < height; + row++, pBuffer += width) { - if ((len = (int)( After_End_Of_Data( pBuffer, width ) - pBuffer )) > 0) + if ((len = (int)(After_End_Of_Data(pBuffer, width) - pBuffer)) > 0) { - wmove( win, row, 0 ); - waddnstr( win, pBuffer, len ); + wmove(win, row, 0); + myADDNSTR(win, pBuffer, len); } - } + } + wmove(win, y, x); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static void Window_To_Buffer( | WINDOW * win, | FIELD * field) -| +| | Description : Copy the content of the window into the buffer. | The multiple lines of a window are simply | concatenated into the buffer. Pad characters in @@ -359,42 +511,48 @@ static void Buffer_To_Window(const FIELD * field, WINDOW * win) | | Return Values : - +--------------------------------------------------------------------------*/ -static void Window_To_Buffer(WINDOW * win, FIELD * field) +static void +Window_To_Buffer(WINDOW *win, FIELD *field) { int pad; int len = 0; - char *p; + FIELD_CELL *p; int row, height; - - assert(win && field && field->buf ); + + assert(win && field && field->buf); pad = field->pad; p = field->buf; height = getmaxy(win); - for(row=0; (row < height) && (row < field->drows); row++ ) + for (row = 0; (row < height) && (row < field->drows); row++) { - wmove( win, row, 0 ); - len += winnstr( win, p+len, field->dcols ); + wmove(win, row, 0); + len += myINNSTR(win, p + len, field->dcols); } - p[len] = '\0'; + p[len] = myZEROS; /* replace visual padding character by blanks in buffer */ if (pad != C_BLANK) { int i; - for(i=0; ichars[1] == 0 +#endif + && AttrOf(*p) == ChAttrOf(pad)) + *p = myBLANK; } } } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static void Synchronize_Buffer(FORM * form) -| +| | Description : If there was a change, copy the content of the | window into the buffer, so the buffer is synchronized | with the windows content. We have to indicate that the @@ -402,21 +560,22 @@ static void Window_To_Buffer(WINDOW * win, FIELD * field) | | Return Values : - +--------------------------------------------------------------------------*/ -INLINE static void Synchronize_Buffer(FORM * form) +INLINE static void +Synchronize_Buffer(FORM *form) { if (form->status & _WINDOW_MODIFIED) { form->status &= ~_WINDOW_MODIFIED; - form->status |= _FCHECK_REQUIRED; - Window_To_Buffer(form->w,form->current); - wmove(form->w,form->currow,form->curcol); + form->status |= _FCHECK_REQUIRED; + Window_To_Buffer(form->w, form->current); + wmove(form->w, form->currow, form->curcol); } } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static bool Field_Grown( FIELD *field, int amount) -| +| | Description : This function is called for growable dynamic fields | only. It has to increase the buffers and to allocate | a new window for this field. @@ -427,7 +586,8 @@ INLINE static void Synchronize_Buffer(FORM * form) | Return Values : TRUE - field successfully increased | FALSE - there was some error +--------------------------------------------------------------------------*/ -static bool Field_Grown(FIELD * field, int amount) +static bool +Field_Grown(FIELD *field, int amount) { bool result = FALSE; @@ -438,23 +598,23 @@ static bool Field_Grown(FIELD * field, int amount) int new_buflen; int old_dcols = field->dcols; int old_drows = field->drows; - char *oldbuf = field->buf; - char *newbuf; + FIELD_CELL *oldbuf = field->buf; + FIELD_CELL *newbuf; int growth; FORM *form = field->form; - bool need_visual_update = ((form != (FORM *)0) && + bool need_visual_update = ((form != (FORM *)0) && (form->status & _POSTED) && - (form->current==field)); - + (form->current == field)); + if (need_visual_update) Synchronize_Buffer(form); - + if (single_line_field) { growth = field->cols * amount; if (field->maxgrow) - growth = Minimum(field->maxgrow - field->dcols,growth); + growth = Minimum(field->maxgrow - field->dcols, growth); field->dcols += growth; if (field->dcols == field->maxgrow) field->status &= ~_MAY_GROW; @@ -463,96 +623,113 @@ static bool Field_Grown(FIELD * field, int amount) { growth = (field->rows + field->nrow) * amount; if (field->maxgrow) - growth = Minimum(field->maxgrow - field->drows,growth); + growth = Minimum(field->maxgrow - field->drows, growth); field->drows += growth; if (field->drows == field->maxgrow) field->status &= ~_MAY_GROW; } /* drows, dcols changed, so we get really the new buffer length */ new_buflen = Buffer_Length(field); - newbuf=(char *)malloc((size_t)Total_Buffer_Size(field)); + newbuf = (FIELD_CELL *)malloc(Total_Buffer_Size(field)); if (!newbuf) - { /* restore to previous state */ + { + /* restore to previous state */ field->dcols = old_dcols; field->drows = old_drows; - if (( single_line_field && (field->dcols!=field->maxgrow)) || - (!single_line_field && (field->drows!=field->maxgrow))) + if ((single_line_field && (field->dcols != field->maxgrow)) || + (!single_line_field && (field->drows != field->maxgrow))) field->status |= _MAY_GROW; - return FALSE; } else - { /* Copy all the buffers. This is the reason why we can't - just use realloc(). - */ - int i; - char *old_bp; - char *new_bp; - + { + /* Copy all the buffers. This is the reason why we can't just use + * realloc(). + */ + int i, j; + FIELD_CELL *old_bp; + FIELD_CELL *new_bp; + + result = TRUE; /* allow sharing of recovery on failure */ + field->buf = newbuf; - for(i=0;i<=field->nbuf;i++) + for (i = 0; i <= field->nbuf; i++) { - new_bp = Address_Of_Nth_Buffer(field,i); - old_bp = oldbuf + i*(1+old_buflen); - memcpy(new_bp,old_bp,(size_t)old_buflen); - if (new_buflen > old_buflen) - memset(new_bp + old_buflen,C_BLANK, - (size_t)(new_buflen - old_buflen)); - *(new_bp + new_buflen) = '\0'; + new_bp = Address_Of_Nth_Buffer(field, i); + old_bp = oldbuf + i * (1 + old_buflen); + for (j = 0; j < old_buflen; ++j) + new_bp[j] = old_bp[j]; + while (j < new_buflen) + new_bp[j++] = myBLANK; + new_bp[new_buflen] = myZEROS; } - if (need_visual_update) - { - WINDOW *new_window = newpad(field->drows,field->dcols); - if (!new_window) - { /* restore old state */ - field->dcols = old_dcols; - field->drows = old_drows; - field->buf = oldbuf; - if (( single_line_field && - (field->dcols!=field->maxgrow)) || - (!single_line_field && - (field->drows!=field->maxgrow))) - field->status |= _MAY_GROW; - free( newbuf ); - return FALSE; +#if USE_WIDEC_SUPPORT + if (wresize(field->working, 1, Buffer_Length(field) + 1) == ERR) + result = FALSE; +#endif + + if (need_visual_update && result) + { + WINDOW *new_window = newpad(field->drows, field->dcols); + + if (new_window != 0) + { + assert(form != (FORM *)0); + if (form->w) + delwin(form->w); + form->w = new_window; + Set_Field_Window_Attributes(field, form->w); + werase(form->w); + Buffer_To_Window(field, form->w); + untouchwin(form->w); + wmove(form->w, form->currow, form->curcol); } - assert(form!=(FORM *)0); - if (form->w) - delwin(form->w); - form->w = new_window; - Set_Field_Window_Attributes(field,form->w); - werase(form->w); - Buffer_To_Window(field,form->w); - untouchwin(form->w); - wmove(form->w,form->currow,form->curcol); + else + result = FALSE; } - free(oldbuf); - /* reflect changes in linked fields */ - if (field != field->link) + if (result) { - FIELD *linked_field; - for(linked_field = field->link; - linked_field!= field; - linked_field = linked_field->link) + free(oldbuf); + /* reflect changes in linked fields */ + if (field != field->link) { - linked_field->buf = field->buf; - linked_field->drows = field->drows; - linked_field->dcols = field->dcols; + FIELD *linked_field; + + for (linked_field = field->link; + linked_field != field; + linked_field = linked_field->link) + { + linked_field->buf = field->buf; + linked_field->drows = field->drows; + linked_field->dcols = field->dcols; + } } } - result = TRUE; - } + else + { + /* restore old state */ + field->dcols = old_dcols; + field->drows = old_drows; + field->buf = oldbuf; + if ((single_line_field && + (field->dcols != field->maxgrow)) || + (!single_line_field && + (field->drows != field->maxgrow))) + field->status |= _MAY_GROW; + free(newbuf); + } + } } - return(result); + return (result); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int _nc_Position_Form_Cursor(FORM * form) -| +| | Description : Position the cursor in the window for the current -| field to be in sync. with the currow and curcol +| field to be in sync. with the currow and curcol | values. | | Return Values : E_OK - success @@ -561,39 +738,39 @@ static bool Field_Grown(FIELD * field, int amount) | field-window +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -_nc_Position_Form_Cursor (FORM * form) +_nc_Position_Form_Cursor(FORM *form) { - FIELD *field; + FIELD *field; WINDOW *formwin; - + if (!form) - return(E_BAD_ARGUMENT); + return (E_BAD_ARGUMENT); - if (!form->w || !form->current) - return(E_SYSTEM_ERROR); + if (!form->w || !form->current) + return (E_SYSTEM_ERROR); - field = form->current; - formwin = Get_Form_Window(form); + field = form->current; + formwin = Get_Form_Window(form); - wmove( form->w, form->currow, form->curcol ); - if ( Has_Invisible_Parts(field) ) + wmove(form->w, form->currow, form->curcol); + if (Has_Invisible_Parts(field)) { /* in this case fieldwin isn't derived from formwin, so we have - to move the cursor in formwin by hand... */ + to move the cursor in formwin by hand... */ wmove(formwin, field->frow + form->currow - form->toprow, field->fcol + form->curcol - form->begincol); wcursyncup(formwin); } - else + else wcursyncup(form->w); - return(E_OK); + return (E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int _nc_Refresh_Current_Field(FORM * form) -| +| | Description : Propagate the changes in the fields window to the | window of the form. | @@ -602,19 +779,21 @@ _nc_Position_Form_Cursor (FORM * form) | E_SYSTEM_ERROR - general error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -_nc_Refresh_Current_Field (FORM * form) +_nc_Refresh_Current_Field(FORM *form) { WINDOW *formwin; - FIELD *field; + FIELD *field; + + T((T_CALLED("_nc_Refresh_Current_Field(%p)"), form)); if (!form) RETURN(E_BAD_ARGUMENT); - if (!form->w || !form->current) + if (!form->w || !form->current) RETURN(E_SYSTEM_ERROR); - field = form->current; - formwin = Get_Form_Window(form); + field = form->current; + formwin = Get_Form_Window(form); if (field->opts & O_PUBLIC) { @@ -623,13 +802,14 @@ _nc_Refresh_Current_Field (FORM * form) /* Again, in this case the fieldwin isn't derived from formwin, so we have to perform a copy operation. */ if (Single_Line_Field(field)) - { /* horizontal scrolling */ + { + /* horizontal scrolling */ if (form->curcol < form->begincol) - form->begincol = form->curcol; + form->begincol = form->curcol; else { if (form->curcol >= (form->begincol + field->cols)) - form->begincol = form->curcol - field->cols + 1; + form->begincol = form->curcol - field->cols + 1; } copywin(form->w, formwin, @@ -642,8 +822,9 @@ _nc_Refresh_Current_Field (FORM * form) 0); } else - { /* A multi-line, i.e. vertical scrolling field */ - int row_after_bottom,first_modified_row,first_unmodified_row; + { + /* A multi-line, i.e. vertical scrolling field */ + int row_after_bottom, first_modified_row, first_unmodified_row; if (field->drows > field->rows) { @@ -659,25 +840,27 @@ _nc_Refresh_Current_Field (FORM * form) field->status |= _NEWTOP; } if (field->status & _NEWTOP) - { /* means we have to copy whole range */ + { + /* means we have to copy whole range */ first_modified_row = form->toprow; first_unmodified_row = first_modified_row + field->rows; field->status &= ~_NEWTOP; } - else - { /* we try to optimize : finding the range of touched - lines */ + else + { + /* we try to optimize : finding the range of touched + lines */ first_modified_row = form->toprow; - while(first_modified_row < row_after_bottom) + while (first_modified_row < row_after_bottom) { - if (is_linetouched(form->w,first_modified_row)) + if (is_linetouched(form->w, first_modified_row)) break; first_modified_row++; } first_unmodified_row = first_modified_row; - while(first_unmodified_row < row_after_bottom) + while (first_unmodified_row < row_after_bottom) { - if (!is_linetouched(form->w,first_unmodified_row)) + if (!is_linetouched(form->w, first_unmodified_row)) break; first_unmodified_row++; } @@ -685,7 +868,7 @@ _nc_Refresh_Current_Field (FORM * form) } else { - first_modified_row = form->toprow; + first_modified_row = form->toprow; first_unmodified_row = first_modified_row + field->rows; } if (first_unmodified_row != first_modified_row) @@ -702,45 +885,47 @@ _nc_Refresh_Current_Field (FORM * form) wsyncup(formwin); } else - { /* if the field-window is simply a derived window, i.e. contains - no invisible parts, the whole thing is trivial - */ + { + /* if the field-window is simply a derived window, i.e. contains no + * invisible parts, the whole thing is trivial + */ wsyncup(form->w); } } untouchwin(form->w); - return _nc_Position_Form_Cursor(form); + returnCode(_nc_Position_Form_Cursor(form)); } - + /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static void Perform_Justification( | FIELD * field, | WINDOW * win) -| -| Description : Output field with requested justification +| +| Description : Output field with requested justification | | Return Values : - +--------------------------------------------------------------------------*/ -static void Perform_Justification(FIELD * field, WINDOW * win) +static void +Perform_Justification(FIELD *field, WINDOW *win) { - char *bp; + FIELD_CELL *bp; int len; - int col = 0; + int col = 0; - bp = Get_Start_Of_Data(field->buf,Buffer_Length(field)); - len = (int)(After_End_Of_Data(field->buf,Buffer_Length(field)) - bp); + bp = Get_Start_Of_Data(field->buf, Buffer_Length(field)); + len = (int)(After_End_Of_Data(field->buf, Buffer_Length(field)) - bp); - if (len>0) + if (len > 0) { assert(win && (field->drows == 1) && (field->dcols == field->cols)); - switch(field->just) + switch (field->just) { case JUSTIFY_LEFT: break; case JUSTIFY_CENTER: - col = (field->cols - len)/2; + col = (field->cols - len) / 2; break; case JUSTIFY_RIGHT: col = field->cols - len; @@ -749,77 +934,79 @@ static void Perform_Justification(FIELD * field, WINDOW * win) break; } - wmove(win,0,col); - waddnstr(win,bp,len); + wmove(win, 0, col); + myADDNSTR(win, bp, len); } } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static void Undo_Justification( | FIELD * field, | WINDOW * win) -| +| | Description : Display field without any justification, i.e. | left justified | | Return Values : - +--------------------------------------------------------------------------*/ -static void Undo_Justification(FIELD * field, WINDOW * win) +static void +Undo_Justification(FIELD *field, WINDOW *win) { - char *bp; + FIELD_CELL *bp; int len; - bp = Get_Start_Of_Data(field->buf,Buffer_Length(field)); - len = (int)(After_End_Of_Data(field->buf,Buffer_Length(field))-bp); + bp = Get_Start_Of_Data(field->buf, Buffer_Length(field)); + len = (int)(After_End_Of_Data(field->buf, Buffer_Length(field)) - bp); - if (len>0) + if (len > 0) { assert(win); - wmove(win,0,0); - waddnstr(win,bp,len); + wmove(win, 0, 0); + myADDNSTR(win, bp, len); } } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static bool Check_Char( | FIELDTYPE * typ, | int ch, | TypeArgument *argp) -| +| | Description : Perform a single character check for character ch -| according to the fieldtype instance. +| according to the fieldtype instance. | | Return Values : TRUE - Character is valid | FALSE - Character is invalid +--------------------------------------------------------------------------*/ -static bool Check_Char(FIELDTYPE * typ, int ch, TypeArgument *argp) +static bool +Check_Char(FIELDTYPE *typ, int ch, TypeArgument *argp) { - if (typ) + if (typ) { if (typ->status & _LINKED_TYPE) { assert(argp); - return( - Check_Char(typ->left ,ch,argp->left ) || - Check_Char(typ->right,ch,argp->right) ); - } - else + return ( + Check_Char(typ->left, ch, argp->left) || + Check_Char(typ->right, ch, argp->right)); + } + else { if (typ->ccheck) - return typ->ccheck(ch,(void *)argp); + return typ->ccheck(ch, (void *)argp); } } - return (isprint((unsigned char)ch) ? TRUE : FALSE); + return (!iscntrl(UChar(ch)) ? TRUE : FALSE); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Display_Or_Erase_Field( | FIELD * field, | bool bEraseFlag) -| +| | Description : Create a subwindow for the field and display the | buffer contents (apply justification if required) | or simply erase the field. @@ -827,7 +1014,8 @@ static bool Check_Char(FIELDTYPE * typ, int ch, TypeArgument *argp) | Return Values : E_OK - on success | E_SYSTEM_ERROR - some error (typical no memory) +--------------------------------------------------------------------------*/ -static int Display_Or_Erase_Field(FIELD * field, bool bEraseFlag) +static int +Display_Or_Erase_Field(FIELD *field, bool bEraseFlag) { WINDOW *win; WINDOW *fwin; @@ -836,17 +1024,17 @@ static int Display_Or_Erase_Field(FIELD * field, bool bEraseFlag) return E_SYSTEM_ERROR; fwin = Get_Form_Window(field->form); - win = derwin(fwin, - field->rows,field->cols,field->frow,field->fcol); + win = derwin(fwin, + field->rows, field->cols, field->frow, field->fcol); - if (!win) + if (!win) return E_SYSTEM_ERROR; else { if (field->opts & O_VISIBLE) - Set_Field_Window_Attributes(field,win); + Set_Field_Window_Attributes(field, win); else - wattrset(win,getattrs(fwin)); + wattrset(win, getattrs(fwin)); werase(win); } @@ -855,9 +1043,9 @@ static int Display_Or_Erase_Field(FIELD * field, bool bEraseFlag) if (field->opts & O_PUBLIC) { if (Justification_Allowed(field)) - Perform_Justification(field,win); + Perform_Justification(field, win); else - Buffer_To_Window(field,win); + Buffer_To_Window(field, win); } field->status &= ~_NEWTOP; } @@ -871,176 +1059,185 @@ static int Display_Or_Erase_Field(FIELD * field, bool bEraseFlag) #define Erase_Field(field) Display_Or_Erase_Field(field,TRUE) /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Synchronize_Field(FIELD * field) -| +| | Description : Synchronize the windows content with the value in | the buffer. | | Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid field pointer +| E_BAD_ARGUMENT - invalid field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ -static int Synchronize_Field(FIELD * field) +static int +Synchronize_Field(FIELD *field) { FORM *form; int res = E_OK; if (!field) - return(E_BAD_ARGUMENT); + return (E_BAD_ARGUMENT); - if (((form=field->form) != (FORM *)0) + if (((form = field->form) != (FORM *)0) && Field_Really_Appears(field)) { if (field == form->current) - { - form->currow = form->curcol = form->toprow = form->begincol = 0; + { + form->currow = form->curcol = form->toprow = form->begincol = 0; werase(form->w); - - if ( (field->opts & O_PUBLIC) && Justification_Allowed(field) ) - Undo_Justification( field, form->w ); + + if ((field->opts & O_PUBLIC) && Justification_Allowed(field)) + Undo_Justification(field, form->w); else - Buffer_To_Window( field, form->w ); - + Buffer_To_Window(field, form->w); + field->status |= _NEWTOP; - res = _nc_Refresh_Current_Field( form ); + res = _nc_Refresh_Current_Field(form); } else - res = Display_Field( field ); + res = Display_Field(field); } field->status |= _CHANGED; - return(res); + return (res); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Synchronize_Linked_Fields(FIELD * field) -| +| | Description : Propagate the Synchronize_Field function to all linked | fields. The first error that occurs in the sequence | of updates is the return value. | | Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid field pointer +| E_BAD_ARGUMENT - invalid field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ -static int Synchronize_Linked_Fields(FIELD * field) +static int +Synchronize_Linked_Fields(FIELD *field) { FIELD *linked_field; int res = E_OK; int syncres; if (!field) - return(E_BAD_ARGUMENT); + return (E_BAD_ARGUMENT); if (!field->link) - return(E_SYSTEM_ERROR); + return (E_SYSTEM_ERROR); - for(linked_field = field->link; - linked_field!= field; - linked_field = linked_field->link ) + for (linked_field = field->link; + linked_field != field; + linked_field = linked_field->link) { - if (((syncres=Synchronize_Field(linked_field)) != E_OK) && - (res==E_OK)) + if (((syncres = Synchronize_Field(linked_field)) != E_OK) && + (res == E_OK)) res = syncres; } - return(res); + return (res); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int _nc_Synchronize_Attributes(FIELD * field) -| +| | Description : If a fields visual attributes have changed, this | routine is called to propagate those changes to the -| screen. +| screen. | | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -_nc_Synchronize_Attributes (FIELD * field) +_nc_Synchronize_Attributes(FIELD *field) { FORM *form; int res = E_OK; WINDOW *formwin; + T((T_CALLED("_nc_Synchronize_Attributes(%p)"), field)); + if (!field) - return(E_BAD_ARGUMENT); + returnCode(E_BAD_ARGUMENT); - if (((form=field->form) != (FORM *)0) + CHECKPOS(field->form); + if (((form = field->form) != (FORM *)0) && Field_Really_Appears(field)) - { - if (form->current==field) + { + if (form->current == field) { Synchronize_Buffer(form); - Set_Field_Window_Attributes(field,form->w); + Set_Field_Window_Attributes(field, form->w); werase(form->w); + wmove(form->w, form->currow, form->curcol); + if (field->opts & O_PUBLIC) { if (Justification_Allowed(field)) - Undo_Justification(field,form->w); - else - Buffer_To_Window(field,form->w); + Undo_Justification(field, form->w); + else + Buffer_To_Window(field, form->w); } - else + else { - formwin = Get_Form_Window(form); - copywin(form->w,formwin, - 0,0, - field->frow,field->fcol, - field->rows-1,field->cols-1,0); + formwin = Get_Form_Window(form); + copywin(form->w, formwin, + 0, 0, + field->frow, field->fcol, + field->rows - 1, field->cols - 1, 0); wsyncup(formwin); - Buffer_To_Window(field,form->w); - field->status |= _NEWTOP; /* fake refresh to paint all */ + Buffer_To_Window(field, form->w); + field->status |= _NEWTOP; /* fake refresh to paint all */ _nc_Refresh_Current_Field(form); } } - else + else { res = Display_Field(field); } } - return(res); + CHECKPOS(form); + returnCode(res); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int _nc_Synchronize_Options(FIELD * field, | Field_Options newopts) -| +| | Description : If a fields options have changed, this routine is | called to propagate these changes to the screen and | to really change the behavior of the field. | | Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid field pointer +| E_BAD_ARGUMENT - invalid field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -_nc_Synchronize_Options -(FIELD *field, Field_Options newopts) +_nc_Synchronize_Options(FIELD *field, Field_Options newopts) { Field_Options oldopts; Field_Options changed_opts; FORM *form; int res = E_OK; + T((T_CALLED("_nc_Synchronize_Options(%p,%#x)"), field, newopts)); + if (!field) - return(E_BAD_ARGUMENT); + returnCode(E_BAD_ARGUMENT); - oldopts = field->opts; + oldopts = field->opts; changed_opts = oldopts ^ newopts; - field->opts = newopts; - form = field->form; + field->opts = newopts; + form = field->form; if (form) { if (form->current == field) { field->opts = oldopts; - return(E_CURRENT); + returnCode(E_CURRENT); } if (form->status & _POSTED) @@ -1070,12 +1267,13 @@ _nc_Synchronize_Options int res2 = E_OK; if (newopts & O_STATIC) - { /* the field becomes now static */ + { + /* the field becomes now static */ field->status &= ~_MAY_GROW; /* if actually we have no hidden columns, justification may occur again */ - if (single_line_field && - (field->cols == field->dcols) && + if (single_line_field && + (field->cols == field->dcols) && (field->just != NO_JUSTIFICATION) && Field_Really_Appears(field)) { @@ -1083,62 +1281,64 @@ _nc_Synchronize_Options } } else - { /* field is no longer static */ - if ((field->maxgrow==0) || - ( single_line_field && (field->dcols < field->maxgrow)) || + { + /* field is no longer static */ + if ((field->maxgrow == 0) || + (single_line_field && (field->dcols < field->maxgrow)) || (!single_line_field && (field->drows < field->maxgrow))) { field->status |= _MAY_GROW; /* a field with justification now changes its behavior, - so we must redisplay it */ - if (single_line_field && + so we must redisplay it */ + if (single_line_field && (field->just != NO_JUSTIFICATION) && Field_Really_Appears(field)) { res2 = Display_Field(field); - } - } + } + } } if (res2 != E_OK) res = res2; } - return(res); + returnCode(res); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int _nc_Set_Current_Field(FORM * form, | FIELD * newfield) -| +| | Description : Make the newfield the new current field. | | Return Values : E_OK - success -| E_BAD_ARGUMENT - invalid form or field pointer +| E_BAD_ARGUMENT - invalid form or field pointer | E_SYSTEM_ERROR - some severe basic error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -_nc_Set_Current_Field -(FORM *form, FIELD *newfield) +_nc_Set_Current_Field(FORM *form, FIELD *newfield) { - FIELD *field; + FIELD *field; WINDOW *new_window; - if (!form || !newfield || !form->current || (newfield->form!=form)) - return(E_BAD_ARGUMENT); + T((T_CALLED("_nc_Set_Current_Field(%p,%p)"), form, newfield)); + + if (!form || !newfield || !form->current || (newfield->form != form)) + returnCode(E_BAD_ARGUMENT); - if ( (form->status & _IN_DRIVER) ) - return(E_BAD_STATE); + if ((form->status & _IN_DRIVER)) + returnCode(E_BAD_STATE); if (!(form->field)) - return(E_NOT_CONNECTED); + returnCode(E_NOT_CONNECTED); field = form->current; - - if ((field!=newfield) || + + if ((field != newfield) || !(form->status & _POSTED)) { - if ((form->w) && + if ((form->w) && (field->opts & O_VISIBLE) && (field->form->curpage == field->page)) { @@ -1147,18 +1347,18 @@ _nc_Set_Current_Field { if (field->drows > field->rows) { - if (form->toprow==0) + if (form->toprow == 0) field->status &= ~_NEWTOP; - else + else field->status |= _NEWTOP; - } - else + } + else { if (Justification_Allowed(field)) { - Window_To_Buffer(form->w,field); + Window_To_Buffer(form->w, field); werase(form->w); - Perform_Justification(field,form->w); + Perform_Justification(field, form->w); wsyncup(form->w); } } @@ -1166,38 +1366,38 @@ _nc_Set_Current_Field delwin(form->w); form->w = (WINDOW *)0; } - + field = newfield; if (Has_Invisible_Parts(field)) - new_window = newpad(field->drows,field->dcols); - else + new_window = newpad(field->drows, field->dcols); + else new_window = derwin(Get_Form_Window(form), - field->rows,field->cols,field->frow,field->fcol); + field->rows, field->cols, field->frow, field->fcol); - if (!new_window) - return(E_SYSTEM_ERROR); + if (!new_window) + returnCode(E_SYSTEM_ERROR); form->current = field; if (form->w) delwin(form->w); - form->w = new_window; + form->w = new_window; form->status &= ~_WINDOW_MODIFIED; - Set_Field_Window_Attributes(field,form->w); + Set_Field_Window_Attributes(field, form->w); if (Has_Invisible_Parts(field)) { werase(form->w); - Buffer_To_Window(field,form->w); - } - else + Buffer_To_Window(field, form->w); + } + else { if (Justification_Allowed(field)) { werase(form->w); - Undo_Justification(field,form->w); + Undo_Justification(field, form->w); wsyncup(form->w); } } @@ -1206,417 +1406,461 @@ _nc_Set_Current_Field } form->currow = form->curcol = form->toprow = form->begincol = 0; - return(E_OK); + returnCode(E_OK); } - + /*---------------------------------------------------------------------------- Intra-Field Navigation routines --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_Next_Character(FORM * form) -| +| | Description : Move to the next character in the field. In a multi-line | field this wraps at the end of the line. | | Return Values : E_OK - success | E_REQUEST_DENIED - at the rightmost position +--------------------------------------------------------------------------*/ -static int IFN_Next_Character(FORM * form) +static int +IFN_Next_Character(FORM *form) { FIELD *field = form->current; - - if ((++(form->curcol))==field->dcols) + int step = myWCWIDTH(form->w, form->currow, form->curcol); + + T((T_CALLED("IFN_Next_Character(%p)"), form)); + if ((form->curcol += step) == field->dcols) { - if ((++(form->currow))==field->drows) + if ((++(form->currow)) == field->drows) { #if GROW_IF_NAVIGATE - if (!Single_Line_Field(field) && Field_Grown(field,1)) { - form->curcol = 0; - return(E_OK); - } + if (!Single_Line_Field(field) && Field_Grown(field, 1)) + { + form->curcol = 0; + returnCode(E_OK); + } #endif form->currow--; #if GROW_IF_NAVIGATE - if (Single_Line_Field(field) && Field_Grown(field,1)) - return(E_OK); + if (Single_Line_Field(field) && Field_Grown(field, 1)) + returnCode(E_OK); #endif - form->curcol--; - return(E_REQUEST_DENIED); + form->curcol -= step; + returnCode(E_REQUEST_DENIED); } form->curcol = 0; } - return(E_OK); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_Previous_Character(FORM * form) -| -| Description : Move to the previous character in the field. In a -| multi-line field this wraps and the beginning of the +| +| Description : Move to the previous character in the field. In a +| multi-line field this wraps and the beginning of the | line. | | Return Values : E_OK - success | E_REQUEST_DENIED - at the leftmost position +--------------------------------------------------------------------------*/ -static int IFN_Previous_Character(FORM * form) +static int +IFN_Previous_Character(FORM *form) { - if ((--(form->curcol))<0) + int amount = myWCWIDTH(form->w, form->currow, form->curcol - 1); + int oldcol = form->curcol; + + T((T_CALLED("IFN_Previous_Character(%p)"), form)); + if ((form->curcol -= amount) < 0) { - if ((--(form->currow))<0) + if ((--(form->currow)) < 0) { form->currow++; - form->curcol++; - return(E_REQUEST_DENIED); + form->curcol = oldcol; + returnCode(E_REQUEST_DENIED); } form->curcol = form->current->dcols - 1; } - return(E_OK); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_Next_Line(FORM * form) -| +| | Description : Move to the beginning of the next line in the field | | Return Values : E_OK - success | E_REQUEST_DENIED - at the last line +--------------------------------------------------------------------------*/ -static int IFN_Next_Line(FORM * form) +static int +IFN_Next_Line(FORM *form) { FIELD *field = form->current; - if ((++(form->currow))==field->drows) + T((T_CALLED("IFN_Next_Line(%p)"), form)); + if ((++(form->currow)) == field->drows) { #if GROW_IF_NAVIGATE - if (!Single_Line_Field(field) && Field_Grown(field,1)) - return(E_OK); + if (!Single_Line_Field(field) && Field_Grown(field, 1)) + returnCode(E_OK); #endif form->currow--; - return(E_REQUEST_DENIED); + returnCode(E_REQUEST_DENIED); } form->curcol = 0; - return(E_OK); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_Previous_Line(FORM * form) -| +| | Description : Move to the beginning of the previous line in the field | | Return Values : E_OK - success | E_REQUEST_DENIED - at the first line +--------------------------------------------------------------------------*/ -static int IFN_Previous_Line(FORM * form) +static int +IFN_Previous_Line(FORM *form) { - if ( (--(form->currow)) < 0 ) + T((T_CALLED("IFN_Previous_Line(%p)"), form)); + if ((--(form->currow)) < 0) { form->currow++; - return(E_REQUEST_DENIED); + returnCode(E_REQUEST_DENIED); } form->curcol = 0; - return(E_OK); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_Next_Word(FORM * form) -| +| | Description : Move to the beginning of the next word in the field. | | Return Values : E_OK - success | E_REQUEST_DENIED - there is no next word +--------------------------------------------------------------------------*/ -static int IFN_Next_Word(FORM * form) +static int +IFN_Next_Word(FORM *form) { FIELD *field = form->current; - char *bp = Address_Of_Current_Position_In_Buffer(form); - char *s; - char *t; + FIELD_CELL *bp = Address_Of_Current_Position_In_Buffer(form); + FIELD_CELL *s; + FIELD_CELL *t; + + T((T_CALLED("IFN_Next_Word(%p)"), form)); /* We really need access to the data, so we have to synchronize */ Synchronize_Buffer(form); /* Go to the first whitespace after the current position (including current position). This is then the starting point to look for the - next non-blank data */ - s = Get_First_Whitespace_Character(bp,Buffer_Length(field) - + next non-blank data */ + s = Get_First_Whitespace_Character(bp, Buffer_Length(field) - (int)(bp - field->buf)); /* Find the start of the next word */ - t = Get_Start_Of_Data(s,Buffer_Length(field) - + t = Get_Start_Of_Data(s, Buffer_Length(field) - (int)(s - field->buf)); #if !FRIENDLY_PREV_NEXT_WORD - if (s==t) - return(E_REQUEST_DENIED); + if (s == t) + returnCode(E_REQUEST_DENIED); else #endif { - Adjust_Cursor_Position(form,t); - return(E_OK); + Adjust_Cursor_Position(form, t); + returnCode(E_OK); } } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_Previous_Word(FORM * form) -| +| | Description : Move to the beginning of the previous word in the field. | | Return Values : E_OK - success | E_REQUEST_DENIED - there is no previous word +--------------------------------------------------------------------------*/ -static int IFN_Previous_Word(FORM * form) +static int +IFN_Previous_Word(FORM *form) { FIELD *field = form->current; - char *bp = Address_Of_Current_Position_In_Buffer(form); - char *s; - char *t; - bool again = FALSE; + FIELD_CELL *bp = Address_Of_Current_Position_In_Buffer(form); + FIELD_CELL *s; + FIELD_CELL *t; + bool again = FALSE; + + T((T_CALLED("IFN_Previous_Word(%p)"), form)); /* We really need access to the data, so we have to synchronize */ Synchronize_Buffer(form); - s = After_End_Of_Data(field->buf,(int)(bp-field->buf)); + s = After_End_Of_Data(field->buf, (int)(bp - field->buf)); /* s points now right after the last non-blank in the buffer before bp. If bp was in a word, s equals bp. In this case we must find the last whitespace in the buffer before bp and repeat the game to really find the previous word! */ - if (s==bp) + if (s == bp) again = TRUE; - + /* And next call now goes backward to look for the last whitespace before that, pointing right after this, so it points to the begin - of the previous word. - */ - t = After_Last_Whitespace_Character(field->buf,(int)(s - field->buf)); + of the previous word. + */ + t = After_Last_Whitespace_Character(field->buf, (int)(s - field->buf)); #if !FRIENDLY_PREV_NEXT_WORD - if (s==t) - return(E_REQUEST_DENIED); + if (s == t) + returnCode(E_REQUEST_DENIED); #endif if (again) - { /* and do it again, replacing bp by t */ - s = After_End_Of_Data(field->buf,(int)(t - field->buf)); - t = After_Last_Whitespace_Character(field->buf,(int)(s - field->buf)); + { + /* and do it again, replacing bp by t */ + s = After_End_Of_Data(field->buf, (int)(t - field->buf)); + t = After_Last_Whitespace_Character(field->buf, (int)(s - field->buf)); #if !FRIENDLY_PREV_NEXT_WORD - if (s==t) - return(E_REQUEST_DENIED); + if (s == t) + returnCode(E_REQUEST_DENIED); #endif } - Adjust_Cursor_Position(form,t); - return(E_OK); + Adjust_Cursor_Position(form, t); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_Beginning_Of_Field(FORM * form) -| +| | Description : Place the cursor at the first non-pad character in -| the field. +| the field. | -| Return Values : E_OK - success +| Return Values : E_OK - success +--------------------------------------------------------------------------*/ -static int IFN_Beginning_Of_Field(FORM * form) +static int +IFN_Beginning_Of_Field(FORM *form) { FIELD *field = form->current; + T((T_CALLED("IFN_Beginning_Of_Field(%p)"), form)); Synchronize_Buffer(form); Adjust_Cursor_Position(form, - Get_Start_Of_Data(field->buf,Buffer_Length(field))); - return(E_OK); + Get_Start_Of_Data(field->buf, Buffer_Length(field))); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_End_Of_Field(FORM * form) -| +| | Description : Place the cursor after the last non-pad character in | the field. If the field occupies the last position in -| the buffer, the cursor is positioned on the last +| the buffer, the cursor is positioned on the last | character. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -static int IFN_End_Of_Field(FORM * form) +static int +IFN_End_Of_Field(FORM *form) { FIELD *field = form->current; - char *pos; + FIELD_CELL *pos; + T((T_CALLED("IFN_End_Of_Field(%p)"), form)); Synchronize_Buffer(form); - pos = After_End_Of_Data(field->buf,Buffer_Length(field)); - if (pos==(field->buf + Buffer_Length(field))) + pos = After_End_Of_Data(field->buf, Buffer_Length(field)); + if (pos == (field->buf + Buffer_Length(field))) pos--; - Adjust_Cursor_Position(form,pos); - return(E_OK); + Adjust_Cursor_Position(form, pos); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_Beginning_Of_Line(FORM * form) -| +| | Description : Place the cursor on the first non-pad character in | the current line of the field. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -static int IFN_Beginning_Of_Line(FORM * form) +static int +IFN_Beginning_Of_Line(FORM *form) { FIELD *field = form->current; + T((T_CALLED("IFN_Beginning_Of_Line(%p)"), form)); Synchronize_Buffer(form); Adjust_Cursor_Position(form, - Get_Start_Of_Data(Address_Of_Current_Row_In_Buffer(form), - field->dcols)); - return(E_OK); + Get_Start_Of_Data(Address_Of_Current_Row_In_Buffer(form), + field->dcols)); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_End_Of_Line(FORM * form) -| +| | Description : Place the cursor after the last non-pad character in the -| current line of the field. If the field occupies the +| current line of the field. If the field occupies the | last column in the line, the cursor is positioned on the | last character of the line. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -static int IFN_End_Of_Line(FORM * form) +static int +IFN_End_Of_Line(FORM *form) { FIELD *field = form->current; - char *pos; - char *bp; + FIELD_CELL *pos; + FIELD_CELL *bp; + T((T_CALLED("IFN_End_Of_Line(%p)"), form)); Synchronize_Buffer(form); - bp = Address_Of_Current_Row_In_Buffer(form); - pos = After_End_Of_Data(bp,field->dcols); + bp = Address_Of_Current_Row_In_Buffer(form); + pos = After_End_Of_Data(bp, field->dcols); if (pos == (bp + field->dcols)) pos--; - Adjust_Cursor_Position(form,pos); - return(E_OK); + Adjust_Cursor_Position(form, pos); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_Left_Character(FORM * form) -| +| | Description : Move one character to the left in the current line. -| This doesn't cycle. +| This doesn't cycle. | | Return Values : E_OK - success | E_REQUEST_DENIED - already in first column +--------------------------------------------------------------------------*/ -static int IFN_Left_Character(FORM * form) +static int +IFN_Left_Character(FORM *form) { - if ( (--(form->curcol)) < 0 ) + int amount = myWCWIDTH(form->w, form->currow, form->curcol - 1); + int oldcol = form->curcol; + + T((T_CALLED("IFN_Left_Character(%p)"), form)); + if ((form->curcol -= amount) < 0) { - form->curcol++; - return(E_REQUEST_DENIED); + form->curcol = oldcol; + returnCode(E_REQUEST_DENIED); } - return(E_OK); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_Right_Character(FORM * form) -| +| | Description : Move one character to the right in the current line. | This doesn't cycle. | | Return Values : E_OK - success | E_REQUEST_DENIED - already in last column +--------------------------------------------------------------------------*/ -static int IFN_Right_Character(FORM * form) +static int +IFN_Right_Character(FORM *form) { - if ( (++(form->curcol)) == form->current->dcols ) + int amount = myWCWIDTH(form->w, form->currow, form->curcol); + int oldcol = form->curcol; + + T((T_CALLED("IFN_Right_Character(%p)"), form)); + if ((form->curcol += amount) >= form->current->dcols) { #if GROW_IF_NAVIGATE FIELD *field = form->current; - if (Single_Line_Field(field) && Field_Grown(field,1)) - return(E_OK); + + if (Single_Line_Field(field) && Field_Grown(field, 1)) + returnCode(E_OK); #endif - --(form->curcol); - return(E_REQUEST_DENIED); + form->curcol = oldcol; + returnCode(E_REQUEST_DENIED); } - return(E_OK); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_Up_Character(FORM * form) -| +| | Description : Move one line up. This doesn't cycle through the lines | of the field. | | Return Values : E_OK - success | E_REQUEST_DENIED - already in last column +--------------------------------------------------------------------------*/ -static int IFN_Up_Character(FORM * form) +static int +IFN_Up_Character(FORM *form) { - if ( (--(form->currow)) < 0 ) + T((T_CALLED("IFN_Up_Character(%p)"), form)); + if ((--(form->currow)) < 0) { form->currow++; - return(E_REQUEST_DENIED); + returnCode(E_REQUEST_DENIED); } - return(E_OK); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int IFN_Down_Character(FORM * form) -| +| | Description : Move one line down. This doesn't cycle through the | lines of the field. | | Return Values : E_OK - success | E_REQUEST_DENIED - already in last column +--------------------------------------------------------------------------*/ -static int IFN_Down_Character(FORM * form) +static int +IFN_Down_Character(FORM *form) { FIELD *field = form->current; - if ( (++(form->currow)) == field->drows ) + T((T_CALLED("IFN_Down_Character(%p)"), form)); + if ((++(form->currow)) == field->drows) { #if GROW_IF_NAVIGATE - if (!Single_Line_Field(field) && Field_Grown(field,1)) - return(E_OK); + if (!Single_Line_Field(field) && Field_Grown(field, 1)) + returnCode(E_OK); #endif --(form->currow); - return(E_REQUEST_DENIED); + returnCode(E_REQUEST_DENIED); } - return(E_OK); + returnCode(E_OK); } /*---------------------------------------------------------------------------- - END of Intra-Field Navigation routines + END of Intra-Field Navigation routines --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Vertical scrolling helper routines --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static int VSC_Generic(FORM *form, int lines) +| Facility : libnform +| Function : static int VSC_Generic(FORM *form, int nlines) | -| Description : Scroll multi-line field forward (lines>0) or -| backward (lines<0) this many lines. +| Description : Scroll multi-line field forward (nlines>0) or +| backward (nlines<0) this many lines. | -| Return Values : E_OK - success +| Return Values : E_OK - success | E_REQUEST_DENIED - can't scroll +--------------------------------------------------------------------------*/ -static int VSC_Generic(FORM *form, int lines) +static int +VSC_Generic(FORM *form, int nlines) { FIELD *field = form->current; int res = E_REQUEST_DENIED; - int rows_to_go = (lines > 0 ? lines : -lines); + int rows_to_go = (nlines > 0 ? nlines : -nlines); - if (lines > 0) + if (nlines > 0) { - if ( (rows_to_go + form->toprow) > (field->drows - field->rows) ) + if ((rows_to_go + form->toprow) > (field->drows - field->rows)) rows_to_go = (field->drows - field->rows - form->toprow); if (rows_to_go > 0) @@ -1630,7 +1874,7 @@ static int VSC_Generic(FORM *form, int lines) { if (rows_to_go > form->toprow) rows_to_go = form->toprow; - + if (rows_to_go > 0) { form->currow -= rows_to_go; @@ -1638,29 +1882,30 @@ static int VSC_Generic(FORM *form, int lines) res = E_OK; } } - return(res); + return (res); } /*---------------------------------------------------------------------------- End of Vertical scrolling helper routines --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Vertical scrolling routines --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Vertical_Scrolling( | int (* const fct) (FORM *), | FORM * form) -| -| Description : Performs the generic vertical scrolling routines. +| +| Description : Performs the generic vertical scrolling routines. | This has to check for a multi-line field and to set | the _NEWTOP flag if scrolling really occurred. | | Return Values : Propagated error code from low-level driver calls +--------------------------------------------------------------------------*/ -static int Vertical_Scrolling(int (* const fct) (FORM *), FORM * form) +static int +Vertical_Scrolling(int (*const fct) (FORM *), FORM *form) { int res = E_REQUEST_DENIED; @@ -1670,299 +1915,327 @@ static int Vertical_Scrolling(int (* const fct) (FORM *), FORM * form) if (res == E_OK) form->current->status |= _NEWTOP; } - return(res); + return (res); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int VSC_Scroll_Line_Forward(FORM * form) -| +| | Description : Scroll multi-line field forward a line | | Return Values : E_OK - success | E_REQUEST_DENIED - no data ahead +--------------------------------------------------------------------------*/ -static int VSC_Scroll_Line_Forward(FORM * form) +static int +VSC_Scroll_Line_Forward(FORM *form) { - return VSC_Generic(form,1); + T((T_CALLED("VSC_Scroll_Line_Forward(%p)"), form)); + returnCode(VSC_Generic(form, 1)); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int VSC_Scroll_Line_Backward(FORM * form) -| +| | Description : Scroll multi-line field backward a line | | Return Values : E_OK - success | E_REQUEST_DENIED - no data behind +--------------------------------------------------------------------------*/ -static int VSC_Scroll_Line_Backward(FORM * form) +static int +VSC_Scroll_Line_Backward(FORM *form) { - return VSC_Generic(form,-1); + T((T_CALLED("VSC_Scroll_Line_Backward(%p)"), form)); + returnCode(VSC_Generic(form, -1)); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int VSC_Scroll_Page_Forward(FORM * form) -| +| | Description : Scroll a multi-line field forward a page | | Return Values : E_OK - success | E_REQUEST_DENIED - no data ahead +--------------------------------------------------------------------------*/ -static int VSC_Scroll_Page_Forward(FORM * form) +static int +VSC_Scroll_Page_Forward(FORM *form) { - return VSC_Generic(form,form->current->rows); + T((T_CALLED("VSC_Scroll_Page_Forward(%p)"), form)); + returnCode(VSC_Generic(form, form->current->rows)); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int VSC_Scroll_Half_Page_Forward(FORM * form) -| +| | Description : Scroll a multi-line field forward half a page | | Return Values : E_OK - success | E_REQUEST_DENIED - no data ahead +--------------------------------------------------------------------------*/ -static int VSC_Scroll_Half_Page_Forward(FORM * form) +static int +VSC_Scroll_Half_Page_Forward(FORM *form) { - return VSC_Generic(form,(form->current->rows + 1)/2); + T((T_CALLED("VSC_Scroll_Half_Page_Forward(%p)"), form)); + returnCode(VSC_Generic(form, (form->current->rows + 1) / 2)); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int VSC_Scroll_Page_Backward(FORM * form) -| +| | Description : Scroll a multi-line field backward a page | | Return Values : E_OK - success | E_REQUEST_DENIED - no data behind +--------------------------------------------------------------------------*/ -static int VSC_Scroll_Page_Backward(FORM * form) +static int +VSC_Scroll_Page_Backward(FORM *form) { - return VSC_Generic(form, -(form->current->rows)); + T((T_CALLED("VSC_Scroll_Page_Backward(%p)"), form)); + returnCode(VSC_Generic(form, -(form->current->rows))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int VSC_Scroll_Half_Page_Backward(FORM * form) -| +| | Description : Scroll a multi-line field backward half a page | | Return Values : E_OK - success | E_REQUEST_DENIED - no data behind +--------------------------------------------------------------------------*/ -static int VSC_Scroll_Half_Page_Backward(FORM * form) +static int +VSC_Scroll_Half_Page_Backward(FORM *form) { - return VSC_Generic(form, -((form->current->rows + 1)/2)); + T((T_CALLED("VSC_Scroll_Half_Page_Backward(%p)"), form)); + returnCode(VSC_Generic(form, -((form->current->rows + 1) / 2))); } /*---------------------------------------------------------------------------- End of Vertical scrolling routines --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Horizontal scrolling helper routines --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static int HSC_Generic(FORM *form, int columns) +| Facility : libnform +| Function : static int HSC_Generic(FORM *form, int ncolumns) | -| Description : Scroll single-line field forward (columns>0) or -| backward (columns<0) this many columns. +| Description : Scroll single-line field forward (ncolumns>0) or +| backward (ncolumns<0) this many columns. | -| Return Values : E_OK - success +| Return Values : E_OK - success | E_REQUEST_DENIED - can't scroll +--------------------------------------------------------------------------*/ -static int HSC_Generic(FORM *form, int columns) +static int +HSC_Generic(FORM *form, int ncolumns) { FIELD *field = form->current; int res = E_REQUEST_DENIED; - int cols_to_go = (columns > 0 ? columns : -columns); + int cols_to_go = (ncolumns > 0 ? ncolumns : -ncolumns); - if (columns > 0) + if (ncolumns > 0) { if ((cols_to_go + form->begincol) > (field->dcols - field->cols)) cols_to_go = field->dcols - field->cols - form->begincol; - + if (cols_to_go > 0) { - form->curcol += cols_to_go; + form->curcol += cols_to_go; form->begincol += cols_to_go; res = E_OK; } } else { - if ( cols_to_go > form->begincol ) + if (cols_to_go > form->begincol) cols_to_go = form->begincol; if (cols_to_go > 0) { - form->curcol -= cols_to_go; + form->curcol -= cols_to_go; form->begincol -= cols_to_go; res = E_OK; } } - return(res); + return (res); } /*---------------------------------------------------------------------------- End of Horizontal scrolling helper routines --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Horizontal scrolling routines --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Horizontal_Scrolling( | int (* const fct) (FORM *), | FORM * form) -| -| Description : Performs the generic horizontal scrolling routines. +| +| Description : Performs the generic horizontal scrolling routines. | This has to check for a single-line field. | | Return Values : Propagated error code from low-level driver calls +--------------------------------------------------------------------------*/ -static int Horizontal_Scrolling(int (* const fct) (FORM *), FORM * form) +static int +Horizontal_Scrolling(int (*const fct) (FORM *), FORM *form) { if (Single_Line_Field(form->current)) return fct(form); else - return(E_REQUEST_DENIED); + return (E_REQUEST_DENIED); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int HSC_Scroll_Char_Forward(FORM * form) -| +| | Description : Scroll single-line field forward a character | | Return Values : E_OK - success | E_REQUEST_DENIED - no data ahead +--------------------------------------------------------------------------*/ -static int HSC_Scroll_Char_Forward(FORM *form) +static int +HSC_Scroll_Char_Forward(FORM *form) { - return HSC_Generic(form,1); + T((T_CALLED("HSC_Scroll_Char_Forward(%p)"), form)); + returnCode(HSC_Generic(form, 1)); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int HSC_Scroll_Char_Backward(FORM * form) -| +| | Description : Scroll single-line field backward a character | | Return Values : E_OK - success | E_REQUEST_DENIED - no data behind +--------------------------------------------------------------------------*/ -static int HSC_Scroll_Char_Backward(FORM *form) +static int +HSC_Scroll_Char_Backward(FORM *form) { - return HSC_Generic(form,-1); + T((T_CALLED("HSC_Scroll_Char_Backward(%p)"), form)); + returnCode(HSC_Generic(form, -1)); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int HSC_Horizontal_Line_Forward(FORM* form) -| +| | Description : Scroll single-line field forward a line | | Return Values : E_OK - success | E_REQUEST_DENIED - no data ahead +--------------------------------------------------------------------------*/ -static int HSC_Horizontal_Line_Forward(FORM * form) +static int +HSC_Horizontal_Line_Forward(FORM *form) { - return HSC_Generic(form,form->current->cols); + T((T_CALLED("HSC_Horizontal_Line_Forward(%p)"), form)); + returnCode(HSC_Generic(form, form->current->cols)); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int HSC_Horizontal_Half_Line_Forward(FORM* form) -| +| | Description : Scroll single-line field forward half a line | | Return Values : E_OK - success | E_REQUEST_DENIED - no data ahead +--------------------------------------------------------------------------*/ -static int HSC_Horizontal_Half_Line_Forward(FORM * form) +static int +HSC_Horizontal_Half_Line_Forward(FORM *form) { - return HSC_Generic(form,(form->current->cols + 1)/2); + T((T_CALLED("HSC_Horizontal_Half_Line_Forward(%p)"), form)); + returnCode(HSC_Generic(form, (form->current->cols + 1) / 2)); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int HSC_Horizontal_Line_Backward(FORM* form) -| +| | Description : Scroll single-line field backward a line | | Return Values : E_OK - success | E_REQUEST_DENIED - no data behind +--------------------------------------------------------------------------*/ -static int HSC_Horizontal_Line_Backward(FORM * form) +static int +HSC_Horizontal_Line_Backward(FORM *form) { - return HSC_Generic(form,-(form->current->cols)); + T((T_CALLED("HSC_Horizontal_Line_Backward(%p)"), form)); + returnCode(HSC_Generic(form, -(form->current->cols))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int HSC_Horizontal_Half_Line_Backward(FORM* form) -| +| | Description : Scroll single-line field backward half a line | | Return Values : E_OK - success | E_REQUEST_DENIED - no data behind +--------------------------------------------------------------------------*/ -static int HSC_Horizontal_Half_Line_Backward(FORM * form) +static int +HSC_Horizontal_Half_Line_Backward(FORM *form) { - return HSC_Generic(form,-((form->current->cols + 1)/2)); + T((T_CALLED("HSC_Horizontal_Half_Line_Backward(%p)"), form)); + returnCode(HSC_Generic(form, -((form->current->cols + 1) / 2))); } /*---------------------------------------------------------------------------- End of Horizontal scrolling routines --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Helper routines for Field Editing --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static bool Is_There_Room_For_A_Line(FORM * form) -| +| | Description : Check whether or not there is enough room in the | buffer to enter a whole line. | | Return Values : TRUE - there is enough space | FALSE - there is not enough space +--------------------------------------------------------------------------*/ -INLINE static bool Is_There_Room_For_A_Line(FORM * form) +INLINE static bool +Is_There_Room_For_A_Line(FORM *form) { FIELD *field = form->current; - char *begin_of_last_line, *s; - + FIELD_CELL *begin_of_last_line, *s; + Synchronize_Buffer(form); - begin_of_last_line = Address_Of_Row_In_Buffer(field,(field->drows-1)); - s = After_End_Of_Data(begin_of_last_line,field->dcols); - return ((s==begin_of_last_line) ? TRUE : FALSE); + begin_of_last_line = Address_Of_Row_In_Buffer(field, (field->drows - 1)); + s = After_End_Of_Data(begin_of_last_line, field->dcols); + return ((s == begin_of_last_line) ? TRUE : FALSE); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static bool Is_There_Room_For_A_Char_In_Line(FORM * form) -| +| | Description : Checks whether or not there is room for a new character | in the current line. | | Return Values : TRUE - there is room | FALSE - there is not enough room (line full) +--------------------------------------------------------------------------*/ -INLINE static bool Is_There_Room_For_A_Char_In_Line(FORM * form) +INLINE static bool +Is_There_Room_For_A_Char_In_Line(FORM *form) { int last_char_in_line; - wmove(form->w,form->currow,form->current->dcols-1); - last_char_in_line = (int)(winch(form->w) & A_CHARTEXT); - wmove(form->w,form->currow,form->curcol); + wmove(form->w, form->currow, form->current->dcols - 1); + last_char_in_line = (int)(winch(form->w) & A_CHARTEXT); + wmove(form->w, form->currow, form->curcol); return (((last_char_in_line == form->current->pad) || is_blank(last_char_in_line)) ? TRUE : FALSE); } @@ -1971,85 +2244,90 @@ INLINE static bool Is_There_Room_For_A_Char_In_Line(FORM * form) !Is_There_Room_For_A_Char_In_Line(f) /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Insert_String( | FORM * form, | int row, | char *txt, | int len ) -| +| | Description : Insert the 'len' characters beginning at pointer 'txt' | into the 'row' of the 'form'. The insertion occurs | on the beginning of the row, all other characters are -| moved to the right. After the text a pad character will +| moved to the right. After the text a pad character will | be inserted to separate the text from the rest. If | necessary the insertion moves characters on the next | line to make place for the requested insertion string. | -| Return Values : E_OK - success +| Return Values : E_OK - success | E_REQUEST_DENIED - | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -static int Insert_String(FORM *form, int row, char *txt, int len) -{ - FIELD *field = form->current; - char *bp = Address_Of_Row_In_Buffer(field,row); - int datalen = (int)(After_End_Of_Data(bp,field->dcols) - bp); - int freelen = field->dcols - datalen; - int requiredlen = len+1; - char *split; +static int +Insert_String(FORM *form, int row, FIELD_CELL *txt, int len) +{ + FIELD *field = form->current; + FIELD_CELL *bp = Address_Of_Row_In_Buffer(field, row); + int datalen = (int)(After_End_Of_Data(bp, field->dcols) - bp); + int freelen = field->dcols - datalen; + int requiredlen = len + 1; + FIELD_CELL *split; int result = E_REQUEST_DENIED; - const char *Space = " "; if (freelen >= requiredlen) { - wmove(form->w,row,0); - winsnstr(form->w,txt,len); - wmove(form->w,row,len); - winsnstr(form->w,Space,1); + wmove(form->w, row, 0); + myINSNSTR(form->w, txt, len); + wmove(form->w, row, len); + myINSNSTR(form->w, &myBLANK, 1); return E_OK; } else - { /* we have to move characters on the next line. If we are on the - last line this may work, if the field is growable */ + { + /* we have to move characters on the next line. If we are on the + last line this may work, if the field is growable */ if ((row == (field->drows - 1)) && Growable(field)) { - if (!Field_Grown(field,1)) - return(E_SYSTEM_ERROR); + if (!Field_Grown(field, 1)) + return (E_SYSTEM_ERROR); /* !!!Side-Effect : might be changed due to growth!!! */ - bp = Address_Of_Row_In_Buffer(field,row); + bp = Address_Of_Row_In_Buffer(field, row); } - if (row < (field->drows - 1)) - { - split = After_Last_Whitespace_Character(bp, - (int)(Get_Start_Of_Data(bp + field->dcols - requiredlen , - requiredlen) - bp)); + if (row < (field->drows - 1)) + { + split = + After_Last_Whitespace_Character(bp, + (int)(Get_Start_Of_Data(bp + + field->dcols + - requiredlen, + requiredlen) + - bp)); /* split points now to the first character of the portion of the line that must be moved to the next line */ - datalen = (int)(split-bp); /* + freelen has to stay on this line */ - freelen = field->dcols - (datalen + freelen); /* for the next line */ + datalen = (int)(split - bp); /* + freelen has to stay on this line */ + freelen = field->dcols - (datalen + freelen); /* for the next line */ - if ((result=Insert_String(form,row+1,split,freelen))==E_OK) + if ((result = Insert_String(form, row + 1, split, freelen)) == E_OK) { - wmove(form->w,row,datalen); + wmove(form->w, row, datalen); wclrtoeol(form->w); - wmove(form->w,row,0); - winsnstr(form->w,txt,len); - wmove(form->w,row,len); - winsnstr(form->w,Space,1); + wmove(form->w, row, 0); + myINSNSTR(form->w, txt, len); + wmove(form->w, row, len); + myINSNSTR(form->w, &myBLANK, 1); return E_OK; } } - return(result); + return (result); } } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Wrapping_Not_Necessary_Or_Wrapping_Ok( | FORM * form) -| +| | Description : If a character has been entered into a field, it may | be that wrapping has to occur. This routine checks | whether or not wrapping is required and if so, performs @@ -2060,40 +2338,43 @@ static int Insert_String(FORM *form, int row, char *txt, int len) | E_REQUEST_DENIED - | E_SYSTEM_ERROR - some system error +--------------------------------------------------------------------------*/ -static int Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM * form) +static int +Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM *form) { - FIELD *field = form->current; + FIELD *field = form->current; int result = E_REQUEST_DENIED; bool Last_Row = ((field->drows - 1) == form->currow); - if ( (field->opts & O_WRAP) && /* wrapping wanted */ - (!Single_Line_Field(field)) && /* must be multi-line */ - (There_Is_No_Room_For_A_Char_In_Line(form)) && /* line is full */ - (!Last_Row || Growable(field)) ) /* there are more lines*/ + if ((field->opts & O_WRAP) && /* wrapping wanted */ + (!Single_Line_Field(field)) && /* must be multi-line */ + (There_Is_No_Room_For_A_Char_In_Line(form)) && /* line is full */ + (!Last_Row || Growable(field))) /* there are more lines */ { - char *bp; - char *split; + FIELD_CELL *bp; + FIELD_CELL *split; int chars_to_be_wrapped; int chars_to_remain_on_line; + if (Last_Row) - { /* the above logic already ensures, that in this case the field + { + /* the above logic already ensures, that in this case the field is growable */ - if (!Field_Grown(field,1)) + if (!Field_Grown(field, 1)) return E_SYSTEM_ERROR; } bp = Address_Of_Current_Row_In_Buffer(form); - Window_To_Buffer(form->w,field); - split = After_Last_Whitespace_Character(bp,field->dcols); + Window_To_Buffer(form->w, field); + split = After_Last_Whitespace_Character(bp, field->dcols); /* split points to the first character of the sequence to be brought on the next line */ chars_to_remain_on_line = (int)(split - bp); - chars_to_be_wrapped = field->dcols - chars_to_remain_on_line; + chars_to_be_wrapped = field->dcols - chars_to_remain_on_line; if (chars_to_remain_on_line > 0) { - if ((result=Insert_String(form,form->currow+1,split, - chars_to_be_wrapped)) == E_OK) + if ((result = Insert_String(form, form->currow + 1, split, + chars_to_be_wrapped)) == E_OK) { - wmove(form->w,form->currow,chars_to_remain_on_line); + wmove(form->w, form->currow, chars_to_remain_on_line); wclrtoeol(form->w); if (form->curcol >= chars_to_remain_on_line) { @@ -2105,29 +2386,28 @@ static int Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM * form) } else return E_OK; - if (result!=E_OK) + if (result != E_OK) { - wmove(form->w,form->currow,form->curcol); - wdelch(form->w); - Window_To_Buffer(form->w,field); + DeleteChar(form); + Window_To_Buffer(form->w, field); result = E_REQUEST_DENIED; } } else - result = E_OK; /* wrapping was not necessary */ - return(result); + result = E_OK; /* wrapping was not necessary */ + return (result); } - + /*---------------------------------------------------------------------------- Field Editing routines --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Field_Editing( | int (* const fct) (FORM *), | FORM * form) -| +| | Description : Generic routine for field editing requests. The driver | routines are only called for editable fields, the | _WINDOW_MODIFIED flag is set if editing occurred. @@ -2136,30 +2416,31 @@ static int Wrapping_Not_Necessary_Or_Wrapping_Ok(FORM * form) | | Return Values : Error code from low level drivers. +--------------------------------------------------------------------------*/ -static int Field_Editing(int (* const fct) (FORM *), FORM * form) +static int +Field_Editing(int (*const fct) (FORM *), FORM *form) { int res = E_REQUEST_DENIED; - /* We have to deal here with the specific case of the overloaded + /* We have to deal here with the specific case of the overloaded behavior of New_Line and Delete_Previous requests. They may end up in navigational requests if we are on the first character in a field. But navigation is also allowed on non- editable fields. - */ - if ((fct==FE_Delete_Previous) && - (form->opts & O_BS_OVERLOAD) && - First_Position_In_Current_Field(form) ) + */ + if ((fct == FE_Delete_Previous) && + (form->opts & O_BS_OVERLOAD) && + First_Position_In_Current_Field(form)) { - res = Inter_Field_Navigation(FN_Previous_Field,form); + res = Inter_Field_Navigation(FN_Previous_Field, form); } else { - if (fct==FE_New_Line) + if (fct == FE_New_Line) { - if ((form->opts & O_NL_OVERLOAD) && + if ((form->opts & O_NL_OVERLOAD) && First_Position_In_Current_Field(form)) { - res = Inter_Field_Navigation(FN_Next_Field,form); + res = Inter_Field_Navigation(FN_Next_Field, form); } else /* FE_New_Line deals itself with the _WINDOW_MODIFIED flag */ @@ -2171,7 +2452,7 @@ static int Field_Editing(int (* const fct) (FORM *), FORM * form) if (form->current->opts & O_EDIT) { res = fct(form); - if (res==E_OK) + if (res == E_OK) form->status |= _WINDOW_MODIFIED; } } @@ -2180,11 +2461,11 @@ static int Field_Editing(int (* const fct) (FORM *), FORM * form) } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FE_New_Line(FORM * form) -| +| | Description : Perform a new line request. This is rather complex -| compared to other routines in this code due to the +| compared to other routines in this code due to the | rather difficult to understand description in the | manuals. | @@ -2192,133 +2473,141 @@ static int Field_Editing(int (* const fct) (FORM *), FORM * form) | E_REQUEST_DENIED - new line not allowed | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ -static int FE_New_Line(FORM * form) +static int +FE_New_Line(FORM *form) { - FIELD *field = form->current; - char *bp, *t; - bool Last_Row = ((field->drows - 1)==form->currow); - - if (form->status & _OVLMODE) + FIELD *field = form->current; + FIELD_CELL *bp, *t; + bool Last_Row = ((field->drows - 1) == form->currow); + + T((T_CALLED("FE_New_Line(%p)"), form)); + if (form->status & _OVLMODE) { - if (Last_Row && + if (Last_Row && (!(Growable(field) && !Single_Line_Field(field)))) { if (!(form->opts & O_NL_OVERLOAD)) - return(E_REQUEST_DENIED); - wmove(form->w,form->currow,form->curcol); + returnCode(E_REQUEST_DENIED); + wmove(form->w, form->currow, form->curcol); wclrtoeol(form->w); /* we have to set this here, although it is also handled in the generic routine. The reason is, that FN_Next_Field may fail, but the form is definitively changed */ form->status |= _WINDOW_MODIFIED; - return Inter_Field_Navigation(FN_Next_Field,form); + returnCode(Inter_Field_Navigation(FN_Next_Field, form)); } - else + else { - if (Last_Row && !Field_Grown(field,1)) - { /* N.B.: due to the logic in the 'if', LastRow==TRUE - means here that the field is growable and not - a single-line field */ - return(E_SYSTEM_ERROR); + if (Last_Row && !Field_Grown(field, 1)) + { + /* N.B.: due to the logic in the 'if', LastRow==TRUE + means here that the field is growable and not + a single-line field */ + returnCode(E_SYSTEM_ERROR); } - wmove(form->w,form->currow,form->curcol); + wmove(form->w, form->currow, form->curcol); wclrtoeol(form->w); form->currow++; form->curcol = 0; form->status |= _WINDOW_MODIFIED; - return(E_OK); + returnCode(E_OK); } } - else - { /* Insert Mode */ + else + { + /* Insert Mode */ if (Last_Row && !(Growable(field) && !Single_Line_Field(field))) { if (!(form->opts & O_NL_OVERLOAD)) - return(E_REQUEST_DENIED); - return Inter_Field_Navigation(FN_Next_Field,form); + returnCode(E_REQUEST_DENIED); + returnCode(Inter_Field_Navigation(FN_Next_Field, form)); } - else + else { bool May_Do_It = !Last_Row && Is_There_Room_For_A_Line(form); - + if (!(May_Do_It || Growable(field))) - return(E_REQUEST_DENIED); - if (!May_Do_It && !Field_Grown(field,1)) - return(E_SYSTEM_ERROR); - - bp= Address_Of_Current_Position_In_Buffer(form); - t = After_End_Of_Data(bp,field->dcols - form->curcol); - wmove(form->w,form->currow,form->curcol); + returnCode(E_REQUEST_DENIED); + if (!May_Do_It && !Field_Grown(field, 1)) + returnCode(E_SYSTEM_ERROR); + + bp = Address_Of_Current_Position_In_Buffer(form); + t = After_End_Of_Data(bp, field->dcols - form->curcol); + wmove(form->w, form->currow, form->curcol); wclrtoeol(form->w); form->currow++; - form->curcol=0; - wmove(form->w,form->currow,form->curcol); + form->curcol = 0; + wmove(form->w, form->currow, form->curcol); winsertln(form->w); - waddnstr(form->w,bp,(int)(t-bp)); + myADDNSTR(form->w, bp, (int)(t - bp)); form->status |= _WINDOW_MODIFIED; - return E_OK; + returnCode(E_OK); } } } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FE_Insert_Character(FORM * form) -| +| | Description : Insert blank character at the cursor position | | Return Values : E_OK | E_REQUEST_DENIED +--------------------------------------------------------------------------*/ -static int FE_Insert_Character(FORM * form) +static int +FE_Insert_Character(FORM *form) { FIELD *field = form->current; int result = E_REQUEST_DENIED; - if (Check_Char(field->type,(int)C_BLANK,(TypeArgument *)(field->arg))) + T((T_CALLED("FE_Insert_Character(%p)"), form)); + if (Check_Char(field->type, (int)C_BLANK, (TypeArgument *)(field->arg))) { bool There_Is_Room = Is_There_Room_For_A_Char_In_Line(form); if (There_Is_Room || ((Single_Line_Field(field) && Growable(field)))) { - if (!There_Is_Room && !Field_Grown(field,1)) - result = E_SYSTEM_ERROR; + if (!There_Is_Room && !Field_Grown(field, 1)) + result = E_SYSTEM_ERROR; else { - winsch(form->w,(chtype)C_BLANK); + winsch(form->w, (chtype)C_BLANK); result = Wrapping_Not_Necessary_Or_Wrapping_Ok(form); } } } - return result; + returnCode(result); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FE_Insert_Line(FORM * form) -| +| | Description : Insert a blank line at the cursor position | | Return Values : E_OK - success | E_REQUEST_DENIED - line can not be inserted +--------------------------------------------------------------------------*/ -static int FE_Insert_Line(FORM * form) +static int +FE_Insert_Line(FORM *form) { FIELD *field = form->current; int result = E_REQUEST_DENIED; - if (Check_Char(field->type,(int)C_BLANK,(TypeArgument *)(field->arg))) + T((T_CALLED("FE_Insert_Line(%p)"), form)); + if (Check_Char(field->type, (int)C_BLANK, (TypeArgument *)(field->arg))) { - bool Maybe_Done = (form->currow!=(field->drows-1)) && - Is_There_Room_For_A_Line(form); + bool Maybe_Done = (form->currow != (field->drows - 1)) && + Is_There_Room_For_A_Line(form); if (!Single_Line_Field(field) && (Maybe_Done || Growable(field))) { - if (!Maybe_Done && !Field_Grown(field,1)) + if (!Maybe_Done && !Field_Grown(field, 1)) result = E_SYSTEM_ERROR; else { @@ -2328,28 +2617,29 @@ static int FE_Insert_Line(FORM * form) } } } - return result; + returnCode(result); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FE_Delete_Character(FORM * form) -| +| | Description : Delete character at the cursor position | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -static int FE_Delete_Character(FORM * form) +static int +FE_Delete_Character(FORM *form) { - wmove(form->w,form->currow,form->curcol); - wdelch(form->w); - return E_OK; + T((T_CALLED("FE_Delete_Character(%p)"), form)); + DeleteChar(form); + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FE_Delete_Previous(FORM * form) -| +| | Description : Delete character before cursor. Again this is a rather | difficult piece compared to others due to the overloading | semantics of backspace. @@ -2359,304 +2649,353 @@ static int FE_Delete_Character(FORM * form) | Return Values : E_OK - success | E_REQUEST_DENIED - Character can't be deleted +--------------------------------------------------------------------------*/ -static int FE_Delete_Previous(FORM * form) +static int +FE_Delete_Previous(FORM *form) { - FIELD *field = form->current; - + FIELD *field = form->current; + + T((T_CALLED("FE_Delete_Previous(%p)"), form)); if (First_Position_In_Current_Field(form)) - return E_REQUEST_DENIED; + returnCode(E_REQUEST_DENIED); - if ( (--(form->curcol))<0 ) + if ((--(form->curcol)) < 0) { - char *this_line, *prev_line, *prev_end, *this_end; - + FIELD_CELL *this_line, *prev_line, *prev_end, *this_end; + int this_row = form->currow; + form->curcol++; - if (form->status & _OVLMODE) - return E_REQUEST_DENIED; - - prev_line = Address_Of_Row_In_Buffer(field,(form->currow-1)); - this_line = Address_Of_Row_In_Buffer(field,(form->currow)); + if (form->status & _OVLMODE) + returnCode(E_REQUEST_DENIED); + + prev_line = Address_Of_Row_In_Buffer(field, (form->currow - 1)); + this_line = Address_Of_Row_In_Buffer(field, (form->currow)); Synchronize_Buffer(form); - prev_end = After_End_Of_Data(prev_line,field->dcols); - this_end = After_End_Of_Data(this_line,field->dcols); - if ((int)(this_end-this_line) > - (field->cols-(int)(prev_end-prev_line))) - return E_REQUEST_DENIED; - wmove(form->w,form->currow,form->curcol); + prev_end = After_End_Of_Data(prev_line, field->dcols); + this_end = After_End_Of_Data(this_line, field->dcols); + if ((int)(this_end - this_line) > + (field->cols - (int)(prev_end - prev_line))) + returnCode(E_REQUEST_DENIED); + wmove(form->w, form->currow, form->curcol); wdeleteln(form->w); - Adjust_Cursor_Position(form,prev_end); - wmove(form->w,form->currow,form->curcol); - waddnstr(form->w,this_line,(int)(this_end-this_line)); - } - else + Adjust_Cursor_Position(form, prev_end); + /* + * If we did not really move to the previous line, help the user a + * little. It is however a little inconsistent. Normally, when + * backspacing around the point where text wraps to a new line in a + * multi-line form, we absorb one keystroke for the wrapping point. That + * is consistent with SVr4 forms. However, SVr4 does not allow typing + * into the last column of the field, and requires the user to enter a + * newline to move to the next line. Therefore it can consistently eat + * that keystroke. Since ncurses allows the last column, it wraps + * automatically (given the proper options). But we cannot eat the + * keystroke to back over the wrapping point, since that would put the + * cursor past the end of the form field. In this case, just delete the + * character at the end of the field. + */ + if (form->currow == this_row && this_row > 0) + { + form->currow -= 1; + form->curcol = field->dcols - 1; + DeleteChar(form); + } + else + { + wmove(form->w, form->currow, form->curcol); + myADDNSTR(form->w, this_line, (int)(this_end - this_line)); + } + } + else { - wmove(form->w,form->currow,form->curcol); - wdelch(form->w); + DeleteChar(form); } - return E_OK; + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FE_Delete_Line(FORM * form) -| +| | Description : Delete line at cursor position. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -static int FE_Delete_Line(FORM * form) +static int +FE_Delete_Line(FORM *form) { + T((T_CALLED("FE_Delete_Line(%p)"), form)); form->curcol = 0; wdeleteln(form->w); - return E_OK; + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FE_Delete_Word(FORM * form) -| +| | Description : Delete word at cursor position | | Return Values : E_OK - success | E_REQUEST_DENIED - failure +--------------------------------------------------------------------------*/ -static int FE_Delete_Word(FORM * form) +static int +FE_Delete_Word(FORM *form) { - FIELD *field = form->current; - char *bp = Address_Of_Current_Row_In_Buffer(form); - char *ep = bp + field->dcols; - char *cp = bp + form->curcol; - char *s; - + FIELD *field = form->current; + FIELD_CELL *bp = Address_Of_Current_Row_In_Buffer(form); + FIELD_CELL *ep = bp + field->dcols; + FIELD_CELL *cp = bp + form->curcol; + FIELD_CELL *s; + + T((T_CALLED("FE_Delete_Word(%p)"), form)); Synchronize_Buffer(form); - if (is_blank(*cp)) - return E_REQUEST_DENIED; /* not in word */ + if (ISBLANK(*cp)) + returnCode(E_REQUEST_DENIED); /* not in word */ /* move cursor to begin of word and erase to end of screen-line */ Adjust_Cursor_Position(form, - After_Last_Whitespace_Character(bp,form->curcol)); - wmove(form->w,form->currow,form->curcol); + After_Last_Whitespace_Character(bp, form->curcol)); + wmove(form->w, form->currow, form->curcol); wclrtoeol(form->w); /* skip over word in buffer */ - s = Get_First_Whitespace_Character(cp,(int)(ep-cp)); + s = Get_First_Whitespace_Character(cp, (int)(ep - cp)); /* to begin of next word */ - s = Get_Start_Of_Data(s,(int)(ep - s)); - if ( (s!=cp) && !is_blank(*s)) + s = Get_Start_Of_Data(s, (int)(ep - s)); + if ((s != cp) && !ISBLANK(*s)) { /* copy remaining line to window */ - waddnstr(form->w,s,(int)(s - After_End_Of_Data(s,(int)(ep - s)))); + myADDNSTR(form->w, s, (int)(s - After_End_Of_Data(s, (int)(ep - s)))); } - return E_OK; + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FE_Clear_To_End_Of_Line(FORM * form) -| +| | Description : Clear to end of current line. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -static int FE_Clear_To_End_Of_Line(FORM * form) +static int +FE_Clear_To_End_Of_Line(FORM *form) { - wmove(form->w,form->currow,form->curcol); + T((T_CALLED("FE_Clear_To_End_Of_Line(%p)"), form)); + wmove(form->w, form->currow, form->curcol); wclrtoeol(form->w); - return E_OK; + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FE_Clear_To_End_Of_Field(FORM * form) -| +| | Description : Clear to end of field. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -static int FE_Clear_To_End_Of_Field(FORM * form) +static int +FE_Clear_To_End_Of_Field(FORM *form) { - wmove(form->w,form->currow,form->curcol); + T((T_CALLED("FE_Clear_To_End_Of_Field(%p)"), form)); + wmove(form->w, form->currow, form->curcol); wclrtobot(form->w); - return E_OK; + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FE_Clear_Field(FORM * form) -| +| | Description : Clear entire field. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -static int FE_Clear_Field(FORM * form) +static int +FE_Clear_Field(FORM *form) { + T((T_CALLED("FE_Clear_Field(%p)"), form)); form->currow = form->curcol = 0; werase(form->w); - return E_OK; + returnCode(E_OK); } /*---------------------------------------------------------------------------- - END of Field Editing routines + END of Field Editing routines --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Edit Mode routines --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int EM_Overlay_Mode(FORM * form) -| +| | Description : Switch to overlay mode. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -static int EM_Overlay_Mode(FORM * form) +static int +EM_Overlay_Mode(FORM *form) { + T((T_CALLED("EM_Overlay_Mode(%p)"), form)); form->status |= _OVLMODE; - return E_OK; + returnCode(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int EM_Insert_Mode(FORM * form) -| +| | Description : Switch to insert mode | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -static int EM_Insert_Mode(FORM * form) +static int +EM_Insert_Mode(FORM *form) { + T((T_CALLED("EM_Insert_Mode(%p)"), form)); form->status &= ~_OVLMODE; - return E_OK; + returnCode(E_OK); } /*---------------------------------------------------------------------------- - END of Edit Mode routines + END of Edit Mode routines --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Helper routines for Choice Requests --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static bool Next_Choice( | FIELDTYPE * typ, | FIELD * field, | TypeArgument *argp) -| +| | Description : Get the next field choice. For linked types this is | done recursively. | | Return Values : TRUE - next choice successfully retrieved | FALSE - couldn't retrieve next choice +--------------------------------------------------------------------------*/ -static bool Next_Choice(FIELDTYPE * typ, FIELD *field, TypeArgument *argp) +static bool +Next_Choice(FIELDTYPE *typ, FIELD *field, TypeArgument *argp) { - if (!typ || !(typ->status & _HAS_CHOICE)) + if (!typ || !(typ->status & _HAS_CHOICE)) return FALSE; if (typ->status & _LINKED_TYPE) { assert(argp); - return( - Next_Choice(typ->left ,field,argp->left) || - Next_Choice(typ->right,field,argp->right) ); - } + return ( + Next_Choice(typ->left, field, argp->left) || + Next_Choice(typ->right, field, argp->right)); + } else { assert(typ->next); - return typ->next(field,(void *)argp); + return typ->next(field, (void *)argp); } } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static bool Previous_Choice( | FIELDTYPE * typ, | FIELD * field, | TypeArgument *argp) -| +| | Description : Get the previous field choice. For linked types this | is done recursively. | | Return Values : TRUE - previous choice successfully retrieved | FALSE - couldn't retrieve previous choice +--------------------------------------------------------------------------*/ -static bool Previous_Choice(FIELDTYPE *typ, FIELD *field, TypeArgument *argp) +static bool +Previous_Choice(FIELDTYPE *typ, FIELD *field, TypeArgument *argp) { - if (!typ || !(typ->status & _HAS_CHOICE)) + if (!typ || !(typ->status & _HAS_CHOICE)) return FALSE; if (typ->status & _LINKED_TYPE) { assert(argp); - return( - Previous_Choice(typ->left ,field,argp->left) || - Previous_Choice(typ->right,field,argp->right)); - } - else + return ( + Previous_Choice(typ->left, field, argp->left) || + Previous_Choice(typ->right, field, argp->right)); + } + else { assert(typ->prev); - return typ->prev(field,(void *)argp); + return typ->prev(field, (void *)argp); } } /*---------------------------------------------------------------------------- End of Helper routines for Choice Requests --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Routines for Choice Requests --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int CR_Next_Choice(FORM * form) -| +| | Description : Get the next field choice. | | Return Values : E_OK - success | E_REQUEST_DENIED - next choice couldn't be retrieved +--------------------------------------------------------------------------*/ -static int CR_Next_Choice(FORM * form) +static int +CR_Next_Choice(FORM *form) { FIELD *field = form->current; + + T((T_CALLED("CR_Next_Choice(%p)"), form)); Synchronize_Buffer(form); - return ((Next_Choice(field->type,field,(TypeArgument *)(field->arg))) ? - E_OK : E_REQUEST_DENIED); + returnCode((Next_Choice(field->type, field, (TypeArgument *)(field->arg))) + ? E_OK + : E_REQUEST_DENIED); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int CR_Previous_Choice(FORM * form) -| +| | Description : Get the previous field choice. | | Return Values : E_OK - success | E_REQUEST_DENIED - prev. choice couldn't be retrieved +--------------------------------------------------------------------------*/ -static int CR_Previous_Choice(FORM * form) +static int +CR_Previous_Choice(FORM *form) { FIELD *field = form->current; + + T((T_CALLED("CR_Previous_Choice(%p)"), form)); Synchronize_Buffer(form); - return ((Previous_Choice(field->type,field,(TypeArgument *)(field->arg))) ? - E_OK : E_REQUEST_DENIED); + returnCode((Previous_Choice(field->type, field, (TypeArgument *)(field->arg))) + ? E_OK + : E_REQUEST_DENIED); } /*---------------------------------------------------------------------------- End of Routines for Choice Requests --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Helper routines for Field Validations. --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static bool Check_Field( | FIELDTYPE * typ, | FIELD * field, | TypeArgument * argp) -| +| | Description : Check the field according to its fieldtype and its | actual arguments. For linked fieldtypes this is done | recursively. @@ -2664,59 +3003,63 @@ static int CR_Previous_Choice(FORM * form) | Return Values : TRUE - field is valid | FALSE - field is invalid. +--------------------------------------------------------------------------*/ -static bool Check_Field(FIELDTYPE *typ, FIELD *field, TypeArgument *argp) +static bool +Check_Field(FIELDTYPE *typ, FIELD *field, TypeArgument *argp) { if (typ) { if (field->opts & O_NULLOK) { - char *bp = field->buf; + FIELD_CELL *bp = field->buf; + assert(bp); - while(is_blank(*bp)) - { bp++; } - if (*bp == '\0') + while (ISBLANK(*bp)) + { + bp++; + } + if (CharOf(*bp) == 0) return TRUE; } if (typ->status & _LINKED_TYPE) { assert(argp); - return( - Check_Field(typ->left ,field,argp->left ) || - Check_Field(typ->right,field,argp->right) ); + return ( + Check_Field(typ->left, field, argp->left) || + Check_Field(typ->right, field, argp->right)); } - else + else { if (typ->fcheck) - return typ->fcheck(field,(void *)argp); + return typ->fcheck(field, (void *)argp); } } return TRUE; } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : bool _nc_Internal_Validation(FORM * form ) -| -| Description : Validate the current field of the form. +| +| Description : Validate the current field of the form. | | Return Values : TRUE - field is valid | FALSE - field is invalid +--------------------------------------------------------------------------*/ NCURSES_EXPORT(bool) -_nc_Internal_Validation (FORM *form) +_nc_Internal_Validation(FORM *form) { FIELD *field; - field = form->current; - + field = form->current; + Synchronize_Buffer(form); if ((form->status & _FCHECK_REQUIRED) || (!(field->opts & O_PASSOK))) { - if (!Check_Field(field->type,field,(TypeArgument *)(field->arg))) + if (!Check_Field(field->type, field, (TypeArgument *)(field->arg))) return FALSE; - form->status &= ~_FCHECK_REQUIRED; + form->status &= ~_FCHECK_REQUIRED; field->status |= _CHANGED; Synchronize_Linked_Fields(field); } @@ -2725,67 +3068,71 @@ _nc_Internal_Validation (FORM *form) /*---------------------------------------------------------------------------- End of Helper routines for Field Validations. --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Routines for Field Validation. --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FV_Validation(FORM * form) -| +| | Description : Validate the current field of the form. | | Return Values : E_OK - field valid | E_INVALID_FIELD - field not valid +--------------------------------------------------------------------------*/ -static int FV_Validation(FORM * form) +static int +FV_Validation(FORM *form) { + T((T_CALLED("FV_Validation(%p)"), form)); if (_nc_Internal_Validation(form)) - return E_OK; + returnCode(E_OK); else - return E_INVALID_FIELD; + returnCode(E_INVALID_FIELD); } /*---------------------------------------------------------------------------- End of routines for Field Validation. --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Helper routines for Inter-Field Navigation --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static FIELD *Next_Field_On_Page(FIELD * field) -| -| Description : Get the next field after the given field on the current +| +| Description : Get the next field after the given field on the current | page. The order of fields is the one defined by the | fields array. Only visible and active fields are | counted. | | Return Values : Pointer to the next field. +--------------------------------------------------------------------------*/ -INLINE static FIELD *Next_Field_On_Page(FIELD * field) +INLINE static FIELD * +Next_Field_On_Page(FIELD *field) { - FORM *form = field->form; + FORM *form = field->form; FIELD **field_on_page = &form->field[field->index]; FIELD **first_on_page = &form->field[form->page[form->curpage].pmin]; - FIELD **last_on_page = &form->field[form->page[form->curpage].pmax]; + FIELD **last_on_page = &form->field[form->page[form->curpage].pmax]; do { - field_on_page = - (field_on_page==last_on_page) ? first_on_page : field_on_page + 1; + field_on_page = + (field_on_page == last_on_page) ? first_on_page : field_on_page + 1; if (Field_Is_Selectable(*field_on_page)) break; - } while(field!=(*field_on_page)); - return(*field_on_page); + } + while (field != (*field_on_page)); + return (*field_on_page); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : FIELD* _nc_First_Active_Field(FORM * form) -| +| | Description : Get the first active field on the current page, | if there are such. If there are none, get the first | visible field on the page. If there are also none, @@ -2793,17 +3140,18 @@ INLINE static FIELD *Next_Field_On_Page(FIELD * field) | | Return Values : Pointer to calculated field. +--------------------------------------------------------------------------*/ -NCURSES_EXPORT(FIELD*) -_nc_First_Active_Field (FORM * form) +NCURSES_EXPORT(FIELD *) +_nc_First_Active_Field(FORM *form) { FIELD **last_on_page = &form->field[form->page[form->curpage].pmax]; FIELD *proposed = Next_Field_On_Page(*last_on_page); if (proposed == *last_on_page) - { /* there might be the special situation, where there is no - active and visible field on the current page. We then select - the first visible field on this readonly page - */ + { + /* there might be the special situation, where there is no + active and visible field on the current page. We then select + the first visible field on this readonly page + */ if (Field_Is_Not_Selectable(proposed)) { FIELD **field = &form->field[proposed->index]; @@ -2811,66 +3159,71 @@ _nc_First_Active_Field (FORM * form) do { - field = (field==last_on_page) ? first : field + 1; + field = (field == last_on_page) ? first : field + 1; if (((*field)->opts & O_VISIBLE)) break; - } while(proposed!=(*field)); - + } + while (proposed != (*field)); + proposed = *field; - if ((proposed == *last_on_page) && !(proposed->opts&O_VISIBLE)) - { /* This means, there is also no visible field on the page. - So we propose the first one and hope the very best... - Some very clever user has designed a readonly and invisible - page on this form. + if ((proposed == *last_on_page) && !(proposed->opts & O_VISIBLE)) + { + /* This means, there is also no visible field on the page. + So we propose the first one and hope the very best... + Some very clever user has designed a readonly and invisible + page on this form. */ proposed = *first; } } } - return(proposed); + return (proposed); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static FIELD *Previous_Field_On_Page(FIELD * field) -| -| Description : Get the previous field before the given field on the -| current page. The order of fields is the one defined by +| +| Description : Get the previous field before the given field on the +| current page. The order of fields is the one defined by | the fields array. Only visible and active fields are | counted. | | Return Values : Pointer to the previous field. +--------------------------------------------------------------------------*/ -INLINE static FIELD *Previous_Field_On_Page(FIELD * field) +INLINE static FIELD * +Previous_Field_On_Page(FIELD *field) { - FORM *form = field->form; + FORM *form = field->form; FIELD **field_on_page = &form->field[field->index]; FIELD **first_on_page = &form->field[form->page[form->curpage].pmin]; - FIELD **last_on_page = &form->field[form->page[form->curpage].pmax]; - + FIELD **last_on_page = &form->field[form->page[form->curpage].pmax]; + do { - field_on_page = - (field_on_page==first_on_page) ? last_on_page : field_on_page - 1; + field_on_page = + (field_on_page == first_on_page) ? last_on_page : field_on_page - 1; if (Field_Is_Selectable(*field_on_page)) break; - } while(field!=(*field_on_page)); - + } + while (field != (*field_on_page)); + return (*field_on_page); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static FIELD *Sorted_Next_Field(FIELD * field) -| -| Description : Get the next field after the given field on the current +| +| Description : Get the next field after the given field on the current | page. The order of fields is the one defined by the | (row,column) geometry, rows are major. | | Return Values : Pointer to the next field. +--------------------------------------------------------------------------*/ -INLINE static FIELD *Sorted_Next_Field(FIELD * field) +INLINE static FIELD * +Sorted_Next_Field(FIELD *field) { FIELD *field_on_page = field; @@ -2879,22 +3232,24 @@ INLINE static FIELD *Sorted_Next_Field(FIELD * field) field_on_page = field_on_page->snext; if (Field_Is_Selectable(field_on_page)) break; - } while(field_on_page!=field); - + } + while (field_on_page != field); + return (field_on_page); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static FIELD *Sorted_Previous_Field(FIELD * field) -| -| Description : Get the previous field before the given field on the -| current page. The order of fields is the one defined +| +| Description : Get the previous field before the given field on the +| current page. The order of fields is the one defined | by the (row,column) geometry, rows are major. | | Return Values : Pointer to the previous field. +--------------------------------------------------------------------------*/ -INLINE static FIELD *Sorted_Previous_Field(FIELD * field) +INLINE static FIELD * +Sorted_Previous_Field(FIELD *field) { FIELD *field_on_page = field; @@ -2903,21 +3258,23 @@ INLINE static FIELD *Sorted_Previous_Field(FIELD * field) field_on_page = field_on_page->sprev; if (Field_Is_Selectable(field_on_page)) break; - } while(field_on_page!=field); - + } + while (field_on_page != field); + return (field_on_page); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static FIELD *Left_Neighbor_Field(FIELD * field) -| +| | Description : Get the left neighbor of the field on the same line | and the same page. Cycles through the line. | | Return Values : Pointer to left neighbor field. +--------------------------------------------------------------------------*/ -INLINE static FIELD *Left_Neighbor_Field(FIELD * field) +INLINE static FIELD * +Left_Neighbor_Field(FIELD *field) { FIELD *field_on_page = field; @@ -2925,25 +3282,27 @@ INLINE static FIELD *Left_Neighbor_Field(FIELD * field) immediately fails and the loop is left, positioned at the right neighbor. Otherwise we cycle backwards through the sorted field list until we enter the same line (from the right end). - */ + */ do { field_on_page = Sorted_Previous_Field(field_on_page); - } while(field_on_page->frow != field->frow); - + } + while (field_on_page->frow != field->frow); + return (field_on_page); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static FIELD *Right_Neighbor_Field(FIELD * field) -| +| | Description : Get the right neighbor of the field on the same line | and the same page. | | Return Values : Pointer to right neighbor field. +--------------------------------------------------------------------------*/ -INLINE static FIELD *Right_Neighbor_Field(FIELD * field) +INLINE static FIELD * +Right_Neighbor_Field(FIELD *field) { FIELD *field_on_page = field; @@ -2951,15 +3310,16 @@ INLINE static FIELD *Right_Neighbor_Field(FIELD * field) do { field_on_page = Sorted_Next_Field(field_on_page); - } while(field_on_page->frow != field->frow); - + } + while (field_on_page->frow != field->frow); + return (field_on_page); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static FIELD *Upper_Neighbor_Field(FIELD * field) -| +| | Description : Because of the row-major nature of sorting the fields, | it is more difficult to define whats the upper neighbor | field really means. We define that it must be on a @@ -2969,7 +3329,8 @@ INLINE static FIELD *Right_Neighbor_Field(FIELD * field) | | Return Values : Pointer to the upper neighbor field. +--------------------------------------------------------------------------*/ -static FIELD *Upper_Neighbor_Field(FIELD * field) +static FIELD * +Upper_Neighbor_Field(FIELD *field) { FIELD *field_on_page = field; int frow = field->frow; @@ -2978,35 +3339,37 @@ static FIELD *Upper_Neighbor_Field(FIELD * field) /* Walk back to the 'previous' line. The second term in the while clause just guarantees that we stop if we cycled through the line because there might be no 'previous' line if the page has just one line. - */ + */ do { field_on_page = Sorted_Previous_Field(field_on_page); - } while(field_on_page->frow==frow && field_on_page->fcol!=fcol); - - if (field_on_page->frow!=frow) - { /* We really found a 'previous' line. We are positioned at the + } + while (field_on_page->frow == frow && field_on_page->fcol != fcol); + + if (field_on_page->frow != frow) + { + /* We really found a 'previous' line. We are positioned at the rightmost field on this line */ - frow = field_on_page->frow; + frow = field_on_page->frow; - /* We walk to the left as long as we are really right of the - field. */ - while(field_on_page->frow==frow && field_on_page->fcol>fcol) + /* We walk to the left as long as we are really right of the + field. */ + while (field_on_page->frow == frow && field_on_page->fcol > fcol) field_on_page = Sorted_Previous_Field(field_on_page); - /* If we wrapped, just go to the right which is the first field on - the row */ - if (field_on_page->frow!=frow) + /* If we wrapped, just go to the right which is the first field on + the row */ + if (field_on_page->frow != frow) field_on_page = Sorted_Next_Field(field_on_page); } - + return (field_on_page); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static FIELD *Down_Neighbor_Field(FIELD * field) -| +| | Description : Because of the row-major nature of sorting the fields, | its more difficult to define whats the down neighbor | field really means. We define that it must be on a @@ -3016,7 +3379,8 @@ static FIELD *Upper_Neighbor_Field(FIELD * field) | | Return Values : Pointer to the upper neighbor field. +--------------------------------------------------------------------------*/ -static FIELD *Down_Neighbor_Field(FIELD * field) +static FIELD * +Down_Neighbor_Field(FIELD *field) { FIELD *field_on_page = field; int frow = field->frow; @@ -3025,41 +3389,43 @@ static FIELD *Down_Neighbor_Field(FIELD * field) /* Walk forward to the 'next' line. The second term in the while clause just guarantees that we stop if we cycled through the line because there might be no 'next' line if the page has just one line. - */ + */ do { field_on_page = Sorted_Next_Field(field_on_page); - } while(field_on_page->frow==frow && field_on_page->fcol!=fcol); + } + while (field_on_page->frow == frow && field_on_page->fcol != fcol); - if (field_on_page->frow!=frow) - { /* We really found a 'next' line. We are positioned at the rightmost + if (field_on_page->frow != frow) + { + /* We really found a 'next' line. We are positioned at the rightmost field on this line */ frow = field_on_page->frow; - /* We walk to the right as long as we are really left of the - field. */ - while(field_on_page->frow==frow && field_on_page->fcolfrow == frow && field_on_page->fcol < fcol) field_on_page = Sorted_Next_Field(field_on_page); - /* If we wrapped, just go to the left which is the last field on - the row */ - if (field_on_page->frow!=frow) + /* If we wrapped, just go to the left which is the last field on + the row */ + if (field_on_page->frow != frow) field_on_page = Sorted_Previous_Field(field_on_page); } - - return(field_on_page); + + return (field_on_page); } - + /*---------------------------------------------------------------------------- Inter-Field Navigation routines --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Inter_Field_Navigation( | int (* const fct) (FORM *), | FORM * form) -| +| | Description : Generic behavior for changing the current field, the | field is left and a new field is entered. So the field | must be validated and the field init/term hooks must @@ -3069,228 +3435,253 @@ static FIELD *Down_Neighbor_Field(FIELD * field) | E_INVALID_FIELD - field is invalid | some other - error from subordinate call +--------------------------------------------------------------------------*/ -static int Inter_Field_Navigation(int (* const fct) (FORM *),FORM *form) +static int +Inter_Field_Navigation(int (*const fct) (FORM *), FORM *form) { int res; - if (!_nc_Internal_Validation(form)) + if (!_nc_Internal_Validation(form)) res = E_INVALID_FIELD; else { - Call_Hook(form,fieldterm); + Call_Hook(form, fieldterm); res = fct(form); - Call_Hook(form,fieldinit); + Call_Hook(form, fieldinit); } return res; } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FN_Next_Field(FORM * form) -| +| | Description : Move to the next field on the current page of the form | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int FN_Next_Field(FORM * form) +static int +FN_Next_Field(FORM *form) { - return _nc_Set_Current_Field(form, - Next_Field_On_Page(form->current)); + T((T_CALLED("FN_Next_Field(%p)"), form)); + returnCode(_nc_Set_Current_Field(form, + Next_Field_On_Page(form->current))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FN_Previous_Field(FORM * form) -| -| Description : Move to the previous field on the current page of the +| +| Description : Move to the previous field on the current page of the | form | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int FN_Previous_Field(FORM * form) +static int +FN_Previous_Field(FORM *form) { - return _nc_Set_Current_Field(form, - Previous_Field_On_Page(form->current)); + T((T_CALLED("FN_Previous_Field(%p)"), form)); + returnCode(_nc_Set_Current_Field(form, + Previous_Field_On_Page(form->current))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FN_First_Field(FORM * form) -| +| | Description : Move to the first field on the current page of the form | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int FN_First_Field(FORM * form) +static int +FN_First_Field(FORM *form) { - return _nc_Set_Current_Field(form, - Next_Field_On_Page(form->field[form->page[form->curpage].pmax])); + T((T_CALLED("FN_First_Field(%p)"), form)); + returnCode(_nc_Set_Current_Field(form, + Next_Field_On_Page(form->field[form->page[form->curpage].pmax]))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FN_Last_Field(FORM * form) -| +| | Description : Move to the last field on the current page of the form | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int FN_Last_Field(FORM * form) +static int +FN_Last_Field(FORM *form) { - return - _nc_Set_Current_Field(form, - Previous_Field_On_Page(form->field[form->page[form->curpage].pmin])); + T((T_CALLED("FN_Last_Field(%p)"), form)); + returnCode( + _nc_Set_Current_Field(form, + Previous_Field_On_Page(form->field[form->page[form->curpage].pmin]))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FN_Sorted_Next_Field(FORM * form) -| +| | Description : Move to the sorted next field on the current page | of the form. | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int FN_Sorted_Next_Field(FORM * form) +static int +FN_Sorted_Next_Field(FORM *form) { - return _nc_Set_Current_Field(form, - Sorted_Next_Field(form->current)); + T((T_CALLED("FN_Sorted_Next_Field(%p)"), form)); + returnCode(_nc_Set_Current_Field(form, + Sorted_Next_Field(form->current))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FN_Sorted_Previous_Field(FORM * form) -| +| | Description : Move to the sorted previous field on the current page | of the form. | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int FN_Sorted_Previous_Field(FORM * form) +static int +FN_Sorted_Previous_Field(FORM *form) { - return _nc_Set_Current_Field(form, - Sorted_Previous_Field(form->current)); + T((T_CALLED("FN_Sorted_Previous_Field(%p)"), form)); + returnCode(_nc_Set_Current_Field(form, + Sorted_Previous_Field(form->current))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FN_Sorted_First_Field(FORM * form) -| +| | Description : Move to the sorted first field on the current page | of the form. | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int FN_Sorted_First_Field(FORM * form) +static int +FN_Sorted_First_Field(FORM *form) { - return _nc_Set_Current_Field(form, - Sorted_Next_Field(form->field[form->page[form->curpage].smax])); + T((T_CALLED("FN_Sorted_First_Field(%p)"), form)); + returnCode(_nc_Set_Current_Field(form, + Sorted_Next_Field(form->field[form->page[form->curpage].smax]))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FN_Sorted_Last_Field(FORM * form) -| +| | Description : Move to the sorted last field on the current page | of the form. | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int FN_Sorted_Last_Field(FORM * form) +static int +FN_Sorted_Last_Field(FORM *form) { - return _nc_Set_Current_Field(form, - Sorted_Previous_Field(form->field[form->page[form->curpage].smin])); + T((T_CALLED("FN_Sorted_Last_Field(%p)"), form)); + returnCode(_nc_Set_Current_Field(form, + Sorted_Previous_Field(form->field[form->page[form->curpage].smin]))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FN_Left_Field(FORM * form) -| +| | Description : Get the field on the left of the current field on the | same line and the same page. Cycles through the line. | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int FN_Left_Field(FORM * form) +static int +FN_Left_Field(FORM *form) { - return _nc_Set_Current_Field(form, - Left_Neighbor_Field(form->current)); + T((T_CALLED("FN_Left_Field(%p)"), form)); + returnCode(_nc_Set_Current_Field(form, + Left_Neighbor_Field(form->current))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FN_Right_Field(FORM * form) -| +| | Description : Get the field on the right of the current field on the | same line and the same page. Cycles through the line. | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int FN_Right_Field(FORM * form) +static int +FN_Right_Field(FORM *form) { - return _nc_Set_Current_Field(form, - Right_Neighbor_Field(form->current)); + T((T_CALLED("FN_Right_Field(%p)"), form)); + returnCode(_nc_Set_Current_Field(form, + Right_Neighbor_Field(form->current))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FN_Up_Field(FORM * form) -| +| | Description : Get the upper neighbor of the current field. This | cycles through the page. See the comments of the | Upper_Neighbor_Field function to understand how -| 'upper' is defined. +| 'upper' is defined. | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int FN_Up_Field(FORM * form) +static int +FN_Up_Field(FORM *form) { - return _nc_Set_Current_Field(form, - Upper_Neighbor_Field(form->current)); + T((T_CALLED("FN_Up_Field(%p)"), form)); + returnCode(_nc_Set_Current_Field(form, + Upper_Neighbor_Field(form->current))); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int FN_Down_Field(FORM * form) -| +| | Description : Get the down neighbor of the current field. This | cycles through the page. See the comments of the | Down_Neighbor_Field function to understand how -| 'down' is defined. +| 'down' is defined. | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int FN_Down_Field(FORM * form) +static int +FN_Down_Field(FORM *form) { - return _nc_Set_Current_Field(form, - Down_Neighbor_Field(form->current)); + T((T_CALLED("FN_Down_Field(%p)"), form)); + returnCode(_nc_Set_Current_Field(form, + Down_Neighbor_Field(form->current))); } /*---------------------------------------------------------------------------- - END of Field Navigation routines + END of Field Navigation routines --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Helper routines for Page Navigation --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int _nc_Set_Form_Page(FORM * form, | int page, | FIELD * field) -| +| | Description : Make the given page number the current page and make | the given field the current field on the page. If | for the field NULL is given, make the first field on @@ -3301,12 +3692,11 @@ static int FN_Down_Field(FORM * form) | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -_nc_Set_Form_Page -(FORM * form, int page, FIELD * field) +_nc_Set_Form_Page(FORM *form, int page, FIELD *field) { int res = E_OK; - if ((form->curpage!=page)) + if ((form->curpage != page)) { FIELD *last_field, *field_on_page; @@ -3316,63 +3706,66 @@ _nc_Set_Form_Page do { if (field_on_page->opts & O_VISIBLE) - if ((res=Display_Field(field_on_page))!=E_OK) - return(res); + if ((res = Display_Field(field_on_page)) != E_OK) + return (res); field_on_page = field_on_page->snext; - } while(field_on_page != last_field); + } + while (field_on_page != last_field); if (field) - res = _nc_Set_Current_Field(form,field); + res = _nc_Set_Current_Field(form, field); else /* N.B.: we don't encapsulate this by Inter_Field_Navigation(), because this is already executed in a page navigation - context that contains field navigation + context that contains field navigation */ res = FN_First_Field(form); } - return(res); + return (res); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Next_Page_Number(const FORM * form) -| +| | Description : Calculate the page number following the current page | number. This cycles if the highest page number is -| reached. +| reached. | | Return Values : The next page number +--------------------------------------------------------------------------*/ -INLINE static int Next_Page_Number(const FORM * form) +INLINE static int +Next_Page_Number(const FORM *form) { return (form->curpage + 1) % form->maxpage; } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Previous_Page_Number(const FORM * form) -| +| | Description : Calculate the page number before the current page | number. This cycles if the first page number is -| reached. +| reached. | | Return Values : The previous page number +--------------------------------------------------------------------------*/ -INLINE static int Previous_Page_Number(const FORM * form) +INLINE static int +Previous_Page_Number(const FORM *form) { - return (form->curpage!=0 ? form->curpage - 1 : form->maxpage - 1); + return (form->curpage != 0 ? form->curpage - 1 : form->maxpage - 1); } - + /*---------------------------------------------------------------------------- - Page Navigation routines + Page Navigation routines --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Page_Navigation( | int (* const fct) (FORM *), | FORM * form) -| +| | Description : Generic behavior for changing a page. This means | that the field is left and a new field is entered. | So the field must be validated and the field init/term @@ -3383,90 +3776,100 @@ INLINE static int Previous_Page_Number(const FORM * form) | E_INVALID_FIELD - field is invalid | some other - error from subordinate call +--------------------------------------------------------------------------*/ -static int Page_Navigation(int (* const fct) (FORM *), FORM * form) +static int +Page_Navigation(int (*const fct) (FORM *), FORM *form) { int res; - if (!_nc_Internal_Validation(form)) + if (!_nc_Internal_Validation(form)) res = E_INVALID_FIELD; else { - Call_Hook(form,fieldterm); - Call_Hook(form,formterm); + Call_Hook(form, fieldterm); + Call_Hook(form, formterm); res = fct(form); - Call_Hook(form,forminit); - Call_Hook(form,fieldinit); + Call_Hook(form, forminit); + Call_Hook(form, fieldinit); } return res; } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int PN_Next_Page(FORM * form) -| +| | Description : Move to the next page of the form | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int PN_Next_Page(FORM * form) -{ - return _nc_Set_Form_Page(form,Next_Page_Number(form),(FIELD *)0); +static int +PN_Next_Page(FORM *form) +{ + T((T_CALLED("PN_Next_Page(%p)"), form)); + returnCode(_nc_Set_Form_Page(form, Next_Page_Number(form), (FIELD *)0)); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int PN_Previous_Page(FORM * form) -| +| | Description : Move to the previous page of the form | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int PN_Previous_Page(FORM * form) +static int +PN_Previous_Page(FORM *form) { - return _nc_Set_Form_Page(form,Previous_Page_Number(form),(FIELD *)0); + T((T_CALLED("PN_Previous_Page(%p)"), form)); + returnCode(_nc_Set_Form_Page(form, Previous_Page_Number(form), (FIELD *)0)); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int PN_First_Page(FORM * form) -| +| | Description : Move to the first page of the form | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int PN_First_Page(FORM * form) +static int +PN_First_Page(FORM *form) { - return _nc_Set_Form_Page(form,0,(FIELD *)0); + T((T_CALLED("PN_First_Page(%p)"), form)); + returnCode(_nc_Set_Form_Page(form, 0, (FIELD *)0)); } /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int PN_Last_Page(FORM * form) -| +| | Description : Move to the last page of the form | | Return Values : E_OK - success | != E_OK - error from subordinate call +--------------------------------------------------------------------------*/ -static int PN_Last_Page(FORM * form) +static int +PN_Last_Page(FORM *form) { - return _nc_Set_Form_Page(form,form->maxpage-1,(FIELD *)0); + T((T_CALLED("PN_Last_Page(%p)"), form)); + returnCode(_nc_Set_Form_Page(form, form->maxpage - 1, (FIELD *)0)); } + /*---------------------------------------------------------------------------- - END of Field Navigation routines + END of Field Navigation routines --------------------------------------------------------------------------*/ - + /*---------------------------------------------------------------------------- Helper routines for the core form driver. --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : static int Data_Entry(FORM * form,int c) -| +| | Description : Enter character c into at the current position of the | current field of the form. | @@ -3474,101 +3877,119 @@ static int PN_Last_Page(FORM * form) | E_REQUEST_DENIED - | E_SYSTEM_ERROR - +--------------------------------------------------------------------------*/ -static int Data_Entry(FORM * form, int c) +static int +Data_Entry(FORM *form, int c) { - FIELD *field = form->current; + FIELD *field = form->current; int result = E_REQUEST_DENIED; - if ( (field->opts & O_EDIT) + T((T_CALLED("Data_Entry(%p,%s)"), form, _tracechtype(c))); + if ((field->opts & O_EDIT) #if FIX_FORM_INACTIVE_BUG - && (field->opts & O_ACTIVE) + && (field->opts & O_ACTIVE) #endif - ) + ) { - if ( (field->opts & O_BLANK) && - First_Position_In_Current_Field(form) && - !(form->status & _FCHECK_REQUIRED) && - !(form->status & _WINDOW_MODIFIED) ) + if ((field->opts & O_BLANK) && + First_Position_In_Current_Field(form) && + !(form->status & _FCHECK_REQUIRED) && + !(form->status & _WINDOW_MODIFIED)) werase(form->w); if (form->status & _OVLMODE) { - waddch(form->w,(chtype)c); - } - else /* no _OVLMODE */ + waddch(form->w, (chtype)c); + } + else + /* no _OVLMODE */ { bool There_Is_Room = Is_There_Room_For_A_Char_In_Line(form); if (!(There_Is_Room || ((Single_Line_Field(field) && Growable(field))))) - return E_REQUEST_DENIED; + RETURN(E_REQUEST_DENIED); - if (!There_Is_Room && !Field_Grown(field,1)) - return E_SYSTEM_ERROR; + if (!There_Is_Room && !Field_Grown(field, 1)) + RETURN(E_SYSTEM_ERROR); - winsch(form->w,(chtype)c); + winsch(form->w, (chtype)c); } - if ((result=Wrapping_Not_Necessary_Or_Wrapping_Ok(form))==E_OK) + if ((result = Wrapping_Not_Necessary_Or_Wrapping_Ok(form)) == E_OK) { - bool End_Of_Field= (((field->drows-1)==form->currow) && - ((field->dcols-1)==form->curcol)); + bool End_Of_Field = (((field->drows - 1) == form->currow) && + ((field->dcols - 1) == form->curcol)); + form->status |= _WINDOW_MODIFIED; if (End_Of_Field && !Growable(field) && (field->opts & O_AUTOSKIP)) - result = Inter_Field_Navigation(FN_Next_Field,form); + result = Inter_Field_Navigation(FN_Next_Field, form); else { - if (End_Of_Field && Growable(field) && !Field_Grown(field,1)) + if (End_Of_Field && Growable(field) && !Field_Grown(field, 1)) result = E_SYSTEM_ERROR; else { +#if USE_WIDEC_SUPPORT + /* + * We have just added a byte to the form field. It may have + * been part of a multibyte character. If it was, the + * addch_used field is nonzero and we should not try to move + * to a new column. + */ + if (WINDOW_EXT(form->w, addch_used) == 0) + IFN_Next_Character(form); +#else IFN_Next_Character(form); +#endif result = E_OK; } } } } - return result; + RETURN(result); } - + /* Structure to describe the binding of a request code to a function. The member keycode codes the request value as well as the generic routine to use for the request. The code for the generic routine is coded in the upper 16 Bits while the request code is coded in - the lower 16 bits. + the lower 16 bits. In terms of C++ you might think of a request as a class with a virtual method "perform". The different types of request are derived from this base class and overload (or not) the base class implementation of perform. */ -typedef struct { - int keycode; /* must be at least 32 bit: hi:mode, lo: key */ - int (*cmd)(FORM *); /* low level driver routine for this key */ -} Binding_Info; +typedef struct +{ + int keycode; /* must be at least 32 bit: hi:mode, lo: key */ + int (*cmd) (FORM *); /* low level driver routine for this key */ +} +Binding_Info; /* You may see this is the class-id of the request type class */ -#define ID_PN (0x00000000) /* Page navigation */ -#define ID_FN (0x00010000) /* Inter-Field navigation */ -#define ID_IFN (0x00020000) /* Intra-Field navigation */ -#define ID_VSC (0x00030000) /* Vertical Scrolling */ -#define ID_HSC (0x00040000) /* Horizontal Scrolling */ -#define ID_FE (0x00050000) /* Field Editing */ -#define ID_EM (0x00060000) /* Edit Mode */ -#define ID_FV (0x00070000) /* Field Validation */ -#define ID_CH (0x00080000) /* Choice */ +#define ID_PN (0x00000000) /* Page navigation */ +#define ID_FN (0x00010000) /* Inter-Field navigation */ +#define ID_IFN (0x00020000) /* Intra-Field navigation */ +#define ID_VSC (0x00030000) /* Vertical Scrolling */ +#define ID_HSC (0x00040000) /* Horizontal Scrolling */ +#define ID_FE (0x00050000) /* Field Editing */ +#define ID_EM (0x00060000) /* Edit Mode */ +#define ID_FV (0x00070000) /* Field Validation */ +#define ID_CH (0x00080000) /* Choice */ #define ID_Mask (0xffff0000) #define Key_Mask (0x0000ffff) #define ID_Shft (16) /* This array holds all the Binding Infos */ -static const Binding_Info bindings[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = +/* *INDENT-OFF* */ +static const Binding_Info bindings[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = { { REQ_NEXT_PAGE |ID_PN ,PN_Next_Page}, { REQ_PREV_PAGE |ID_PN ,PN_Previous_Page}, { REQ_FIRST_PAGE |ID_PN ,PN_First_Page}, { REQ_LAST_PAGE |ID_PN ,PN_Last_Page}, - + { REQ_NEXT_FIELD |ID_FN ,FN_Next_Field}, { REQ_PREV_FIELD |ID_FN ,FN_Previous_Field}, { REQ_FIRST_FIELD |ID_FN ,FN_First_Field}, @@ -3581,7 +4002,7 @@ static const Binding_Info bindings[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = { REQ_RIGHT_FIELD |ID_FN ,FN_Right_Field}, { REQ_UP_FIELD |ID_FN ,FN_Up_Field}, { REQ_DOWN_FIELD |ID_FN ,FN_Down_Field}, - + { REQ_NEXT_CHAR |ID_IFN ,IFN_Next_Character}, { REQ_PREV_CHAR |ID_IFN ,IFN_Previous_Character}, { REQ_NEXT_LINE |ID_IFN ,IFN_Next_Line}, @@ -3596,7 +4017,7 @@ static const Binding_Info bindings[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = { REQ_RIGHT_CHAR |ID_IFN ,IFN_Right_Character}, { REQ_UP_CHAR |ID_IFN ,IFN_Up_Character}, { REQ_DOWN_CHAR |ID_IFN ,IFN_Down_Character}, - + { REQ_NEW_LINE |ID_FE ,FE_New_Line}, { REQ_INS_CHAR |ID_FE ,FE_Insert_Character}, { REQ_INS_LINE |ID_FE ,FE_Insert_Line}, @@ -3607,34 +4028,35 @@ static const Binding_Info bindings[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = { REQ_CLR_EOL |ID_FE ,FE_Clear_To_End_Of_Line}, { REQ_CLR_EOF |ID_FE ,FE_Clear_To_End_Of_Field}, { REQ_CLR_FIELD |ID_FE ,FE_Clear_Field}, - + { REQ_OVL_MODE |ID_EM ,EM_Overlay_Mode}, { REQ_INS_MODE |ID_EM ,EM_Insert_Mode}, - + { REQ_SCR_FLINE |ID_VSC ,VSC_Scroll_Line_Forward}, { REQ_SCR_BLINE |ID_VSC ,VSC_Scroll_Line_Backward}, { REQ_SCR_FPAGE |ID_VSC ,VSC_Scroll_Page_Forward}, { REQ_SCR_BPAGE |ID_VSC ,VSC_Scroll_Page_Backward}, { REQ_SCR_FHPAGE |ID_VSC ,VSC_Scroll_Half_Page_Forward}, { REQ_SCR_BHPAGE |ID_VSC ,VSC_Scroll_Half_Page_Backward}, - + { REQ_SCR_FCHAR |ID_HSC ,HSC_Scroll_Char_Forward}, { REQ_SCR_BCHAR |ID_HSC ,HSC_Scroll_Char_Backward}, { REQ_SCR_HFLINE |ID_HSC ,HSC_Horizontal_Line_Forward}, { REQ_SCR_HBLINE |ID_HSC ,HSC_Horizontal_Line_Backward}, { REQ_SCR_HFHALF |ID_HSC ,HSC_Horizontal_Half_Line_Forward}, { REQ_SCR_HBHALF |ID_HSC ,HSC_Horizontal_Half_Line_Backward}, - + { REQ_VALIDATION |ID_FV ,FV_Validation}, { REQ_NEXT_CHOICE |ID_CH ,CR_Next_Choice}, { REQ_PREV_CHOICE |ID_CH ,CR_Previous_Choice} }; +/* *INDENT-ON* */ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int form_driver(FORM * form,int c) -| +| | Description : This is the workhorse of the forms system. It checks | to determine whether the character c is a request or | data. If it is a request, the form driver executes @@ -3656,126 +4078,143 @@ static const Binding_Info bindings[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = | E_UNKNOWN_COMMAND - command not known +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -form_driver (FORM * form, int c) +form_driver(FORM *form, int c) { - const Binding_Info* BI = (Binding_Info *)0; + const Binding_Info *BI = (Binding_Info *) 0; int res = E_UNKNOWN_COMMAND; + T((T_CALLED("form_driver(%p,%d)"), form, c)); + if (!form) RETURN(E_BAD_ARGUMENT); if (!(form->field)) RETURN(E_NOT_CONNECTED); - + assert(form->page); - - if (c==FIRST_ACTIVE_MAGIC) + + if (c == FIRST_ACTIVE_MAGIC) { form->current = _nc_First_Active_Field(form); - return E_OK; + RETURN(E_OK); } - - assert(form->current && - form->current->buf && + + assert(form->current && + form->current->buf && (form->current->form == form) - ); - - if ( form->status & _IN_DRIVER ) + ); + + if (form->status & _IN_DRIVER) RETURN(E_BAD_STATE); - if ( !( form->status & _POSTED ) ) + if (!(form->status & _POSTED)) RETURN(E_NOT_POSTED); - - if ((c>=MIN_FORM_COMMAND && c<=MAX_FORM_COMMAND) && - ((bindings[c-MIN_FORM_COMMAND].keycode & Key_Mask) == c)) - BI = &(bindings[c-MIN_FORM_COMMAND]); - + + if ((c >= MIN_FORM_COMMAND && c <= MAX_FORM_COMMAND) && + ((bindings[c - MIN_FORM_COMMAND].keycode & Key_Mask) == c)) + BI = &(bindings[c - MIN_FORM_COMMAND]); + if (BI) { - typedef int (*Generic_Method)(int (* const)(FORM *),FORM *); - static const Generic_Method Generic_Methods[] = - { - Page_Navigation, /* overloaded to call field&form hooks */ - Inter_Field_Navigation, /* overloaded to call field hooks */ - NULL, /* Intra-Field is generic */ - Vertical_Scrolling, /* Overloaded to check multi-line */ - Horizontal_Scrolling, /* Overloaded to check single-line */ - Field_Editing, /* Overloaded to mark modification */ - NULL, /* Edit Mode is generic */ - NULL, /* Field Validation is generic */ - NULL /* Choice Request is generic */ - }; - size_t nMethods = (sizeof(Generic_Methods)/sizeof(Generic_Methods[0])); - size_t method = ((BI->keycode & ID_Mask) >> ID_Shft) & 0xffff; - - if ( (method >= nMethods) || !(BI->cmd) ) + typedef int (*Generic_Method) (int (*const) (FORM *), FORM *); + static const Generic_Method Generic_Methods[] = + { + Page_Navigation, /* overloaded to call field&form hooks */ + Inter_Field_Navigation, /* overloaded to call field hooks */ + NULL, /* Intra-Field is generic */ + Vertical_Scrolling, /* Overloaded to check multi-line */ + Horizontal_Scrolling, /* Overloaded to check single-line */ + Field_Editing, /* Overloaded to mark modification */ + NULL, /* Edit Mode is generic */ + NULL, /* Field Validation is generic */ + NULL /* Choice Request is generic */ + }; + size_t nMethods = (sizeof(Generic_Methods) / sizeof(Generic_Methods[0])); + size_t method = ((BI->keycode & ID_Mask) >> ID_Shft) & 0xffff; + + if ((method >= nMethods) || !(BI->cmd)) res = E_SYSTEM_ERROR; else { Generic_Method fct = Generic_Methods[method]; + if (fct) - res = fct(BI->cmd,form); + res = fct(BI->cmd, form); else - res = (BI->cmd)(form); + res = (BI->cmd) (form); } - } - else + } + else if (!(c & (~(int)MAX_REGULAR_CHARACTER))) { - if (!(c & (~(int)MAX_REGULAR_CHARACTER)) && - isprint((unsigned char)c) && - Check_Char(form->current->type,c, + /* + * If we're using 8-bit characters, iscntrl+isprint cover the whole set. + * But with multibyte characters, there is a third possibility, i.e., + * parts of characters that build up into printable characters which are + * not considered printable. + * + * FIXME: the wide-character branch should also use Check_Char(). + */ +#if USE_WIDEC_SUPPORT + if (!iscntrl(UChar(c))) +#else + if (isprint(UChar(c)) && + Check_Char(form->current->type, c, (TypeArgument *)(form->current->arg))) - res = Data_Entry(form,c); +#endif + res = Data_Entry(form, c); } _nc_Refresh_Current_Field(form); RETURN(res); } - + /*---------------------------------------------------------------------------- Field-Buffer manipulation routines. - The effects of setting a buffer is tightly coupled to the core of the form + The effects of setting a buffer are tightly coupled to the core of the form driver logic. This is especially true in the case of growable fields. - So I don't separate this into an own module. + So I don't separate this into a separate module. --------------------------------------------------------------------------*/ /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int set_field_buffer(FIELD *field, | int buffer, char *value) -| +| | Description : Set the given buffer of the field to the given value. | Buffer 0 stores the displayed content of the field. | For dynamic fields this may grow the fieldbuffers if | the length of the value exceeds the current buffer | length. For buffer 0 only printable values are allowed. | For static fields, the value needs not to be zero ter- -| minated. It is copied up to the length of the buffer. +| minated. It is copied up to the length of the buffer. | | Return Values : E_OK - success | E_BAD_ARGUMENT - invalid argument | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_field_buffer -(FIELD * field, int buffer, const char * value) +set_field_buffer(FIELD *field, int buffer, const char *value) { - char *s, *p; + FIELD_CELL *p; int res = E_OK; + unsigned int i; unsigned int len; - if ( !field || !value || ((buffer < 0)||(buffer > field->nbuf)) ) +#if USE_WIDEC_SUPPORT + FIELD_CELL *widevalue = 0; +#endif + + T((T_CALLED("set_field_buffer(%p,%d,%s)"), field, buffer, _nc_visbuf(value))); + + if (!field || !value || ((buffer < 0) || (buffer > field->nbuf))) RETURN(E_BAD_ARGUMENT); - len = Buffer_Length(field); + len = Buffer_Length(field); - if (buffer==0) + if (buffer == 0) { - const char *v; - unsigned int i = 0; - - for(v=value; *v && (i len) { if (!Field_Grown(field, - (int)(1 + (vlen-len)/((field->rows+field->nrow)*field->cols)))) + (int)(1 + (vlen - len) / ((field->rows + field->nrow) + * field->cols)))) RETURN(E_SYSTEM_ERROR); /* in this case we also have to check, whether or not the remaining characters in value are also printable for buffer 0. */ - if (buffer==0) + if (buffer == 0) { - unsigned int i; - - for(i=len; iworking); + mvwaddstr(field->working, 0, 0, value); + + if ((widevalue = (FIELD_CELL *)calloc(len, sizeof(FIELD_CELL))) == 0) + { + RETURN(E_SYSTEM_ERROR); + } + else + { + mvwin_wchnstr(field->working, 0, 0, widevalue, (int)len); + for (i = 0; i < len; ++i) + { + if (CharEq(myZEROS, widevalue[i])) + { + while (i < len) + p[i++] = myBLANK; + break; + } + p[i] = widevalue[i]; + } + free(widevalue); + } #else - for(s=(char *)value; *s && (s < (value+len)); s++) - p[s-value] = *s; - if (s < (value+len)) + for (i = 0; i < len; ++i) { - p[s-value] = *s++; - s = p + (s-value); + if (value[i] == '\0') + { + while (i < len) + p[i++] = myBLANK; + break; + } + p[i] = value[i]; } - else - s=(char *)0; #endif - if (s) - { /* this means, value was null terminated and not greater than the - buffer. We have to pad with blanks. Please note that due to memccpy - logic s points after the terminating null. */ - s--; /* now we point to the terminator. */ - assert(len >= (unsigned int)(s-p)); - if (len > (unsigned int)(s-p)) - memset(s,C_BLANK,len-(unsigned int)(s-p)); - } - - if (buffer==0) + if (buffer == 0) { int syncres; - if (((syncres=Synchronize_Field( field ))!=E_OK) && - (res==E_OK)) + + if (((syncres = Synchronize_Field(field)) != E_OK) && + (res == E_OK)) res = syncres; - if (((syncres=Synchronize_Linked_Fields(field ))!=E_OK) && - (res==E_OK)) + if (((syncres = Synchronize_Linked_Fields(field)) != E_OK) && + (res == E_OK)) res = syncres; } RETURN(res); -} +} /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : char *field_buffer(const FIELD *field,int buffer) -| +| | Description : Return the address of the buffer for the field. | | Return Values : Pointer to buffer or NULL if arguments were invalid. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(char *) -field_buffer (const FIELD * field, int buffer) +field_buffer(const FIELD *field, int buffer) { + char *result = 0; + + T((T_CALLED("field_buffer(%p,%d)"), field, buffer)); + if (field && (buffer >= 0) && (buffer <= field->nbuf)) - return Address_Of_Nth_Buffer(field,buffer); - else - return (char *)0; + { +#if USE_WIDEC_SUPPORT + FIELD_CELL *data = Address_Of_Nth_Buffer(field, buffer); + unsigned need = 0; + int size = Buffer_Length(field); + int n; + + /* determine the number of bytes needed to store the expanded string */ + for (n = 0; n < size; ++n) + { + if (!isWidecExt(data[n])) + { + mbstate_t state; + size_t next; + + init_mb(state); + next = _nc_wcrtomb(0, data[n].chars[0], &state); + if (!isEILSEQ(next)) + { + if (next != 0) + need += next; + } + } + } + + /* allocate a place to store the expanded string */ + if (field->expanded[buffer] != 0) + free(field->expanded[buffer]); + field->expanded[buffer] = typeMalloc(char, need + 1); + + /* expand the multibyte data */ + if ((result = field->expanded[buffer]) != 0) + { + wclear(field->working); + mvwadd_wchnstr(field->working, 0, 0, data, size); + mvwinnstr(field->working, 0, 0, result, (int)need + 1); + } +#else + result = Address_Of_Nth_Buffer(field, buffer); +#endif + } + returnPtr(result); +} + +#if USE_WIDEC_SUPPORT + +/* FIXME: see lib_get_wch.c */ +#if HAVE_MBTOWC && HAVE_MBLEN +#define reset_mbytes(state) mblen(NULL, 0), mbtowc(NULL, NULL, 0) +#define count_mbytes(buffer,length,state) mblen(buffer,length) +#define trans_mbytes(wch,buffer,length,state) \ + (int) mbtowc(&wch, buffer, length) +#elif HAVE_MBRTOWC && HAVE_MBRLEN +#define NEED_STATE +#define reset_mbytes(state) init_mb(state) +#define count_mbytes(buffer,length,state) mbrlen(buffer,length,&state) +#define trans_mbytes(wch,buffer,length,state) \ + (int) mbrtowc(&wch, buffer, length, &state) +#else +make an error +#endif + +/*--------------------------------------------------------------------------- +| Convert a multibyte string to a wide-character string. The result must be +| freed by the caller. ++--------------------------------------------------------------------------*/ +NCURSES_EXPORT(wchar_t *) +_nc_Widen_String(char *source, int *lengthp) +{ + wchar_t *result = 0; + wchar_t wch; + size_t given = strlen(source); + size_t tries; + int pass; + int status; + +#ifdef NEED_STATE + mbstate_t state; +#endif + + for (pass = 0; pass < 2; ++pass) + { + unsigned need = 0; + size_t passed = 0; + + while (passed < given) + { + bool found = FALSE; + + for (tries = 1, status = 0; tries <= (given - passed); ++tries) + { + int save = source[passed + tries]; + + source[passed + tries] = 0; + reset_mbytes(state); + status = trans_mbytes(wch, source + passed, tries, state); + source[passed + tries] = save; + + if (status > 0) + { + found = TRUE; + break; + } + } + if (found) + { + if (pass) + { + result[need] = wch; + } + passed += status; + ++need; + } + else + { + if (pass) + { + result[need] = source[passed]; + } + ++need; + ++passed; + } + } + + if (!pass) + { + if (!need) + break; + result = typeCalloc(wchar_t, need); + + *lengthp = need; + if (result == 0) + break; + } + } + + return result; } +#endif /* frm_driver.c ends here */ diff --git a/form/frm_hook.c b/form/frm_hook.c index 367cf5fa..18e6d71f 100644 --- a/form/frm_hook.c +++ b/form/frm_hook.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,12 +32,13 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_hook.c,v 1.11 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: frm_hook.c,v 1.14 2004/12/25 22:37:27 tom Exp $") /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook func)\ {\ + T((T_CALLED("set_" #typ"_"#name"(%p,%p)"), form, func));\ (Normalize_Form( form ) -> typ ## name) = func ;\ RETURN(E_OK);\ } @@ -46,95 +47,96 @@ NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (FORM *form, Form_Hook f #define GEN_HOOK_GET_FUNCTION( typ, name ) \ NCURSES_IMPEXP Form_Hook NCURSES_API typ ## _ ## name ( const FORM *form )\ {\ - return ( Normalize_Form( form ) -> typ ## name );\ + T((T_CALLED(#typ "_" #name "(%p)"), form));\ + returnFormHook( Normalize_Form( form ) -> typ ## name );\ } - + /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int set_field_init(FORM *form, Form_Hook f) -| +| | Description : Assigns an application defined initialization function | to be called when the form is posted and just after | the current field changes. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -GEN_HOOK_SET_FUNCTION(field,init) +GEN_HOOK_SET_FUNCTION(field, init) /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : Form_Hook field_init(const FORM *form) -| +| | Description : Retrieve field initialization routine address. | | Return Values : The address or NULL if no hook defined. +--------------------------------------------------------------------------*/ -GEN_HOOK_GET_FUNCTION(field,init) +GEN_HOOK_GET_FUNCTION(field, init) /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int set_field_term(FORM *form, Form_Hook f) -| +| | Description : Assigns an application defined finalization function | to be called when the form is unposted and just before | the current field changes. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -GEN_HOOK_SET_FUNCTION(field,term) +GEN_HOOK_SET_FUNCTION(field, term) /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : Form_Hook field_term(const FORM *form) -| +| | Description : Retrieve field finalization routine address. | | Return Values : The address or NULL if no hook defined. +--------------------------------------------------------------------------*/ -GEN_HOOK_GET_FUNCTION(field,term) +GEN_HOOK_GET_FUNCTION(field, term) /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int set_form_init(FORM *form, Form_Hook f) -| +| | Description : Assigns an application defined initialization function | to be called when the form is posted and just after | a page change. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -GEN_HOOK_SET_FUNCTION(form,init) +GEN_HOOK_SET_FUNCTION(form, init) /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : Form_Hook form_init(const FORM *form) -| +| | Description : Retrieve form initialization routine address. | | Return Values : The address or NULL if no hook defined. +--------------------------------------------------------------------------*/ -GEN_HOOK_GET_FUNCTION(form,init) +GEN_HOOK_GET_FUNCTION(form, init) /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : int set_form_term(FORM *form, Form_Hook f) -| +| | Description : Assigns an application defined finalization function | to be called when the form is unposted and just before | a page change. | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -GEN_HOOK_SET_FUNCTION(form,term) +GEN_HOOK_SET_FUNCTION(form, term) /*--------------------------------------------------------------------------- -| Facility : libnform +| Facility : libnform | Function : Form_Hook form_term(const FORM *form) -| +| | Description : Retrieve form finalization routine address. | | Return Values : The address or NULL if no hook defined. +--------------------------------------------------------------------------*/ -GEN_HOOK_GET_FUNCTION(form,term) +GEN_HOOK_GET_FUNCTION(form, term) /* frm_hook.c ends here */ diff --git a/form/frm_opts.c b/form/frm_opts.c index 0b8032d1..d36d618a 100644 --- a/form/frm_opts.c +++ b/form/frm_opts.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_opts.c,v 1.11 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: frm_opts.c,v 1.14 2005/04/16 16:59:18 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -45,14 +45,16 @@ MODULE_ID("$Id: frm_opts.c,v 1.11 2003/10/25 15:17:08 tom Exp $") | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_form_opts (FORM * form, Form_Options opts) +set_form_opts(FORM *form, Form_Options opts) { + T((T_CALLED("set_form_opts(%p,%d)"), form, opts)); + opts &= ALL_FORM_OPTS; if (opts & ~ALL_FORM_OPTS) RETURN(E_BAD_ARGUMENT); else { - Normalize_Form( form )->opts = opts; + Normalize_Form(form)->opts = opts; RETURN(E_OK); } } @@ -66,9 +68,10 @@ set_form_opts (FORM * form, Form_Options opts) | Return Values : The option flags. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(Form_Options) -form_opts (const FORM * form) +form_opts(const FORM *form) { - return (Normalize_Form(form)->opts & ALL_FORM_OPTS); + T((T_CALLED("form_opts(%p)"), form)); + returnCode((int)(Normalize_Form(form)->opts & ALL_FORM_OPTS)); } /*--------------------------------------------------------------------------- @@ -82,14 +85,16 @@ form_opts (const FORM * form) | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -form_opts_on (FORM * form, Form_Options opts) +form_opts_on(FORM *form, Form_Options opts) { + T((T_CALLED("form_opts_on(%p,%d)"), form, opts)); + opts &= ALL_FORM_OPTS; if (opts & ~ALL_FORM_OPTS) RETURN(E_BAD_ARGUMENT); else { - Normalize_Form( form )->opts |= opts; + Normalize_Form(form)->opts |= opts; RETURN(E_OK); } } @@ -105,8 +110,10 @@ form_opts_on (FORM * form, Form_Options opts) | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -form_opts_off (FORM * form, Form_Options opts) +form_opts_off(FORM *form, Form_Options opts) { + T((T_CALLED("form_opts_off(%p,%d)"), form, opts)); + opts &= ALL_FORM_OPTS; if (opts & ~ALL_FORM_OPTS) RETURN(E_BAD_ARGUMENT); diff --git a/form/frm_page.c b/form/frm_page.c index 354c9aea..a371838d 100644 --- a/form/frm_page.c +++ b/form/frm_page.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_page.c,v 1.8 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: frm_page.c,v 1.10 2004/12/11 22:08:21 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -47,35 +47,37 @@ MODULE_ID("$Id: frm_page.c,v 1.8 2003/10/25 15:17:08 tom Exp $") | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_form_page (FORM * form, int page) +set_form_page(FORM *form, int page) { int err = E_OK; - if ( !form || (page<0) || (page>=form->maxpage) ) + T((T_CALLED("set_form_page(%p,%d)"), form, page)); + + if (!form || (page < 0) || (page >= form->maxpage)) RETURN(E_BAD_ARGUMENT); if (!(form->status & _POSTED)) { form->curpage = page; form->current = _nc_First_Active_Field(form); - } + } else { - if (form->status & _IN_DRIVER) + if (form->status & _IN_DRIVER) err = E_BAD_STATE; else { if (form->curpage != page) { - if (!_nc_Internal_Validation(form)) + if (!_nc_Internal_Validation(form)) err = E_INVALID_FIELD; else { - Call_Hook(form,fieldterm); - Call_Hook(form,formterm); - err = _nc_Set_Form_Page(form,page,(FIELD *)0); - Call_Hook(form,forminit); - Call_Hook(form,fieldinit); + Call_Hook(form, fieldterm); + Call_Hook(form, formterm); + err = _nc_Set_Form_Page(form, page, (FIELD *)0); + Call_Hook(form, forminit); + Call_Hook(form, fieldinit); _nc_Refresh_Current_Field(form); } } @@ -94,9 +96,11 @@ set_form_page (FORM * form, int page) | -1 : invalid form pointer +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -form_page (const FORM * form) +form_page(const FORM *form) { - return Normalize_Form(form)->curpage; + T((T_CALLED("form_page(%p)"), form)); + + returnCode(Normalize_Form(form)->curpage); } /* frm_page.c ends here */ diff --git a/form/frm_post.c b/form/frm_post.c index 05342bb2..28937e91 100644 --- a/form/frm_post.c +++ b/form/frm_post.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_post.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: frm_post.c,v 1.9 2004/12/11 22:19:06 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -48,37 +48,39 @@ MODULE_ID("$Id: frm_post.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | E_SYSTEM_ERROR - system error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -post_form (FORM * form) +post_form(FORM *form) { WINDOW *formwin; int err; int page; + T((T_CALLED("post_form(%p)"), form)); + if (!form) RETURN(E_BAD_ARGUMENT); - if (form->status & _POSTED) + if (form->status & _POSTED) RETURN(E_POSTED); if (!(form->field)) RETURN(E_NOT_CONNECTED); - + formwin = Get_Form_Window(form); - if ((form->cols > getmaxx(formwin)) || (form->rows > getmaxy(formwin))) + if ((form->cols > getmaxx(formwin)) || (form->rows > getmaxy(formwin))) RETURN(E_NO_ROOM); /* reset form->curpage to an invald value. This forces Set_Form_Page to do the page initialization which is required by post_form. - */ + */ page = form->curpage; form->curpage = -1; - if ((err = _nc_Set_Form_Page(form,page,form->current))!=E_OK) + if ((err = _nc_Set_Form_Page(form, page, form->current)) != E_OK) RETURN(err); form->status |= _POSTED; - Call_Hook(form,forminit); - Call_Hook(form,fieldinit); + Call_Hook(form, forminit); + Call_Hook(form, fieldinit); _nc_Refresh_Current_Field(form); RETURN(E_OK); @@ -96,19 +98,21 @@ post_form (FORM * form) | E_BAD_STATE - called from a hook routine +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -unpost_form (FORM * form) +unpost_form(FORM *form) { + T((T_CALLED("unpost_form(%p)"), form)); + if (!form) RETURN(E_BAD_ARGUMENT); - if (!(form->status & _POSTED)) + if (!(form->status & _POSTED)) RETURN(E_NOT_POSTED); - if (form->status & _IN_DRIVER) + if (form->status & _IN_DRIVER) RETURN(E_BAD_STATE); - Call_Hook(form,fieldterm); - Call_Hook(form,formterm); + Call_Hook(form, fieldterm); + Call_Hook(form, formterm); werase(Get_Form_Window(form)); delwin(form->w); diff --git a/form/frm_req_name.c b/form/frm_req_name.c index 80d62c19..e4d5c335 100644 --- a/form/frm_req_name.c +++ b/form/frm_req_name.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,71 +37,73 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_req_name.c,v 1.10 2003/10/25 15:17:08 tom Exp $") - -static const char *request_names[ MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1 ] = { - "NEXT_PAGE" , - "PREV_PAGE" , - "FIRST_PAGE" , - "LAST_PAGE" , - - "NEXT_FIELD" , - "PREV_FIELD" , - "FIRST_FIELD" , - "LAST_FIELD" , - "SNEXT_FIELD" , - "SPREV_FIELD" , - "SFIRST_FIELD" , - "SLAST_FIELD" , - "LEFT_FIELD" , - "RIGHT_FIELD" , - "UP_FIELD" , - "DOWN_FIELD" , - - "NEXT_CHAR" , - "PREV_CHAR" , - "NEXT_LINE" , - "PREV_LINE" , - "NEXT_WORD" , - "PREV_WORD" , - "BEG_FIELD" , - "END_FIELD" , - "BEG_LINE" , - "END_LINE" , - "LEFT_CHAR" , - "RIGHT_CHAR" , - "UP_CHAR" , - "DOWN_CHAR" , - - "NEW_LINE" , - "INS_CHAR" , - "INS_LINE" , - "DEL_CHAR" , - "DEL_PREV" , - "DEL_LINE" , - "DEL_WORD" , - "CLR_EOL" , - "CLR_EOF" , - "CLR_FIELD" , - "OVL_MODE" , - "INS_MODE" , - "SCR_FLINE" , - "SCR_BLINE" , - "SCR_FPAGE" , - "SCR_BPAGE" , - "SCR_FHPAGE" , - "SCR_BHPAGE" , - "SCR_FCHAR" , - "SCR_BCHAR" , - "SCR_HFLINE" , - "SCR_HBLINE" , - "SCR_HFHALF" , - "SCR_HBHALF" , - - "VALIDATION" , - "NEXT_CHOICE" , - "PREV_CHOICE" +MODULE_ID("$Id: frm_req_name.c,v 1.15 2005/04/16 16:59:27 tom Exp $") + +static const char *request_names[MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1] = +{ + "NEXT_PAGE", + "PREV_PAGE", + "FIRST_PAGE", + "LAST_PAGE", + + "NEXT_FIELD", + "PREV_FIELD", + "FIRST_FIELD", + "LAST_FIELD", + "SNEXT_FIELD", + "SPREV_FIELD", + "SFIRST_FIELD", + "SLAST_FIELD", + "LEFT_FIELD", + "RIGHT_FIELD", + "UP_FIELD", + "DOWN_FIELD", + + "NEXT_CHAR", + "PREV_CHAR", + "NEXT_LINE", + "PREV_LINE", + "NEXT_WORD", + "PREV_WORD", + "BEG_FIELD", + "END_FIELD", + "BEG_LINE", + "END_LINE", + "LEFT_CHAR", + "RIGHT_CHAR", + "UP_CHAR", + "DOWN_CHAR", + + "NEW_LINE", + "INS_CHAR", + "INS_LINE", + "DEL_CHAR", + "DEL_PREV", + "DEL_LINE", + "DEL_WORD", + "CLR_EOL", + "CLR_EOF", + "CLR_FIELD", + "OVL_MODE", + "INS_MODE", + "SCR_FLINE", + "SCR_BLINE", + "SCR_FPAGE", + "SCR_BPAGE", + "SCR_FHPAGE", + "SCR_BHPAGE", + "SCR_FCHAR", + "SCR_BCHAR", + "SCR_HFLINE", + "SCR_HBLINE", + "SCR_HFHALF", + "SCR_HBHALF", + + "VALIDATION", + "NEXT_CHOICE", + "PREV_CHOICE" }; + #define A_SIZE (sizeof(request_names)/sizeof(request_names[0])) /*--------------------------------------------------------------------------- @@ -114,18 +116,19 @@ static const char *request_names[ MAX_FORM_COMMAND - MIN_FORM_COMMAND + 1 ] = { | NULL - on invalid request code +--------------------------------------------------------------------------*/ NCURSES_EXPORT(const char *) -form_request_name ( int request ) +form_request_name(int request) { - if ( (request < MIN_FORM_COMMAND) || (request > MAX_FORM_COMMAND) ) + T((T_CALLED("form_request_name(%d)"), request)); + + if ((request < MIN_FORM_COMMAND) || (request > MAX_FORM_COMMAND)) { - SET_ERROR (E_BAD_ARGUMENT); - return (const char *)0; + SET_ERROR(E_BAD_ARGUMENT); + returnCPtr((const char *)0); } else - return request_names[ request - MIN_FORM_COMMAND ]; + returnCPtr(request_names[request - MIN_FORM_COMMAND]); } - /*--------------------------------------------------------------------------- | Facility : libnform | Function : int form_request_by_name (const char *str); @@ -136,28 +139,30 @@ form_request_name ( int request ) | E_NO_MATCH - request not found +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -form_request_by_name ( const char *str ) -{ +form_request_by_name(const char *str) +{ /* because the table is so small, it doesn't really hurt to run sequentially through it. - */ + */ unsigned int i = 0; char buf[16]; - + + T((T_CALLED("form_request_by_name(%s)"), _nc_visbuf(str))); + if (str) { - strncpy(buf,str,sizeof(buf)); - while( (ifield) ) + if (!(form->field)) RETURN(E_NOT_CONNECTED); - - if (rows) + + if (rows) *rows = form->rows; - if (cols) + if (cols) *cols = form->cols; - + RETURN(E_OK); } diff --git a/form/frm_sub.c b/form/frm_sub.c index b20c788d..6db0023d 100644 --- a/form/frm_sub.c +++ b/form/frm_sub.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_sub.c,v 1.7 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: frm_sub.c,v 1.9 2004/12/11 22:13:39 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,14 +44,16 @@ MODULE_ID("$Id: frm_sub.c,v 1.7 2003/10/25 15:17:08 tom Exp $") | E_POSTED - form is posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_form_sub (FORM * form, WINDOW * win) +set_form_sub(FORM *form, WINDOW *win) { - if (form && (form->status & _POSTED)) + T((T_CALLED("set_form_sub(%p,%p)"), form, win)); + + if (form && (form->status & _POSTED)) RETURN(E_POSTED); - Normalize_Form( form )->sub = win; + Normalize_Form(form)->sub = win; RETURN(E_OK); -} +} /*--------------------------------------------------------------------------- | Facility : libnform @@ -62,10 +64,14 @@ set_form_sub (FORM * form, WINDOW * win) | Return Values : The pointer to the Subwindow. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(WINDOW *) -form_sub (const FORM * form) +form_sub(const FORM *form) { - const FORM* f = Normalize_Form( form ); - return Get_Form_Window(f); + const FORM *f; + + T((T_CALLED("form_sub(%p)"), form)); + + f = Normalize_Form(form); + returnWin(Get_Form_Window(f)); } /* frm_sub.c ends here */ diff --git a/form/frm_user.c b/form/frm_user.c index f75aa912..4d5e0e46 100644 --- a/form/frm_user.c +++ b/form/frm_user.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_user.c,v 1.11 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: frm_user.c,v 1.14 2004/12/25 22:37:56 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,8 +44,10 @@ MODULE_ID("$Id: frm_user.c,v 1.11 2003/10/25 15:17:08 tom Exp $") | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_form_userptr (FORM * form, void *usrptr) +set_form_userptr(FORM *form, void *usrptr) { + T((T_CALLED("set_form_userptr(%p,%p)"), form, usrptr)); + Normalize_Form(form)->usrptr = usrptr; RETURN(E_OK); } @@ -61,9 +63,10 @@ set_form_userptr (FORM * form, void *usrptr) | NULL is returned +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void *) -form_userptr (const FORM * form) +form_userptr(const FORM *form) { - return Normalize_Form(form)->usrptr; + T((T_CALLED("form_userptr(%p)"), form)); + returnVoidPtr(Normalize_Form(form)->usrptr); } /* frm_user.c ends here */ diff --git a/form/frm_win.c b/form/frm_win.c index 6cdfdd96..2258f0a6 100644 --- a/form/frm_win.c +++ b/form/frm_win.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include "form.priv.h" -MODULE_ID("$Id: frm_win.c,v 1.11 2003/10/25 15:17:08 tom Exp $") +MODULE_ID("$Id: frm_win.c,v 1.13 2004/12/11 22:15:27 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -44,14 +44,16 @@ MODULE_ID("$Id: frm_win.c,v 1.11 2003/10/25 15:17:08 tom Exp $") | E_POSTED - form is posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_form_win (FORM * form, WINDOW * win) +set_form_win(FORM *form, WINDOW *win) { - if (form && (form->status & _POSTED)) + T((T_CALLED("set_form_win(%p,%p)"), form, win)); + + if (form && (form->status & _POSTED)) RETURN(E_POSTED); - Normalize_Form( form )->win = win; + Normalize_Form(form)->win = win; RETURN(E_OK); -} +} /*--------------------------------------------------------------------------- | Facility : libnform @@ -62,11 +64,14 @@ set_form_win (FORM * form, WINDOW * win) | Return Values : The pointer to the Window or stdscr if there is none. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(WINDOW *) -form_win (const FORM * form) +form_win(const FORM *form) { - const FORM* f = Normalize_Form( form ); - return (f->win ? f->win : stdscr); + const FORM *f; + + T((T_CALLED("form_win(%p)"), form)); + + f = Normalize_Form(form); + returnWin(f->win ? f->win : stdscr); } /* frm_win.c ends here */ - diff --git a/form/fty_alnum.c b/form/fty_alnum.c index 7eb5a788..f1409305 100644 --- a/form/fty_alnum.c +++ b/form/fty_alnum.c @@ -1,4 +1,3 @@ - /* * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. * You may freely copy it for use as a template for your own field types. @@ -13,42 +12,48 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_alnum.c,v 1.12 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: fty_alnum.c,v 1.18 2005/08/20 18:26:16 tom Exp $") + +#define thisARG alnumARG -typedef struct { - int width; -} alnumARG; +typedef struct + { + int width; + } +thisARG; /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static void *Make_AlphaNumeric_Type(va_list *ap) -| +| Facility : libnform +| Function : static void *Make_This_Type(va_list *ap) +| | Description : Allocate structure for alphanumeric type argument. | | Return Values : Pointer to argument structure or NULL on error +--------------------------------------------------------------------------*/ -static void *Make_AlphaNumeric_Type(va_list * ap) +static void * +Make_This_Type(va_list *ap) { - alnumARG *argp = (alnumARG *)malloc(sizeof(alnumARG)); + thisARG *argp = (thisARG *) malloc(sizeof(thisARG)); if (argp) - argp->width = va_arg(*ap,int); + argp->width = va_arg(*ap, int); return ((void *)argp); } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static void *Copy_AlphaNumericType(const void *argp) -| -| Description : Copy structure for alphanumeric type argument. +| Facility : libnform +| Function : static void *Copy_ThisType(const void *argp) +| +| Description : Copy structure for alphanumeric type argument. | | Return Values : Pointer to argument structure or NULL on error. +--------------------------------------------------------------------------*/ -static void *Copy_AlphaNumeric_Type(const void *argp) +static void * +Copy_This_Type(const void *argp) { - const alnumARG *ap = (const alnumARG *)argp; - alnumARG *result = (alnumARG *)malloc(sizeof(alnumARG)); + const thisARG *ap = (const thisARG *)argp; + thisARG *result = (thisARG *) malloc(sizeof(thisARG)); if (result) *result = *ap; @@ -57,81 +62,78 @@ static void *Copy_AlphaNumeric_Type(const void *argp) } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static void Free_AlphaNumeric_Type(void *argp) -| +| Facility : libnform +| Function : static void Free_This_Type(void *argp) +| | Description : Free structure for alphanumeric type argument. | | Return Values : - +--------------------------------------------------------------------------*/ -static void Free_AlphaNumeric_Type(void * argp) +static void +Free_This_Type(void *argp) { - if (argp) + if (argp) free(argp); } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static bool Check_AlphaNumeric_Field( -| FIELD *field, +| Facility : libnform +| Function : static bool Check_This_Character( +| int c, | const void *argp) -| -| Description : Validate buffer content to be a valid alphanumeric value | -| Return Values : TRUE - field is valid -| FALSE - field is invalid +| Description : Check a character for the alphanumeric type. +| +| Return Values : TRUE - character is valid +| FALSE - character is invalid +--------------------------------------------------------------------------*/ -static bool Check_AlphaNumeric_Field(FIELD * field, const void * argp) +static bool +Check_This_Character(int c, const void *argp GCC_UNUSED) { - int width = ((const alnumARG *)argp)->width; - unsigned char *bp = (unsigned char *)field_buffer(field,0); - int l = -1; - unsigned char *s; - - while(*bp && *bp==' ') - bp++; - if (*bp) - { - s = bp; - while(*bp && isalnum(*bp)) - bp++; - l = (int)(bp-s); - while(*bp && *bp==' ') - bp++; - } - return ((*bp || (l < width)) ? FALSE : TRUE); +#if USE_WIDEC_SUPPORT + if (iswalnum((wint_t) c)) + return TRUE; +#endif + return (isalnum(UChar(c)) ? TRUE : FALSE); } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static bool Check_AlphaNumeric_Character( -| int c, -| const void *argp ) -| -| Description : Check a character for the alphanumeric type. +| Facility : libnform +| Function : static bool Check_This_Field( +| FIELD *field, +| const void *argp) | -| Return Values : TRUE - character is valid -| FALSE - character is invalid +| Description : Validate buffer content to be a valid alphanumeric value +| +| Return Values : TRUE - field is valid +| FALSE - field is invalid +--------------------------------------------------------------------------*/ -static bool Check_AlphaNumeric_Character(int c, const void * argp GCC_UNUSED) +static bool +Check_This_Field(FIELD *field, const void *argp) { - return (isalnum(c) ? TRUE : FALSE); + int width = ((const thisARG *)argp)->width; + unsigned char *bp = (unsigned char *)field_buffer(field, 0); + bool result = (width < 0); + + Check_CTYPE_Field(result, bp, width, Check_This_Character); + return (result); } -static FIELDTYPE typeALNUM = { +static FIELDTYPE typeTHIS = +{ _HAS_ARGS | _RESIDENT, - 1, /* this is mutable, so we can't be const */ + 1, /* this is mutable, so we can't be const */ (FIELDTYPE *)0, (FIELDTYPE *)0, - Make_AlphaNumeric_Type, - Copy_AlphaNumeric_Type, - Free_AlphaNumeric_Type, - Check_AlphaNumeric_Field, - Check_AlphaNumeric_Character, + Make_This_Type, + Copy_This_Type, + Free_This_Type, + Check_This_Field, + Check_This_Character, NULL, NULL }; -NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM = &typeALNUM; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALNUM = &typeTHIS; /* fty_alnum.c ends here */ diff --git a/form/fty_alpha.c b/form/fty_alpha.c index 5796ab7f..d96fe091 100644 --- a/form/fty_alpha.c +++ b/form/fty_alpha.c @@ -1,4 +1,3 @@ - /* * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. * You may freely copy it for use as a template for your own field types. @@ -13,126 +12,128 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_alpha.c,v 1.12 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: fty_alpha.c,v 1.20 2005/08/20 18:37:48 tom Exp $") + +#define thisARG alphaARG -typedef struct { - int width; -} alphaARG; +typedef struct + { + int width; + } +thisARG; /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static void *Make_Alpha_Type(va_list *ap) -| +| Facility : libnform +| Function : static void *Make_This_Type(va_list *ap) +| | Description : Allocate structure for alpha type argument. | | Return Values : Pointer to argument structure or NULL on error +--------------------------------------------------------------------------*/ -static void *Make_Alpha_Type(va_list * ap) +static void * +Make_This_Type(va_list *ap) { - alphaARG *argp = (alphaARG *)malloc(sizeof(alphaARG)); + thisARG *argp = (thisARG *) malloc(sizeof(thisARG)); + if (argp) - { - argp->width = va_arg(*ap,int); - } + argp->width = va_arg(*ap, int); + return ((void *)argp); } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static void *Copy_Alpha_Type(const void * argp) -| -| Description : Copy structure for alpha type argument. +| Facility : libnform +| Function : static void *Copy_This_Type(const void * argp) +| +| Description : Copy structure for alpha type argument. | | Return Values : Pointer to argument structure or NULL on error. +--------------------------------------------------------------------------*/ -static void *Copy_Alpha_Type(const void * argp) +static void * +Copy_This_Type(const void *argp) { - const alphaARG *ap = (const alphaARG *)argp; - alphaARG *result = (alphaARG *)malloc(sizeof(alphaARG)); - + const thisARG *ap = (const thisARG *)argp; + thisARG *result = (thisARG *) malloc(sizeof(thisARG)); + if (result) - { - *result = *ap; - } + *result = *ap; + return ((void *)result); } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static void Free_Alpha_Type( void * argp ) -| +| Facility : libnform +| Function : static void Free_This_Type(void *argp) +| | Description : Free structure for alpha type argument. | | Return Values : - +--------------------------------------------------------------------------*/ -static void Free_Alpha_Type(void * argp) +static void +Free_This_Type(void *argp) { - if (argp) + if (argp) free(argp); } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static bool Check_Alpha_Field( -| FIELD * field, -| const void * argp) -| -| Description : Validate buffer content to be a valid alpha value +| Facility : libnform +| Function : static bool Check_This_Character( +| int c, +| const void *argp) | -| Return Values : TRUE - field is valid -| FALSE - field is invalid +| Description : Check a character for the alpha type. +| +| Return Values : TRUE - character is valid +| FALSE - character is invalid +--------------------------------------------------------------------------*/ -static bool Check_Alpha_Field(FIELD * field, const void * argp) +static bool +Check_This_Character(int c, const void *argp GCC_UNUSED) { - int width = ((const alphaARG *)argp)->width; - unsigned char *bp = (unsigned char *)field_buffer(field,0); - int l = -1; - unsigned char *s; - - while(*bp && *bp==' ') - bp++; - if (*bp) - { - s = bp; - while(*bp && isalpha(*bp)) - bp++; - l = (int)(bp-s); - while(*bp && *bp==' ') - bp++; - } - return ((*bp || (l < width)) ? FALSE : TRUE); +#if USE_WIDEC_SUPPORT + if (iswalpha((wint_t) c)) + return TRUE; +#endif + return (isalpha(UChar(c)) ? TRUE : FALSE); } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static bool Check_Alpha_Character( -| int c, -| const void * argp) -| -| Description : Check a character for the alpha type. +| Facility : libnform +| Function : static bool Check_This_Field( +| FIELD *field, +| const void *argp) | -| Return Values : TRUE - character is valid -| FALSE - character is invalid +| Description : Validate buffer content to be a valid alpha value +| +| Return Values : TRUE - field is valid +| FALSE - field is invalid +--------------------------------------------------------------------------*/ -static bool Check_Alpha_Character(int c, const void * argp GCC_UNUSED) +static bool +Check_This_Field(FIELD *field, const void *argp) { - return (isalpha(c) ? TRUE : FALSE); + int width = ((const thisARG *)argp)->width; + unsigned char *bp = (unsigned char *)field_buffer(field, 0); + bool result = (width < 0); + + Check_CTYPE_Field(result, bp, width, Check_This_Character); + return (result); } -static FIELDTYPE typeALPHA = { +static FIELDTYPE typeTHIS = +{ _HAS_ARGS | _RESIDENT, - 1, /* this is mutable, so we can't be const */ + 1, /* this is mutable, so we can't be const */ (FIELDTYPE *)0, (FIELDTYPE *)0, - Make_Alpha_Type, - Copy_Alpha_Type, - Free_Alpha_Type, - Check_Alpha_Field, - Check_Alpha_Character, + Make_This_Type, + Copy_This_Type, + Free_This_Type, + Check_This_Field, + Check_This_Character, NULL, NULL }; -NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA = &typeALPHA; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ALPHA = &typeTHIS; /* fty_alpha.c ends here */ diff --git a/form/fty_enum.c b/form/fty_enum.c index 95d96d4a..94ce60ae 100644 --- a/form/fty_enum.c +++ b/form/fty_enum.c @@ -13,14 +13,16 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_enum.c,v 1.18 2003/11/08 20:25:29 tom Exp $") +MODULE_ID("$Id: fty_enum.c,v 1.19 2004/05/29 19:05:20 tom Exp $") -typedef struct { - char **kwds; - int count; - bool checkcase; - bool checkunique; -} enumARG; +typedef struct + { + char **kwds; + int count; + bool checkcase; + bool checkunique; + } +enumARG; /*--------------------------------------------------------------------------- | Facility : libnform @@ -30,7 +32,8 @@ typedef struct { | | Return Values : Pointer to argument structure or NULL on error +--------------------------------------------------------------------------*/ -static void *Make_Enum_Type(va_list * ap) +static void * +Make_Enum_Type(va_list *ap) { enumARG *argp = (enumARG *)malloc(sizeof(enumARG)); @@ -40,14 +43,16 @@ static void *Make_Enum_Type(va_list * ap) char **kp = (char **)0; int ccase, cunique; - argp->kwds = va_arg(*ap,char **); - ccase = va_arg(*ap,int); - cunique = va_arg(*ap,int); - argp->checkcase = ccase ? TRUE : FALSE; + argp->kwds = va_arg(*ap, char **); + ccase = va_arg(*ap, int); + cunique = va_arg(*ap, int); + + argp->checkcase = ccase ? TRUE : FALSE; argp->checkunique = cunique ? TRUE : FALSE; kp = argp->kwds; - while( kp && (*kp++) ) cnt++; + while (kp && (*kp++)) + cnt++; argp->count = cnt; } return (void *)argp; @@ -61,7 +66,8 @@ static void *Make_Enum_Type(va_list * ap) | | Return Values : Pointer to argument structure or NULL on error. +--------------------------------------------------------------------------*/ -static void *Copy_Enum_Type(const void * argp) +static void * +Copy_Enum_Type(const void *argp) { enumARG *result = (enumARG *)0; @@ -70,6 +76,7 @@ static void *Copy_Enum_Type(const void * argp) const enumARG *ap = (const enumARG *)argp; result = (enumARG *)malloc(sizeof(enumARG)); + if (result) *result = *ap; } @@ -84,9 +91,10 @@ static void *Copy_Enum_Type(const void * argp) | | Return Values : - +--------------------------------------------------------------------------*/ -static void Free_Enum_Type(void * argp) +static void +Free_Enum_Type(void *argp) { - if (argp) + if (argp) free(argp); } @@ -108,30 +116,33 @@ static void Free_Enum_Type(void * argp) | PARTIAL - buffer matches partially | EXACT - buffer matches exactly +--------------------------------------------------------------------------*/ -static int Compare(const unsigned char *s, const unsigned char *buf, - bool ccase) +static int +Compare(const unsigned char *s, const unsigned char *buf, + bool ccase) { - SKIP_SPACE(buf); /* Skip leading spaces in both texts */ + SKIP_SPACE(buf); /* Skip leading spaces in both texts */ SKIP_SPACE(s); - if (*buf=='\0') + if (*buf == '\0') { - return (((*s)!='\0') ? NOMATCH : EXACT); - } - else + return (((*s) != '\0') ? NOMATCH : EXACT); + } + else { if (ccase) { - while(*s++ == *buf) + while (*s++ == *buf) { - if (*buf++=='\0') return EXACT; - } - } - else + if (*buf++ == '\0') + return EXACT; + } + } + else { - while(toupper(*s++)==toupper(*buf)) + while (toupper(*s++) == toupper(*buf)) { - if (*buf++=='\0') return EXACT; + if (*buf++ == '\0') + return EXACT; } } } @@ -139,12 +150,12 @@ static int Compare(const unsigned char *s, const unsigned char *buf, matches with s. So if only blanks are following, we have a partial match otherwise there is no match */ SKIP_SPACE(buf); - if (*buf) + if (*buf) return NOMATCH; /* If it happens that the reference buffer is at its end, the partial match is actually an exact match. */ - return ((s[-1]!='\0') ? PARTIAL : EXACT); + return ((s[-1] != '\0') ? PARTIAL : EXACT); } /*--------------------------------------------------------------------------- @@ -158,27 +169,28 @@ static int Compare(const unsigned char *s, const unsigned char *buf, | Return Values : TRUE - field is valid | FALSE - field is invalid +--------------------------------------------------------------------------*/ -static bool Check_Enum_Field(FIELD * field, const void * argp) +static bool +Check_Enum_Field(FIELD *field, const void *argp) { - char **kwds = ((const enumARG *)argp)->kwds; - bool ccase = ((const enumARG *)argp)->checkcase; - bool unique = ((const enumARG *)argp)->checkunique; - unsigned char *bp = (unsigned char *)field_buffer(field,0); + char **kwds = ((const enumARG *)argp)->kwds; + bool ccase = ((const enumARG *)argp)->checkcase; + bool unique = ((const enumARG *)argp)->checkunique; + unsigned char *bp = (unsigned char *)field_buffer(field, 0); char *s, *t, *p; int res; - - while( kwds && (s=(*kwds++)) ) + + while (kwds && (s = (*kwds++))) { - if ((res=Compare((unsigned char *)s,bp,ccase))!=NOMATCH) + if ((res = Compare((unsigned char *)s, bp, ccase)) != NOMATCH) { - p=t=s; /* t is at least a partial match */ - if ((unique && res!=EXACT)) + p = t = s; /* t is at least a partial match */ + if ((unique && res != EXACT)) { - while( kwds && (p = *kwds++) ) + while (kwds && (p = *kwds++)) { - if ((res=Compare((unsigned char *)p,bp,ccase))!=NOMATCH) + if ((res = Compare((unsigned char *)p, bp, ccase)) != NOMATCH) { - if (res==EXACT) + if (res == EXACT) { t = p; break; @@ -187,10 +199,10 @@ static bool Check_Enum_Field(FIELD * field, const void * argp) t = (char *)0; } } - } + } if (t) { - set_field_buffer(field,0,t); + set_field_buffer(field, 0, t); return TRUE; } if (!p) @@ -200,7 +212,8 @@ static bool Check_Enum_Field(FIELD * field, const void * argp) return FALSE; } -static const char *dummy[] = { (char *)0 }; +static const char *dummy[] = +{(char *)0}; /*--------------------------------------------------------------------------- | Facility : libnform @@ -212,28 +225,30 @@ static const char *dummy[] = { (char *)0 }; | Return Values : TRUE - next value found and loaded | FALSE - no next value loaded +--------------------------------------------------------------------------*/ -static bool Next_Enum(FIELD * field, const void * argp) +static bool +Next_Enum(FIELD *field, const void *argp) { const enumARG *args = (const enumARG *)argp; - char **kwds = args->kwds; - bool ccase = args->checkcase; - int cnt = args->count; - unsigned char *bp = (unsigned char *)field_buffer(field,0); + char **kwds = args->kwds; + bool ccase = args->checkcase; + int cnt = args->count; + unsigned char *bp = (unsigned char *)field_buffer(field, 0); - if (kwds) { - while(cnt--) - { - if (Compare((unsigned char *)(*kwds++),bp,ccase)==EXACT) - break; - } - if (cnt<=0) - kwds = args->kwds; - if ((cnt>=0) || (Compare((const unsigned char *)dummy,bp,ccase)==EXACT)) - { - set_field_buffer(field,0,*kwds); - return TRUE; - } - } + if (kwds) + { + while (cnt--) + { + if (Compare((unsigned char *)(*kwds++), bp, ccase) == EXACT) + break; + } + if (cnt <= 0) + kwds = args->kwds; + if ((cnt >= 0) || (Compare((const unsigned char *)dummy, bp, ccase) == EXACT)) + { + set_field_buffer(field, 0, *kwds); + return TRUE; + } + } return FALSE; } @@ -248,37 +263,39 @@ static bool Next_Enum(FIELD * field, const void * argp) | Return Values : TRUE - previous value found and loaded | FALSE - no previous value loaded +--------------------------------------------------------------------------*/ -static bool Previous_Enum(FIELD * field, const void * argp) +static bool +Previous_Enum(FIELD *field, const void *argp) { const enumARG *args = (const enumARG *)argp; - int cnt = args->count; - char **kwds = &args->kwds[cnt-1]; - bool ccase = args->checkcase; - unsigned char *bp = (unsigned char *)field_buffer(field,0); + int cnt = args->count; + char **kwds = &args->kwds[cnt - 1]; + bool ccase = args->checkcase; + unsigned char *bp = (unsigned char *)field_buffer(field, 0); - if (kwds) { - while(cnt--) - { - if (Compare((unsigned char *)(*kwds--),bp,ccase)==EXACT) - break; - } - - if (cnt<=0) - kwds = &args->kwds[args->count-1]; - - if ((cnt>=0) || (Compare((const unsigned char *)dummy,bp,ccase)==EXACT)) - { - set_field_buffer(field,0,*kwds); - return TRUE; - } - } + if (kwds) + { + while (cnt--) + { + if (Compare((unsigned char *)(*kwds--), bp, ccase) == EXACT) + break; + } + + if (cnt <= 0) + kwds = &args->kwds[args->count - 1]; + + if ((cnt >= 0) || (Compare((const unsigned char *)dummy, bp, ccase) == EXACT)) + { + set_field_buffer(field, 0, *kwds); + return TRUE; + } + } return FALSE; } - -static FIELDTYPE typeENUM = { +static FIELDTYPE typeENUM = +{ _HAS_ARGS | _HAS_CHOICE | _RESIDENT, - 1, /* this is mutable, so we can't be const */ + 1, /* this is mutable, so we can't be const */ (FIELDTYPE *)0, (FIELDTYPE *)0, Make_Enum_Type, @@ -290,6 +307,7 @@ static FIELDTYPE typeENUM = { Previous_Enum }; -NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_ENUM = &typeENUM; +NCURSES_EXPORT_VAR(FIELDTYPE *) +TYPE_ENUM = &typeENUM; /* fty_enum.c ends here */ diff --git a/form/fty_int.c b/form/fty_int.c index 5f5c5ab0..2f18b901 100644 --- a/form/fty_int.c +++ b/form/fty_int.c @@ -1,4 +1,3 @@ - /* * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. * You may freely copy it for use as a template for your own field types. @@ -13,51 +12,63 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_int.c,v 1.13 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: fty_int.c,v 1.19 2005/08/20 18:26:16 tom Exp $") + +#if USE_WIDEC_SUPPORT +#define isDigit(c) (iswdigit((wint_t)(c)) || isdigit(UChar(c))) +#else +#define isDigit(c) isdigit(UChar(c)) +#endif -typedef struct { - int precision; - long low; - long high; -} integerARG; +#define thisARG integerARG + +typedef struct + { + int precision; + long low; + long high; + } +thisARG; /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static void *Make_Integer_Type( va_list * ap ) +| Function : static void *Make_This_Type( va_list * ap ) | | Description : Allocate structure for integer type argument. | | Return Values : Pointer to argument structure or NULL on error +--------------------------------------------------------------------------*/ -static void *Make_Integer_Type(va_list * ap) +static void * +Make_This_Type(va_list *ap) { - integerARG *argp = (integerARG *)malloc(sizeof(integerARG)); + thisARG *argp = (thisARG *) malloc(sizeof(thisARG)); if (argp) { - argp->precision = va_arg(*ap,int); - argp->low = va_arg(*ap,long); - argp->high = va_arg(*ap,long); + argp->precision = va_arg(*ap, int); + argp->low = va_arg(*ap, long); + argp->high = va_arg(*ap, long); } return (void *)argp; } /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static void *Copy_Integer_Type(const void * argp) +| Function : static void *Copy_This_Type(const void * argp) | | Description : Copy structure for integer type argument. | | Return Values : Pointer to argument structure or NULL on error. +--------------------------------------------------------------------------*/ -static void *Copy_Integer_Type(const void * argp) +static void * +Copy_This_Type(const void *argp) { - const integerARG *ap = (const integerARG *)argp; - integerARG *result = (integerARG *)0; + const thisARG *ap = (const thisARG *)argp; + thisARG *result = (thisARG *) 0; if (argp) { - result = (integerARG *)malloc(sizeof(integerARG)); + result = (thisARG *) malloc(sizeof(thisARG)); if (result) *result = *ap; } @@ -66,68 +77,115 @@ static void *Copy_Integer_Type(const void * argp) /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static void Free_Integer_Type(void * argp) +| Function : static void Free_This_Type(void * argp) | | Description : Free structure for integer type argument. | | Return Values : - +--------------------------------------------------------------------------*/ -static void Free_Integer_Type(void * argp) +static void +Free_This_Type(void *argp) { - if (argp) + if (argp) free(argp); } /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static bool Check_Integer_Field( -| FIELD * field, -| const void * argp) +| Function : static bool Check_This_Field( +| FIELD * field, +| const void * argp) | | Description : Validate buffer content to be a valid integer value | | Return Values : TRUE - field is valid | FALSE - field is invalid +--------------------------------------------------------------------------*/ -static bool Check_Integer_Field(FIELD * field, const void * argp) +static bool +Check_This_Field(FIELD *field, const void *argp) { - const integerARG *argi = (const integerARG *)argp; - long low = argi->low; - long high = argi->high; - int prec = argi->precision; - unsigned char *bp = (unsigned char *)field_buffer(field,0); - char *s = (char *)bp; + const thisARG *argi = (const thisARG *)argp; + long low = argi->low; + long high = argi->high; + int prec = argi->precision; + unsigned char *bp = (unsigned char *)field_buffer(field, 0); + char *s = (char *)bp; long val; char buf[100]; + bool result = FALSE; - while( *bp && *bp==' ') bp++; + while (*bp && *bp == ' ') + bp++; if (*bp) { - if (*bp=='-') bp++; + if (*bp == '-') + bp++; +#if USE_WIDEC_SUPPORT + if (*bp) + { + bool blank = FALSE; + int len; + int n; + wchar_t *list = _nc_Widen_String((char *)bp, &len); + + if (list != 0) + { + result = TRUE; + for (n = 0; n < len; ++n) + { + if (blank) + { + if (list[n] != ' ') + { + result = FALSE; + break; + } + } + else if (list[n] == ' ') + { + blank = TRUE; + } + else if (!isDigit(list[n])) + { + result = FALSE; + break; + } + } + free(list); + } + } +#else while (*bp) { - if (!isdigit(*bp)) break; + if (!isdigit(UChar(*bp))) + break; bp++; } - while(*bp && *bp==' ') bp++; - if (*bp=='\0') + while (*bp && *bp == ' ') + bp++; + result = (*bp == '\0'); +#endif + if (result) { val = atol(s); - if (lowhigh) return FALSE; + if (val < low || val > high) + result = FALSE; + } + if (result) + { + sprintf(buf, "%.*ld", (prec > 0 ? prec : 0), val); + set_field_buffer(field, 0, buf); } - sprintf(buf,"%.*ld",(prec>0?prec:0),val); - set_field_buffer(field,0,buf); - return TRUE; } } - return FALSE; + return (result); } /*--------------------------------------------------------------------------- | Facility : libnform -| Function : static bool Check_Integer_Character( +| Function : static bool Check_This_Character( | int c, | const void * argp) | @@ -136,25 +194,27 @@ static bool Check_Integer_Field(FIELD * field, const void * argp) | Return Values : TRUE - character is valid | FALSE - character is invalid +--------------------------------------------------------------------------*/ -static bool Check_Integer_Character(int c, const void * argp GCC_UNUSED) +static bool +Check_This_Character(int c, const void *argp GCC_UNUSED) { - return ((isdigit(c) || (c=='-')) ? TRUE : FALSE); + return ((isDigit(UChar(c)) || (c == '-')) ? TRUE : FALSE); } -static FIELDTYPE typeINTEGER = { +static FIELDTYPE typeTHIS = +{ _HAS_ARGS | _RESIDENT, - 1, /* this is mutable, so we can't be const */ + 1, /* this is mutable, so we can't be const */ (FIELDTYPE *)0, (FIELDTYPE *)0, - Make_Integer_Type, - Copy_Integer_Type, - Free_Integer_Type, - Check_Integer_Field, - Check_Integer_Character, + Make_This_Type, + Copy_This_Type, + Free_This_Type, + Check_This_Field, + Check_This_Character, NULL, NULL }; -NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER = &typeINTEGER; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_INTEGER = &typeTHIS; /* fty_int.c ends here */ diff --git a/form/fty_ipv4.c b/form/fty_ipv4.c index f49dcdb1..b90f7466 100644 --- a/form/fty_ipv4.c +++ b/form/fty_ipv4.c @@ -13,7 +13,7 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_ipv4.c,v 1.4 2000/12/09 23:46:12 tom Exp $") +MODULE_ID("$Id: fty_ipv4.c,v 1.6 2004/05/29 19:13:48 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnform @@ -26,24 +26,25 @@ MODULE_ID("$Id: fty_ipv4.c,v 1.4 2000/12/09 23:46:12 tom Exp $") | Return Values : TRUE - field is valid | FALSE - field is invalid +--------------------------------------------------------------------------*/ -static bool Check_IPV4_Field(FIELD * field, const void * argp GCC_UNUSED) +static bool +Check_IPV4_Field(FIELD *field, const void *argp GCC_UNUSED) { - char *bp = field_buffer(field,0); + char *bp = field_buffer(field, 0); int num = 0, len; unsigned int d1, d2, d3, d4; - if(isdigit((unsigned char)*bp)) /* Must start with digit */ + if (isdigit(UChar(*bp))) /* Must start with digit */ { num = sscanf(bp, "%u.%u.%u.%u%n", &d1, &d2, &d3, &d4, &len); if (num == 4) - { - bp += len; /* Make bp point to what sscanf() left */ - while (*bp && isspace((unsigned char)*bp)) - bp++; /* Allow trailing whitespace */ - } + { + bp += len; /* Make bp point to what sscanf() left */ + while (*bp && isspace(UChar(*bp))) + bp++; /* Allow trailing whitespace */ + } } return ((num != 4 || *bp || d1 > 255 || d2 > 255 - || d3 > 255 || d4 > 255) ? FALSE : TRUE); + || d3 > 255 || d4 > 255) ? FALSE : TRUE); } /*--------------------------------------------------------------------------- @@ -57,14 +58,16 @@ static bool Check_IPV4_Field(FIELD * field, const void * argp GCC_UNUSED) | Return Values : TRUE - character is valid | FALSE - character is invalid +--------------------------------------------------------------------------*/ -static bool Check_IPV4_Character(int c, const void * argp GCC_UNUSED) +static bool +Check_IPV4_Character(int c, const void *argp GCC_UNUSED) { - return ((isdigit(c) || (c=='.')) ? TRUE : FALSE); + return ((isdigit(UChar(c)) || (c == '.')) ? TRUE : FALSE); } -static FIELDTYPE typeIPV4 = { +static FIELDTYPE typeIPV4 = +{ _RESIDENT, - 1, /* this is mutable, so we can't be const */ + 1, /* this is mutable, so we can't be const */ (FIELDTYPE *)0, (FIELDTYPE *)0, NULL, diff --git a/form/fty_num.c b/form/fty_num.c index 6bc95c95..f7dc90a5 100644 --- a/form/fty_num.c +++ b/form/fty_num.c @@ -1,4 +1,3 @@ - /* * THIS CODE IS SPECIFICALLY EXEMPTED FROM THE NCURSES PACKAGE COPYRIGHT. * You may freely copy it for use as a template for your own field types. @@ -13,183 +12,253 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_num.c,v 1.16 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: fty_num.c,v 1.22 2005/08/20 18:26:16 tom Exp $") #if HAVE_LOCALE_H #include #endif -typedef struct { - int precision; - double low; - double high; - struct lconv* L; -} numericARG; +#if HAVE_LOCALE_H +#define isDecimalPoint(c) ((c) == ((L && L->decimal_point) ? *(L->decimal_point) : '.')) +#else +#define isDecimalPoint(c) ((c) == '.') +#endif + +#if USE_WIDEC_SUPPORT +#define isDigit(c) (iswdigit((wint_t)(c)) || isdigit(UChar(c))) +#else +#define isDigit(c) isdigit(UChar(c)) +#endif + +#define thisARG numericARG + +typedef struct + { + int precision; + double low; + double high; + struct lconv *L; + } +thisARG; /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static void *Make_Numeric_Type(va_list * ap) -| +| Facility : libnform +| Function : static void *Make_This_Type(va_list * ap) +| | Description : Allocate structure for numeric type argument. | | Return Values : Pointer to argument structure or NULL on error +--------------------------------------------------------------------------*/ -static void *Make_Numeric_Type(va_list * ap) +static void * +Make_This_Type(va_list *ap) { - numericARG *argn = (numericARG *)malloc(sizeof(numericARG)); + thisARG *argn = (thisARG *) malloc(sizeof(thisARG)); if (argn) { - argn->precision = va_arg(*ap,int); - argn->low = va_arg(*ap,double); - argn->high = va_arg(*ap,double); + argn->precision = va_arg(*ap, int); + argn->low = va_arg(*ap, double); + argn->high = va_arg(*ap, double); + #if HAVE_LOCALE_H - argn->L = localeconv(); + argn->L = localeconv(); #else - argn->L = NULL; + argn->L = NULL; #endif } return (void *)argn; } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static void *Copy_Numeric_Type(const void * argp) -| -| Description : Copy structure for numeric type argument. +| Facility : libnform +| Function : static void *Copy_This_Type(const void * argp) +| +| Description : Copy structure for numeric type argument. | | Return Values : Pointer to argument structure or NULL on error. +--------------------------------------------------------------------------*/ -static void *Copy_Numeric_Type(const void * argp) +static void * +Copy_This_Type(const void *argp) { - const numericARG *ap = (const numericARG *)argp; - numericARG *result = (numericARG *)0; + const thisARG *ap = (const thisARG *)argp; + thisARG *result = (thisARG *) 0; if (argp) { - result = (numericARG *)malloc(sizeof(numericARG)); + result = (thisARG *) malloc(sizeof(thisARG)); if (result) - *result = *ap; + *result = *ap; } return (void *)result; } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static void Free_Numeric_Type(void * argp) -| +| Facility : libnform +| Function : static void Free_This_Type(void * argp) +| | Description : Free structure for numeric type argument. | | Return Values : - +--------------------------------------------------------------------------*/ -static void Free_Numeric_Type(void * argp) +static void +Free_This_Type(void *argp) { - if (argp) + if (argp) free(argp); } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static bool Check_Numeric_Field(FIELD * field, -| const void * argp) -| +| Facility : libnform +| Function : static bool Check_This_Field(FIELD * field, +| const void * argp) +| | Description : Validate buffer content to be a valid numeric value | | Return Values : TRUE - field is valid | FALSE - field is invalid +--------------------------------------------------------------------------*/ -static bool Check_Numeric_Field(FIELD * field, const void * argp) +static bool +Check_This_Field(FIELD *field, const void *argp) { - const numericARG *argn = (const numericARG *)argp; - double low = argn->low; - double high = argn->high; - int prec = argn->precision; - unsigned char *bp = (unsigned char *)field_buffer(field,0); - char *s = (char *)bp; - double val = 0.0; - struct lconv* L = argn->L; + const thisARG *argn = (const thisARG *)argp; + double low = argn->low; + double high = argn->high; + int prec = argn->precision; + unsigned char *bp = (unsigned char *)field_buffer(field, 0); + char *s = (char *)bp; + double val = 0.0; + struct lconv *L = argn->L; char buf[64]; + bool result = FALSE; - while(*bp && *bp==' ') bp++; + while (*bp && *bp == ' ') + bp++; if (*bp) { - if (*bp=='-' || *bp=='+') + if (*bp == '-' || *bp == '+') bp++; - while(*bp) +#if USE_WIDEC_SUPPORT + if (*bp) + { + bool blank = FALSE; + int state = 0; + int len; + int n; + wchar_t *list = _nc_Widen_String((char *)bp, &len); + + if (list != 0) + { + result = TRUE; + for (n = 0; n < len; ++n) + { + if (blank) + { + if (list[n] != ' ') + { + result = FALSE; + break; + } + } + else if (list[n] == ' ') + { + blank = TRUE; + } + else if (isDecimalPoint(list[n])) + { + if (++state > 1) + { + result = FALSE; + break; + } + } + else if (!isDigit(list[n])) + { + result = FALSE; + break; + } + } + free(list); + } + } +#else + while (*bp) { - if (!isdigit(*bp)) break; + if (!isdigit(UChar(*bp))) + break; bp++; } - if (*bp==( -#if HAVE_LOCALE_H - (L && L->decimal_point) ? *(L->decimal_point) : -#endif - '.')) + if (isDecimalPoint(*bp)) { bp++; - while(*bp) + while (*bp) { - if (!isdigit(*bp)) break; + if (!isdigit(UChar(*bp))) + break; bp++; } } - while(*bp && *bp==' ') bp++; - if (*bp=='\0') + while (*bp && *bp == ' ') + bp++; + result = (*bp == '\0'); +#endif + if (result) { val = atof(s); - if (low high) + result = FALSE; + } + if (result) { - if (valhigh) return FALSE; + sprintf(buf, "%.*f", (prec > 0 ? prec : 0), val); + set_field_buffer(field, 0, buf); } - sprintf(buf,"%.*f",(prec>0?prec:0),val); - set_field_buffer(field,0,buf); - return TRUE; } } - return FALSE; + return (result); } /*--------------------------------------------------------------------------- -| Facility : libnform -| Function : static bool Check_Numeric_Character( +| Facility : libnform +| Function : static bool Check_This_Character( | int c, | const void * argp) -| +| | Description : Check a character for the numeric type. | | Return Values : TRUE - character is valid | FALSE - character is invalid +--------------------------------------------------------------------------*/ -static bool Check_Numeric_Character(int c, const void * argp) +static bool +Check_This_Character(int c, const void *argp) { - const numericARG *argn = (const numericARG *)argp; - struct lconv* L = argn->L; + const thisARG *argn = (const thisARG *)argp; + struct lconv *L = argn->L; - return (isdigit(c) || - c == '+' || - c == '-' || - c == ( -#if HAVE_LOCALE_H - (L && L->decimal_point) ? *(L->decimal_point) : -#endif - '.') - ) ? TRUE : FALSE; + return ((isDigit(c) || + c == '+' || + c == '-' || + isDecimalPoint(c)) + ? TRUE + : FALSE); } -static FIELDTYPE typeNUMERIC = { +static FIELDTYPE typeTHIS = +{ _HAS_ARGS | _RESIDENT, - 1, /* this is mutable, so we can't be const */ + 1, /* this is mutable, so we can't be const */ (FIELDTYPE *)0, (FIELDTYPE *)0, - Make_Numeric_Type, - Copy_Numeric_Type, - Free_Numeric_Type, - Check_Numeric_Field, - Check_Numeric_Character, + Make_This_Type, + Copy_This_Type, + Free_This_Type, + Check_This_Field, + Check_This_Character, NULL, NULL }; -NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC = &typeNUMERIC; +NCURSES_EXPORT_VAR(FIELDTYPE*) TYPE_NUMERIC = &typeTHIS; /* fty_num.c ends here */ diff --git a/form/fty_regex.c b/form/fty_regex.c index c36d1743..4362f25a 100644 --- a/form/fty_regex.c +++ b/form/fty_regex.c @@ -13,31 +13,34 @@ #include "form.priv.h" -MODULE_ID("$Id: fty_regex.c,v 1.17 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: fty_regex.c,v 1.18 2004/05/29 19:19:09 tom Exp $") -#if HAVE_REGEX_H_FUNCS /* We prefer POSIX regex */ +#if HAVE_REGEX_H_FUNCS /* We prefer POSIX regex */ #include typedef struct -{ - regex_t *pRegExp; - unsigned long *refCount; -} RegExp_Arg; + { + regex_t *pRegExp; + unsigned long *refCount; + } +RegExp_Arg; #elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS #undef RETURN static int reg_errno; -static char *RegEx_Init(char *instring) +static char * +RegEx_Init(char *instring) { - reg_errno = 0; - return instring; + reg_errno = 0; + return instring; } -static char *RegEx_Error(int code) +static char * +RegEx_Error(int code) { - reg_errno = code; - return 0; + reg_errno = code; + return 0; } #define INIT register char *sp = RegEx_Init(instring); @@ -57,7 +60,8 @@ typedef struct { char *compiled_expression; unsigned long *refCount; -} RegExp_Arg; +} +RegExp_Arg; /* Maximum Length we allow for a compiled regular expression */ #define MAX_RX_LEN (2048) @@ -73,20 +77,23 @@ typedef struct | | Return Values : Pointer to argument structure or NULL on error +--------------------------------------------------------------------------*/ -static void *Make_RegularExpression_Type(va_list * ap) +static void * +Make_RegularExpression_Type(va_list *ap) { #if HAVE_REGEX_H_FUNCS - char *rx = va_arg(*ap,char *); + char *rx = va_arg(*ap, char *); RegExp_Arg *preg; - preg = (RegExp_Arg*)malloc(sizeof(RegExp_Arg)); + preg = (RegExp_Arg *)malloc(sizeof(RegExp_Arg)); + if (preg) { - if (((preg->pRegExp = (regex_t*)malloc(sizeof(regex_t))) != (regex_t*)0) - && !regcomp(preg->pRegExp,rx, - (REG_EXTENDED | REG_NOSUB | REG_NEWLINE) )) + if (((preg->pRegExp = (regex_t *) malloc(sizeof(regex_t))) != 0) + && !regcomp(preg->pRegExp, rx, + (REG_EXTENDED | REG_NOSUB | REG_NEWLINE))) { preg->refCount = (unsigned long *)malloc(sizeof(unsigned long)); + *(preg->refCount) = 1; } else @@ -94,12 +101,12 @@ static void *Make_RegularExpression_Type(va_list * ap) if (preg->pRegExp) free(preg->pRegExp); free(preg); - preg = (RegExp_Arg*)0; + preg = (RegExp_Arg *)0; } } - return((void *)preg); + return ((void *)preg); #elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS - char *rx = va_arg(*ap,char *); + char *rx = va_arg(*ap, char *); RegExp_Arg *pArg; pArg = (RegExp_Arg *)malloc(sizeof(RegExp_Arg)); @@ -107,38 +114,44 @@ static void *Make_RegularExpression_Type(va_list * ap) if (pArg) { int blen = RX_INCREMENT; + pArg->compiled_expression = NULL; pArg->refCount = (unsigned long *)malloc(sizeof(unsigned long)); + *(pArg->refCount) = 1; - do { - char *buf = (char *)malloc(blen); - if (buf) - { + do + { + char *buf = (char *)malloc(blen); + + if (buf) + { #if HAVE_REGEXP_H_FUNCS - char *last_pos = compile (rx, buf, &buf[blen], '\0'); + char *last_pos = compile(rx, buf, &buf[blen], '\0'); + #else /* HAVE_REGEXPR_H_FUNCS */ - char *last_pos = compile (rx, buf, &buf[blen]); + char *last_pos = compile(rx, buf, &buf[blen]); #endif - if (reg_errno) - { - free(buf); - if (reg_errno==50) - blen += RX_INCREMENT; - else - { - free(pArg); - pArg = NULL; - break; - } - } - else - { - pArg->compiled_expression = buf; - break; - } - } - } while( blen <= MAX_RX_LEN ); + if (reg_errno) + { + free(buf); + if (reg_errno == 50) + blen += RX_INCREMENT; + else + { + free(pArg); + pArg = NULL; + break; + } + } + else + { + pArg->compiled_expression = buf; + break; + } + } + } + while (blen <= MAX_RX_LEN); } if (pArg && !pArg->compiled_expression) { @@ -160,7 +173,8 @@ static void *Make_RegularExpression_Type(va_list * ap) | | Return Values : Pointer to argument structure or NULL on error. +--------------------------------------------------------------------------*/ -static void *Copy_RegularExpression_Type(const void * argp) +static void * +Copy_RegularExpression_Type(const void *argp) { #if (HAVE_REGEX_H_FUNCS | HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS) const RegExp_Arg *ap = (const RegExp_Arg *)argp; @@ -185,10 +199,12 @@ static void *Copy_RegularExpression_Type(const void * argp) | | Return Values : - +--------------------------------------------------------------------------*/ -static void Free_RegularExpression_Type(void * argp) +static void +Free_RegularExpression_Type(void *argp) { #if HAVE_REGEX_H_FUNCS | HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS RegExp_Arg *ap = (RegExp_Arg *)argp; + if (ap) { if (--(*(ap->refCount)) == 0) @@ -223,24 +239,33 @@ static void Free_RegularExpression_Type(void * argp) | Return Values : TRUE - field is valid | FALSE - field is invalid +--------------------------------------------------------------------------*/ -static bool Check_RegularExpression_Field(FIELD * field, const void * argp) +static bool +Check_RegularExpression_Field(FIELD *field, const void *argp) { bool match = FALSE; + #if HAVE_REGEX_H_FUNCS - const RegExp_Arg *ap = (const RegExp_Arg*)argp; + const RegExp_Arg *ap = (const RegExp_Arg *)argp; + if (ap && ap->pRegExp) - match = (regexec(ap->pRegExp,field_buffer(field,0),0,NULL,0) ? FALSE:TRUE); + match = (regexec(ap->pRegExp, field_buffer(field, 0), 0, NULL, 0) + ? FALSE + : TRUE); #elif HAVE_REGEXP_H_FUNCS | HAVE_REGEXPR_H_FUNCS RegExp_Arg *ap = (RegExp_Arg *)argp; + if (ap && ap->compiled_expression) - match = (step(field_buffer(field,0),ap->compiled_expression) ? TRUE:FALSE); + match = (step(field_buffer(field, 0), ap->compiled_expression) + ? TRUE + : FALSE); #endif return match; } -static FIELDTYPE typeREGEXP = { +static FIELDTYPE typeREGEXP = +{ _HAS_ARGS | _RESIDENT, - 1, /* this is mutable, so we can't be const */ + 1, /* this is mutable, so we can't be const */ (FIELDTYPE *)0, (FIELDTYPE *)0, Make_RegularExpression_Type, diff --git a/form/llib-lform b/form/llib-lform index d66a9620..bd7c3a4f 100644 --- a/form/llib-lform +++ b/form/llib-lform @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,14 +27,41 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1996,1997,2002 * + * Author: Thomas E. Dickey 1996,1997,2002,2005 * ****************************************************************************/ /* LINTLIBRARY */ -/* ./fld_arg.c */ +/* ./f_trace.c */ #include "form.priv.h" +#undef _nc_retrace_field_ptr +FIELD **_nc_retrace_field_ptr( + FIELD **code) + { return(*(FIELD ***)0); } + +#undef _nc_retrace_field +FIELD *_nc_retrace_field( + FIELD *code) + { return(*(FIELD **)0); } + +#undef _nc_retrace_field_type +FIELDTYPE *_nc_retrace_field_type( + FIELDTYPE *code) + { return(*(FIELDTYPE **)0); } + +#undef _nc_retrace_form +FORM *_nc_retrace_form( + FORM *code) + { return(*(FORM **)0); } + +#undef _nc_retrace_form_hook +Form_Hook _nc_retrace_form_hook( + Form_Hook code) + { return(*(Form_Hook *)0); } + +/* ./fld_arg.c */ + #undef set_fieldtype_arg int set_fieldtype_arg( FIELDTYPE *typ, @@ -441,10 +468,12 @@ int _nc_Set_Form_Page( FIELD *field) { return(*(int *)0); } -typedef struct { - int keycode; - int (*cmd)(FORM *); -} Binding_Info; +typedef struct +{ + int keycode; + int (*cmd) (FORM *); +} +Binding_Info; #undef form_driver int form_driver( @@ -623,41 +652,49 @@ WINDOW *form_win( /* ./fty_alnum.c */ -typedef struct { - int width; -} alnumARG; +typedef struct + { + int width; + } +alnumARG; #undef TYPE_ALNUM FIELDTYPE *TYPE_ALNUM; /* ./fty_alpha.c */ -typedef struct { - int width; -} alphaARG; +typedef struct + { + int width; + } +alphaARG; #undef TYPE_ALPHA FIELDTYPE *TYPE_ALPHA; /* ./fty_enum.c */ -typedef struct { - char **kwds; - int count; - NCURSES_BOOL checkcase; - NCURSES_BOOL checkunique; -} enumARG; +typedef struct + { + char **kwds; + int count; + NCURSES_BOOL checkcase; + NCURSES_BOOL checkunique; + } +enumARG; #undef TYPE_ENUM FIELDTYPE *TYPE_ENUM; /* ./fty_int.c */ -typedef struct { - int precision; - long low; - long high; -} integerARG; +typedef struct + { + int precision; + long low; + long high; + } +integerARG; #undef TYPE_INTEGER FIELDTYPE *TYPE_INTEGER; @@ -670,12 +707,14 @@ FIELDTYPE *TYPE_IPV4; #include -typedef struct { - int precision; - double low; - double high; - struct lconv* L; -} numericARG; +typedef struct + { + int precision; + double low; + double high; + struct lconv *L; + } +numericARG; #undef TYPE_NUMERIC FIELDTYPE *TYPE_NUMERIC; @@ -685,10 +724,11 @@ FIELDTYPE *TYPE_NUMERIC; #include typedef struct -{ - regex_t *pRegExp; - unsigned long *refCount; -} RegExp_Arg; + { + regex_t *pRegExp; + unsigned long *refCount; + } +RegExp_Arg; #undef TYPE_REGEXP FIELDTYPE *TYPE_REGEXP; diff --git a/form/llib-lformw b/form/llib-lformw index f5720189..7690c5b0 100644 --- a/form/llib-lformw +++ b/form/llib-lformw @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002 Free Software Foundation, Inc. * + * Copyright (c) 2002,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,14 +27,41 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 2002 * + * Author: Thomas E. Dickey 2002,2005 * ****************************************************************************/ /* LINTLIBRARY */ -/* ./fld_arg.c */ +/* ./f_trace.c */ #include "form.priv.h" +#undef _nc_retrace_field_ptr +FIELD **_nc_retrace_field_ptr( + FIELD **code) + { return(*(FIELD ***)0); } + +#undef _nc_retrace_field +FIELD *_nc_retrace_field( + FIELD *code) + { return(*(FIELD **)0); } + +#undef _nc_retrace_field_type +FIELDTYPE *_nc_retrace_field_type( + FIELDTYPE *code) + { return(*(FIELDTYPE **)0); } + +#undef _nc_retrace_form +FORM *_nc_retrace_form( + FORM *code) + { return(*(FORM **)0); } + +#undef _nc_retrace_form_hook +Form_Hook _nc_retrace_form_hook( + Form_Hook code) + { return(*(Form_Hook *)0); } + +/* ./fld_arg.c */ + #undef set_fieldtype_arg int set_fieldtype_arg( FIELDTYPE *typ, @@ -441,10 +468,12 @@ int _nc_Set_Form_Page( FIELD *field) { return(*(int *)0); } -typedef struct { - int keycode; - int (*cmd)(FORM *); -} Binding_Info; +typedef struct +{ + int keycode; + int (*cmd) (FORM *); +} +Binding_Info; #undef form_driver int form_driver( @@ -465,6 +494,12 @@ char *field_buffer( int buffer) { return(*(char **)0); } +#undef _nc_Widen_String +wchar_t *_nc_Widen_String( + char *source, + int *lengthp) + { return(*(wchar_t **)0); } + /* ./frm_hook.c */ #undef set_field_init @@ -623,41 +658,49 @@ WINDOW *form_win( /* ./fty_alnum.c */ -typedef struct { - int width; -} alnumARG; +typedef struct + { + int width; + } +alnumARG; #undef TYPE_ALNUM FIELDTYPE *TYPE_ALNUM; /* ./fty_alpha.c */ -typedef struct { - int width; -} alphaARG; +typedef struct + { + int width; + } +alphaARG; #undef TYPE_ALPHA FIELDTYPE *TYPE_ALPHA; /* ./fty_enum.c */ -typedef struct { - char **kwds; - int count; - NCURSES_BOOL checkcase; - NCURSES_BOOL checkunique; -} enumARG; +typedef struct + { + char **kwds; + int count; + NCURSES_BOOL checkcase; + NCURSES_BOOL checkunique; + } +enumARG; #undef TYPE_ENUM FIELDTYPE *TYPE_ENUM; /* ./fty_int.c */ -typedef struct { - int precision; - long low; - long high; -} integerARG; +typedef struct + { + int precision; + long low; + long high; + } +integerARG; #undef TYPE_INTEGER FIELDTYPE *TYPE_INTEGER; @@ -668,12 +711,16 @@ FIELDTYPE *TYPE_IPV4; /* ./fty_num.c */ -typedef struct { - int precision; - double low; - double high; - struct lconv* L; -} numericARG; +#include + +typedef struct + { + int precision; + double low; + double high; + struct lconv *L; + } +numericARG; #undef TYPE_NUMERIC FIELDTYPE *TYPE_NUMERIC; @@ -683,10 +730,11 @@ FIELDTYPE *TYPE_NUMERIC; #include typedef struct -{ - regex_t *pRegExp; - unsigned long *refCount; -} RegExp_Arg; + { + regex_t *pRegExp; + unsigned long *refCount; + } +RegExp_Arg; #undef TYPE_REGEXP FIELDTYPE *TYPE_REGEXP; diff --git a/form/modules b/form/modules index 4125e93e..a11dade0 100644 --- a/form/modules +++ b/form/modules @@ -1,6 +1,6 @@ -# $Id: modules,v 1.13 1999/02/19 00:27:47 juergen Exp $ +# $Id: modules,v 1.14 2004/12/25 23:29:22 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998,2004 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -27,11 +27,12 @@ # authorization. # ############################################################################## # -# Author: Thomas E. Dickey 1996,1997 +# Author: Thomas E. Dickey # @ base # Library objects +f_trace lib $(srcdir) $(FORM_PRIV_H) fld_arg lib $(srcdir) $(FORM_PRIV_H) fld_attr lib $(srcdir) $(FORM_PRIV_H) fld_current lib $(srcdir) $(FORM_PRIV_H) diff --git a/include/curses.h.in b/include/curses.h.in index 3b869601..9e9077f0 100644 --- a/include/curses.h.in +++ b/include/curses.h.in @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,10 +29,10 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * - * and: Thomas E. Dickey 1996-on * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ -/* $Id: curses.h.in,v 1.148 2004/01/14 23:50:12 tom Exp $ */ +/* $Id: curses.h.in,v 1.157 2005/07/02 16:58:28 tom Exp $ */ #ifndef __NCURSES_H #define __NCURSES_H @@ -55,8 +55,23 @@ #undef NCURSES_VERSION #define NCURSES_VERSION "@NCURSES_MAJOR@.@NCURSES_MINOR@" +/* + * Identify the mouse encoding version. + */ +#define NCURSES_MOUSE_VERSION @NCURSES_MOUSE_VERSION@ + +/* + * Definitions to facilitate DLL's. + */ #include +/* + * User-definable tweak to disable the include of . + */ +#ifndef NCURSES_ENABLE_STDBOOL_H +#define NCURSES_ENABLE_STDBOOL_H @cf_cv_header_stdbool_h@ +#endif + /* * NCURSES_ATTR_T is used to quiet compiler warnings when building ncurses * configured using --disable-macros. @@ -96,7 +111,13 @@ #undef NCURSES_CH_T #define NCURSES_CH_T @NCURSES_CH_T@ +#if @cf_cv_enable_lp64@ && defined(_LP64) +typedef unsigned chtype; +typedef unsigned mmask_t; +#else typedef unsigned @cf_cv_typeof_chtype@ chtype; +typedef unsigned @cf_cv_typeof_mmask_t@ mmask_t; +#endif #include #include @@ -132,7 +153,7 @@ typedef @cf_cv_type_of_bool@ NCURSES_BOOL; #else /* c89, c99, etc. */ -#if @cf_cv_header_stdbool_h@ +#if NCURSES_ENABLE_STDBOOL_H #include /* use whatever the C compiler decides bool really is */ #define NCURSES_BOOL bool @@ -146,6 +167,9 @@ typedef @cf_cv_type_of_bool@ NCURSES_BOOL; #ifdef __cplusplus extern "C" { +#define NCURSES_CAST(type,value) static_cast(value) +#else +#define NCURSES_CAST(type,value) (type)(value) #endif /* @@ -192,7 +216,7 @@ extern NCURSES_EXPORT_VAR(chtype*) _nc_acs_map(void); extern NCURSES_EXPORT_VAR(chtype) acs_map[]; #endif -#define NCURSES_ACS(c) (acs_map[(unsigned char)c]) +#define NCURSES_ACS(c) (acs_map[NCURSES_CAST(unsigned char,c)]) /* VT100 symbols begin here */ #define ACS_ULCORNER NCURSES_ACS('l') /* upper left corner */ @@ -310,6 +334,9 @@ typedef struct { attr_t attr; wchar_t chars[CCHARW_MAX]; +#if @NCURSES_EXT_COLORS@ + int ext_color; /* color pair, must be more than 16-bits */ +#endif } cchar_t; @@ -366,6 +393,9 @@ struct _win_st #ifdef _XOPEN_SOURCE_EXTENDED cchar_t _bkgrnd; /* current background char/attribute pair */ +#if @NCURSES_EXT_COLORS@ + int _color; /* current color-pair for non-space character */ +#endif #endif }; @@ -788,7 +818,7 @@ extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #define NCURSES_ATTR_SHIFT 8 #define NCURSES_BITS(mask,shift) ((mask) << ((shift) + NCURSES_ATTR_SHIFT)) -#define A_NORMAL 0L +#define A_NORMAL (@cf_cv_1UL@ - @cf_cv_1UL@) #define A_ATTRIBUTES NCURSES_BITS(~(@cf_cv_1UL@ - @cf_cv_1UL@),0) #define A_CHARTEXT (NCURSES_BITS(@cf_cv_1UL@,0) - @cf_cv_1UL@) #define A_COLOR NCURSES_BITS(((@cf_cv_1UL@) << 8) - @cf_cv_1UL@,0) @@ -808,8 +838,11 @@ extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #define A_TOP NCURSES_BITS(@cf_cv_1UL@,21) #define A_VERTICAL NCURSES_BITS(@cf_cv_1UL@,22) +/* + * These apply to the first 256 color pairs. + */ #define COLOR_PAIR(n) NCURSES_BITS(n, 0) -#define PAIR_NUMBER(a) ((int)(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT)) +#define PAIR_NUMBER(a) (NCURSES_CAST(int,(((a) & A_COLOR) >> NCURSES_ATTR_SHIFT))) /* * pseudo functions @@ -851,11 +884,16 @@ extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #define wstandout(win) (wattrset(win,A_STANDOUT)) #define wstandend(win) (wattrset(win,A_NORMAL)) -#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK) -#define wattron(win,at) wattr_on(win, (attr_t) at, (void *)0) -#define wattroff(win,at) wattr_off(win, (attr_t) at, (void *)0) +#define wattron(win,at) wattr_on(win, NCURSES_CAST(attr_t, at), NULL) +#define wattroff(win,at) wattr_off(win, NCURSES_CAST(attr_t, at), NULL) + +#if @NCURSES_EXT_COLORS@ +#define wattrset(win,at) ((win)->_color = PAIR_NUMBER(at), \ + (win)->_attrs = (at)) +#else #define wattrset(win,at) ((win)->_attrs = (at)) +#endif #define scroll(win) wscrl(win,1) @@ -940,7 +978,7 @@ extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #define mvwgetnstr(win,y,x,str,n) (wmove(win,y,x) == ERR ? ERR : wgetnstr(win,str,n)) #define mvwgetstr(win,y,x,str) (wmove(win,y,x) == ERR ? ERR : wgetstr(win,str)) #define mvwhline(win,y,x,c,n) (wmove(win,y,x) == ERR ? ERR : whline(win,c,n)) -#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? (chtype)ERR : winch(win)) +#define mvwinch(win,y,x) (wmove(win,y,x) == ERR ? NCURSES_CAST(chtype, ERR) : winch(win)) #define mvwinchnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winchnstr(win,s,n)) #define mvwinchstr(win,y,x,s) (wmove(win,y,x) == ERR ? ERR : winchstr(win,s)) #define mvwinnstr(win,y,x,s,n) (wmove(win,y,x) == ERR ? ERR : winnstr(win,s,n)) @@ -972,16 +1010,26 @@ extern NCURSES_EXPORT(int) wvline (WINDOW *,chtype,int); /* implemented */ #define mvvline(y,x,c,n) mvwvline(stdscr,y,x,c,n) /* - * Some wide-character functions do not depend on the extensions. + * Some wide-character functions can be implemented without the extensions. */ #define getbkgd(win) ((win)->_bkgd) #define slk_attr_off(a,v) ((v) ? ERR : slk_attroff(a)) #define slk_attr_on(a,v) ((v) ? ERR : slk_attron(a)) +#if @NCURSES_EXT_COLORS@ +#define wattr_set(win,a,p,opts) ((win)->_attrs = ((a) & ~A_COLOR), \ + (win)->_color = (p), \ + OK) +#define wattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), \ + (void)((p) != 0 && (*(p) = (win)->_color)), \ + OK) +#else +#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK) #define wattr_get(win,a,p,opts) ((void)((a) != 0 && (*(a) = (win)->_attrs)), \ (void)((p) != 0 && (*(p) = PAIR_NUMBER((win)->_attrs))), \ OK) +#endif /* * XSI curses deprecates SVr4 vwprintw/vwscanw, which are supposed to use diff --git a/include/curses.tail b/include/curses.tail index d51abc25..66388e39 100644 --- a/include/curses.tail +++ b/include/curses.tail @@ -1,38 +1,77 @@ -/* $Id: curses.tail,v 1.8 2002/11/02 20:26:26 tom Exp $ */ +/* $Id: curses.tail,v 1.12 2005/03/27 00:09:51 tom Exp $ */ /* mouse interface */ -#define NCURSES_MOUSE_VERSION 1 + +#if NCURSES_MOUSE_VERSION > 1 +#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 5)) +#else +#define NCURSES_MOUSE_MASK(b,m) ((m) << (((b) - 1) * 6)) +#endif + +#define NCURSES_BUTTON_RELEASED 001L +#define NCURSES_BUTTON_PRESSED 002L +#define NCURSES_BUTTON_CLICKED 004L +#define NCURSES_DOUBLE_CLICKED 010L +#define NCURSES_TRIPLE_CLICKED 020L +#define NCURSES_RESERVED_EVENT 040L /* event masks */ -#define BUTTON1_RELEASED 000000000001L -#define BUTTON1_PRESSED 000000000002L -#define BUTTON1_CLICKED 000000000004L -#define BUTTON1_DOUBLE_CLICKED 000000000010L -#define BUTTON1_TRIPLE_CLICKED 000000000020L -#define BUTTON1_RESERVED_EVENT 000000000040L -#define BUTTON2_RELEASED 000000000100L -#define BUTTON2_PRESSED 000000000200L -#define BUTTON2_CLICKED 000000000400L -#define BUTTON2_DOUBLE_CLICKED 000000001000L -#define BUTTON2_TRIPLE_CLICKED 000000002000L -#define BUTTON2_RESERVED_EVENT 000000004000L -#define BUTTON3_RELEASED 000000010000L -#define BUTTON3_PRESSED 000000020000L -#define BUTTON3_CLICKED 000000040000L -#define BUTTON3_DOUBLE_CLICKED 000000100000L -#define BUTTON3_TRIPLE_CLICKED 000000200000L -#define BUTTON3_RESERVED_EVENT 000000400000L -#define BUTTON4_RELEASED 000001000000L -#define BUTTON4_PRESSED 000002000000L -#define BUTTON4_CLICKED 000004000000L -#define BUTTON4_DOUBLE_CLICKED 000010000000L -#define BUTTON4_TRIPLE_CLICKED 000020000000L -#define BUTTON4_RESERVED_EVENT 000040000000L -#define BUTTON_CTRL 000100000000L -#define BUTTON_SHIFT 000200000000L -#define BUTTON_ALT 000400000000L -#define ALL_MOUSE_EVENTS 000777777777L -#define REPORT_MOUSE_POSITION 001000000000L +#define BUTTON1_RELEASED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_RELEASED) +#define BUTTON1_PRESSED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_PRESSED) +#define BUTTON1_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_BUTTON_CLICKED) +#define BUTTON1_DOUBLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_DOUBLE_CLICKED) +#define BUTTON1_TRIPLE_CLICKED NCURSES_MOUSE_MASK(1, NCURSES_TRIPLE_CLICKED) + +#define BUTTON2_RELEASED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_RELEASED) +#define BUTTON2_PRESSED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_PRESSED) +#define BUTTON2_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_BUTTON_CLICKED) +#define BUTTON2_DOUBLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_DOUBLE_CLICKED) +#define BUTTON2_TRIPLE_CLICKED NCURSES_MOUSE_MASK(2, NCURSES_TRIPLE_CLICKED) + +#define BUTTON3_RELEASED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_RELEASED) +#define BUTTON3_PRESSED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_PRESSED) +#define BUTTON3_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_BUTTON_CLICKED) +#define BUTTON3_DOUBLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_DOUBLE_CLICKED) +#define BUTTON3_TRIPLE_CLICKED NCURSES_MOUSE_MASK(3, NCURSES_TRIPLE_CLICKED) + +#define BUTTON4_RELEASED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_RELEASED) +#define BUTTON4_PRESSED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_PRESSED) +#define BUTTON4_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_BUTTON_CLICKED) +#define BUTTON4_DOUBLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_DOUBLE_CLICKED) +#define BUTTON4_TRIPLE_CLICKED NCURSES_MOUSE_MASK(4, NCURSES_TRIPLE_CLICKED) + +/* + * In 32 bits the version-1 scheme does not provide enough space for a 5th + * button, unless we choose to change the ABI by omitting the reserved-events. + */ +#if NCURSES_MOUSE_VERSION > 1 + +#define BUTTON5_RELEASED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_RELEASED) +#define BUTTON5_PRESSED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_PRESSED) +#define BUTTON5_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_BUTTON_CLICKED) +#define BUTTON5_DOUBLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_DOUBLE_CLICKED) +#define BUTTON5_TRIPLE_CLICKED NCURSES_MOUSE_MASK(5, NCURSES_TRIPLE_CLICKED) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(6, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(6, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(6, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(6, 0010L) + +#else + +#define BUTTON1_RESERVED_EVENT NCURSES_MOUSE_MASK(1, NCURSES_RESERVED_EVENT) +#define BUTTON2_RESERVED_EVENT NCURSES_MOUSE_MASK(2, NCURSES_RESERVED_EVENT) +#define BUTTON3_RESERVED_EVENT NCURSES_MOUSE_MASK(3, NCURSES_RESERVED_EVENT) +#define BUTTON4_RESERVED_EVENT NCURSES_MOUSE_MASK(4, NCURSES_RESERVED_EVENT) + +#define BUTTON_CTRL NCURSES_MOUSE_MASK(5, 0001L) +#define BUTTON_SHIFT NCURSES_MOUSE_MASK(5, 0002L) +#define BUTTON_ALT NCURSES_MOUSE_MASK(5, 0004L) +#define REPORT_MOUSE_POSITION NCURSES_MOUSE_MASK(5, 0010L) + +#endif + +#define ALL_MOUSE_EVENTS (REPORT_MOUSE_POSITION - 1) /* macros to extract single event-bits from masks */ #define BUTTON_RELEASE(e, x) ((e) & (001 << (6 * ((x) - 1)))) @@ -42,8 +81,6 @@ #define BUTTON_TRIPLE_CLICK(e, x) ((e) & (020 << (6 * ((x) - 1)))) #define BUTTON_RESERVED_EVENT(e, x) ((e) & (040 << (6 * ((x) - 1)))) -typedef unsigned long mmask_t; - typedef struct { short id; /* ID to distinguish multiple devices */ @@ -57,7 +94,7 @@ extern NCURSES_EXPORT(int) ungetmouse (MEVENT *); extern NCURSES_EXPORT(mmask_t) mousemask (mmask_t, mmask_t *); extern NCURSES_EXPORT(bool) wenclose (const WINDOW *, int, int); extern NCURSES_EXPORT(int) mouseinterval (int); -extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW* win,int* y, int* x, bool to_screen); +extern NCURSES_EXPORT(bool) wmouse_trafo (const WINDOW*, int*, int*, bool); extern NCURSES_EXPORT(bool) mouse_trafo (int*, int*, bool); /* generated */ #define mouse_trafo(y,x,to_screen) wmouse_trafo(stdscr,y,x,to_screen) @@ -113,6 +150,7 @@ extern NCURSES_EXPORT(void) trace (const unsigned int); extern NCURSES_EXPORT_VAR(int) _nc_optimize_enable; /* enable optimizations */ #ifdef _XOPEN_SOURCE_EXTENDED extern NCURSES_EXPORT(const char *) _nc_viswbuf(const wchar_t *); +extern NCURSES_EXPORT(const char *) _nc_viswibuf(const wint_t *); #endif extern NCURSES_EXPORT(const char *) _nc_visbuf (const char *); #define OPTIMIZE_MVCUR 0x01 /* cursor movement optimization */ diff --git a/include/curses.wide b/include/curses.wide index a37f3f84..932b6e23 100644 --- a/include/curses.wide +++ b/include/curses.wide @@ -1,7 +1,7 @@ #ifdef _XOPEN_SOURCE_EXTENDED -/* $Id: curses.wide,v 1.28 2004/01/03 20:35:14 tom Exp $ */ +/* $Id: curses.wide,v 1.29 2005/01/28 21:11:53 tom Exp $ */ extern NCURSES_EXPORT_VAR(cchar_t *) _nc_wacs; @@ -188,11 +188,9 @@ extern NCURSES_EXPORT(int) wvline_set (WINDOW *, const cchar_t *, int); /* imple #define ins_wch(c) wins_wch(stdscr,c) #define ins_wstr(t) wins_wstr(stdscr,t) #define inwstr(c) winwstr(stdscr,c) -#define vid_attr(a,pair,opts) vidattr(a) #define vline_set(c,n) wvline_set(stdscr,c,n) #define wadd_wchstr(win,str) wadd_wchnstr(win,str,-1) #define waddwstr(win,wstr) waddnwstr(win,wstr,-1) -#define wattr_set(win,a,p,opts) ((win)->_attrs = (((a) & ~A_COLOR) | COLOR_PAIR(p)), OK) #define wget_wstr(w,t) wgetn_wstr(w,t,-1) #define wgetbkgrnd(win,wch) (*wch = win->_bkgrnd, OK) #define win_wchstr(w,c) win_wchnstr(w,c,-1) diff --git a/include/nc_alloc.h b/include/nc_alloc.h index 8bf6dcc7..ad514087 100644 --- a/include/nc_alloc.h +++ b/include/nc_alloc.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Thomas E. Dickey 1996,1997 * ****************************************************************************/ -/* $Id: nc_alloc.h,v 1.11 2002/07/20 13:16:40 tom Exp $ */ +/* $Id: nc_alloc.h,v 1.13 2005/01/16 00:27:35 tom Exp $ */ #ifndef NC_ALLOC_included #define NC_ALLOC_included 1 @@ -52,6 +52,13 @@ extern "C" { #define HAVE_LIBDBMALLOC 0 #endif +#if HAVE_LIBMPATROL +#include /* Memory-Patrol library */ +#else +#undef HAVE_LIBMPATROL +#define HAVE_LIBMPATROL 0 +#endif + #ifndef NO_LEAKS #define NO_LEAKS 0 #endif @@ -59,9 +66,9 @@ extern "C" { #if HAVE_LIBDBMALLOC || HAVE_LIBDMALLOC || NO_LEAKS #define HAVE_NC_FREEALL 1 struct termtype; -extern void _nc_free_and_exit(int) GCC_NORETURN; -extern void _nc_free_tparm(void); -extern void _nc_leaks_dump_entry(void); +extern NCURSES_EXPORT(void) _nc_free_and_exit(int) GCC_NORETURN; +extern NCURSES_EXPORT(void) _nc_free_tparm(void); +extern NCURSES_EXPORT(void) _nc_leaks_dump_entry(void); #define ExitProgram(code) _nc_free_and_exit(code) #endif diff --git a/include/ncurses_cfg.hin b/include/ncurses_cfg.hin index 14391bad..3f8a482a 100644 --- a/include/ncurses_cfg.hin +++ b/include/ncurses_cfg.hin @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,7 +30,7 @@ * Author: Thomas E. Dickey 1997 * ****************************************************************************/ /* - * $Id: ncurses_cfg.hin,v 1.4 2002/09/07 16:55:14 tom Exp $ + * $Id: ncurses_cfg.hin,v 1.7 2005/01/02 01:26:58 tom Exp $ * * This is a template-file used to generate the "ncurses_cfg.h" file. * @@ -57,6 +57,16 @@ #undef inline #define inline /* nothing */ #endif +#endif + + /* On HP-UX, the C compiler doesn't grok mbstate_t without + -D_XOPEN_SOURCE=500. However, this causes problems on + IRIX. So, we #define mbstate_t to int in configure.in + only for the C compiler if needed. */ +#ifndef __cplusplus +#ifdef NEED_MBSTATE_T_DEF +#define mbstate_t int +#endif #endif #endif /* NC_CONFIG_H */ diff --git a/include/ncurses_defs b/include/ncurses_defs index 4a302828..7cd7b388 100644 --- a/include/ncurses_defs +++ b/include/ncurses_defs @@ -1,6 +1,6 @@ -# $Id: ncurses_defs,v 1.21 2004/01/18 01:03:24 tom Exp $ +# $Id: ncurses_defs,v 1.27 2005/01/28 21:11:53 tom Exp $ ############################################################################## -# Copyright (c) 2000-2003,2004 Free Software Foundation, Inc. # +# Copyright (c) 2000-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -59,17 +59,20 @@ HAVE_GETNSTR HAVE_GETOPT_H HAVE_GETTIMEOFDAY HAVE_GETTTYNAM +HAVE_GPM_H HAVE_GPP_BUILTIN_H HAVE_GXX_BUILTIN_H HAVE_HAS_KEY HAVE_ISASCII HAVE_ISSETUGID +HAVE_LANGINFO_CODESET HAVE_LIBC_H HAVE_LIBDBMALLOC HAVE_LIBDMALLOC HAVE_LIBFORM HAVE_LIBGPM HAVE_LIBMENU +HAVE_LIBMPATROL HAVE_LIBPANEL HAVE_LIMITS_H HAVE_LINK @@ -79,7 +82,6 @@ HAVE_MBLEN HAVE_MBRLEN HAVE_MBRTOWC HAVE_MBTOWC -HAVE_MEMCCPY HAVE_MENU_H HAVE_MKSTEMP HAVE_NANOSLEEP @@ -132,11 +134,13 @@ HAVE_VSNPRINTF HAVE_VSSCANF HAVE_WCTOB HAVE_WCTOMB +HAVE_WCTYPE_H HAVE_WORKING_POLL HAVE_WRESIZE HAVE__DOSCAN MIXEDCASE_FILENAMES NCURSES_EXPANDED +NCURSES_EXT_COLORS NCURSES_EXT_FUNCS NCURSES_NOMACROS NCURSES_NO_PADDING diff --git a/include/term_entry.h b/include/term_entry.h index a066be99..c880c3a7 100644 --- a/include/term_entry.h +++ b/include/term_entry.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,9 +29,10 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1998-2004 * ****************************************************************************/ -/* $Id: term_entry.h,v 1.32 2001/03/24 21:53:10 tom Exp $ */ +/* $Id: term_entry.h,v 1.34 2005/07/16 21:15:07 tom Exp $ */ /* * term_entry.h -- interface to entry-manipulation code @@ -56,7 +57,7 @@ typedef struct entry { { char *name; struct entry *link; - long line; + long line; } uses[MAX_USES]; int ncrosslinks; @@ -133,6 +134,9 @@ extern NCURSES_EXPORT(void) _nc_free_termtype (TERMTYPE *); /* lib_acs.c */ extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */ +/* lib_termcap.c: trim sgr0 string for termcap users */ +extern NCURSES_EXPORT(char *) _nc_trim_sgr0 (TERMTYPE *); + /* parse_entry.c: entry-parsing code */ #if NCURSES_XNAMES extern NCURSES_EXPORT_VAR(bool) _nc_user_definable; @@ -148,9 +152,11 @@ extern NCURSES_EXPORT(void) _nc_write_entry (TERMTYPE *const); /* comp_parse.c: entry list handling */ extern NCURSES_EXPORT(void) _nc_read_entry_source (FILE*, char*, int, bool, bool (*)(ENTRY*)); extern NCURSES_EXPORT(bool) _nc_entry_match (char *, char *); -extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); +extern NCURSES_EXPORT(int) _nc_resolve_uses (bool); /* obs 20040705 */ +extern NCURSES_EXPORT(int) _nc_resolve_uses2 (bool, bool); extern NCURSES_EXPORT(void) _nc_free_entries (ENTRY *); -extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)(TERMTYPE *); +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype)(TERMTYPE *); /* obs 20040705 */ +extern NCURSES_IMPEXP void NCURSES_API (*_nc_check_termtype2)(TERMTYPE *, bool); /* trace_xnames.c */ extern NCURSES_EXPORT(void) _nc_trace_xnames (TERMTYPE *); diff --git a/include/tic.h b/include/tic.h index 752c1f7e..6b98b83b 100644 --- a/include/tic.h +++ b/include/tic.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,10 +29,11 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996 on * ****************************************************************************/ /* - * $Id: tic.h,v 1.46 2003/12/27 19:05:32 tom Exp $ + * $Id: tic.h,v 1.50 2005/08/20 19:41:40 tom Exp $ * tic.h - Global variables and structures for the terminfo * compiler. */ @@ -108,7 +109,7 @@ extern "C" { #define DEBUG_LEVEL(n) ((n) << TRACE_SHIFT) #define set_trace_level(n) \ - _nc_tracing &= DEBUG_LEVEL(MAX_DEBUG_LEVEL), \ + _nc_tracing &= DEBUG_LEVEL(MAX_DEBUG_LEVEL), \ _nc_tracing |= DEBUG_LEVEL(n) #ifdef TRACE @@ -216,18 +217,18 @@ extern NCURSES_EXPORT(const struct name_table_entry * const *) _nc_get_hash_tabl #define NOTFOUND ((struct name_table_entry *) 0) /* out-of-band values for representing absent capabilities */ -#define ABSENT_BOOLEAN (char)(-1) /* 255 */ +#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ #define ABSENT_NUMERIC (-1) #define ABSENT_STRING (char *)0 /* out-of-band values for representing cancels */ -#define CANCELLED_BOOLEAN (char)(-2) /* 254 */ +#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */ #define CANCELLED_NUMERIC (-2) #define CANCELLED_STRING (char *)(-1) #define VALID_BOOLEAN(s) ((unsigned char)(s) <= 1) /* reject "-1" */ #define VALID_NUMERIC(s) ((s) >= 0) -#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) +#define VALID_STRING(s) ((s) != CANCELLED_STRING && (s) != ABSENT_STRING) /* termcap entries longer than this may break old binaries */ #define MAX_TERMCAP_LENGTH 1023 @@ -266,11 +267,12 @@ extern NCURSES_EXPORT_VAR(long) _nc_start_line; #define SYN_TERMCAP 1 /* comp_error.c: warning & abort messages */ -extern NCURSES_EXPORT(void) _nc_set_source (const char *const name); +extern NCURSES_EXPORT(const char *) _nc_get_source (void); +extern NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; extern NCURSES_EXPORT(void) _nc_get_type (char *name); -extern NCURSES_EXPORT(void) _nc_set_type (const char *const name); +extern NCURSES_EXPORT(void) _nc_set_source (const char *const); +extern NCURSES_EXPORT(void) _nc_set_type (const char *const); extern NCURSES_EXPORT(void) _nc_syserr_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; -extern NCURSES_EXPORT(void) _nc_err_abort (const char *const,...) GCC_PRINTFLIKE(1,2) GCC_NORETURN; extern NCURSES_EXPORT(void) _nc_warning (const char *const,...) GCC_PRINTFLIKE(1,2); extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings; @@ -278,7 +280,7 @@ extern NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings; extern NCURSES_EXPORT(char *) _nc_tic_expand (const char *, bool, int); /* comp_scan.c: decode string from readable form */ -extern NCURSES_EXPORT(char) _nc_trans_string (char *, char *); +extern NCURSES_EXPORT(int) _nc_trans_string (char *, char *); /* captoinfo.c: capability conversion */ extern NCURSES_EXPORT(char *) _nc_captoinfo (const char *, const char *, int const); @@ -289,7 +291,7 @@ extern NCURSES_EXPORT(char *) _nc_infotocap (const char *, const char *, int con extern NCURSES_EXPORT_VAR(int) _nc_tparm_err; -extern NCURSES_EXPORT(int) _nc_tparm_analyze(const char *string, char *p_is_s[NUM_PARM], int *popcount); +extern NCURSES_EXPORT(int) _nc_tparm_analyze(const char *, char **, int *); /* lib_tputs.c */ extern NCURSES_EXPORT_VAR(int) _nc_nulls_sent; /* Add one for every null sent */ diff --git a/install-sh b/install-sh index ebc66913..9f59f0be 100755 --- a/install-sh +++ b/install-sh @@ -109,38 +109,39 @@ then echo "install: no input file specified" exit 1 else - true + : fi if [ x"$dir_arg" != x ]; then dst=$src src="" - + if [ -d $dst ]; then instcmd=: + chmodcmd="" else - instcmd=mkdir + instcmd=$mkdirprog fi else # Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad +# might cause directories to be created, which would be especially bad # if $src (and thus $dsttmp) contains '*'. if [ -f $src -o -d $src ] then - true + : else echo "install: $src does not exist" exit 1 fi - + if [ x"$dst" = x ] then echo "install: no destination specified" exit 1 else - true + : fi # If destination is a directory, append the input filename; if your system @@ -150,7 +151,7 @@ else then dst="$dst"/`basename $src` else - true + : fi fi @@ -162,8 +163,8 @@ dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` # Skip lots of stat calls in the usual case. if [ ! -d "$dstdir" ]; then -defaultIFS=' -' +defaultIFS=' + ' IFS="${IFS-${defaultIFS}}" oIFS="${IFS}" @@ -182,7 +183,7 @@ while [ $# -ne 0 ] ; do then $mkdirprog "${pathcomp}" else - true + : fi pathcomp="${pathcomp}/" @@ -193,29 +194,29 @@ if [ x"$dir_arg" != x ] then $doit $instcmd $dst && - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else : ; fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else : ; fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else : ; fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else : ; fi else # If we're going to rename the final executable, determine the name now. - if [ x"$transformarg" = x ] + if [ x"$transformarg" = x ] then dstfile=`basename $dst` else - dstfile=`basename $dst $transformbasename | + dstfile=`basename $dst $transformbasename | sed $transformarg`$transformbasename fi # don't allow the sed command to completely eliminate the filename - if [ x"$dstfile" = x ] + if [ x"$dstfile" = x ] then dstfile=`basename $dst` else - true + : fi # Make a temp file name in the proper directory. @@ -234,15 +235,15 @@ else # ignore errors from any of these, just make sure not to ignore # errors from the above "$doit $instcmd $src $dsttmp" command. - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && + if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else :;fi && + if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else :;fi && + if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else :;fi && + if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else :;fi && # Now rename the file to the real destination. $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile + $doit $mvcmd $dsttmp $dstdir/$dstfile fi && diff --git a/man/Makefile.in b/man/Makefile.in index 92fb9d30..8a24d843 100644 --- a/man/Makefile.in +++ b/man/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.35 2003/12/20 18:41:10 tom Exp $ +# $Id: Makefile.in,v 1.39 2005/07/16 17:26:45 tom Exp $ ############################################################################## -# Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -49,6 +49,7 @@ INSTALL_DATA = @INSTALL_DATA@ all \ sources : terminfo.5 depend : +tags : $(DESTDIR)$(mandir) : sh $(srcdir)/../mkinstalldirs $@ @@ -56,10 +57,10 @@ $(DESTDIR)$(mandir) : EDITARGS = $(DESTDIR)$(mandir) $(srcdir) terminfo.5 $(srcdir)/*.[0-9]* install install.man : terminfo.5 $(DESTDIR)$(mandir) - sh ./edit_man.sh normal installing $(EDITARGS) + sh ../edit_man.sh normal installing $(EDITARGS) uninstall uninstall.man : - -sh ./edit_man.sh normal removing $(EDITARGS) + -sh ../edit_man.sh normal removing $(EDITARGS) # We compose terminfo.5 from the real sources... CAPLIST=$(srcdir)/../include/@TERMINFO_CAPS@ @@ -72,8 +73,8 @@ mostlyclean : clean: mostlyclean rm -f terminfo.5 -edit_man.sed : make_sed.sh @MANPAGE_RENAMES@ - sh $srcdir/make_sed.sh @MANPAGE_RENAMES@ >edit_man.sed +../edit_man.sed : make_sed.sh @MANPAGE_RENAMES@ + sh $(srcdir)/make_sed.sh @MANPAGE_RENAMES@ >../edit_man.sed distclean realclean: clean - rm -f Makefile edit_man.* + rm -f Makefile ../edit_man.* diff --git a/man/captoinfo.1m b/man/captoinfo.1m index 2938ec6c..94a5ae96 100644 --- a/man/captoinfo.1m +++ b/man/captoinfo.1m @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,14 +27,14 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: captoinfo.1m,v 1.17 2003/05/11 00:32:53 tom Exp $ +.\" $Id: captoinfo.1m,v 1.18 2004/07/05 13:16:08 tom Exp $ .TH captoinfo 1M "" .ds n 5 .ds d @TERMINFO@ .SH NAME \fBcaptoinfo\fR - convert a \fItermcap\fR description into a \fIterminfo\fR description .SH SYNOPSIS -\fBcaptoinfo\fR [\fB\-v\fR\fIn\fR \fIwidth\fR] [\fB\-V\fR] [\fB\-1\fR] [\fB\-w\fR \fIwidth\fR] \fIfile\fR . . . +\fBcaptoinfo\fR [\fB-v\fR\fIn\fR \fIwidth\fR] [\fB-V\fR] [\fB-1\fR] [\fB-w\fR \fIwidth\fR] \fIfile\fR . . . .SH DESCRIPTION \fBcaptoinfo\fR looks in \fIfile\fR for \fBtermcap\fR descriptions. For each one found, an equivalent \fBterminfo\fR description is written to standard @@ -47,18 +47,18 @@ the terminal whose name is specified in the environment variable \fBTERM\fR is extracted from that file. If the environment variable \fBTERMCAP\fR is not set, then the file \fB\*d\fR is read. .TP 5 -\fB\-v\fR +\fB-v\fR print out tracing information on standard error as the program runs. .TP 5 -\fB\-V\fR +\fB-V\fR print out the version of the program in use on standard error and exit. .TP 5 -\fB\-1\fR +\fB-1\fR cause the fields to print out one to a line. Otherwise, the fields will be printed several to a line to a maximum width of 60 characters. .TP 5 -\fB\-w\fR +\fB-w\fR change the output to \fIwidth\fR characters. .SH FILES .TP 20 @@ -172,11 +172,11 @@ Hewlett-Packard's terminfo library supports two nonstandard terminfo capabilities \fBmeml\fR (memory lock) and \fBmemu\fR (memory unlock). These will be discarded with a warning message. .SH NOTES -This utility is actually a link to \fItic\fR(1M), running in \fI\-I\fR mode. -You can use other \fItic\fR options such as \fB\-f\fR and \fB\-x\fR. +This utility is actually a link to \fItic\fR(1M), running in \fI-I\fR mode. +You can use other \fItic\fR options such as \fB-f\fR and \fB-x\fR. The trace option isn't identical to SVr4's. Under SVr4, instead of following -the \fB\-v\fR with a trace level n, you repeat it n times. +the \fB-v\fR with a trace level n, you repeat it n times. .SH SEE ALSO \fBcurses\fR(3X), \fB@INFOCMP@\fR(1M), \fBterminfo\fR(\*n) .SH AUTHOR diff --git a/man/curs_add_wchstr.3x b/man/curs_add_wchstr.3x index 7afd4984..f84c2cb9 100644 --- a/man/curs_add_wchstr.3x +++ b/man/curs_add_wchstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 2002-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,10 +26,9 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_add_wchstr.3x,v 1.2 2003/12/27 18:53:41 tom Exp $ +.\" $Id: curs_add_wchstr.3x,v 1.6 2005/01/02 01:28:49 tom Exp $ .TH curs_add_wchstr 3X "" .SH NAME -.PP \fBadd_wchstr\fR, \fBadd_wchnstr\fR, \fBwadd_wchstr\fR, @@ -73,7 +72,7 @@ On the other hand, they do not perform checking they do not advance the current cursor position, they do not expand other control characters to ^-escapes, and they truncate the string if it crosses the right margin, -rather then wrapping it around to the new line. +rather than wrapping it around to the new line. .PP These routines end successfully on encountering a null \fIcchar_t\fR, or @@ -88,7 +87,7 @@ All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success. All these entry points are described in the XSI Curses standard, Issue 4. .SH SEE ALSO \fBcurses\fR(3X), -\fBcurs_addchstr\fR(3X) +\fBcurs_addchstr\fR(3X), \fBcurs_addwstr\fR(3X) .\"# .\"# The following sets edit modes for GNU EMACS diff --git a/man/curs_addchstr.3x b/man/curs_addchstr.3x index 9de749fc..3a74e13d 100644 --- a/man/curs_addchstr.3x +++ b/man/curs_addchstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,21 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_addchstr.3x,v 1.8 2003/12/27 18:51:24 tom Exp $ +.\" $Id: curs_addchstr.3x,v 1.10 2005/05/15 16:17:07 tom Exp $ .TH curs_addchstr 3X "" +.na +.hy 0 .SH NAME -\fBaddchstr\fR, \fBaddchnstr\fR, \fBwaddchstr\fR, -\fBwaddchnstr\fR, \fBmvaddchstr\fR, \fBmvaddchnstr\fR, \fBmvwaddchstr\fR, +\fBaddchstr\fR, +\fBaddchnstr\fR, +\fBwaddchstr\fR, +\fBwaddchnstr\fR, +\fBmvaddchstr\fR, +\fBmvaddchnstr\fR, +\fBmvwaddchstr\fR, \fBmvwaddchnstr\fR - add a string of characters (and attributes) to a \fBcurses\fR window +.ad +.hy .SH SYNOPSIS \fB#include \fR .PP @@ -58,9 +67,9 @@ If \fBn\fR=\fB-1\fR then the whole string is copied, to the maximum number of characters that will fit on the line. .PP The window cursor is \fInot\fR advanced, and these routines work faster than -\fBwaddnstr\fR. On the other hand, they don't perform any kind of checking -(such as for the newline, backspace, or carriage return characters), they don't -advance the current cursor position, they don't expand other control characters +\fBwaddnstr\fR. On the other hand, they do not perform any kind of checking +(such as for the newline, backspace, or carriage return characters), they do not +advance the current cursor position, they do not expand other control characters to ^-escapes, and they truncate the string if it crosses the right margin, rather then wrapping it around to the new line. .SH RETURN VALUES @@ -68,10 +77,14 @@ All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success (the SVr4 manuals specify only "an integer value other than \fBERR\fR") upon successful completion, unless otherwise noted in the preceding routine descriptions. +.PP +X/Open does not define any error conditions. +This implementation returns an error +if the window pointer is null. .SH NOTES Note that all routines except \fBwaddchnstr\fR may be macros. .SH PORTABILITY -All these entry points are described in the XSI Curses standard, Issue 4. +These entry points are described in the XSI Curses standard, Issue 4. .SH SEE ALSO \fBcurses\fR(3X). .\"# diff --git a/man/curs_addstr.3x b/man/curs_addstr.3x index 0ffacc6f..488b9dd8 100644 --- a/man/curs_addstr.3x +++ b/man/curs_addstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_addstr.3x,v 1.11 2003/12/27 18:51:15 tom Exp $ +.\" $Id: curs_addstr.3x,v 1.13 2005/05/15 16:17:14 tom Exp $ .TH curs_addstr 3X "" +.na +.hy 0 .SH NAME \fBaddstr\fR, \fBaddnstr\fR, @@ -37,6 +39,8 @@ \fBmvaddnstr\fR, \fBmvwaddstr\fR, \fBmvwaddnstr\fR - add a string of characters to a \fBcurses\fR window and advance cursor +.ad +.hy .SH SYNOPSIS .nf \fB#include \fR @@ -70,6 +74,12 @@ or until a terminating null is reached. All routines return the integer \fBERR\fR upon failure and \fBOK\fR on success (the SVr4 manuals specify only "an integer value other than \fBERR\fR") upon successful completion. +.PP +X/Open does not define any error conditions. +This implementation returns an error +if the window pointer is null or +if the string pointer is null or +if the corresponding calls to \fBwaddch\fP return an error. .SH NOTES Note that all of these routines except \fBwaddstr\fR and \fBwaddnstr\fR may be macros. diff --git a/man/curs_addwstr.3x b/man/curs_addwstr.3x index 4091b362..4ee2ef96 100644 --- a/man/curs_addwstr.3x +++ b/man/curs_addwstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 2002-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_addwstr.3x,v 1.3 2003/12/27 18:51:01 tom Exp $ +.\" $Id: curs_addwstr.3x,v 1.6 2005/05/15 17:02:54 tom Exp $ .TH curs_addwstr 3X "" +.na +.hy 0 .SH NAME \fBaddwstr\fR, \fBaddnwstr\fR, @@ -37,6 +39,8 @@ \fBmvaddnwstr\fR, \fBmvwaddwstr\fR, \fBmvwaddnwstr\fR \- add a string of wide characters to a \fBcurses\fR window and advance cursor +.ad +.hy .SH SYNOPSIS .nf \fB#include \fR @@ -58,7 +62,8 @@ \fBint mvwaddnwstr(WINDOW *\fR\fIwin\fR\fB, int \fR\fIy\fR\fB, int \fR\fIx\fR\fB, const wchar_t *\fR\fIwstr\fR\fB, int \fR\fIn\fR\fB);\fR .fi .SH DESCRIPTION -These routines write the characters of the (null-terminated) \fBwchar_t\fRcharacter string +These routines write the characters of the +(null-terminated) \fBwchar_t\fR character string \fIwstr\fR on the given window. It is similar to constructing a \fBcchar_t\fR for each wchar_t in the string, then calling \fBwadd_wch\fR for the resulting \fBcchar_t\fR. diff --git a/man/curs_attr.3x b/man/curs_attr.3x index bcbf61c4..3cbaf535 100644 --- a/man/curs_attr.3x +++ b/man/curs_attr.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,19 +27,38 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_attr.3x,v 1.27 2003/12/27 18:50:51 tom Exp $ +.\" $Id: curs_attr.3x,v 1.29 2005/05/15 16:17:25 tom Exp $ .TH curs_attr 3X "" +.na +.hy 0 .SH NAME -\fBattroff\fR, \fBwattroff\fR, \fBattron\fR, \fBwattron\fR, -\fBattrset\fR, \fBwattrset\fR, \fBcolor_set\fR, \fBwcolor_set\fR, -\fBstandend\fR, \fBwstandend\fR, \fBstandout\fR, \fBwstandout\fR, -\fBattr_get\fR, \fBwattr_get\fR, -\fBattr_off\fR, \fBwattr_off\fR, -\fBattr_on\fR, \fBwattr_on\fR, -\fBattr_set\fR, \fBwattr_set\fR, -\fBchgat\fR, \fBwchgat\fR, -\fBmvchgat\fR, \fBmvwchgat\fR, +\fBattroff\fR, +\fBwattroff\fR, +\fBattron\fR, +\fBwattron\fR, +\fBattrset\fR, +\fBwattrset\fR, +\fBcolor_set\fR, +\fBwcolor_set\fR, +\fBstandend\fR, +\fBwstandend\fR, +\fBstandout\fR, +\fBwstandout\fR, +\fBattr_get\fR, +\fBwattr_get\fR, +\fBattr_off\fR, +\fBwattr_off\fR, +\fBattr_on\fR, +\fBwattr_on\fR, +\fBattr_set\fR, +\fBwattr_set\fR, +\fBchgat\fR, +\fBwchgat\fR, +\fBmvchgat\fR, +\fBmvwchgat\fR, \fBPAIR_NUMBER\fR - \fBcurses\fR character and window attribute control routines +.ad +.hy .SH SYNOPSIS \fB#include \fR .br @@ -146,7 +165,7 @@ since the character values are not modified. Use \fBtouchwin\fR to force the screen to match the updated attributes. .SS Attributes The following video attributes, defined in \fB\fR, can be passed to -the routines \fBattron\fR, \fBattroff\fR, and \fBattrset\fR, or OR'ed with the +the routines \fBattron\fR, \fBattroff\fR, and \fBattrset\fR, or OR'd with the characters passed to \fBaddch\fR. .PP .TS @@ -179,8 +198,15 @@ The SVr4 manual page claims (falsely) that these routines always return \fB1\fR. .SH NOTES Note that \fBattroff\fR, \fBwattroff\fR, \fBattron\fR, \fBwattron\fR, \fBattrset\fR, \fBwattrset\fR, \fBstandend\fR and \fBstandout\fR may be macros. +.PP +\fBCOLOR_PAIR\fP values can only be OR'd with attributes if the pair +number is less than 256. +The alternate functions such as \fBcolor_set\fP can pass a color pair +value directly. +However, ncurses ABI 4 and 5 simply OR this value within the alternate functions. +You must use ncurses ABI 6 to support more than 256 color pairs. .SH PORTABILITY -All these functions are supported in the XSI Curses standard, Issue 4. The +These functions are supported in the XSI Curses standard, Issue 4. The standard defined the dedicated type for highlights, \fBattr_t\fR, which is not defined in SVr4 curses. The functions taking \fBattr_t\fR arguments are not supported under SVr4. @@ -217,7 +243,16 @@ information. The XSI standard extended conformance level adds new highlights \fBA_HORIZONTAL\fR, \fBA_LEFT\fR, \fBA_LOW\fR, \fBA_RIGHT\fR, \fBA_TOP\fR, \fBA_VERTICAL\fR (and corresponding \fBWA_\fR macros for each) which this -curses does not yet support. +implementation does not yet support. +.SH RETURN VALUE +All routines return the integer \fBOK\fR on success, or \fBERR\fP on failure. +.PP +X/Open does not define any error conditions. +.PP +This implementation returns an error +if the window pointer is null. +The \fBwcolor_set\fP function returns an error if the color pair parameter +is outside the range 0..COLOR_PAIRS-1. .SH SEE ALSO \fBcurses\fR(3X), \fBcurs_addch\fR(3X), diff --git a/man/curs_beep.3x b/man/curs_beep.3x index 579931cc..49e57619 100644 --- a/man/curs_beep.3x +++ b/man/curs_beep.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_beep.3x,v 1.9 2003/12/27 18:44:30 tom Exp $ +.\" $Id: curs_beep.3x,v 1.10 2005/01/08 17:55:51 tom Exp $ .TH curs_beep 3X "" .SH NAME \fBbeep\fR, \fBflash\fR - \fBcurses\fR bell and screen flash routines @@ -51,8 +51,8 @@ These routines return \fBOK\fR if they succeed in beeping or flashing, SVr4's beep and flash routines always returned \fBOK\fR, so it was not possible to tell when the beep or flash failed. .SH PORTABILITY -These functions are defined in the XSI Curses standard, Issue 4. Like SVr4, it -specifies that they always return \fBOK\fR. +These functions are described in the XSI Curses standard, Issue 4. +Like SVr4, it specifies that they always return \fBOK\fR. .SH SEE ALSO \fBcurses\fR(3X) .\"# diff --git a/man/curs_bkgrnd.3x b/man/curs_bkgrnd.3x index 3be0dced..fd42338a 100644 --- a/man/curs_bkgrnd.3x +++ b/man/curs_bkgrnd.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 2002 Free Software Foundation, Inc. * +.\" Copyright (c) 2002,2004 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,10 +26,9 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_bkgrnd.3x,v 1.1 2002/02/23 23:23:42 tom Exp $ +.\" $Id: curs_bkgrnd.3x,v 1.2 2004/03/13 19:39:10 tom Exp $ .TH curs_bkgrnd 3X "" .SH NAME -.PP \fBbkgrnd\fR, \fBwbkgrnd\fR, \fBbkgrndset\fR, diff --git a/man/curs_border.3x b/man/curs_border.3x index c087fad7..2b18d8b0 100644 --- a/man/curs_border.3x +++ b/man/curs_border.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,14 +26,24 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_border.3x,v 1.15 2002/02/16 22:21:47 tom Exp $ +.\" $Id: curs_border.3x,v 1.17 2005/05/15 16:17:31 tom Exp $ .TH curs_border 3X "" +.na +.hy 0 .SH NAME -\fBborder\fR, \fBwborder\fR, \fBbox\fR, -\fBhline\fR, \fBwhline\fR, -\fBvline\fR, \fBwvline\fR, -\fBmvhline\fR, \fBmvwhline\fR, -\fBmvvline\fR, \fBmvwvline\fR - create \fBcurses\fR borders, horizontal and vertical lines +\fBborder\fR, +\fBwborder\fR, +\fBbox\fR, +\fBhline\fR, +\fBwhline\fR, +\fBvline\fR, +\fBwvline\fR, +\fBmvhline\fR, +\fBmvwhline\fR, +\fBmvvline\fR, +\fBmvwvline\fR - create \fBcurses\fR borders, horizontal and vertical lines +.ad +.hy .SH SYNOPSIS \fB#include \fR .br @@ -119,6 +129,10 @@ long, or as many as fit into the window. .SH RETURN VALUE All routines return the integer \fBOK\fR. The SVr4.0 manual says "or a non-negative integer if \fBimmedok\fR is set", but this appears to be an error. +.PP +X/Open does not define any error conditions. +This implementation returns an error +if the window pointer is null. .SH NOTES The borders generated by these functions are \fIinside\fR borders (this is also true of SVr4 curses, though the fact is not documented). diff --git a/man/curs_border_set.3x b/man/curs_border_set.3x index ba7a197b..dbf86538 100644 --- a/man/curs_border_set.3x +++ b/man/curs_border_set.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 2002 Free Software Foundation, Inc. * +.\" Copyright (c) 2002-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,10 +26,11 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_border_set.3x,v 1.3 2002/04/20 16:49:13 tom Exp $ +.\" $Id: curs_border_set.3x,v 1.6 2005/05/15 16:17:37 tom Exp $ .TH curs_border_set 3X "" +.na +.hy 0 .SH NAME -.PP \fBborder_set\fR, \fBwborder_set\fR, \fBbox_set\fR, @@ -41,6 +42,8 @@ \fBwvline_set\fR, \fBmvvline_set\fR, \fBmvwvline_set\fR \- create \fBcurses\fR borders or lines using complex characters and renditions +.ad +.hy .SH SYNOPSIS .PP \fB#include \fR @@ -190,6 +193,8 @@ Upon successful completion, these functions return \fBOK\fR. Otherwise, they return \fBERR\fR. +.PP +Functions using a window parameter return an error if it is null. .SH SEE ALSO \fBncurses\fR(3X), \fBcurs_border\fR(3X), diff --git a/man/curs_clear.3x b/man/curs_clear.3x index d08e852a..fa7723af 100644 --- a/man/curs_clear.3x +++ b/man/curs_clear.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,15 +26,24 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_clear.3x,v 1.7 1998/03/11 21:12:53 juergen Exp $ +.\" $Id: curs_clear.3x,v 1.10 2005/10/01 19:34:43 tom Exp $ .TH curs_clear 3X "" +.na +.hy 0 .SH NAME -\fBerase\fR, \fBwerase\fR, \fBclear\fR, -\fBwclear\fR, \fBclrtobot\fR, \fBwclrtobot\fR, \fBclrtoeol\fR, +\fBerase\fR, +\fBwerase\fR, +\fBclear\fR, +\fBwclear\fR, +\fBclrtobot\fR, +\fBwclrtobot\fR, +\fBclrtoeol\fR, \fBwclrtoeol\fR - clear all or part of a \fBcurses\fR window +.ad +.hy .SH SYNOPSIS \fB# include \fR - +.sp \fBint erase(void);\fR .br \fBint werase(WINDOW *win);\fR @@ -54,24 +63,29 @@ .SH DESCRIPTION The \fBerase\fR and \fBwerase\fR routines copy blanks to every position in the window, clearing the screen. - +.PP The \fBclear\fR and \fBwclear\fR routines are like \fBerase\fR and \fBwerase\fR, but they also call \fBclearok\fR, so that the screen is cleared completely on the next call to \fBwrefresh\fR for that window and repainted from scratch. - +.PP The \fBclrtobot\fR and \fBwclrtobot\fR routines erase from the cursor to the end of screen. That is, they erase all lines below the cursor in the window. Also, the current line to the right of the cursor, inclusive, is erased. - +.PP The \fBclrtoeol\fR and \fBwclrtoeol\fR routines erase the current line to the right of the cursor, inclusive, to the end of the current line. - +.PP Blanks created by erasure have the current background rendition (as set by \fBwbkgdset\fR) merged into them. .SH RETURN VALUE -All routines return the integer \fBOK\fR. The SVr4.0 manual says "or a +All routines return the integer \fBOK\fR on success and \fBERR\fP on failure. +The SVr4.0 manual says "or a non-negative integer if \fBimmedok\fR is set", but this appears to be an error. +.PP +X/Open defines no error conditions. +In this implementation, +functions using a window pointer parameter return an error if it is null. .SH NOTES Note that \fBerase\fR, \fBwerase\fR, \fBclear\fR, \fBwclear\fR, \fBclrtobot\fR, and \fBclrtoeol\fR may be macros. @@ -79,11 +93,18 @@ Note that \fBerase\fR, \fBwerase\fR, \fBclear\fR, \fBwclear\fR, These functions are described in the XSI Curses standard, Issue 4. The standard specifies that they return \fBERR\fR on failure, but specifies no error conditions. - +.PP Some historic curses implementations had, as an undocumented feature, the ability to do the equivalent of \fBclearok(..., 1)\fR by saying \fBtouchwin(stdscr)\fR or \fBclear(stdscr)\fR. This will not work under ncurses. +.PP +This implementation, and others such as Solaris, +sets the current position to 0,0 after erasing +via \fBwerase()\fP and \fBwclear()\fP. +That fact is not documented in other implementations, +and may not be true of implementations +which were not derived from SVr4 source. .SH SEE ALSO \fBcurses\fR(3X), \fBcurs_outopts\fR(3X), \fBcurs_refresh\fR(3X) .\"# diff --git a/man/curs_color.3x b/man/curs_color.3x index 18926d92..7ca76907 100644 --- a/man/curs_color.3x +++ b/man/curs_color.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_color.3x,v 1.19 2002/02/16 22:38:32 tom Exp $ +.\" $Id: curs_color.3x,v 1.27 2005/05/15 16:55:36 tom Exp $ .TH curs_color 3X "" +.na +.hy 0 .SH NAME \fBstart_color\fR, \fBinit_pair\fR, @@ -37,6 +39,8 @@ \fBcolor_content\fR, \fBpair_content\fR, \fBCOLOR_PAIR\fR - \fBcurses\fR color manipulation routines +.ad +.hy .SH SYNOPSIS \fB# include \fR .br @@ -64,7 +68,7 @@ color (for the blank field on which the characters are displayed). A programmer initializes a color-pair with the routine \fBinit_pair\fR. After it has been initialized, \fBCOLOR_PAIR\fR(\fIn\fR), a macro defined in \fB\fR, can be used as a new video attribute. - +.SP If a terminal is capable of redefining colors, the programmer can use the routine \fBinit_color\fR to change the definition of a color. The routines \fBhas_colors\fR and \fBcan_change_color\fR return \fBTRUE\fR or \fBFALSE\fR, @@ -84,7 +88,7 @@ and white), and two global variables, \fBCOLORS\fR and and color-pairs the terminal can support). It also restores the colors on the terminal to the values they had when the terminal was just turned on. - +.SP The \fBinit_pair\fR routine changes the definition of a color-pair. It takes three arguments: the number of the color-pair to be changed, the foreground color number, and the background color number. @@ -96,18 +100,20 @@ must be between \fB1\fR and \fBCOLOR_PAIRS-1\fR. .TP 5 - The value of the second and -third arguments must be between 0 and \fBCOLORS\fR (the 0 color pair is wired -to white on black and cannot be changed). +third arguments must be between 0 and \fBCOLORS\fR. +Color pair 0 is assumed to be white on black, +but is actually whatever the terminal implements before color is initialized. +It cannot be modified by the application. .PP If the color-pair was previously initialized, the screen is refreshed and all occurrences of that color-pair are changed to the new definition. - +.SP As an extension, ncurses allows you to set color pair 0 via the \fBassume_default_colors\fR routine, or to specify the use of default colors (color number \fB-1\fR) if you first invoke the \fBuse_default_colors\fR routine. - +.SP The \fBinit_color\fR routine changes the definition of a color. It takes four arguments: the number of the color to be changed followed by three RGB values (for the amounts of red, green, and blue components). The value of the first @@ -116,18 +122,18 @@ argument must be between \fB0\fR and \fBCOLORS\fR. (See the section must be a value between 0 and 1000. When \fBinit_color\fR is used, all occurrences of that color on the screen immediately change to the new definition. - +.SP The \fBhas_colors\fR routine requires no arguments. It returns \fBTRUE\fR if the terminal can manipulate colors; otherwise, it returns \fBFALSE\fR. This routine facilitates writing terminal-independent programs. For example, a programmer can use it to decide whether to use color or some other video attribute. - +.SP The \fBcan_change_color\fR routine requires no arguments. It returns \fBTRUE\fR if the terminal supports colors and can change their definitions; other, it returns \fBFALSE\fR. This routine facilitates writing terminal-independent programs. - +.SP The \fBcolor_content\fR routine gives programmers a way to find the intensity of the red, green, and blue (RGB) components in a color. It requires four arguments: the color number, and three addresses of \fBshort\fRs for storing @@ -136,7 +142,7 @@ given color. The value of the first argument must be between 0 and \fBCOLORS\fR. The values that are stored at the addresses pointed to by the last three arguments are between 0 (no component) and 1000 (maximum amount of component). - +.SP The \fBpair_content\fR routine allows programmers to find out what colors a given color-pair consists of. It requires three arguments: the color-pair number, and two addresses of \fBshort\fRs for storing the foreground and the @@ -147,7 +153,7 @@ to by the second and third arguments are between 0 and \fBCOLORS\fR. In \fB\fR the following macros are defined. These are the default colors. \fBcurses\fR also assumes that \fBCOLOR_BLACK\fR is the default background color for all terminals. - +.SP .nf \fBCOLOR_BLACK\fR \fBCOLOR_RED\fR @@ -161,22 +167,44 @@ background color for all terminals. .SH RETURN VALUE The routines \fBcan_change_color()\fR and \fBhas_colors()\fR return \fBTRUE\fR or \fBFALSE\fR. - +.SP All other routines return the integer \fBERR\fR upon failure and an \fBOK\fR (SVr4 specifies only "an integer value other than \fBERR\fR") upon successful completion. +.PP +X/Open defines no error conditions. +This implementation will return \fBERR\fR on attempts to +use color values outside the range 0 to COLORS-1 +(except for the default colors extension), +or use color pairs outside the range 0 to COLOR_PAIR-1. +Color values used in \fBinit_color\fP must be in the range 0 to 1000. +An error is returned from all functions +if the terminal has not been initialized. +An error is returned from secondary functions such as \fBinit_pair\fP +if \fBstart_color\fP was not called. +.RS +.TP 5 +\fBinit_color\fP +returns an error if the terminal does not support +this feature, e.g., if the \fIinitialize_color\fP capability is absent +from the terminal description. +.TP 5 +\fBstart_color\fP +returns an error +If the color table cannot be allocated. +.RE .SH NOTES In the \fIncurses\fR implementation, there is a separate color activation flag, color palette, color pairs table, and associated COLORS and COLOR_PAIRS counts for each screen; the \fBstart_color\fR function only affects the current screen. The SVr4/XSI interface is not really designed with this in mind, and historical implementations may use a single shared color palette. - +.SP Note that setting an implicit background color via a color pair affects only character cells that a character write operation explicitly touches. To change the background color used when parts of a window are blanked by erasing or scrolling operations, see \fBcurs_bkgd\fR(3X). - +.SP Several caveats apply on 386 and 486 machines with VGA-compatible graphics: .TP 5 - @@ -201,8 +229,12 @@ but only if that routine has been first invoked. .PP The assumption that \fBCOLOR_BLACK\fR is the default background color for all terminals can be modified using the -\fBassume_default_colors\fP extension, - +\fBassume_default_colors\fP extension. +.PP +This implementation checks the pointers, +e.g., for the values returned by +\fBcolor_content\fP and \fBpair_content\fP, +and will treat those as optional parameters when null. .SH SEE ALSO \fBcurses\fR(3X), \fBcurs_initscr\fR(3X), diff --git a/man/curs_deleteln.3x b/man/curs_deleteln.3x index 38a5496a..6a340b15 100644 --- a/man/curs_deleteln.3x +++ b/man/curs_deleteln.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_deleteln.3x,v 1.8 2003/05/10 20:33:49 jmc Exp $ +.\" $Id: curs_deleteln.3x,v 1.9 2005/05/15 16:53:35 tom Exp $ .TH curs_deleteln 3X "" .SH NAME \fBdeleteln\fR, @@ -67,6 +67,10 @@ current line and the bottom line is lost. All routines return the integer \fBERR\fR upon failure and an \fBOK\fR (SVr4 specifies only "an integer value other than \fBERR\fR") upon successful completion. +.PP +X/Open defines no error conditions. +In this implementation, +if the window parameter is null, an error is returned. .SH PORTABILITY These functions are described in the XSI Curses standard, Issue 4. The standard specifies that they return \fBERR\fR on failure, but specifies no diff --git a/man/curs_extend.3x b/man/curs_extend.3x index 8e992e74..a5f187f0 100644 --- a/man/curs_extend.3x +++ b/man/curs_extend.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1999-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1999-2003,2004 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -28,7 +28,7 @@ .\" .\" Author: Thomas E. Dickey 1999 .\" -.\" $Id: curs_extend.3x,v 1.12 2003/10/25 20:33:16 tom Exp $ +.\" $Id: curs_extend.3x,v 1.13 2004/07/05 13:16:08 tom Exp $ .TH curs_extend 3X "" .SH NAME \fBcurses_version\fP, @@ -56,7 +56,7 @@ is able to use user-defined or nonstandard names which may be compiled into the terminfo description, i.e., via the terminfo or termcap interfaces. Normally these names are available for use, since the essential decision -is made by using the \fB\-x\fP option of \fItic\fP to compile +is made by using the \fB-x\fP option of \fItic\fP to compile extended terminal definitions. However you can disable this feature to ensure compatibility with other implementations of curses. diff --git a/man/curs_get_wstr.3x b/man/curs_get_wstr.3x index 86a5b82a..2eaca12c 100644 --- a/man/curs_get_wstr.3x +++ b/man/curs_get_wstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 2002-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_get_wstr.3x,v 1.3 2003/07/05 11:15:28 tom Exp $ +.\" $Id: curs_get_wstr.3x,v 1.5 2005/05/15 16:17:44 tom Exp $ .TH curs_get_wstr 3X "" +.na +.hy 0 .SH NAME \fBget_wstr\fR, \fBgetn_wstr\fR, @@ -37,6 +39,8 @@ \fBmvgetn_wstr\fR, \fBmvwget_wstr\fR, \fBmvwgetn_wstr\fR \- get an array of wide characters from a curses terminal keyboard +.ad +.hy .SH SYNOPSIS .nf \fB#include \fR @@ -143,6 +147,13 @@ All of these routines except \fBwgetn_wstr\fR may be macros. .SH RETURN VALUES All of these functions return \fBOK\fR upon successful completion. Otherwise, they return \fBERR\fR. +.PP +Functions using a window parameter return an error if it is null. +.RS +.TP 5 +\fBwgetn_wstr\fP +returns an error if the associated call to \fBwget_wch\fP failed. +.RE .SH PORTABILITY These functions are described in The Single Unix Specification, Version 2. No error conditions are defined. diff --git a/man/curs_getch.3x b/man/curs_getch.3x index 88003a5d..ce62ed17 100644 --- a/man/curs_getch.3x +++ b/man/curs_getch.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,8 +27,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_getch.3x,v 1.24 2003/12/27 18:46:06 tom Exp $ +.\" $Id: curs_getch.3x,v 1.29 2005/06/25 22:03:09 tom Exp $ .TH curs_getch 3X "" +.na +.hy 0 .SH NAME \fBgetch\fR, \fBwgetch\fR, @@ -36,6 +38,8 @@ \fBmvwgetch\fR, \fBungetch\fR, \fBhas_key\fR \- get (or push back) characters from \fBcurses\fR terminal keyboard +.ad +.hy .SH SYNOPSIS \fB#include \fR .PP @@ -110,7 +114,6 @@ center tab(/) ; l l l l . \fIName\fR/\fIKey\fR \fIname\fR -.PP KEY_BREAK/Break key KEY_DOWN/The four arrow keys ... KEY_UP @@ -223,24 +226,38 @@ The \fBhas_key\fR routine takes a key value from the above list, and returns TRUE or FALSE according to whether the current terminal type recognizes a key with that value. Note that a few values do not correspond to a real key, -e.g., KEY_RESIZE and KEY_MOUSE. +e.g., \fBKEY_RESIZE\fP and \fBKEY_MOUSE\fP. +See \fBresizeterm\fR(3X) for more details about \fBKEY_RESIZE\fP, and +\fBcurs_mouse\fR(3X) for a discussion of \fBKEY_MOUSE\fP. .PP .SH RETURN VALUE All routines return the integer \fBERR\fR upon failure and an integer value other than \fBERR\fR (\fBOK\fR in the case of ungetch()) upon successful completion. +.RS +.TP 5 +\fBungetch\fP +returns an error +if there is no more room in the FIFO. +.TP 5 +\fBwgetch\fP +returns an error +if the window pointer is null, or +if its timeout expires without having any data. +.RE .SH NOTES Use of the escape key by a programmer for a single character function is discouraged, as it will cause a delay of up to one second while the keypad code looks for a following function-key sequence. .PP Note that some keys may be the same as commonly used control -keys, e.g., KEY_ENTER versus control/M, KEY_BACKSPACE versus control/H. +keys, e.g., \fBKEY_ENTER\fP versus control/M, \fBKEY_BACKSPACE\fP versus control/H. Some curses implementations may differ according to whether they treat these control keys specially (and ignore the terminfo), or use the terminfo definitions. \fBNcurses\fR uses the terminfo definition. -If it says that KEY_ENTER is control/M, \fBgetch\fR will return KEY_ENTER +If it says that \fBKEY_ENTER\fP is control/M, +\fBgetch\fR will return \fBKEY_ENTER\fP when you press control/M. .PP When using \fBgetch\fR, \fBwgetch\fR, \fBmvgetch\fR, or @@ -297,7 +314,7 @@ any code using it be conditionalized on the \fBNCURSES_VERSION\fR feature macro. \fBcurs_inopts\fR(3X), \fBcurs_mouse\fR(3X), \fBcurs_move\fR(3X), -\fBcurs_refresh\fR(3X). +\fBcurs_refresh\fR(3X), \fBresizeterm\fR(3X). .\"# .\"# The following sets edit modes for GNU EMACS diff --git a/man/curs_getstr.3x b/man/curs_getstr.3x index ffbd2887..a5f186e8 100644 --- a/man/curs_getstr.3x +++ b/man/curs_getstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_getstr.3x,v 1.12 2003/05/10 20:33:49 jmc Exp $ +.\" $Id: curs_getstr.3x,v 1.14 2005/05/15 16:17:55 tom Exp $ .TH curs_getstr 3X "" +.na +.hy 0 .SH NAME \fBgetstr\fR, \fBgetnstr\fR, @@ -37,6 +39,8 @@ \fBmvgetnstr\fR, \fBmvwgetstr\fR, \fBmvwgetnstr\fR - accept character strings from \fBcurses\fR terminal keyboard +.ad +.hy .SH SYNOPSIS \fB#include \fR @@ -79,6 +83,13 @@ motion). All routines return the integer \fBERR\fR upon failure and an \fBOK\fR (SVr4 specifies only "an integer value other than \fBERR\fR") upon successful completion. +.PP +X/Open defines no error conditions. +.PP +In this implementation, +these functions return an error +if the window pointer is null, or +if its timeout expires without having any data. .SH NOTES Note that \fBgetstr\fR, \fBmvgetstr\fR, and \fBmvwgetstr\fR may be macros. .SH PORTABILITY diff --git a/man/curs_in_wchstr.3x b/man/curs_in_wchstr.3x index 0012789f..5bac9d3d 100644 --- a/man/curs_in_wchstr.3x +++ b/man/curs_in_wchstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 2002 Free Software Foundation, Inc. * +.\" Copyright (c) 2002,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_in_wchstr.3x,v 1.2 2002/05/18 21:48:30 tom Exp $ +.\" $Id: curs_in_wchstr.3x,v 1.5 2005/05/15 16:57:17 tom Exp $ .TH curs_in_wchstr 3X "" +.na +.hy 0 .SH NAME \fBin_wchstr\fR, \fBin_wchnstr\fR, @@ -37,10 +39,12 @@ \fBmvin_wchnstr\fR, \fBmvwin_wchstr\fR, \fBmvwin_wchnstr\fR \- get an array of complex characters and renditions from a curses window +.ad +.hy .SH SYNOPSIS .nf \fB#include \fR - +.sp \fBint in_wchstr(cchar_t *\fR\fIwchstr\fR\fB);\fR .br \fBint in_wchnstr(cchar_t *\fR\fIwchstr\fR\fB, int \fR\fIn\fR\fB);\fR @@ -106,7 +110,7 @@ returning ERR in that case. .SH SEE ALSO Functions: \fBcurses\fR(3X), -\fBcurs_in_wch\fR(3X) +\fBcurs_in_wch\fR(3X), \fBcurs_instr\fR(3X), \fBcurs_inwstr\fR(3X) .\"# diff --git a/man/curs_inchstr.3x b/man/curs_inchstr.3x index 60f9d566..cb91aa44 100644 --- a/man/curs_inchstr.3x +++ b/man/curs_inchstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_inchstr.3x,v 1.8 2000/07/01 20:16:18 tom Exp $ +.\" $Id: curs_inchstr.3x,v 1.10 2005/05/15 16:54:53 tom Exp $ .TH curs_inchstr 3X "" +.na +.hy 0 .SH NAME \fBinchstr\fR, \fBinchnstr\fR, @@ -37,6 +39,8 @@ \fBmvinchnstr\fR, \fBmvwinchstr\fR, \fBmvwinchnstr\fR - get a string of characters (and attributes) from a \fBcurses\fR window +.ad +.hy .SH SYNOPSIS \fB#include \fR @@ -69,6 +73,11 @@ in the \fIchstr\fR [see \fBcurs_inch\fR(3X)]. All routines return the integer \fBERR\fR upon failure and an integer value other than \fBERR\fR upon successful completion (the number of characters retrieved, exclusive of the trailing 0). +.PP +No error conditions are defined. +If the \fIchstr\fP parameter is null, +no data is returned, +and the return value is zero. .SH NOTES Note that all routines except \fBwinchnstr\fR may be macros. SVr4 does not document whether the result string is 0-terminated; it does not document diff --git a/man/curs_initscr.3x b/man/curs_initscr.3x index 02f149df..1a865f94 100644 --- a/man/curs_initscr.3x +++ b/man/curs_initscr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_initscr.3x,v 1.12 2003/05/10 20:33:49 jmc Exp $ +.\" $Id: curs_initscr.3x,v 1.14 2005/05/15 16:18:01 tom Exp $ .TH curs_initscr 3X "" +.na +.hy 0 .SH NAME \fBinitscr\fR, \fBnewterm\fR, @@ -35,9 +37,11 @@ \fBisendwin\fR, \fBset_term\fR, \fBdelscreen\fR - \fBcurses\fR screen initialization and manipulation routines +.ad +.hy .SH SYNOPSIS \fB#include \fR - +.sp \fBWINDOW *initscr(void);\fR .br \fBint endwin(void);\fR @@ -56,13 +60,13 @@ initializing a program. A few special routines sometimes need to be called before it; these are \fBslk_init\fR, \fBfilter\fR, \fBripoffline\fR, \fBuse_env\fR. For multiple-terminal applications, \fBnewterm\fR may be called before \fBinitscr\fR. - +.PP The initscr code determines the terminal type and initializes all \fBcurses\fR data structures. \fBinitscr\fR also causes the first call to \fBrefresh\fR to clear the screen. If errors occur, \fBinitscr\fR writes an appropriate error message to standard error and exits; otherwise, a pointer is returned to \fBstdscr\fR. - +.PP A program that outputs to more than one terminal should use the \fBnewterm\fR routine for each terminal instead of \fBinitscr\fR. A program that needs to inspect capabilities, so it can continue to run in a line-oriented mode if the @@ -76,23 +80,23 @@ is \fBNULL\fR, \fB$TERM\fR will be used). The program must also call \fBendwin\fR for each terminal being used before exiting from \fBcurses\fR. If \fBnewterm\fR is called more than once for the same terminal, the first terminal referred to must be the last one for which \fBendwin\fR is called. - +.PP A program should always call \fBendwin\fR before exiting or escaping from \fBcurses\fR mode temporarily. This routine restores tty modes, moves the cursor to the lower left-hand corner of the screen and resets the terminal into the proper non-visual mode. Calling \fBrefresh\fR or \fBdoupdate\fR after a temporary escape causes the program to resume visual mode. - +.PP The \fBisendwin\fR routine returns \fBTRUE\fR if \fBendwin\fR has been called without any subsequent calls to \fBwrefresh\fR, and \fBFALSE\fR otherwise. - +.PP The \fBset_term\fR routine is used to switch between different terminals. The screen reference \fBnew\fR becomes the new current terminal. The previous terminal is returned by the routine. This is the only routine which manipulates \fBSCREEN\fR pointers; all other routines affect only the current terminal. - +.PP The \fBdelscreen\fR routine frees storage associated with the \fBSCREEN\fR data structure. The \fBendwin\fR routine does not do this, so \fBdelscreen\fR should be called after \fBendwin\fR if a @@ -100,15 +104,19 @@ particular \fBSCREEN\fR is no longer needed. .SH RETURN VALUE \fBendwin\fR returns the integer \fBERR\fR upon failure and \fBOK\fR upon successful completion. - +.PP Routines that return pointers always return \fBNULL\fR on error. +.PP +X/Open defines no error conditions. +In this implementation +\fBendwin\fP returns an error if the terminal was not initialized. .SH NOTES Note that \fBinitscr\fR and \fBnewterm\fR may be macros. .SH PORTABILITY These functions are described in the XSI Curses standard, Issue 4. It specifies that portable applications must not call \fBinitscr\fR more than once. - +.PP Old versions of curses, e.g., BSD 4.4, may have returned a null pointer from \fBinitscr\fR when an error is detected, rather than exiting. It is safe but redundant to check the return value of \fBinitscr\fR diff --git a/man/curs_inopts.3x b/man/curs_inopts.3x index 24a9bd61..7b5a17b8 100644 --- a/man/curs_inopts.3x +++ b/man/curs_inopts.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,14 +26,30 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_inopts.3x,v 1.11 2003/12/27 18:45:42 tom Exp $ +.\" $Id: curs_inopts.3x,v 1.13 2005/05/15 16:18:07 tom Exp $ .TH curs_inopts 3X "" +.na +.hy 0 .SH NAME -\fBcbreak\fR, \fBnocbreak\fR, \fBecho\fR, -\fBnoecho\fR, \fBhalfdelay\fR, \fBintrflush\fR, \fBkeypad\fR, -\fBmeta\fR, \fBnodelay\fR, \fBnotimeout\fR, \fBraw\fR, \fBnoraw\fR, -\fBnoqiflush\fR, \fBqiflush\fR, \fBtimeout\fR, \fBwtimeout\fR, +\fBcbreak\fR, +\fBnocbreak\fR, +\fBecho\fR, +\fBnoecho\fR, +\fBhalfdelay\fR, +\fBintrflush\fR, +\fBkeypad\fR, +\fBmeta\fR, +\fBnodelay\fR, +\fBnotimeout\fR, +\fBraw\fR, +\fBnoraw\fR, +\fBnoqiflush\fR, +\fBqiflush\fR, +\fBtimeout\fR, +\fBwtimeout\fR, \fBtypeahead\fR - \fBcurses\fR input options +.ad +.hy .SH SYNOPSIS \fB#include \fR .PP @@ -186,6 +202,18 @@ The \fBtypeahead\fR routine specifies that the file descriptor All routines that return an integer return \fBERR\fR upon failure and OK (SVr4 specifies only "an integer value other than \fBERR\fR") upon successful completion, unless otherwise noted in the preceding routine descriptions. +.PP +X/Open does not define any error conditions. +In this implementation, +functions with a window parameter will return an error if it is null. +Any function will also return an error if the terminal was not initialized. +Also, +.RS +.TP 5 +\fBhalfdelay\fP +returns an error +if its parameter is outside the range 1..255. +.RE .SH PORTABILITY These functions are described in the XSI Curses standard, Issue 4. .PP diff --git a/man/curs_ins_wstr.3x b/man/curs_ins_wstr.3x index 197f30f5..0c153c4c 100644 --- a/man/curs_ins_wstr.3x +++ b/man/curs_ins_wstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 2002 Free Software Foundation, Inc. * +.\" Copyright (c) 2002,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_ins_wstr.3x,v 1.2 2002/03/10 23:43:27 tom Exp $ +.\" $Id: curs_ins_wstr.3x,v 1.4 2005/05/15 17:02:54 tom Exp $ .TH curs_ins_wstr 3X "" +.na +.hy 0 .SH NAME \fBins_wstr\fR, \fBins_nwstr\fR, @@ -37,10 +39,12 @@ \fBmvins_nwstr\fR, \fBmvwins_wstr\fR, \fBmvwins_nwstr\fR \- insert a wide-character string into a curses window +.ad +.hy .SH SYNOPSIS .nf \fB#include \fR - +.sp \fBint ins_wstr(const wchar_t *\fR\fIwstr);\fR .br \fBint ins_nwstr(const wchar_t *\fR\fIwstr\fR\fB, int \fR\fIn\fR\fB);\fR @@ -69,7 +73,7 @@ The cursor position does not change The four routines with \fIn\fR as the last argument insert a leading substring of at most \fIn\fR \fBwchar_t\fR characters. If \fIn\fR is less than 1, the entire string is inserted. - +.PP If a character in \fIwstr\fR is a tab, newline, carriage return or backspace, the cursor is moved appropriately within the window. A newline also does a \fBclrtoeol\fR before moving. @@ -83,7 +87,7 @@ but instead returns a character in the ^-representation of the control character. .SH NOTES Note that all but wins_nwstr may be macros. - +.PP If the first character in the string is a nonspacing character, these functions will fail. XSI does not define what will happen if a nonspacing character follows diff --git a/man/curs_insstr.3x b/man/curs_insstr.3x index ed1e13ea..4166fc30 100644 --- a/man/curs_insstr.3x +++ b/man/curs_insstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_insstr.3x,v 1.12 2001/11/03 19:59:03 tom Exp $ +.\" $Id: curs_insstr.3x,v 1.16 2005/05/15 17:48:33 tom Exp $ .TH curs_insstr 3X "" .SH NAME \fBinsstr\fR, @@ -57,36 +57,42 @@ \fBint mvwinsnstr(WINDOW *win, int y, int x, const char *str, int n);\fR .br .SH DESCRIPTION -These routines insert a character string (as many characters as will fit on the -line) before the character under the cursor. All characters to the right of -the cursor are shifted right, with the possibility of the rightmost characters -on the line being lost. The cursor position does not change (after moving to -\fIy\fR, \fIx\fR, if specified). The four routines with \fIn\fR as the last -argument insert a leading substring of at most \fIn\fR characters. If -\fIn\fR<=0, then the entire string is inserted. +These routines insert a character string +(as many characters as will fit on the line) +before the character under the cursor. +All characters to the right of the cursor are shifted right +with the possibility of the rightmost characters on the line being lost. +The cursor position does not change +(after moving to \fIy\fR, \fIx\fR, if specified). +The functions with \fIn\fR as the last argument +insert a leading substring of at most \fIn\fR characters. +If \fIn\fR<=0, then the entire string is inserted. -If a character in \fIstr\fR is a tab, newline, carriage return or -backspace, the cursor is moved appropriately within the window. A -newline also does a \fBclrtoeol\fR before moving. Tabs are considered -to be at every eighth column. If a character in \fIstr\fR is another -control character, it is drawn in the \fB^\fR\fIX\fR notation. -Calling \fBwinch\fR after adding a control character (and moving to -it, if necessary) does not return the control character, but instead -returns a character in the ^-representation of the control character. +Special characters are handled as in \fBaddch\fP. .SH RETURN VALUE All routines that return an integer return \fBERR\fR upon failure and OK (SVr4 specifies only "an integer value other than \fBERR\fR") upon successful completion, unless otherwise noted in the preceding routine descriptions. +.PP +X/Open defines no error conditions. +In this implementation, +if the window parameter is null or the str parameter is null, +an error is returned. .SH NOTES Note that all but \fBwinsnstr\fR may be macros. .SH PORTABILITY These functions are described in the XSI Curses standard, Issue 4, which adds -const qualifiers to the arguments. The XSI Curses error conditions -\fBEILSEQ\fR and \fBEILOVERFLOW\fR associated with extended-level conformance -are not yet detected (this implementation does not yet support XPG4 multibyte -characters). +const qualifiers to the arguments. +.LP +The Single Unix Specification, Version 2 states that +\fBinsnstr\fP and \fBwinsnstr\fP perform wrapping. +This is probably an error, since it makes this group of functions inconsistent. +Also, no implementation of curses documents this inconsistency. .SH SEE ALSO -\fBcurses\fR(3X), \fBcurs_clear\fR(3X), \fBcurs_inch\fR(3X). +\fBcurses\fR(3X), +\fBunctrl\fR(3X), +\fBcurs_clear\fR(3X), +\fBcurs_inch\fR(3X). .\"# .\"# The following sets edit modes for GNU EMACS .\"# Local Variables: diff --git a/man/curs_instr.3x b/man/curs_instr.3x index 9a09ab27..38205a66 100644 --- a/man/curs_instr.3x +++ b/man/curs_instr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. * +.\" Copyright (c) 1998,2001,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_instr.3x,v 1.10 2001/11/03 19:58:56 tom Exp $ +.\" $Id: curs_instr.3x,v 1.12 2005/05/15 17:48:23 tom Exp $ .TH curs_instr 3X "" .SH NAME \fBinstr\fR, @@ -65,13 +65,14 @@ functions with \fIn\fR as the last argument return a leading substring at most .SH RETURN VALUE All of the functions return \fBERR\fR upon failure, or the number of characters actually read into the string. +.PP +X/Open defines no error conditions. +In this implementation, +if the window parameter is null or the str parameter is null, +a zero is returned. .SH NOTES Note that all routines except \fBwinnstr\fR may be macros. .SH PORTABILITY -The XSI Curses -error conditions \fBEILSEQ\fR and \fBEILOVERFLOW\fR associated with -extended-level conformance are not yet detected (this implementation does not -yet support XPG4 multibyte characters). SVr4 does not document whether a length limit includes or excludes the trailing NUL. .PP diff --git a/man/curs_inwstr.3x b/man/curs_inwstr.3x index b345ce6e..d53908b3 100644 --- a/man/curs_inwstr.3x +++ b/man/curs_inwstr.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 2002 Free Software Foundation, Inc. * +.\" Copyright (c) 2002-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,10 +26,9 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_inwstr.3x,v 1.2 2002/04/13 20:25:35 tom Exp $ -.TH curs_inwstr 3 "" +.\" $Id: curs_inwstr.3x,v 1.4 2005/06/25 18:31:26 Daniel.Jacobowitz Exp $ +.TH curs_inwstr 3X "" .SH NAME -.PP \fBinwstr\fR, \fBinnwstr\fR, \fBwinwstr\fR, diff --git a/man/curs_kernel.3x b/man/curs_kernel.3x index caeb5bba..94039738 100644 --- a/man/curs_kernel.3x +++ b/man/curs_kernel.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2001,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,16 +26,27 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_kernel.3x,v 1.13 2001/12/08 18:01:25 tom Exp $ +.\" $Id: curs_kernel.3x,v 1.15 2005/05/15 16:18:13 tom Exp $ .TH curs_kernel 3X "" +.na +.hy 0 .SH NAME -\fBdef_prog_mode\fR, \fBdef_shell_mode\fR, -\fBreset_prog_mode\fR, \fBreset_shell_mode\fR, \fBresetty\fR, -\fBsavetty\fR, \fBgetsyx\fR, \fBsetsyx\fR, \fBripoffline\fR, -\fBcurs_set\fR, \fBnapms\fR - low-level \fBcurses\fR routines +\fBdef_prog_mode\fR, +\fBdef_shell_mode\fR, +\fBreset_prog_mode\fR, +\fBreset_shell_mode\fR, +\fBresetty\fR, +\fBsavetty\fR, +\fBgetsyx\fR, +\fBsetsyx\fR, +\fBripoffline\fR, +\fBcurs_set\fR, +\fBnapms\fR - low-level \fBcurses\fR routines +.ad +.hy .SH SYNOPSIS \fB#include \fR - +.sp \fBint def_prog_mode(void);\fR .br \fBint def_shell_mode(void);\fR @@ -62,32 +73,32 @@ The following routines give low-level access to various \fBcurses\fR capabilities. Theses routines typically are used inside library routines. - +.PP The \fBdef_prog_mode\fR and \fBdef_shell_mode\fR routines save the current terminal modes as the "program" (in \fBcurses\fR) or "shell" (not in \fBcurses\fR) state for use by the \fBreset_prog_mode\fR and \fBreset_shell_mode\fR routines. This is done automatically by \fBinitscr\fR. There is one such save area for each screen context allocated by \fBnewterm()\fR. - +.PP The \fBreset_prog_mode\fR and \fBreset_shell_mode\fR routines restore the terminal to "program" (in \fBcurses\fR) or "shell" (out of \fBcurses\fR) state. These are done automatically by \fBendwin\fR and, after an \fBendwin\fR, by \fBdoupdate\fR, so they normally are not called. - +.PP The \fBresetty\fR and \fBsavetty\fR routines save and restore the state of the terminal modes. \fBsavetty\fR saves the current state in a buffer and \fBresetty\fR restores the state to what it was at the last call to \fBsavetty\fR. - +.PP The \fBgetsyx\fR routine returns the current coordinates of the virtual screen cursor in \fIy\fR and \fIx\fR. If \fBleaveok\fR is currently \fBTRUE\fR, then \fB-1\fR,\fB-1\fR is returned. If lines have been removed from the top of the screen, using \fBripoffline\fR, \fIy\fR and \fIx\fR include these lines; therefore, \fIy\fR and \fIx\fR should be used only as arguments for \fBsetsyx\fR. - +.PP The \fBsetsyx\fR routine sets the virtual screen cursor to \fIy\fR, \fIx\fR. If \fIy\fR and \fIx\fR are both \fB-1\fR, then \fBleaveok\fR is set. The two routines \fBgetsyx\fR and \fBsetsyx\fR @@ -97,7 +108,7 @@ of the program's cursor. The library routine would call \fBgetsyx\fR at the beginning, do its manipulation of its own windows, do a \fBwnoutrefresh\fR on its windows, call \fBsetsyx\fR, and then call \fBdoupdate\fR. - +.PP The \fBripoffline\fR routine provides access to the same facility that \fBslk_init\fR [see \fBcurs_slk\fR(3X)] uses to reduce the size of the screen. \fBripoffline\fR must be called before \fBinitscr\fR or @@ -112,29 +123,45 @@ and \fBCOLS\fR (defined in \fB\fR) are not guaranteed to be accurate and \fBwrefresh\fR or \fBdoupdate\fR must not be called. It is allowable to call \fBwnoutrefresh\fR during the initialization routine. - +.PP \fBripoffline\fR can be called up to five times before calling \fBinitscr\fR or \fBnewterm\fR. - +.PP The \fBcurs_set\fR routine sets the cursor state is set to invisible, normal, or very visible for \fBvisibility\fR equal to \fB0\fR, \fB1\fR, or \fB2\fR respectively. If the terminal supports the \fIvisibility\fR requested, the previous \fIcursor\fR state is returned; otherwise, \fBERR\fR is returned. - +.PP The \fBnapms\fR routine is used to sleep for \fIms\fR milliseconds. .SH RETURN VALUE Except for \fBcurs_set\fR, these routines always return \fBOK\fR. -\fBcurs_set\fR returns the previous cursor state, or \fBERR\fR if the +.PP +\fBcurs_set\fR +returns the previous cursor state, or \fBERR\fR if the requested \fIvisibility\fR is not supported. +.PP +X/Open defines no error conditions. +In this implementation +.RS +.TP 5 +\fBdef_prog_mode\fR, \fBdef_shell_mode\fR, \fBreset_prog_mode\fR, \fBreset_shell_mode\fR +return an error +if the terminal was not initialized, or +if the I/O call to obtain the terminal settings fails. +.TP 5 +\fBripoffline\fP +returns an error if the maximum number of ripped-off lines +exceeds the maximum (NRIPS = 5). +.RE .SH NOTES Note that \fBgetsyx\fR is a macro, so \fB&\fR is not necessary before the variables \fIy\fR and \fIx\fR. - +.PP Older SVr4 man pages warn that the return value of \fBcurs_set\fR "is currently incorrect". This implementation gets it right, but it may be unwise to count on the correctness of the return value anywhere else. - +.PP Both ncurses and SVr4 will call \fBcurs_set\fR in \fBendwin\fR if \fBcurs_set\fR has been called to make the cursor other than normal, i.e., either @@ -144,7 +171,7 @@ restore that. .SH PORTABILITY The functions \fBsetsyx\fR and \fBgetsyx\fR are not described in the XSI Curses standard, Issue 4. All other functions are as described in XSI Curses. - +.PP The SVr4 documentation describes \fBsetsyx\fR and \fBgetsyx\fR as having return type int. This is misleading, as they are macros with no documented semantics for the return value. diff --git a/man/curs_mouse.3x b/man/curs_mouse.3x index b1550762..865fab1a 100644 --- a/man/curs_mouse.3x +++ b/man/curs_mouse.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,13 +27,17 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_mouse.3x,v 1.24 2003/12/27 18:47:54 tom Exp $ +.\" $Id: curs_mouse.3x,v 1.28 2005/05/15 16:18:19 tom Exp $ .TH curs_mouse 3X "" +.na +.hy 0 .SH NAME \fBgetmouse\fR, \fBungetmouse\fR, \fBmousemask\fR, \fBwenclose\fR, \fBmouse_trafo\fR, \fBwmouse_trafo\fR, \fBmouseinterval\fR - mouse interface through curses +.ad +.hy .SH SYNOPSIS .nf \fB#include @@ -85,7 +89,7 @@ As a side effect, setting a zero mousemask may turn off the mouse pointer; setting a nonzero mask may turn it on. Whether this happens is device-dependent. .PP -Here are the mouse event type masks: +Here are the mouse event type masks which may be defined: .PP .TS l l @@ -97,26 +101,37 @@ BUTTON1_RELEASED mouse button 1 up BUTTON1_CLICKED mouse button 1 clicked BUTTON1_DOUBLE_CLICKED mouse button 1 double clicked BUTTON1_TRIPLE_CLICKED mouse button 1 triple clicked +_ BUTTON2_PRESSED mouse button 2 down BUTTON2_RELEASED mouse button 2 up BUTTON2_CLICKED mouse button 2 clicked BUTTON2_DOUBLE_CLICKED mouse button 2 double clicked BUTTON2_TRIPLE_CLICKED mouse button 2 triple clicked +_ BUTTON3_PRESSED mouse button 3 down BUTTON3_RELEASED mouse button 3 up BUTTON3_CLICKED mouse button 3 clicked BUTTON3_DOUBLE_CLICKED mouse button 3 double clicked BUTTON3_TRIPLE_CLICKED mouse button 3 triple clicked +_ BUTTON4_PRESSED mouse button 4 down BUTTON4_RELEASED mouse button 4 up BUTTON4_CLICKED mouse button 4 clicked BUTTON4_DOUBLE_CLICKED mouse button 4 double clicked BUTTON4_TRIPLE_CLICKED mouse button 4 triple clicked +_ +BUTTON5_PRESSED mouse button 5 down +BUTTON5_RELEASED mouse button 5 up +BUTTON5_CLICKED mouse button 5 clicked +BUTTON5_DOUBLE_CLICKED mouse button 5 double clicked +BUTTON5_TRIPLE_CLICKED mouse button 5 triple clicked +_ BUTTON_SHIFT shift was down during button state change BUTTON_CTRL control was down during button state change BUTTON_ALT alt was down during button state change ALL_MOUSE_EVENTS report all button state changes REPORT_MOUSE_POSITION report mouse movement +_ .TE .PP Once a class of mouse events have been made visible in a window, @@ -172,8 +187,9 @@ successful. The \fBmouseinterval\fR function sets the maximum time (in thousands of a second) that can elapse between press and release events for them to be recognized as a click. -Use \fBmouseinterval(-1)\fR to disable click resolution. +Use \fBmouseinterval(0)\fR to disable click resolution. This function returns the previous interval value. +Use \fBmouseinterval(-1)\fR to obtain the interval without altering it. The default is one sixth of a second. .PP Note that mouse events will be ignored when input is in cooked mode, and will @@ -181,11 +197,28 @@ cause an error beep when cooked mode is being simulated in a window by a function such as \fBgetstr\fR that expects a linefeed for input-loop termination. .SH RETURN VALUE -\fBgetmouse\fR, \fBungetmouse\fR and \fBmouseinterval\fR +\fBgetmouse\fR and \fBungetmouse\fR return the integer \fBERR\fR upon failure or \fBOK\fR upon successful completion. -\fBmousemask\fR returns the -mask of reportable events. +.RS +.TP 5 +\fBgetmouse\fP +returns an error. +If no mouse driver was initialized, or +if the mask parameter is zero, +.TP 5 +\fBungetmouse\fP +returns an error if the FIFO is full. +.RE +.PP +\fBmousemask\fR +returns the mask of reportable events. +.PP +\fBmouseinterval\fR +returns the previous interval value, unless +the terminal was not initialized. +In that case, it returns the maximum interval value (166). +.PP \fBwenclose\fR and \fBwmouse_trafo\fR are boolean functions returning \fBTRUE\fR or \fBFALSE\fR depending on their test result. @@ -194,9 +227,22 @@ These calls were designed for \fBncurses\fR(3X), and are not found in SVr4 curses, 4.4BSD curses, or any other previous version of curses. .PP The feature macro \fBNCURSES_MOUSE_VERSION\fR is provided so the preprocessor -can be used to test whether these features are present (its value is 1). +can be used to test whether these features are present. If the interface is changed, the value of \fBNCURSES_MOUSE_VERSION\fR will be incremented. +These values for \fBNCURSES_MOUSE_VERSION\fR may be +specified when configuring ncurses: +.RS +.TP 3 +1 +has definitions for reserved events. +The mask uses 28 bits. +.TP 3 +2 +adds definitions for button 5, +removes the definitions for reserved events. +The mask uses 29 bits. +.RE .PP The order of the \fBMEVENT\fR structure members is not guaranteed. Additional fields may be added to the structure in the future. diff --git a/man/curs_move.3x b/man/curs_move.3x index 2fff160c..e66e93b2 100644 --- a/man/curs_move.3x +++ b/man/curs_move.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998,2001 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2001,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,10 +26,15 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_move.3x,v 1.7 2001/11/03 19:58:47 tom Exp $ +.\" $Id: curs_move.3x,v 1.11 2005/05/15 17:36:19 tom Exp $ .TH curs_move 3X "" +.na +.hy 0 .SH NAME -\fBmove\fR, \fBwmove\fR - move \fBcurses\fR window cursor +\fBmove\fR, +\fBwmove\fR - move \fBcurses\fR window cursor +.ad +.hy .SH SYNOPSIS \fB#include \fR @@ -46,13 +51,14 @@ left-hand corner of the window, which is (0,0). These routines return \fBERR\fR upon failure and OK (SVr4 specifies only "an integer value other than \fBERR\fR") upon successful completion. +.PP +Specifically, they return an error +if the window pointer is null, or +if the position is outside the window. .SH NOTES Note that \fBmove\fR may be a macro. .SH PORTABILITY -These functions are described in the XSI Curses standard, Issue 4. The -standard specifies that if (y,x) is within a multi-column character, the cursor -is moved to the first column of that character; however, this implementation -does not yet support the extended-level XSI multibyte characters. +These functions are described in the XSI Curses standard, Issue 4. .SH SEE ALSO \fBcurses\fR(3X), \fBcurs_refresh\fR(3X) .\"# diff --git a/man/curs_outopts.3x b/man/curs_outopts.3x index c5b518c1..5b986bbd 100644 --- a/man/curs_outopts.3x +++ b/man/curs_outopts.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2001,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,15 +26,26 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_outopts.3x,v 1.18 2003/05/10 20:33:49 jmc Exp $ +.\" $Id: curs_outopts.3x,v 1.20 2005/05/15 16:18:32 tom Exp $ .TH curs_outopts 3X "" +.na +.hy 0 .SH NAME -\fBclearok\fR, \fBidlok\fR, \fBidcok\fR, \fBimmedok\fR, -\fBleaveok\fR, \fBsetscrreg\fR, \fBwsetscrreg\fR, \fBscrollok\fR, -\fBnl\fR, \fBnonl\fR - \fBcurses\fR output options +\fBclearok\fR, +\fBidlok\fR, +\fBidcok\fR, +\fBimmedok\fR, +\fBleaveok\fR, +\fBsetscrreg\fR, +\fBwsetscrreg\fR, +\fBscrollok\fR, +\fBnl\fR, +\fBnonl\fR - \fBcurses\fR output options +.ad +.hy .SH SYNOPSIS \fB#include \fR - +.sp \fBint clearok(WINDOW *win, bool bf);\fR .br \fBint idlok(WINDOW *win, bool bf);\fR @@ -60,7 +71,7 @@ These routines set options that change the style of output within \fBcurses\fR. All options are initially \fBFALSE\fR, unless otherwise stated. It is not necessary to turn these options off before calling \fBendwin\fR. - +.PP If \fBclearok\fR is called with \fBTRUE\fR as argument, the next call to \fBwrefresh\fR with this window will clear the screen completely and redraw the entire screen from scratch. @@ -70,7 +81,7 @@ If the \fIwin\fR argument to \fBclearok\fR is the global variable \fBcurscr\fR, the next call to \fBwrefresh\fR with any window causes the screen to be cleared and repainted from scratch. - +.PP If \fBidlok\fR is called with \fBTRUE\fR as second argument, \fBcurses\fR considers using the hardware insert/delete line feature of terminals so equipped. @@ -83,28 +94,28 @@ disabled by default because insert/delete line tends to be visually annoying when used in applications where it isn't really needed. If insert/delete line cannot be used, \fBcurses\fR redraws the changed portions of all lines. - +.PP If \fBidcok\fR is called with \fBFALSE\fR as second argument, \fBcurses\fR no longer considers using the hardware insert/delete character feature of terminals so equipped. Use of character insert/delete is enabled by default. Calling \fBidcok\fR with \fBTRUE\fR as second argument re-enables use of character insertion and deletion. - +.PP If \fBimmedok\fR is called with \fBTRUE as argument\fR, any change in the window image, such as the ones caused by \fBwaddch, wclrtobot, wscrl\fR, etc., automatically cause a call to \fBwrefresh\fR. However, it may degrade performance considerably, due to repeated calls to \fBwrefresh\fR. It is disabled by default. - +.PP Normally, the hardware cursor is left at the location of the window cursor being refreshed. The \fBleaveok\fR option allows the cursor to be left wherever the update happens to leave it. It is useful for applications where the cursor is not used, since it reduces the need for cursor motions. - +.PP The \fBsetscrreg\fR and \fBwsetscrreg\fR routines allow the application programmer to set a software scrolling region in a window. \fItop\fR and @@ -121,7 +132,7 @@ terminal, like that in the VT100. If \fBidlok\fR is enabled and the terminal has either a scrolling region or insert/delete line capability, they will probably be used by the output routines.) - +.PP The \fBscrollok\fR option controls what happens when the cursor of a window is moved off the edge of the window or scrolling region, either as a result of a newline action on the bottom line, or typing the last character of the last @@ -131,7 +142,7 @@ line. If enabled, (\fIbf\fR is \fBTRUE\fR), the window is scrolled up one line (Note that to get the physical scrolling effect on the terminal, it is also necessary to call \fBidlok\fR). - +.PP The \fBnl\fR and \fBnonl\fR routines control whether the underlying display device translates the return key into newline on input, and whether it translates newline into return and line-feed on output (in either case, the @@ -148,30 +159,48 @@ The functions \fBsetscrreg\fR and \fBwsetscrreg\fR return \fBOK\fR upon success and \fBERR\fR upon failure. All other routines that return an integer always return \fBOK\fR. +.PP +X/Open does not define any error conditions. +.PP +In this implementation, those functions that have a window pointer +will return an error if the window pointer is null. +.RS +.TP 5 +.B wclrtoeol +returns an error +if the cursor position is about to wrap. +.TP 5 +.B wsetscrreg +returns an error if the scrolling region limits extend outside the window. +.RE +.PP +X/Open does not define any error conditions. +This implementation returns an error +if the window pointer is null. .SH PORTABILITY These functions are described in the XSI Curses standard, Issue 4. - +.PP The XSI Curses standard is ambiguous on the question of whether \fBraw\fR() should disable the CRLF translations controlled by \fBnl\fR() and \fBnonl\fR(). BSD curses did turn off these translations; AT&T curses (at least as late as SVr1) did not. We choose to do so, on the theory that a programmer requesting raw input wants a clean (ideally 8-bit clean) connection that the operating -system does not mess with. - +system will not alter. +.PP Some historic curses implementations had, as an undocumented feature, the ability to do the equivalent of \fBclearok(..., 1)\fR by saying \fBtouchwin(stdscr)\fR or \fBclear(stdscr)\fR. This will not work under ncurses. - +.PP Earlier System V curses implementations specified that with \fBscrollok\fR enabled, any window modification triggering a scroll also forced a physical refresh. XSI Curses does not require this, and \fBncurses\fR avoids doing it to perform better vertical-motion optimization at \fBwrefresh\fR time. - +.PP The XSI Curses standard does not mention that the cursor should be made invisible as a side-effect of \fBleaveok\fR. SVr4 curses documentation does this, but the code does not. @@ -179,7 +208,7 @@ Use \fBcurs_set\fR to make the cursor invisible. .SH NOTES Note that \fBclearok\fR, \fBleaveok\fR, \fBscrollok\fR, \fBidcok\fR, \fBnl\fR, \fBnonl\fR and \fBsetscrreg\fR may be macros. - +.PP The \fBimmedok\fR routine is useful for windows that are used as terminal emulators. .SH SEE ALSO diff --git a/man/curs_overlay.3x b/man/curs_overlay.3x index 3d817d41..2a5e3cab 100644 --- a/man/curs_overlay.3x +++ b/man/curs_overlay.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,16 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_overlay.3x,v 1.11 2002/07/20 14:53:00 tom Exp $ +.\" $Id: curs_overlay.3x,v 1.13 2005/05/15 16:18:38 tom Exp $ .TH curs_overlay 3X "" +.na +.hy 0 .SH NAME \fBoverlay\fR, \fBoverwrite\fR, \fBcopywin\fR - overlay and manipulate overlapped \fBcurses\fR windows +.ad +.hy .SH SYNOPSIS \fB#include \fR @@ -60,6 +64,13 @@ argument \fIoverlay\fR is \fBtrue\fR, then copying is non-destructive, as in Routines that return an integer return \fBERR\fR upon failure, and \fBOK\fR (SVr4 only specifies "an integer value other than \fBERR\fR") upon successful completion. +.PP +X/Open defines no error conditions. +In this implementation, +\fBcopywin\fP, +\fBoverlay\fP and \fBoverwrite\fP return an error +if either of the window pointers are null, or +if some part of the window would be placed off-screen. .SH NOTES Note that \fBoverlay\fR and \fBoverwrite\fR may be macros. .SH PORTABILITY diff --git a/man/curs_pad.3x b/man/curs_pad.3x index 4db08dcf..c7222074 100644 --- a/man/curs_pad.3x +++ b/man/curs_pad.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,12 +26,19 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_pad.3x,v 1.12 2004/01/04 01:36:49 tom Exp $ +.\" $Id: curs_pad.3x,v 1.14 2005/05/15 16:18:43 tom Exp $ .TH curs_pad 3X "" +.na +.hy 0 .SH NAME -\fBnewpad\fR, \fBsubpad\fR, \fBprefresh\fR, +\fBnewpad\fR, +\fBsubpad\fR, +\fBprefresh\fR, \fBpnoutrefresh\fR, -\fBpechochar\fR, \fBpecho_wchar\fR - create and display \fBcurses\fR pads +\fBpechochar\fR, +\fBpecho_wchar\fR - create and display \fBcurses\fR pads +.ad +.hy .SH SYNOPSIS \fB#include \fR .sp @@ -119,6 +126,28 @@ completion. .PP Routines that return pointers return \fBNULL\fR on error, and set \fBerrno\fR to \fBENOMEM\fR. +.PP +X/Open does not define any error conditions. +In this implementation +.RS +.TP 5 +\fBprefresh\fP and \fBpnoutrefresh\fP +return an error +if the window pointer is null, or +if the window is not really a pad or +if the area to refresh extends off-screen or +if the minimum coordinates are greater than the maximum. +.TP 5 +\fBpechochar\fP +returns an error +if the window is not really a pad, and the associated call +to \fBwechochar\fP returns an error. +.TP 5 +\fBpecho_wchar\fP +returns an error +if the window is not really a pad, and the associated call +to \fBwecho_wchar\fP returns an error. +.RE .SH NOTES Note that \fBpechochar\fR may be a macro. .SH PORTABILITY diff --git a/man/curs_print.3x b/man/curs_print.3x index 3077d347..3136d182 100644 --- a/man/curs_print.3x +++ b/man/curs_print.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_print.3x,v 1.6 2003/05/10 20:33:49 jmc Exp $ +.\" $Id: curs_print.3x,v 1.7 2005/05/15 15:59:36 tom Exp $ .TH curs_print 3X "" .SH NAME \fBmcprint\fR - ship binary data to printer @@ -51,7 +51,7 @@ for some reason. In this case, errno will contain either an error associated with \fBwrite(2)\fR or one of the following: .TP 5 ENODEV -Capabilities for printer redirection don't exist. +Capabilities for printer redirection do not exist. .TP 5 ENOMEM Couldn't allocate sufficient memory to buffer the printer write. diff --git a/man/curs_printw.3x b/man/curs_printw.3x index f16e2fe0..ecb9d171 100644 --- a/man/curs_printw.3x +++ b/man/curs_printw.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,14 +26,18 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_printw.3x,v 1.13 2002/11/16 22:28:57 tom Exp $ +.\" $Id: curs_printw.3x,v 1.15 2005/05/15 16:55:16 tom Exp $ .TH curs_printw 3X "" +.na +.hy 0 .SH NAME \fBprintw\fR, \fBwprintw\fR, \fBmvprintw\fR, \fBmvwprintw\fR, \fBvwprintw\fR, \fBvw_printw\fR - print formatted output in \fBcurses\fR windows +.ad +.hy .SH SYNOPSIS \fB#include \fR @@ -64,6 +68,12 @@ list of arguments, as defined in \fB\fR. Routines that return an integer return \fBERR\fR upon failure and \fBOK\fR (SVr4 only specifies "an integer value other than \fBERR\fR") upon successful completion. +.PP +X/Open defines no error conditions. +In this implementation, +an error may be returned if it cannot allocate enough memory for the +buffer used to format the results. +It will return an error if the window pointer is null. .SH PORTABILITY The XSI Curses standard, Issue 4 describes these functions. The function \fBvwprintw\fR is marked TO BE WITHDRAWN, and is to be replaced by a function diff --git a/man/curs_refresh.3x b/man/curs_refresh.3x index 210b326a..5ce06903 100644 --- a/man/curs_refresh.3x +++ b/man/curs_refresh.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2001,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_refresh.3x,v 1.10 2001/11/03 18:57:12 tom Exp $ +.\" $Id: curs_refresh.3x,v 1.12 2005/05/15 16:18:49 tom Exp $ .TH curs_refresh 3X "" +.na +.hy 0 .SH NAME \fBdoupdate\fR, \fBredrawwin\fR, @@ -35,9 +37,11 @@ \fBwnoutrefresh\fR, \fBwredrawln\fR, \fBwrefresh\fR - refresh \fBcurses\fR windows and lines +.ad +.hy .SH SYNOPSIS \fB#include \fR - +.sp \fBint refresh(void);\fR .br \fBint wrefresh(WINDOW *win);\fR @@ -62,14 +66,14 @@ same, using \fBstdscr\fR as the default window. Unless \fBleaveok\fR has been enabled, the physical cursor of the terminal is left at the location of the cursor for that window. - +.PP The \fBwnoutrefresh\fR and \fBdoupdate\fR routines allow multiple updates with more efficiency than \fBwrefresh\fR alone. In addition to all the window structures, \fBcurses\fR keeps two data structures representing the terminal screen: a physical screen, describing what is actually on the screen, and a virtual screen, describing what the programmer wants to have on the screen. - +.PP The routine \fBwrefresh\fR works by first calling \fBwnoutrefresh\fR, which copies the named window to the virtual screen, and then calling \fBdoupdate\fR, which compares the virtual screen to the physical screen and does the actual @@ -84,7 +88,7 @@ characters transmitted and less CPU time used. If the \fIwin\fR argument to \fBwrefresh\fR is the global variable \fBcurscr\fR, the screen is immediately cleared and repainted from scratch. - +.PP The phrase "copies the named window to the virtual screen" above is ambiguous. What actually happens is that all \fItouched\fR (changed) lines in the window are copied to the virtual screen. @@ -94,7 +98,7 @@ order and the overlap region will be modified only when it is explicitly changed. (But see the section on \fBPORTABILITY\fR below for a warning about exploiting this behavior.) - +.PP The \fBwredrawln\fR routine indicates to \fBcurses\fR that some screen lines are corrupted and should be thrown away before anything is written over them. It touches the indicated lines (marking them changed). @@ -103,11 +107,25 @@ The routine \fBredrawwin\fR() touches the entire window. Routines that return an integer return \fBERR\fR upon failure, and \fBOK\fR (SVr4 only specifies "an integer value other than \fBERR\fR") upon successful completion. +.PP +X/Open does not define any error conditions. +In this implementation +.RS +.TP 5 +\fBwnoutrefresh\fP +returns an error +if the window pointer is null, or +if the window is really a pad. +.TP 5 +\fBwredrawln\fP +returns an error +if the associated call to \fBtouchln\fP returns an error. +.RE .SH NOTES Note that \fBrefresh\fR and \fBredrawwin\fR may be macros. .SH PORTABILITY The XSI Curses standard, Issue 4 describes these functions. - +.PP Whether \fBwnoutrefresh()\fR copies to the virtual screen the entire contents of a window or just its changed portions has never been well-documented in historic curses versions (including SVr4). diff --git a/man/curs_scr_dump.3x b/man/curs_scr_dump.3x index a925ea56..867d0932 100644 --- a/man/curs_scr_dump.3x +++ b/man/curs_scr_dump.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,13 +26,17 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_scr_dump.3x,v 1.3 2003/10/25 20:34:06 tom Exp $ +.\" $Id: curs_scr_dump.3x,v 1.5 2005/05/15 16:18:55 tom Exp $ .TH curs_scr_dump 3X "" +.na +.hy 0 .SH NAME \fBscr_dump\fR, \fBscr_restore\fR, \fBscr_init\fR, \fBscr_set\fR - read (write) a \fBcurses\fR screen from (to) a file +.ad +.hy .SH SYNOPSIS \fB#include \fR @@ -74,6 +78,10 @@ To read (write) a window from (to) a file, use the \fBgetwin\fR and .SH RETURN VALUE All routines return the integer \fBERR\fR upon failure and \fBOK\fR upon success. +.PP +X/Open defines no error conditions. +In this implementation, +each will return an error if the file cannot be opened. .SH NOTES Note that \fBscr_init\fR, \fBscr_set\fR, and \fBscr_restore\fR may be macros. .SH PORTABILITY @@ -81,7 +89,7 @@ The XSI Curses standard, Issue 4, describes these functions (adding the const qualifiers). The SVr4 docs merely say under \fBscr_init\fR that the dump data is also -considered invalid "if the time-stamp of the tty is old" but don't define +considered invalid "if the time-stamp of the tty is old" but do not define "old". .SH SEE ALSO \fBcurses\fR(3X), \fBcurs_initscr\fR(3X), \fBcurs_refresh\fR(3X), diff --git a/man/curs_scroll.3x b/man/curs_scroll.3x index 4e694c33..0ba48f62 100644 --- a/man/curs_scroll.3x +++ b/man/curs_scroll.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2001,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,10 +26,16 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_scroll.3x,v 1.10 2003/05/10 20:33:49 jmc Exp $ +.\" $Id: curs_scroll.3x,v 1.12 2005/05/15 16:19:01 tom Exp $ .TH curs_scroll 3X "" +.na +.hy 0 .SH NAME -\fBscroll\fR, \fBscrl\fR, \fBwscrl\fR - scroll a \fBcurses\fR window +\fBscroll\fR, +\fBscrl\fR, +\fBwscrl\fR - scroll a \fBcurses\fR window +.ad +.hy .SH SYNOPSIS \fB#include \fR @@ -58,6 +64,12 @@ For these functions to work, scrolling must be enabled via \fBscrollok\fR. .SH RETURN VALUE These routines return \fBERR\fR upon failure, and \fBOK\fR (SVr4 only specifies "an integer value other than \fBERR\fR") upon successful completion. +.PP +X/Open defines no error conditions. +.PP +This implementation returns an error +if the window pointer is null, or +if scrolling is not enabled in the window, e.g., with \fBscrollok\fP. .SH NOTES Note that \fBscrl\fR and \fBscroll\fR may be macros. diff --git a/man/curs_slk.3x b/man/curs_slk.3x index 1271f859..c76fdf77 100644 --- a/man/curs_slk.3x +++ b/man/curs_slk.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,15 +26,29 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_slk.3x,v 1.12 2003/05/10 20:33:49 jmc Exp $ +.\" $Id: curs_slk.3x,v 1.14 2005/05/15 16:19:06 tom Exp $ .TH curs_slk 3X "" +.na +.hy 0 .SH NAME -\fBslk_init\fR, \fBslk_set\fR, \fBslk_refresh\fR, -\fBslk_noutrefresh\fR, \fBslk_label\fR, -\fBslk_clear\fR, \fBslk_restore\fR, \fBslk_touch\fR, -\fBslk_attron\fR, \fBslk_attrset\fR, \fBslk_attroff\fR, -\fBslk_attr_on\fR, \fBslk_attr_set\fR, \fBslk_attr_off\fR, -\fBslk_attr\fR, \fBslk_color\fR - \fBcurses\fR soft label routines +\fBslk_init\fR, +\fBslk_set\fR, +\fBslk_refresh\fR, +\fBslk_noutrefresh\fR, +\fBslk_label\fR, +\fBslk_clear\fR, +\fBslk_restore\fR, +\fBslk_touch\fR, +\fBslk_attron\fR, +\fBslk_attrset\fR, +\fBslk_attroff\fR, +\fBslk_attr_on\fR, +\fBslk_attr_set\fR, +\fBslk_attr_off\fR, +\fBslk_attr\fR, +\fBslk_color\fR - \fBcurses\fR soft label routines +.ad +.hy .SH SYNOPSIS \fB#include \fR @@ -126,10 +140,52 @@ if soft labels are simulated on the bottom line of the screen. .SH RETURN VALUE These routines return \fBERR\fR upon failure and OK (SVr4 specifies only "an -integer value other than \fBERR\fR") upon successful completion. \fBslk_attr\fR +integer value other than \fBERR\fR") upon successful completion. +.PP +X/Open defines no error conditions. +In this implementation +.RS +.TP 5 +\fBslk_attr\fR returns the attribute used for the soft keys. - -\fBslk_label\fR returns \fBNULL\fR on error. +.TP 5 +.na +.hy 0 +\fBslk_attroff\fP, \fBslk_attron\fP, \fBslk_clear\fP, \fBslk_noutrefresh\fP, \fBslk_refresh\fP, \fBslk_touch\fP +.ad +.hy +return an error +if the terminal or the softkeys were not initialized. +.TP 5 +\fBslk_attrset\fP +returns an error +if the terminal or the softkeys were not initialized. +.TP 5 +\fBslk_attr_set\fP +returns an error +if the terminal or the softkeys were not initialized, or +the color pair is outside the range 0..COLOR_PAIRS-1, +or opts is not null. +.TP 5 +\fBslk_color\fP +returns an error +if the terminal or the softkeys were not initialized, or +the color pair is outside the range 0..COLOR_PAIRS-1. +.TP 5 +\fBslk_init\fR +returns an error +if the format parameter is outside the range 0..3. +.TP 5 +\fBslk_label\fR +returns \fBNULL\fR on error. +.TP 5 +\fBslk_set\fP +returns an error +if the terminal or the softkeys were not initialized, or +the \fIlabnum\fP parameter is outside the range of label counts, or +if the format parameter is outside the range 0..2, or if +memory for the labels cannot be allocated. +.RE .SH NOTES Most applications would use \fBslk_noutrefresh\fR because a \fBwrefresh\fR is likely to follow soon. diff --git a/man/curs_terminfo.3x b/man/curs_terminfo.3x index d5c9bf68..14214d08 100644 --- a/man/curs_terminfo.3x +++ b/man/curs_terminfo.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1999-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1999-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,9 +26,11 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_terminfo.3x,v 1.18 2003/12/27 18:48:59 tom Exp $ +.\" $Id: curs_terminfo.3x,v 1.20 2005/05/15 16:19:13 tom Exp $ .TH curs_terminfo 3X "" .ds n 5 +.na +.hy 0 .SH NAME \fBdel_curterm\fR, \fBmvcur\fR, @@ -46,6 +48,8 @@ \fBvid_puts\fR, \fBvidattr\fR, \fBvidputs\fR - \fBcurses\fR interfaces to terminfo database +.ad +.hy .SH SYNOPSIS .nf \fB#include \fR @@ -252,6 +256,25 @@ Routines that return an integer return \fBERR\fR upon failure and \fBOK\fR completion, unless otherwise noted in the preceding routine descriptions. .PP Routines that return pointers always return \fBNULL\fR on error. +.PP +X/Open defines no error conditions. +In this implementation +.RS +.TP 5 +\fBdel_curterm\fP +returns an error +if its terminal parameter is null. +.TP 5 +\fBrestartterm\fP +returns an error +if the associated call to \fBsetupterm\fP returns an error. +.TP 5 +\fBsetupterm\fP +returns an error +if it cannot allocate enough memory, or +create the initial windows (stdscr, curscr, newscr). +Other error conditions are documented above. +.RE .SH NOTES The \fBsetupterm\fR routine should be used in place of \fBsetterm\fR. It may be useful when you want to test for terminal capabilities without diff --git a/man/curs_touch.3x b/man/curs_touch.3x index 58ffa9f6..fa0f12ca 100644 --- a/man/curs_touch.3x +++ b/man/curs_touch.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998,2000 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_touch.3x,v 1.8 2000/07/08 11:07:57 tom Exp $ +.\" $Id: curs_touch.3x,v 1.10 2005/05/15 16:19:19 tom Exp $ .TH curs_touch 3X "" +.na +.hy 0 .SH NAME \fBtouchwin\fR, \fBtouchline\fR, @@ -35,6 +37,8 @@ \fBwtouchln\fR, \fBis_linetouched\fR, \fBis_wintouched\fR - \fBcurses\fR refresh control routines +.ad +.hy .SH SYNOPSIS \fB#include \fR .br @@ -77,6 +81,22 @@ valid for the given window. All routines return the integer \fBERR\fR upon failure and an integer value other than \fBERR\fR upon successful completion, unless otherwise noted in the preceding routine descriptions. +.PP +X/Open does not define any error conditions. +In this implementation +.RS +.TP 5 +\fBis_linetouched\fP +returns an error +if the window pointer is null, or +if the line number is outside the window. +Note that ERR is distinct from TRUE and FALSE, which are the normal return values of this function. +.TP 5 +\fBwtouchln\fP +returns an error +if the window pointer is null, or +if the line number is outside the window. +.RE .SH PORTABILITY The XSI Curses standard, Issue 4 describes these functions. diff --git a/man/curs_trace.3x b/man/curs_trace.3x index 4af258da..560302c4 100644 --- a/man/curs_trace.3x +++ b/man/curs_trace.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 2000,2002 Free Software Foundation, Inc. * +.\" Copyright (c) 2000-2002,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_trace.3x,v 1.5 2002/02/16 22:39:52 tom Exp $ +.\" $Id: curs_trace.3x,v 1.7 2005/05/15 17:02:54 tom Exp $ .TH curs_trace 3X "" +.na +.hy 0 .SH NAME \fB_tracef\fR, \fB_tracedump\fR, @@ -39,9 +41,11 @@ \fB_tracechtype2\fR, \fB_tracemouse\fR, \fBtrace\fR - \fBcurses\fR debugging routines +.ad +.hy .SH SYNOPSIS \fB#include \fR -.br +.sp \fBvoid _tracef(const char *format, ...);\fR .br \fBvoid _tracedump(const char *label, WINDOW *win);\fR @@ -67,11 +71,11 @@ as well as applications which use the ncurses libraries. These functions are normally available only with the debugging library \fIlibncurses_g.a\fR, but may be compiled into any model (shared, static, profile) by defining the symbol \fBTRACE\fR. - +.PP The principal parts of this interface are the \fBtrace\fR routine which selectively enables different tracing features, and the \fB_tracef\fR routine which writes formatted data to the \fItrace\fR file. - +.PP Calling \fBtrace\fR with a nonzero parameter opens the file \fBtrace\fR in the current directory for output. The parameter is formed by OR'ing values from the list of \fBTRACE_\fP\fIxxx\fR definitions in \fB\fR. @@ -127,7 +131,7 @@ trace changes to video attributes and colors. .TP 5 TRACE_MAXIMUM maximum trace level, enables all of the separate trace features. - +.PP Some tracing features are enabled whenever the \fBtrace\fR parameter is nonzero. Some features overlap. The specific names are used as a guideline. diff --git a/man/curs_util.3x b/man/curs_util.3x index de19a308..7b2617e6 100644 --- a/man/curs_util.3x +++ b/man/curs_util.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_util.3x,v 1.12 2004/01/31 17:24:53 tom Exp $ +.\" $Id: curs_util.3x,v 1.17 2005/06/25 21:51:37 tom Exp $ .TH curs_util 3X "" +.na +.hy 0 .SH NAME \fBdelay_output\fR, \fBfilter\fR, @@ -39,6 +41,8 @@ \fBunctrl\fR, \fBuse_env\fR, \fBwunctrl\fR - miscellaneous \fBcurses\fR utility routines +.ad +.hy .SH SYNOPSIS \fB#include \fR .sp @@ -93,6 +97,8 @@ argument, the values of \fBlines\fR and \fBcolumns\fR specified in the \fBcurses\fR is running in a window (in which case default behavior would be to use the window size if \fBLINES\fR and \fBCOLUMNS\fR are not set). +Note that setting \fBLINES\fR or \fBCOLUMNS\fR overrides the +corresponding size which may be obtained from the operating system. .PP The \fBputwin\fR routine writes all data associated with window \fIwin\fR into the file to which \fIfilep\fR points. This information can be later retrieved @@ -114,9 +120,18 @@ Except for \fBflushinp\fR, routines that return an integer return \fBERR\fR upon failure and \fBOK\fR (SVr4 specifies only "an integer value other than \fBERR\fR") upon successful completion. .PP -\fBflushinp\fR always returns \fBOK\fR. -.PP Routines that return pointers return \fBNULL\fR on error. +.PP +X/Open does not define any error conditions. +In this implementation +.RS +.TP 5 +\fBflushinp\fR +returns an error if the terminal was not initialized. +.TP 5 +\fBputwin\fP +returns an error if the associated \fBfwrite\fP calls return an error. +.RE .SH PORTABILITY The XSI Curses standard, Issue 4 describes these functions. It states that \fBunctrl\fR and \fBwunctrl\fR will return a null pointer if @@ -133,6 +148,10 @@ Other implementations typically show both sets of control characters with `^', and may strip the parameter to 7 bits. This implementation uses 8 bits but does not modify the string to reflect locale. +.PP +The \fBkeyname\fP function may return the names of user-defined +string capabilities which are defined in the terminfo entry via the \fB-x\fP +option of \fBtic\fP. .SH SEE ALSO \fBcurses\fR(3X), \fBcurs_initscr\fR(3X), diff --git a/man/curs_window.3x b/man/curs_window.3x index 6aad4e7f..8c572995 100644 --- a/man/curs_window.3x +++ b/man/curs_window.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,8 +26,10 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: curs_window.3x,v 1.10 2003/05/10 20:33:49 jmc Exp $ +.\" $Id: curs_window.3x,v 1.13 2005/05/15 16:32:02 tom Exp $ .TH curs_window 3X "" +.na +.hy 0 .SH NAME \fBnewwin\fR, \fBdelwin\fR, @@ -40,6 +42,8 @@ \fBsyncok\fR, \fBwcursyncup\fR, \fBwsyncdown\fR - create \fBcurses\fR windows +.ad +.hy .SH SYNOPSIS \fB#include \fR @@ -126,11 +130,36 @@ window. Routines that return an integer return the integer \fBERR\fR upon failure and \fBOK\fR (SVr4 only specifies "an integer value other than \fBERR\fR") upon successful completion. - -\fBdelwin\fR returns the integer \fBERR\fR upon failure and \fBOK\fR -upon successful completion. - +.PP Routines that return pointers return \fBNULL\fR on error. +.PP +X/Open defines no error conditions. +In this implementation +.RS +.TP 5 +\fBdelwin\fR +returns an error if the window pointer is null, or +if the window is the parent of another window. +.IP +This implementation also maintains a list of windows, +and checks that the pointer passed to \fBdelwin\fP is one that +it created, returning an error if it was not.. +.TP 5 +\fBmvderwin\fP +returns an error +if the window pointer is null, or +if some part of the window would be placed off-screen. +.TP 5 +\fBmvwin\fP +returns an error +if the window pointer is null, or +if the window is really a pad, or +if some part of the window would be placed off-screen. +.TP 5 +\fBsyncok\fP +returns an error +if the window pointer is null. +.RE .SH NOTES If many small changes are made to the window, the \fBwsyncup\fR option could degrade performance. diff --git a/man/default_colors.3x b/man/default_colors.3x index ae07899d..e00b4981 100644 --- a/man/default_colors.3x +++ b/man/default_colors.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,9 +26,9 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" Author: Thomas E. Dickey 1997,1999,2000 +.\" Author: Thomas E. Dickey 1997,1999,2000,2005 .\" -.\" $Id: default_colors.3x,v 1.17 2003/10/25 20:41:08 tom Exp $ +.\" $Id: default_colors.3x,v 1.18 2005/02/19 20:25:44 tom Exp $ .TH default_colors 3X "" .SH NAME \fBuse_default_colors\fR, @@ -107,6 +107,26 @@ error as well. Associated with this extension, the \fBinit_pair\fR(3X) function accepts negative arguments to specify default foreground or background colors. +.PP +The \fIuse_default_colors()\fP function was added to support \fIded\fP. +This is a full-screen application which uses curses to manage only part +of the screen. The bottom portion of the screen, which is of adjustable +size, is left uncolored to display the results from shell commands. +The top portion of the screen colors filenames using a scheme like the +"color ls" programs. +Attempting to manage the background color of the screen for this application +would give unsatisfactory results for a variety of reasons. +This extension was devised after +noting that color xterm (and similar programs) provides a background color +which does not necessarily correspond to any of the ANSI colors. +While a special terminfo entry could be constructed using nine colors, +there was no mechanism provided within curses to account for the related +\fIorig_pair\fP and \fIback_color_erase\fP capabilities. +.PP +The \fIassume_default_colors()\fP function was added to solve +a different problem: support for applications which would use +environment variables and other configuration to bypass curses' +notion of the terminal's default colors, setting specific values. .SH PORTABILITY These routines are specific to ncurses. They were not supported on Version 7, BSD or System V implementations. It is recommended that diff --git a/man/define_key.3x b/man/define_key.3x index c11e14b1..b7bca879 100644 --- a/man/define_key.3x +++ b/man/define_key.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -28,7 +28,7 @@ .\" .\" Author: Thomas E. Dickey 1997 .\" -.\" $Id: define_key.3x,v 1.10 2003/10/25 20:33:16 tom Exp $ +.\" $Id: define_key.3x,v 1.11 2004/06/05 19:20:03 tom Exp $ .TH define_key 3X "" .SH NAME \fBdefine_key\fP \- define a keycode @@ -53,7 +53,8 @@ These routines are specific to ncurses. They were not supported on Version 7, BSD or System V implementations. It is recommended that any code depending on them be conditioned using NCURSES_VERSION. .SH SEE ALSO -\fBkeyok\fR(3X). +\fBkeyok\fR(3X), +\fBkey_defined\fR(3X). .SH AUTHOR Thomas Dickey. .\"# diff --git a/man/form_field_buffer.3x b/man/form_field_buffer.3x index 7595f53e..c5d1d2ee 100644 --- a/man/form_field_buffer.3x +++ b/man/form_field_buffer.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_buffer.3x,v 1.10 2003/05/10 20:22:01 tom Exp $ +.\" $Id: form_field_buffer.3x,v 1.12 2005/05/15 15:59:55 tom Exp $ .TH form_field_buffer 3X "" .SH NAME \fBform_field_buffer\fR - field buffer control @@ -55,7 +55,7 @@ that it may typically contain trailing spaces. If you entered leading spaces the buffer may also contain them. If you want the raw data, you must write your own routine that copies the value out of the buffer and removes the leading and trailing spaces. Please note also, that subsequent operations on the form -will probably change the content of the buffer. So don't use it for long term +will probably change the content of the buffer. So do not use it for long term storage of the entered form data. The function \fBset_field_status\fR sets the associated status flag of @@ -84,6 +84,12 @@ Routine detected an incorrect or out-of-range argument. descriptions of the entry points. .SH NOTES The header file \fB\fR automatically includes the header file + +When configured for wide-characters, \fBfield_buffer\fP returns a pointer +to temporary storage (allocated and freed by the library). +The application should not attempt to modify the data. +It will be freed on the next call to \fBfield_buffer\fP to return the +same buffer. \fB\fR. .SH PORTABILITY These routines emulate the System V forms library. They were not supported on diff --git a/man/form_field_info.3x b/man/form_field_info.3x index 56b81ac7..7ebf5f0d 100644 --- a/man/form_field_info.3x +++ b/man/form_field_info.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998,2000,2001,2002 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_info.3x,v 1.8 2002/01/19 22:48:32 tom Exp $ +.\" $Id: form_field_info.3x,v 1.9 2005/10/08 22:15:07 tom Exp $ .TH form_field_info 3X "" .SH NAME \fBform_field_info\fR - retrieve field characteristics @@ -44,11 +44,12 @@ The function \fBfield_info\fR returns the sizes and other attributes passed in to the field at its creation time. The attributes are: height, width, row of upper-left corner, column of upper-left corner, number off-screen rows, and number of working buffers. - +.PP The function \fBdynamic_field_info\fR returns the actual size of the field, and its maximum possible size. If the field has no size limit, the location -addressed by the third argument will be set to 0. (A field can be made dynamic -by turning off the \fBO_STATIC\fR). +addressed by the third argument will be set to 0. +A field can be made dynamic +by turning off the \fBO_STATIC\fR option with \fBfield_opts_off\fR. .SH RETURN VALUE These routines return one of the following: .TP 5 diff --git a/man/form_field_opts.3x b/man/form_field_opts.3x index 8a3e5018..9999f12e 100644 --- a/man/form_field_opts.3x +++ b/man/form_field_opts.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: form_field_opts.3x,v 1.8 2003/05/10 20:33:49 jmc Exp $ +.\" $Id: form_field_opts.3x,v 1.10 2005/10/08 22:16:18 tom Exp $ .TH form_field_opts 3X "" .SH NAME \fBform_field_opts\fR - set and get field options @@ -72,7 +72,7 @@ O_EDIT The field can be edited. .TP 5 O_WRAP -Words that don't fit on a line are wrapped to the next line. Words are +Words that do not fit on a line are wrapped to the next line. Words are blank-separated. .TP 5 O_BLANK @@ -86,6 +86,7 @@ Allow a blank field. .TP 5 O_STATIC Field buffers are fixed to field's original size. +Turn this option off to create a dynamic field. .TP 5 O_PASSOK Validate field only if modified by user. diff --git a/man/infocmp.1m b/man/infocmp.1m index fe95d6f8..1bf64980 100644 --- a/man/infocmp.1m +++ b/man/infocmp.1m @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,14 +27,14 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: infocmp.1m,v 1.34 2003/10/25 16:19:01 tom Exp $ +.\" $Id: infocmp.1m,v 1.39 2004/08/28 22:43:49 tom Exp $ .TH infocmp 1M "" .ds n 5 .ds d @TERMINFO@ .SH NAME \fBinfocmp\fR - compare or print out \fIterminfo\fR descriptions .SH SYNOPSIS -\fBinfocmp\fR [\fB\-\ +\fBinfocmp\fR [\fB-\ 1\ C\ E\ @@ -56,11 +56,12 @@ q\ r\ t\ u\ +x\ \fR] .br - [\fB\-v\fR \fIn\fR] [\fB\-s d\fR| \fBi\fR| \fBl\fR| \fBc\fR] [\fB\-R \fR\fBsubset\fR] + [\fB-v\fR \fIn\fR] [\fB-s d\fR| \fBi\fR| \fBl\fR| \fBc\fR] [\fB-R \fR\fBsubset\fR] .br - [\fB\-w\fR\ \fIwidth\fR] [\fB\-A\fR\ \fIdirectory\fR] [\fB\-B\fR\ \fIdirectory\fR] + [\fB-w\fR\ \fIwidth\fR] [\fB-A\fR\ \fIdirectory\fR] [\fB-B\fR\ \fIdirectory\fR] .br [\fItermname\fR...] .SH DESCRIPTION @@ -72,9 +73,9 @@ fields will be printed first, followed by the numeric fields, followed by the string fields. .SS Default Options If no options are specified and zero or one \fItermnames\fR are specified, the -\fB\-I\fR option will be assumed. If more than one \fItermname\fR is specified, -the \fB\-d\fR option will be assumed. -.SS Comparison Options [\-d] [\-c] [\-n] +\fB-I\fR option will be assumed. If more than one \fItermname\fR is specified, +the \fB-d\fR option will be assumed. +.SS Comparison Options [-d] [-c] [-n] \fBinfocmp\fR compares the \fBterminfo\fR description of the first terminal \fItermname\fR with each of the descriptions given by the entries for the other terminal's \fItermnames\fR. If a capability is defined for only one of the @@ -82,35 +83,35 @@ terminals, the value returned will depend on the type of the capability: \fBF\fR for boolean variables, \fB-1\fR for integer variables, and \fBNULL\fR for string variables. -The \fB\-d\fR option produces a list of each capability that is different +The \fB-d\fR option produces a list of each capability that is different between two entries. This option is useful to show the difference between two entries, created by different people, for the same or similar terminals. -The \fB\-c\fR option produces a list of each capability that is common between +The \fB-c\fR option produces a list of each capability that is common between two entries. Capabilities that are not set are ignored. This option can be -used as a quick check to see if the \fB\-u\fR option is worth using. +used as a quick check to see if the \fB-u\fR option is worth using. -The \fB\-n\fR option produces a list of each capability that is in neither +The \fB-n\fR option produces a list of each capability that is in neither entry. If no \fItermnames\fR are given, the environment variable \fBTERM\fR will be used for both of the \fItermnames\fR. This can be used as a quick check to see if anything was left out of a description. -.SS Source Listing Options [\-I] [\-L] [\-C] [\-r] -The \fB\-I\fR, \fB\-L\fR, and \fB\-C\fR options will produce a source listing for +.SS Source Listing Options [-I] [-L] [-C] [-r] +The \fB-I\fR, \fB-L\fR, and \fB-C\fR options will produce a source listing for each terminal named. .TS center tab(/) ; l l . -\fB\-I\fR/use the \fBterminfo\fR names -\fB\-L\fR/use the long C variable name listed in <\fBterm.h\fR> -\fB\-C\fR/use the \fBtermcap\fR names -\fB\-r\fR/when using \fB\-C\fR, put out all capabilities in \fBtermcap\fR form +\fB-I\fR/use the \fBterminfo\fR names +\fB-L\fR/use the long C variable name listed in <\fBterm.h\fR> +\fB-C\fR/use the \fBtermcap\fR names +\fB-r\fR/when using \fB-C\fR, put out all capabilities in \fBtermcap\fR form .TE If no \fItermnames\fR are given, the environment variable \fBTERM\fR will be used for the terminal name. -The source produced by the \fB\-C\fR option may be used directly as a +The source produced by the \fB-C\fR option may be used directly as a \fBtermcap\fR entry, but not all parameterized strings can be changed to the \fBtermcap\fR format. \fBinfocmp\fR will attempt to convert most of the parameterized information, and anything not converted will be plainly marked in @@ -123,7 +124,7 @@ padding (padding information with a trailing '/') will become optional. All \fBtermcap\fR variables no longer supported by \fBterminfo\fR, but which are derivable from other \fBterminfo\fR variables, will be output. Not all \fBterminfo\fR capabilities will be translated; only those variables which were -part of \fBtermcap\fR will normally be output. Specifying the \fB\-r\fR option +part of \fBtermcap\fR will normally be output. Specifying the \fB-r\fR option will take off this restriction, allowing all capabilities to be output in \fItermcap\fR form. @@ -151,8 +152,8 @@ l l l. \fB%p1%?%'x'%>%t%p1%'y'%+%;/%>xy\fR/concept \fB%p2\fR is printed before \fB%p1/%r\fR/hp .TE -.SS Use= Option [\-u] -The \fB\-u\fR option produces a \fBterminfo\fR source description of the first +.SS Use= Option [-u] +The \fB-u\fR option produces a \fBterminfo\fR source description of the first terminal \fItermname\fR which is relative to the sum of the descriptions given by the entries for the other terminals \fItermnames\fR. It does this by analyzing the differences between the first \fItermname\fR and the other @@ -187,29 +188,29 @@ Another error that does not cause incorrect compiled files, but will slow down the compilation time, is specifying extra \fBuse=\fR fields that are superfluous. \fBinfocmp\fR will flag any other \fItermname use=\fR fields that were not needed. -.SS Changing Databases [\-A \fIdirectory\fR] [\-B \fIdirectory\fR] +.SS Changing Databases [-A \fIdirectory\fR] [-B \fIdirectory\fR] The location of the compiled \fBterminfo\fR database is taken from the environment variable \fBTERMINFO\fR . If the variable is not defined, or the terminal is not found in that location, the system \fBterminfo\fR database, -in \fB@TERMINFO@\fR, will be used. The options \fB\-A\fR -and \fB\-B\fR may be used to override this location. The \fB\-A\fR option will -set \fBTERMINFO\fR for the first \fItermname\fR and the \fB\-B\fR option will +in \fB@TERMINFO@\fR, will be used. The options \fB-A\fR +and \fB-B\fR may be used to override this location. The \fB-A\fR option will +set \fBTERMINFO\fR for the first \fItermname\fR and the \fB-B\fR option will set \fBTERMINFO\fR for the other \fItermnames\fR. With this, it is possible to compare descriptions for a terminal with the same name located in two different databases. This is useful for comparing descriptions for the same terminal created by different people. .SS Other Options .TP 5 -\fB\-1\fR +\fB-1\fR causes the fields to be printed out one to a line. Otherwise, the fields will be printed several to a line to a maximum width of 60 characters. .TP -\fB\-a\fR +\fB-a\fR tells \fBinfocmp\fP to retain commented-out capabilities rather than discarding them. Capabilities are commented by prefixing them with a period. .TP 5 -\fB\-E\fR +\fB-E\fR Dump the capabilities of the given terminal as tables, needed in the C initializer for a TERMTYPE structure (the terminal capability structure in the \fB\fR). @@ -218,17 +219,17 @@ for a given terminal type. The tables are all declared static, and are named according to the type and the name of the corresponding terminal entry. .sp -Before ncurses 5.0, the split between the \fB\-e\fP and \fB\-E\fP +Before ncurses 5.0, the split between the \fB-e\fP and \fB-E\fP options was not needed; but support for extended names required making the arrays of terminal capabilities separate from the TERMTYPE structure. .TP 5 -\fB\-e\fR +\fB-e\fR Dump the capabilities of the given terminal as a C initializer for a TERMTYPE structure (the terminal capability structure in the \fB\fR). This option is useful for preparing versions of the curses library hardwired for a given terminal type. .TP 5 -\fB\-F\fR +\fB-F\fR compare terminfo files. This assumes that two following arguments are filenames. The files are searched for pairwise matches between entries, with two entries considered to match if any of their names do. @@ -237,21 +238,21 @@ the other file, and entries with more than one match. For entries with exactly one match it includes a difference report. Normally, to reduce the volume of the report, use references are not resolved before looking for differences, but resolution can be forced -by also specifying \fB\-r\fR. +by also specifying \fB-r\fR. .TP 5 -\fB\-f\fR +\fB-f\fR Display complex terminfo strings which contain if/then/else/endif expressions indented for readability. .TP 5 -\fB\-G\fR +\fB-G\fR Display constant literals in decimal form rather than their character equivalents. .TP 5 -\fB\-g\fR +\fB-g\fR Display constant character literals in quoted form rather than their decimal equivalents. .TP 5 -\fB\-i\fR +\fB-i\fR Analyze the initialization (\fBis1\fR, \fBis2\fR, \fBis3\fR), and reset (\fBrs1\fR, \fBrs2\fR, \fBrs3\fR), strings in the entry. For each string, the code tries to analyze it into actions in terms of the other capabilities in the @@ -275,6 +276,9 @@ RC/restore cursor LL/home-down RSR/reset scroll region +DECSTR/soft reset (VT320) +S7C1T/7-bit controls (VT220) + ISO DEC G0/enable DEC graphics for G0 ISO UK G0/enable UK chars for G0 ISO US G0/enable US chars for G0 @@ -286,6 +290,11 @@ DECPAM/application keypad mode DECPNM/normal keypad mode DECANSI/enter ANSI mode +ECMA[+-]AM/keyboard action mode +ECMA[+-]IRM/insert replace mode +ECMA[+-]SRM/send receive mode +ECMA[+-]LNM/linefeed mode + DEC[+-]CKM/application cursor keys DEC[+-]ANM/set VT52 mode DEC[+-]COLM/132-column mode @@ -302,17 +311,17 @@ REVERSE. All but NORMAL may be prefixed with `+' (turn on) or `-' (turn off). An SGR0 designates an empty highlight sequence (equivalent to {SGR:NORMAL}). .TP 5 -\fB\-l\fR +\fB-l\fR Set output format to terminfo. .TP 5 -\fB\-p\fR +\fB-p\fR Ignore padding specifications when comparing strings. .TP 5 -\fB\-q\fR +\fB-q\fR Make the comparison listing shorter by omitting subheadings, and using "-" for absent capabilities, "@" for canceled rather than "NULL". .TP 5 -\fB\-R\fR\fIsubset\fR +\fB-R\fR\fIsubset\fR Restrict output to a given subset. This option is for use with archaic versions of terminfo like those on SVr1, Ultrix, or HP/UX that do not support the full set of SVR4/XSI Curses terminfo; and variants such as AIX @@ -321,8 +330,8 @@ subsets are "SVr1", "Ultrix", "HP", and "AIX"; see \fBterminfo\fR(\*n) for details. You can also choose the subset "BSD" which selects only capabilities with termcap equivalents recognized by 4.4BSD. .TP -\fB\-s \fR\fI[d|i|l|c]\fR -The \fB\-s\fR option sorts the fields within each type according to the argument +\fB-s \fR\fI[d|i|l|c]\fR +The \fB-s\fR option sorts the fields within each type according to the argument below: .br .RS 5 @@ -340,59 +349,64 @@ sort by the long C variable name. sort by the \fItermcap\fR name. .RE .IP -If the \fB\-s\fR option is not given, the fields printed out will be +If the \fB-s\fR option is not given, the fields printed out will be sorted alphabetically by the \fBterminfo\fR name within each type, -except in the case of the \fB\-C\fR or the \fB\-L\fR options, which cause the +except in the case of the \fB-C\fR or the \fB-L\fR options, which cause the sorting to be done by the \fBtermcap\fR name or the long C variable name, respectively. .TP 5 -\fB\-T\fR +\fB-T\fR eliminates size-restrictions on the generated text. This is mainly useful for testing and analysis, since the compiled descriptions are limited (e.g., 1023 for termcap, 4096 for terminfo). .TP -\fB\-t\fR +\fB-t\fR tells \fBtic\fP to discard commented-out capabilities. Normally when translating from terminfo to termcap, untranslatable capabilities are commented-out. .TP 5 -\fB\-V\fR +\fB-V\fR reports the version of ncurses which was used in this program, and exits. .TP 5 -\fB\-v\fR \fIn\fR +\fB-v\fR \fIn\fR prints out tracing information on standard error as the program runs. Higher values of n induce greater verbosity. .TP 5 -\fB\-w\fR \fIwidth\fR +\fB-w\fR \fIwidth\fR changes the output to \fIwidth\fR characters. +.TP +\fB-x\fR +print information for user-defined capabilities. +These are extensions to the terminfo repertoire which can be loaded +using the \fB-x\fR option of \fBtic\fP. .SH FILES .TP 20 \*d Compiled terminal description database. .SH EXTENSIONS The -\fB\-E\fR, -\fB\-F\fR, -\fB\-G\fR, -\fB\-R\fR, -\fB\-T\fR, -\fB\-V\fR, -\fB\-a\fR, -\fB\-e\fR, -\fB\-f\fR, -\fB\-g\fR, -\fB\-i\fR, -\fB\-l\fR, -\fB\-p\fR, -\fB\-q\fR and -\fB\-t\fR +\fB-E\fR, +\fB-F\fR, +\fB-G\fR, +\fB-R\fR, +\fB-T\fR, +\fB-V\fR, +\fB-a\fR, +\fB-e\fR, +\fB-f\fR, +\fB-g\fR, +\fB-i\fR, +\fB-l\fR, +\fB-p\fR, +\fB-q\fR and +\fB-t\fR options are not supported in SVr4 curses. -The \fB\-r\fR option's notion of `termcap' capabilities is System V Release 4's. +The \fB-r\fR option's notion of `termcap' capabilities is System V Release 4's. Actual BSD curses versions will have a more restricted set. To see only the -4.4BSD set, use \fB\-r\fR \fB\-RBSD\fR. +4.4BSD set, use \fB-r\fR \fB-RBSD\fR. .SH BUGS -The \fB\-F\fR option of \fBinfocmp\fR(1M) should be a \fBtoe\fR(1M) mode. +The \fB-F\fR option of \fBinfocmp\fR(1M) should be a \fBtoe\fR(1M) mode. .SH SEE ALSO \fBinfocmp\fR(1M), \fBcaptoinfo\fR(1M), \fBinfotocap\fR(1M), \fBtic\fR(1M), \fBtoe\fR(1M), diff --git a/man/infotocap.1m b/man/infotocap.1m index f1845842..e1dacc63 100644 --- a/man/infotocap.1m +++ b/man/infotocap.1m @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1999-2000,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1999-2003,2004 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,40 +27,40 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: infotocap.1m,v 1.4 2003/05/11 00:32:53 tom Exp $ +.\" $Id: infotocap.1m,v 1.5 2004/07/05 13:16:08 tom Exp $ .TH infotocap 1M "" .ds n 5 .ds d @TERMINFO@ .SH NAME \fBinfotocap\fR - convert a \fIterminfo\fR description into a \fItermcap\fR description .SH SYNOPSIS -\fBinfotocap\fR [\fB\-v\fR\fIn\fR \fIwidth\fR] [\fB\-V\fR] [\fB\-1\fR] [\fB\-w\fR \fIwidth\fR] \fIfile\fR . . . +\fBinfotocap\fR [\fB-v\fR\fIn\fR \fIwidth\fR] [\fB-V\fR] [\fB-1\fR] [\fB-w\fR \fIwidth\fR] \fIfile\fR . . . .SH DESCRIPTION \fBinfotocap\fR looks in \fIfile\fR for \fBterminfo\fR descriptions. For each one found, an equivalent \fBtermcap\fR description is written to standard output. Terminfo \fBuse\fR capabilities are translated directly to termcap \fBtc\fR capabilities. .TP 5 -\fB\-v\fR +\fB-v\fR print out tracing information on standard error as the program runs. .TP 5 -\fB\-V\fR +\fB-V\fR print out the version of the program in use on standard error and exit. .TP 5 -\fB\-1\fR +\fB-1\fR cause the fields to print out one to a line. Otherwise, the fields will be printed several to a line to a maximum width of 60 characters. .TP 5 -\fB\-w\fR +\fB-w\fR change the output to \fIwidth\fR characters. .SH FILES .TP 20 \*d Compiled terminal description database. .SH NOTES -This utility is actually a link to \fItic\fR(1M), running in \fI\-C\fR mode. -You can use other \fItic\fR options such as \fB\-f\fR and \fB\-x\fR. +This utility is actually a link to \fItic\fR(1M), running in \fI-C\fR mode. +You can use other \fItic\fR options such as \fB-f\fR and \fB-x\fR. .SH SEE ALSO \fBcurses\fR(3X), \fBtic\fR(1M), diff --git a/man/key_defined.3x b/man/key_defined.3x index 574e524c..a0bf8bb4 100644 --- a/man/key_defined.3x +++ b/man/key_defined.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 2003 Free Software Foundation, Inc. * +.\" Copyright (c) 2003,2004 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -28,10 +28,10 @@ .\" .\" Author: Thomas E. Dickey 2003 .\" -.\" $Id: key_defined.3x,v 1.2 2003/05/17 23:24:45 tom Exp $ +.\" $Id: key_defined.3x,v 1.3 2004/06/05 19:19:09 tom Exp $ .TH key_defined 3X "" .SH NAME -\fBdefine_key\fP \- define a keycode +\fBkey_defined\fP \- check if a keycode is defined .SH SYNOPSIS \fB#include \fP diff --git a/man/make_sed.sh b/man/make_sed.sh index 766801d5..f2afac93 100755 --- a/man/make_sed.sh +++ b/man/make_sed.sh @@ -1,7 +1,7 @@ #!/bin/sh -# $Id: make_sed.sh,v 1.7 2003/10/25 20:33:16 tom Exp $ +# $Id: make_sed.sh,v 1.9 2005/07/16 18:15:31 tom Exp $ ############################################################################## -# Copyright (c) 1998,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -28,7 +28,7 @@ # authorization. # ############################################################################## # -# Author: Thomas E. Dickey 1997 +# Author: Thomas E. Dickey 1997-2005 # # Construct a sed-script to perform renaming within man-pages. Originally # written in much simpler form, this one accounts for the common cases of @@ -63,7 +63,7 @@ paste $COL.* | \ sed -e 's/^/s\/\\$UPPER -# Do the TH lines +echo "# Do the TH lines" >>$RESULT sed -e 's/\//\/TH /' \ -e 's/ / /' \ -e 's/ / ""\/TH /' \ @@ -71,7 +71,7 @@ sed -e 's/\//\/TH /' \ -e 's/\/$/ ""\//' \ $UPPER >>$RESULT -# Do the embedded references +echo "# Do the embedded references" >>$RESULT sed -e 's/>$RESULT +echo "# Do the \fBxxx\fR references in the .NAME section" >>$RESULT +sed -e 's/\\>$RESULT + # Finally, send the result to standard output cat $RESULT diff --git a/man/man_db.renames b/man/man_db.renames index ff5546b3..99e5cb10 100644 --- a/man/man_db.renames +++ b/man/man_db.renames @@ -1,4 +1,4 @@ -# $Id: man_db.renames,v 0.32 2003/05/31 17:27:11 tom Exp $ +# $Id: man_db.renames,v 0.34 2005/06/25 18:30:53 Daniel.Jacobowitz Exp $ # Manual-page renamings for the man_db program # # Files: @@ -137,3 +137,6 @@ can_change_color.3x can_change_color.3ncurses curs_attr_get.3x attr_get.3ncurses dup_field.3x dup_field.3ncurses init_pair.3x init_pair.3ncurses +# +# Other: +tack.1m tack.1 diff --git a/man/menu_spacing.3x b/man/menu_spacing.3x index 18316219..dfe03a8a 100644 --- a/man/menu_spacing.3x +++ b/man/menu_spacing.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998,2001 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2001,2004 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: menu_spacing.3x,v 1.6 2001/08/04 20:36:16 William.Setzer Exp $ +.\" $Id: menu_spacing.3x,v 1.8 2004/12/11 23:39:07 tom Exp $ .TH menu_spacing 3X "" .SH NAME \fBmenu_spacing\fR - Control spacing between menu items. @@ -51,7 +51,7 @@ description. It must not be larger than \fBTABSIZE\fR. The menu system puts in t middle of this spacing area the pad character. The remaining parts are filled with spaces. \fBspc_rows\fR controls the number of rows that are used for an item. It must not be -larger than 3. The menu system inserts then blank lines between item rows, these lines +larger than 3. The menu system inserts the blank lines between item rows, these lines will contain the pad character in the appropriate positions. \fBspc_columns\fR controls the number of blanks between columns of items. It must not be larger than TABSIZE. diff --git a/man/ncurses.3x b/man/ncurses.3x index 0c87dd8d..14e38cc7 100644 --- a/man/ncurses.3x +++ b/man/ncurses.3x @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: ncurses.3x,v 1.70 2004/01/11 01:45:54 tom Exp $ +.\" $Id: ncurses.3x,v 1.76 2005/09/03 17:42:29 tom Exp $ .hy 0 .TH ncurses 3X "" .ds n 5 @@ -46,9 +46,9 @@ implementation is ``new curses'' (ncurses) and is the approved replacement for The \fBncurses\fR routines emulate the \fBcurses\fR(3X) library of System V Release 4 UNIX, and the XPG4 curses standard (XSI curses) but the \fBncurses\fR library is freely redistributable in source form. Differences from the SVr4 -curses are summarized under the EXTENSIONS and BUGS sections below and -described in detail in the EXTENSIONS and BUGS sections of individual man -pages. +curses are summarized under the EXTENSIONS and PORTABILITY sections below and +described in detail in the respective EXTENSIONS, PORTABILITY and BUGS sections +of individual man pages. .PP A program using these routines must be linked with the \fB-lncurses\fR option, or (if it has been generated) with the debugging library \fB-lncurses_g\fR. @@ -643,22 +643,25 @@ COLUMNS Specify the width of the screen in characters. Applications running in a windowing environment usually are able to obtain the width of the window in which they are executing. -If neither the $COLUMNS value nor the terminal's screen size is available, +If neither the \fBCOLUMNS\fP value nor the terminal's screen size is available, \fBncurses\fR uses the size which may be specified in the terminfo database (i.e., the \fBcols\fR capability). .IP It is important that your application use a correct size for the screen. -However, this is not always possible because your application may be +This is not always possible because your application may be running on a host which does not honor NAWS (Negotiations About Window Size), or because you are temporarily running as another user. +However, setting \fBCOLUMNS\fP and/or \fBLINES\fP overrides the library's +use of the screen size obtained from the operating system. .IP -Either COLUMNS or LINES symbols may be specified independently. +Either \fBCOLUMNS\fP or \fBLINES\fP symbols may be specified independently. This is mainly useful to circumvent legacy misfeatures of terminal descriptions, e.g., xterm which commonly specifies a 65 line screen. For best results, \fBlines\fR and \fBcols\fR should not be specified in a terminal description for terminals which are run as emulations. .IP -Use the \fBuse_env\fR function to disable this feature. +Use the \fBuse_env\fR function to disable all use of external environment +(including system calls) to determine the screen size. .TP 5 ESCDELAY Specifies the total time, in milliseconds, for which ncurses will @@ -677,6 +680,13 @@ received from the xterm. If your application makes heavy use of multiple-clicking, you may wish to lengthen this default value because the timeout applies to the composed multi-click event as well as the individual clicks. +.IP +In addition to the environment variable, +this implementation provides a global variable with the same name. +Portable applications should not rely upon the presence of ESCDELAY +in either form, +but setting the environment variable rather than the global variable +does not create problems when compiling an application. .TP 5 HOME Tells \fBncurses\fR where your home directory is. @@ -750,6 +760,24 @@ this feature is made optional. Setting the NCURSES_NO_SETBUF variable disables output buffering, leaving the output in the original (usually line buffered) mode. .TP 5 +NCURSES_NO_UTF8_ACS +During initialization, the \fBncurses\fR library +checks for special cases where VT100 line-drawing (and the corresponding +alternate character set capabilities) described in the terminfo are known +to be missing. +Specifically, when running in a UTF-8 locale, +the Linux console emulator and the GNU screen program ignore these. +Ncurses checks the TERM environment variable for these. +For other special cases, you should set this environment variable. +Doing this tells ncurses to use Unicode values which correspond to +the VT100 line-drawing glyphs. +That works for the special cases cited, +and is likely to work for terminal emulators. +.IP +When setting this variable, you should set it to a nonzero value. +Setting it to zero (or to a nonnumber) +disables the special check for Linux and screen. +.TP 5 NCURSES_TRACE During initialization, the \fBncurses\fR debugging library checks the NCURSES_TRACE symbol. @@ -828,7 +856,7 @@ terminal capability database \fBterminfo\fR(\*n) and related pages whose names begin "curs_" for detailed routine descriptions. .SH EXTENSIONS -The \fBncurses\fR library can be compiled with an option (\fB\-DUSE_GETCAP\fR) +The \fBncurses\fR library can be compiled with an option (\fB-DUSE_GETCAP\fR) that falls back to the old-style /etc/termcap file if the terminal setup code cannot find a terminfo entry corresponding to \fBTERM\fR. Use of this feature is not recommended, as it essentially includes an entire termcap compiler in diff --git a/man/resizeterm.3x b/man/resizeterm.3x index da5d84df..888eaaf3 100644 --- a/man/resizeterm.3x +++ b/man/resizeterm.3x @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,9 +26,9 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" Author: Thomas E. Dickey 1996,1997,2002 +.\" Author: Thomas E. Dickey 1996-2005 .\" -.\" $Id: resizeterm.3x,v 1.10 2003/10/25 20:41:08 tom Exp $ +.\" $Id: resizeterm.3x,v 1.11 2005/06/25 22:19:42 tom Exp $ .TH resizeterm 3X "" .SH NAME \fBis_term_resized\fR, @@ -36,7 +36,7 @@ \fBresizeterm\fR - change the curses terminal size .SH SYNOPSIS \fB#include \fR - +.sp \fBbool is_term_resized(int lines, int columns);\fR .br \fBint resize_term(int lines, int columns);\fR @@ -49,7 +49,7 @@ primarily for use by programs running in an X Window terminal (e.g., xterm). The function \fBresizeterm\fR resizes the standard and current windows to the specified dimensions, and adjusts other bookkeeping data used by the \fBncurses\fR library that record the window dimensions. - +.LP Most of the work is done by the inner function \fBresize_term\fR. The outer function \fBresizeterm\fR adds bookkeeping for the SIGWINCH handler. When resizing the windows, @@ -59,7 +59,7 @@ The \fBresize_term\fR function attempts to resize all windows. However, due to the calling convention of pads, it is not possible to resize these without additional interaction with the application. - +.LP A support function \fBis_term_resized\fR is provided so that applications can check if the \fBresize_term\fR function would modify the window structures. It returns TRUE if the windows would be modified, and FALSE otherwise. @@ -80,6 +80,14 @@ will be read on the next call to \fBgetch\fR. This is used to alert an application that the screen size has changed, and that it should repaint special features such as pads that cannot be done automatically. +.PP +If the environment variables \fBLINES\fP or \fBCOLUMNS\fP are set, +this overrides the library's use of the window size obtained from +the operating system. +Thus, even if a SIGWINCH is received, +no screen size change may be recorded. +In that case, no \fBKEY_RESIZE\fP is queued for the next call to \fBgetch\fP; +an \fBERR\fP will be returned instead. .SH SEE ALSO \fBwresize\fR(3X). .SH AUTHOR diff --git a/man/term.5 b/man/term.5 index 94b6df51..e999b2e8 100644 --- a/man/term.5 +++ b/man/term.5 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: term.5,v 1.15 2003/05/10 20:33:49 jmc Exp $ +.\" $Id: term.5,v 1.16 2004/07/05 13:16:08 tom Exp $ .TH TERM 5 .ds n 5 .ds d @TERMINFO@ @@ -83,7 +83,7 @@ Short integers are stored in two 8-bit bytes. The first byte contains the least significant 8 bits of the value, and the second byte contains the most significant 8 bits. (Thus, the value represented is 256*second+first.) -The value \-1 is represented by the two bytes 0377, 0377; other negative +The value -1 is represented by the two bytes 0377, 0377; other negative values are illegal. This value generally means that the corresponding capability is missing from this terminal. Note that this format corresponds to the hardware of the \s-1VAX\s+1 @@ -112,11 +112,11 @@ All short integers are aligned on a short word boundary. The numbers section is similar to the flags section. Each capability takes up two bytes, and is stored as a little-endian short integer. -If the value represented is \-1, the capability is taken to be missing. +If the value represented is -1, the capability is taken to be missing. .PP The strings section is also similar. Each capability is stored as a short integer, in the format above. -A value of \-1 means the capability is missing. +A value of -1 means the capability is missing. Otherwise, the value is taken as an offset from the beginning of the string table. Special characters in ^X or \ec notation are stored in their diff --git a/man/terminfo.head b/man/terminfo.head index 3869cca0..398170ff 100644 --- a/man/terminfo.head +++ b/man/terminfo.head @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2000,2002 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2002,2004 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: terminfo.head,v 1.10 2002/08/17 23:37:10 tom Exp $ +.\" $Id: terminfo.head,v 1.12 2004/09/25 19:07:11 tom Exp $ .TH TERMINFO 5 "" "" "File Formats" .ds n 5 .ds d @TERMINFO@ @@ -59,6 +59,16 @@ and all others are understood as synonyms for the terminal name. All names but the last should be in lower case and contain no blanks; the last name may well contain upper case and blanks for readability. .PP +Lines beginning with a `#' in the first column are treated as comments. +While comment lines are legal at any point, the output of \fIcaptoinfo\fP +and \fIinfotocap\fP (aliases for \fItic\fP) +will move comments so they occur only between entries. +.PP +Newlines and leading tabs may be used for formatting entries for readability. +These are removed from parsed entries. +The \fIinfocmp\ -f\fP option relies on this to format if-then-else expressions: +the result can be read by \fItic\fP. +.PP Terminal names (except for the last, verbose entry) should be chosen using the following conventions. The particular piece of hardware making up the terminal should diff --git a/man/terminfo.tail b/man/terminfo.tail index fc6af2e0..00e0c592 100644 --- a/man/terminfo.tail +++ b/man/terminfo.tail @@ -1,5 +1,6 @@ -.\" $Id: terminfo.tail,v 1.38 2003/01/05 22:47:05 tom Exp $ +.\" $Id: terminfo.tail,v 1.42 2005/06/25 22:46:03 tom Exp $ .\" Beginning of terminfo.tail file +.\" See "terminfo.head" for copyright. .ps +1 .PP .SS A Sample Entry @@ -271,22 +272,22 @@ Thus the model 33 teletype is described as .DT .nf .ft CW -.in -7 - \s-133\||\|tty33\||\|tty\||\|model 33 teletype, +.\".in -2 +\s-133\||\|tty33\||\|tty\||\|model 33 teletype, bel=^G, cols#72, cr=^M, cud1=^J, hc, ind=^J, os,\s+1 -.in +7 +.\".in +2 .ft R .PP -while the Lear Siegler \s-1ADM\-3\s0 is described as +while the Lear Siegler \s-1ADM-3\s0 is described as .PP .DT .nf .ft CW -.in -7 - \s-1adm3\||\|3\||\|lsi adm3, +.\".in -2 +\s-1adm3\||\|3\||\|lsi adm3, am, bel=^G, clear=^Z, cols#80, cr=^M, cub1=^H, cud1=^J, ind=^J, lines#24,\s+1 -.in +7 +.\".in +2 .ft R .fi .PP @@ -365,27 +366,39 @@ push strlen(pop) arithmetic (%m is mod): push(pop() op pop()) .TP %& %| %^ -bit operations: push(pop() op pop()) +bit operations (AND, OR and exclusive-OR): push(pop() op pop()) .TP %= %> %< logical operations: push(pop() op pop()) .TP %A, %O -logical and & or operations (for conditionals) +logical AND and OR operations (for conditionals) .TP %! %~ -unary operations push(op pop()) +unary operations (logical and bit complement): push(op pop()) .TP %i add 1 to first two parameters (for ANSI terminals) .TP %? \fIexpr\fP %t \fIthenpart\fP %e \fIelsepart\fP %; -if-then-else, %e \fIelsepart\fP is optional. -else-if's are possible a la Algol 68: -.br +This forms an if-then-else. +The %e \fIelsepart\fP is optional. +Usually the %? \fIexpr\fP part pushes a value onto the stack, +and %t pops it from the stack, testing if it is nonzero (true). +If it is zero (false), control passes to the %e (else) part. +.IP +It is possible to form else-if's a la Algol 68: +.RS %? c\d1\u %t b\d1\u %e c\d2\u %t b\d2\u %e c\d3\u %t b\d3\u %e c\d4\u %t b\d4\u %e %; -.br -c\di\u are conditions, b\di\u are bodies. +.RE +.IP +where c\di\u are conditions, b\di\u are bodies. +.IP +Use the \fB-f\fP option of \fBtic\fP or \fBinfocmp\fP to see +the structure of if-the-else's. +Some strings, e.g., \fBsgr\fP can be very complicated when written +on one line. +The \fB-f\fP option splits the string into lines with the parts indented. .PP Binary operations are in postfix form with the operands in the usual order. That is, to get x-5 one would use "%gx%{5}%-". @@ -801,6 +814,12 @@ Putting this all together into the sgr sequence gives: .fi .PP Remember that if you specify sgr, you must also specify sgr0. +Also, some implementations rely on sgr being given if sgr0 is, +Not all terminfo entries necessarily have an sgr string, however. +Many terminfo entries are derived from termcap entries +which have no sgr string. +The only drawback to adding an sgr string is that termcap also +assumes that sgr0 does not exit alternate character set mode. .PP Terminals with the ``magic cookie'' glitch .RB ( xmc ) @@ -1046,7 +1065,7 @@ or .BR if . .SS Delays and Padding .PP -Many older and slower terminals don't support either XON/XOFF or DTR +Many older and slower terminals do not support either XON/XOFF or DTR handshaking, including hard copy terminals and some very archaic CRTs (including, for example, DEC VT100s). These may require padding characters @@ -1058,7 +1077,7 @@ close to full), set .BR xon . This capability suppresses the emission of padding. You can also set it -for memory-mapped console devices effectively that don't have a speed limit. +for memory-mapped console devices effectively that do not have a speed limit. Padding information should still be included so that routines can make better decisions about relative costs, but actual pad characters will not be transmitted. @@ -1479,39 +1498,39 @@ user preferences. .SS Pitfalls of Long Entries .PP Long terminfo entries are unlikely to be a problem; to date, no entry has even -approached terminfo's 4K string-table maximum. +approached terminfo's 4096-byte string-table maximum. Unfortunately, the termcap -translations are much more strictly limited (to 1K), thus termcap translations +translations are much more strictly limited (to 1023 bytes), thus termcap translations of long terminfo entries can cause problems. .PP -The man pages for 4.3BSD and older versions of tgetent() instruct the user to -allocate a 1K buffer for the termcap entry. +The man pages for 4.3BSD and older versions of \fBtgetent()\fP instruct the user to +allocate a 1024-byte buffer for the termcap entry. The entry gets null-terminated by the termcap library, so that makes the maximum safe length for a termcap entry 1k-1 (1023) bytes. Depending on what the application and the termcap library -being used does, and where in the termcap file the terminal type that tgetent() +being used does, and where in the termcap file the terminal type that \fBtgetent()\fP is searching for is, several bad things can happen. .PP Some termcap libraries print a warning message or exit if they find an -entry that's longer than 1023 bytes; others don't; others truncate the +entry that's longer than 1023 bytes; others do not; others truncate the entries to 1023 bytes. Some application programs allocate more than -the recommended 1K for the termcap entry; others don't. +the recommended 1K for the termcap entry; others do not. .PP Each termcap entry has two important sizes associated with it: before "tc" expansion, and after "tc" expansion. "tc" is the capability that tacks on another termcap entry to the end of the current one, to add on its capabilities. -If a termcap entry doesn't use the "tc" +If a termcap entry does not use the "tc" capability, then of course the two lengths are the same. .PP The "before tc expansion" length is the most important one, because it affects more than just users of that particular terminal. This is the length of the entry as it exists in /etc/termcap, minus the -backslash-newline pairs, which tgetent() strips out while reading it. +backslash-newline pairs, which \fBtgetent()\fP strips out while reading it. Some termcap libraries strip off the final newline, too (GNU termcap does not). Now suppose: .TP 5 @@ -1527,12 +1546,12 @@ the whole entry into the buffer, no matter what its length, to see if it's the entry it wants, .TP 5 * -and tgetent() is searching for a terminal type that either is the +and \fBtgetent()\fP is searching for a terminal type that either is the long entry, appears in the termcap file after the long entry, or -doesn't appear in the file at all (so that tgetent() has to search +does not appear in the file at all (so that \fBtgetent()\fP has to search the whole termcap file). .PP -Then tgetent() will overwrite memory, perhaps its stack, and probably core dump +Then \fBtgetent()\fP will overwrite memory, perhaps its stack, and probably core dump the program. Programs like telnet are particularly vulnerable; modern telnets pass along values like the terminal type automatically. @@ -1545,7 +1564,7 @@ here but will return incorrect data for the terminal. .PP The "after tc expansion" length will have a similar effect to the above, but only for people who actually set TERM to that terminal -type, since tgetent() only does "tc" expansion once it's found the +type, since \fBtgetent()\fP only does "tc" expansion once it's found the terminal type it was looking for, not while searching. .PP In summary, a termcap entry that is longer than 1023 bytes can cause, @@ -1569,12 +1588,12 @@ of terminfo (under HP-UX and AIX) which diverged from System V terminfo after SVr1, and have added extension capabilities to the string table that (in the binary format) collide with System V and XSI Curses extensions. .SH EXTENSIONS -Some SVr4 \fBcurses\fR implementations, and all previous to SVr4, don't +Some SVr4 \fBcurses\fR implementations, and all previous to SVr4, do not interpret the %A and %O operators in parameter strings. .PP SVr4/XPG4 do not specify whether \fBmsgr\fR licenses movement while in an alternate-character-set mode (such modes may, among other things, map -CR and NL to characters that don't trigger local motions). +CR and NL to characters that do not trigger local motions). The \fBncurses\fR implementation ignores \fBmsgr\fR in \fBALTCHARSET\fR mode. This raises the possibility that an XPG4 @@ -1631,7 +1650,11 @@ Supports both the SVr4 set and the AIX extensions. \*d/?/* files containing terminal descriptions .SH SEE ALSO -\fBtic\fR(1M), \fBcurses\fR(3X), \fBprintf\fR(3S), \fBterm\fR(\*n). +\fBtic\fR(1M), +\fBinfocmp\fR(1M), +\fBcurses\fR(3X), +\fBprintf\fR(3S), +\fBterm\fR(\*n). .SH AUTHORS Zeyd M. Ben-Halim, Eric S. Raymond, Thomas E. Dickey. Based on pcurses by Pavel Curtis. diff --git a/man/tic.1m b/man/tic.1m index 29d52619..08de74aa 100644 --- a/man/tic.1m +++ b/man/tic.1m @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: tic.1m,v 1.35 2003/05/11 00:32:53 tom Exp $ +.\" $Id: tic.1m,v 1.38 2005/04/30 19:39:28 tom Exp $ .TH tic 1M "" .ds n 5 .ds d @TERMINFO@ @@ -34,7 +34,7 @@ \fBtic\fR - the \fIterminfo\fR entry-description compiler .SH SYNOPSIS \fBtic\fR -[\fB\-\ +[\fB-\ 1\ C\ G\ @@ -52,11 +52,11 @@ s\ t\ x\ \fR] -[\fB\-e\fR \fInames\fR] -[\fB\-o\fR \fIdir\fR] -[\fB\-R\fR \fIsubset\fR] -[\fB\-v\fR[\fIn\fR]] -[\fB\-w\fR[\fIn\fR]] +[\fB-e\fR \fInames\fR] +[\fB-o\fR \fIdir\fR] +[\fB-R\fR \fIsubset\fR] +[\fB-v\fR[\fIn\fR]] +[\fB-w\fR[\fIn\fR]] \fIfile\fR .br .SH DESCRIPTION @@ -78,31 +78,33 @@ Libraries that read terminfo entries are expected to check for a TERMINFO directory first, look at \fI$HOME/.terminfo\fR if TERMINFO is not set, and finally look in \fI\*d\fR. .TP -\fB\-1\fR +\fB-1\fR restricts the output to a single column .TP -\fB\-a\fR +\fB-a\fR tells \fBtic\fP to retain commented-out capabilities rather than discarding them. Capabilities are commented by prefixing them with a period. -This sets the \fB\-x\fR option, because it treats the commented-out +This sets the \fB-x\fR option, because it treats the commented-out entries as user-defined names. +If the source is termcap, accept the 2-character names required by version 6. +Otherwise these are ignored. .TP -\fB\-C\fR -Force source translation to termcap format. Note: this differs from the \fB\-C\fR +\fB-C\fR +Force source translation to termcap format. Note: this differs from the \fB-C\fR option of \fIinfocmp\fR(1M) in that it does not merely translate capability names, but also translates terminfo strings to termcap format. Capabilities that are not translatable are left in the entry under their terminfo names but commented out with two preceding dots. .TP -\fB\-c\fR +\fB-c\fR tells \fBtic\fP to only check \fIfile\fR for errors, including syntax problems and -bad use links. If you specify \fB\-C\fR (\fB\-I\fR) with this option, the code +bad use links. If you specify \fB-C\fR (\fB-I\fR) with this option, the code will print warnings about entries which, after use resolution, are more than 1023 (4096) bytes long. Due to a fixed buffer length in older termcap libraries (and a documented limit in terminfo), these entries may cause core dumps. .TP -\fB\-e \fR\fInames\fR +\fB-e \fR\fInames\fR Limit writes and translations to the following comma-separated list of terminals. If any name or alias of a terminal matches one of the names in @@ -110,28 +112,28 @@ the list, the entry will be written or translated as normal. Otherwise no output will be generated for it. The option value is interpreted as a file containing the list if it contains a '/'. -(Note: depending on how tic was compiled, this option may require \fB\-I\fR or \fB\-C\fR.) +(Note: depending on how tic was compiled, this option may require \fB-I\fR or \fB-C\fR.) .TP -\fB\-f\fR +\fB-f\fR Display complex terminfo strings which contain if/then/else/endif expressions indented for readability. .TP -\fB\-G\fR +\fB-G\fR Display constant literals in decimal form rather than their character equivalents. .TP -\fB\-g\fR +\fB-g\fR Display constant character literals in quoted form rather than their decimal equivalents. .TP -\fB\-I\fR +\fB-I\fR Force source translation to terminfo format. .TP -\fB\-L\fR +\fB-L\fR Force source translation to terminfo format using the long C variable names listed in <\fBterm.h\fR> .TP -\fB\-N\fR +\fB-N\fR Disable smart defaults. Normally, when translating from termcap to terminfo, the compiler makes a number of assumptions about the defaults of string capabilities @@ -143,42 +145,42 @@ normally suppresses output of obsolete termcap capabilities such as \fBbs\fR. This option forces a more literal translation that also preserves the obsolete capabilities. .TP -\fB\-o\fR\fIdir\fR +\fB-o\fR\fIdir\fR Write compiled entries to given directory. Overrides the TERMINFO environment variable. .TP -\fB\-R\fR\fIsubset\fR +\fB-R\fR\fIsubset\fR Restrict output to a given subset. This option is for use with archaic versions of terminfo like those on SVr1, Ultrix, or HP/UX that do not support the full set of SVR4/XSI Curses terminfo; and outright broken ports like AIX 3.x that have their own extensions incompatible with SVr4/XSI. Available subsets are "SVr1", "Ultrix", "HP", "BSD" and "AIX"; see \fBterminfo\fR(\*n) for details. .TP -\fB\-r\fR +\fB-r\fR Force entry resolution (so there are no remaining tc capabilities) even when doing translation to termcap format. This may be needed if you are preparing a termcap file for a termcap library (such as GNU termcap through version 1.3 or BSD termcap through 4.3BSD) that does not handle multiple tc capabilities per entry. .TP -\fB\-s\fR +\fB-s\fR Summarize the compile by showing the directory into which entries are written, and the number of entries which are compiled. .TP -\fB\-T\fR +\fB-T\fR eliminates size-restrictions on the generated text. This is mainly useful for testing and analysis, since the compiled descriptions are limited (e.g., 1023 for termcap, 4096 for terminfo). .TP -\fB\-t\fR +\fB-t\fR tells \fBtic\fP to discard commented-out capabilities. Normally when translating from terminfo to termcap, untranslatable capabilities are commented-out. .TP -\fB\-V\fR +\fB-V\fR reports the version of ncurses which was used in this program, and exits. .TP -\fB\-v\fR\fIn\fR +\fB-v\fR\fIn\fR specifies that (verbose) output be written to standard error trace information showing \fBtic\fR's progress. The optional integer \fIn\fR is a number from 1 to 10, inclusive, indicating the desired @@ -186,14 +188,16 @@ level of detail of information. If \fIn\fR is omitted, the default level is 1. If \fIn\fR is specified and greater than 1, the level of detail is increased. .TP -\fB\-w\fR\fIn\fR +\fB-w\fR\fIn\fR specifies the width of the output. .TP -\fB\-x\fR +\fB-x\fR Treat unknown capabilities as user-defined. That is, if you supply a capability name which \fBtic\fP does not recognize, it will infer its type (boolean, number or string) from the syntax and make an extended table entry for that. +User-defined capability strings +whose name begins with ``k'' are treated as function keys. .TP \fIfile\fR contains one or more \fBterminfo\fR terminal descriptions in source @@ -274,25 +278,25 @@ The error messages from this \fBtic\fR have the same format as GNU C error messages, and can be parsed by GNU Emacs's compile facility. The -\fB\-C\fR, -\fB\-G\fR, -\fB\-I\fR, -\fB\-N\fR, -\fB\-R\fR, -\fB\-T\fR, -\fB\-V\fR, -\fB\-a\fR, -\fB\-e\fR, -\fB\-f\fR, -\fB\-g\fR, -\fB\-o\fR, -\fB\-r\fR, -\fB\-s\fR, -\fB\-t\fR and -\fB\-x\fR +\fB-C\fR, +\fB-G\fR, +\fB-I\fR, +\fB-N\fR, +\fB-R\fR, +\fB-T\fR, +\fB-V\fR, +\fB-a\fR, +\fB-e\fR, +\fB-f\fR, +\fB-g\fR, +\fB-o\fR, +\fB-r\fR, +\fB-s\fR, +\fB-t\fR and +\fB-x\fR options are not supported under SVr4. -The SVr4 \fB\-c\fR mode does not report bad use links. +The SVr4 \fB-c\fR mode does not report bad use links. System V does not compile entries to or read entries from your \fI$HOME/.terminfo\fR directory unless TERMINFO is explicitly set to it. diff --git a/man/toe.1m b/man/toe.1m index 4e69f55f..b7dc9596 100644 --- a/man/toe.1m +++ b/man/toe.1m @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,45 +26,45 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: toe.1m,v 1.12 2003/05/11 00:32:53 tom Exp $ +.\" $Id: toe.1m,v 1.13 2004/07/05 13:16:08 tom Exp $ .TH toe 1M "" .ds n 5 .ds d @TERMINFO@ .SH NAME \fBtoe\fR - table of (terminfo) entries .SH SYNOPSIS -\fBtoe\fR [\fB\-v\fR[\fIn\fR]] [\fB\-huUV\fR] \fIfile...\fR +\fBtoe\fR [\fB-v\fR[\fIn\fR]] [\fB-huUV\fR] \fIfile...\fR .br .SH DESCRIPTION .PP With no options, \fBtoe\fR lists all available terminal types by primary name with descriptions. File arguments specify the directories to be scanned; if no such arguments are given, your default terminfo directory is scanned. If you -also specify the \fB\-h\fR option, a directory header will be issued as each +also specify the \fB-h\fR option, a directory header will be issued as each directory is entered. .PP There are other options intended for use by terminfo file maintainers: .TP -\fB\-u\fR \fIfile\fR +\fB-u\fR \fIfile\fR says to issue a report on dependencies in the given file. This report condenses the `use' relation: each line consists of the primary name of a terminal that has use capabilities, followed by a colon, followed by the whitespace-separated primary names of all terminals which occur in those use capabilities, followed by a newline .TP -\fB\-U\fR \fIfile\fR +\fB-U\fR \fIfile\fR says to issue a report on reverse dependencies in the given file. This report reverses the `use' relation: each line consists of the primary name of a terminal that occurs in use capabilities, followed by a colon, followed by the whitespace-separated primary names of all terminals which depend on it, followed by a newline. .TP -\fB\-v\fR\fIn\fR +\fB-v\fR\fIn\fR specifies that (verbose) output be written to standard error trace information showing \fBtoe\fR's progress. The optional integer \fIn\fR is a number from 1 to 10, interpreted as for \fBtic\fR(1). .TP 5 -\fB\-V\fR +\fB-V\fR reports the version of ncurses which was used in this program, and exits. .SH FILES .TP 5 diff --git a/man/tput.1 b/man/tput.1 index c657a162..b12385e1 100644 --- a/man/tput.1 +++ b/man/tput.1 @@ -1,6 +1,6 @@ '\" t .\"*************************************************************************** -.\" Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -27,70 +27,84 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: tput.1,v 1.20 2003/05/11 00:32:53 tom Exp $ +.\" $Id: tput.1,v 1.22 2005/01/08 17:44:26 tom Exp $ .TH tput 1 "" .ds d @TERMINFO@ .ds n 1 .SH NAME \fBtput\fR, \fBreset\fR - initialize a terminal or query terminfo database .SH SYNOPSIS -\fBtput\fR [\fB\-T\fR\fItype\fR] \fIcapname\fR [\fIparms\fR ... ] +\fBtput\fR [\fB-T\fR\fItype\fR] \fIcapname\fR [\fIparms\fR ... ] .br -\fBtput\fR [\fB\-T\fR\fItype\fR] \fBinit\fR +\fBtput\fR [\fB-T\fR\fItype\fR] \fBinit\fR .br -\fBtput\fR [\fB\-T\fR\fItype\fR] \fBreset\fR +\fBtput\fR [\fB-T\fR\fItype\fR] \fBreset\fR .br -\fBtput\fR [\fB\-T\fR\fItype\fR] \fBlongname\fR +\fBtput\fR [\fB-T\fR\fItype\fR] \fBlongname\fR .br -\fBtput \-S\fR \fB<<\fR +\fBtput -S\fR \fB<<\fR .br -\fBtput \-V\fR +\fBtput -V\fR .br .SH DESCRIPTION The \fBtput\fR utility uses the \fBterminfo\fR database to make the values of terminal-dependent capabilities and information available to the shell (see \fBsh\fR(1)), to initialize or reset the terminal, or -return the long name of the requested terminal type. \fBtput\fR -outputs a string if the attribute (\fIcap\fRability \fIname\fR) is of -type string, or an integer if the attribute is of type integer. If -the attribute is of type boolean, \fBtput\fR simply sets the exit code -(\fB0\fR for TRUE if the terminal has the capability, \fB1\fR for -FALSE if it does not), and produces no output. Before using a value -returned on standard output, the user should test the exit code -[\fB$?\fR, see \fBsh\fR(1)] to be sure it is \fB0\fR. +return the long name of the requested terminal type. +The result depends upon the capability's type: +.RS +.TP 5 +string +\fBtput\fR writes the string to the standard output. +No trailing newline is supplied. +.TP +integer +\fBtput\fR writes the decimal value to the standard output, +with a trailing newline. +.TP +boolean +\fBtput\fR simply sets the exit code +(\fB0\fR for TRUE if the terminal has the capability, +\fB1\fR for FALSE if it does not), +and writes nothing to the standard output. +.RE +.PP +Before using a value returned on the standard output, +the application should test the exit code +(e.g., \fB$?\fR, see \fBsh\fR(1)) to be sure it is \fB0\fR. (See the \fBEXIT CODES\fR and \fBDIAGNOSTICS\fR sections.) For a complete list of capabilities and the \fIcapname\fR associated with each, see \fBterminfo\fR(\*n). .TP -\fB\-T\fR\fItype\fR +\fB-T\fR\fItype\fR indicates the \fItype\fR of terminal. Normally this option is unnecessary, because the default is taken from the environment -variable \fBTERM\fR. If \fB\-T\fR is specified, then the shell +variable \fBTERM\fR. If \fB-T\fR is specified, then the shell variables \fBLINES\fR and \fBCOLUMNS\fR will be ignored,and the operating system will not be queried for the actual screen size. .TP \fIcapname\fR -indicates the attribute from the \fBterminfo\fR database. When +indicates the capability from the \fBterminfo\fR database. When \fBtermcap\fR support is compiled in, the \fBtermcap\fR name for -the attribute is also accepted. +the capability is also accepted. .TP \fIparms\fR -If the attribute is a string that takes parameters, the arguments +If the capability is a string that takes parameters, the arguments \fIparms\fR will be instantiated into the string. -An all-numeric argument will be passed to the attribute as a number. .IP +Most parameters are numbers. Only a few terminfo capabilities require string parameters; \fBtput\fR uses a table to decide which to pass as strings. Normally \fBtput\fR uses \fBtparm\fR (3X) to perform the substitution. -If no parameters are given for the attribute, +If no parameters are given for the capability, \fBtput\fR writes the string without performing the substitution. .TP -\fB\-S\fR +\fB-S\fR allows more than one capability per invocation of \fBtput\fR. The capabilities must be passed to \fBtput\fR from the standard input instead of from the command line (see example). Only one \fIcapname\fR is allowed per line. -The \fB\-S\fR option changes the +The \fB-S\fR option changes the meaning of the \fB0\fR and \fB1\fR boolean and string exit codes (see the EXIT CODES section). .IP @@ -98,12 +112,12 @@ Again, \fBtput\fR uses a table and the presence of parameters in its input to decide whether to use \fBtparm\fR (3X), and how to interpret the parameters. .TP -\fB\-V\fR +\fB-V\fR reports the version of ncurses which was used in this program, and exits. .TP \fBinit\fR If the \fBterminfo\fR database is present and an entry for the user's -terminal exists (see \fB\-T\fR\fItype\fR, above), the following will +terminal exists (see \fB-T\fR\fItype\fR, above), the following will occur: (1) if present, the terminal's initialization strings will be output (\fBis1\fR, \fBis2\fR, \fBis3\fR, \fBif\fR, \fBiprog\fR), (2) any delays (e.g., newline) specified in the entry will be set in the @@ -122,7 +136,7 @@ Otherwise, \fBreset\fR acts identically to \fBinit\fR. .TP \fBlongname\fR If the \fBterminfo\fR database is present and an entry for the -user's terminal exists (see \fB\-T\fR\fItype\fR above), then the long name +user's terminal exists (see \fB-T\fR\fItype\fR above), then the long name of the terminal will be put out. The long name is the last name in the first line of the terminal's description in the \fBterminfo\fR database [see \fBterm\fR(5)]. @@ -139,7 +153,7 @@ command should be included in everyone's .profile after the environmental variable \fBTERM\fR has been exported, as illustrated on the \fBprofile\fR(5) manual page. .TP 5 -\fBtput \-T5620 reset\fR +\fBtput -T5620 reset\fR Reset an AT&T 5620 terminal, overriding the type of terminal in the environmental variable \fBTERM\fR. .TP 5 @@ -154,7 +168,7 @@ Echo the clear-screen sequence for the current terminal. \fBtput cols\fR Print the number of columns for the current terminal. .TP 5 -\fBtput \-T450 cols\fR +\fBtput -T450 cols\fR Print the number of columns for the 450 terminal. .TP 5 \fBbold=`tput smso` offbold=`tput rmso`\fR @@ -178,7 +192,7 @@ type of terminal specified in the environmental variable \fBTERM\fR. .PP .RS 5 -\fBtput \-S < clear\fR .br @@ -200,12 +214,6 @@ The list is terminated by an exclamation mark (\fB!\fR) on a line by itself. \fB\*d\fR compiled terminal description database .TP -\fB/usr/include/curses.h\fR -\fBcurses\fR(3X) header file -.TP -\fB/usr/include/term.h\fR -\fBterminfo\fR header file -.TP \fB@DATADIR@/tabset/*\fR tab settings for some terminals, in a format appropriate to be output to the terminal (escape @@ -213,7 +221,7 @@ sequences that set margins and tabs); for more information, see the "Tabs and Initialization" section of \fBterminfo\fR(5) .SH EXIT CODES -If the \fB\-S\fR option is used, +If the \fB-S\fR option is used, \fBtput\fR checks for errors from each line, and if any errors are found, will set the exit code to 4 plus the number of lines with errors. @@ -221,7 +229,7 @@ If no errors are found, the exit code is \fB0\fR. No indication of which line failed can be given so exit code \fB1\fR will never appear. Exit codes \fB2\fR, \fB3\fR, and \fB4\fR retain their usual interpretation. -If the \fB\-S\fR option is not used, +If the \fB-S\fR option is not used, the exit code depends on the type of \fIcapname\fR: .RS 5 .TP @@ -241,7 +249,7 @@ a value of \fB0\fR is always set, whether or not \fIcapname\fR is defined for this terminal \fItype\fR. To determine if \fIcapname\fR is defined for this terminal \fItype\fR, the user must test the value written to standard output. -A value of \fB\-1\fR +A value of \fB-1\fR means that \fIcapname\fR is not defined for this terminal \fItype\fR. .TP .I other @@ -262,17 +270,17 @@ exit code error message \fB0\fR T{ (\fIcapname\fR is a numeric variable that is not specified in the \fBterminfo\fR(\*n) database for this terminal type, e.g. -\fBtput \-T450 lines\fR and \fBtput \-T2621 xmc\fR) +\fBtput -T450 lines\fR and \fBtput -T2621 xmc\fR) T} \fB1\fR no error message is printed, see the \fBEXIT CODES\fR section. \fB2\fR usage error \fB3\fR unknown terminal \fItype\fR or no \fBterminfo\fR database \fB4\fR unknown \fBterminfo\fR capability \fIcapname\fR -\fB>4\fR error occurred in \-S +\fB>4\fR error occurred in -S = .TE .SH PORTABILITY -The \fBlongname\fR and \fB\-S\fR options, and the parameter-substitution +The \fBlongname\fR and \fB-S\fR options, and the parameter-substitution features used in the \fBcup\fR example, are not supported in BSD curses or in AT&T/USL curses before SVr4. .SH SEE ALSO diff --git a/man/tset.1 b/man/tset.1 index 3a78b37b..1c8cc363 100644 --- a/man/tset.1 +++ b/man/tset.1 @@ -1,5 +1,5 @@ .\"*************************************************************************** -.\" Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. * +.\" Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * .\" * .\" Permission is hereby granted, free of charge, to any person obtaining a * .\" copy of this software and associated documentation files (the * @@ -26,14 +26,14 @@ .\" authorization. * .\"*************************************************************************** .\" -.\" $Id: tset.1,v 1.13 2003/05/11 00:32:53 tom Exp $ +.\" $Id: tset.1,v 1.15 2005/03/20 18:27:09 tom Exp $ .TH tset 1 "" .SH NAME \fBtset\fR, \fBreset\fR - terminal initialization .SH SYNOPSIS -tset [\-IQVqrs] [\-] [\-e \fIch\fR] [\-i \fIch\fR] [\-k \fIch\fR] [\-m \fImapping\fR] [\fIterminal\fR] +\fBtset\fR [\fB-IQVcqrsw\fR] [\fB-\fR] [\fB-e\fR \fIch\fR] [\fB-i\fR \fIch\fR] [\fB-k\fR \fIch\fR] [\fB-m\fR \fImapping\fR] [\fIterminal\fR] .br -reset [\-IQVqrs] [\-] [\-e \fIch\fR] [\-i \fIch\fR] [\-k \fIch\fR] [\-m \fImapping\fR] [\fIterminal\fR] +\fBreset\fR [\fB-IQVcqrsw\fR] [\fB-\fR] [\fB-e\fR \fIch\fR] [\fB-i\fR \fIch\fR] [\fB-k\fR \fIch\fR] [\fB-m\fR \fImapping\fR] [\fIterminal\fR] .SH DESCRIPTION \&\fBTset\fR initializes terminals. \fBTset\fR first determines the type of terminal that you are using. @@ -50,8 +50,10 @@ System-V-like UNIXes, \fIgetty\fR does this job by setting .PP 4. The default terminal type, ``unknown''. .PP -If the terminal type was not specified on the command-line, the \fB\-m\fR -option mappings are then applied (see below for more information). +If the terminal type was not specified on the command-line, the \fB-m\fR +option mappings are then applied (see the section +.B TERMINAL TYPE MAPPING +for more information). Then, if the terminal type begins with a question mark (``?''), the user is prompted for confirmation of the terminal type. An empty response confirms the type, or, another type can be entered to specify @@ -65,6 +67,9 @@ and tab initialization strings are sent to the standard error output. Finally, if the erase, interrupt and line kill characters have changed, or are not set to their default values, their values are displayed to the standard error output. +Use the \fB-c\fP or \fB-w\fP option to select only the window sizing +versus the other initialization. +If neither option is given, both are assumed. .PP When invoked as \fBreset\fR, \fBtset\fR sets cooked and echo modes, turns off cbreak and raw modes, turns on newline translation and @@ -81,50 +86,64 @@ Also, the terminal will often not echo the command. .PP The options are as follows: .TP 5 -.B \-q -The terminal type is displayed to the standard output, and the terminal is -not initialized in any way. The option `-' by itself is equivalent but -archaic. -.TP -.B \-e +.B -c +Set control characters and modes. +.B -e Set the erase character to \fIch\fR. .TP -.B \-I +.B -I Do not send the terminal or tab initialization strings to the terminal. .TP -.B \-Q -Don't display any values for the erase, interrupt and line kill characters. -.TP -.B \-V -reports the version of ncurses which was used in this program, and exits. -.TP -.B \-i +.B -i Set the interrupt character to \fIch\fR. .TP -.B \-k +.B -k Set the line kill character to \fIch\fR. .TP -.B \-m +.B -m Specify a mapping from a port type to a terminal. -See below for more information. +See the section +.B TERMINAL TYPE MAPPING +for more information. +.TP +.B -Q +Do not display any values for the erase, interrupt and line kill characters. +Normally \fBtset\fR displays the values for control characters which +differ from the system's default values. .TP -.B \-r +.B -q +The terminal type is displayed to the standard output, and the terminal is +not initialized in any way. The option `-' by itself is equivalent but +archaic. +.TP +.B -r Print the terminal type to the standard error output. .TP -.B \-s +.B -s Print the sequence of shell commands to initialize the environment variable \fBTERM\fR to the standard output. -See the section below on setting the environment for details. +See the section +.B SETTING THE ENVIRONMENT +for details. +.TP +.B -V +reports the version of ncurses which was used in this program, and exits. +.TP +.B -w +Resize the window to match the size deduced via \fBsetupterm\fP. +Normally this has no effect, +unless \fBsetupterm\fP is not able to detect the window size. .PP The arguments for the \fB-e\fR, \fB-i\fR, and \fB-k\fR options may either be entered as actual characters or by using the `hat' notation, i.e. control-h may be specified as ``^H'' or ``^h''. +. .SH SETTING THE ENVIRONMENT It is often desirable to enter the terminal type and information about the terminal's capabilities into the shell's environment. -This is done using the \fB\-s\fR option. +This is done using the \fB-s\fR option. .PP -When the \fB\-s\fR option is specified, the commands to enter the information +When the \fB-s\fR option is specified, the commands to enter the information into the shell's environment are written to the standard output. If the \fBSHELL\fR environmental variable ends in ``csh'', the commands are for \fBcsh\fR, otherwise, they are for \fBsh\fR. @@ -132,7 +151,7 @@ Note, the \fBcsh\fR commands set and unset the shell variable \fBnoglob\fR, leaving it unset. The following line in the \fB.login\fR or \fB.profile\fR files will initialize the environment correctly: - eval \`tset \-s options ... \` + eval \`tset -s options ... \` .SH TERMINAL TYPE MAPPING When the terminal is not hardwired into the system (or the current @@ -142,13 +161,13 @@ something generic like \fBnetwork\fR, \fBdialup\fR, or \fBunknown\fR. When \fBtset\fR is used in a startup script it is often desirable to provide information about the type of terminal used on such ports. .PP -The purpose of the \fB\-m\fR option is to map +The purpose of the \fB-m\fR option is to map from some set of conditions to a terminal type, that is, to tell \fBtset\fR ``If I'm on this port at a particular speed, guess that I'm on that kind of terminal''. .PP -The argument to the \fB\-m\fR option consists of an optional port type, an +The argument to the \fB-m\fR option consists of an optional port type, an optional operator, an optional baud rate specification, an optional colon (``:'') character and a terminal type. The port type is a string (delimited by either the operator or the colon character). The @@ -159,7 +178,7 @@ The baud rate is specified as a number and is compared with the speed of the standard error output (which should be the control terminal). The terminal type is a string. .PP -If the terminal type is not specified on the command line, the \fB\-m\fR +If the terminal type is not specified on the command line, the \fB-m\fR mappings are applied to the terminal type. If the port type and baud rate match the mapping, the terminal type specified in the mapping replaces the current type. If more than one mapping is specified, the @@ -174,16 +193,16 @@ and the baud rate is greater than 9600 baud, a terminal type of .PP If no baud rate is specified, the terminal type will match any baud rate. If no port type is specified, the terminal type will match any port type. -For example, \fB\-m dialup:vt100 \-m :?xterm\fR +For example, \fB-m dialup:vt100 -m :?xterm\fR will cause any dialup port, regardless of baud rate, to match the terminal type vt100, and any non-dialup port type to match the terminal type ?xterm. Note, because of the leading question mark, the user will be queried on a default port as to whether they are actually using an xterm terminal. .PP -No whitespace characters are permitted in the \fB\-m\fR option argument. +No whitespace characters are permitted in the \fB-m\fR option argument. Also, to avoid problems with meta-characters, it is suggested that the -entire \fB\-m\fR option argument be placed within single quote characters, +entire \fB-m\fR option argument be placed within single quote characters, and that \fBcsh\fR users insert a backslash character (``\e'') before any exclamation marks (``!''). .SH HISTORY @@ -197,33 +216,33 @@ can set \fBTERM\fR appropriately for each dial-up line; this obviates what was \fBtset\fR's most important use). This implementation behaves like 4.4BSD tset, with a few exceptions specified here. .PP -The \fB\-S\fR option of BSD tset no longer works; it prints an error message to stderr -and dies. The \fB\-s\fR option only sets \fBTERM\fR, not \fBTERMCAP\fP. Both these +The \fB-S\fR option of BSD tset no longer works; it prints an error message to stderr +and dies. The \fB-s\fR option only sets \fBTERM\fR, not \fBTERMCAP\fP. Both these changes are because the \fBTERMCAP\fR variable is no longer supported under -terminfo-based \fBncurses\fR, which makes \fBtset \-S\fR useless (we made it die +terminfo-based \fBncurses\fR, which makes \fBtset -S\fR useless (we made it die noisily rather than silently induce lossage). .PP There was an undocumented 4.4BSD feature that invoking tset via a link named `TSET` (or via any other name beginning with an upper-case letter) set the terminal to use upper-case only. This feature has been omitted. .PP -The \fB\-A\fR, \fB\-E\fR, \fB\-h\fR, \fB\-u\fR and \fB\-v\fR +The \fB-A\fR, \fB-E\fR, \fB-h\fR, \fB-u\fR and \fB-v\fR options were deleted from the \fBtset\fR utility in 4.4BSD. None of them were documented in 4.3BSD and all are of limited utility at best. -The \fB\-a\fR, -\fB\d\fR, and -\fB\p\fR options are similarly +The \fB-a\fR, \fB-d\fR, and \fB-p\fR options are similarly not documented or useful, but were retained as they appear to be in widespread use. It is strongly recommended that any usage of these -three options be changed to use the \fB\-m\fR option instead. The --n option remains, but has no effect. The \fB\-adnp\fR options are therefore +three options be changed to use the \fB-m\fR option instead. The +-n option remains, but has no effect. The \fB-adnp\fR options are therefore omitted from the usage summary above. .PP -It is still permissible to specify the \fB\-e\fR, \fB\-i\fR, and \fB\-k\fR options without +It is still permissible to specify the \fB-e\fR, \fB-i\fR, and \fB-k\fR options without arguments, although it is strongly recommended that such usage be fixed to explicitly specify the character. .PP -As of 4.4BSD, executing \fBtset\fR as \fBreset\fR no longer implies the \fB\-Q\fR +As of 4.4BSD, executing \fBtset\fR as \fBreset\fR no longer implies the \fB-Q\fR option. Also, the interaction between the - option and the \fIterminal\fR argument in some historic implementations of \fBtset\fR has been removed. .SH ENVIRONMENT @@ -240,6 +259,7 @@ terminal capability database csh(1), sh(1), stty(1), +setupterm(3), tty(4), termcap(5), ttys(5), diff --git a/menu/Makefile.in b/menu/Makefile.in index 28152290..2ddfa337 100644 --- a/menu/Makefile.in +++ b/menu/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.41 2003/11/01 22:44:33 tom Exp $ +# $Id: Makefile.in,v 1.42 2004/12/11 23:33:16 tom Exp $ ############################################################################## # Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. # # # @@ -79,7 +79,7 @@ CC = @CC@ CPP = @CPP@ CFLAGS = @CFLAGS@ -CPPFLAGS = -DHAVE_CONFIG_H @CPPFLAGS@ +CPPFLAGS = -I@top_srcdir@/ncurses -DHAVE_CONFIG_H @CPPFLAGS@ CCFLAGS = $(CPPFLAGS) $(CFLAGS) diff --git a/menu/llib-lmenu b/menu/llib-lmenu index 82a7af48..fc17cc36 100644 --- a/menu/llib-lmenu +++ b/menu/llib-lmenu @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999,2002 Free Software Foundation, Inc. * + * Copyright (c) 1999-2002,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1996-1999,2002 * + * Author: Thomas E. Dickey 1996-2002,2005 * ****************************************************************************/ /* LINTLIBRARY */ @@ -132,6 +132,11 @@ void _nc_Disconnect_Items( MENU *menu) { /* void */ } +#undef _nc_Calculate_Text_Width +int _nc_Calculate_Text_Width( + const TEXT *item) + { return(*(int *)0); } + #undef _nc_Calculate_Item_Length_and_Width void _nc_Calculate_Item_Length_and_Width( MENU *menu) @@ -481,6 +486,38 @@ WINDOW *menu_sub( const MENU *menu) { return(*(WINDOW **)0); } +/* ./m_trace.c */ + +#undef _nc_retrace_item +ITEM *_nc_retrace_item( + ITEM *code) + { return(*(ITEM **)0); } + +#undef _nc_retrace_item_ptr +ITEM **_nc_retrace_item_ptr( + ITEM **code) + { return(*(ITEM ***)0); } + +#undef _nc_retrace_item_opts +Item_Options _nc_retrace_item_opts( + Item_Options code) + { return(*(Item_Options *)0); } + +#undef _nc_retrace_menu +MENU *_nc_retrace_menu( + MENU *code) + { return(*(MENU **)0); } + +#undef _nc_retrace_menu_hook +Menu_Hook _nc_retrace_menu_hook( + Menu_Hook code) + { return(*(Menu_Hook *)0); } + +#undef _nc_retrace_menu_opts +Menu_Options _nc_retrace_menu_opts( + Menu_Options code) + { return(*(Menu_Options *)0); } + /* ./m_userptr.c */ #undef set_menu_userptr diff --git a/menu/llib-lmenuw b/menu/llib-lmenuw index 3abc5f39..d21fb948 100644 --- a/menu/llib-lmenuw +++ b/menu/llib-lmenuw @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002 Free Software Foundation, Inc. * + * Copyright (c) 2002,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 2002 * + * Author: Thomas E. Dickey 2002,2005 * ****************************************************************************/ /* LINTLIBRARY */ @@ -132,6 +132,11 @@ void _nc_Disconnect_Items( MENU *menu) { /* void */ } +#undef _nc_Calculate_Text_Width +int _nc_Calculate_Text_Width( + const TEXT *item) + { return(*(int *)0); } + #undef _nc_Calculate_Item_Length_and_Width void _nc_Calculate_Item_Length_and_Width( MENU *menu) @@ -232,6 +237,8 @@ const char *item_description( /* ./m_item_new.c */ +#include + #undef new_item ITEM *new_item( const char *name, @@ -481,6 +488,38 @@ WINDOW *menu_sub( const MENU *menu) { return(*(WINDOW **)0); } +/* ./m_trace.c */ + +#undef _nc_retrace_item +ITEM *_nc_retrace_item( + ITEM *code) + { return(*(ITEM **)0); } + +#undef _nc_retrace_item_ptr +ITEM **_nc_retrace_item_ptr( + ITEM **code) + { return(*(ITEM ***)0); } + +#undef _nc_retrace_item_opts +Item_Options _nc_retrace_item_opts( + Item_Options code) + { return(*(Item_Options *)0); } + +#undef _nc_retrace_menu +MENU *_nc_retrace_menu( + MENU *code) + { return(*(MENU **)0); } + +#undef _nc_retrace_menu_hook +Menu_Hook _nc_retrace_menu_hook( + Menu_Hook code) + { return(*(Menu_Hook *)0); } + +#undef _nc_retrace_menu_opts +Menu_Options _nc_retrace_menu_opts( + Menu_Options code) + { return(*(Menu_Options *)0); } + /* ./m_userptr.c */ #undef set_menu_userptr diff --git a/menu/m_attribs.c b/menu/m_attribs.c index b36ccc15..1126ffb8 100644 --- a/menu/m_attribs.c +++ b/menu/m_attribs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_attribs.c,v 1.12 2003/11/08 20:54:20 tom Exp $") +MODULE_ID("$Id: m_attribs.c,v 1.14 2004/12/11 23:29:12 tom Exp $") /* Macro to redraw menu if it is posted and changed */ #define Refresh_Menu(menu) \ @@ -51,6 +51,7 @@ MODULE_ID("$Id: m_attribs.c,v 1.12 2003/11/08 20:54:20 tom Exp $") #define GEN_MENU_ATTR_SET_FCT( name ) \ NCURSES_IMPEXP int NCURSES_API set_menu_ ## name (MENU * menu, chtype attr)\ {\ + T((T_CALLED("set_menu_" #name "(%p,%s)"), menu, _traceattr(attr)));\ if (!(attr==A_NORMAL || (attr & A_ATTRIBUTES)==attr))\ RETURN(E_BAD_ARGUMENT);\ if (menu && ( menu -> name != attr))\ @@ -66,7 +67,8 @@ NCURSES_IMPEXP int NCURSES_API set_menu_ ## name (MENU * menu, chtype attr)\ #define GEN_MENU_ATTR_GET_FCT( name ) \ NCURSES_IMPEXP chtype NCURSES_API menu_ ## name (const MENU * menu)\ {\ - return (Normalize_Menu( menu ) -> name);\ + T((T_CALLED("menu_" #name "(%p)"), menu));\ + returnAttr(Normalize_Menu( menu ) -> name);\ } /*--------------------------------------------------------------------------- @@ -81,7 +83,7 @@ NCURSES_IMPEXP chtype NCURSES_API menu_ ## name (const MENU * menu)\ | Return Values : E_OK - success | E_BAD_ARGUMENT - an invalid value has been passed +--------------------------------------------------------------------------*/ -GEN_MENU_ATTR_SET_FCT( fore ) +GEN_MENU_ATTR_SET_FCT(fore) /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -93,7 +95,7 @@ GEN_MENU_ATTR_SET_FCT( fore ) | | Return Values : Attribute value +--------------------------------------------------------------------------*/ -GEN_MENU_ATTR_GET_FCT( fore ) +GEN_MENU_ATTR_GET_FCT(fore) /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -105,7 +107,7 @@ GEN_MENU_ATTR_GET_FCT( fore ) | Return Values : E_OK - success | E_BAD_ARGUMENT - an invalid value has been passed +--------------------------------------------------------------------------*/ -GEN_MENU_ATTR_SET_FCT( back ) +GEN_MENU_ATTR_SET_FCT(back) /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -116,7 +118,7 @@ GEN_MENU_ATTR_SET_FCT( back ) | | Return Values : Attribute value +--------------------------------------------------------------------------*/ -GEN_MENU_ATTR_GET_FCT( back ) +GEN_MENU_ATTR_GET_FCT(back) /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -127,7 +129,7 @@ GEN_MENU_ATTR_GET_FCT( back ) | Return Values : E_OK - success | E_BAD_ARGUMENT - an invalid value has been passed +--------------------------------------------------------------------------*/ -GEN_MENU_ATTR_SET_FCT( grey ) +GEN_MENU_ATTR_SET_FCT(grey) /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -137,5 +139,5 @@ GEN_MENU_ATTR_SET_FCT( grey ) | | Return Values : Attribute value +--------------------------------------------------------------------------*/ -GEN_MENU_ATTR_GET_FCT( grey ) +GEN_MENU_ATTR_GET_FCT(grey) /* m_attribs.c ends here */ diff --git a/menu/m_cursor.c b/menu/m_cursor.c index 11011dc1..9f127aa5 100644 --- a/menu/m_cursor.c +++ b/menu/m_cursor.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_cursor.c,v 1.16 2003/10/25 15:23:42 tom Exp $") +MODULE_ID("$Id: m_cursor.c,v 1.19 2004/12/25 22:03:00 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,24 +50,23 @@ MODULE_ID("$Id: m_cursor.c,v 1.16 2003/10/25 15:23:42 tom Exp $") | E_NOT_POSTED - Menu is not posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -_nc_menu_cursor_pos -(const MENU* menu, const ITEM* item, int* pY, int* pX) +_nc_menu_cursor_pos(const MENU * menu, const ITEM * item, int *pY, int *pX) { if (!menu || !pX || !pY) - return(E_BAD_ARGUMENT); + return (E_BAD_ARGUMENT); else { - if ((ITEM*)0 == item) + if ((ITEM *) 0 == item) item = menu->curitem; - assert(item!=(ITEM*)0); + assert(item != (ITEM *) 0); - if ( !( menu->status & _POSTED ) ) - return(E_NOT_POSTED); + if (!(menu->status & _POSTED)) + return (E_NOT_POSTED); *pX = item->x * (menu->spc_cols + menu->itemlen); *pY = (item->y - menu->toprow) * menu->spc_rows; } - return(E_OK); + return (E_OK); } /*--------------------------------------------------------------------------- @@ -81,24 +80,26 @@ _nc_menu_cursor_pos | E_NOT_POSTED - Menu is not posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -pos_menu_cursor (const MENU * menu) +pos_menu_cursor(const MENU * menu) { WINDOW *win, *sub; int x, y; - int err = _nc_menu_cursor_pos(menu,(ITEM*)0,&y,&x); + int err = _nc_menu_cursor_pos(menu, (ITEM *) 0, &y, &x); - if (E_OK==err) + T((T_CALLED("pos_menu_cursor(%p)"), menu)); + + if (E_OK == err) { win = menu->userwin ? menu->userwin : stdscr; sub = menu->usersub ? menu->usersub : win; assert(win && sub); if ((menu->opt & O_SHOWMATCH) && (menu->pindex > 0)) - x += ( menu->pindex + menu->marklen - 1); + x += (menu->pindex + menu->marklen - 1); - wmove(sub,y,x); + wmove(sub, y, x); - if ( win != sub ) + if (win != sub) { wcursyncup(sub); wsyncup(sub); diff --git a/menu/m_driver.c b/menu/m_driver.c index 215cb5fa..c32a1d2f 100644 --- a/menu/m_driver.c +++ b/menu/m_driver.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_driver.c,v 1.20 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: m_driver.c,v 1.24 2005/04/09 20:40:25 tom Exp $") /* Macros */ @@ -62,28 +62,31 @@ MODULE_ID("$Id: m_driver.c,v 1.20 2003/10/25 14:54:48 tom Exp $") | Return Values : TRUE - if it is a substring | FALSE - if it is not a substring +--------------------------------------------------------------------------*/ -static bool Is_Sub_String( - bool IgnoreCaseFlag, - const char *part, - const char *string - ) +static bool +Is_Sub_String( + bool IgnoreCaseFlag, + const char *part, + const char *string +) { - assert( part && string ); - if ( IgnoreCaseFlag ) + assert(part && string); + if (IgnoreCaseFlag) { - while(*string && *part) + while (*string && *part) { - if (toupper(*string++)!=toupper(*part)) break; + if (toupper(*string++) != toupper(*part)) + break; part++; } } else { - while( *string && *part ) - if (*part != *string++) break; + while (*string && *part) + if (*part != *string++) + break; part++; } - return ( (*part) ? FALSE : TRUE ); + return ((*part) ? FALSE : TRUE); } /*--------------------------------------------------------------------------- @@ -113,73 +116,77 @@ static bool Is_Sub_String( +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) _nc_Match_Next_Character_In_Item_Name -(MENU *menu, int ch, ITEM **item) +(MENU * menu, int ch, ITEM ** item) { bool found = FALSE, passed = FALSE; - int idx, last; + int idx, last; + + T((T_CALLED("_nc_Match_Next_Character(%p,%d,%p)"), menu, ch, item)); - assert( menu && item && *item); + assert(menu && item && *item); idx = (*item)->index; - if (ch && ch!=BS) + if (ch && ch != BS) { /* if we become to long, we need no further checking : there can't be - a match ! */ - if ((menu->pindex+1) > menu->namelen) + a match ! */ + if ((menu->pindex + 1) > menu->namelen) RETURN(E_NO_MATCH); - Add_Character_To_Pattern(menu,ch); + Add_Character_To_Pattern(menu, ch); /* we artificially position one item back, because in the do...while - loop we start with the next item. This means, that with a new - pattern search we always start the scan with the actual item. If - we do a NEXT_PATTERN oder PREV_PATTERN search, we start with the - one after or before the actual item. */ + loop we start with the next item. This means, that with a new + pattern search we always start the scan with the actual item. If + we do a NEXT_PATTERN oder PREV_PATTERN search, we start with the + one after or before the actual item. */ if (--idx < 0) - idx = menu->nitems-1; + idx = menu->nitems - 1; } last = idx; /* this closes the cycle */ - do{ - if (ch==BS) - { /* we have to go backward */ - if (--idx < 0) - idx = menu->nitems-1; - } - else - { /* otherwise we always go forward */ - if (++idx >= menu->nitems) - idx = 0; - } - if (Is_Sub_String((menu->opt & O_IGNORECASE) != 0, - menu->pattern, - menu->items[idx]->name.str) + do + { + if (ch == BS) + { /* we have to go backward */ + if (--idx < 0) + idx = menu->nitems - 1; + } + else + { /* otherwise we always go forward */ + if (++idx >= menu->nitems) + idx = 0; + } + if (Is_Sub_String((menu->opt & O_IGNORECASE) != 0, + menu->pattern, + menu->items[idx]->name.str) ) - found = TRUE; - else - passed = TRUE; - } while (!found && (idx != last)); + found = TRUE; + else + passed = TRUE; + } + while (!found && (idx != last)); if (found) { - if (!((idx==(*item)->index) && passed)) + if (!((idx == (*item)->index) && passed)) { *item = menu->items[idx]; RETURN(E_OK); } /* This point is reached, if we fully cycled through the item list - and the only match we found is the starting item. With a NEXT_PATTERN - or PREV_PATTERN scan this means, that there was no additional match. - If we searched with an expanded new pattern, we should never reach - this point, because if the expanded pattern matches also the actual - item we will find it in the first attempt (passed==FALSE) and we - will never cycle through the whole item array. - */ - assert( ch==0 || ch==BS ); + and the only match we found is the starting item. With a NEXT_PATTERN + or PREV_PATTERN scan this means, that there was no additional match. + If we searched with an expanded new pattern, we should never reach + this point, because if the expanded pattern matches also the actual + item we will find it in the first attempt (passed==FALSE) and we + will never cycle through the whole item array. + */ + assert(ch == 0 || ch == BS); } else { - if (ch && ch!=BS && menu->pindex>0) + if (ch && ch != BS && menu->pindex > 0) { /* if we had no match with a new pattern, we have to restore it */ Remove_Character_From_Pattern(menu); @@ -201,7 +208,7 @@ _nc_Match_Next_Character_In_Item_Name | E_NOT_POSTED - menu is not posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -menu_driver (MENU * menu, int c) +menu_driver(MENU * menu, int c) { #define NAVIGATE(dir) \ if (!item->dir)\ @@ -213,327 +220,332 @@ menu_driver (MENU * menu, int c) ITEM *item; int my_top_row, rdiff; + T((T_CALLED("menu_driver(%p,%d)"), menu, c)); + if (!menu) RETURN(E_BAD_ARGUMENT); - if ( menu->status & _IN_DRIVER ) + if (menu->status & _IN_DRIVER) RETURN(E_BAD_STATE); - if ( !( menu->status & _POSTED ) ) + if (!(menu->status & _POSTED)) RETURN(E_NOT_POSTED); item = menu->curitem; - my_top_row = menu->toprow; - assert(item); - - if ((c > KEY_MAX) && (c<=MAX_MENU_COMMAND)) - { - if (!((c==REQ_BACK_PATTERN) - || (c==REQ_NEXT_MATCH) || (c==REQ_PREV_MATCH))) - { - assert( menu->pattern ); - Reset_Pattern(menu); - } - - switch(c) - { - case REQ_LEFT_ITEM: + my_top_row = menu->toprow; + assert(item); + + if ((c > KEY_MAX) && (c <= MAX_MENU_COMMAND)) + { + if (!((c == REQ_BACK_PATTERN) + || (c == REQ_NEXT_MATCH) || (c == REQ_PREV_MATCH))) + { + assert(menu->pattern); + Reset_Pattern(menu); + } + + switch (c) + { + case REQ_LEFT_ITEM: /*=================*/ - NAVIGATE(left); - break; + NAVIGATE(left); + break; - case REQ_RIGHT_ITEM: + case REQ_RIGHT_ITEM: /*==================*/ - NAVIGATE(right); - break; + NAVIGATE(right); + break; - case REQ_UP_ITEM: + case REQ_UP_ITEM: /*===============*/ - NAVIGATE(up); - break; + NAVIGATE(up); + break; - case REQ_DOWN_ITEM: + case REQ_DOWN_ITEM: /*=================*/ - NAVIGATE(down); - break; + NAVIGATE(down); + break; - case REQ_SCR_ULINE: + case REQ_SCR_ULINE: /*=================*/ if (my_top_row == 0 || !(item->up)) - result = E_REQUEST_DENIED; - else - { - --my_top_row; - item = item->up; - } - break; - - case REQ_SCR_DLINE: + result = E_REQUEST_DENIED; + else + { + --my_top_row; + item = item->up; + } + break; + + case REQ_SCR_DLINE: /*=================*/ if ((my_top_row + menu->arows >= menu->rows) || !(item->down)) - { - /* only if the menu has less items than rows, we can deny the - request. Otherwise the epilogue of this routine adjusts the - top row if necessary */ - result = E_REQUEST_DENIED; - } - else { - my_top_row++; + { + /* only if the menu has less items than rows, we can deny the + request. Otherwise the epilogue of this routine adjusts the + top row if necessary */ + result = E_REQUEST_DENIED; + } + else + { + my_top_row++; item = item->down; - } - break; + } + break; - case REQ_SCR_DPAGE: + case REQ_SCR_DPAGE: /*=================*/ rdiff = menu->rows - (menu->arows + my_top_row); - if (rdiff > menu->arows) - rdiff = menu->arows; - if (rdiff<=0) - result = E_REQUEST_DENIED; - else - { - my_top_row += rdiff; - while(rdiff-- > 0 && item!=(ITEM*)0) - item = item->down; - } - break; - - case REQ_SCR_UPAGE: + if (rdiff > menu->arows) + rdiff = menu->arows; + if (rdiff <= 0) + result = E_REQUEST_DENIED; + else + { + my_top_row += rdiff; + while (rdiff-- > 0 && item != (ITEM *) 0) + item = item->down; + } + break; + + case REQ_SCR_UPAGE: /*=================*/ rdiff = (menu->arows < my_top_row) ? menu->arows : my_top_row; - if (rdiff<=0) - result = E_REQUEST_DENIED; - else - { - my_top_row -= rdiff; - while(rdiff-- && item!=(ITEM*)0) - item = item->up; - } - break; + if (rdiff <= 0) + result = E_REQUEST_DENIED; + else + { + my_top_row -= rdiff; + while (rdiff-- && item != (ITEM *) 0) + item = item->up; + } + break; - case REQ_FIRST_ITEM: + case REQ_FIRST_ITEM: /*==================*/ - item = menu->items[0]; - break; + item = menu->items[0]; + break; - case REQ_LAST_ITEM: + case REQ_LAST_ITEM: /*=================*/ - item = menu->items[menu->nitems-1]; - break; + item = menu->items[menu->nitems - 1]; + break; - case REQ_NEXT_ITEM: + case REQ_NEXT_ITEM: /*=================*/ - if ((item->index+1)>=menu->nitems) - { - if (menu->opt & O_NONCYCLIC) - result = E_REQUEST_DENIED; - else - item = menu->items[0]; - } - else - item = menu->items[item->index + 1]; - break; - - case REQ_PREV_ITEM: + if ((item->index + 1) >= menu->nitems) + { + if (menu->opt & O_NONCYCLIC) + result = E_REQUEST_DENIED; + else + item = menu->items[0]; + } + else + item = menu->items[item->index + 1]; + break; + + case REQ_PREV_ITEM: /*=================*/ - if (item->index<=0) - { - if (menu->opt & O_NONCYCLIC) - result = E_REQUEST_DENIED; - else - item = menu->items[menu->nitems-1]; - } - else - item = menu->items[item->index - 1]; - break; - - case REQ_TOGGLE_ITEM: - /*===================*/ - if (menu->opt & O_ONEVALUE) - { + if (item->index <= 0) + { + if (menu->opt & O_NONCYCLIC) result = E_REQUEST_DENIED; - } - else - { - if (menu->curitem->opt & O_SELECTABLE) - { - menu->curitem->value = !menu->curitem->value; - Move_And_Post_Item(menu,menu->curitem); - _nc_Show_Menu(menu); - } - else - result = E_NOT_SELECTABLE; - } - break; - - case REQ_CLEAR_PATTERN: + else + item = menu->items[menu->nitems - 1]; + } + else + item = menu->items[item->index - 1]; + break; + + case REQ_TOGGLE_ITEM: + /*===================*/ + if (menu->opt & O_ONEVALUE) + { + result = E_REQUEST_DENIED; + } + else + { + if (menu->curitem->opt & O_SELECTABLE) + { + menu->curitem->value = !menu->curitem->value; + Move_And_Post_Item(menu, menu->curitem); + _nc_Show_Menu(menu); + } + else + result = E_NOT_SELECTABLE; + } + break; + + case REQ_CLEAR_PATTERN: /*=====================*/ - /* already cleared in prologue */ - break; + /* already cleared in prologue */ + break; - case REQ_BACK_PATTERN: + case REQ_BACK_PATTERN: /*====================*/ - if (menu->pindex>0) - { - assert(menu->pattern); - Remove_Character_From_Pattern(menu); - pos_menu_cursor( menu ); - } - else - result = E_REQUEST_DENIED; - break; - - case REQ_NEXT_MATCH: + if (menu->pindex > 0) + { + assert(menu->pattern); + Remove_Character_From_Pattern(menu); + pos_menu_cursor(menu); + } + else + result = E_REQUEST_DENIED; + break; + + case REQ_NEXT_MATCH: /*==================*/ - assert(menu->pattern); - if (menu->pattern[0]) - result = _nc_Match_Next_Character_In_Item_Name(menu,0,&item); - else - { - if ((item->index+1)nitems) - item=menu->items[item->index+1]; - else - { - if (menu->opt & O_NONCYCLIC) - result = E_REQUEST_DENIED; - else - item = menu->items[0]; - } - } - break; - - case REQ_PREV_MATCH: + assert(menu->pattern); + if (menu->pattern[0]) + result = _nc_Match_Next_Character_In_Item_Name(menu, 0, &item); + else + { + if ((item->index + 1) < menu->nitems) + item = menu->items[item->index + 1]; + else + { + if (menu->opt & O_NONCYCLIC) + result = E_REQUEST_DENIED; + else + item = menu->items[0]; + } + } + break; + + case REQ_PREV_MATCH: /*==================*/ - assert(menu->pattern); - if (menu->pattern[0]) - result = _nc_Match_Next_Character_In_Item_Name(menu,BS,&item); - else - { - if (item->index) - item = menu->items[item->index-1]; - else - { - if (menu->opt & O_NONCYCLIC) - result = E_REQUEST_DENIED; - else - item = menu->items[menu->nitems-1]; - } - } - break; - - default: + assert(menu->pattern); + if (menu->pattern[0]) + result = _nc_Match_Next_Character_In_Item_Name(menu, BS, &item); + else + { + if (item->index) + item = menu->items[item->index - 1]; + else + { + if (menu->opt & O_NONCYCLIC) + result = E_REQUEST_DENIED; + else + item = menu->items[menu->nitems - 1]; + } + } + break; + + default: /*======*/ - result = E_UNKNOWN_COMMAND; - break; - } - } - else - { /* not a command */ - if ( !(c & ~((int)MAX_REGULAR_CHARACTER)) && isprint(c) ) - result = _nc_Match_Next_Character_In_Item_Name( menu, c, &item ); + result = E_UNKNOWN_COMMAND; + break; + } + } + else + { /* not a command */ + if (!(c & ~((int)MAX_REGULAR_CHARACTER)) && isprint(UChar(c))) + result = _nc_Match_Next_Character_In_Item_Name(menu, c, &item); #ifdef NCURSES_MOUSE_VERSION - else if (KEY_MOUSE == c) - { - MEVENT event; - WINDOW* uwin = Get_Menu_UserWin(menu); - - getmouse(&event); - if ((event.bstate & (BUTTON1_CLICKED | - BUTTON1_DOUBLE_CLICKED | - BUTTON1_TRIPLE_CLICKED )) - && wenclose(uwin,event.y, event.x)) - { /* we react only if the click was in the userwin, that means - * inside the menu display area or at the decoration window. - */ - WINDOW* sub = Get_Menu_Window(menu); - int ry = event.y, rx = event.x; /* screen coordinates */ + else if (KEY_MOUSE == c) + { + MEVENT event; + WINDOW *uwin = Get_Menu_UserWin(menu); + + getmouse(&event); + if ((event.bstate & (BUTTON1_CLICKED | + BUTTON1_DOUBLE_CLICKED | + BUTTON1_TRIPLE_CLICKED)) + && wenclose(uwin, event.y, event.x)) + { /* we react only if the click was in the userwin, that means + * inside the menu display area or at the decoration window. + */ + WINDOW *sub = Get_Menu_Window(menu); + int ry = event.y, rx = event.x; /* screen coordinates */ - result = E_REQUEST_DENIED; - if (mouse_trafo(&ry,&rx,FALSE)) - { /* rx, ry are now "curses" coordinates */ - if (ry < sub->_begy) - { /* we clicked above the display region; this is - * interpreted as "scroll up" request - */ - if (event.bstate & BUTTON1_CLICKED) - result = menu_driver(menu,REQ_SCR_ULINE); - else if (event.bstate & BUTTON1_DOUBLE_CLICKED) - result = menu_driver(menu,REQ_SCR_UPAGE); - else if (event.bstate & BUTTON1_TRIPLE_CLICKED) - result = menu_driver(menu,REQ_FIRST_ITEM); - RETURN(result); - } - else if (ry >= sub->_begy + sub->_maxy) - { /* we clicked below the display region; this is - * interpreted as "scroll down" request - */ - if (event.bstate & BUTTON1_CLICKED) - result = menu_driver(menu,REQ_SCR_DLINE); - else if (event.bstate & BUTTON1_DOUBLE_CLICKED) - result = menu_driver(menu,REQ_SCR_DPAGE); - else if (event.bstate & BUTTON1_TRIPLE_CLICKED) - result = menu_driver(menu,REQ_LAST_ITEM); - RETURN(result); - } - else if (wenclose(sub,event.y,event.x)) - { /* Inside the area we try to find the hit item */ - int i,x,y,err; - ry = event.y; rx = event.x; - if (wmouse_trafo(sub,&ry,&rx,FALSE)) - { - for(i=0;initems;i++) - { - err = _nc_menu_cursor_pos(menu,menu->items[i], - &y, &x); - if (E_OK==err) - { - if ((ry==y) && - (rx>=x) && - (rx < x + menu->itemlen)) - { - item = menu->items[i]; - result = E_OK; - break; - } - } - } - if (E_OK==result) - { /* We found an item, now we can handle the click. + result = E_REQUEST_DENIED; + if (mouse_trafo(&ry, &rx, FALSE)) + { /* rx, ry are now "curses" coordinates */ + if (ry < sub->_begy) + { /* we clicked above the display region; this is + * interpreted as "scroll up" request + */ + if (event.bstate & BUTTON1_CLICKED) + result = menu_driver(menu, REQ_SCR_ULINE); + else if (event.bstate & BUTTON1_DOUBLE_CLICKED) + result = menu_driver(menu, REQ_SCR_UPAGE); + else if (event.bstate & BUTTON1_TRIPLE_CLICKED) + result = menu_driver(menu, REQ_FIRST_ITEM); + RETURN(result); + } + else if (ry > sub->_begy + sub->_maxy) + { /* we clicked below the display region; this is + * interpreted as "scroll down" request + */ + if (event.bstate & BUTTON1_CLICKED) + result = menu_driver(menu, REQ_SCR_DLINE); + else if (event.bstate & BUTTON1_DOUBLE_CLICKED) + result = menu_driver(menu, REQ_SCR_DPAGE); + else if (event.bstate & BUTTON1_TRIPLE_CLICKED) + result = menu_driver(menu, REQ_LAST_ITEM); + RETURN(result); + } + else if (wenclose(sub, event.y, event.x)) + { /* Inside the area we try to find the hit item */ + int i, x, y, err; + + ry = event.y; + rx = event.x; + if (wmouse_trafo(sub, &ry, &rx, FALSE)) + { + for (i = 0; i < menu->nitems; i++) + { + err = _nc_menu_cursor_pos(menu, menu->items[i], + &y, &x); + if (E_OK == err) + { + if ((ry == y) && + (rx >= x) && + (rx < x + menu->itemlen)) + { + item = menu->items[i]; + result = E_OK; + break; + } + } + } + if (E_OK == result) + { /* We found an item, now we can handle the click. * A single click just positions the menu cursor * to the clicked item. A double click toggles * the item. */ - if (event.bstate & BUTTON1_DOUBLE_CLICKED) - { - _nc_New_TopRow_and_CurrentItem(menu, - my_top_row, - item); - menu_driver(menu,REQ_TOGGLE_ITEM); - result = E_UNKNOWN_COMMAND; - } - } - } - } - } - } - else - result = E_REQUEST_DENIED; - } + if (event.bstate & BUTTON1_DOUBLE_CLICKED) + { + _nc_New_TopRow_and_CurrentItem(menu, + my_top_row, + item); + menu_driver(menu, REQ_TOGGLE_ITEM); + result = E_UNKNOWN_COMMAND; + } + } + } + } + } + } + else + result = E_REQUEST_DENIED; + } #endif /* NCURSES_MOUSE_VERSION */ - else - result = E_UNKNOWN_COMMAND; - } + else + result = E_UNKNOWN_COMMAND; + } - if (E_OK==result) + if (E_OK == result) { - /* Adjust the top row if it turns out that the current item unfortunately - doesn't appear in the menu window */ - if ( item->y < my_top_row ) - my_top_row = item->y; - else if ( item->y >= (my_top_row + menu->arows) ) - my_top_row = item->y - menu->arows + 1; - - _nc_New_TopRow_and_CurrentItem( menu, my_top_row, item ); + /* Adjust the top row if it turns out that the current item unfortunately + doesn't appear in the menu window */ + if (item->y < my_top_row) + my_top_row = item->y; + else if (item->y >= (my_top_row + menu->arows)) + my_top_row = item->y - menu->arows + 1; + + _nc_New_TopRow_and_CurrentItem(menu, my_top_row, item); } diff --git a/menu/m_format.c b/menu/m_format.c index 3785e650..773cb27e 100644 --- a/menu/m_format.c +++ b/menu/m_format.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,14 +37,14 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_format.c,v 1.12 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: m_format.c,v 1.15 2004/12/11 23:11:21 tom Exp $") #define minimum(a,b) ((a)<(b) ? (a): (b)) /*--------------------------------------------------------------------------- -| Facility : libnmenu +| Facility : libnmenu | Function : int set_menu_format(MENU *menu, int rows, int cols) -| +| | Description : Sets the maximum number of rows and columns of items | that may be displayed at one time on a menu. If the | menu contains more items than can be displayed at @@ -56,42 +56,44 @@ MODULE_ID("$Id: m_format.c,v 1.12 2003/10/25 14:54:48 tom Exp $") | E_POSTED - the menu is already posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_menu_format (MENU *menu, int rows, int cols) +set_menu_format(MENU * menu, int rows, int cols) { int total_rows, total_cols; - - if (rows<0 || cols<0) + + T((T_CALLED("set_menu_format(%p,%d,%d)"), menu, rows, cols)); + + if (rows < 0 || cols < 0) RETURN(E_BAD_ARGUMENT); - + if (menu) { - if ( menu->status & _POSTED ) + if (menu->status & _POSTED) RETURN(E_POSTED); - + if (!(menu->items)) RETURN(E_NOT_CONNECTED); - - if (rows==0) + + if (rows == 0) rows = menu->frows; - if (cols==0) + if (cols == 0) cols = menu->fcols; - + if (menu->pattern) Reset_Pattern(menu); - + menu->frows = rows; menu->fcols = cols; - - assert(rows>0 && cols>0); - total_rows = (menu->nitems - 1)/cols + 1; - total_cols = (menu->status & O_ROWMAJOR) ? - minimum(menu->nitems,cols) : - (menu->nitems-1)/total_rows + 1; - - menu->rows = total_rows; - menu->cols = total_cols; - menu->arows = minimum(total_rows,rows); - menu->toprow = 0; + + assert(rows > 0 && cols > 0); + total_rows = (menu->nitems - 1) / cols + 1; + total_cols = (menu->opt & O_ROWMAJOR) ? + minimum(menu->nitems, cols) : + (menu->nitems - 1) / total_rows + 1; + + menu->rows = total_rows; + menu->cols = total_cols; + menu->arows = minimum(total_rows, rows); + menu->toprow = 0; menu->curitem = *(menu->items); assert(menu->curitem); menu->status |= _LINK_NEEDED; @@ -99,24 +101,26 @@ set_menu_format (MENU *menu, int rows, int cols) } else { - if (rows>0) _nc_Default_Menu.frows = rows; - if (cols>0) _nc_Default_Menu.fcols = cols; + if (rows > 0) + _nc_Default_Menu.frows = rows; + if (cols > 0) + _nc_Default_Menu.fcols = cols; } - + RETURN(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnmenu +| Facility : libnmenu | Function : void menu_format(const MENU *menu, int *rows, int *cols) -| +| | Description : Returns the maximum number of rows and columns that may | be displayed at one time on menu. | | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void) -menu_format (const MENU *menu, int *rows, int *cols) +menu_format(const MENU * menu, int *rows, int *cols) { if (rows) *rows = Normalize_Menu(menu)->frows; diff --git a/menu/m_global.c b/menu/m_global.c index 542b484f..5aeb021f 100644 --- a/menu/m_global.c +++ b/menu/m_global.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,10 +37,10 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_global.c,v 1.16 2003/11/08 20:53:01 tom Exp $") +MODULE_ID("$Id: m_global.c,v 1.20 2005/04/16 17:30:57 tom Exp $") static char mark[] = "-"; - +/* *INDENT-OFF* */ NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu = { 16, /* Nr. of chars high */ 1, /* Nr. of chars wide */ @@ -95,6 +95,7 @@ NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item = { (ITEM *)0, /* up */ (ITEM *)0 /* down */ }; +/* *INDENT-ON* */ /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -105,24 +106,26 @@ NCURSES_EXPORT_VAR(ITEM) _nc_Default_Item = { | | Return Values : - +--------------------------------------------------------------------------*/ -INLINE static void ComputeMaximum_NameDesc_Lengths(MENU * menu) +INLINE static void +ComputeMaximum_NameDesc_Lengths(MENU * menu) { - unsigned MaximumNameLength = 0; + unsigned MaximumNameLength = 0; unsigned MaximumDescriptionLength = 0; ITEM **items; - + assert(menu && menu->items); - for( items = menu->items; *items ; items++ ) + for (items = menu->items; *items; items++) { - if (items[0]->name.length > MaximumNameLength ) - MaximumNameLength = items[0]->name.length; - + if (items[0]->name.length > MaximumNameLength) + MaximumNameLength = items[0]->name.length; + if (items[0]->description.length > MaximumDescriptionLength) MaximumDescriptionLength = items[0]->description.length; } - + menu->namelen = MaximumNameLength; menu->desclen = MaximumDescriptionLength; + T(("ComputeMaximum_NameDesc_Lengths %d,%d", menu->namelen, menu->desclen)); } /*--------------------------------------------------------------------------- @@ -134,22 +137,23 @@ INLINE static void ComputeMaximum_NameDesc_Lengths(MENU * menu) | | Return Values : - +--------------------------------------------------------------------------*/ -INLINE static void ResetConnectionInfo(MENU *menu, ITEM **items) +INLINE static void +ResetConnectionInfo(MENU * menu, ITEM ** items) { ITEM **item; - + assert(menu && items); - for(item=items; *item; item++) + for (item = items; *item; item++) { (*item)->index = 0; - (*item)->imenu = (MENU *)0; + (*item)->imenu = (MENU *) 0; } if (menu->pattern) free(menu->pattern); menu->pattern = (char *)0; - menu->pindex = 0; - menu->items = (ITEM **)0; - menu->nitems = 0; + menu->pindex = 0; + menu->items = (ITEM **) 0; + menu->nitems = 0; } /*--------------------------------------------------------------------------- @@ -164,25 +168,25 @@ INLINE static void ResetConnectionInfo(MENU *menu, ITEM **items) | FALSE - connection failed +--------------------------------------------------------------------------*/ NCURSES_EXPORT(bool) -_nc_Connect_Items (MENU *menu, ITEM **items) +_nc_Connect_Items(MENU * menu, ITEM ** items) { ITEM **item; unsigned int ItemCount = 0; - - if ( menu && items ) - { - for(item=items; *item ; item++) + + if (menu && items) + { + for (item = items; *item; item++) { - if ( (*item)->imenu ) + if ((*item)->imenu) { /* if a item is already connected, reject connection */ break; } } - if (! (*item) ) + if (!(*item)) /* we reached the end, so there was no connected item */ { - for(item=items; *item ; item++) + for (item = items; *item; item++) { if (menu->opt & O_ONEVALUE) { @@ -190,31 +194,31 @@ _nc_Connect_Items (MENU *menu, ITEM **items) } (*item)->index = ItemCount++; (*item)->imenu = menu; - } + } } } else - return(FALSE); - + return (FALSE); + if (ItemCount != 0) { - menu->items = items; + menu->items = items; menu->nitems = ItemCount; ComputeMaximum_NameDesc_Lengths(menu); - if ( (menu->pattern = (char *)malloc( (unsigned)(1 + menu->namelen))) ) + if ((menu->pattern = typeMalloc(char, (unsigned)(1 + menu->namelen)))) { - Reset_Pattern(menu); - set_menu_format(menu,menu->frows,menu->fcols); + Reset_Pattern(menu); + set_menu_format(menu, menu->frows, menu->fcols); menu->curitem = *items; menu->toprow = 0; - return(TRUE); + return (TRUE); } } - + /* If we fall through to this point, we have to reset all items connection and inform about a reject connection */ - ResetConnectionInfo( menu, items ); - return(FALSE); + ResetConnectionInfo(menu, items); + return (FALSE); } /*--------------------------------------------------------------------------- @@ -226,11 +230,88 @@ _nc_Connect_Items (MENU *menu, ITEM **items) | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void) -_nc_Disconnect_Items (MENU * menu) +_nc_Disconnect_Items(MENU * menu) { if (menu && menu->items) - ResetConnectionInfo( menu, menu->items ); + ResetConnectionInfo(menu, menu->items); +} + +/*--------------------------------------------------------------------------- +| Facility : libnmenu +| Function : int _nc_Calculate_Text_Width(const TEXT * item) +| +| Description : Calculate the number of columns for a TEXT. +| +| Return Values : the width ++--------------------------------------------------------------------------*/ +NCURSES_EXPORT(int) +_nc_Calculate_Text_Width(const TEXT * item /*FIXME: limit length */ ) +{ +#if USE_WIDEC_SUPPORT + int result = item->length; + int count = mbstowcs(0, item->str, 0); + wchar_t *temp = 0; + + T((T_CALLED("_nc_menu_text_width(%p)"), item)); + if (count > 0 + && (temp = typeMalloc(wchar_t, 2 + count)) != 0) + { + int n; + + result = 0; + mbstowcs(temp, item->str, (unsigned)count); + for (n = 0; n < count; ++n) + { + int test = wcwidth(temp[n]); + + if (test <= 0) + test = 1; + result += test; + } + free(temp); + } + returnCode(result); +#else + return item->length; +#endif +} + +/* FIXME: this is experimental, should cache the results but don't want to + * modify the MENU struct to do this until it's complete. + */ +#if 0 /* USE_WIDEC_SUPPORT */ +static int +calculate_actual_width(MENU * menu, bool name) +{ + int width = 0; + int check = 0; + ITEM **items; + + assert(menu && menu->items); + for (items = menu->items; *items; items++) + { + if (name) + { + check = _nc_Calculate_Text_Width(&((*items)->name)); + } + else + { + check = _nc_Calculate_Text_Width(&((*items)->description)); + } + if (check > width) + width = check; + } + + T(("calculate_actual_width %s = %d/%d", + name ? "name" : "desc", + width, + name ? menu->namelen : menu->desclen)); + width += 2; /* FIXME - need this? */ + return width; } +#else +#define calculate_actual_width(menu, name) (name ? menu->namelen : menu->desclen) +#endif /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -242,23 +323,33 @@ _nc_Disconnect_Items (MENU * menu) | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void) -_nc_Calculate_Item_Length_and_Width (MENU * menu) +_nc_Calculate_Item_Length_and_Width(MENU * menu) { int l; - + assert(menu); - menu->height = 1 + menu->spc_rows * (menu->arows - 1); + menu->height = 1 + menu->spc_rows * (menu->arows - 1); + + l = calculate_actual_width(menu, TRUE); + l += menu->marklen; + + if ((menu->opt & O_SHOWDESC) && (menu->desclen > 0)) + { + l += calculate_actual_width(menu, FALSE); + l += menu->spc_desc; + } - l = menu->namelen + menu->marklen; - if ( (menu->opt & O_SHOWDESC) && (menu->desclen > 0) ) - l += (menu->desclen + menu->spc_desc); - menu->itemlen = l; l *= menu->cols; - l += (menu->cols-1)*menu->spc_cols; /* for the padding between the columns */ + l += (menu->cols - 1) * menu->spc_cols; /* for the padding between the columns */ menu->width = l; -} + + T(("_nc_CalculateItem_Length_and_Width columns %d, item %d, width %d", + menu->cols, + menu->itemlen, + menu->width)); +} /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -271,64 +362,64 @@ _nc_Calculate_Item_Length_and_Width (MENU * menu) | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void) -_nc_Link_Items (MENU * menu) +_nc_Link_Items(MENU * menu) { if (menu && menu->items && *(menu->items)) { - int i,j; + int i, j; ITEM *item; int Number_Of_Items = menu->nitems; int col = 0, row = 0; int Last_in_Row; int Last_in_Column; bool cycle = (menu->opt & O_NONCYCLIC) ? FALSE : TRUE; - + menu->status &= ~_LINK_NEEDED; - + if (menu->opt & O_ROWMAJOR) { int Number_Of_Columns = menu->cols; - - for(i=0; i < Number_Of_Items; i++) + + for (i = 0; i < Number_Of_Items; i++) { item = menu->items[i]; - - Last_in_Row = row * Number_Of_Columns + (Number_Of_Columns-1); - - item->left = (col) ? - /* if we are not in the leftmost column, we can use the - predecessor in the items array */ - menu->items[i-1] : - (cycle ? menu->items[(Last_in_Row>=Number_Of_Items) ? - Number_Of_Items-1: - Last_in_Row] : - (ITEM *)0 ); - - item->right = ( (col < (Number_Of_Columns-1)) && - ((i+1) < Number_Of_Items) - ) ? - menu->items[i+1] : - ( cycle ? menu->items[row * Number_Of_Columns] : - (ITEM *)0 - ); - - Last_in_Column = (menu->rows-1) * Number_Of_Columns + col; - - item->up = (row) ? menu->items[i-Number_Of_Columns] : - (cycle ? menu->items[(Last_in_Column>=Number_Of_Items) ? - Number_Of_Items-1 : - Last_in_Column] : - (ITEM *)0); - - item->down = ( (i+Number_Of_Columns) < Number_Of_Items ) - ? - menu->items[i + Number_Of_Columns] : - (cycle ? menu->items[(row+1)rows ? - Number_Of_Items-1:col] : - (ITEM *)0); + + Last_in_Row = row * Number_Of_Columns + (Number_Of_Columns - 1); + + item->left = (col) ? + /* if we are not in the leftmost column, we can use the + predecessor in the items array */ + menu->items[i - 1] : + (cycle ? menu->items[(Last_in_Row >= Number_Of_Items) ? + Number_Of_Items - 1 : + Last_in_Row] : + (ITEM *) 0); + + item->right = ((col < (Number_Of_Columns - 1)) && + ((i + 1) < Number_Of_Items) + )? + menu->items[i + 1] : + (cycle ? menu->items[row * Number_Of_Columns] : + (ITEM *) 0 + ); + + Last_in_Column = (menu->rows - 1) * Number_Of_Columns + col; + + item->up = (row) ? menu->items[i - Number_Of_Columns] : + (cycle ? menu->items[(Last_in_Column >= Number_Of_Items) ? + Number_Of_Items - 1 : + Last_in_Column] : + (ITEM *) 0); + + item->down = ((i + Number_Of_Columns) < Number_Of_Items) + ? + menu->items[i + Number_Of_Columns] : + (cycle ? menu->items[(row + 1) < menu->rows ? + Number_Of_Items - 1 : col] : + (ITEM *) 0); item->x = col; item->y = row; - if ( ++col == Number_Of_Columns ) + if (++col == Number_Of_Columns) { row++; col = 0; @@ -338,48 +429,48 @@ _nc_Link_Items (MENU * menu) else { int Number_Of_Rows = menu->rows; - - for(j=0; jitems[i=(col * Number_Of_Rows + row)]; - - Last_in_Column = (menu->cols-1) * Number_Of_Rows + row; - - item->left = (col) ? + item = menu->items[i = (col * Number_Of_Rows + row)]; + + Last_in_Column = (menu->cols - 1) * Number_Of_Rows + row; + + item->left = (col) ? menu->items[i - Number_Of_Rows] : - (cycle ? (Last_in_Column >= Number_Of_Items ) ? - menu->items[Last_in_Column-Number_Of_Rows] : - menu->items[Last_in_Column] : - (ITEM *)0 ); - - item->right = ((i + Number_Of_Rows) items[i + Number_Of_Rows] : - (cycle ? menu->items[row] : (ITEM *)0); - + (cycle ? (Last_in_Column >= Number_Of_Items) ? + menu->items[Last_in_Column - Number_Of_Rows] : + menu->items[Last_in_Column] : + (ITEM *) 0); + + item->right = ((i + Number_Of_Rows) < Number_Of_Items) + ? + menu->items[i + Number_Of_Rows] : + (cycle ? menu->items[row] : (ITEM *) 0); + Last_in_Row = col * Number_Of_Rows + (Number_Of_Rows - 1); - - item->up = (row) ? - menu->items[i-1] : - (cycle ? - menu->items[(Last_in_Row>=Number_Of_Items) ? - Number_Of_Items-1: - Last_in_Row] : - (ITEM *)0); - - item->down = (row < (Number_Of_Rows-1)) - ? - (menu->items[((i+1)items[col * Number_Of_Rows] : - (ITEM *)0 - ); - + + item->up = (row) ? + menu->items[i - 1] : + (cycle ? + menu->items[(Last_in_Row >= Number_Of_Items) ? + Number_Of_Items - 1 : + Last_in_Row] : + (ITEM *) 0); + + item->down = (row < (Number_Of_Rows - 1)) + ? + (menu->items[((i + 1) < Number_Of_Items) ? + i + 1 : + (col - 1) * Number_Of_Rows + row + 1]) : + (cycle ? + menu->items[col * Number_Of_Rows] : + (ITEM *) 0 + ); + item->x = col; item->y = row; - if ( (++row) == Number_Of_Rows ) + if ((++row) == Number_Of_Rows) { col++; row = 0; @@ -398,31 +489,31 @@ _nc_Link_Items (MENU * menu) | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void) -_nc_Show_Menu (const MENU *menu) +_nc_Show_Menu(const MENU * menu) { WINDOW *win; int maxy, maxx; - + assert(menu); - if ( (menu->status & _POSTED) && !(menu->status & _IN_DRIVER) ) + if ((menu->status & _POSTED) && !(menu->status & _IN_DRIVER)) { /* adjust the internal subwindow to start on the current top */ assert(menu->sub); - mvderwin(menu->sub,menu->spc_rows * menu->toprow,0); + mvderwin(menu->sub, menu->spc_rows * menu->toprow, 0); win = Get_Menu_Window(menu); - + maxy = getmaxy(win); - maxx = getmaxx(win); - - if (menu->height < maxy) + maxx = getmaxx(win); + + if (menu->height < maxy) maxy = menu->height; - if (menu->width < maxx) + if (menu->width < maxx) maxx = menu->width; - - copywin(menu->sub,win,0,0,0,0,maxy-1,maxx-1,0); + + copywin(menu->sub, win, 0, 0, 0, 0, maxy - 1, maxx - 1, 0); pos_menu_cursor(menu); - } -} + } +} /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -438,41 +529,41 @@ _nc_Show_Menu (const MENU *menu) | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void) -_nc_New_TopRow_and_CurrentItem -(MENU *menu, int new_toprow, ITEM *new_current_item) + _nc_New_TopRow_and_CurrentItem + (MENU * menu, int new_toprow, ITEM * new_current_item) { ITEM *cur_item; bool mterm_called = FALSE; bool iterm_called = FALSE; - + assert(menu); if (menu->status & _POSTED) { if (new_current_item != menu->curitem) { - Call_Hook(menu,itemterm); + Call_Hook(menu, itemterm); iterm_called = TRUE; } if (new_toprow != menu->toprow) { - Call_Hook(menu,menuterm); + Call_Hook(menu, menuterm); mterm_called = TRUE; - } - - cur_item = menu->curitem; + } + + cur_item = menu->curitem; assert(cur_item); - menu->toprow = new_toprow; - menu->curitem = new_current_item; - + menu->toprow = new_toprow; + menu->curitem = new_current_item; + if (mterm_called) { - Call_Hook(menu,menuinit); + Call_Hook(menu, menuinit); } if (iterm_called) { /* this means, move from the old current_item to the new one... */ - Move_To_Current_Item( menu, cur_item ); - Call_Hook(menu,iteminit); + Move_To_Current_Item(menu, cur_item); + Call_Hook(menu, iteminit); } if (mterm_called || iterm_called) { @@ -482,8 +573,8 @@ _nc_New_TopRow_and_CurrentItem pos_menu_cursor(menu); } else - { /* if we are not posted, this is quite simple */ - menu->toprow = new_toprow; + { /* if we are not posted, this is quite simple */ + menu->toprow = new_toprow; menu->curitem = new_current_item; } } diff --git a/menu/m_hook.c b/menu/m_hook.c index 51644a10..8d768a30 100644 --- a/menu/m_hook.c +++ b/menu/m_hook.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,12 +37,13 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_hook.c,v 1.11 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: m_hook.c,v 1.14 2004/12/25 21:39:52 tom Exp $") /* "Template" macro to generate function to set application specific hook */ #define GEN_HOOK_SET_FUNCTION( typ, name ) \ NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook func )\ {\ + T((T_CALLED("set_" #typ "_" #name "(%p,%p)"), menu, func));\ (Normalize_Menu(menu) -> typ ## name = func );\ RETURN(E_OK);\ } @@ -51,7 +52,8 @@ NCURSES_IMPEXP int NCURSES_API set_ ## typ ## _ ## name (MENU *menu, Menu_Hook f #define GEN_HOOK_GET_FUNCTION( typ, name ) \ NCURSES_IMPEXP Menu_Hook NCURSES_API typ ## _ ## name ( const MENU *menu )\ {\ - return (Normalize_Menu(menu) -> typ ## name);\ + T((T_CALLED(#typ "_" #name "(%p)"), menu));\ + returnMenuHook(Normalize_Menu(menu) -> typ ## name);\ } /*--------------------------------------------------------------------------- @@ -63,7 +65,7 @@ NCURSES_IMPEXP Menu_Hook NCURSES_API typ ## _ ## name ( const MENU *menu )\ | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -GEN_HOOK_SET_FUNCTION( menu, init ) +GEN_HOOK_SET_FUNCTION(menu, init) /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -75,7 +77,7 @@ GEN_HOOK_SET_FUNCTION( menu, init ) | | Return Values : Menu init function address or NULL +--------------------------------------------------------------------------*/ -GEN_HOOK_GET_FUNCTION( menu, init ) +GEN_HOOK_GET_FUNCTION(menu, init) /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -86,7 +88,7 @@ GEN_HOOK_GET_FUNCTION( menu, init ) | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -GEN_HOOK_SET_FUNCTION( menu, term ) +GEN_HOOK_SET_FUNCTION(menu, term) /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -98,7 +100,7 @@ GEN_HOOK_SET_FUNCTION( menu, term ) | | Return Values : Menu finalization function address or NULL +--------------------------------------------------------------------------*/ -GEN_HOOK_GET_FUNCTION( menu, term ) +GEN_HOOK_GET_FUNCTION(menu, term) /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -109,7 +111,7 @@ GEN_HOOK_GET_FUNCTION( menu, term ) | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -GEN_HOOK_SET_FUNCTION( item, init ) +GEN_HOOK_SET_FUNCTION(item, init) /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -121,7 +123,7 @@ GEN_HOOK_SET_FUNCTION( item, init ) | | Return Values : Item init function address or NULL +--------------------------------------------------------------------------*/ -GEN_HOOK_GET_FUNCTION( item, init ) +GEN_HOOK_GET_FUNCTION(item, init) /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -132,7 +134,7 @@ GEN_HOOK_GET_FUNCTION( item, init ) | | Return Values : E_OK - success +--------------------------------------------------------------------------*/ -GEN_HOOK_SET_FUNCTION( item, term ) +GEN_HOOK_SET_FUNCTION(item, term) /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -144,6 +146,6 @@ GEN_HOOK_SET_FUNCTION( item, term ) | | Return Values : Item finalization function address or NULL +--------------------------------------------------------------------------*/ -GEN_HOOK_GET_FUNCTION( item, term ) +GEN_HOOK_GET_FUNCTION(item, term) /* m_hook.c ends here */ diff --git a/menu/m_item_cur.c b/menu/m_item_cur.c index d4d6bb84..dac12ed9 100644 --- a/menu/m_item_cur.c +++ b/menu/m_item_cur.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_cur.c,v 1.14 2003/10/25 15:23:42 tom Exp $") +MODULE_ID("$Id: m_item_cur.c,v 1.17 2004/12/25 21:57:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -48,14 +48,16 @@ MODULE_ID("$Id: m_item_cur.c,v 1.14 2003/10/25 15:23:42 tom Exp $") | Return Values : E_OK - success +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_current_item (MENU * menu, ITEM * item) +set_current_item(MENU * menu, ITEM * item) { - if (menu && item && (item->imenu==menu)) + T((T_CALLED("set_current_item(%p,%p)"), menu, item)); + + if (menu && item && (item->imenu == menu)) { - if ( menu->status & _IN_DRIVER ) + if (menu->status & _IN_DRIVER) RETURN(E_BAD_STATE); - - assert( menu->curitem ); + + assert(menu->curitem); if (item != menu->curitem) { if (menu->status & _LINK_NEEDED) @@ -69,12 +71,12 @@ set_current_item (MENU * menu, ITEM * item) assert(menu->pattern); Reset_Pattern(menu); /* adjust the window to make item visible and update the menu */ - Adjust_Current_Item(menu,menu->toprow,item); + Adjust_Current_Item(menu, menu->toprow, item); } } else RETURN(E_BAD_ARGUMENT); - + RETURN(E_OK); } @@ -87,9 +89,10 @@ set_current_item (MENU * menu, ITEM * item) | Return Values : Item pointer or NULL if failure +--------------------------------------------------------------------------*/ NCURSES_EXPORT(ITEM *) -current_item (const MENU * menu) +current_item(const MENU * menu) { - return (menu && menu->items) ? menu->curitem : (ITEM *)0; + T((T_CALLED("current_item(%p)"), menu)); + returnItem((menu && menu->items) ? menu->curitem : (ITEM *) 0); } /*--------------------------------------------------------------------------- @@ -101,9 +104,10 @@ current_item (const MENU * menu) | Return Values : The index or ERR if this is an invalid item pointer +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -item_index (const ITEM *item) +item_index(const ITEM * item) { - return (item && item->imenu) ? item->index : ERR; + T((T_CALLED("item_index(%p)"), item)); + returnCode((item && item->imenu) ? item->index : ERR); } /* m_item_cur.c ends here */ diff --git a/menu/m_item_nam.c b/menu/m_item_nam.c index 65eb5953..05a16934 100644 --- a/menu/m_item_nam.c +++ b/menu/m_item_nam.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_nam.c,v 1.12 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: m_item_nam.c,v 1.14 2004/12/25 21:41:54 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -48,11 +48,12 @@ MODULE_ID("$Id: m_item_nam.c,v 1.12 2003/10/25 14:54:48 tom Exp $") | Return Values : See above; returns NULL if item is invalid +--------------------------------------------------------------------------*/ NCURSES_EXPORT(const char *) -item_name (const ITEM * item) +item_name(const ITEM * item) { - return ((item) ? item->name.str : (char *)0); + T((T_CALLED("item_name(%p)"), item)); + returnCPtr((item) ? item->name.str : (char *)0); } - + /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : char *item_description(const ITEM *item) @@ -62,9 +63,10 @@ item_name (const ITEM * item) | Return Values : See above; Returns NULL if item is invalid +--------------------------------------------------------------------------*/ NCURSES_EXPORT(const char *) -item_description (const ITEM * item) +item_description(const ITEM * item) { - return ((item) ? item->description.str : (char *)0); + T((T_CALLED("item_description(%p)"), item)); + returnCPtr((item) ? item->description.str : (char *)0); } /* m_item_nam.c ends here */ diff --git a/menu/m_item_new.c b/menu/m_item_new.c index 788f53ee..185e2dca 100644 --- a/menu/m_item_new.c +++ b/menu/m_item_new.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -38,7 +38,11 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_new.c,v 1.14 2003/10/25 15:23:42 tom Exp $") +#if USE_WIDEC_SUPPORT +#include +#endif + +MODULE_ID("$Id: m_item_new.c,v 1.25 2005/04/16 22:24:38 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,16 +54,44 @@ MODULE_ID("$Id: m_item_new.c,v 1.14 2003/10/25 15:23:42 tom Exp $") | Return Values : TRUE - if string is printable | FALSE - if string contains non-printable characters +--------------------------------------------------------------------------*/ -static bool Is_Printable_String(const char *s) +static bool +Is_Printable_String(const char *s) { + int result = TRUE; + +#if USE_WIDEC_SUPPORT + int count = mbstowcs(0, s, 0); + wchar_t *temp = 0; + + assert(s); + + if (count > 0 + && (temp = typeCalloc(wchar_t, (2 + count))) != 0) + { + int n; + + mbstowcs(temp, s, (unsigned)count); + for (n = 0; n < count; ++n) + if (!iswprint(temp[n])) + { + result = FALSE; + break; + } + free(temp); + } +#else assert(s); - while(*s) + while (*s) { - if (!isprint((unsigned char)*s)) - return FALSE; + if (!isprint(UChar(*s))) + { + result = FALSE; + break; + } s++; } - return TRUE; +#endif + return result; } /*--------------------------------------------------------------------------- @@ -73,41 +105,45 @@ static bool Is_Printable_String(const char *s) | Return Values : The item pointer or NULL if creation failed. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(ITEM *) -new_item (const char *name, const char *description) +new_item(const char *name, const char *description) { ITEM *item; - - if ( !name || (*name == '\0') || !Is_Printable_String(name) ) + + T((T_CALLED("new_item(\"%s\", \"%s\")"), + name ? name : "", + description ? description : "")); + + if (!name || (*name == '\0') || !Is_Printable_String(name)) { - item = (ITEM *)0; - SET_ERROR( E_BAD_ARGUMENT ); + item = (ITEM *) 0; + SET_ERROR(E_BAD_ARGUMENT); } else { - item = (ITEM *)calloc(1,sizeof(ITEM)); + item = (ITEM *) calloc(1, sizeof(ITEM)); if (item) { - *item = _nc_Default_Item; /* hope we have struct assignment */ - - item->name.length = strlen(name); - item->name.str = name; + *item = _nc_Default_Item; /* hope we have struct assignment */ + + item->name.length = strlen(name); + item->name.str = name; - if (description && (*description != '\0') && + if (description && (*description != '\0') && Is_Printable_String(description)) { - item->description.length = strlen(description); - item->description.str = description; + item->description.length = strlen(description); + item->description.str = description; } else { item->description.length = 0; - item->description.str = (char *)0; + item->description.str = (char *)0; } } else - SET_ERROR( E_SYSTEM_ERROR ); - } - return(item); + SET_ERROR(E_SYSTEM_ERROR); + } + returnItem(item); } /*--------------------------------------------------------------------------- @@ -122,17 +158,19 @@ new_item (const char *name, const char *description) | E_CONNECTED - item is still connected to a menu +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -free_item (ITEM * item) +free_item(ITEM * item) { + T((T_CALLED("free_item(%p)"), item)); + if (!item) - RETURN( E_BAD_ARGUMENT ); + RETURN(E_BAD_ARGUMENT); if (item->imenu) - RETURN( E_CONNECTED ); - + RETURN(E_CONNECTED); + free(item); - RETURN( E_OK ); + RETURN(E_OK); } /*--------------------------------------------------------------------------- @@ -153,16 +191,18 @@ free_item (ITEM * item) | E_SYSTEM_ERROR - no memory to store mark +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_menu_mark (MENU * menu, const char * mark) +set_menu_mark(MENU * menu, const char *mark) { - int l; + unsigned l; + + T((T_CALLED("set_menu_mark(%p,%s)"), menu, _nc_visbuf(mark))); - if ( mark && (*mark != '\0') && Is_Printable_String(mark) ) + if (mark && (*mark != '\0') && Is_Printable_String(mark)) l = strlen(mark); else l = 0; - if ( menu ) + if (menu) { char *old_mark = menu->mark; unsigned short old_status = menu->status; @@ -171,13 +211,13 @@ set_menu_mark (MENU * menu, const char * mark) { /* If the menu is already posted, the geometry is fixed. Then we can only accept a mark with exactly the same length */ - if (menu->marklen != l) + if (menu->marklen != (int)l) RETURN(E_BAD_ARGUMENT); - } + } menu->marklen = l; if (l) { - menu->mark = (char *)malloc(l+1); + menu->mark = (char *)malloc(l + 1); if (menu->mark) { strcpy(menu->mark, mark); @@ -192,24 +232,24 @@ set_menu_mark (MENU * menu, const char * mark) } else menu->mark = (char *)0; - + if ((old_status & _MARK_ALLOCATED) && old_mark) free(old_mark); if (menu->status & _POSTED) { - _nc_Draw_Menu( menu ); - _nc_Show_Menu( menu ); + _nc_Draw_Menu(menu); + _nc_Show_Menu(menu); } else { /* Recalculate the geometry */ - _nc_Calculate_Item_Length_and_Width( menu ); + _nc_Calculate_Item_Length_and_Width(menu); } } else { - return set_menu_mark(&_nc_Default_Menu, mark); + returnCode(set_menu_mark(&_nc_Default_Menu, mark)); } RETURN(E_OK); } @@ -223,9 +263,10 @@ set_menu_mark (MENU * menu, const char * mark) | Return Values : The marker string pointer or NULL if no marker defined +--------------------------------------------------------------------------*/ NCURSES_EXPORT(const char *) -menu_mark (const MENU * menu) +menu_mark(const MENU * menu) { - return Normalize_Menu( menu )->mark; + T((T_CALLED("menu_mark(%p)"), menu)); + returnPtr(Normalize_Menu(menu)->mark); } /* m_item_new.c */ diff --git a/menu/m_item_opt.c b/menu/m_item_opt.c index 5dcc06b6..cfe7b75d 100644 --- a/menu/m_item_opt.c +++ b/menu/m_item_opt.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_opt.c,v 1.14 2003/11/08 20:50:19 tom Exp $") +MODULE_ID("$Id: m_item_opt.c,v 1.17 2004/12/25 21:32:54 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -51,34 +51,36 @@ MODULE_ID("$Id: m_item_opt.c,v 1.14 2003/11/08 20:50:19 tom Exp $") | E_BAD_ARGUMENT - invalid item options +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_item_opts (ITEM *item, Item_Options opts) -{ +set_item_opts(ITEM * item, Item_Options opts) +{ + T((T_CALLED("set_menu_opts(%p,%d)"), item, opts)); + opts &= ALL_ITEM_OPTS; if (opts & ~ALL_ITEM_OPTS) RETURN(E_BAD_ARGUMENT); - + if (item) { if (item->opt != opts) - { + { MENU *menu = item->imenu; - + item->opt = opts; - + if ((!(opts & O_SELECTABLE)) && item->value) item->value = FALSE; - + if (menu && (menu->status & _POSTED)) { - Move_And_Post_Item( menu, item ); + Move_And_Post_Item(menu, item); _nc_Show_Menu(menu); } } } else _nc_Default_Item.opt = opts; - + RETURN(E_OK); } @@ -92,18 +94,21 @@ set_item_opts (ITEM *item, Item_Options opts) | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -item_opts_off (ITEM *item, Item_Options opts) -{ - ITEM *citem = item; /* use a copy because set_item_opts must detect - NULL item itself to adjust its behavior */ +item_opts_off(ITEM * item, Item_Options opts) +{ + ITEM *citem = item; /* use a copy because set_item_opts must detect + + NULL item itself to adjust its behavior */ + + T((T_CALLED("item_opts_off(%p,%d)"), item, opts)); if (opts & ~ALL_ITEM_OPTS) RETURN(E_BAD_ARGUMENT); else { - Normalize_Item(citem); + Normalize_Item(citem); opts = citem->opt & ~(opts & ALL_ITEM_OPTS); - return set_item_opts( item, opts ); + returnCode(set_item_opts(item, opts)); } } @@ -117,11 +122,14 @@ item_opts_off (ITEM *item, Item_Options opts) | E_BAD_ARGUMENT - invalid options +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -item_opts_on (ITEM *item, Item_Options opts) +item_opts_on(ITEM * item, Item_Options opts) { - ITEM *citem = item; /* use a copy because set_item_opts must detect - NULL item itself to adjust its behavior */ - + ITEM *citem = item; /* use a copy because set_item_opts must detect + + NULL item itself to adjust its behavior */ + + T((T_CALLED("item_opts_on(%p,%d)"), item, opts)); + opts &= ALL_ITEM_OPTS; if (opts & ~ALL_ITEM_OPTS) RETURN(E_BAD_ARGUMENT); @@ -129,7 +137,7 @@ item_opts_on (ITEM *item, Item_Options opts) { Normalize_Item(citem); opts = citem->opt | opts; - return set_item_opts( item, opts ); + returnCode(set_item_opts(item, opts)); } } @@ -142,9 +150,10 @@ item_opts_on (ITEM *item, Item_Options opts) | Return Values : Items options +--------------------------------------------------------------------------*/ NCURSES_EXPORT(Item_Options) -item_opts (const ITEM * item) +item_opts(const ITEM * item) { - return (ALL_ITEM_OPTS & Normalize_Item(item)->opt); + T((T_CALLED("item_opts(%p)"), item)); + returnItemOpts(ALL_ITEM_OPTS & Normalize_Item(item)->opt); } /* m_item_opt.c ends here */ diff --git a/menu/m_item_top.c b/menu/m_item_top.c index 0a0fb481..7268a0e4 100644 --- a/menu/m_item_top.c +++ b/menu/m_item_top.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_top.c,v 1.8 2003/11/08 20:51:53 tom Exp $") +MODULE_ID("$Id: m_item_top.c,v 1.10 2004/12/11 23:29:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,35 +50,37 @@ MODULE_ID("$Id: m_item_top.c,v 1.8 2003/11/08 20:51:53 tom Exp $") | E_NOT_CONNECTED - there are no items for the menu +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_top_row (MENU * menu, int row) +set_top_row(MENU * menu, int row) { ITEM *item; - + + T((T_CALLED("set_top_row(%p,%d)"), menu, row)); + if (menu) { - if ( menu->status & _IN_DRIVER ) + if (menu->status & _IN_DRIVER) RETURN(E_BAD_STATE); - if (menu->items == (ITEM **)0) + if (menu->items == (ITEM **) 0) RETURN(E_NOT_CONNECTED); - - if ((row<0) || (row > (menu->rows - menu->arows))) + + if ((row < 0) || (row > (menu->rows - menu->arows))) RETURN(E_BAD_ARGUMENT); } else RETURN(E_BAD_ARGUMENT); - + if (row != menu->toprow) { - if (menu->status & _LINK_NEEDED) + if (menu->status & _LINK_NEEDED) _nc_Link_Items(menu); - - item = menu->items[ (menu->opt&O_ROWMAJOR) ? (row*menu->cols) : row ]; + + item = menu->items[(menu->opt & O_ROWMAJOR) ? (row * menu->cols) : row]; assert(menu->pattern); Reset_Pattern(menu); _nc_New_TopRow_and_CurrentItem(menu, row, item); } - - RETURN(E_OK); + + RETURN(E_OK); } /*--------------------------------------------------------------------------- @@ -90,15 +92,16 @@ set_top_row (MENU * menu, int row) | Return Values : The row number or ERR if there is no row +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -top_row (const MENU * menu) +top_row(const MENU * menu) { + T((T_CALLED("top_row(%p)"), menu)); if (menu && menu->items && *(menu->items)) { - assert( (menu->toprow>=0) && (menu->toprow < menu->rows) ); - return menu->toprow; + assert((menu->toprow >= 0) && (menu->toprow < menu->rows)); + returnCode(menu->toprow); } else - return(ERR); + returnCode(ERR); } /* m_item_top.c ends here */ diff --git a/menu/m_item_use.c b/menu/m_item_use.c index c05e1d21..06a5baf9 100644 --- a/menu/m_item_use.c +++ b/menu/m_item_use.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_use.c,v 1.13 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: m_item_use.c,v 1.16 2004/12/25 21:33:31 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -49,10 +49,11 @@ MODULE_ID("$Id: m_item_use.c,v 1.13 2003/10/25 14:54:48 tom Exp $") | Return Values : E_OK - success +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_item_userptr (ITEM * item, void * userptr) +set_item_userptr(ITEM * item, void *userptr) { + T((T_CALLED("set_item_userptr(%p,%p)"), item, userptr)); Normalize_Item(item)->userptr = userptr; - RETURN( E_OK ); + RETURN(E_OK); } /*--------------------------------------------------------------------------- @@ -66,9 +67,10 @@ set_item_userptr (ITEM * item, void * userptr) | NULL is returned. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void *) -item_userptr (const ITEM * item) +item_userptr(const ITEM * item) { - return Normalize_Item(item)->userptr; + T((T_CALLED("item_userptr(%p)"), item)); + returnVoidPtr(Normalize_Item(item)->userptr); } /* m_item_use.c */ diff --git a/menu/m_item_val.c b/menu/m_item_val.c index 89bd8fb3..cebf693f 100644 --- a/menu/m_item_val.c +++ b/menu/m_item_val.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_val.c,v 1.12 2003/11/08 20:51:29 tom Exp $") +MODULE_ID("$Id: m_item_val.c,v 1.14 2004/12/11 23:29:34 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -53,18 +53,19 @@ MODULE_ID("$Id: m_item_val.c,v 1.12 2003/11/08 20:51:29 tom Exp $") | E_REQUEST_DENIED - not selectable or single valued menu +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_item_value (ITEM *item, bool value) +set_item_value(ITEM * item, bool value) { MENU *menu; - + + T((T_CALLED("set_item_value(%p,%d)"), item, value)); if (item) { menu = item->imenu; - + if ((!(item->opt & O_SELECTABLE)) || - (menu && (menu->opt & O_ONEVALUE))) + (menu && (menu->opt & O_ONEVALUE))) RETURN(E_REQUEST_DENIED); - + if (item->value ^ value) { item->value = value ? TRUE : FALSE; @@ -72,7 +73,7 @@ set_item_value (ITEM *item, bool value) { if (menu->status & _POSTED) { - Move_And_Post_Item(menu,item); + Move_And_Post_Item(menu, item); _nc_Show_Menu(menu); } } @@ -80,7 +81,7 @@ set_item_value (ITEM *item, bool value) } else _nc_Default_Item.value = value; - + RETURN(E_OK); } @@ -94,9 +95,10 @@ set_item_value (ITEM *item, bool value) | FALSE - if item is not selected +--------------------------------------------------------------------------*/ NCURSES_EXPORT(bool) -item_value (const ITEM *item) +item_value(const ITEM * item) { - return ((Normalize_Item(item)->value) ? TRUE : FALSE); + T((T_CALLED("item_value(%p)"), item)); + returnBool((Normalize_Item(item)->value) ? TRUE : FALSE); } /* m_item_val.c ends here */ diff --git a/menu/m_item_vis.c b/menu/m_item_vis.c index 75bb60ed..f8fb97f0 100644 --- a/menu/m_item_vis.c +++ b/menu/m_item_vis.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_item_vis.c,v 1.13 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: m_item_vis.c,v 1.15 2004/12/25 21:40:09 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -50,18 +50,19 @@ MODULE_ID("$Id: m_item_vis.c,v 1.13 2003/10/25 14:54:48 tom Exp $") | FALSE if invisible +--------------------------------------------------------------------------*/ NCURSES_EXPORT(bool) -item_visible (const ITEM * item) +item_visible(const ITEM * item) { MENU *menu; - - if ( item && - (menu=item->imenu) && - (menu->status & _POSTED) && - ( (menu->toprow + menu->arows) > (item->y) ) && - ( item->y >= menu->toprow) ) - return TRUE; + + T((T_CALLED("item_visible(%p)"), item)); + if (item && + (menu = item->imenu) && + (menu->status & _POSTED) && + ((menu->toprow + menu->arows) > (item->y)) && + (item->y >= menu->toprow)) + returnBool(TRUE); else - return FALSE; + returnBool(FALSE); } /* m_item_vis.c ends here */ diff --git a/menu/m_items.c b/menu/m_items.c index d66a5189..3e8f70b0 100644 --- a/menu/m_items.c +++ b/menu/m_items.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_items.c,v 1.12 2003/11/08 20:50:58 tom Exp $") +MODULE_ID("$Id: m_items.c,v 1.16 2005/01/16 01:02:23 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -53,26 +53,28 @@ MODULE_ID("$Id: m_items.c,v 1.12 2003/11/08 20:50:58 tom Exp $") | passed to the function +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_menu_items (MENU * menu, ITEM ** items) +set_menu_items(MENU * menu, ITEM ** items) { + T((T_CALLED("set_menu_items(%p,%p)"), menu, items)); + if (!menu || (items && !(*items))) RETURN(E_BAD_ARGUMENT); - - if ( menu->status & _POSTED ) + + if (menu->status & _POSTED) RETURN(E_POSTED); - + if (menu->items) _nc_Disconnect_Items(menu); - + if (items) { - if(!_nc_Connect_Items( menu, items )) + if (!_nc_Connect_Items(menu, items)) RETURN(E_CONNECTED); } - + menu->items = items; RETURN(E_OK); -} +} /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -83,9 +85,10 @@ set_menu_items (MENU * menu, ITEM ** items) | Return Values : NULL on error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(ITEM **) -menu_items (const MENU *menu) +menu_items(const MENU * menu) { - return(menu ? menu->items : (ITEM **)0); + T((T_CALLED("menu_items(%p)"), menu)); + returnItemPtr(menu ? menu->items : (ITEM **) 0); } /*--------------------------------------------------------------------------- @@ -98,9 +101,10 @@ menu_items (const MENU *menu) | Return Values : Number of items or -1 to indicate error. +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -item_count (const MENU *menu) +item_count(const MENU * menu) { - return(menu ? menu->nitems : -1); + T((T_CALLED("item_count(%p)"), menu)); + returnCode(menu ? menu->nitems : -1); } /* m_items.c ends here */ diff --git a/menu/m_new.c b/menu/m_new.c index 10fd052f..20490d5f 100644 --- a/menu/m_new.c +++ b/menu/m_new.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_new.c,v 1.13 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: m_new.c,v 1.16 2004/12/25 21:57:53 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -51,10 +51,11 @@ MODULE_ID("$Id: m_new.c,v 1.13 2003/10/25 14:54:48 tom Exp $") | Return Values : NULL on error +--------------------------------------------------------------------------*/ NCURSES_EXPORT(MENU *) -new_menu (ITEM ** items) +new_menu(ITEM ** items) { - MENU *menu = (MENU *)calloc(1,sizeof(MENU)); - + MENU *menu = (MENU *) calloc(1, sizeof(MENU)); + + T((T_CALLED("new_menu(%p)"), items)); if (menu) { *menu = _nc_Default_Menu; @@ -63,10 +64,10 @@ new_menu (ITEM ** items) menu->cols = menu->fcols; if (items && *items) { - if (!_nc_Connect_Items(menu,items)) + if (!_nc_Connect_Items(menu, items)) { free(menu); - menu = (MENU *)0; + menu = (MENU *) 0; } } } @@ -74,7 +75,7 @@ new_menu (ITEM ** items) if (!menu) SET_ERROR(E_SYSTEM_ERROR); - return(menu); + returnMenu(menu); } /*--------------------------------------------------------------------------- @@ -89,17 +90,18 @@ new_menu (ITEM ** items) | E_POSTED - Menu is already posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -free_menu (MENU * menu) +free_menu(MENU * menu) { + T((T_CALLED("free_menu(%p)"), menu)); if (!menu) RETURN(E_BAD_ARGUMENT); - - if ( menu->status & _POSTED ) + + if (menu->status & _POSTED) RETURN(E_POSTED); - - if (menu->items) + + if (menu->items) _nc_Disconnect_Items(menu); - + if ((menu->status & _MARK_ALLOCATED) && menu->mark) free(menu->mark); diff --git a/menu/m_opts.c b/menu/m_opts.c index 70fc7d2b..a7370b06 100644 --- a/menu/m_opts.c +++ b/menu/m_opts.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_opts.c,v 1.16 2003/11/08 20:50:19 tom Exp $") +MODULE_ID("$Id: m_opts.c,v 1.19 2004/12/25 21:36:12 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -53,8 +53,10 @@ MODULE_ID("$Id: m_opts.c,v 1.16 2003/11/08 20:50:19 tom Exp $") | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_menu_opts (MENU * menu, Menu_Options opts) +set_menu_opts(MENU * menu, Menu_Options opts) { + T((T_CALLED("set_menu_opts(%p,%d)"), menu, opts)); + opts &= ALL_MENU_OPTS; if (opts & ~ALL_MENU_OPTS) @@ -62,18 +64,18 @@ set_menu_opts (MENU * menu, Menu_Options opts) if (menu) { - if ( menu->status & _POSTED ) + if (menu->status & _POSTED) RETURN(E_POSTED); - if ( (opts&O_ROWMAJOR) != (menu->opt&O_ROWMAJOR)) + if ((opts & O_ROWMAJOR) != (menu->opt & O_ROWMAJOR)) { /* we need this only if the layout really changed ... */ if (menu->items && menu->items[0]) { - menu->toprow = 0; + menu->toprow = 0; menu->curitem = menu->items[0]; assert(menu->curitem); - set_menu_format( menu, menu->frows, menu->fcols ); + set_menu_format(menu, menu->frows, menu->fcols); } } @@ -83,13 +85,13 @@ set_menu_opts (MENU * menu, Menu_Options opts) { ITEM **item; - if ( ((item=menu->items) != (ITEM**)0) ) - for(;*item;item++) + if (((item = menu->items) != (ITEM **) 0)) + for (; *item; item++) (*item)->value = FALSE; } if (opts & O_SHOWDESC) /* this also changes the geometry */ - _nc_Calculate_Item_Length_and_Width( menu ); + _nc_Calculate_Item_Length_and_Width(menu); } else _nc_Default_Menu.opt = opts; @@ -111,10 +113,13 @@ set_menu_opts (MENU * menu, Menu_Options opts) | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -menu_opts_off (MENU *menu, Menu_Options opts) +menu_opts_off(MENU * menu, Menu_Options opts) { - MENU *cmenu = menu; /* use a copy because set_menu_opts must detect - NULL menu itself to adjust its behavior */ + MENU *cmenu = menu; /* use a copy because set_menu_opts must detect + + NULL menu itself to adjust its behavior */ + + T((T_CALLED("menu_opts_off(%p,%d)"), menu, opts)); opts &= ALL_MENU_OPTS; if (opts & ~ALL_MENU_OPTS) @@ -123,7 +128,7 @@ menu_opts_off (MENU *menu, Menu_Options opts) { Normalize_Menu(cmenu); opts = cmenu->opt & ~opts; - return set_menu_opts( menu, opts ); + returnCode(set_menu_opts(menu, opts)); } } @@ -141,10 +146,13 @@ menu_opts_off (MENU *menu, Menu_Options opts) | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -menu_opts_on (MENU * menu, Menu_Options opts) +menu_opts_on(MENU * menu, Menu_Options opts) { - MENU *cmenu = menu; /* use a copy because set_menu_opts must detect - NULL menu itself to adjust its behavior */ + MENU *cmenu = menu; /* use a copy because set_menu_opts must detect + + NULL menu itself to adjust its behavior */ + + T((T_CALLED("menu_opts_on(%p,%d)"), menu, opts)); opts &= ALL_MENU_OPTS; if (opts & ~ALL_MENU_OPTS) @@ -153,7 +161,7 @@ menu_opts_on (MENU * menu, Menu_Options opts) { Normalize_Menu(cmenu); opts = cmenu->opt | opts; - return set_menu_opts(menu, opts); + returnCode(set_menu_opts(menu, opts)); } } @@ -166,9 +174,10 @@ menu_opts_on (MENU * menu, Menu_Options opts) | Return Values : Menu options +--------------------------------------------------------------------------*/ NCURSES_EXPORT(Menu_Options) -menu_opts (const MENU *menu) +menu_opts(const MENU * menu) { - return (ALL_MENU_OPTS & Normalize_Menu( menu )->opt); + T((T_CALLED("menu_opts(%p)"), menu)); + returnMenuOpts(ALL_MENU_OPTS & Normalize_Menu(menu)->opt); } /* m_opts.c ends here */ diff --git a/menu/m_pad.c b/menu/m_pad.c index 560036e2..76083ba3 100644 --- a/menu/m_pad.c +++ b/menu/m_pad.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_pad.c,v 1.7 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: m_pad.c,v 1.10 2004/12/25 21:40:58 tom Exp $") /* Macro to redraw menu if it is posted and changed */ #define Refresh_Menu(menu) \ @@ -59,18 +59,20 @@ MODULE_ID("$Id: m_pad.c,v 1.7 2003/10/25 14:54:48 tom Exp $") | E_BAD_ARGUMENT - an invalid value has been passed +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_menu_pad (MENU *menu, int pad) +set_menu_pad(MENU * menu, int pad) { - bool do_refresh = (menu != (MENU*)0); + bool do_refresh = (menu != (MENU *) 0); - if (!isprint((unsigned char)pad)) + T((T_CALLED("set_menu_pad(%p,%d)"), menu, pad)); + + if (!isprint(UChar(pad))) RETURN(E_BAD_ARGUMENT); - - Normalize_Menu( menu ); + + Normalize_Menu(menu); menu->pad = pad; - + if (do_refresh) - Refresh_Menu( menu ); + Refresh_Menu(menu); RETURN(E_OK); } @@ -84,9 +86,10 @@ set_menu_pad (MENU *menu, int pad) | Return Values : The pad character +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -menu_pad (const MENU * menu) +menu_pad(const MENU * menu) { - return (Normalize_Menu( menu ) -> pad); + T((T_CALLED("menu_pad(%p)"), menu)); + returnCode(Normalize_Menu(menu)->pad); } /* m_pad.c ends here */ diff --git a/menu/m_pattern.c b/menu/m_pattern.c index 3d50cf42..c3ef43a6 100644 --- a/menu/m_pattern.c +++ b/menu/m_pattern.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_pattern.c,v 1.9 2003/12/06 17:22:10 tom Exp $") +MODULE_ID("$Id: m_pattern.c,v 1.14 2005/04/16 17:53:16 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -51,9 +51,12 @@ MODULE_ID("$Id: m_pattern.c,v 1.9 2003/12/06 17:22:10 tom Exp $") | PatternString - as expected +--------------------------------------------------------------------------*/ NCURSES_EXPORT(char *) -menu_pattern (const MENU * menu) +menu_pattern(const MENU * menu) { - return (char *)(menu ? (menu->pattern ? menu->pattern : "") : 0); + static char empty[] = ""; + + T((T_CALLED("menu_pattern(%p)"), menu)); + returnPtr(menu ? (menu->pattern ? menu->pattern : empty) : 0); } /*--------------------------------------------------------------------------- @@ -70,49 +73,51 @@ menu_pattern (const MENU * menu) | E_NO_MATCH - no item matches pattern +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_menu_pattern (MENU *menu, const char *p) +set_menu_pattern(MENU * menu, const char *p) { ITEM *matchitem; - int matchpos; - - if (!menu || !p) + int matchpos; + + T((T_CALLED("set_menu_pattern(%p,%s)"), menu, _nc_visbuf(p))); + + if (!menu || !p) RETURN(E_BAD_ARGUMENT); - + if (!(menu->items)) RETURN(E_NOT_CONNECTED); - - if ( menu->status & _IN_DRIVER ) + + if (menu->status & _IN_DRIVER) RETURN(E_BAD_STATE); - + Reset_Pattern(menu); - + if (!(*p)) { pos_menu_cursor(menu); RETURN(E_OK); } - - if (menu->status & _LINK_NEEDED) + + if (menu->status & _LINK_NEEDED) _nc_Link_Items(menu); - - matchpos = menu->toprow; + + matchpos = menu->toprow; matchitem = menu->curitem; assert(matchitem); - - while(*p) + + while (*p) { - if ( !isprint((unsigned char)(*p)) || - (_nc_Match_Next_Character_In_Item_Name(menu,*p,&matchitem) != E_OK) ) + if (!isprint(UChar(*p)) || + (_nc_Match_Next_Character_In_Item_Name(menu, *p, &matchitem) != E_OK)) { Reset_Pattern(menu); pos_menu_cursor(menu); RETURN(E_NO_MATCH); } p++; - } - + } + /* This is reached if there was a match. So we position to the new item */ - Adjust_Current_Item(menu,matchpos,matchitem); + Adjust_Current_Item(menu, matchpos, matchitem); RETURN(E_OK); } diff --git a/menu/m_post.c b/menu/m_post.c index 759b328a..657d0f18 100644 --- a/menu/m_post.c +++ b/menu/m_post.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,113 +37,117 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_post.c,v 1.19 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: m_post.c,v 1.26 2004/12/25 23:57:04 tom Exp $") /*--------------------------------------------------------------------------- -| Facility : libnmenu -| Function : void _nc_Post_Item(MENU *menu, ITEM *item) -| +| Facility : libnmenu +| Function : void _nc_Post_Item(MENU *menu, ITEM *item) +| | Description : Draw the item in the menus window at the current -| window position +| window position | | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void) -_nc_Post_Item (const MENU * menu, const ITEM * item) +_nc_Post_Item(const MENU * menu, const ITEM * item) { int i; chtype ch; int item_x, item_y; int count = 0; - bool isfore = FALSE, isback=FALSE, isgrey = FALSE; - + bool isfore = FALSE, isback = FALSE, isgrey = FALSE; + int name_len; + int desc_len; + assert(menu->win); - - getyx(menu->win,item_y,item_x); - + + getyx(menu->win, item_y, item_x); + /* We need a marker iff - it is a onevalued menu and it is the current item - or it has a selection value - */ - wattron(menu->win,menu->back); - if (item->value || (item==menu->curitem)) + */ + wattron(menu->win, menu->back); + if (item->value || (item == menu->curitem)) { - if (menu->marklen) + if (menu->marklen) { /* In a multi selection menu we use the fore attribute for a selected marker that is not the current one. This improves visualization of the menu, because now always the 'normal' marker denotes the current item. */ - if (!(menu->opt & O_ONEVALUE) && item->value && item!=menu->curitem) + if (!(menu->opt & O_ONEVALUE) && item->value && item != menu->curitem) { - wattron(menu->win,menu->fore); + wattron(menu->win, menu->fore); isfore = TRUE; } - waddstr(menu->win,menu->mark); + waddstr(menu->win, menu->mark); if (isfore) { - wattron(menu->win,menu->fore); + wattron(menu->win, menu->fore); isfore = FALSE; } } } - else /* otherwise we have to wipe out the marker area */ - for(ch=' ',i=menu->marklen;i>0;i--) - waddch(menu->win,ch); - wattroff(menu->win,menu->back); + else /* otherwise we have to wipe out the marker area */ + for (ch = ' ', i = menu->marklen; i > 0; i--) + waddch(menu->win, ch); + wattroff(menu->win, menu->back); count += menu->marklen; /* First we have to calculate the attribute depending on selectability and selection status - */ + */ if (!(item->opt & O_SELECTABLE)) { - wattron(menu->win,menu->grey); + wattron(menu->win, menu->grey); isgrey = TRUE; } else { - if (item->value || item==menu->curitem) + if (item->value || item == menu->curitem) { - wattron(menu->win,menu->fore); + wattron(menu->win, menu->fore); isfore = TRUE; } else { - wattron(menu->win,menu->back); + wattron(menu->win, menu->back); isback = TRUE; } } - waddnstr(menu->win,item->name.str,item->name.length); - for(ch=' ',i=menu->namelen-item->name.length;i>0;i--) + waddnstr(menu->win, item->name.str, item->name.length); + name_len = _nc_Calculate_Text_Width(&(item->name)); + for (ch = ' ', i = menu->namelen - name_len; i > 0; i--) { - waddch(menu->win,ch); + waddch(menu->win, ch); } count += menu->namelen; /* Show description if required and available */ - if ( (menu->opt & O_SHOWDESC) && menu->desclen>0 ) + if ((menu->opt & O_SHOWDESC) && menu->desclen > 0) { - int m = menu->spc_desc/2; + int m = menu->spc_desc / 2; int cy = -1, cx = -1; - for(ch=' ',i=0; i < menu->spc_desc; i++) + for (ch = ' ', i = 0; i < menu->spc_desc; i++) { - if (i==m) + if (i == m) { - waddch(menu->win,menu->pad); - getyx(menu->win,cy,cx); + waddch(menu->win, menu->pad); + getyx(menu->win, cy, cx); } else - waddch(menu->win,ch); + waddch(menu->win, ch); } if (item->description.length) - waddnstr(menu->win,item->description.str,item->description.length); - for(ch=' ',i=menu->desclen-item->description.length; i>0; i--) + waddnstr(menu->win, item->description.str, item->description.length); + desc_len = _nc_Calculate_Text_Width(&(item->description)); + for (ch = ' ', i = menu->desclen - desc_len; i > 0; i--) { - waddch(menu->win,ch); + waddch(menu->win, ch); } count += menu->desclen + menu->spc_desc; @@ -151,47 +155,49 @@ _nc_Post_Item (const MENU * menu, const ITEM * item) { int j, k, ncy, ncx; - assert(cx>=0 && cy>=0); - getyx(menu->win,ncy,ncx); - if (isgrey) wattroff(menu->win,menu->grey); - else if (isfore) wattroff(menu->win,menu->fore); - wattron(menu->win,menu->back); - for(j=1; j < menu->spc_rows;j++) + assert(cx >= 0 && cy >= 0); + getyx(menu->win, ncy, ncx); + if (isgrey) + wattroff(menu->win, menu->grey); + else if (isfore) + wattroff(menu->win, menu->fore); + wattron(menu->win, menu->back); + for (j = 1; j < menu->spc_rows; j++) { - if ((item_y+j) < getmaxy(menu->win)) + if ((item_y + j) < getmaxy(menu->win)) { - wmove (menu->win,item_y+j,item_x); - for(k=0;kwin,' '); + wmove(menu->win, item_y + j, item_x); + for (k = 0; k < count; k++) + waddch(menu->win, ' '); } - if ((cy+j) < getmaxy(menu->win)) - mvwaddch(menu->win,cy+j,cx-1,menu->pad); + if ((cy + j) < getmaxy(menu->win)) + mvwaddch(menu->win, cy + j, cx - 1, menu->pad); } - wmove(menu->win,ncy,ncx); + wmove(menu->win, ncy, ncx); if (!isback) - wattroff(menu->win,menu->back); + wattroff(menu->win, menu->back); } } - + /* Remove attributes */ if (isfore) - wattroff(menu->win,menu->fore); + wattroff(menu->win, menu->fore); if (isback) - wattroff(menu->win,menu->back); + wattroff(menu->win, menu->back); if (isgrey) - wattroff(menu->win,menu->grey); -} + wattroff(menu->win, menu->grey); +} /*--------------------------------------------------------------------------- -| Facility : libnmenu +| Facility : libnmenu | Function : void _nc_Draw_Menu(const MENU *) -| +| | Description : Display the menu in its windows | | Return Values : - +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void) -_nc_Draw_Menu (const MENU * menu) +_nc_Draw_Menu(const MENU * menu) { ITEM *item = menu->items[0]; ITEM *lasthor, *lastvert; @@ -202,75 +208,78 @@ _nc_Draw_Menu (const MENU * menu) assert(item && menu->win); s_bkgd = getbkgd(menu->win); - wbkgdset(menu->win,menu->back); + wbkgdset(menu->win, menu->back); werase(menu->win); - wbkgdset(menu->win,s_bkgd); + wbkgdset(menu->win, s_bkgd); - lastvert = (menu->opt & O_NONCYCLIC) ? (ITEM *)0 : item; + lastvert = (menu->opt & O_NONCYCLIC) ? (ITEM *) 0 : item; do - { - wmove(menu->win,y,0); + { + wmove(menu->win, y, 0); + + hitem = item; + lasthor = (menu->opt & O_NONCYCLIC) ? (ITEM *) 0 : hitem; - hitem = item; - lasthor = (menu->opt & O_NONCYCLIC) ? (ITEM *)0 : hitem; - do { - _nc_Post_Item( menu, hitem); + _nc_Post_Item(menu, hitem); - wattron(menu->win,menu->back); - if ( ((hitem = hitem->right) != lasthor) && hitem ) + wattron(menu->win, menu->back); + if (((hitem = hitem->right) != lasthor) && hitem) { - int i,j, cy, cx; + int i, j, cy, cx; chtype ch = ' '; - getyx(menu->win,cy,cx); - for(j=0;jspc_rows;j++) + getyx(menu->win, cy, cx); + for (j = 0; j < menu->spc_rows; j++) { - wmove(menu->win,cy+j,cx); - for(i=0; i < menu->spc_cols; i++) + wmove(menu->win, cy + j, cx); + for (i = 0; i < menu->spc_cols; i++) { - waddch( menu->win,ch); + waddch(menu->win, ch); } } - wmove(menu->win,cy,cx+menu->spc_cols); + wmove(menu->win, cy, cx + menu->spc_cols); } - } while (hitem && (hitem != lasthor)); - wattroff(menu->win,menu->back); - + } + while (hitem && (hitem != lasthor)); + wattroff(menu->win, menu->back); + item = item->down; y += menu->spc_rows; - - } while( item && (item != lastvert) ); + + } + while (item && (item != lastvert)); } /*--------------------------------------------------------------------------- -| Facility : libnmenu +| Facility : libnmenu | Function : int post_menu(MENU *) -| +| | Description : Post a menu to the screen. This makes it visible. | | Return Values : E_OK - success | E_BAD_ARGUMENT - not a valid menu pointer | E_SYSTEM_ERROR - error in lower layers -| E_NO_ROOM - Menu to large for screen | E_NOT_CONNECTED - No items connected to menu | E_BAD_STATE - Menu in userexit routine | E_POSTED - Menu already posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -post_menu (MENU * menu) +post_menu(MENU * menu) { + T((T_CALLED("post_menu(%p)"), menu)); + if (!menu) RETURN(E_BAD_ARGUMENT); - - if ( menu->status & _IN_DRIVER ) + + if (menu->status & _IN_DRIVER) RETURN(E_BAD_STATE); - if ( menu->status & _POSTED ) + if (menu->status & _POSTED) RETURN(E_POSTED); - + if (menu->items && *(menu->items)) { int y; @@ -278,54 +287,50 @@ post_menu (MENU * menu) WINDOW *win = Get_Menu_Window(menu); int maxy = getmaxy(win); - int maxx = getmaxx(win); - - if (maxx < menu->width || maxy < menu->height) - RETURN(E_NO_ROOM); - if ( (menu->win = newpad(h,menu->width)) ) + if ((menu->win = newpad(h, menu->width))) { y = (maxy >= h) ? h : maxy; - if (y>=menu->height) + if (y >= menu->height) y = menu->height; - if(!(menu->sub = subpad(menu->win,y,menu->width,0,0))) + if (!(menu->sub = subpad(menu->win, y, menu->width, 0, 0))) RETURN(E_SYSTEM_ERROR); } - else - RETURN(E_SYSTEM_ERROR); - - if (menu->status & _LINK_NEEDED) + else + RETURN(E_SYSTEM_ERROR); + + if (menu->status & _LINK_NEEDED) _nc_Link_Items(menu); } else RETURN(E_NOT_CONNECTED); - + menu->status |= _POSTED; - if (!(menu->opt&O_ONEVALUE)) + if (!(menu->opt & O_ONEVALUE)) { ITEM **items; - - for(items=menu->items;*items;items++) + + for (items = menu->items; *items; items++) { (*items)->value = FALSE; } } - + _nc_Draw_Menu(menu); - - Call_Hook(menu,menuinit); - Call_Hook(menu,iteminit); - + + Call_Hook(menu, menuinit); + Call_Hook(menu, iteminit); + _nc_Show_Menu(menu); - + RETURN(E_OK); } /*--------------------------------------------------------------------------- -| Facility : libnmenu +| Facility : libnmenu | Function : int unpost_menu(MENU *) -| +| | Description : Detach menu from screen | | Return Values : E_OK - success @@ -334,36 +339,38 @@ post_menu (MENU * menu) | E_NOT_POSTED - menu is not posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -unpost_menu (MENU * menu) +unpost_menu(MENU * menu) { WINDOW *win; - + + T((T_CALLED("unpost_menu(%p)"), menu)); + if (!menu) RETURN(E_BAD_ARGUMENT); - - if ( menu->status & _IN_DRIVER ) + + if (menu->status & _IN_DRIVER) RETURN(E_BAD_STATE); - if ( !( menu->status & _POSTED ) ) + if (!(menu->status & _POSTED)) RETURN(E_NOT_POSTED); - - Call_Hook(menu,itemterm); - Call_Hook(menu,menuterm); - + + Call_Hook(menu, itemterm); + Call_Hook(menu, menuterm); + win = Get_Menu_Window(menu); werase(win); wsyncup(win); - + assert(menu->sub); delwin(menu->sub); menu->sub = (WINDOW *)0; - + assert(menu->win); delwin(menu->win); menu->win = (WINDOW *)0; - + menu->status &= ~_POSTED; - + RETURN(E_OK); } diff --git a/menu/m_req_name.c b/menu/m_req_name.c index 2f1a4a12..01fe79e3 100644 --- a/menu/m_req_name.c +++ b/menu/m_req_name.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,27 +37,29 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_req_name.c,v 1.15 2003/10/25 14:54:48 tom Exp $") +MODULE_ID("$Id: m_req_name.c,v 1.19 2005/04/16 16:59:52 tom Exp $") -static const char *request_names[ MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1 ] = { - "LEFT_ITEM" , - "RIGHT_ITEM" , - "UP_ITEM" , - "DOWN_ITEM" , - "SCR_ULINE" , - "SCR_DLINE" , - "SCR_DPAGE" , - "SCR_UPAGE" , - "FIRST_ITEM" , - "LAST_ITEM" , - "NEXT_ITEM" , - "PREV_ITEM" , - "TOGGLE_ITEM" , +static const char *request_names[MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1] = +{ + "LEFT_ITEM", + "RIGHT_ITEM", + "UP_ITEM", + "DOWN_ITEM", + "SCR_ULINE", + "SCR_DLINE", + "SCR_DPAGE", + "SCR_UPAGE", + "FIRST_ITEM", + "LAST_ITEM", + "NEXT_ITEM", + "PREV_ITEM", + "TOGGLE_ITEM", "CLEAR_PATTERN", - "BACK_PATTERN" , - "NEXT_MATCH" , - "PREV_MATCH" + "BACK_PATTERN", + "NEXT_MATCH", + "PREV_MATCH" }; + #define A_SIZE (sizeof(request_names)/sizeof(request_names[0])) /*--------------------------------------------------------------------------- @@ -70,18 +72,18 @@ static const char *request_names[ MAX_MENU_COMMAND - MIN_MENU_COMMAND + 1 ] = { | NULL - on invalid request code +--------------------------------------------------------------------------*/ NCURSES_EXPORT(const char *) -menu_request_name ( int request ) +menu_request_name(int request) { - if ( (request < MIN_MENU_COMMAND) || (request > MAX_MENU_COMMAND) ) + T((T_CALLED("menu_request_name(%d)"), request)); + if ((request < MIN_MENU_COMMAND) || (request > MAX_MENU_COMMAND)) { SET_ERROR(E_BAD_ARGUMENT); - return (const char *)0; + returnCPtr((const char *)0); } else - return request_names[ request - MIN_MENU_COMMAND ]; + returnCPtr(request_names[request - MIN_MENU_COMMAND]); } - /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : int menu_request_by_name (const char *str); @@ -92,28 +94,30 @@ menu_request_name ( int request ) | E_NO_MATCH - request not found +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -menu_request_by_name ( const char *str ) -{ +menu_request_by_name(const char *str) +{ /* because the table is so small, it doesn't really hurt to run sequentially through it. - */ + */ unsigned int i = 0; char buf[16]; - + + T((T_CALLED("menu_request_by_name(%s)"), _nc_visbuf(str))); + if (str) { - strncpy(buf,str,sizeof(buf)); - while( (iitems && *(menu->items)) { if (rows) @@ -65,8 +67,7 @@ scale_menu (const MENU *menu, int *rows, int *cols) RETURN(E_OK); } else - RETURN( E_NOT_CONNECTED ); + RETURN(E_NOT_CONNECTED); } /* m_scale.c ends here */ - diff --git a/menu/m_spacing.c b/menu/m_spacing.c index 69474773..039bbe4d 100644 --- a/menu/m_spacing.c +++ b/menu/m_spacing.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_spacing.c,v 1.15 2003/11/08 20:49:06 tom Exp $") +MODULE_ID("$Id: m_spacing.c,v 1.17 2004/12/11 23:29:34 tom Exp $") #define MAX_SPC_DESC ((TABSIZE) ? (TABSIZE) : 8) #define MAX_SPC_COLS ((TABSIZE) ? (TABSIZE) : 8) @@ -52,10 +52,12 @@ MODULE_ID("$Id: m_spacing.c,v 1.15 2003/11/08 20:49:06 tom Exp $") | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_menu_spacing -(MENU *menu, int s_desc, int s_row, int s_col ) +set_menu_spacing(MENU * menu, int s_desc, int s_row, int s_col) { - MENU *m; /* split for ATAC workaround */ + MENU *m; /* split for ATAC workaround */ + + T((T_CALLED("set_menu_spacing(%p,%d,%d,%d)"), menu, s_desc, s_row, s_col)); + m = Normalize_Menu(menu); assert(m); @@ -63,19 +65,18 @@ set_menu_spacing RETURN(E_POSTED); if (((s_desc < 0) || (s_desc > MAX_SPC_DESC)) || - ((s_row < 0) || (s_row > MAX_SPC_ROWS)) || - ((s_col < 0) || (s_col > MAX_SPC_COLS))) + ((s_row < 0) || (s_row > MAX_SPC_ROWS)) || + ((s_col < 0) || (s_col > MAX_SPC_COLS))) RETURN(E_BAD_ARGUMENT); m->spc_desc = s_desc ? s_desc : 1; - m->spc_rows = s_row ? s_row : 1; - m->spc_cols = s_col ? s_col : 1; + m->spc_rows = s_row ? s_row : 1; + m->spc_cols = s_col ? s_col : 1; _nc_Calculate_Item_Length_and_Width(m); RETURN(E_OK); } - /*--------------------------------------------------------------------------- | Facility : libnmenu | Function : int menu_spacing (const MENU *,int *,int *,int *); @@ -85,15 +86,21 @@ set_menu_spacing | Return Values : E_OK - on success +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -menu_spacing ( const MENU *menu, int* s_desc, int* s_row, int* s_col) +menu_spacing(const MENU * menu, int *s_desc, int *s_row, int *s_col) { - const MENU *m; /* split for ATAC workaround */ + const MENU *m; /* split for ATAC workaround */ + + T((T_CALLED("menu_spacing(%p,%p,%p,%p)"), menu, s_desc, s_row, s_col)); + m = Normalize_Menu(menu); assert(m); - if (s_desc) *s_desc = m->spc_desc; - if (s_row) *s_row = m->spc_rows; - if (s_col) *s_col = m->spc_cols; + if (s_desc) + *s_desc = m->spc_desc; + if (s_row) + *s_row = m->spc_rows; + if (s_col) + *s_col = m->spc_cols; RETURN(E_OK); } diff --git a/menu/m_sub.c b/menu/m_sub.c index 8122e002..82649c57 100644 --- a/menu/m_sub.c +++ b/menu/m_sub.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_sub.c,v 1.7 2003/10/25 15:23:42 tom Exp $") +MODULE_ID("$Id: m_sub.c,v 1.10 2004/12/25 21:38:31 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -49,18 +49,20 @@ MODULE_ID("$Id: m_sub.c,v 1.7 2003/10/25 15:23:42 tom Exp $") | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_menu_sub (MENU *menu, WINDOW *win) +set_menu_sub(MENU * menu, WINDOW *win) { + T((T_CALLED("set_menu_sub(%p,%p)"), menu, win)); + if (menu) { - if ( menu->status & _POSTED ) + if (menu->status & _POSTED) RETURN(E_POSTED); menu->usersub = win; _nc_Calculate_Item_Length_and_Width(menu); } else _nc_Default_Menu.usersub = win; - + RETURN(E_OK); } @@ -73,10 +75,12 @@ set_menu_sub (MENU *menu, WINDOW *win) | Return Values : NULL on error, otherwise a pointer to the window +--------------------------------------------------------------------------*/ NCURSES_EXPORT(WINDOW *) -menu_sub (const MENU * menu) +menu_sub(const MENU * menu) { - const MENU* m = Normalize_Menu(menu); - return Get_Menu_Window(m); + const MENU *m = Normalize_Menu(menu); + + T((T_CALLED("menu_sub(%p)"), menu)); + returnWin(Get_Menu_Window(m)); } /* m_sub.c ends here */ diff --git a/menu/m_trace.c b/menu/m_trace.c new file mode 100644 index 00000000..0f9f9027 --- /dev/null +++ b/menu/m_trace.c @@ -0,0 +1,77 @@ +/**************************************************************************** + * Copyright (c) 2004,2005 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey * + ****************************************************************************/ + +#include "menu.priv.h" + +MODULE_ID("$Id: m_trace.c,v 1.3 2005/01/16 01:06:11 tom Exp $") + +NCURSES_EXPORT(ITEM *) +_nc_retrace_item(ITEM * code) +{ + T((T_RETURN("%p"), code)); + return code; +} + +NCURSES_EXPORT(ITEM **) +_nc_retrace_item_ptr(ITEM ** code) +{ + T((T_RETURN("%p"), code)); + return code; +} + +NCURSES_EXPORT(Item_Options) +_nc_retrace_item_opts(Item_Options code) +{ + T((T_RETURN("%d"), code)); + return code; +} + +NCURSES_EXPORT(MENU *) +_nc_retrace_menu(MENU * code) +{ + T((T_RETURN("%p"), code)); + return code; +} + +NCURSES_EXPORT(Menu_Hook) +_nc_retrace_menu_hook(Menu_Hook code) +{ + T((T_RETURN("%p"), code)); + return code; +} + +NCURSES_EXPORT(Menu_Options) +_nc_retrace_menu_opts(Menu_Options code) +{ + T((T_RETURN("%d"), code)); + return code; +} diff --git a/menu/m_userptr.c b/menu/m_userptr.c index 86f81d22..7b178b25 100644 --- a/menu/m_userptr.c +++ b/menu/m_userptr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_userptr.c,v 1.13 2003/10/25 15:23:42 tom Exp $") +MODULE_ID("$Id: m_userptr.c,v 1.16 2004/12/25 21:38:55 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -49,10 +49,11 @@ MODULE_ID("$Id: m_userptr.c,v 1.13 2003/10/25 15:23:42 tom Exp $") | Return Values : E_OK - success +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_menu_userptr (MENU * menu, void * userptr) +set_menu_userptr(MENU * menu, void *userptr) { + T((T_CALLED("set_menu_userptr(%p,%p)"), menu, userptr)); Normalize_Menu(menu)->userptr = userptr; - RETURN( E_OK ); + RETURN(E_OK); } /*--------------------------------------------------------------------------- @@ -66,9 +67,10 @@ set_menu_userptr (MENU * menu, void * userptr) | NULL is returned +--------------------------------------------------------------------------*/ NCURSES_EXPORT(void *) -menu_userptr (const MENU * menu) +menu_userptr(const MENU * menu) { - return( Normalize_Menu(menu)->userptr); + T((T_CALLED("menu_userptr(%p)"), menu)); + returnVoidPtr(Normalize_Menu(menu)->userptr); } /* m_userptr.c ends here */ diff --git a/menu/m_win.c b/menu/m_win.c index 7e0e212c..c3f857f7 100644 --- a/menu/m_win.c +++ b/menu/m_win.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,7 +37,7 @@ #include "menu.priv.h" -MODULE_ID("$Id: m_win.c,v 1.12 2003/10/25 15:23:42 tom Exp $") +MODULE_ID("$Id: m_win.c,v 1.15 2004/12/25 21:39:20 tom Exp $") /*--------------------------------------------------------------------------- | Facility : libnmenu @@ -49,18 +49,20 @@ MODULE_ID("$Id: m_win.c,v 1.12 2003/10/25 15:23:42 tom Exp $") | E_POSTED - menu is already posted +--------------------------------------------------------------------------*/ NCURSES_EXPORT(int) -set_menu_win (MENU *menu, WINDOW *win) +set_menu_win(MENU * menu, WINDOW *win) { + T((T_CALLED("set_menu_win(%p,%p)"), menu, win)); + if (menu) { - if ( menu->status & _POSTED ) + if (menu->status & _POSTED) RETURN(E_POSTED); menu->userwin = win; _nc_Calculate_Item_Length_and_Width(menu); } else _nc_Default_Menu.userwin = win; - + RETURN(E_OK); } @@ -73,10 +75,12 @@ set_menu_win (MENU *menu, WINDOW *win) | Return Values : NULL on error, otherwise pointer to window +--------------------------------------------------------------------------*/ NCURSES_EXPORT(WINDOW *) -menu_win (const MENU *menu) +menu_win(const MENU * menu) { - const MENU* m = Normalize_Menu(menu); - return (m->userwin ? m->userwin : stdscr); + const MENU *m = Normalize_Menu(menu); + + T((T_CALLED("menu_win(%p)"), menu)); + returnWin(m->userwin ? m->userwin : stdscr); } /* m_win.c ends here */ diff --git a/menu/menu.priv.h b/menu/menu.priv.h index 139dd618..10d35375 100644 --- a/menu/menu.priv.h +++ b/menu/menu.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,7 +30,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: menu.priv.h,v 1.16 2003/10/25 15:24:29 tom Exp $ */ +/* $Id: menu.priv.h,v 1.22 2005/01/16 01:02:23 tom Exp $ */ /*************************************************************************** * Module menu.priv.h * @@ -40,9 +40,7 @@ #ifndef MENU_PRIV_H_incl #define MENU_PRIV_H_incl 1 -#include -#include - +#include "curses.priv.h" #include "mf_common.h" #include "menu.h" @@ -108,10 +106,13 @@ extern NCURSES_EXPORT_VAR(MENU) _nc_Default_Menu; { (menu)->pindex = 0; \ (menu)->pattern[0] = '\0'; } +#define UChar(c) ((unsigned char)(c)) + /* Internal functions. */ extern NCURSES_EXPORT(void) _nc_Draw_Menu (const MENU *); extern NCURSES_EXPORT(void) _nc_Show_Menu (const MENU *); extern NCURSES_EXPORT(void) _nc_Calculate_Item_Length_and_Width (MENU *); +extern NCURSES_EXPORT(int) _nc_Calculate_Text_Width(const TEXT *); extern NCURSES_EXPORT(void) _nc_Post_Item (const MENU *, const ITEM *); extern NCURSES_EXPORT(bool) _nc_Connect_Items (MENU *, ITEM **); extern NCURSES_EXPORT(void) _nc_Disconnect_Items (MENU *); @@ -121,4 +122,31 @@ extern NCURSES_EXPORT(int) _nc_Match_Next_Character_In_Item_Name (MENU*,int,ITE extern NCURSES_EXPORT(int) _nc_menu_cursor_pos (const MENU* menu, const ITEM* item, int* pY, int* pX); +#ifdef TRACE + +#define returnItem(code) TRACE_RETURN(code,item) +#define returnItemPtr(code) TRACE_RETURN(code,item_ptr) +#define returnItemOpts(code) TRACE_RETURN(code,item_opts) +#define returnMenu(code) TRACE_RETURN(code,menu) +#define returnMenuHook(code) TRACE_RETURN(code,menu_hook) +#define returnMenuOpts(code) TRACE_RETURN(code,menu_opts) + +extern NCURSES_EXPORT(ITEM *) _nc_retrace_item (ITEM *); +extern NCURSES_EXPORT(ITEM **) _nc_retrace_item_ptr (ITEM **); +extern NCURSES_EXPORT(Item_Options) _nc_retrace_item_opts (Item_Options); +extern NCURSES_EXPORT(MENU *) _nc_retrace_menu (MENU *); +extern NCURSES_EXPORT(Menu_Hook) _nc_retrace_menu_hook (Menu_Hook); +extern NCURSES_EXPORT(Menu_Options) _nc_retrace_menu_opts (Menu_Options); + +#else /* !TRACE */ + +#define returnItem(code) return code +#define returnItemPtr(code) return code +#define returnItemOpts(code) return code +#define returnMenu(code) return code +#define returnMenuHook(code) return code +#define returnMenuOpts(code) return code + +#endif /* TRACE/!TRACE */ + #endif /* MENU_PRIV_H_incl */ diff --git a/menu/mf_common.h b/menu/mf_common.h index b9073c81..5b02eb4c 100644 --- a/menu/mf_common.h +++ b/menu/mf_common.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,7 +30,7 @@ * Author: Juergen Pfeifer, 1995,1997 * ****************************************************************************/ -/* $Id: mf_common.h,v 0.19 2003/10/25 15:24:29 tom Exp $ */ +/* $Id: mf_common.h,v 0.21 2004/12/11 22:40:40 tom Exp $ */ /* Common internal header for menu and form library */ @@ -71,16 +71,21 @@ extern int errno; #define MAX_REGULAR_CHARACTER (0xff) #define SET_ERROR(code) (errno=(code)) -#define GET_ERROR() (errno) -#define RETURN(code) return( SET_ERROR(code) ) +#define GET_ERROR() (errno) + +#ifdef TRACE +#define RETURN(code) returnCode( SET_ERROR(code) ) +#else +#define RETURN(code) return( SET_ERROR(code) ) +#endif /* The few common values in the status fields for menus and forms */ -#define _POSTED (0x01) /* menu or form is posted */ -#define _IN_DRIVER (0x02) /* menu or form is processing hook routine */ +#define _POSTED (0x01U) /* menu or form is posted */ +#define _IN_DRIVER (0x02U) /* menu or form is processing hook routine */ /* Call object hook */ #define Call_Hook( object, handler ) \ - if ( (object) && ((object)->handler) )\ + if ( (object) != 0 && ((object)->handler) != (void *) 0 )\ {\ (object)->status |= _IN_DRIVER;\ (object)->handler(object);\ diff --git a/menu/modules b/menu/modules index 5d6cc823..c78178a1 100644 --- a/menu/modules +++ b/menu/modules @@ -1,6 +1,6 @@ -# $Id: modules,v 1.14 1999/02/18 22:39:04 juergen Exp $ +# $Id: modules,v 1.16 2004/12/25 22:06:33 tom Exp $ ############################################################################## -# Copyright (c) 1998 Free Software Foundation, Inc. # +# Copyright (c) 1998,2004 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -56,5 +56,6 @@ m_req_name lib $(srcdir) $(MENU_PRIV_H) m_scale lib $(srcdir) $(MENU_PRIV_H) m_spacing lib $(srcdir) $(MENU_PRIV_H) m_sub lib $(srcdir) $(MENU_PRIV_H) +m_trace lib $(srcdir) $(MENU_PRIV_H) m_userptr lib $(srcdir) $(MENU_PRIV_H) m_win lib $(srcdir) $(MENU_PRIV_H) diff --git a/misc/Makefile.in b/misc/Makefile.in index b8f25b8e..8712edb4 100644 --- a/misc/Makefile.in +++ b/misc/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.34 2002/01/12 23:54:39 Robert.Joop Exp $ +# $Id: Makefile.in,v 1.36 2004/07/11 16:00:13 tom Exp $ ############################################################################## # Copyright (c) 1998,2000,2001,2002 Free Software Foundation, Inc. # # # @@ -68,7 +68,7 @@ INSTALL = @INSTALL@ INSTALL_DATA = @INSTALL_DATA@ ################################################################################ -all : +all : terminfo.tmp depend : @@ -76,7 +76,8 @@ sources : install : install.data -install.data : $(DESTDIR)$(libdir) \ +install.data : terminfo.tmp \ + $(DESTDIR)$(libdir) \ $(DESTDIR)$(ticdir) \ $(DESTDIR)$(tabsetdir) DESTDIR=${DESTDIR} \ @@ -87,7 +88,7 @@ install.data : $(DESTDIR)$(libdir) \ srcdir=${srcdir} \ datadir=${datadir} \ ticdir=${ticdir} \ - source=${source} \ + source=terminfo.tmp \ THIS_CC="$(CC)" \ THAT_CC="$(HOSTCC)" \ sh ./run_tic.sh @@ -98,10 +99,19 @@ install.data : $(DESTDIR)$(libdir) \ $(INSTALL_DATA) $$i $(DESTDIR)$(tabsetdir)/$$i; \ fi; done' +terminfo.tmp : run_tic.sed $(source) + echo '** adjusting tabset paths' + sed -f run_tic.sed $(source) >terminfo.tmp + +run_tic.sed : + WHICH_XTERM=@WHICH_XTERM@ \ + ticdir=${ticdir} \ + sh $(srcdir)/gen_edit.sh >$@ + $(DESTDIR)$(libdir) \ $(DESTDIR)$(tabsetdir) \ $(DESTDIR)$(ticdir) : - sh $(srcdir)/../mkinstalldirs $@ + sh $(top_srcdir)/mkinstalldirs $@ uninstall : uninstall.data @@ -114,6 +124,8 @@ tags : @MAKE_UPPER_TAGS@TAGS : mostlyclean : + -rm -f terminfo.tmp + -rm -f run_tic.sed -rm -f core tags TAGS *~ *.bak *.ln *.atac trace clean :: mostlyclean diff --git a/misc/gen_edit.sh b/misc/gen_edit.sh new file mode 100755 index 00000000..f0aa72ac --- /dev/null +++ b/misc/gen_edit.sh @@ -0,0 +1,58 @@ +#!/bin/sh +############################################################################## +# Copyright (c) 2004 Free Software Foundation, Inc. # +# # +# Permission is hereby granted, free of charge, to any person obtaining a # +# copy of this software and associated documentation files (the "Software"), # +# to deal in the Software without restriction, including without limitation # +# the rights to use, copy, modify, merge, publish, distribute, distribute # +# with modifications, sublicense, and/or sell copies of the Software, and to # +# permit persons to whom the Software is furnished to do so, subject to the # +# following conditions: # +# # +# The above copyright notice and this permission notice shall be included in # +# all copies or substantial portions of the Software. # +# # +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # +# THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # +# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # +# FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # +# DEALINGS IN THE SOFTWARE. # +# # +# Except as contained in this notice, the name(s) of the above copyright # +# holders shall not be used in advertising or otherwise to promote the sale, # +# use or other dealings in this Software without prior written # +# authorization. # +############################################################################## +# +# Author: Thomas E. Dickey +# +# $Id: gen_edit.sh,v 1.1 2004/07/11 15:01:29 tom Exp $ +# Generate a sed-script for converting the terminfo.src to the form which will +# be installed. +# +# Assumes: +# The leaf directory names (lib, tabset, terminfo) +# + +: ${ticdir=@TERMINFO@} +: ${xterm_new=@WHICH_XTERM@} + +# If we're not installing into /usr/share/, we'll have to adjust the location +# of the tabset files in terminfo.src (which are in a parallel directory). +TABSET=`echo $ticdir | sed -e 's%/terminfo$%/tabset%'` +if test "x$TABSET" != "x/usr/share/tabset" ; then +cat <\),//\1,' \ + "$save" >"$test" + cp "$test" "$name" + chmod u+w "$name" + # ${INDENT_PROG-indent} --version + ${INDENT_PROG-indent} $OPTS "$name" + sed \ + -e '/MODULE_ID(/s/);$/)/' \ + -e 's,;[ ]*//GCC_NORETURN;, GCC_NORETURN;,' \ + -e 's,//\(\\),\1,' \ + "$name" >"$test" + mv "$test" "$name" + rm -f "${name}~" + if test $NOOP = yes ; then + if (cmp -s "$name" "$save" ) then + echo "** no change: $name" + else + diff -u "$save" "$name" + fi + rm -f "$name" + mv "$save" "$name" + elif ( cmp -s "$name" "$save" ) ; then + echo "** unchanged $name" + rm -f "${name}" + mv "$save" "$name" + else + echo "** updated $name" + rm -f "$save" + fi + ;; + *) + echo "** ignored: $name" + ;; + esac +done diff --git a/misc/ncu-indent b/misc/ncu-indent new file mode 100755 index 00000000..7bd1d04e --- /dev/null +++ b/misc/ncu-indent @@ -0,0 +1,98 @@ +#!/bin/sh +# $Id: ncu-indent,v 1.12 2004/11/23 00:45:48 tom Exp $ +NOOP=no +OPTS=' +--blank-lines-after-procedures +--braces-on-if-line +--continuation-indentation0 +--continue-at-parentheses +--cuddle-else +--indent-level4 +--leave-preprocessor-space +--no-blank-lines-after-commas +--no-blank-lines-after-declarations +--no-space-after-function-call-names +--procnames-start-lines +--space-special-semicolon +--swallow-optional-blank-lines +--tab-size8 + +-T NCURSES_EXPORT_VAR +-T SCREEN +-T TERMTYPE +-T attr_t +-T cchar_t +-T chtype +-T inline +-T wchar_t +-T wint_t + +-T BUFFER +-T CHARTYPE +-T FILE +-T GCC_NORETURN +-T LINE +-T MARK +-T RETSIGTYPE +-T TBUFF +-T WINDOW +-T size_t +-T va_list + +-T Cardinal +-T Widget +-T XtPointer +' +for name in $* +do + case $name in + -v|-n) + NOOP=yes + OPTS="$OPTS -v" + ;; + -*) + OPTS="$OPTS $name" + ;; + *.[ch]) + save="${name}".a$$ + test="${name}".b$$ + rm -f "$save" "$test" + mv "$name" "$save" + sed \ + -e '/MODULE_ID(/s/)$/);/' \ + -e 's,\\),//\1,' \ + "$save" >"$test" + cp "$test" "$name" + chmod u+w "$name" + # ${INDENT_PROG-indent} --version + ${INDENT_PROG-indent} -npro $OPTS "$name" + sed \ + -e '/MODULE_ID(/s/);$/)/' \ + -e 's,;[ ]*//GCC_NORETURN;, GCC_NORETURN;,' \ + -e 's,//\(\\),\1,' \ + "$name" >"$test" + mv "$test" "$name" + rm -f "${name}~" + if test $NOOP = yes ; then + if (cmp -s "$name" "$save" ) then + echo "** no change: $name" + else + diff -u "$save" "$name" + fi + rm -f "$name" + mv "$save" "$name" + elif ( cmp -s "$name" "$save" ) ; then + echo "** unchanged $name" + rm -f "${name}" + mv "$save" "$name" + else + echo "** updated $name" + rm -f "$save" + fi + ;; + *) + echo "** ignored: $name" + ;; + esac +done diff --git a/misc/run_tic.in b/misc/run_tic.in index 3b208b44..b228e45b 100644 --- a/misc/run_tic.in +++ b/misc/run_tic.in @@ -1,6 +1,6 @@ #!@SHELL@ ############################################################################## -# Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -29,7 +29,7 @@ # # Author: Thomas E. Dickey 1996,2000 # -# $Id: run_tic.in,v 1.15 2003/09/06 22:31:44 Dan.Kegel Exp $ +# $Id: run_tic.in,v 1.20 2005/09/17 23:13:49 tom Exp $ # This script is used to install terminfo.src using tic. We use a script # because the path checking is too awkward to do in a makefile. # @@ -54,6 +54,7 @@ echo '** Building terminfo database, please wait...' : ${LN_S="@LN_S@"} : ${THAT_CC=cc} : ${THIS_CC=cc} +: ${ext_funcs=@NCURSES_EXT_FUNCS@} test -z "${DESTDIR}" && DESTDIR= @@ -70,22 +71,26 @@ SHLIB="sh $srcdir/shlib" else # Cross-compiling, so don't set PATH or run shlib. SHLIB= +# reset $suffix, since it applies to the target, not the build platform. +suffix= fi -# + # set another env var that doesn't get reset when `shlib' runs, so `shlib' uses # the PATH we just set. -# -NEWPATH=$PATH -export NEWPATH -PROG_BIN_DIR=${DESTDIR}$bindir -export PROG_BIN_DIR +SHLIB_PATH=$PATH +export SHLIB_PATH +# set a variable to simplify environment update in shlib +SHLIB_HOST=@host_os@ +export SHLIB_HOST + +# don't use user's TERMINFO variable TERMINFO=${DESTDIR}$ticdir ; export TERMINFO umask 022 # Construct the name of the old (obsolete) pathname, e.g., /usr/lib/terminfo. -TICDIR=`echo $TERMINFO | sed -e 's%/share/%/lib/%'` +TICDIR=`echo $TERMINFO | sed -e 's%/share/\([^/]*\)$%/lib/\1%'` # Remove the old terminfo stuff; we don't care if it existed before, and it # would generate a lot of confusing error messages if we tried to overwrite it. @@ -93,26 +98,35 @@ TICDIR=`echo $TERMINFO | sed -e 's%/share/%/lib/%'` # the directory is actually a symbolic link. ( cd $TERMINFO && rm -fr ? 2>/dev/null ) -# If we're not installing into /usr/share/, we'll have to adjust the location -# of the tabset files in terminfo.src (which are in a parallel directory). -TABSET=`echo $ticdir | sed -e 's%/terminfo$%/tabset%'` -if test "x$TABSET" != "x/usr/share/tabset" ; then - echo '** adjusting tabset paths' - TMP=${TMPDIR-/tmp}/$$ - sed -e s%/usr/share/tabset%$TABSET%g $source >$TMP - trap "rm -f $TMP" 0 1 2 5 15 - source=$TMP -fi +if test "$ext_funcs" = 1 ; then +cat < 1996 # -# $Id: shlib,v 1.7 2003/07/19 22:58:14 tom Exp $ +# $Id: shlib,v 1.10 2005/06/25 22:41:17 tom Exp $ # Use this script as a wrapper when running executables linked to shared # libraries on systems that use the $LD_LIBRARY_PATH variable and don't embed # the soname's path within the linked executable (such as IRIX), e.g, @@ -58,37 +58,83 @@ # Special cases: # # BeOS R4.5 uses $LIBRARY_PATH rather than $LD_LIBRARY_PATH. - +# Cygwin uses $PATH +# Mac OS X uses $DYLD_LIBRARY_PATH # -# Make sure that we use the PATH that was set in run_tic.sh +# Other cases not handled by this script: +# +# AIX uses $LIBPATH +# IRIX64 may use $LD_LIBRARY64_PATH or $LD_LIBRARYN32_PATH +# Solaris may use $LD_LIBRARY_PATH_64 # -if test X$NEWPATH != X ; then - PATH=$NEWPATH +CDPATH= +# +# Make sure that we use the PATH that was set in run_tic.sh +if test -n "$SHLIB_PATH" ; then + PATH=$SHLIB_PATH export PATH fi +# Find the lib-directory for this build tree q="" -for p in lib ../lib +for p in lib ../lib ../../lib ../../../lib do if test -d $p; then - q="$p" + q=`cd $p; pwd` + elif test -f configure && test ! -d ../$p ; then + break fi done + +# Set the environment variable. if test -n "$q" ; then - if test -n "$LD_LIBRARY_PATH"; then - LD_LIBRARY_PATH="$q:$LD_LIBRARY_PATH" + system= + if test -n "$SHLIB_HOST" ; then + system="$SHLIB_HOST" + elif test -n "$PATHEXT" ; then + system=cygwin elif test -n "$LIBRARY_PATH" ; then - LIBRARY_PATH="$q:$LIBRARY_PATH" + system=beos + elif test -n "$DYLD_LIBRARY_PATH" ; then + system=darwin + elif test -n "$LD_LIBRARY_PATH"; then + system=unix else - LD_LIBRARY_PATH="$q" + for r in $q/*.* + do + if test -f "$r" + then + case $r in + *.dll) + system=cygwin + ;; + *.dylib) + system=darwin + ;; + esac + fi + test -n "$system" && break + done fi - export LD_LIBRARY_PATH -fi -# cygwin doesn't use LD_LIBRARY_PATH, but does use PATH -if test -n "$PATHEXT" ; then - PATH=$LD_LIBRARY_PATH:$PATH; - export PATH + case .$system in + .cygwin*) + variable=PATH + ;; + .beos*) + variable=LIBRARY_PATH + ;; + .darwin*) + variable=DYLD_LIBRARY_PATH + ;; + *) + variable=LD_LIBRARY_PATH + ;; + esac + + eval 'test -z "$'$variable'" && '$variable'=":"' + eval $variable'="$q:$'$variable'"' + eval 'export '$variable fi eval "$*" diff --git a/misc/terminfo.src b/misc/terminfo.src index 1dc48996..21eb3f0e 100644 --- a/misc/terminfo.src +++ b/misc/terminfo.src @@ -4,12 +4,13 @@ # Report bugs and new terminal descriptions to # bug-ncurses@gnu.org # -# $Revision: 1.227 $ -# $Date: 2004/01/18 01:37:18 $ +# $Revision: 1.268 $ +# $Date: 2005/07/24 00:22:25 $ # # The original header is preserved below for reference. It is noted that there -# is a newer version which differs in some cosmetic details; we have decided -# to not change the header unless there is also a change in content. +# is a "newer" version which differs in some cosmetic details (but actually +# stopped updates several years ago); we have decided to not change the header +# unless there is also a change in content. # #------------------------------------------------------------------------------ # Version 10.2.1 @@ -291,7 +292,7 @@ glasstty|classic glass tty interpreting ASCII control characters, bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, ht=^I, kcub1=^H, kcud1=^J, nel=^M^J, .kbs=^H, -vanilla, +vanilla|dumb tty, OTbs, bel=^G, cr=^M, cud1=^J, ind=^J, @@ -329,7 +330,9 @@ ansi+arrows, kbs=^H, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, khome=\E[H, ansi+sgr|ansi graphic renditions, - blink=\E[5m, invis=\E[8m, rev=\E[7m, sgr0=\E[0m, + blink=\E[5m, invis=\E[8m, rev=\E[7m, + sgr=\E[0%?%p3%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%;, + sgr0=\E[0m, ansi+sgrso|ansi standout only, rmso=\E[m, smso=\E[7m, ansi+sgrul|ansi underline only, @@ -705,12 +708,12 @@ linux-basic|linux console, kf19=\E[33~, kf2=\E[[B, kf20=\E[34~, kf3=\E[[C, kf4=\E[[D, kf5=\E[[E, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, - kspd=^Z, nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rmir=\E[4l, - rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, + kspd=^Z, nel=^M^J, rc=\E8, rev=\E[7m, ri=\EM, rmam=\E[?7l, + rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, rs1=\Ec\E]R, sc=\E7, sgr=\E[0;10%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, - smir=\E[4h, smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, - u7=\E[6n, u8=\E[?6c, u9=\E[c, vpa=\E[%i%p1%dd, - use=klone+sgr, use=ecma+color, + smam=\E[?7h, smir=\E[4h, smul=\E[4m, tbc=\E[3g, + u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?6c, u9=\E[c, + vpa=\E[%i%p1%dd, use=klone+sgr, use=ecma+color, linux-m|Linux console no color, colors@, pairs@, @@ -791,6 +794,63 @@ mach-color|Mach Console with ANSI color, dim=\E[2m, invis=\E[8m, op=\E[37;40m, rmso=\E[27m, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, use=mach, +# From: Marcus Brinkmann +# http://savannah.gnu.org/cgi-bin/viewcvs/*checkout*/hurd/hurd/console/ +# +# Comments in the original are summarized here: +# +# hurd uses 8-bit characters (km). +# +# Although it doesn't do XON/XOFF, we don't want padding characters (xon). +# +# Regarding compatibility to vt100: hurd doesn't specify , as we don't +# have the eat_newline_glitch. It doesn't support setting or removing tab +# stops (hts/tbc). +# +# hurd uses ^H instead of \E[D for cub1, as only ^H implements and it is +# one byte instead three. +# +# is not included because hurd has insert mode. +# +# hurd doesn't use ^J for scrolling, because this could put things into the +# scrollback buffer. +# +# gsbom/grbom are used to enable/disable real bold (not intensity bright) mode. +# This is a GNU extension. +# +# The original has commented-out ncv, but is restored here. +# +# Reading the source, RIS resets cnorm, but not xmous. +hurd|The GNU Hurd console server, + am, bce, bw, eo, km, mir, msgr, xon, + colors#8, it#8, ncv#18, pairs#64, + acsc=++\,\,--..00ii``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\Ec, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, + cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=\E[B, + cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, + cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[34l, dch=\E[%p1%dP, + dch1=\E[P, dim=\E[2m, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, flash=\Eg, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, ich=\E[%p1%d@, + il=\E[%p1%dL, il1=\E[L, ind=\E[S, indn=\E[%p1%dS, + invis=\E[8m, kb2=\E[G, kbs=\177, kcbt=\E[Z, kcub1=\EOD, + kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, + kend=\E[4~, kf1=\EOP, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf5=\E[15~, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + kspd=^Z, nel=^M^J, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\E[T, + rin=\E[%p1%dT, ritm=\E[23m, rmacs=\E[10m, rmir=\E[4l, + rmso=\E[27m, rmul=\E[24m, rs1=\EM\E[?1000l, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;%?%p9%t;11%;m, + sgr0=\E[0m, sitm=\E[3m, smacs=\E[11m, smir=\E[4h, + smso=\E[7m, smul=\E[4m, vpa=\E[%i%p1%dd, grbom=\E[>1l, + gsbom=\E[>1h, + #### OSF Unix # @@ -1464,7 +1524,7 @@ x68k|x68k-ite|NetBSD/x68k ITE, # Entry for the DNARD OpenFirmware console, close to ANSI but not quite. # # (still unfinished, but good enough so far.) -ofcons, +ofcons|DNARD OpenFirmware console, bw, cols#80, lines#30, bel=^G, blink=\2337;2m, bold=\2331m, clear=^L, cr=^M, @@ -1482,15 +1542,29 @@ ofcons, sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, sgr0=\2330m, -# NetBSD "wscons" emulator in vt220 mode -# These are micro-minimal and probably need to be redone for real -# after the manner of the pcvt entries. +# NetBSD "wscons" emulator in vt220 mode. +# This entry is based on the NetBSD termcap entry, correcting the ncv value. +# The emulator renders underlined text in red. Colors are otherwise usable. +# +# Testing the emulator and reading the source code (NetBSD 2.0), it appears +# that "vt220" is inaccurate. There are a few vt220-features, but most of the +# vt220 screens in vttest do not work with this emulator. For instance, it +# identifies itself (primary DA response) as a vt220 with selective erase. But +# the selective erase feature does not work. The secondary response is copied +# from Kermit's emulation of vt220, does not correspond to actual vt220. At +# the level of detail in a termcap, it is a passable emulator, since ECH does +# work. Don't use it on a VMS system -TD wsvt25|NetBSD wscons in 25 line DEC VT220 mode, - cols#80, lines#25, use=vt220, + bce, msgr, + colors#8, cols#80, it#8, lines#25, ncv#2, pairs#64, + is2=\E[r\E[25;1H, kend=\E[8~, kf1=\E[11~, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, kf3=\E[13~, + kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, + kf9=\E[20~, khome=\E[7~, op=\E[m, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, use=vt220, wsvt25m|NetBSD wscons in 25 line DEC VT220 mode with Meta, - km, - cols#80, lines#25, use=vt220, + km, use=wsvt25, # `rasterconsole' provided by 4.4BSD, NetBSD and OpenBSD on SPARC, and # DECstation/pmax. @@ -1563,31 +1637,34 @@ cons25w|ansiw|ansi80x25-raw|freebsd console (25-line raw mode), cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[=1C, dch=\E[%p1%dP, dch1=\E[P, dim=\E[30;1m, - dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, home=\E[H, - hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, ich1=\E[@, - il=\E[%p1%dL, il1=\E[L, ind=\E[S, indn=\E[%p1%dS, kb2=\E[E, - kbs=^H, kcbt=\E[Z, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, - kcuu1=\E[A, kdch1=\177, kend=\E[F, kf1=\E[M, kf10=\E[V, - kf11=\E[W, kf12=\E[X, kf13=\E[Y, kf14=\E[Z, kf15=\E[a, - kf16=\E[b, kf17=\E[c, kf18=\E[d, kf19=\E[e, kf2=\E[N, - kf20=\E[f, kf21=\E[g, kf22=\E[h, kf23=\E[i, kf24=\E[j, - kf25=\E[k, kf26=\E[l, kf27=\E[m, kf28=\E[n, kf29=\E[o, - kf3=\E[O, kf30=\E[p, kf31=\E[q, kf32=\E[r, kf33=\E[s, - kf34=\E[t, kf35=\E[u, kf36=\E[v, kf37=\E[w, kf38=\E[x, - kf39=\E[y, kf4=\E[P, kf40=\E[z, kf41=\E[@, kf42=\E[[, - kf43=\E[\\, kf44=\E[], kf45=\E[\^, kf46=\E[_, kf47=\E[`, - kf48=\E[{, kf5=\E[Q, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, - khome=\E[H, kich1=\E[L, knp=\E[G, kpp=\E[I, nel=\E[E, - op=\E[x, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, - rs2=\E[x\E[m\Ec, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + dl=\E[%p1%dM, dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, + home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\E[S, + indn=\E[%p1%dS, kb2=\E[E, kbs=^H, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\177, kend=\E[F, + kf1=\E[M, kf10=\E[V, kf11=\E[W, kf12=\E[X, kf13=\E[Y, + kf14=\E[Z, kf15=\E[a, kf16=\E[b, kf17=\E[c, kf18=\E[d, + kf19=\E[e, kf2=\E[N, kf20=\E[f, kf21=\E[g, kf22=\E[h, + kf23=\E[i, kf24=\E[j, kf25=\E[k, kf26=\E[l, kf27=\E[m, + kf28=\E[n, kf29=\E[o, kf3=\E[O, kf30=\E[p, kf31=\E[q, + kf32=\E[r, kf33=\E[s, kf34=\E[t, kf35=\E[u, kf36=\E[v, + kf37=\E[w, kf38=\E[x, kf39=\E[y, kf4=\E[P, kf40=\E[z, + kf41=\E[@, kf42=\E[[, kf43=\E[\\, kf44=\E[], kf45=\E[\^, + kf46=\E[_, kf47=\E[`, kf48=\E[{, kf5=\E[Q, kf6=\E[R, + kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, kich1=\E[L, + knp=\E[G, kpp=\E[I, nel=\E[E, op=\E[x, rc=\E8, rev=\E[7m, + ri=\E[T, rin=\E[%p1%dT, rmso=\E[m, rs2=\E[x\E[m\Ec, sc=\E7, + setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0%?%p1%t;2;7%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;30;1%;%?%p6%t;1%;m, sgr0=\E[m, smso=\E[7m, vpa=\E[%i%p1%dd, cons25|ansis|ansi80x25|freebsd console (25-line ansi mode), acsc=-\030.^Y0\333`\004a\260f\370g\361h\261i\025j\331k\277l\332m\300n\305q\304t\303u\264v\301w\302x\263y\363z\362~\371, use=cons25w, cons25-m|ansis-mono|ansi80x25-mono|freebsd console (25-line mono ansi mode), colors@, pairs@, - bold@, dim@, op@, rmul=\E[m, setab@, setaf@, smul=\E[4m, - use=cons25, + bold@, dim@, op@, rmul=\E[m, setab@, setaf@, + sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m, + smul=\E[4m, use=cons25, cons30|ansi80x30|freebsd console (30-line ansi mode), lines#30, use=cons25, cons30-m|ansi80x30-mono|freebsd console (30-line mono ansi mode), @@ -1609,7 +1686,9 @@ cons25r|pc3r|ibmpc3r|cons25-koi8-r|freebsd console w/koi8-r cyrillic, use=cons25w, cons25r-m|pc3r-m|ibmpc3r-mono|cons25-koi8r-m|freebsd console w/koi8-r cyrillic (mono), colors@, pairs@, - op@, rmul=\E[m, setab@, setaf@, smul=\E[4m, use=cons25r, + op@, rmul=\E[m, setab@, setaf@, + sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;30;1%;%?%p6%t;1%;m, + smul=\E[4m, use=cons25r, cons50r|cons50-koi8r|freebsd console w/koi8-r cyrillic (50 lines), lines#50, use=cons25r, cons50r-m|cons50-koi8r-m|freebsd console w/koi8-r cyrillic (50-line mono), @@ -1624,8 +1703,9 @@ cons25l1|cons25-iso8859|freebsd console w/iso 8859-1 chars, use=cons25w, cons25l1-m|cons25-iso-m|freebsd console w/iso 8859-1 chars (mono), colors@, pairs@, - bold@, dim@, op@, rmul=\E[m, setab@, setaf@, smul=\E[4m, - use=cons25l1, + bold@, dim@, op@, rmul=\E[m, setab@, setaf@, + sgr=\E[0%?%p1%t;2;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m, + smul=\E[4m, use=cons25l1, cons50l1|cons50-iso8859|freebsd console w/iso 8859-1 chars (50 lines), lines#50, use=cons25l1, cons50l1-m|cons50-iso-m|freebsd console w/iso 8859-1 chars (50-line mono), @@ -1705,11 +1785,27 @@ bsdos-ppc|PowerPC BSD/OS Console, #### DEC VT52 # (// capabilities aren't in DEC's official entry -- esr) +# +# Actually (TD pointed this out at the time the acsc string was added): +# vt52 shouldn't define full acsc since most of the cells don't match. +# see vt100 manual page A-31. This is the list that does match: +# f degree +# g plus/minus +# h right-arrow +# k down-arrow +# m scan-1 +# o scan-3 +# q scan-5 +# s scan-7 +# The line-drawing happens to work in several terminal emulators, but should +# not be used as a guide to the capabilities of the vt52. Note in particular +# that vt52 does not support line-drawing characters (the scan-X values refer +# to a crude plotting feature) -TD vt52|dec vt52, OTbs, cols#80, it#8, lines#24, - acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, clear=\EH\EJ, cr=^M, cub1=\ED, cud1=\EB, cuf1=\EC, + acsc=ffgghhompoqqss.k, bel=^G, clear=\EH\EJ, cr=^M, + cub1=\ED, cud1=\EB, cuf1=\EC, cup=\EY%p1%{32}%+%c%p2%{32}%+%c, cuu1=\EA, ed=\EJ, el=\EK, home=\EH, ht=^I, ind=^J, kbs=^H, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, nel=^M^J, ri=\EI, rmacs=\EG, smacs=\EF, @@ -1894,7 +1990,7 @@ vt220+keypad|dec vt220 numeric keypad, # # (vt100: I added / based on the init string, also . -- esr) vt100|vt100-am|dec vt100 (w/advanced video), - OTbs, am, msgr, xenl, xon, + OTbs, am, mc5i, msgr, xenl, xon, cols#80, it#8, lines#24, vt#3, acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m$<2>, bold=\E[1m$<2>, @@ -1904,8 +2000,9 @@ vt100|vt100-am|dec vt100 (w/advanced video), cup=\E[%i%p1%d;%p2%dH$<5>, cuu=\E[%p1%dA, cuu1=\E[A$<2>, ed=\E[J$<50>, el=\E[K$<3>, el1=\E[1K$<3>, enacs=\E(B\E)0, home=\E[H, ht=^I, hts=\EH, ind=^J, kbs=^H, - kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, rc=\E8, - rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, + kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, lf1=pf1, + lf2=pf2, lf3=pf3, lf4=pf4, mc0=\E[0i, mc4=\E[4i, mc5=\E[5i, + rc=\E8, rev=\E[7m$<2>, ri=\EM$<5>, rmacs=^O, rmam=\E[?7l, rmkx=\E[?1l\E>, rmso=\E[m$<2>, rmul=\E[m$<2>, rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h, sc=\E7, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;$<2>, @@ -1955,7 +2052,6 @@ vt100-s-bot|vt100-bot-s|vt100 for use with bottom sysline, # This entry (or vt102-nsgr) is probably the right thing to use for # these. vt102|dec vt102, - mir, dch1=\E[P, dl1=\E[M, il1=\E[L, rmir=\E[4l, smir=\E[4h, use=vt100, vt102-w|dec vt102 in wide mode, @@ -1974,7 +2070,9 @@ vt102-nsgr|vt102 no sgr (use if you see snowflakes after highlight changes), sgr@, sgr0=\E[m, use=vt102, # VT125 Graphics CRT. Clear screen also erases graphics +# Some vt125's came configured with vt102 support. vt125|vt125 graphics terminal, + mir, clear=\E[H\E[2J\EPpS(E)\E\\$<50>, use=vt100, # This isn't a DEC entry, it came from University of Wisconsin. @@ -2058,12 +2156,14 @@ vt220|vt200|dec vt220, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\EOQ, kf20=\E[34~, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, khlp=\E[28~, - khome=\E[H, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, krdo=\E[29~, - kslt=\E[4~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\E[i, - mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, + kich1=\E[2~, knp=\E[6~, kpp=\E[5~, krdo=\E[29~, kslt=\E[4~, + lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\E[i, mc4=\E[4i, + mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=\E(B$<4>, rmam=\E[?7l, rmir=\E[4l, rmso=\E[27m, - rmul=\E[24m, rs1=\E[?3l, sc=\E7, sgr0=\E[m, smacs=\E(0$<2>, - smam=\E[?7h, smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + rmul=\E[24m, rs1=\E[?3l, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, + sgr0=\E[m\E(B, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, + smso=\E[7m, smul=\E[4m, tbc=\E[3g, vt220-w|vt200-w|DEC vt220 in wide mode, cols#132, rs3=\E[?3h, use=vt220, @@ -2089,12 +2189,13 @@ vt220-8bit|vt220-8|vt200-8bit|vt200-8|dec vt220/200 in 8-bit mode, kfnd=\2331~, khlp=\23328~, khome=\233H, kich1=\2332~, knp=\2336~, kpp=\2335~, krdo=\23329~, kslt=\2334~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\233i, mc4=\2334i, mc5=\2335i, - nel=\EE, rc=\E8, rev=\2337m, ri=\EM, rmacs=^O, rmam=\233?7l, - rmir=\2334l, rmso=\23327m, rmul=\23324m, rs1=\233?3l, - sc=\E7, sgr0=\233m, smacs=^N, smam=\233?7h, smir=\2334h, + nel=\EE, rc=\E8, rev=\2337m, ri=\EM, rmacs=\E(B, + rmam=\233?7l, rmir=\2334l, rmso=\23327m, rmul=\23324m, + rs1=\233?3l, sc=\E7, + sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, + sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h, smir=\2334h, smso=\2337m, smul=\2334m, tbc=\2333g, -# # vt220d: # This vt220 description regards F6--F10 as the second block of function keys # at the top of the keyboard. This mapping follows the description given @@ -2146,7 +2247,6 @@ vt200-js|vt220-js|dec vt200 series with jump scroll, #vt320|DEC VT320 in vt100 emulation mode, # use=vt220, -# # Use v320n for SCO's LYRIX. Otherwise, use Adam Thompson's vt320-nam. # vt320nam|v320n|DEC VT320 in vt100 emul. mode with NO AUTO WRAP mode, @@ -2179,7 +2279,7 @@ vt320|vt300|dec vt320 7 bit terminal, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, fsl=\E[0$}, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, - is2=\E>\E[?3l\E[?4l\E[5?l\E[?7h\E[?8h\E[1;24r\E[24;1H, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, kbs=\177, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kel=\E[4~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, @@ -2191,25 +2291,27 @@ vt320|vt300|dec vt320 7 bit terminal, rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[m, rmul=\E[m, - rs2=\E>\E[?3l\E[?4l\E[5?l\E[?7h\E[?8h\E[1;24r\E[24;1H, - sc=\E7, sgr0=\E[m, smacs=\E(0, smam=\E[?7h, smir=\E[4h, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, + sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, + sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, tsl=\E[1$}\E[H\E[K, use=vt220+keypad, vt320-nam|vt300-nam|dec vt320 7 bit terminal with no am to make SAS happy, am@, - is2=\E>\E[?3l\E[?4l\E[5?l\E[?7l\E[?8h\E[1;24r\E[24;1H, - rs2=\E>\E[?3l\E[?4l\E[5?l\E[?7l\E[?8h\E[1;24r\E[24;1H, + is2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, + rs2=\E>\E[?3l\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, use=vt320, # We have to init 132-col mode, not 80-col mode. vt320-w|vt300-w|dec vt320 wide 7 bit terminal, cols#132, wsl#132, - is2=\E>\E[?3h\E[?4l\E[5?l\E[?7h\E[?8h\E[1;24r\E[24;1H, - rs2=\E>\E[?3h\E[?4l\E[5?l\E[?7h\E[?8h\E[1;24r\E[24;1H, + is2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, use=vt320, vt320-w-nam|vt300-w-nam|dec vt320 wide 7 bit terminal with no am, am@, - is2=\E>\E[?3h\E[?4l\E[5?l\E[?7l\E[?8h\E[1;24r\E[24;1H, - rs2=\E>\E[?3h\E[?4l\E[5?l\E[?7l\E[?8h\E[1;24r\E[24;1H, + is2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, + rs2=\E>\E[?3h\E[?4l\E[?5l\E[?7l\E[?8h\E[1;24r\E[24;1H, use=vt320-w, # VT330 and VT340 -- These are ReGIS and SIXEL graphics terminals @@ -2240,21 +2342,23 @@ vt340|dec-vt340|vt330|dec-vt330|dec vt340 graphics terminal with 24 line page, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, - cuu=\E[%p1%dA, cuu1=\E[A, cvvis=\E[?25h, dch=\E[%p1%dP, - dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, - dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J, el=\E[K, - flash=\E[?5h\E[?5l$<200/>, fsl=\E[$}, home=\E[H, ht=^I, - hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, + cuu=\E[%p1%dA, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, + dl=\E[%p1%dM, dl1=\E[M, dsl=\E[2$~\r\E[1$}\E[K\E[$}, + ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l$<200/>, fsl=\E[$}, + home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, + il1=\E[L, ind=\ED, is2=\E<\E F\E>\E[?1h\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, kbs=^H, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, - rf=/usr/share/tabset/vt300, ri=\EM, rmacs=^O, + rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, - rmul=\E[24m, rs1=\E[?3l, sc=\E7, sgr0=\E[m, smacs=^N, - smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, - smul=\E[4m, tbc=\E[3g, tsl=\E[2$~\E[1$}\E[1;%dH, + rmul=\E[24m, rs1=\E[?3l, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, + sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + tsl=\E[2$~\E[1$}\E[1;%dH, # DEC doesn't supply a vt400 description, so we add Daniel Glasser's # (originally written with vt420 as its primary name, and usable for it). @@ -2286,8 +2390,8 @@ vt400|vt400-24|dec-vt400|dec vt400 24x80 column autowrap, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, - dl1=\E[M, dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J$<10/>, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J$<10/>, el=\E[K$<4/>, flash=\E[?5h\E[?5l$<200/>, fsl=\E[$}, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=\ED, @@ -2296,11 +2400,12 @@ vt400|vt400-24|dec-vt400|dec vt400 24x80 column autowrap, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, nel=^M\ED, rc=\E8, rev=\E[7m, - rf=/usr/share/tabset/vt300, ri=\EM, rmacs=^O, + rf=/usr/share/tabset/vt300, ri=\EM, rmacs=\E(B, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, - rmul=\E[24m, rs1=\E<\E[?3l\E[!p\E[?7h, sc=\E7, sgr0=\E[m, - smacs=^N, smam=\E[?7h, smir=\E[4h, smkx=\E[?1h\E=, - smso=\E[7m, smul=\E[4m, tbc=\E[3g, + rmul=\E[24m, rs1=\E<\E[?3l\E[!p\E[?7h, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;$<2>, + sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, tsl=\E[2$~\E[1$}\E[1;%dH, # (vt420: I removed , it collided with . I also restored @@ -2329,7 +2434,6 @@ vt420|DEC VT420, sgr0=\E[m$<2>, smacs=\E(0$<2>, smam=\E[?7h, smir=\E[4h, smkx=\E=, smso=\E[7m, smul=\E[4m, -# # DEC VT220 and up support DECUDK (user-defined keys). DECUDK (i.e., pfx) # takes two parameters, the key and the string. Translating the key is # straightforward (keys 1-5 are not defined on real terminals, though some @@ -2493,12 +2597,17 @@ crt|crt-vt220|CRT 2.3 emulating VT220, hts=\EH, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, use=vt220, use=ecma+color, -# PuTTY 0.51 (released 14 December 2000) +# PuTTY 0.55 (released 3 August 2004) # http://www.chiark.greenend.org.uk/~sgtatham/putty/ # +# Comparing with 0.51, vttest is much better (only a few problems with the +# cursor position reports and wrapping). +# +# PuTTY 0.51 (released 14 December 2000) +# # This emulates vt100 + vt52 (plus a few vt220 features: ech, SRM, DECTCEM, as # well as SCO and Atari, color palettes from Linux console). Reading the code, -# it is intended to be VT102 plus selected features By default, it sets $TERM +# it is intended to be VT102 plus selected features. By default, it sets $TERM # to xterm, which is incorrect, since several features are misimplemented: # # Alt+key always sends ESC+key, so 'km' capability is removed. @@ -2510,39 +2619,48 @@ crt|crt-vt220|CRT 2.3 emulating VT220, # # Several features such as backspace/delete are optional; this entry documents # the default behavior -TD -putty|xterm clone (win32), - am, bw, ccc, km, mir, msgr, xenl, - colors#8, cols#80, it#8, lines#24, pairs#64, - acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, - bel=^G, blink=\E[5m, bold=\E[1m, civis=\E[?25l, - clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + +putty|PuTTY terminal emulator, + am, bce, bw, ccc, hs, mir, msgr, xenl, xon, + colors#8, it#8, ncv#22, pairs#64, + acsc=``aaffggjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, + clear=\E[H\E[J, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, - cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, - cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, - ech=\E[%p1%dX, ed=\E[J, el=\E[K, enacs=\E)0, home=\E[H, - hpa=\E[%i%p1%dG, ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, - ind=^J, - initc=\E]P%?%p1%{9}%>%t%p1%{10}%-%'a'%+%c%e%p1%d%;%p2%{255}%&%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%p3%{255}%&%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%p4%{255}%&%Pr%gr%{16}%/%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;%gr%{15}%&%Px%?%gx%{9}%>%t%gx%{10}%-%'A'%+%c%e%gx%d%;, - is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, - kbs=\177, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, - kcuu1=\EOA, kdch1=\E[3~, kf1=\E[11~, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, - kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, - kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, - kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, - kf9=\E[20~, kfnd=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, - kpp=\E[5~, kslt=\E[4~, oc=\E]R, op=\E[39;49m, rc=\E8, - rev=\E[7m, ri=\EM, rmacs=^O, rmam=\E[?7l, - rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E[?1l\E>, + cud=\E[%p1%dB, cud1=\ED, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\EM, + dch=\E[%p1%dP, dch1=\E[P, + dispc=%?%p1%{8}%=%t\E%%G\342\227\230\E%%@%e%p1%{10}%=%t\E%%G\342\227\231\E%%@%e%p1%{12}%=%t\E%%G\342\231\0\E%%@%e%p1%{13}%=%t\E%%G\342\231\252\E%%@%e%p1%{14}%=%t\E%%G\342\231\253\E%%@%e%p1%{15}%=%t\E%%G\342\230\274\E%%@%e%p1%{27}%=%t\E%%G\342\206\220\E%%@%e%p1%{155}%=%t\E%%G\340\202\242\E%%@%e%p1%c%;, + dl=\E[%p1%dM, dl1=\E[M, dsl=\E]0;\007, ech=\E[%p1%dX, + ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, + flash=\E[?5h\E[?5l, fsl=^G, home=\E[H, hpa=\E[%i%p1%dG, + ht=^I, hts=\EH, il=\E[%p1%dL, il1=\E[L, ind=^J, + indn=\E[%p1%dS, + initc=\E]P%p1%x%p2%{255}%*%{1000}%/%02x%p3%{255}%*%{1000}%/%02x%p4%{255}%*%{1000}%/%02x, + is2=\E7\E[r\E[m\E[?7h\E[?1;4;6l\E[4l\E8\E>\E]R, + kb2=\E[G, kbs=\177, kcan=^C, kcbt=\E[Z, kcub1=\E[D, + kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, + kend=\E[4~, kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, + kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, + kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, + kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, kf4=\E[14~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + kspd=^Z, nel=^M^J, oc=\E]R, op=\E[39;49m, rc=\E8, rev=\E[7m, + ri=\EM, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, + rmcup=\E[2J\E[?47l, rmir=\E[4l, rmpch=\E[10m, rmso=\E[27m, rmul=\E[24m, - rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>, sc=\E7, + rs2=\E<\E["p\E[50;6"p\Ec\E[?3l\E]R\E[?1000l, + s0ds=\E[10m, s1ds=\E[11m, s2ds=\E[12m, sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, - sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, - sgr0=\E[m, smacs=^N, smam=\E[?7h, smcup=\E7\E[?47h, - smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, - tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, - vpa=\E[%i%p1%dd, + sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[?47h, + smir=\E[4h, smpch=\E[11m, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, tsl=\E]0;, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?6c, + u9=\E[c, vpa=\E[%i%p1%dd, +vt100-putty|Reset Putty to pure vt100, + rs2=\E<\E["p\Ec\E[?3l\E]R\E[40"p\E[61"p\E[50;1;2"p, + use=vt100, # This entry is for Tera Term Pro version 2.3, for MS-Windows 95/NT written by # T. Teranishi dated Mar 10, 1998. It is a free software terminal emulator @@ -2599,7 +2717,7 @@ teraterm|Tera Term Pro, kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, op=\E[100m, rev=\E[7m, ri=\EM, - rmso=\E[27m, rmul=\E[24m, sgr0=\E[m, smso=\E[7m, + rmso=\E[27m, rmul=\E[24m, sgr0=\E[0m\017, smso=\E[7m, smul=\E[4m, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd, use=klone+color, use=vt100, @@ -2840,86 +2958,125 @@ xterm-xf86-v40|xterm terminal emulator (XFree86 4.0 Window System), # This version was released in XFree86 4.3. xterm-xf86-v43|xterm terminal emulator (XFree86 4.3 Window System), - npc, kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, kRIT=\E[1;2C, - kb2=\EOE, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, - kcuu1=\EOA, kend=\EOF, kent=\EOM, kf1=\EOP, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf13=\EO2P, kf14=\EO2Q, - kf15=\EO2R, kf16=\EO2S, kf17=\E[15;2~, kf18=\E[17;2~, - kf19=\E[18;2~, kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~, - kf22=\E[21;2~, kf23=\E[23;2~, kf24=\E[24;2~, kf25=\EO5P, - kf26=\EO5Q, kf27=\EO5R, kf28=\EO5S, kf29=\E[15;5~, - kf3=\EOR, kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~, + kbeg@, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + use=xterm-xf86-v40, + +# This version was released in XFree86 4.4. +xterm-xf86-v44|xterm terminal emulator (XFree86 4.4 Window System), + cnorm=\E[?12l\E[?25h, cvvis=\E[?12;25h, indn=\E[%p1%dS, + rin=\E[%p1%dT, use=xterm-xf86-v43, + +# This is the most common alias for xterm-new. +xterm-xfree86|xterm terminal emulator (XFree86), + use=xterm-new, +# use=xterm-old, + +# This version is current (XFree86 xterm patch #192). +xterm-new|modern xterm terminal emulator, + npc, + indn=\E[%p1%dS, kDC=\E[3;2~, kEND=\E[1;2F, kHOM=\E[1;2H, + kIC=\E[2;2~, kLFT=\E[1;2D, kNXT=\E[6;2~, kPRV=\E[5;2~, + kRIT=\E[1;2C, kb2=\EOE, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, + kcuf1=\EOC, kcuu1=\EOA, kend=\EOF, kent=\EOM, khome=\EOH, + kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + rin=\E[%p1%dT, use=xterm+pcfkeys, use=xterm-basic, +# +# This fragment describes as much of XFree86 xterm's "pc-style" function +# keys as will fit into terminfo's 60 function keys. +# From ctlseqs.ms: +# Code Modifiers +# --------------------------------- +# 2 Shift +# 3 Alt +# 4 Shift + Alt +# 5 Control +# 6 Shift + Control +# 7 Alt + Control +# 8 Shift + Alt + Control +# --------------------------------- +# The meta key may also be used as a modifier in this scheme, adding another +# bit to the parameter. +xterm+pcfkeys|fragment for PC-style fkeys, + kf1=\EOP, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R, kf16=\EO2S, + kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, kf2=\EOQ, + kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, + kf23=\E[23;2~, kf24=\E[24;2~, kf25=\EO5P, kf26=\EO5Q, + kf27=\EO5R, kf28=\EO5S, kf29=\E[15;5~, kf3=\EOR, + kf30=\E[17;5~, kf31=\E[18;5~, kf32=\E[19;5~, kf33=\E[20;5~, kf34=\E[21;5~, kf35=\E[23;5~, kf36=\E[24;5~, kf37=\EO6P, kf38=\EO6Q, kf39=\EO6R, kf4=\EOS, kf40=\EO6S, kf41=\E[15;6~, kf42=\E[17;6~, kf43=\E[18;6~, kf44=\E[19;6~, kf45=\E[20;6~, - kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, kf5=\E[15~, - kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, khome=\EOH, - kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, - use=xterm-basic, - -# This version is current (XFree86 xterm patch #180). -xterm-xfree86|xterm-new|xterm terminal emulator (XFree86 4.4 Window System), - cnorm=\E[?12l\E[?25h, cvvis=\E[?12;25h, indn=\E[%p1%dS, - rin=\E[%p1%dT, use=xterm-xf86-v43, + kf46=\E[21;6~, kf47=\E[23;6~, kf48=\E[24;6~, kf49=\EO3P, + kf5=\E[15~, kf50=\EO3Q, kf51=\EO3R, kf52=\EO3S, + kf53=\E[15;3~, kf54=\E[17;3~, kf55=\E[18;3~, + kf56=\E[19;3~, kf57=\E[20;3~, kf58=\E[21;3~, + kf59=\E[23;3~, kf6=\E[17~, kf60=\E[24;3~, kf61=\EO4P, + kf62=\EO4Q, kf63=\EO4R, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + kDN=\E[1;2B, kDN5=\E[1;5B, kDN6=\E[1;6B, kLFT5=\E[1;5D, + kLFT6=\E[1;6D, kRIT5=\E[1;5C, kRIT6=\E[1;6C, kUP=\E[1;2A, + kUP5=\E[1;5A, kUP6=\E[1;6A, # # This chunk is used for building the VT220/Sun/PC keyboard variants. xterm-basic|xterm terminal emulator - common (XFree86), - am, bce, km, mc5i, mir, msgr, xenl, + OTbs, am, bce, km, mc5i, mir, msgr, xenl, AX, colors#8, cols#80, it#8, lines#24, pairs#64, acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, - clear=\E[H\E[2J, cnorm=\E[?25h, cr=^M, + clear=\E[H\E[2J, cnorm=\E[?12l\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, - ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, + cvvis=\E[?12;25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, + dl1=\E[M, ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, flash=\E[?5h$<100/>\E[?5l, home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=^J, invis=\E[8m, is2=\E[!p\E[?3;4l\E[4l\E>, kbs=^H, kdch1=\E[3~, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, meml=\El, - memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, - rmam=\E[?7l, rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, - rmso=\E[27m, rmul=\E[24m, rs1=\Ec, + memu=\Em, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, + rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?1049l, rmir=\E[4l, + rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=\Ec, rs2=\E[!p\E[?3;4l\E[4l\E>, sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, - sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, - sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E[?1049h, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m, + sgr0=\E(B\E[m, smacs=\E(0, smam=\E[?7h, smcup=\E[?1049h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, vpa=\E[%i%p1%dd, # From: David J. MacKenzie , 14 Nov 1997 +# In retrospect, something like xterm-r6 was intended here -TD xterm-xi|xterm on XI Graphics Accelerated X under BSD/OS 3.1, rmso=\E[m, rmul=\E[m, use=xterm-xf86-v33, # This is one of the variants of XFree86 3.3 xterm, updated for 4.0 (T.Dickey) xterm-16color|xterm with 16 colors like aixterm, - ncv#32, use=ibm+16color, use=xterm-xfree86, + ncv#32, use=ibm+16color, use=xterm-new, # These variants of XFree86 3.9.16 xterm are built as a configure option. xterm-256color|xterm with 256 colors, ccc, - colors#256, ncv#32, pairs#256, + colors#256, pairs#32767, initc=\E]4;%p1%d;rgb\:%p2%{255}%*%{1000}%/%2.2X/%p3%{255}%*%{1000}%/%2.2X/%p4%{255}%*%{1000}%/%2.2X\E\\, setab=\E[48;5;%p1%dm, setaf=\E[38;5;%p1%dm, setb=\E[48;5;%p1%dm, setf=\E[38;5;%p1%dm, - use=xterm-xfree86, + use=xterm-new, xterm-88color|xterm with 88 colors, - colors#88, pairs#88, use=xterm-256color, + colors#88, pairs#7744, use=xterm-256color, # These two are used to demonstrate the any-event mouse support, i.e., by # using an extended name "XM" which tells ncurses to put the terminal into # a special mode when initializing the xterm mouse. xterm-1002|testing xterm-mouse, - XM=\E[?1002%?%p1%{1}%=%th%el%;, use=xterm-xfree86, + XM=\E[?1002%?%p1%{1}%=%th%el%;, use=xterm-new, xterm-1003|testing xterm-mouse, - XM=\E[?1003%?%p1%{1}%=%th%el%;, use=xterm-xfree86, + XM=\E[?1003%?%p1%{1}%=%th%el%;, use=xterm-new, # This is another variant, for XFree86 4.0 xterm (T.Dickey) # This is an 8-bit version of xterm, which emulates DEC vt220 with ANSI color. @@ -2931,21 +3088,21 @@ xterm-1003|testing xterm-mouse, # CSI \E [ \233 # xterm-8bit|xterm terminal emulator 8-bit controls (X Window System), - OTbs, am, bce, km, mc5i, mir, msgr, npc, xenl, + OTbs, am, bce, km, mc5i, mir, msgr, npc, xenl, AX, colors#8, cols#80, it#8, lines#24, pairs#64, acsc=``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, bel=^G, blink=\2335m, bold=\2331m, cbt=\233Z, - civis=\233?25l, clear=\233H\2332J, cnorm=\233?25h, cr=^M, - csr=\233%i%p1%d;%p2%dr, cub=\233%p1%dD, cub1=^H, - cud=\233%p1%dB, cud1=^J, cuf=\233%p1%dC, cuf1=\233C, - cup=\233%i%p1%d;%p2%dH, cuu=\233%p1%dA, cuu1=\233A, + civis=\233?25l, clear=\233H\2332J, + cnorm=\233?25l\233?25h, cr=^M, csr=\233%i%p1%d;%p2%dr, + cub=\233%p1%dD, cub1=^H, cud=\233%p1%dB, cud1=^J, + cuf=\233%p1%dC, cuf1=\233C, cup=\233%i%p1%d;%p2%dH, + cuu=\233%p1%dA, cuu1=\233A, cvvis=\233?12;25h, dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, dl1=\233M, ech=\233%p1%dX, ed=\233J, el=\233K, el1=\2331K, - enacs=\E(B\E)0, flash=\233?5h$<100/>\233?5l, - home=\233H, hpa=\233%i%p1%dG, ht=^I, hts=\210, - ich=\233%p1%d@, il=\233%p1%dL, il1=\233L, ind=^J, - invis=\2338m, - is2=\E7\E G\233r\233m\233?7h\233?1;3;4;6l\2334l\E8\E>, + flash=\233?5h$<100/>\233?5l, home=\233H, + hpa=\233%i%p1%dG, ht=^I, hts=\210, ich=\233%p1%d@, + il=\233%p1%dL, il1=\233L, ind=^J, invis=\2338m, + is2=\E[62"p\E G\233m\233?7h\E>\E7\233?1;3;4;6l\2334l\233r\E8, ka1=\217w, ka3=\217u, kb2=\217y, kbeg=\217E, kbs=^H, kc1=\217q, kc3=\217s, kcbt=\233Z, kcub1=\217D, kcud1=\217B, kcuf1=\217C, kcuu1=\217A, kdch1=\2333~, kend=\2334~, @@ -2957,18 +3114,18 @@ xterm-8bit|xterm terminal emulator 8-bit controls (X Window System), kf9=\23320~, khome=\2331~, kich1=\2332~, kmous=\233M, knp=\2336~, kpp=\2335~, mc0=\233i, mc4=\2334i, mc5=\2335i, meml=\El, memu=\Em, op=\23339;49m, rc=\E8, rev=\2337m, - ri=\215, rmacs=^O, rmam=\233?7l, rmcup=\233?1049l, + ri=\215, rmacs=\E(B, rmam=\233?7l, rmcup=\233?1049l, rmir=\2334l, rmkx=\233?1l\E>, rmso=\23327m, rmul=\23324m, rs1=\Ec, - rs2=\E[62"p\E G\E7\233r\E8\233m\233?7h\233?1;3;4;6l\2334l\E>, + rs2=\E[62"p\E G\233m\233?7h\E>\E7\233?1;3;4;6l\2334l\233r\E8, sc=\E7, setab=\2334%p1%dm, setaf=\2333%p1%dm, setb=\2334%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, setf=\2333%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, - sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, - sgr0=\233m^O, smacs=^N, smam=\233?7h, smcup=\233?1049h, - smir=\2334h, smkx=\233?1h\E=, smso=\2337m, smul=\2334m, - tbc=\2333g, u6=\233[%i%d;%dR, u7=\E[6n, u8=\233[?1;2c, - u9=\E[c, vpa=\233%i%p1%dd, + sgr=\2330%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p7%t;8%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\2330m\E(B, smacs=\E(0, smam=\233?7h, + smcup=\233?1049h, smir=\2334h, smkx=\233?1h\E=, + smso=\2337m, smul=\2334m, tbc=\2333g, u6=\233[%i%d;%dR, + u7=\E[6n, u8=\233[?1;2c, u9=\E[c, vpa=\233%i%p1%dd, xterm-hp|XFree86 xterm with hpterm function keys, kclr=\EJ, kcub1=\ED, kcud1=\EB, kcuf1=\EC, kcuu1=\EA, @@ -2987,7 +3144,7 @@ xterm-sco|XFree86 xterm with SCO function keys, kf6=\E[R, kf7=\E[S, kf8=\E[T, kf9=\E[U, khome=\E[H, kich1=\E[L, knp=\E[G, kpp=\E[I, use=xterm-basic, -# The xterm-xfree86 description has all of the features, but is not completely +# The xterm-new description has all of the features, but is not completely # compatible with vt220. If you are using a Sun or PC keyboard, set the # sunKeyboard resource to true: # + maps the editing keypad @@ -2997,14 +3154,13 @@ xterm-sco|XFree86 xterm with SCO function keys, # + uses DEC-style control sequences for the application keypad. # xterm-vt220|XFree86 xterm emulating vt220, - kbeg=\EOu, kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, - kcuu1=\EOA, kend=\E[4~, kf10=\E[21~, kf11=\E[23~, - kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, - kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, - kf20=\E[34~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, - kf8=\E[19~, kf9=\E[20~, khome=\E[1~, kich1=\E[2~, - kmous=\E[M, knp=\E[6~, kpp=\E[5~, use=xterm-basic, - use=vt220+keypad, + kcbt=\E[Z, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kend=\E[4~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf20=\E[34~, + kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, + khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, + use=xterm-basic, use=vt220+keypad, xterm-vt52|XFree86 xterm emulating dec vt52, cols#80, it#8, lines#24, @@ -3023,8 +3179,7 @@ xterm-24|vs100|xterms|xterm terminal emulator (X Window System), # This is xterm for ncurses. xterm|xterm terminal emulator (X Window System), - use=xterm-r6, -# use=xterm-xfree86, + use=xterm-new, # These entries allow access to the X titlebar and icon name as a status line. # Note that twm (and possibly window managers descended from it such as tvtwm, @@ -3054,8 +3209,10 @@ kterm|kterm kanji terminal emulator (X window system), eslok, hs, acsc=++\,\,--..00ii``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, csr=\E[%i%p1%d;%p2%dr, dsl=\E[?H, enacs=, fsl=\E[?F, - kmous=\E[M, rc=\E8, rmacs=\E(B, sc=\E7, smacs=\E(0, - tsl=\E[?E\E[?%i%dT, use=xterm-r6, use=ecma+color, + kmous=\E[M, rc=\E8, rmacs=\E(B, rmam=\E[?7l, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, + tsl=\E[?E\E[?%i%p1%dT, use=xterm-r6, use=ecma+color, kterm-color|kterm-co|kterm with ANSI colors, ncv@, use=kterm, use=ecma+color, # See the note on ICH/ICH1 VERSUS RMIR/SMIR near the end of file @@ -3093,7 +3250,7 @@ color_xterm|cx|cx100|color_xterm color terminal emulator for X, rs1=\E(B\017\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E<, sc=\E7, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, - sgr0=\E[m, smacs=^N, smam=\E[?7h, + sgr0=\E[0m\017, smacs=^N, smam=\E[?7h, smcup=\E[?1;41s\E[?1;41h\E=, smir=\E[4h, smso=\E[7m, smul=\E[4m, use=ecma+color, use=vt220+keypad, @@ -3140,7 +3297,7 @@ gnome-rh72|GNOME Terminal, civis=\E[?25l, cnorm=\E[?25h, kdch1=\E[3~, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, rmam=\E[?7l, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\016%e\017%;, - smam=\E[?7h, tbc@, use=xterm-color, + sgr0=\E[0m\017, smam=\E[?7h, tbc@, use=xterm-color, # GNOME Terminal 2.0.1 (Redhat 8.0) # @@ -3150,7 +3307,7 @@ gnome-rh72|GNOME Terminal, # more of its bugs using vttest. # # However, note that bce and msgr are broken in this release. Tabs (tbc and -# hts) are broken as well. Sometimes flash (as in xterm-xfree86) works. +# hts) are broken as well. Sometimes flash (as in xterm-new) works. # # kf1 and kf10 are not tested since they're assigned (hardcoded?) to menu # operations. Shift-tab generates a distinct sequence so it can be argued @@ -3164,9 +3321,13 @@ gnome-rh80|GNOME Terminal, # # bce and msgr are repaired. gnome-rh90|GNOME Terminal, - bce, msgr, use=gnome-rh80, + bce, msgr, + hpa=\E[%i%p1%dG, kDC=\E[3;2~, kLFT=\EO2D, kRIT=\EO2C, + kb2=\E[E, kcbt=\E[Z, kend=\EOF, khome=\EOH, tbc=\E[3g, + vpa=\E[%i%p1%dd, use=xterm+pcfkeys, use=gnome-rh80, gnome|GNOME Terminal, + rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, use=gnome-rh90, # This is kvt 0-18.7, shipped with Redhat 6.0 (though whether it supports bce @@ -3197,17 +3358,24 @@ kvt|KDE terminal, # vt220, which is doubly incorrect because it does not implement vt220 # control sequences except for a few special cases). Treat it as a # mildly-broken vt102. +# +# Update for konsole 1.3.2: +# The 1049 private mode works (but see the other xterm screens in vttest). +# Primary Device Attributes now returns the code for a vt100 with advanced +# video option. Perhaps that's intended to be a "mildly-broken vt102". konsole-base|KDE console window, bce, km@, npc, bel@, blink=\E[5m, civis=\E[?25l, cnorm=\E[?25h, ech=\E[%p1%dX, flash=\E[?5h$<100/>\E[?5l, - hpa=\E[%i%p1%dG, kbs@, kdch1@, kend@, kf1@, kf10@, kf11@, kf12@, - kf13@, kf14@, kf15@, kf16@, kf17@, kf18@, kf19@, kf2@, kf20@, kf3@, - kf4@, kf5@, kf6@, kf7@, kf8@, kf9@, kfnd@, khome@, kslt@, - rmam=\E[?7l, rmso=\E[27m, rmul=\E[24m, + hpa=\E[%i%p1%dG, indn=\E[%p1%dS, kbs=\177, kdch1@, + kend=\E[4~, kf1@, kf10@, kf11@, kf12@, kf13@, kf14@, kf15@, kf16@, + kf17@, kf18@, kf19@, kf2@, kf20@, kf3@, kf4@, kf5@, kf6@, kf7@, kf8@, + kf9@, kfnd@, khome=\E[1~, kslt@, rin=\E[%p1%dT, rmam=\E[?7l, + rmso=\E[27m, rmul=\E[24m, + rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, - smam=\E[?7h, vpa=\E[%i%p1%dd, use=ecma+color, - use=xterm-r6, + sgr0=\E[0m\017, smam=\E[?7h, vpa=\E[%i%p1%dd, + use=ecma+color, use=xterm-r6, konsole-linux|KDE console window with linux keyboard, kdch1=\E[3~, kf1=\E[[A, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13@, kf14@, kf15@, kf16@, kf17@, kf18@, kf19@, @@ -3221,7 +3389,10 @@ konsole-xf3x|KDE console window with keyboard for XFree86 3.x xterm, # The value for kbs reflects local customization rather than the settings used # for XFree86 xterm. konsole-xf4x|KDE console window with keyboard for XFree86 4.x xterm, - kbs=^H, kend=\EOF, kf1=\EOP, kf2=\EOQ, kf3=\EOR, kf4=\EOS, + kend=\EOF, kf1=\EOP, kf13=\EO2P, kf14=\EO2Q, kf15=\EO2R, + kf16=\EO2S, kf17=\E[15;2~, kf18=\E[17;2~, kf19=\E[18;2~, + kf2=\EOQ, kf20=\E[19;2~, kf21=\E[20;2~, kf22=\E[21;2~, + kf23=\E[23;2~, kf24=\E[24;2~, kf3=\EOR, kf4=\EOS, khome=\EOH, use=konsole-vt100, # KDE's "vt100" keyboard has no relationship to any terminal that DEC made, but # it is still useful for deriving the other entries. @@ -3237,7 +3408,47 @@ konsole-16color|klone of xterm-16color, ncv#32, use=ibm+16color, use=konsole, # make a default entry for konsole konsole|KDE console window, - use=konsole-linux, + use=konsole-xf4x, + +# Based on mlterm 2.8.0's mlterm.ti, with corrections/additions from reading +# the source code and running tack -TD +# +# This is nominally a vt102 emulator, with features borrowed from rxvt and +# xterm. +# +# There are some problems with vttest: +# save/restore cursor doesn't restore character +# test of character sets leaves it in line-drawing mode. +mlterm|multi lingual terminal emulator, + am, eslok, km, mc5i, mir, msgr, npc, xenl, + colors#8, cols#80, it#8, lines#24, pairs#64, + acsc=00``aaffgghhjjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~, + bel=^G, bold=\E[1m, cbt=\E[Z, clear=\E[H\E[2J, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, + cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + ech=\E[%p1%dX, ed=\E[J, el=\E[K, el1=\E[1K, enacs=, + home=\E[H, hpa=\E[%i%p1%dG, ht=^I, hts=\EH, ich=\E[%p1%d@, + ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, indn=\E[%p1%dS, + is2=\E7\E[r\E[m\E[?7h\E[?1;3;4;6l\E[4l\E8\E>, + kbs=\177, kcub1=\EOD, kcud1=\EOB, kcuf1=\EOC, kcuu1=\EOA, + kdch1=\E[3~, kend=\EOF, kent=\EOM, kf1=\E[11~, kf10=\E[21~, + kf11=\E[23~, kf12=\E[24~, kf2=\E[12~, kf3=\E[13~, + kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, + kf9=\E[20~, kfnd=\E[1~, khome=\EOH, kich1=\E[2~, + kmous=\E[M, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, mc0=\E[i, + nel=\EE, op=\E[39;49m, rc=\E8, rev=\E[7m, ri=\EM, + rin=\E[%p1%dT, rmacs=\E(B, rmam=\E[?7l, + rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E[?1l\E>, + rmso=\E[m, rmul=\E[m, + rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l, + sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, + sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smcup=\E7\E[?47h, + smir=\E[4h, smkx=\E[?1h\E=, smso=\E[7m, smul=\E[4m, + tbc=\E[3g, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?1;2c, u9=\E[c, + vpa=\E[%i%p1%dd, # From: Thomas Dickey 04 Oct 1997 # Updated: Oezguer Kesim 02 Nov 1997 @@ -3257,6 +3468,8 @@ konsole|KDE console window, # rxvt is normally configured to look for "xterm" or "xterm-color" as $TERM. # Since rxvt is not really compatible with xterm, it should be configured as # "rxvt" (monochrome) and "rxvt-color". +# +# removed dch/dch1 because they are inconsistent with bce/ech -TD rxvt-basic|rxvt terminal base (X Window System), OTbs, am, bce, eo, km, mir, msgr, xenl, xon, cols#80, it#8, lines#24, @@ -3266,33 +3479,111 @@ rxvt-basic|rxvt terminal base (X Window System), csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, - el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\E[?5h\E[?5l, - home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, ich1=\E[@, - il=\E[%p1%dL, il1=\E[L, ind=^J, is1=\E[?47l\E=\E[?1l, - is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, - kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kLFT=\E[d, kNXT=\E[6$, - kPRV=\E[5$, kRIT=\E[c, kbs=^H, kcbt=\E[Z, kcub1=\E[D, - kcud1=\E[B, kcuf1=\E[C, kcuu1=\E[A, kdch1=\E[3~, - kel=\E[8\^, kend=\E[8~, kf1=\E[11~, kf10=\E[21~, - kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, kf14=\E[26~, - kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, kf18=\E[32~, - kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, kf3=\E[13~, - kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, - kf9=\E[20~, kfnd=\E[1~, khome=\E[7~, kich1=\E[2~, - kmous=\E[M, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, rc=\E8, - rev=\E[7m, ri=\EM, rmacs=^O, rmcup=\E[2J\E[?47l\E8, - rmir=\E[4l, rmkx=\E>, rmso=\E[27m, rmul=\E[24m, + dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, el1=\E[1K, + enacs=\E(B\E)0, flash=\E[?5h\E[?5l, home=\E[H, ht=^I, + hts=\EH, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, + ind=^J, is1=\E[?47l\E=\E[?1l, + is2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l, kbs=^H, + kcbt=\E[Z, kmous=\E[M, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, + rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=\E>, rmso=\E[27m, + rmul=\E[24m, rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, - rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>, - s0ds=\E(B, s1ds=\E(0, sc=\E7, sgr0=\E[0m\017, smacs=^N, - smcup=\E7\E[?47h, smir=\E[4h, smkx=\E=, smso=\E[7m, - smul=\E[4m, tbc=\E[3g, use=vt220+keypad, + rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, + s0ds=\E(B, s1ds=\E(0, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr0=\E[0m\017, smacs=^N, smcup=\E7\E[?47h, smir=\E[4h, + smkx=\E=, smso=\E[7m, smul=\E[4m, tbc=\E[3g, + use=vt220+keypad, use=rxvt+pcfkeys, +# Key Codes from rxvt reference: +# +# Note: Shift + F1-F10 generates F11-F20 +# +# For the keypad, use Shift to temporarily override Application-Keypad +# setting use Num_Lock to toggle Application-Keypad setting if Num_Lock +# is off, escape sequences toggle Application-Keypad setting. +# Also note that values of Home, End, Delete may have been compiled +# differently on your system. +# +# Normal Shift Control Ctrl+Shift +# Tab ^I ESC [ Z ^I ESC [ Z +# BackSpace ^H ^? ^? ^? +# Find ESC [ 1 ~ ESC [ 1 $ ESC [ 1 ^ ESC [ 1 @ +# Insert ESC [ 2 ~ paste ESC [ 2 ^ ESC [ 2 @ +# Execute ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @ +# Select ESC [ 4 ~ ESC [ 4 $ ESC [ 4 ^ ESC [ 4 @ +# Prior ESC [ 5 ~ scroll-up ESC [ 5 ^ ESC [ 5 @ +# Next ESC [ 6 ~ scroll-down ESC [ 6 ^ ESC [ 6 @ +# Home ESC [ 7 ~ ESC [ 7 $ ESC [ 7 ^ ESC [ 7 @ +# End ESC [ 8 ~ ESC [ 8 $ ESC [ 8 ^ ESC [ 8 @ +# Delete ESC [ 3 ~ ESC [ 3 $ ESC [ 3 ^ ESC [ 3 @ +# F1 ESC [ 11 ~ ESC [ 23 ~ ESC [ 11 ^ ESC [ 23 ^ +# F2 ESC [ 12 ~ ESC [ 24 ~ ESC [ 12 ^ ESC [ 24 ^ +# F3 ESC [ 13 ~ ESC [ 25 ~ ESC [ 13 ^ ESC [ 25 ^ +# F4 ESC [ 14 ~ ESC [ 26 ~ ESC [ 14 ^ ESC [ 26 ^ +# F5 ESC [ 15 ~ ESC [ 28 ~ ESC [ 15 ^ ESC [ 28 ^ +# F6 ESC [ 17 ~ ESC [ 29 ~ ESC [ 17 ^ ESC [ 29 ^ +# F7 ESC [ 18 ~ ESC [ 31 ~ ESC [ 18 ^ ESC [ 31 ^ +# F8 ESC [ 19 ~ ESC [ 32 ~ ESC [ 19 ^ ESC [ 32 ^ +# F9 ESC [ 20 ~ ESC [ 33 ~ ESC [ 20 ^ ESC [ 33 ^ +# F10 ESC [ 21 ~ ESC [ 34 ~ ESC [ 21 ^ ESC [ 34 ^ +# F11 ESC [ 23 ~ ESC [ 23 $ ESC [ 23 ^ ESC [ 23 @ +# F12 ESC [ 24 ~ ESC [ 24 $ ESC [ 24 ^ ESC [ 24 @ +# F13 ESC [ 25 ~ ESC [ 25 $ ESC [ 25 ^ ESC [ 25 @ +# F14 ESC [ 26 ~ ESC [ 26 $ ESC [ 26 ^ ESC [ 26 @ +# F15 (Help) ESC [ 28 ~ ESC [ 28 $ ESC [ 28 ^ ESC [ 28 @ +# F16 (Menu) ESC [ 29 ~ ESC [ 29 $ ESC [ 29 ^ ESC [ 29 @ +# F17 ESC [ 31 ~ ESC [ 31 $ ESC [ 31 ^ ESC [ 31 @ +# F18 ESC [ 32 ~ ESC [ 32 $ ESC [ 32 ^ ESC [ 32 @ +# F19 ESC [ 33 ~ ESC [ 33 $ ESC [ 33 ^ ESC [ 33 @ +# F20 ESC [ 34 ~ ESC [ 34 $ ESC [ 34 ^ ESC [ 34 @ +# Application +# Up ESC [ A ESC [ a ESC O a ESC O A +# Down ESC [ B ESC [ b ESC O b ESC O B +# Right ESC [ C ESC [ c ESC O c ESC O C +# Left ESC [ D ESC [ d ESC O d ESC O D +# KP_Enter ^M ESC O M +# KP_F1 ESC O P ESC O P +# KP_F2 ESC O Q ESC O Q +# KP_F3 ESC O R ESC O R +# KP_F4 ESC O S ESC O S +# XK_KP_Multiply * ESC O j +# XK_KP_Add + ESC O k +# XK_KP_Separator , ESC O l +# XK_KP_Subtract - ESC O m +# XK_KP_Decimal . ESC O n +# XK_KP_Divide / ESC O o +# XK_KP_0 0 ESC O p +# XK_KP_1 1 ESC O q +# XK_KP_2 2 ESC O r +# XK_KP_3 3 ESC O s +# XK_KP_4 4 ESC O t +# XK_KP_5 5 ESC O u +# XK_KP_6 6 ESC O v +# XK_KP_7 7 ESC O w +# XK_KP_8 8 ESC O x +# XK_KP_9 9 ESC O y +rxvt+pcfkeys|fragment for PC-style fkeys, + kDC=\E[3$, kEND=\E[8$, kHOM=\E[7$, kLFT=\E[d, kNXT=\E[6$, + kPRV=\E[5$, kRIT=\E[c, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\E[3~, kel=\E[8\^, kend=\E[8~, + kf1=\E[11~, kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, + kf13=\E[25~, kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, + kf17=\E[31~, kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, + kf20=\E[34~, kf21=\E[23$, kf22=\E[24$, kf23=\E[11\^, + kf24=\E[12\^, kf25=\E[13\^, kf26=\E[14\^, kf27=\E[15\^, + kf28=\E[17\^, kf29=\E[18\^, kf3=\E[13~, kf30=\E[19\^, + kf31=\E[20\^, kf32=\E[21\^, kf33=\E[23\^, kf34=\E[24\^, + kf35=\E[25\^, kf36=\E[26\^, kf37=\E[28\^, kf38=\E[29\^, + kf39=\E[31\^, kf4=\E[14~, kf40=\E[32\^, kf41=\E[33\^, + kf42=\E[34\^, kf43=\E[23@, kf44=\E[24@, kf5=\E[15~, + kf6=\E[17~, kf7=\E[18~, kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, + khome=\E[7~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, kslt=\E[4~, + kDN=\E[b, kDN5=\EOb, kDN6=\EOB, kLFT5=\EOd, kLFT6=\EOD, + kRIT5=\EOc, kRIT6=\EOC, kUP=\E[a, kUP5=\EOa, kUP6=\EOA, rxvt|rxvt terminal emulator (X Window System), ncv@, - cvvis=\E[?25h, hpa=\E[%i%p1%dG, kf0=\E[21~, - sgr0=\E[m\017, vpa=\E[%i%p1%dd, use=rxvt-basic, - use=ecma+color, + hpa=\E[%i%p1%dG, kf0=\E[21~, sgr0=\E[m\017, + vpa=\E[%i%p1%dd, use=rxvt-basic, use=ecma+color, rxvt-color|rxvt terminal emulator (X Window System), use=rxvt, rxvt-xpm|rxvt terminal emulator (X Window System), @@ -3342,7 +3633,7 @@ Eterm|Eterm-color|Eterm with xterm-style color support (X Window System), rmacs=^O, rmam=\E[?7l, rmcup=\E[2J\E[?47l\E8, rmir=\E[4l, rmkx=, rmso=\E[27m, rmul=\E[24m, rs1=\E>\E[1;3;4;5;6l\E[?7h\E[m\E[r\E[2J\E[H, - rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>, + rs2=\E[r\E[m\E[2J\E[H\E[?7h\E[?1;3;4;6l\E[4l\E>\E[?1000l\E[?25h, sc=\E7, sgr=\E[0%?%p1%p6%|%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E7\E[?47h, @@ -3439,30 +3730,66 @@ xterms-sun|small (80x24) xterm with sunFunctionKeys true, cols#80, lines#24, use=xterm-sun, # This is for the extensible terminal emulator on the X11R6 contrib tape. +# It corresponds to emu's internal emulation: +# emu -term emu +# emu's default sets TERM to "xterm", but that doesn't work well -TD +# fixes: remove bogus rmacs/smacs, change oc to op, add bce, am -TD +# fixes: add civis, cnorm, sgr -TD emu|emu native mode, - mir, msgr, xon, + am, bce, mir, msgr, xon, colors#15, cols#80, it#8, lines#24, pairs#64, vt#200, acsc=61a\202f\260g2j\213k\214l\215m\216n\217o\220q\222s\224t\225u\226v\227w\230x\231~\244, - bel=^G, blink=\ES\EW, bold=\ES\EU, civis=\EZ, - clear=\EP\EE0;0;, cnorm=\Ea, cr=^M, csr=\Ek%p1%d;%p2%d;, - cub=\Eq-%p1%d;, cub1=^H, cud=\Ep%p1%d;, cud1=\EB, - cuf=\Eq%p1%d;, cuf1=\ED, cup=\EE%p1%d;%p2%d;, - cuu=\Ep-%p1%d;, cuu1=\EA, dch=\EI%p1%d;, dch1=\EI1;, - dl=\ER%p1%d;, dl1=\ER1;, ech=\Ej%p1%d;, ed=\EN, el=\EK, - el1=\EL, enacs=\0, home=\EE0;0;, ht=^I, hts=\Eh, - il=\EQ%p1%d;, il1=\EQ1;, ind=\EG, is2=\ES\Er0;\Es0;, - kbs=^H, kcub1=\EC, kcud1=\EB, kcuf1=\ED, kcuu1=\EA, - kdch1=\177, kent=^M, kf0=\EF00, kf1=\EF01, kf10=\EF10, - kf11=\EF11, kf12=\EF12, kf13=\EF13, kf14=\EF14, kf15=\EF15, - kf16=\EF16, kf17=\EF17, kf18=\EF18, kf19=\EF19, kf2=\EF02, - kf20=\EF20, kf3=\EF03, kf4=\EF04, kf5=\EF05, kf6=\EF06, - kf7=\EF07, kf8=\EF08, kf9=\EF09, kfnd=\Efind, kich1=\Eins, - knp=\Enext, kpp=\Eprior, kslt=\Esel, oc=\Es0;\Er0;, - rev=\ES\ET, ri=\EF, rmacs=\0, rmir=\EX, rmso=\ES, rmul=\ES, + bel=^G, blink=\EW, bold=\EU, civis=\EZ, clear=\EP\EE0;0;, + cnorm=\Ea, cr=^M, csr=\Ek%p1%d;%p2%d;, cub=\Eq-%p1%d;, + cub1=^H, cud=\Ep%p1%d;, cud1=\EB, cuf=\Eq%p1%d;, cuf1=\ED, + cup=\EE%p1%d;%p2%d;, cuu=\Ep-%p1%d;, cuu1=\EA, + dch=\EI%p1%d;, dch1=\EI1;, dl=\ER%p1%d;, dl1=\ER1;, + ech=\Ej%p1%d;, ed=\EN, el=\EK, el1=\EL, home=\EE0;0;, ht=^I, + hts=\Eh, il=\EQ%p1%d;, il1=\EQ1;, ind=\EG, + is2=\ES\Er0;\Es0;, kbs=^H, kcub1=\EC, kcud1=\EB, kcuf1=\ED, + kcuu1=\EA, kdch1=\177, kent=^M, kf0=\EF00, kf1=\EF01, + kf10=\EF10, kf11=\EF11, kf12=\EF12, kf13=\EF13, kf14=\EF14, + kf15=\EF15, kf16=\EF16, kf17=\EF17, kf18=\EF18, kf19=\EF19, + kf2=\EF02, kf20=\EF20, kf3=\EF03, kf4=\EF04, kf5=\EF05, + kf6=\EF06, kf7=\EF07, kf8=\EF08, kf9=\EF09, kfnd=\Efind, + kich1=\Eins, knp=\Enext, kpp=\Eprior, kslt=\Esel, + op=\Es0;\Er0;, rev=\ET, ri=\EF, rmir=\EX, rmso=\ES, rmul=\ES, rs2=\ES\Es0;\Er0;, setab=\Es%i%p1%d;, - setaf=\Er%i%p1%d;, sgr0=\ES, smacs=\0, smir=\EY, - smso=\ES\ET, smul=\ES\EV, tbc=\Ej, - + setaf=\Er%i%p1%d;, + sgr=\ES%?%p1%t\ET%;%?%p2%t\EV%;%?%p3%t\ET%;%?%p4%t\EW%;%?%p6%t\EU%;, + sgr0=\ES, smir=\EY, smso=\ET, smul=\EV, tbc=\Ej, + +# vt220 Terminfo entry for the Emu emulation, corresponds to +# emu -term vt220 +# with NumLock set (to make the keypad transmit kf0-kf9). +# fixes: add am, xenl, corrected sgr0 -TD +emu-220|Emu-220 (vt200-7bit mode), + am, xenl, xon, + cols#80, it#8, lines#24, vt#200, + acsc=aaffggjjkkllmmnnooqqssttuuvvwwxx~~, bel=^G, + blink=\E[0;5m, bold=\E[0;1m, civis=\E[?25l, + clear=\E[2J\E[H, cnorm=\E[?25h, cr=^M, + csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[1D, + cud=\E[%p1%dB, cud1=\E[1B, cuf=\E[%p1%dC, cuf1=\E[1C, + cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[1A, + dch=\E[%p1%dP, dch1=\E[1P, dl=\E[%p1%dM, dl1=\E[1M, + ed=\E[0J, el=\E[0K, el1=\E[1K, enacs=\E)0, home=\E[H, ht=^I, + hts=\EH, if=/usr/share/tabset/vt300, il=\E[%p1%dL, + il1=\E[1L, ind=\ED, is2=\E>\E[?1l\E[?3l\E[4l\E[?7h, + kbs=^H, kcmd=\E[29~, kcub1=\E[D, kcud1=\E[B, kcuf1=\E[C, + kcuu1=\E[A, kdch1=\E[3~, kent=\EOM, kf0=\EOp, kf1=\EOq, + kf10=\EOl, kf11=\EOm, kf12=\EOn, kf13=\EOP, kf14=\EOQ, + kf15=\EOR, kf16=\EOS, kf2=\EOr, kf26=\E[17~, kf27=\E[18~, + kf28=\E[19~, kf29=\E[20~, kf3=\EOs, kf30=\E[21~, + kf34=\E[26~, kf37=\E[31~, kf38=\E[32~, kf39=\E[33~, + kf4=\EOt, kf40=\E[34~, kf5=\EOu, kf6=\EOv, kf7=\EOw, + kf8=\EOx, kf9=\EOy, kfnd=\E[1~, khlp=\E[28~, kich1=\E[2~, + knp=\E[6~, kpp=\E[5~, kslt=\E[4~, rc=\E8, rev=\E[0;7m, + ri=\EM, rmacs=^O, rmcup=\E>, rmkx=\E>, rmso=\E[m, rmul=\E[m, + rs2=\E[4l\E[34l\E[?1l\E[?3l\E[?5l\E[?7h, sc=\E7, + sgr=\E[0%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p6%t;1%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m, smacs=^N, smcup=\E[?1l\E=, smkx=\E=, + smso=\E[0;7m, smul=\E[0;4m, tbc=\E[3g, # A commercial product, Reportedly a version of Xterm with an OPEN LOOK UI, # print interface, ANSI X3.64 colour escape sequences, etc. Newsgroup postings # indicate that it emulates more than one terminal, but incompletely. @@ -3515,8 +3842,10 @@ mterm-ansi|ANSI emulation, il=\E[%p1%dL, il1=\E[L, ind=\E[S, indn=\E[%p1%dS, invis=\E[8m, is2=\E)0\017, kbs=^H, nel=\EE, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmacs=^O, rmir=\E[4l, rmso=\E[27m, - rmul=\E[24m, sgr0=\E[m, smacs=^N, smir=\E[4h, smso=\E[7m, - smul=\E[4m, vpa=\E[%i%p1%dd, + rmul=\E[24m, + sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;%?%p5%t;2%;%?%p7%t;8%;m%?%p9%t\016%e\017%;, + sgr0=\E[m, smacs=^N, smir=\E[4h, smso=\E[7m, smul=\E[4m, + vpa=\E[%i%p1%dd, # mterm normally sets $TERM to "mterm" mterm|mouse-sun|Der Mouse term, am, bw, mir, @@ -3526,6 +3855,8 @@ mterm|mouse-sun|Der Mouse term, home=^P, ht=^I, il1=^A, ind=^U, kbs=^H, ll=^R, nel=^M^U, ri=^W, rmir=^O, rmso=^T, smir=^Q, smso=^V, # "mterm -type decansi" sets $TERM to "decansi" +# +# note: kdch1, kfnd, kslt are in the source code, but do not work -TD decansi|ANSI emulation with DEC compatibility hacks, am, mir, msgr, xenl, colors#8, it#8, pairs#64, @@ -3540,7 +3871,13 @@ decansi|ANSI emulation with DEC compatibility hacks, home=\E[H, hpa=\E[%i%p1%d`, ht=^I, ich1=, il=\E[%p1%dL, il1=\E[L, ind=\E[S, indn=\E[%p1%dS, invis=\E[8m, is2=\E)0\E[r\017, kbs=^H, kcub1=\EOD, kcud1=\EOB, - kcuf1=\EOC, kcuu1=\EOA, nel=\EE, op=\E[0m, rc=\E8, rev=\E[7m, + kcuf1=\EOC, kcuu1=\EOA, kdch1=\E[3~, kf1=\E[11~, + kf10=\E[21~, kf11=\E[23~, kf12=\E[24~, kf13=\E[25~, + kf14=\E[26~, kf15=\E[28~, kf16=\E[29~, kf17=\E[31~, + kf18=\E[32~, kf19=\E[33~, kf2=\E[12~, kf20=\E[34~, + kf3=\E[13~, kf4=\E[14~, kf5=\E[15~, kf6=\E[17~, kf7=\E[18~, + kf8=\E[19~, kf9=\E[20~, kfnd=\E[1~, kich1=\E[2~, knp=\E[6~, + kpp=\E[5~, kslt=\E[4~, nel=\EE, op=\E[0m, rc=\E8, rev=\E[7m, ri=\E[T, rin=\E[%p1%dT, rmacs=^O, rmam=\E[?7l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, sc=\E7, setab=\E[4%p1%dm, setaf=\E[3%p1%dm, @@ -3656,10 +3993,11 @@ screen|VT 100/ANSI X3.64 virtual terminal, khome=\E[1~, kich1=\E[2~, kmous=\E[M, knp=\E[6~, kpp=\E[5~, nel=\EE, rc=\E8, rev=\E[7m, ri=\EM, rmacs=^O, rmcup=\E[?1049l, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[23m, - rmul=\E[24m, rs2=\Ec, sc=\E7, sgr0=\E[m, smacs=^N, - smcup=\E[?1049h, smir=\E[4h, smkx=\E[?1h\E=, smso=\E[3m, - smul=\E[4m, tbc=\E[3g, E0=\E(B, S0=\E(%p1%c, - use=ecma+color, + rmul=\E[24m, rs2=\Ec\E[?1000l\E[?25h, sc=\E7, + sgr=\E[0%?%p6%t;1%;%?%p1%t;3%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, + sgr0=\E[m, smacs=^N, smcup=\E[?1049h, smir=\E[4h, + smkx=\E[?1h\E=, smso=\E[3m, smul=\E[4m, tbc=\E[3g, E0=\E(B, + S0=\E(%p1%c, use=ecma+color, # The bce and status-line entries are from screen 3.9.13 (and require some # changes to .screenrc). screen-bce|VT 100/ANSI X3.64 virtual terminal with bce, @@ -3691,12 +4029,12 @@ screen-s|VT 100/ANSI X3.64 virtual terminal with hardstatus line, # xterm (-xfree86 or -r6) does not normally support kIC, kNXT and kPRV # since the default translations override the built-in keycode # translation. They are suppressed here to show what is tested by tack. -screen.xterm-xfree86|screen customized for XFree86 xterm, +screen.xterm-xfree86|screen.xterm-new|screen customized for modern xterm, bce@, bw, invis@, kIC@, kNXT@, kPRV@, kend=\E[4~, khome=\E[1~, meml@, memu@, - sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m%?%p9%t\016%e\017%;, - use=xterm-xfree86, + sgr=%?%p9%t\E(0%e\E(B%;\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;%?%p4%t;5%;m, + use=xterm-new, # xterm-r6 does not really support khome/kend unless it is propped up by # the translations resource. screen.xterm-r6|screen customized for X11R6 xterm, @@ -3800,11 +4138,11 @@ ncsa-m|ncsa-vt220-8|NCSA Telnet 2.6 for Macintosh in vt220-8 mode, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khlp=\E[1~, khome=\E[2~, knp=\E[6~, kpp=\E[3~, mc4=\E[4i, mc5=\E[5i, rc=\E8, rev=\E[7m, rf=/usr/share/tabset/vt100, ri=\EM, - rmacs=^O, rmam=\E[?7l, rmcup=\E[2J\E8, rmir=\E[4l, + rmacs=\E(B, rmam=\E[?7l, rmcup=\E[2J\E8, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, rs2=\E7\E[r\E8\E[m\E[?7h\E[?1;4;6l\E[4l\E>, sc=\E7, sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p4%t;5%;%?%p1%p3%|%t;7%;m%?%p9%t\E(0%e\E(B%;, - sgr0=\E[m\017, smacs=^N, smam=\E[?7h, smcup=\E7, + sgr0=\E[m\E(B, smacs=\E(0, smam=\E[?7h, smcup=\E7, smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, tsl=\E]0;, u6=\E[%i%d;%dR, u7=\E[6n, u8=\E[?62;1;6c, u9=\E[c, ncsa|NCSA Telnet 2.7 for Macintosh in vt220-8 mode, @@ -3915,7 +4253,7 @@ oldsun|Sun Microsystems Workstation console, sun-il|Sun Microsystems console with working insert-line, am, km, msgr, cols#80, lines#34, - bel=^G, bold@, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, + bel=^G, clear=^L, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu1=\E[A, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, ed=\E[J, el=\E[K, ht=^I, ich=\E[%p1%d@, ich1=\E[@, il=\E[%p1%dL, il1=\E[L, ind=^J, @@ -3926,8 +4264,8 @@ sun-il|Sun Microsystems console with working insert-line, kf7=\E[230z, kf8=\E[231z, kf9=\E[232z, khome=\E[214z, knp=\E[222z, kopt=\E[194z, kpp=\E[216z, kres=\E[193z, kund=\E[195z, rev=\E[7m, rmso=\E[m, rmul@, rs2=\E[s, - sgr=\E[0%?%p6%t;1%;%?%p2%t;4%;%?%p1%p3%|%t;7%;m, - sgr0=\E[m, smso=\E[7m, smul@, u8=\E[1t, u9=\E[11t, + sgr=\E[0%?%p1%p3%|%t;7%;m, sgr0=\E[m, smso=\E[7m, + u8=\E[1t, u9=\E[11t, # On some versions of CGSIX framebuffer firmware (SparcStation 5), / # flake out on the last line. Unfortunately, without them the terminal has no # way to scroll. @@ -3967,6 +4305,19 @@ sun-type4|Sun Workstation console with type 4 keyboard, kcub1=\E[217z, kcud1=\E[221z, kcuf1=\E[219z, kcuu1=\E[215z, use=sun-il, +# Most of the current references to sun-color are from users wondering why this +# is the default on install. Details from reading the wscons manpage, adding +# cub, etc., here (rather than in the base sun-il entry) since it is not clear +# when those were added -TD +sun-color|Sun Microsystems Workstation console with color support (IA systems), + colors#8, pairs#64, + cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, + cuu=\E[%p1%dA, home=\E[H, op=\E[m\E[p, setab=\E[4%p1%dm, + setaf=\E[3%p1%dm, + setb=\E[4%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, + setf=\E[3%?%p1%{1}%=%t4%e%p1%{3}%=%t6%e%p1%{4}%=%t1%e%p1%{6}%=%t3%e%p1%d%;m, + use=sun, + #### Iris consoles # @@ -7446,7 +7797,7 @@ wy100|wyse 100, wy120|wyse120|wy150|wyse150|Wyse 120/150, am, bw, hs, km, mc5i, mir, msgr, xon, cols#80, it#8, lh#1, lines#24, lw#8, nlab#8, pb#9601, wsl#45, - acsc=+/\,.0[Iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~, + acsc=+/\,.0[iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~, bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<50>, cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<7>, @@ -7525,7 +7876,7 @@ wy120-w-vb|wy120-wvb|wyse120-wvb|wy150-w-vb|wyse150-w-vb|Wyse 120/150 132-column wy60|wyse60|Wyse 60, am, bw, hs, km, mc5i, mir, msgr, cols#80, lh#1, lines#24, lw#8, nlab#8, wsl#45, - acsc=+/\,.0[Iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~, + acsc=+/\,.0[iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~, bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<100>, cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, @@ -7694,7 +8045,7 @@ wy99a-ansi|Wyse WY-99GT in ansi mode (US PC keyboard), wy99f|wy99fgt|wy-99fgt|Wyse WY-99GT (int'l PC keyboard), am, bw, hs, km, mc5i, mir, msgr, xon, cols#80, it#8, lines#25, wsl#46, - acsc='x+y.wI~_vj(k'l&m%n)o9q*s8t-u.v\,w+x=, bel=^G, + acsc='x+y.wi~_vj(k'l&m%n)o9q*s8t-u.v\,w+x=, bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E'\E(\032, cnorm=\E`4\E`1, cr=^M, cub1=^H, cud1=\Ej, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, @@ -7746,7 +8097,7 @@ wy99fa|wy99fgta|wy-99fgta|Wyse WY-99GT (US PC keyboard), wy160|wyse160|Wyse 160, am, bw, hs, km, mc5i, mir, msgr, cols#80, lh#1, lines#24, lw#8, nlab#8, wsl#38, - acsc=+/\,.0[Iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~, + acsc=+/\,.0[iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~, bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<30>, cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<5>, @@ -8054,7 +8405,7 @@ wy185-wvb|wyse185-wvb|wyse 185+flash+132 cols, wy325|wyse325|Wyse epc, am, bw, hs, mc5i, mir, cols#80, lh#1, lines#24, lw#8, nlab#8, pb#9601, wsl#45, - acsc=+/\,.0[Iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~, + acsc=+/\,.0[iha2fxgqh1jYk?lZm@nEqDtCu4vAwBx3yszr{c~~, bel=^G, blink=\EG2, cbt=\EI, civis=\E`0, clear=\E+$<50>, cnorm=\E`1, cr=^M, cub1=^H, cud1=^J, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dch1=\EW$<7>, @@ -8609,8 +8960,8 @@ vt320-k311|dec vt320 series as defined by kermit 3.11, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=^H, cud=\E[%p1%dB, cud1=^J, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, - dl1=\E[M, dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J, el=\E[K, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + dsl=\E[2$~\r\E[1$}\E[K\E[$}, ed=\E[J, el=\E[K, flash=\E[?5h\E[?5l, fsl=\E[$}, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L$<3/>, ind=\ED, is2=\E>\E[?3l\E[?4l\E[?5l\E[?7h\E[?8h\E[1;24r\E[24;1H, @@ -8683,15 +9034,20 @@ vt320-k311|dec vt320 series as defined by kermit 3.11, # (The ///// capabilities exist only to # tell ncurses that the corresponding highlights exist; it should use , # which is the only method that will actually work for multiple highlights.) +# +# Update by TD - 2004: half of this was inconsistent. Found documentation +# and repaired most of the damage. sgr0 is probably incorrect, but the +# available documentation gives no clues for a workable string. avatar0|avatar terminal emulator level 0, am, bce, msgr, cols#80, it#8, lines#25, - blink=^A^V\177, bold=^V^A^P, cr=^M, cub1=^V^E, cud1=^V^D, + blink=^V^B, bold=^V^A^P, cr=^M, cub1=^V^E, cud1=^V^D, cuf1=^V^F, cup=\026\010%p1%c%p2%c, cuu1=^V^C, el=^V^G, - ind=^J, invis=^V^A\0, rep=\031%p1%c%p2%d, rev=^A^Vp, - rs2=^L, - sgr=\026\001%{0}%?%p1%t%{112}%|%;%?%p2%t%{1}%|%;%?%p3%t%{112}%|%;%?%p4%t{128}%|%;%?%p6%t%{16}%|%;, - sgr0=^V^A^G, smacs=, smso=^A^Vp, smul=^V^A, use=klone+acs, + ind=^J, invis=^V^A\0, rep=\031%p1%c%p2%c, rev=^V^Ap, + rmacs@, rs2=^L, + sgr=%?%p1%p2%|%p3%|%p6%|%p7%|%t\026\001%?%p7%t%{128}%e%{0}%?%p1%t%{112}%|%;%?%p2%t%{1}%|%;%?%p3%t%{112}%|%;%?%p6%t%{16}%|%;%;%c%;%?%p4%t\026\002%;, + sgr0=^V^A^G, smacs@, smso=^V^Ap, smul=^V^A^A, + use=klone+acs, # From: Eric S. Raymond 1 Nov 1995 avatar0+|avatar terminal emulator level 0+, dch1=^V^N, rmir=\026\n\0\0\0\0, smir=^V^I, use=avatar0, @@ -8712,10 +9068,9 @@ rbcomm|IBM PC with RBcomm and EMACS keybindings, bel=^G, blink=\E[5m, bold=\E[1m, cbt=\E[Z, civis=\E[?25l, clear=^L, cnorm=\E[?25h, cr=^M, csr=\E[%i%p1%d;%p2%dr, cub1=^H, cud1=^C, cuf1=^B, - cup=\037%p2%{32}%+%c%p1%{32}%+%c, cuu1=^^, - cvvis=\E[?25h, dch1=^W, dl=\E[%p1%dM, dl1=^Z, - ech=\E[%p1%dX, ed=^F5, el=^P^P, ht=^I, il=\E[%p1%dL, il1=^K, - ind=\ED, invis=\E[8m, + cup=\037%p2%{32}%+%c%p1%{32}%+%c, cuu1=^^, dch1=^W, + dl=\E[%p1%dM, dl1=^Z, ech=\E[%p1%dX, ed=^F5, el=^P^P, ht=^I, + il=\E[%p1%dL, il1=^K, ind=\ED, invis=\E[8m, is2=\017\035\E(B\E)0\E[?7h\E[?3l\E[>8g, kbs=^H, kcub1=^B, kcud1=^N, kcuf1=^F, kcuu1=^P, khome=^A, nel=^M\ED, rc=\E8, rep=\030%p1%c%p2%c, rev=^R, ri=\EM, rmcup=, rmdc=, @@ -10510,15 +10865,66 @@ screwpoint|adds viewpoint with ^O bug, # underline=01100000, rev=01010000, blink=01000010,dim=01000001, # invis=01000100 and %c is the logical or of desired attributes. # There is also a `tag bit' enabling attributes, set by \E) and unset by \E(. +# +# Update by TD - 2004: +# Adapted from +# http://www.cs.utk.edu/~shuford/terminal/adds_viewpoint_news.txt +# +# COMMANDS ASCII CODE +# +# Address, Absolute ESC,=,row,column +# Beep BEL +# Aux Port Enable ESC,@ +# Aux Port Disable ESC,A +# Backspace BS +# Cursor back BS +# Cursor down LF +# Cursor forward FF +# Cursor home RS +# Cursor up VT +# Cursor supress ETB +# Cursor enable CAN +# Erase to end of line ESC,T +# Erase to end of page ESC,Y +# Erase screen SUB +# Keyboard lock SI +# Keyboard unlock SO +# Read current cursor position ESC,? +# Set Attribute ESC,0,x (see below for values of x) +# Tag bit reset ESC,( +# Tag bit set ESC,) +# Transparent Print on ESC,3 +# Transparent Print off ESC,4 +# +# +# ATTRIBUTES +# +# Normal @ 0100 +# Half Intensity A 0101 +# Blinking B 0102 +# Half Intensity Blinking C 0103 +# Reverse Video P 0120 +# Reverse Video Half Intensity Q 0121 +# Reverse Video Blinking R 0122 +# Reverse Video Half Intensity +# Blinking S 0123 +# Underlined ` 0140 +# Underlined Half Intensity a 0141 +# Underlined Blinking b 0142 +# Underlined Half Intensity +# Blinking c 0143 +# Video suppress D 0104 vp3a+|viewpoint3a+|adds viewpoint 3a+, am, bw, cols#80, it#8, lines#24, - civis=^W, clear=\E*$<80>, cnorm=^X, cr=^M, cub1=^H, cud1=^J, - cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, - ed=\EY$<80>, el=\ET, home=^^, ht=^I, ind=^J, kbs=^H, kcub1=^H, - kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, nel=^M^J, rmso=\E(, - sgr=\E0%{64}%?%p1%tQ%|%;%?%p2%t%{96}%|%;%?%p3%tP%|%;%?%p4%t%{2}%|%;%?%p5%t%{1}%|%;%?%p7%tD%|%;%c\E), - sgr0=\E(, smso=\E0Q\E), + blink=\E0B\E), civis=^W, clear=\E*$<80>, cnorm=^X, cr=^M, + cub1=^H, cud1=^J, cuf1=^L, + cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, dim=\E0A\E), + ed=\EY$<80>, el=\ET, home=^^, ht=^I, ind=^J, invis=\E0D\E), + kbs=^H, kcub1=^H, kcud1=^J, kcuf1=^L, kcuu1=^K, khome=^^, + nel=^M^J, rev=\E0P\E), rmso=\E(, + sgr=%?%p1%p2%|%p3%|%p4%|%p5%|%p7%|%t\E0%{64}%?%p1%t%{17}%|%;%?%p2%t%{32}%|%;%?%p3%t%{16}%|%;%?%p4%t%{2}%|%;%?%p5%t%{1}%|%;%c%?%p7%tD%;\E)%e\E(%;, + sgr0=\E(, smso=\E0Q\E), smul=\E0`\E), vp60|viewpoint60|addsvp60|adds viewpoint60, use=regent40, # @@ -12360,11 +12766,11 @@ f110|freedom110|Liberty Freedom 110, bw@, eslok, it#8, wsl#80, blink=\EG2, bold=\EG0, civis=\E.1, cnorm=\E.2, cud1=^V, - cvvis=\E.2, dim=\EG@, dl1=\ER, dsl=\Ef\r, - flash=\Eb$<200/>\Ed, il1=\EE, ip@, is2@, kclr=^^, kdch1=\EW, - kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, kf10@, kich1=\EQ, - kil1=\EE, mc4=\Ea, mc5=\E`, ri=\EJ, rmacs=\E%%, rmir=\Er\EO, - smacs=\E$, smir=\EO\Eq, smso=\EG<, tsl=\Ef, use=f100, + dim=\EG@, dl1=\ER, dsl=\Ef\r, flash=\Eb$<200/>\Ed, il1=\EE, + ip@, is2@, kclr=^^, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, + kf0=^AI\r, kf10@, kich1=\EQ, kil1=\EE, mc4=\Ea, mc5=\E`, + ri=\EJ, rmacs=\E%%, rmir=\Er\EO, smacs=\E$, smir=\EO\Eq, + smso=\EG<, tsl=\Ef, use=f100, f110-14|Liberty Freedom 110 14inch, dch1@, use=f110, f110-w|Liberty Freedom 110 - 132 cols, @@ -12380,8 +12786,8 @@ f200|freedom200|Liberty Freedom 200, clear=^Z, cnorm=\E.1, cr=^M, csr=\Em0%p1%{32}%+%c%p2%{32}%+%c, cub1=^H, cud1=^V, cuf1=^L, cup=\E=%p1%{32}%+%c%p2%{32}%+%c, cuu1=^K, - cvvis=\E.1, dch1=\EW, dim=\EG@, dl1=\ER, dsl=\Ef\r, ed=\EY, - el=\ET, flash=\Eo$<200/>\En, fsl=^M, home=^^, + dch1=\EW, dim=\EG@, dl1=\ER, dsl=\Ef\r, ed=\EY, el=\ET, + flash=\Eo$<200/>\En, fsl=^M, home=^^, hpa=\E]%p1%{32}%+%c, hts=\E1, il1=\EE, ind=^J, kbs=^H, kclr=^^, kcub1=^H, kcud1=^V, kcuf1=^L, kcuu1=^K, kdch1=\EW, kdl1=\ER, ked=\EY, kel=\ET, kf0=^AI\r, kf1=^A@\r, kf2=^AA\r, @@ -13075,6 +13481,10 @@ jaixterm|IBM Kanji Aixterm Terminal Eemulator, jaixterm-m|IBM Kanji AIXterm Monochrome Terminal Emulator, acsc@, use=aixterm-m, +# This flavor is adapted from xterm, in turn from aixterm documentation -TD +aixterm-16color|IBM Aixterm Terminal Emulator with 16 colors, + use=ibm+16color, use=aixterm, + #### Infoton/General Terminal Corp. # @@ -13090,7 +13500,7 @@ i400|infoton 400, OTbs, am, cols#80, lines#25, bel=^G, clear=\E[2J, cr=^M, cub1=^H, cud1=^J, cuf1=\E[C, - cup=%i\E[%p1%3d;%p2%3dH, cuu1=\E[A, + cup=\E[%i%p1%3d;%p2%3dH, cuu1=\E[A, dch1=\E[4h\E[2Q\E[P\E[4l\E[0Q, dl1=\E[M, el=\E[N, il1=\E[L, ind=^J, rmir=\E[4l\E[0Q, smir=\E[4h\E[2Q, # (addrinfo: removed obsolete ":bc=^Z:" -- esr) @@ -13098,8 +13508,7 @@ addrinfo, am, cols#80, lines#24, bel=^G, clear=^L, cr=^M, cub1=^Z, cud1=^J, cuf1=^Y, - cup=\037%p1%{1}%-%c%p2%{1}%-%c, cuu1=^\, ed=^K, home=^H, - ind=^J, ll=^H^\, + cup=\037%p1%c%p2%c, cuu1=^\, ed=^K, home=^H, ind=^J, ll=^H^\, # (infoton: used to have the no-ops , , -- esr) infoton, am, @@ -13718,9 +14127,9 @@ prism9|p9|P9|MDC Prism-9 in ANSII mode, ri=\E[L, rmir=\E[4l, rmso=\E[27m, rmul=\E[24m, rs2=\E[&p\E[<12l\E F\E[3g\E[9;17;25;33;41;49;57;65;73 N, sc=\E[%y, - sgr=\E[%{0}%?%p1%p3%|%t%{4}%+%;%?%p2%t%{2}%+%;%?%p4%t%{1}%+%;%?%p6%t%{8}%+%;%?%p8%t%{32}%+%;%d%%{%?%p9%t\016%e\017%;, - sgr0=\E[0m, smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[2g, - tsl=\E[%i%p1%d%%}, vpa=\E[%i%p1%dd, + sgr=\E[%{0}%?%p1%p3%|%t%{7}%+%;%?%p2%t%{2}%+%;%?%p4%t%{5}%+%;%?%p6%t%{1}%+%;m%?%p8%t\E[%{32}%+%d%%{%;%?%p9%t\016%e\017%;, + sgr0=\E[0m\017, smir=\E[4h, smso=\E[7m, smul=\E[4m, + tbc=\E[2g, tsl=\E[%i%p1%d%%}, vpa=\E[%i%p1%dd, # p9-w: Prism-9 in 132 column mode # -------------------------------- @@ -14032,9 +14441,9 @@ ncr260vppp|NCR 2900_260 viewpoint, cbt=\EI, civis=\E`0, clear=\014$<40>, cnorm=\E`5, cr=\r$<2>, cub1=\010$<2>, cud1=\n$<2>, cuf1=\006$<2>, cup=\EY%p1%{32}%+%c%p2%{32}%+%c$<5>, cuu1=\032$<2>, - cvvis=\E`5, dch1=\EW$<2>, dim=\EGp, dl1=\El$<2>, dsl=\E`c, - ed=\Ek$<2>, el=\EK$<2>, fsl=^M, home=\036$<2>, ht=^I, - hts=\E1, il1=\EM$<2>, ind=\n$<2>, invis=\EG1, + dch1=\EW$<2>, dim=\EGp, dl1=\El$<2>, dsl=\E`c, ed=\Ek$<2>, + el=\EK$<2>, fsl=^M, home=\036$<2>, ht=^I, hts=\E1, + il1=\EM$<2>, ind=\n$<2>, invis=\EG1, is2=\Ee6\E~%$<100>\E+\E`\:\Ed/\E`1\EO\Ee4\Ec@0@\Ec@1A\EcB0\EcC1\Ee7$<100>, kDC=\El, kEND=\Ek, kHOM=^A, kPRT=\E7, kRIT=^F, ka1=^A, ka3=\EJ, kbs=^H, kc1=\ET, kc3=\EJ, kcub1=^U, kcud1=^J, kcuf1=^F, @@ -16217,9 +16626,16 @@ amiga-h|Hans Verkuil's Amiga ANSI, smso=\2337m, smul=\2334m, # From: Henning 'Faroul' Peters , 25 Sep 1999 +# +# Pavel Fedin added +# Home Shift+Left +# End Shift+Right +# PgUp Shift+Up +# PgDn Shift+Down amiga-8bit|Amiga ANSI using 8-bit controls, acsc=, dl=\233%p1%dM, dl1=\233M, il=\233%p1%dL, il1=\233L, - ind=\204, indn@, ri=\215, rin@, use=amiga-h, + ind=\204, indn@, kend=\233 @, khome=\233 A, knp=\233S, + kpp=\233T, ri=\215, rin@, use=amiga-h, # From: Ruediger Kuhlmann , 18 Jul 2000 # requires use of appropriate preferences settings. @@ -16249,6 +16665,14 @@ amiga-vnc|Amiga using VNC console (black on light gray), sgr0=\E[0m\017\E[30;85;>15m, smcup=\E[?7h, smkx=\E[?1h, smso=\E[1m, smul=\E[4m, +# MorphOS on Genesi Pegasos +# By Pavel Fedin +morphos, + acsc=, dl=\233%p1%dM, dl1=\233M, il=\233%p1%dL, il1=\233L, + ind=\204, indn@, kend=\23345~, kf11=\23320~, kf12=\23321~, + khome=\23344~, kich1=\23340~, knp=\23342~, kpp=\23341~, + ri=\215, rin@, use=amiga-h, + # Commodore B-128 microcomputer from Doug Tyrol # I'm trying to write a termcap for a commodore b-128, and I'm # having a little trouble. I've had to map most of my control characters @@ -16866,9 +17290,9 @@ bq300|Bull vt320 ISO Latin 1 80 columns terminal, csr=\E[%i%p1%d;%p2%dr, cub=\E[%p1%dD, cub1=\E[D, cud=\E[%p1%dB, cud1=\E[B, cuf=\E[%p1%dC, cuf1=\E[C, cup=\E[%i%p1%d;%p2%dH, cuu=\E[%p1%dA, cuu1=\E[A, - cvvis=\E[?25h, dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, - dl1=\E[M, dsl=\E[1$}\E[2$~\n\E[0$}, ech=\E[%p1%dX, - ed=\E[J, el=\E[K, el1=\E[1K, enacs=\E(B\E)0, + dch=\E[%p1%dP, dch1=\E[P, dl=\E[%p1%dM, dl1=\E[M, + dsl=\E[1$}\E[2$~\n\E[0$}, ech=\E[%p1%dX, ed=\E[J, + el=\E[K, el1=\E[1K, enacs=\E(B\E)0, flash=\E[?5h$<50>\E[?5l, fsl=\E[0$}, home=\E[H, ht=^I, hts=\EH, ich=\E[%p1%d@, il=\E[%p1%dL, il1=\E[L, ind=\ED, is1=\E[63;1"p\E[2h, @@ -16883,11 +17307,11 @@ bq300|Bull vt320 ISO Latin 1 80 columns terminal, khlp=\E[28~, kich1=\E[2~, knp=\E[6~, kpp=\E[5~, krdo=\E[29~, kslt=\E[4~, lf1=pf1, lf2=pf2, lf3=pf3, lf4=pf4, mc0=\E[i, mc4=\E[4i, mc5=\E[5i, nel=\EE, rc=\E8, rev=\E[7m, - ri=\EM, rmacs=^O, rmam=\E[?7l, rmcup=\E[?7h, rmir=\E[4l, + ri=\EM, rmacs=\E(B, rmam=\E[?7l, rmcup=\E[?7h, rmir=\E[4l, rmkx=\E[?1l\E>, rmso=\E[27m, rmul=\E[24m, rs1=\E[!p, rs2=\E[?3l, s0ds=\E(B, s1ds=\E(0, sc=\E7, sgr=\E[%?%p1%t;7%;%?%p2%t;4%;%?%p3%t;7%;%?%p4%t;5%;%?%p6%t;1%;m%?%p9%t\E(0%e\E(B%;, - sgr0=\E[0m\E(B, smacs=^N, smam=\E[?7h, + sgr0=\E[0m\E(B, smacs=\E(0, smam=\E[?7h, smcup=\E[?7l\E[?1l\E(B, smir=\E[4h, smso=\E[7m, smul=\E[4m, tbc=\E[3g, tsl=\E[1$}\E[2$~, bq300-rv|Bull vt320 reverse 80 columns, @@ -16966,12 +17390,12 @@ bq300-8|Bull vt320 full 8 bits 80 columns, clear=\233H\233J, cnorm=\233?25h, cr=^M, csr=\233%i%p1%d;%p2%dr, cub=\233%p1%dD, cud=\233%p1%dB, cuf=\233%p1%dC, cup=\233%i%p1%d;%p2%dH, cuu=\233%p1%dA, - cvvis=\233?25h, dch=\233%p1%dP, dch1=\233P, - dl=\233%p1%dM, dsl=\2331$}\2332$~\n\2330$}, - ech=\233%p1%dX, ed=\233J, el=\233K, el1=\2331K, - enacs=\E(B\E)0, flash=\233?5h$<50>\233?5l, fsl=\2330$}, - home=\233H, ht=^I, hts=\EH, ich=\233%p1%d@, il=\233%p1%dL, - ind=\ED, is1=\E[63;2"p\E[2h, + dch=\233%p1%dP, dch1=\233P, dl=\233%p1%dM, + dsl=\2331$}\2332$~\n\2330$}, ech=\233%p1%dX, ed=\233J, + el=\233K, el1=\2331K, enacs=\E(B\E)0, + flash=\233?5h$<50>\233?5l, fsl=\2330$}, home=\233H, + ht=^I, hts=\EH, ich=\233%p1%d@, il=\233%p1%dL, ind=\ED, + is1=\E[63;2"p\E[2h, is2=\E[?2h\E[?3l\E[?5l\E[?7h\E[?8h\E>\E[?1l\E G\E[?42l\E[?4l, is3=\2330$}\233?25h\2332l\233H\233J, ka1=\217w, ka3=\217y, kb2=\217u, kbs=^H, kc1=\217q, kc3=\217s, @@ -18214,16 +18638,16 @@ ti916|ti916-220-7|Texas Instruments 916 VDT 8859/1 vt220 mode 7 bit CTRL, cbt=\E[Z, civis=\E[?25l, clear=\E[H\E[2J$<6>, cnorm=\E[?25h, cub=\E[%p1%dD, cud=\E[%p1%dB, cuf=\E[%p1%dC, cup=\E[%p1%i%p1%d;%p2%dH, cuu=\E[%p1%dA, - cvvis=\E[?25h, dch=\E[%p1%dP$<250>, dch1=\E[P, - dl=\E[%p1%dM, ech=\E[%p1%dX$<20>, ed=\E[J$<6>, el=\E[0K, - el1=\E[1K, enacs=\E(B\E)0, ff=^L, flash=\E[?5h\E[?5l$<6>, + dch=\E[%p1%dP$<250>, dch1=\E[P, dl=\E[%p1%dM, + ech=\E[%p1%dX$<20>, ed=\E[J$<6>, el=\E[0K, el1=\E[1K, + enacs=\E(B\E)0, ff=^L, flash=\E[?5h\E[?5l$<6>, hpa=\E[%p1%{1}%+%dG, hts=\E[0W, ich=\E[%p1%d@$<250>, il=\E[%p1%dL$<36>, ip=$<10>, is2=\E[1;24r\E[24;1H, kcmd=\E[29~, kdch1=\E[P, kent=^J, kf1=\E[17~, kf10=\E[28~, kf11=\E[29~, kf12=\E[31~, kf2=\E[18~, kf3=\E[19~, kf4=\E[20~, kf5=\E[21~, kf6=\E[23~, kf7=\E[24~, kf8=\E[25~, kf9=\E[26~, khome=\E[H, kich1=\E[@, knp=\E[S, kpp=\E[T, - kprt=^X, prot=\E&, rmacs=\017$<2>, rs2=\E[!p, + kprt=^X, prot=\E&, rmacs=\017$<2>, rs2=\E[!p, sgr@, smacs=\016$<2>, tbc=\E[3g, vpa=\E[%p1%{1}%+%dd, use=vt220, # @@ -20477,6 +20901,114 @@ v3220|LANPAR Vision II model 3220/3221/3222, # * add vt100+ and vt-utf8 entries -TD # * add uwin entry -TD # +# 2004-03-27 +# * add sgr strings to several common entries lacking them, e.g., +# screen, to make the entries more portable -TD +# * remove cvvis from rxvt entry, since it is the same as cnorm -TD +# * similar fixups for cvvis/cnorm various entries -TD +# +# 2004-05-22 +# * remove 'ncv' from xterm-256color (patch 188) -TD +# +# 2004-06-26 +# * add mlterm -TD +# * add xterm-xf86-v44 -TD +# * modify xterm-new aka xterm-xfree86 to accommodate luit, which relies +# on G1 being used via an ISO-2022 escape sequence (report by +# Juliusz Chroboczek) -TD +# * add 'hurd' entry -TD +# +# 2004-07-03 +# * make xterm-xf86-v43 derived from xterm-xf86-v40 rather than +# xterm-basic -TD +# * align with xterm #192's use of xterm-new -TD +# * update xterm-new and xterm-8bit for cvvis/cnorm strings -TD +# * make xterm-new the default "xterm" -TD +# +# 2004-07-10 +# * minor fixes for emu -TD +# * add emu-220 +# * add rmam/smam to linux (Trevor Van Bremen) +# * change wyse acsc strings to use 'i' map rather than 'I' -TD +# * fixes for avatar0 -TD +# * fixes for vp3a+ -TD +# +# 2004-07-17 +# * add xterm-pc-fkeys -TD +# * review/update gnome and gnome-rh90 entries (prompted by +# Redhat Bugzilla #122815) -TD +# * review/update konsole entries -TD +# * add sgr, correct sgr0 for kterm and mlterm -TD +# * correct tsl string in kterm -TD +# +# 2004-07-24 +# * make ncsa-m rmacs/smacs consistent with sgr -TD +# * add sgr, rc/sc and ech to syscons entries -TD +# * add function-keys to decansi -TD +# * add sgr to mterm-ansi -TD +# * add sgr, civis, cnorm to emu -TD +# * correct/simplify cup in addrinfo -TD +# * corrections for gnome and konsole entries +# (Redhat Bugzilla #122815) -Hans de Goede +# * modify DEC entries (vt220, etc), to add sgr string, and to use +# ISO-2022 strings for rmacs/smacs -TD +# +# 2004-07-31 +# * rename xterm-pc-fkeys to xterm+pcfkeys -TD +# +# 2004-08-07 +# * improved putty entry -Robert de Bath +# +# 2004-08-14 +# * remove dch/dch1 from rxvt because they are implemented inconsistently +# with the common usage of bce/ech -TD +# * remove khome from vt220 (vt220's have no home key) -TD +# * add rxvt+pcfkeys -TD +# +# 2004-08-21 +# * modify several entries to ensure xterm mouse and cursor visibility +# are reset in rs2 string: hurd, putty, gnome, konsole-base, mlterm, +# Eterm, screen. (The xterm entries are left alone - old ones for +# compatibility, and the new ones do not require this change) -TD +# +# 2004-08-28 +# * add morphos entry -Pavel Fedin +# * modify amiga-8bit to add khome/kend/knp/kpp -Pavel Fedin +# * corrected \E[5?l to \E[?5l in vt320 entries -TD +# +# 2004-11-20 +# * update wsvt25 entry -TD +# +# 2005-01-29 +# * update pairs for xterm-88color and xterm-256color to reflect the +# ncurses extended-color support -TD +# +# 2005-02-26 +# * modify sgr/sgr0 in xterm-new to improve tgetent's derived "me" -TD +# * add aixterm-16color to demonstrate 16-color capability -TD +# +# 2005-04-23 +# * add media-copy to vt100 -TD +# * corrected acsc string for vt52 -TD +# +# 2005-04-30 +# * add kUP, kDN (user-defined shifted up/down arrow) definitions for +# xterm-new -TD +# * add kUP5, kUP6, etc., for xterm-new and rxvt -TD +# +# 2005-05-07 +# * re-corrected acsc string for vt52 -TD +# +# 2005-05-28 +# * corrected sun-il sgr string which referred to bold and underline -TD +# * add sun-color entry -TD +# +# 2005-07-23 +# * modify sgr0 in several entries to reset alternate-charset as in the +# sgr string -TD +# * modify sgr string of prism9 to better match the individual +# attributes -TD +# # The following sets edit modes for GNU EMACS. # Local Variables: # fill-prefix:"\t" diff --git a/mk-0th.awk b/mk-0th.awk index 399f156b..fe91cca6 100644 --- a/mk-0th.awk +++ b/mk-0th.awk @@ -1,6 +1,6 @@ -# $Id: mk-0th.awk,v 1.14 2002/08/31 21:36:54 tom Exp $ +# $Id: mk-0th.awk,v 1.17 2005/01/22 16:31:40 tom Exp $ ############################################################################## -# Copyright (c) 1998-2001 Free Software Foundation, Inc. # +# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -33,22 +33,30 @@ # # Variables: # libname (library name, e.g., "ncurses", "panel", "forms", "menus") +# subsets (is used here to decide if wide-character code is used) # BEGIN { - print "" - print "# generated by mk-0th.awk" - print "" - print ".SUFFIXES: .c .cc .h .i .ii" - print ".c.i :" - printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" - print ".cc.ii :" - printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" - print ".h.i :" - printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" - print "" + using = 0; found = 0; } !/^[@#]/ { + if (using == 0) + { + print "" + print "# generated by mk-0th.awk" + printf "# libname: %s\n", libname + printf "# subsets: %s\n", subsets + print "" + print ".SUFFIXES: .c .cc .h .i .ii" + print ".c.i :" + printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" + print ".cc.ii :" + printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" + print ".h.i :" + printf "\t$(CPP) $(CPPFLAGS) $< >$@\n" + print "" + using = 1; + } if ( $0 != "" && $1 != "link_test" ) { if ( found == 0 ) @@ -84,7 +92,7 @@ END { printf "\trm -f llib-l%s\n", libname print "" printf "llib-l%s : $(C_SRC)\n", libname - printf "\tcproto -a -l -DLINT $(CPPFLAGS) $(C_SRC) >$@\n" + printf "\tcproto -a -l -DNCURSES_ENABLE_STDBOOL_H=0 -DLINT $(CPPFLAGS) $(C_SRC) >$@\n" print "" print "lintlib :" printf "\tsh $(srcdir)/../misc/makellib %s $(CPPFLAGS)", libname diff --git a/mk-1st.awk b/mk-1st.awk index 8ce72f5c..cf7817d2 100644 --- a/mk-1st.awk +++ b/mk-1st.awk @@ -1,6 +1,6 @@ -# $Id: mk-1st.awk,v 1.62 2004/01/10 20:48:43 tom Exp $ +# $Id: mk-1st.awk,v 1.65 2005/06/18 19:15:57 tom Exp $ ############################################################################## -# Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. # +# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -32,18 +32,20 @@ # Generate list of objects for a given model library # Variables: # name (library name, e.g., "ncurses", "panel", "forms", "menus") +# traces ("all" or "DEBUG", to control whether tracing is compiled in) +# MODEL (e.g., "DEBUG", uppercase; toupper is not portable) # model (directory into which we compile, e.g., "obj") # prefix (e.g., "lib", for Unix-style libraries) # suffix (e.g., "_g.a", for debug libraries) -# MODEL (e.g., "DEBUG", uppercase; toupper is not portable) -# depend (optional dependencies for all objects, e.g, ncurses_cfg.h) # subset ("none", "base", "base+ext_funcs" or "termlib") -# host (cross-compile host, if any) # ShlibVer ("rel", "abi" or "auto", to augment DoLinks variable) # ShlibVerInfix ("yes" or "no", determines location of version #) # DoLinks ("yes", "reverse" or "no", flag to add symbolic links) # rmSoLocs ("yes" or "no", flag to add extra clean target) +# ldconfig (path for this tool, if used) # overwrite ("yes" or "no", flag to add link to libcurses.a +# depend (optional dependencies for all objects, e.g, ncurses_cfg.h) +# host (cross-compile host, if any) # # Notes: # CLIXs nawk does not like underscores in command-line variable names. @@ -111,12 +113,26 @@ BEGIN { if (found == 0) { print "" printf "# generated by mk-1st.awk (subset=%s)\n", subset + printf "# name: %s\n", name + printf "# traces: %s\n", traces + printf "# MODEL: %s\n", MODEL + printf "# model: %s\n", model + printf "# prefix: %s\n", prefix + printf "# suffix: %s\n", suffix + printf "# subset: %s\n", subset + printf "# ShlibVer: %s\n", ShlibVer + printf "# ShlibVerInfix: %s\n", ShlibVerInfix + printf "# DoLinks: %s\n", DoLinks + printf "# rmSoLocs: %s\n", rmSoLocs + printf "# ldconfig: %s\n", ldconfig + printf "# overwrite: %s\n", overwrite + printf "# depend: %s\n", depend + printf "# host: %s\n", host print "" } using = 1 } if ( subset == "termlib" || subset == "termlib+ext_tinfo" ) { - name = "tinfo" OBJS = MODEL "_T" } else { OBJS = MODEL @@ -299,7 +315,7 @@ END { print "uninstall.libs \\" printf "uninstall.%s ::\n", name printf "\t@echo uninstalling $(DESTDIR)$(libdir)/%s\n", lib_name - printf "\t-@$(LIBTOOL_CLEAN) rm -f $(DESTDIR)$(libdir)/%s\n", lib_name + printf "\t-@$(LIBTOOL_UNINSTALL) rm -f $(DESTDIR)$(libdir)/%s\n", lib_name } else { diff --git a/mk-2nd.awk b/mk-2nd.awk index 629b1697..1f637635 100644 --- a/mk-2nd.awk +++ b/mk-2nd.awk @@ -1,6 +1,6 @@ -# $Id: mk-2nd.awk,v 1.15 2003/11/01 22:42:50 tom Exp $ +# $Id: mk-2nd.awk,v 1.19 2005/01/22 16:30:04 tom Exp $ ############################################################################## -# Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -36,10 +36,14 @@ # development. # # Variables: -# model +# model directory into which objects are compiled. # MODEL (uppercase version of "model"; toupper is not portable) # echo (yes iff we will show the $(CC) lines) # subset ("none", "base", "base+ext_funcs" or "termlib") +# crenames ("yes" or "no", flag to control whether -c & -o options are used) +# cxxrenames ("yes" or "no", flag to control whether -c & -o options are used) +# traces ("all" or "DEBUG", to control whether tracing is compiled in) +# srcdir is expanded when "configure --srcdir" was used # # Fields in src/modules: # $1 = module name @@ -61,7 +65,14 @@ BEGIN { if (found == 0) { print "" print "# generated by mk-2nd.awk" - print "" + printf "# model: %s\n", model + printf "# MODEL: %s\n", MODEL + printf "# echo: %s\n", echo + printf "# subset: %s\n", subset + printf "# crenames: %s\n", crenames + printf "# cxxrenames: %s\n", cxxrenames + printf "# traces: %s\n", traces + printf "# srcdir: %s\n", srcdir } using = 1 } @@ -83,9 +94,11 @@ BEGIN { if ( $2 == "c++" ) { compile="CXX" suffix=".cc" + use_c_o=cxxrenames } else { compile="CC" suffix=".c" + use_c_o=crenames } printf "../%s/%s$o :\t%s/%s%s", model, $1, $3, $1, suffix for (n = 4; n <= NF; n++) printf " \\\n\t\t\t%s", $n @@ -96,13 +109,31 @@ BEGIN { atsign="@" printf "\t@echo 'compiling %s (%s)'\n", $1, model } + printf "\t%s", atsign; + if ( use_c_o != "yes" ) { + printf "cd ../%s; ", model; + } + # The choice here is between + # base+ext_funcs and + # termlib+ext_tinfo + # but they may appear in the same value. + if ( subset ~ /base/ ) { + mycflags="" + } else if ( subset ~ /termlib/ ) { + mycflags=" -DUSE_TERMLIB" + } + printf "$(LIBTOOL_COMPILE) $(%s) $(CFLAGS_%s)%s -c ", compile, MODEL, mycflags if ( $3 == "." || srcdir == "." ) { dir = $3 "/" sub("^\\$\\(srcdir\\)/","",dir); sub("^\\./","",dir); - printf "\t%scd ../%s; $(LIBTOOL_COMPILE) $(%s) $(CFLAGS_%s) -c ../%s/%s%s%s", atsign, model, compile, MODEL, name, dir, $1, suffix - } else - printf "\t%scd ../%s; $(LIBTOOL_COMPILE) $(%s) $(CFLAGS_%s) -c %s/%s%s", atsign, model, compile, MODEL, $3, $1, suffix + printf "../%s/%s%s%s", name, dir, $1, suffix + } else { + printf "%s/%s%s", $3, $1, suffix + } + if ( use_c_o == "yes" ) { + printf " -o ../%s/%s$o", model, $1 + } } else { printf "%s", $1 for (n = 2; n <= NF; n++) printf " %s", $n diff --git a/ncurses/Makefile.in b/ncurses/Makefile.in index 5b009107..2f5d22d1 100644 --- a/ncurses/Makefile.in +++ b/ncurses/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.91 2003/11/01 22:48:53 tom Exp $ +# $Id: Makefile.in,v 1.96 2005/05/07 18:57:05 tom Exp $ ############################################################################## -# Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -92,8 +92,9 @@ CPPFLAGS = -DHAVE_CONFIG_H -I../ncurses -I$(srcdir) @CPPFLAGS@ CCFLAGS = $(CPPFLAGS) $(CFLAGS) +BUILD_CPPFLAGS = -I../include @BUILD_CPPFLAGS@ BUILD_CC = @BUILD_CC@ -BUILD_CCFLAGS = -DHAVE_CONFIG_H -I../ncurses -I$(srcdir) @BUILD_CPPFLAGS@ @BUILD_CFLAGS@ +BUILD_CCFLAGS = -DHAVE_CONFIG_H -I../ncurses -I$(srcdir) -I$(INCDIR) $(BUILD_CPPFLAGS) @BUILD_CFLAGS@ BUILD_LDFLAGS = @BUILD_LDFLAGS@ BUILD_LIBS = @BUILD_LIBS@ @@ -155,7 +156,7 @@ AUTO_SRC = \ TEST_DEPS = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@ TEST_ARGS = -L../lib -lncurses@DFT_ARG_SUFFIX@ -TEST_LDFLAGS = @LD_MODEL@ $(TEST_ARGS) @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ @LDFLAGS@ +TEST_LDFLAGS = @LD_MODEL@ $(TEST_ARGS) @LIBS@ @LOCAL_LDFLAGS@ @LDFLAGS@ TEST_PROGS = \ captoinfo$x \ @@ -193,7 +194,7 @@ lib_gen.c : $(base)/MKlib_gen.sh ../include/curses.h fgrep undef >$@ init_keytry.h: make_keys$(BUILD_EXEEXT) keys.list - ./make_keys keys.list > $@ + ./make_keys$(BUILD_EXEEXT) keys.list > $@ keys.list : $(tinfo)/MKkeys_list.sh AWK=$(AWK) sh $(tinfo)/MKkeys_list.sh $(TERMINFO_CAPS) | sort >$@ @@ -230,10 +231,10 @@ unctrl.c: $(base)/MKunctrl.awk echo | $(AWK) -f $(base)/MKunctrl.awk >$@ tags: - ctags *.[ch] + ctags *.[ch] */*.[ch] @MAKE_UPPER_TAGS@TAGS: -@MAKE_UPPER_TAGS@ etags *.[ch] +@MAKE_UPPER_TAGS@ etags *.[ch] */*.[ch] mostlyclean :: -rm -f core tags TAGS *~ *.bak *.i *.ln *.atac trace diff --git a/ncurses/SigAction.h b/ncurses/SigAction.h index 150fc42b..5dfde643 100644 --- a/ncurses/SigAction.h +++ b/ncurses/SigAction.h @@ -32,7 +32,7 @@ ****************************************************************************/ /* - * $Id: SigAction.h,v 1.7 2003/12/07 01:00:03 tom Exp $ + * $Id: SigAction.h,v 1.8 2005/08/06 20:05:32 tom Exp $ * * This file exists to handle non-POSIX systems which don't have , * and usually no sigaction() nor @@ -59,10 +59,6 @@ typedef struct sigaction sigaction_t; #if HAVE_SIGVEC -#if HAVE_LIBC_H -#include -#endif - #undef SIG_BLOCK #define SIG_BLOCK 00 diff --git a/ncurses/base/MKkeyname.awk b/ncurses/base/MKkeyname.awk index 4bf83eaf..9ac65837 100644 --- a/ncurses/base/MKkeyname.awk +++ b/ncurses/base/MKkeyname.awk @@ -1,6 +1,6 @@ -# $Id: MKkeyname.awk,v 1.24 2002/09/01 19:43:34 tom Exp $ +# $Id: MKkeyname.awk,v 1.28 2005/04/30 19:26:25 tom Exp $ ############################################################################## -# Copyright (c) 1999-2001,2002 Free Software Foundation, Inc. # +# Copyright (c) 1999-2002,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -31,6 +31,7 @@ BEGIN { print "" print "#include " print "#include " + print "#include " print "" print "const struct kn _nc_key_names[] = {" } @@ -44,47 +45,74 @@ END { print "" print "NCURSES_EXPORT(NCURSES_CONST char *) keyname (int c)" print "{" - print "static char **table;" - print "int i;" - print "char name[20];" - print "char *p;" + print " static char **table;" + print " int i;" + print " char name[20];" + print " char *p;" + print " NCURSES_CONST char *result = 0;" print "" - print "\tif (c == -1) return \"-1\";" + print " if (c == -1) {" + print " result = \"-1\";" + print " } else {" + print " for (i = 0; _nc_key_names[i].name != 0; i++) {" + print " if (_nc_key_names[i].code == c) {" + print " result = (NCURSES_CONST char *)_nc_key_names[i].name;" + print " break;" + print " }" + print " }" print "" - print "\tfor (i = 0; _nc_key_names[i].name != 0; i++)" - print "\t\tif (_nc_key_names[i].code == c)" - print "\t\t\treturn (NCURSES_CONST char *)_nc_key_names[i].name;" - print "\tif (c < 0 || c >= 256) return 0;" + print " if (result == 0 && (c >= 0 && c < 256)) {" + print " if (table == 0)" + print " table = typeCalloc(char *, 256);" + print " if (table != 0) {" + print " if (table[c] == 0) {" + print " p = name;" + print " if (c >= 128) {" + print " strcpy(p, \"M-\");" + print " p += 2;" + print " c -= 128;" + print " }" + print " if (c < 32)" + print " sprintf(p, \"^%c\", c + '@');" + print " else if (c == 127)" + print " strcpy(p, \"^?\");" + print " else" + print " sprintf(p, \"%c\", c);" + print " table[c] = strdup(name);" + print " }" + print " result = table[c];" + print " }" + print "#if NCURSES_EXT_FUNCS && NCURSES_XNAMES" + print " } else if (result == 0 && cur_term != 0) {" + print " int j, k;" + print " char * bound;" + print " TERMTYPE *tp = &(cur_term->type);" + print " int save_trace = _nc_tracing;" print "" - print "\tif (table == 0)" - print "\t\ttable = typeCalloc(char *, 256);" - print "\tif (table == 0)" - print "\t\treturn keyname(256);" - print "" - print "\tif (table[c] == 0) {" - print "\t\tp = name;" - print "\t\tif (c >= 128) {" - print "\t\t\tstrcpy(p, \"M-\");" - print "\t\t\tp += 2;" - print "\t\t\tc -= 128;" - print "\t\t}" - print "\t\tif (c < 32)" - print "\t\t\tsprintf(p, \"^%c\", c + '@');" - print "\t\telse if (c == 127)" - print "\t\t\tstrcpy(p, \"^?\");" - print "\t\telse" - print "\t\t\tsprintf(p, \"%c\", c);" - print "\t\ttable[c] = strdup(name);" - print "\t}" - print "\treturn (NCURSES_CONST char *)table[c];" + print " _nc_tracing = 0; /* prevent recursion via keybound() */" + print " for (j = 0; (bound = keybound(c, j)) != 0; ++j) {" + print " for(k = STRCOUNT; k < NUM_STRINGS(tp); k++) {" + print " if (tp->Strings[k] != 0 && !strcmp(bound, tp->Strings[k])) {" + print " result = ExtStrname(tp, k, strnames);" + print " break;" + print " }" + print " }" + print " if (result != 0)" + print " break;" + print " }" + print " _nc_tracing = save_trace;" + print "#endif" + print " }" + print " }" + print " return result;" print "}" print "" print "#if USE_WIDEC_SUPPORT" print "NCURSES_EXPORT(NCURSES_CONST char *) key_name (wchar_t c)" print "{" - print "\tNCURSES_CONST char *result = keyname((int)c);" - print "\tif (!strncmp(result, \"M-\", 2)) result = 0;" - print "\treturn result;" + print " NCURSES_CONST char *result = keyname((int)c);" + print " if (!strncmp(result, \"M-\", 2)) result = 0;" + print " return result;" print "}" print "#endif" } diff --git a/ncurses/base/MKlib_gen.sh b/ncurses/base/MKlib_gen.sh index 583a349b..d22f4002 100755 --- a/ncurses/base/MKlib_gen.sh +++ b/ncurses/base/MKlib_gen.sh @@ -2,10 +2,10 @@ # # MKlib_gen.sh -- generate sources from curses.h macro definitions # -# ($Id: MKlib_gen.sh,v 1.23 2004/02/07 13:31:35 tom Exp $) +# ($Id: MKlib_gen.sh,v 1.24 2005/06/11 19:26:05 tom Exp $) # ############################################################################## -# Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. # +# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -39,14 +39,14 @@ # # This script accepts a file of prototypes on standard input. It discards # any that don't have a `generated' comment attached. It then parses each -# prototype (relying on the fact that none of the macros take function +# prototype (relying on the fact that none of the macros take function # pointer or array arguments) and generates C source from it. # # Here is what the pipeline stages are doing: # # 1. sed: extract prototypes of generated functions # 2. sed: decorate prototypes with generated arguments a1. a2,...z -# 3. awk: generate the calls with args matching the formals +# 3. awk: generate the calls with args matching the formals # 4. sed: prefix function names in prototypes so the preprocessor won't expand # them. # 5. cpp: macro-expand the file so the macro calls turn into C calls @@ -257,13 +257,17 @@ $0 !~ /^P_/ { comma = "" num = 0; pointer = 0; + va_list = 0; + varargs = 0; argtype = "" for (i = myfunc; i <= NF; i++) { ch = $i; if ( ch == "*" ) pointer = 1; else if ( ch == "va_list" ) - pointer = 1; + va_list = 1; + else if ( ch == "..." ) + varargs = 1; else if ( ch == "char" ) argtype = "char"; else if ( ch == "int" ) @@ -276,7 +280,11 @@ $0 !~ /^P_/ { argtype = "attr"; if ( ch == "," || ch == ")" ) { - if (pointer) { + if (va_list) { + call = call "%s" + } else if (varargs) { + call = call "%s" + } else if (pointer) { if ( argtype == "char" ) { call = call "%s" comma = comma "_nc_visbuf2(" num "," @@ -295,10 +303,17 @@ $0 !~ /^P_/ { comma = comma "(long)" } } - if (ch == ",") + if (ch == ",") { args = args comma "a" ++num; - else if ( argcount != 0 && $check != "..." ) - args = args comma "z" + } else if ( argcount != 0 ) { + if ( va_list ) { + args = args comma "\"va_list\"" + } else if ( varargs ) { + args = args comma "\"...\"" + } else { + args = args comma "z" + } + } call = call ch if (pointer == 0 && argcount != 0 && argtype != "" ) args = args ")" diff --git a/ncurses/base/MKunctrl.awk b/ncurses/base/MKunctrl.awk index d8a6587e..79ca5fc5 100644 --- a/ncurses/base/MKunctrl.awk +++ b/ncurses/base/MKunctrl.awk @@ -1,6 +1,6 @@ -# $Id: MKunctrl.awk,v 1.9 2001/06/02 23:59:20 skimo Exp $ +# $Id: MKunctrl.awk,v 1.10 2004/04/03 22:50:37 tom Exp $ ############################################################################## -# Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. # +# Copyright (c) 1998,2001,2004 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -63,7 +63,10 @@ END { printf "%s", gap } print "};" + print "int check = ChCharOf(ch);" print "" - print "\treturn (NCURSES_CONST char *)table[ChCharOf(ch)];" + print "\tif (check < 0 || check >= (int)SIZEOF(table)) return 0;" + print "" + print "\treturn (NCURSES_CONST char *)table[check];" print "}" } diff --git a/ncurses/base/define_key.c b/ncurses/base/define_key.c index 0c8bc48d..a89cf225 100644 --- a/ncurses/base/define_key.c +++ b/ncurses/base/define_key.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include -MODULE_ID("$Id: define_key.c,v 1.8 2003/05/17 23:28:05 tom Exp $") +MODULE_ID("$Id: define_key.c,v 1.9 2005/04/30 16:21:26 tom Exp $") NCURSES_EXPORT(int) define_key(const char *str, int keycode) @@ -40,7 +40,9 @@ define_key(const char *str, int keycode) int code = ERR; T((T_CALLED("define_key(%s,%d)"), _nc_visbuf(str), keycode)); - if (keycode > 0) { + if (SP == 0) { + code = ERR; + } else if (keycode > 0) { if (str != 0) { define_key(str, 0); } else if (has_key(keycode)) { diff --git a/ncurses/base/keybound.c b/ncurses/base/keybound.c index 06a1f44f..b982d226 100644 --- a/ncurses/base/keybound.c +++ b/ncurses/base/keybound.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999-2000,2003 Free Software Foundation, Inc. * + * Copyright (c) 1999-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,7 +32,7 @@ #include -MODULE_ID("$Id: keybound.c,v 1.4 2003/03/08 19:39:31 tom Exp $") +MODULE_ID("$Id: keybound.c,v 1.5 2005/04/30 16:53:42 tom Exp $") /* * Returns the count'th string definition which is associated with the @@ -42,6 +42,11 @@ MODULE_ID("$Id: keybound.c,v 1.4 2003/03/08 19:39:31 tom Exp $") NCURSES_EXPORT(char *) keybound(int code, int count) { + char *result = 0; + T((T_CALLED("keybound(%d,%d)"), code, count)); - returnPtr(_nc_expand_try(SP->_keytry, code, &count, 0)); + if (SP != 0) { + result = _nc_expand_try(SP->_keytry, code, &count, 0); + } + returnPtr(result); } diff --git a/ncurses/base/lib_addch.c b/ncurses/base/lib_addch.c index 63b63bdd..df5fddd0 100644 --- a/ncurses/base/lib_addch.c +++ b/ncurses/base/lib_addch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,7 +36,7 @@ #include #include -MODULE_ID("$Id: lib_addch.c,v 1.80 2004/02/07 18:20:46 tom Exp $") +MODULE_ID("$Id: lib_addch.c,v 1.95 2005/03/27 16:52:16 tom Exp $") /* * Ugly microtweaking alert. Everything from here to end of module is @@ -49,29 +49,50 @@ MODULE_ID("$Id: lib_addch.c,v 1.80 2004/02/07 18:20:46 tom Exp $") */ /* Return bit mask for clearing color pair number if given ch has color */ -#define COLOR_MASK(ch) (~(attr_t)((ch)&A_COLOR?A_COLOR:0)) +#define COLOR_MASK(ch) (~(attr_t)((ch) & A_COLOR ? A_COLOR : 0)) static inline NCURSES_CH_T render_char(WINDOW *win, NCURSES_CH_T ch) /* compute a rendition of the given char correct for the current context */ { attr_t a = win->_attrs; + int pair = GetPair(ch); - if (ISBLANK(ch) && AttrOf(ch) == A_NORMAL) { - /* color in attrs has precedence over bkgrnd */ + if (ISBLANK(ch) + && AttrOf(ch) == A_NORMAL + && pair == 0) { + /* color/pair in attrs has precedence over bkgrnd */ ch = win->_nc_bkgd; - SetAttr(ch, a | (AttrOf(win->_nc_bkgd) & COLOR_MASK(a))); + SetAttr(ch, a | AttrOf(win->_nc_bkgd)); + if ((pair = GET_WINDOW_PAIR(win)) == 0) + pair = GetPair(win->_nc_bkgd); + SetPair(ch, pair); } else { /* color in attrs has precedence over bkgrnd */ a |= AttrOf(win->_nc_bkgd) & COLOR_MASK(a); /* color in ch has precedence */ + if (pair == 0) { + if ((pair = GET_WINDOW_PAIR(win)) == 0) + pair = GetPair(win->_nc_bkgd); + } +#if 0 + if (pair > 255) { + NCURSES_CH_T fixme = ch; + SetPair(fixme, pair); + } +#endif AddAttr(ch, (a & COLOR_MASK(AttrOf(ch)))); + SetPair(ch, pair); } - TR(TRACE_VIRTPUT, ("render_char bkg %s, attrs %s -> ch %s", - _tracech_t2(1, CHREF(win->_nc_bkgd)), - _traceattr(win->_attrs), - _tracech_t2(3, CHREF(ch)))); + TR(TRACE_VIRTPUT, + ("render_char bkg %s (%d), attrs %s (%d) -> ch %s (%d)", + _tracech_t2(1, CHREF(win->_nc_bkgd)), + GetPair(win->_nc_bkgd), + _traceattr(win->_attrs), + GET_WINDOW_PAIR(win), + _tracech_t2(3, CHREF(ch)), + GetPair(ch))); return (ch); } @@ -99,9 +120,109 @@ _nc_render(WINDOW *win, NCURSES_CH_T ch) #define CHECK_POSITION(win, x, y) /* nothing */ #endif +/* + * The _WRAPPED flag is useful only for telling an application that we've just + * wrapped the cursor. We don't do anything with this flag except set it when + * wrapping, and clear it whenever we move the cursor. If we try to wrap at + * the lower-right corner of a window, we cannot move the cursor (since that + * wouldn't be legal). So we return an error (which is what SVr4 does). + * Unlike SVr4, we can successfully add a character to the lower-right corner + * (Solaris 2.6 does this also, however). + */ +static int +wrap_to_next_line(WINDOW *win) +{ + win->_flags |= _WRAPPED; + if (++win->_cury > win->_regbottom) { + win->_cury = win->_regbottom; + win->_curx = win->_maxx; + if (!win->_scroll) + return (ERR); + scroll(win); + } + win->_curx = 0; + return (OK); +} + +#if USE_WIDEC_SUPPORT +static int waddch_literal(WINDOW *, NCURSES_CH_T); +/* + * Fill the given number of cells with blanks using the current background + * rendition. This saves/restores the current x-position. + */ +static void +fill_cells(WINDOW *win, int count) +{ + NCURSES_CH_T blank = NewChar2(BLANK_TEXT, BLANK_ATTR); + int save_x = win->_curx; + int save_y = win->_cury; + + while (count-- > 0) { + if (waddch_literal(win, blank) == ERR) + break; + } + win->_curx = save_x; + win->_cury = save_y; +} +#endif + +/* + * Build up the bytes for a multibyte character, returning the length when + * complete (a positive number), -1 for error and -2 for incomplete. + */ +#if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) +_nc_build_wch(WINDOW *win, ARG_CH_T ch) +{ + char *buffer = WINDOW_EXT(win, addch_work); + int len; + int x = win->_curx; + int y = win->_cury; + mbstate_t state; + wchar_t result; + + if ((WINDOW_EXT(win, addch_used) != 0) && + (WINDOW_EXT(win, addch_x) != x || + WINDOW_EXT(win, addch_y) != y)) { + /* discard the incomplete multibyte character */ + WINDOW_EXT(win, addch_used) = 0; + TR(TRACE_VIRTPUT, + ("Alert discarded multibyte on move (%d,%d) -> (%d,%d)", + WINDOW_EXT(win, addch_y), WINDOW_EXT(win, addch_x), + y, x)); + } + WINDOW_EXT(win, addch_x) = x; + WINDOW_EXT(win, addch_y) = y; + + init_mb(state); + buffer[WINDOW_EXT(win, addch_used)] = CharOf(CHDEREF(ch)); + WINDOW_EXT(win, addch_used) += 1; + buffer[WINDOW_EXT(win, addch_used)] = '\0'; + if ((len = mbrtowc(&result, + buffer, + WINDOW_EXT(win, addch_used), &state)) > 0) { + attr_t attrs = AttrOf(CHDEREF(ch)); + SetChar(CHDEREF(ch), result, attrs); + WINDOW_EXT(win, addch_used) = 0; + } else { + if (len == -1) { + /* + * An error occurred. We could either discard everything, + * or assume that the error was in the previous input. + * Try the latter. + */ + TR(TRACE_VIRTPUT, ("Alert! mbrtowc returns error")); + buffer[0] = CharOf(CHDEREF(ch)); + WINDOW_EXT(win, addch_used) = 1; + } + } + return len; +} +#endif /* USE_WIDEC_SUPPORT */ + static #if !USE_WIDEC_SUPPORT /* cannot be inline if it is recursive */ - inline +inline #endif int waddch_literal(WINDOW *win, NCURSES_CH_T ch) @@ -115,18 +236,6 @@ waddch_literal(WINDOW *win, NCURSES_CH_T ch) CHECK_POSITION(win, x, y); - /* - * If we're trying to add a character at the lower-right corner more - * than once, fail. (Moving the cursor will clear the flag). - */ -#if 0 /* Solaris 2.6 allows updating the corner more than once */ - if (win->_flags & _WRAPPED) { - if (x >= win->_maxx) - return (ERR); - win->_flags &= ~_WRAPPED; - } -#endif - ch = render_char(win, ch); line = win->_line + y; @@ -137,118 +246,120 @@ waddch_literal(WINDOW *win, NCURSES_CH_T ch) * Build up multibyte characters until we have a wide-character. */ if_WIDEC({ - if (WINDOW_EXT(win, addch_used) == 0 && Charable(ch)) { - WINDOW_EXT(win, addch_used) = 0; - } else { - char *buffer = WINDOW_EXT(win, addch_work); - int len; - mbstate_t state; - wchar_t result; - - if ((WINDOW_EXT(win, addch_used) != 0) && - (WINDOW_EXT(win, addch_x) != x || - WINDOW_EXT(win, addch_y) != y)) { - /* discard the incomplete multibyte character */ - WINDOW_EXT(win, addch_used) = 0; - } - WINDOW_EXT(win, addch_x) = x; - WINDOW_EXT(win, addch_y) = y; - - memset(&state, 0, sizeof(state)); - buffer[WINDOW_EXT(win, addch_used)] = CharOf(ch); - WINDOW_EXT(win, addch_used) += 1; - buffer[WINDOW_EXT(win, addch_used)] = '\0'; - if ((len = mbrtowc(&result, - buffer, - WINDOW_EXT(win, addch_used), &state)) > 0) { - attr_t attrs = AttrOf(ch); - SetChar(ch, result, attrs); - WINDOW_EXT(win, addch_used) = 0; - if (CharOf(ch) < 256) { + if (WINDOW_EXT(win, addch_used) != 0 || !Charable(ch)) { + int len = _nc_build_wch(win, CHREF(ch)); + + if (len > 0) { + if (is8bits(CharOf(ch))) { const char *s = unctrl(CharOf(ch)); if (s[1] != 0) { return waddstr(win, s); } } } else { - if (len == -1) { - /* - * An error occurred. We could either discard everything, - * or assume that the error was in the previous input. - * Try the latter. - */ - TR(TRACE_VIRTPUT, ("Alert! mbrtowc returns error")); - buffer[0] = CharOf(ch); - WINDOW_EXT(win, addch_used) = 1; - } return OK; } } }); /* - * Handle non-spacing characters + * Non-spacing characters are added to the current cell. + * + * Spacing characters that are wider than one column require some display + * adjustments. */ if_WIDEC({ - if (wcwidth(CharOf(ch)) == 0) { - int i; + int len = wcwidth(CharOf(ch)); + int i; + int j; + + if (len == 0) { /* non-spacing */ if ((x > 0 && y >= 0) || ((y = win->_cury - 1) >= 0 && (x = win->_maxx) > 0)) { wchar_t *chars = (win->_line[y].text[x - 1].chars); for (i = 0; i < CCHARW_MAX; ++i) { if (chars[i] == 0) { + TR(TRACE_VIRTPUT, + ("added non-spacing %d: %x", + x, (int) CharOf(ch))); chars[i] = CharOf(ch); break; } } } goto testwrapping; + } else if (len > 1) { /* multi-column characters */ + /* + * Check if the character will fit on the current line. If it does + * not fit, fill in the remainder of the line with blanks. and + * move to the next line. + */ + if (len > win->_maxx + 1) { + TR(TRACE_VIRTPUT, ("character will not fit")); + return ERR; + } else if (x + len > win->_maxx + 1) { + int count = win->_maxx + 1 - x; + TR(TRACE_VIRTPUT, ("fill %d remaining cells", count)); + fill_cells(win, count); + if (wrap_to_next_line(win) == ERR) + return ERR; + x = win->_curx; + y = win->_cury; + } + /* + * Check for cells which are orphaned by adding this character, set + * those to blanks. + * + * FIXME: this actually could fill j-i cells, more complicated to + * setup though. + */ + for (i = 0; i < len; ++i) { + if (isWidecBase(win->_line[y].text[i])) { + break; + } else if (isWidecExt(win->_line[y].text[x + i])) { + for (j = i; x + j <= win->_maxx; ++j) { + if (!isWidecExt(win->_line[y].text[x + j])) { + TR(TRACE_VIRTPUT, ("fill %d orphan cells", j)); + fill_cells(win, j); + break; + } + } + break; + } + } + /* + * Finally, add the cells for this character. + */ + for (i = 0; i < len; ++i) { + NCURSES_CH_T value = ch; + SetWidecExt(value, i); + TR(TRACE_VIRTPUT, ("multicolumn %d:%d", i + 1, len)); + line->text[x] = value; + CHANGED_CELL(line, x); + ++x; + } + goto testwrapping; } }); + + /* + * Single-column characters. + */ line->text[x++] = ch; /* - * Provide for multi-column characters + * This label is used only for wide-characters. */ - if_WIDEC({ - int len = wcwidth(CharOf(ch)); - while (len-- > 1) { - if (x + (len - 1) > win->_maxx) { - NCURSES_CH_T blank = NewChar2(BLANK_TEXT, BLANK_ATTR); - AddAttr(blank, AttrOf(ch)); - if (waddch_literal(win, blank) != ERR) - return waddch_literal(win, ch); - return ERR; - } - AddAttr(line->text[x++], WA_NAC); - TR(TRACE_VIRTPUT, ("added NAC %d", x - 1)); - } - } + if_WIDEC( testwrapping: ); - TR(TRACE_VIRTPUT, ("(%d, %d) = %s", win->_cury, x, _tracech_t(CHREF(ch)))); + TR(TRACE_VIRTPUT, ("cell (%d, %d..%d) = %s", + win->_cury, win->_curx, x - 1, + _tracech_t(CHREF(ch)))); + if (x > win->_maxx) { - /* - * The _WRAPPED flag is useful only for telling an application that - * we've just wrapped the cursor. We don't do anything with this flag - * except set it when wrapping, and clear it whenever we move the - * cursor. If we try to wrap at the lower-right corner of a window, we - * cannot move the cursor (since that wouldn't be legal). So we return - * an error (which is what SVr4 does). Unlike SVr4, we can - * successfully add a character to the lower-right corner (Solaris 2.6 - * does this also, however). - */ - win->_flags |= _WRAPPED; - if (++win->_cury > win->_regbottom) { - win->_cury = win->_regbottom; - win->_curx = win->_maxx; - if (!win->_scroll) - return (ERR); - scroll(win); - } - win->_curx = 0; - return (OK); + return wrap_to_next_line(win); } win->_curx = x; return OK; @@ -260,7 +371,7 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch) { int x, y; chtype t = CharOf(ch); - const char *s = 0; + const char *s = unctrl(t); /* * If we are using the alternate character set, forget about locale. @@ -268,13 +379,20 @@ waddch_nosync(WINDOW *win, const NCURSES_CH_T ch) * claims the code is printable, treat it that way. */ if ((AttrOf(ch) & A_ALTCHARSET) - || ((s = unctrl(t))[1] == 0 || - ( - isprint(t) + || ( +#if USE_WIDEC_SUPPORT + (SP != 0 && SP->_legacy_coding) && +#endif + s[1] == 0 + ) + || ( + isprint(t) #if USE_WIDEC_SUPPORT - || WINDOW_EXT(win, addch_used) + || ((SP == 0 || !SP->_legacy_coding) && + (WINDOW_EXT(win, addch_used) + || !_nc_is_charable(CharOf(ch)))) #endif - ))) + )) return waddch_literal(win, ch); /* @@ -360,7 +478,7 @@ _nc_waddch_nosync(WINDOW *win, const NCURSES_CH_T c) } /* - * The versions below call _nc_synhook(). We wanted to avoid this in the + * The versions below call _nc_synchook(). We wanted to avoid this in the * version exported for string puts; they'll call _nc_synchook once at end * of run. */ diff --git a/ncurses/base/lib_addstr.c b/ncurses/base/lib_addstr.c index 1c3e19a4..7a93c415 100644 --- a/ncurses/base/lib_addstr.c +++ b/ncurses/base/lib_addstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,7 +30,7 @@ * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * * * - * Rewritten 2001-2002 to support wide-characters by * + * Rewritten 2001-2004 to support wide-characters by * * Sven Verdoolaege * * Thomas Dickey * ****************************************************************************/ @@ -44,7 +44,7 @@ #include -MODULE_ID("$Id: lib_addstr.c,v 1.39 2003/12/06 18:04:33 tom Exp $") +MODULE_ID("$Id: lib_addstr.c,v 1.43 2004/12/12 00:15:31 tom Exp $") NCURSES_EXPORT(int) waddnstr(WINDOW *win, const char *astr, int n) @@ -119,7 +119,7 @@ waddchnstr(WINDOW *win, const chtype *astr, int n) #if USE_WIDEC_SUPPORT NCURSES_EXPORT(int) -_nc_wchstrlen(const cchar_t * s) +_nc_wchstrlen(const cchar_t *s) { int result = 0; while (CharOf(s[result]) != L'\0') { @@ -129,13 +129,14 @@ _nc_wchstrlen(const cchar_t * s) } NCURSES_EXPORT(int) -wadd_wchnstr(WINDOW *win, const cchar_t * astr, int n) +wadd_wchnstr(WINDOW *win, const cchar_t *astr, int n) { + NCURSES_CH_T blank = NewChar(BLANK_TEXT); NCURSES_SIZE_T y = win->_cury; NCURSES_SIZE_T x = win->_curx; int code = OK; struct ldat *line; - int i, start, end; + int i, j, start, len, end; T((T_CALLED("wadd_wchnstr(%p,%s,%d)"), win, _nc_viscbuf(astr, n), n)); @@ -153,22 +154,58 @@ wadd_wchnstr(WINDOW *win, const cchar_t * astr, int n) line = &(win->_line[y]); start = x; end = x + n - 1; - if (isnac(line->text[x])) { - line->text[x - 1] = win->_nc_bkgd; - --start; + + /* + * Reset orphaned cells of multi-column characters that extend up to the + * new string's location to blanks. + */ + if (x > 0 && isWidecExt(line->text[x])) { + for (i = 0; i <= x; ++i) { + if (!isWidecExt(line->text[x - i])) { + /* must be isWidecBase() */ + start -= i; + while (i > 0) { + line->text[x - i--] = _nc_render(win, blank); + } + break; + } + } } + + /* + * Copy the new string to the window. + */ for (i = 0; i < n && x <= win->_maxx; ++i) { - line->text[x++] = astr[i]; - if (wcwidth(CharOf(astr[i])) > 1) { - if (x <= win->_maxx) - AddAttr(line->text[x++], WA_NAC); - else - line->text[x - 1] = win->_nc_bkgd; + if (isWidecExt(astr[i])) + continue; + + len = wcwidth(CharOf(astr[i])); + + if (x + len - 1 <= win->_maxx) { + line->text[x] = _nc_render(win, astr[i]); + if (len > 1) { + for (j = 0; j < len; ++j) { + if (j != 0) { + line->text[x + j] = line->text[x]; + } + SetWidecExt(line->text[x + j], j); + } + } + x += len; + end += len - 1; + } else { + break; } } - if (x <= win->_maxx && isnac(line->text[x])) { - line->text[x] = win->_nc_bkgd; + + /* + * Set orphaned cells of multi-column characters which lie after the new + * string to blanks. + */ + while (x <= win->_maxx && isWidecExt(line->text[x])) { + line->text[x] = _nc_render(win, blank); ++end; + ++x; } CHANGED_RANGE(line, start, end); @@ -177,7 +214,7 @@ wadd_wchnstr(WINDOW *win, const cchar_t * astr, int n) } NCURSES_EXPORT(int) -waddnwstr(WINDOW *win, const wchar_t * str, int n) +waddnwstr(WINDOW *win, const wchar_t *str, int n) { int code = ERR; diff --git a/ncurses/base/lib_beep.c b/ncurses/base/lib_beep.c index c23d0a1d..b478f251 100644 --- a/ncurses/base/lib_beep.c +++ b/ncurses/base/lib_beep.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -41,7 +42,7 @@ #include #include /* beep, flash */ -MODULE_ID("$Id: lib_beep.c,v 1.9 2000/12/10 02:43:26 tom Exp $") +MODULE_ID("$Id: lib_beep.c,v 1.10 2005/04/09 15:20:04 tom Exp $") /* * beep() @@ -59,7 +60,9 @@ beep(void) T((T_CALLED("beep()"))); /* FIXME: should make sure that we are not in altchar mode */ - if (bell) { + if (cur_term == 0) { + res = ERR; + } else if (bell) { TPUTS_TRACE("bell"); res = putp(bell); _nc_flush(); diff --git a/ncurses/base/lib_bkgd.c b/ncurses/base/lib_bkgd.c index 3f3a2ac7..48111a78 100644 --- a/ncurses/base/lib_bkgd.c +++ b/ncurses/base/lib_bkgd.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2001-2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,11 +29,14 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1997 * + * and: Sven Verdoolaege 2000 * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ #include -MODULE_ID("$Id: lib_bkgd.c,v 1.30 2003/07/05 16:46:49 tom Exp $") +MODULE_ID("$Id: lib_bkgd.c,v 1.32 2005/04/16 18:03:48 tom Exp $") /* * Set the window's background information. @@ -54,10 +57,23 @@ wbkgrndset(WINDOW *win, const ARG_CH_T ch) toggle_attr_off(win->_attrs, off); toggle_attr_on(win->_attrs, on); - if (CharOf(CHDEREF(ch)) == L('\0')) +#if NCURSES_EXT_COLORS + { + int pair; + + if ((pair = GetPair(win->_nc_bkgd)) != 0) + SET_WINDOW_PAIR(win, 0); + if ((pair = GetPair(CHDEREF(ch))) != 0) + SET_WINDOW_PAIR(win, pair); + } +#endif + + if (CharOf(CHDEREF(ch)) == L('\0')) { SetChar(win->_nc_bkgd, BLANK_TEXT, AttrOf(CHDEREF(ch))); - else + SetPair(win->_nc_bkgd, GetPair(CHDEREF(ch))); + } else { win->_nc_bkgd = CHDEREF(ch); + } #if USE_WIDEC_SUPPORT /* * If we're compiled for wide-character support, _bkgrnd is the @@ -70,9 +86,11 @@ wbkgrndset(WINDOW *win, const ARG_CH_T ch) int tmp; wgetbkgrnd(win, &wch); - tmp = _nc_to_char(CharOf(wch)); + tmp = _nc_to_char((wint_t) CharOf(wch)); - win->_bkgd = ((tmp == EOF) ? ' ' : (chtype) tmp) | AttrOf(wch); + win->_bkgd = (((tmp == EOF) ? ' ' : (chtype) tmp) + | (AttrOf(wch) & ALL_BUT_COLOR) + | COLOR_PAIR(GET_WINDOW_PAIR(win))); } #endif } diff --git a/ncurses/base/lib_chgat.c b/ncurses/base/lib_chgat.c index 54e66ed1..fc8a22f4 100644 --- a/ncurses/base/lib_chgat.c +++ b/ncurses/base/lib_chgat.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000,2001 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,8 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Sven Verdoolaege 2001 * + * and: Thomas E. Dickey 2005 * ****************************************************************************/ /* @@ -40,11 +42,10 @@ #include -MODULE_ID("$Id: lib_chgat.c,v 1.5 2001/06/03 00:05:02 skimo Exp $") +MODULE_ID("$Id: lib_chgat.c,v 1.6 2005/01/29 21:46:12 tom Exp $") NCURSES_EXPORT(int) -wchgat -(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) +wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts GCC_UNUSED) { int i; @@ -53,8 +54,10 @@ wchgat if (win) { toggle_attr_on(attr, COLOR_PAIR(color)); - for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) + for (i = win->_curx; i <= win->_maxx && (n == -1 || (n-- > 0)); i++) { SetAttr(win->_line[win->_cury].text[i], attr); + SetPair(win->_line[win->_cury].text[i], color); + } returnCode(OK); } else diff --git a/ncurses/base/lib_color.c b/ncurses/base/lib_color.c index 86c3fba3..27fb3727 100644 --- a/ncurses/base/lib_color.c +++ b/ncurses/base/lib_color.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* lib_color.c @@ -41,7 +42,7 @@ #include #include -MODULE_ID("$Id: lib_color.c,v 1.62 2002/09/28 20:40:05 tom Exp $") +MODULE_ID("$Id: lib_color.c,v 1.75 2005/06/18 20:19:08 tom Exp $") /* * These should be screen structure members. They need to be globals for @@ -53,6 +54,8 @@ NCURSES_EXPORT_VAR(int) COLORS = 0; #define DATA(r,g,b) {r,g,b, 0,0,0, 0} +#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts)) + /* * Given a RGB range of 0..1000, we'll normally set the individual values * to about 2/3 of the maximum, leaving full-range for bold/bright colors. @@ -222,7 +225,11 @@ start_color(void) T((T_CALLED("start_color()"))); - if (!SP->_coloron) { + if (SP == 0) { + result = ERR; + } else if (SP->_coloron) { + result = OK; + } else { if (reset_color_pair() != TRUE) { set_foreground_color(default_fg(), _nc_outch); @@ -233,9 +240,10 @@ start_color(void) COLOR_PAIRS = SP->_pair_count = max_pairs; COLORS = SP->_color_count = max_colors; - if ((SP->_color_pairs = typeCalloc(unsigned short, - (unsigned) max_pairs)) != 0) { - if ((SP->_color_table = typeCalloc(color_t, max_colors)) != 0) { + if ((SP->_color_pairs = TYPE_CALLOC(colorpair_t, + max_pairs)) != 0) { + if ((SP->_color_table = TYPE_CALLOC(color_t, + max_colors)) != 0) { SP->_color_pairs[0] = PAIR_OF(default_fg(), default_bg()); init_color_table(); @@ -244,13 +252,15 @@ start_color(void) SP->_coloron = 1; result = OK; - } else { + } else if (SP->_color_pairs != 0) { FreeAndNull(SP->_color_pairs); } } + } else { + result = OK; } } - returnCode(OK); + returnCode(result); } /* This function was originally written by Daniel Weaver */ @@ -298,21 +308,21 @@ rgb2hls(short r, short g, short b, short *h, short *l, short *s) NCURSES_EXPORT(int) init_pair(short pair, short f, short b) { - unsigned result; + colorpair_t result; T((T_CALLED("init_pair(%d,%d,%d)"), pair, f, b)); - if ((pair < 0) || (pair >= COLOR_PAIRS)) + if ((pair < 0) || (pair >= COLOR_PAIRS) || SP == 0 || !SP->_coloron) returnCode(ERR); #if NCURSES_EXT_FUNCS if (SP->_default_color) { if (f < 0) - f = C_MASK; + f = COLOR_DEFAULT; if (b < 0) - b = C_MASK; - if (f >= COLORS && f != C_MASK) + b = COLOR_DEFAULT; + if (f >= COLORS && !isDefaultColor(f)) returnCode(ERR); - if (b >= COLORS && b != C_MASK) + if (b >= COLORS && !isDefaultColor(b)) returnCode(ERR); } else #endif @@ -332,13 +342,12 @@ init_pair(short pair, short f, short b) if (SP->_color_pairs[pair] != 0 && SP->_color_pairs[pair] != result) { int y, x; - attr_t z = COLOR_PAIR(pair); for (y = 0; y <= curscr->_maxy; y++) { struct ldat *ptr = &(curscr->_line[y]); bool changed = FALSE; for (x = 0; x <= curscr->_maxx; x++) { - if ((AttrOf(ptr->text[x]) & A_COLOR) == z) { + if (GetPair(ptr->text[x]) == pair) { /* Set the old cell to zero to ensure it will be updated on the next doupdate() */ SetChar(ptr->text[x], 0, 0); @@ -351,8 +360,8 @@ init_pair(short pair, short f, short b) } } SP->_color_pairs[pair] = result; - if ((int) (SP->_current_attr & A_COLOR) == COLOR_PAIR(pair)) - SP->_current_attr |= A_COLOR; /* force attribute update */ + if (GET_SCREEN_PAIR(SP) == pair) + SET_SCREEN_PAIR(SP, ~0); /* force attribute update */ if (initialize_pair) { const color_t *tp = hue_lightness_saturation ? hls_palette : cga_palette; @@ -374,7 +383,7 @@ init_pair(short pair, short f, short b) returnCode(OK); } -#define okRGB(n) ((n) >= 0 && (n) < 1000) +#define okRGB(n) ((n) >= 0 && (n) <= 1000) NCURSES_EXPORT(int) init_color(short color, short r, short g, short b) @@ -384,6 +393,8 @@ init_color(short color, short r, short g, short b) T((T_CALLED("init_color(%d,%d,%d,%d)"), color, r, g, b)); if (initialize_color != NULL + && SP != 0 + && SP->_coloron && (color >= 0 && color < COLORS) && (okRGB(r) && okRGB(g) && okRGB(b))) { @@ -433,40 +444,65 @@ has_colors(void) NCURSES_EXPORT(int) color_content(short color, short *r, short *g, short *b) { - T((T_CALLED("color_content(%d,%p,%p,%p)"), color, r, g, b)); - if (color < 0 || color >= COLORS) - returnCode(ERR); + int result; - if (r) - *r = SP->_color_table[color].red; - if (g) - *g = SP->_color_table[color].green; - if (b) - *b = SP->_color_table[color].blue; - T(("...color_content(%d,%d,%d,%d)", color, *r, *g, *b)); - returnCode(OK); + T((T_CALLED("color_content(%d,%p,%p,%p)"), color, r, g, b)); + if (color < 0 || color >= COLORS || SP == 0 || !SP->_coloron) { + result = ERR; + } else { + NCURSES_COLOR_T c_r = SP->_color_table[color].red; + NCURSES_COLOR_T c_g = SP->_color_table[color].green; + NCURSES_COLOR_T c_b = SP->_color_table[color].blue; + + if (r) + *r = c_r; + if (g) + *g = c_g; + if (b) + *b = c_b; + + T(("...color_content(%d,%d,%d,%d)", color, c_r, c_g, c_b)); + result = OK; + } + returnCode(result); } NCURSES_EXPORT(int) pair_content(short pair, short *f, short *b) { + int result; + T((T_CALLED("pair_content(%d,%p,%p)"), pair, f, b)); - if ((pair < 0) || (pair >= COLOR_PAIRS)) - returnCode(ERR); - if (f) - *f = ((SP->_color_pairs[pair] >> C_SHIFT) & C_MASK); - if (b) - *b = (SP->_color_pairs[pair] & C_MASK); + if ((pair < 0) || (pair >= COLOR_PAIRS) || SP == 0 || !SP->_coloron) { + result = ERR; + } else { + NCURSES_COLOR_T fg = ((SP->_color_pairs[pair] >> C_SHIFT) & C_MASK); + NCURSES_COLOR_T bg = (SP->_color_pairs[pair] & C_MASK); - T(("...pair_content(%d,%d,%d)", pair, *f, *b)); - returnCode(OK); +#if NCURSES_EXT_FUNCS + if (fg == COLOR_DEFAULT) + fg = -1; + if (bg == COLOR_DEFAULT) + bg = -1; +#endif + + if (f) + *f = fg; + if (b) + *b = bg; + + T(("...pair_content(%d,%d,%d)", pair, fg, bg)); + result = OK; + } + returnCode(result); } NCURSES_EXPORT(void) _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) { - NCURSES_COLOR_T fg = C_MASK, bg = C_MASK; + NCURSES_COLOR_T fg = COLOR_DEFAULT; + NCURSES_COLOR_T bg = COLOR_DEFAULT; NCURSES_COLOR_T old_fg, old_bg; if (pair < 0 || pair >= COLOR_PAIRS) { @@ -484,17 +520,21 @@ _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) if (old_pair >= 0 && SP != 0 && pair_content(old_pair, &old_fg, &old_bg) != ERR) { - if ((fg == C_MASK && old_fg != C_MASK) - || (bg == C_MASK && old_bg != C_MASK)) { + if ((isDefaultColor(fg) && !isDefaultColor(old_fg)) + || (isDefaultColor(bg) && !isDefaultColor(old_bg))) { #if NCURSES_EXT_FUNCS /* * A minor optimization - but extension. If "AX" is specified in * the terminal description, treat it as screen's indicator of ECMA * SGR 39 and SGR 49, and assume the two sequences are independent. */ - if (SP->_has_sgr_39_49 && old_bg == C_MASK && old_fg != C_MASK) { + if (SP->_has_sgr_39_49 + && isDefaultColor(old_bg) + && !isDefaultColor(old_fg)) { tputs("\033[39m", 1, outc); - } else if (SP->_has_sgr_39_49 && old_fg == C_MASK && old_bg != C_MASK) { + } else if (SP->_has_sgr_39_49 + && isDefaultColor(old_fg) + && !isDefaultColor(old_bg)) { tputs("\033[49m", 1, outc); } else #endif @@ -507,9 +547,9 @@ _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) } #if NCURSES_EXT_FUNCS - if (fg == C_MASK) + if (isDefaultColor(fg)) fg = default_fg(); - if (bg == C_MASK) + if (isDefaultColor(bg)) bg = default_bg(); #endif @@ -522,10 +562,10 @@ _nc_do_color(int old_pair, int pair, bool reverse, int (*outc) (int)) TR(TRACE_ATTRS, ("setting colors: pair = %d, fg = %d, bg = %d", pair, fg, bg)); - if (fg != C_MASK) { + if (!isDefaultColor(fg)) { set_foreground_color(fg, outc); } - if (bg != C_MASK) { + if (!isDefaultColor(bg)) { set_background_color(bg, outc); } } diff --git a/ncurses/base/lib_colorset.c b/ncurses/base/lib_colorset.c index cd3f7f66..a973c535 100644 --- a/ncurses/base/lib_colorset.c +++ b/ncurses/base/lib_colorset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,8 @@ ****************************************************************************/ /**************************************************************************** - * Author: Juergen Pfeifer, 1998 * + * Author: Juergen Pfeifer, 1998 * + * and: Thomas E. Dickey, 2005 * ****************************************************************************/ /* @@ -40,7 +41,7 @@ #include #include -MODULE_ID("$Id: lib_colorset.c,v 1.10 2003/12/07 00:15:27 tom Exp $") +MODULE_ID("$Id: lib_colorset.c,v 1.11 2005/01/29 21:40:51 tom Exp $") NCURSES_EXPORT(int) wcolor_set(WINDOW *win, short color_pair_number, void *opts) @@ -50,9 +51,9 @@ wcolor_set(WINDOW *win, short color_pair_number, void *opts) && !opts && (color_pair_number >= 0) && (color_pair_number < COLOR_PAIRS)) { - TR(TRACE_ATTRS, ("... current %ld", (long) PAIR_NUMBER(win->_attrs))); - win->_attrs &= ALL_BUT_COLOR; - win->_attrs |= COLOR_PAIR(color_pair_number); + TR(TRACE_ATTRS, ("... current %ld", (long) GET_WINDOW_PAIR(win))); + SET_WINDOW_PAIR(win, color_pair_number); + if_EXT_COLORS(win->_color = color_pair_number); returnCode(OK); } else returnCode(ERR); diff --git a/ncurses/base/lib_dft_fgbg.c b/ncurses/base/lib_dft_fgbg.c index 24705c96..e78281ea 100644 --- a/ncurses/base/lib_dft_fgbg.c +++ b/ncurses/base/lib_dft_fgbg.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,13 +27,13 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1997,1999 * + * Author: Thomas E. Dickey * ****************************************************************************/ #include #include -MODULE_ID("$Id: lib_dft_fgbg.c,v 1.15 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_dft_fgbg.c,v 1.17 2005/01/29 21:42:15 tom Exp $") /* * Modify the behavior of color-pair 0 so that the library doesn't assume that @@ -43,7 +43,7 @@ NCURSES_EXPORT(int) use_default_colors(void) { T((T_CALLED("use_default_colors()"))); - returnCode(assume_default_colors(C_MASK, C_MASK)); + returnCode(assume_default_colors(-1, -1)); } /* @@ -61,11 +61,15 @@ assume_default_colors(int fg, int bg) if (initialize_pair) /* don't know how to handle this */ returnCode(ERR); - SP->_default_color = (fg < 0 || fg == C_MASK) || (bg < 0 || bg == C_MASK); + SP->_default_color = isDefaultColor(fg) || isDefaultColor(bg); SP->_has_sgr_39_49 = (tigetflag("AX") == TRUE); - SP->_default_fg = (fg >= 0) ? (fg & C_MASK) : C_MASK; - SP->_default_bg = (bg >= 0) ? (bg & C_MASK) : C_MASK; - if (SP->_color_pairs != 0) + SP->_default_fg = isDefaultColor(fg) ? COLOR_DEFAULT : (fg & C_MASK); + SP->_default_bg = isDefaultColor(bg) ? COLOR_DEFAULT : (bg & C_MASK); + if (SP->_color_pairs != 0) { + bool save = SP->_default_color; + SP->_default_color = TRUE; init_pair(0, fg, bg); + SP->_default_color = save; + } returnCode(OK); } diff --git a/ncurses/base/lib_freeall.c b/ncurses/base/lib_freeall.c index 607d3495..a5be4a58 100644 --- a/ncurses/base/lib_freeall.c +++ b/ncurses/base/lib_freeall.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,6 +32,7 @@ #include #include +#include #if HAVE_NC_FREEALL @@ -39,7 +40,7 @@ extern int malloc_errfd; /* FIXME */ #endif -MODULE_ID("$Id: lib_freeall.c,v 1.26 2003/12/27 18:21:57 tom Exp $") +MODULE_ID("$Id: lib_freeall.c,v 1.33 2005/06/04 22:34:01 tom Exp $") /* * Free all ncurses data. This is used for testing only (there's no practical @@ -54,7 +55,9 @@ _nc_freeall(void) T((T_CALLED("_nc_freeall()"))); #if NO_LEAKS _nc_free_tparm(); - FreeAndNull(_nc_oldnums); + if (_nc_oldnums != 0) { + FreeAndNull(_nc_oldnums); + } #endif if (SP != 0) { while (_nc_windows != 0) { @@ -82,6 +85,16 @@ _nc_freeall(void) del_curterm(cur_term); _nc_free_entries(_nc_head); + _nc_get_type(0); + _nc_first_name(0); +#if USE_WIDEC_SUPPORT + FreeIfNeeded(_nc_wacs); +#endif +#if NO_LEAKS + _nc_alloc_entry_leaks(); + _nc_captoinfo_leaks(); + _nc_comp_scan_leaks(); +#endif if ((s = _nc_home_terminfo()) != 0) free(s); @@ -94,6 +107,8 @@ _nc_freeall(void) #if HAVE_LIBDBMALLOC malloc_dump(malloc_errfd); #elif HAVE_LIBDMALLOC +#elif HAVE_LIBMPATROL + __mp_summary(); #elif HAVE_PURIFY purify_all_inuse(); #endif diff --git a/ncurses/base/lib_getch.c b/ncurses/base/lib_getch.c index 84700cc7..9cf42f50 100644 --- a/ncurses/base/lib_getch.c +++ b/ncurses/base/lib_getch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -40,7 +41,7 @@ #include -MODULE_ID("$Id: lib_getch.c,v 1.71 2003/05/17 23:49:28 tom Exp $") +MODULE_ID("$Id: lib_getch.c,v 1.73 2005/06/11 18:08:57 tom Exp $") #include @@ -233,7 +234,7 @@ _nc_wgetch(WINDOW *win, T((T_CALLED("_nc_wgetch(%p)"), win)); *result = 0; - if (!win) + if (win == 0 || SP == 0) returnCode(ERR); if (cooked_key_in_fifo()) { @@ -466,7 +467,7 @@ wgetch(WINDOW *win) T((T_CALLED("wgetch(%p)"), win)); code = _nc_wgetch(win, &value, - SP->_use_meta + (SP ? SP->_use_meta : 0) EVENTLIST_2nd((_nc_eventlist *) 0)); if (code != ERR) code = value; diff --git a/ncurses/base/lib_insch.c b/ncurses/base/lib_insch.c index 419c9a8b..b8a856df 100644 --- a/ncurses/base/lib_insch.c +++ b/ncurses/base/lib_insch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -43,22 +43,26 @@ #include #include -MODULE_ID("$Id: lib_insch.c,v 1.18 2002/11/23 21:41:05 tom Exp $") +MODULE_ID("$Id: lib_insch.c,v 1.24 2005/02/26 19:27:28 tom Exp $") /* * Insert the given character, updating the current location to simplify * inserting a string. */ -void +NCURSES_EXPORT(int) _nc_insert_ch(WINDOW *win, chtype ch) { + int code = OK; NCURSES_CH_T wch; int count; + NCURSES_CONST char *s; switch (ch) { case '\t': - for (count = (TABSIZE - (win->_curx % TABSIZE)); count > 0; count--) - _nc_insert_ch(win, ' '); + for (count = (TABSIZE - (win->_curx % TABSIZE)); count > 0; count--) { + if ((code = _nc_insert_ch(win, ' ')) != OK) + break; + } break; case '\n': case '\r': @@ -67,27 +71,49 @@ _nc_insert_ch(WINDOW *win, chtype ch) _nc_waddch_nosync(win, wch); break; default: - if (is7bits(ch) && iscntrl(ch)) { - _nc_insert_ch(win, '^'); - _nc_insert_ch(win, '@' + (ch)); - } else if (win->_curx <= win->_maxx) { - struct ldat *line = &(win->_line[win->_cury]); - NCURSES_CH_T *end = &(line->text[win->_curx]); - NCURSES_CH_T *temp1 = &(line->text[win->_maxx]); - NCURSES_CH_T *temp2 = temp1 - 1; - + if ( +#if USE_WIDEC_SUPPORT + WINDOW_EXT(win, addch_used) == 0 && +#endif + is8bits(ChCharOf(ch)) && + isprint(ChCharOf(ch))) { + if (win->_curx <= win->_maxx) { + struct ldat *line = &(win->_line[win->_cury]); + NCURSES_CH_T *end = &(line->text[win->_curx]); + NCURSES_CH_T *temp1 = &(line->text[win->_maxx]); + NCURSES_CH_T *temp2 = temp1 - 1; + + SetChar2(wch, ch); + + CHANGED_TO_EOL(line, win->_curx, win->_maxx); + while (temp1 > end) + *temp1-- = *temp2--; + + *temp1 = _nc_render(win, wch); + win->_curx++; + } + } else if (is8bits(ChCharOf(ch)) && iscntrl(ChCharOf(ch))) { + s = unctrl(ChCharOf(ch)); + while (*s != '\0') { + if ((code = _nc_insert_ch(win, ChAttrOf(ch) | UChar(*s))) != OK) + break; + ++s; + } + } +#if USE_WIDEC_SUPPORT + else { + /* + * Handle multibyte characters here + */ SetChar2(wch, ch); - - CHANGED_TO_EOL(line, win->_curx, win->_maxx); - while (temp1 > end) - *temp1-- = *temp2--; - - *temp1 = _nc_render(win, wch); - - win->_curx++; + wch = _nc_render(win, wch); + if (_nc_build_wch(win, &wch) >= 0) + code = wins_wch(win, &wch); } +#endif break; } + return code; } NCURSES_EXPORT(int) @@ -103,37 +129,11 @@ winsch(WINDOW *win, chtype c) oy = win->_cury; ox = win->_curx; - _nc_insert_ch(win, c); - - win->_curx = ox; - win->_cury = oy; - _nc_synchook(win); - code = OK; - } - returnCode(code); -} - -NCURSES_EXPORT(int) -winsnstr(WINDOW *win, const char *s, int n) -{ - int code = ERR; - NCURSES_SIZE_T oy; - NCURSES_SIZE_T ox; - const unsigned char *str = (const unsigned char *) s; - const unsigned char *cp; - - T((T_CALLED("winsnstr(%p,%s,%d)"), win, _nc_visbufn(s, n), n)); + code = _nc_insert_ch(win, c); - if (win != 0 && str != 0) { - oy = win->_cury; - ox = win->_curx; - for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) { - _nc_insert_ch(win, (chtype) UChar(*cp)); - } win->_curx = ox; win->_cury = oy; _nc_synchook(win); - code = OK; } returnCode(code); } diff --git a/ncurses/base/lib_insnstr.c b/ncurses/base/lib_insnstr.c new file mode 100644 index 00000000..b6ddfde3 --- /dev/null +++ b/ncurses/base/lib_insnstr.c @@ -0,0 +1,68 @@ +/**************************************************************************** + * Copyright (c) 2004 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas E. Dickey * + ****************************************************************************/ + +/* +** lib_insnstr.c +** +** The routine winsnstr(). +** +*/ + +#include +#include + +MODULE_ID("$Id: lib_insnstr.c,v 1.1 2004/02/28 23:44:56 tom Exp $") + +NCURSES_EXPORT(int) +winsnstr(WINDOW *win, const char *s, int n) +{ + int code = ERR; + NCURSES_SIZE_T oy; + NCURSES_SIZE_T ox; + const unsigned char *str = (const unsigned char *) s; + const unsigned char *cp; + + T((T_CALLED("winsnstr(%p,%s,%d)"), win, _nc_visbufn(s, n), n)); + + if (win != 0 && str != 0) { + oy = win->_cury; + ox = win->_curx; + for (cp = str; *cp && (n <= 0 || (cp - str) < n); cp++) { + _nc_insert_ch(win, (chtype) UChar(*cp)); + } + win->_curx = ox; + win->_cury = oy; + _nc_synchook(win); + code = OK; + } + returnCode(code); +} diff --git a/ncurses/base/lib_instr.c b/ncurses/base/lib_instr.c index 157d2ec9..d75dee9e 100644 --- a/ncurses/base/lib_instr.c +++ b/ncurses/base/lib_instr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -40,7 +41,7 @@ #include -MODULE_ID("$Id: lib_instr.c,v 1.12 2002/10/05 23:23:05 tom Exp $") +MODULE_ID("$Id: lib_instr.c,v 1.14 2005/04/16 17:51:12 tom Exp $") NCURSES_EXPORT(int) winnstr(WINDOW *win, char *str, int n) @@ -59,7 +60,47 @@ winnstr(WINDOW *win, char *str, int n) n = win->_maxx - win->_curx + 1; for (; i < n;) { +#if USE_WIDEC_SUPPORT + cchar_t *cell = &(win->_line[row].text[col]); + wchar_t *wch; + attr_t attrs; + short pair; + int n2; + bool done = FALSE; + mbstate_t state; + size_t i3, n3; + char *tmp; + + if (!isWidecExt(*cell)) { + n2 = getcchar(cell, 0, 0, 0, 0); + if (n2 > 0 + && (wch = typeCalloc(wchar_t, (unsigned) n2 + 1)) != 0) { + if (getcchar(cell, wch, &attrs, &pair, 0) == OK) { + + init_mb(state); + n3 = wcstombs(0, wch, 0); + if (isEILSEQ(n3) || (n3 == 0)) { + ; + } else if ((int) (n3 + i) >= n) { + done = TRUE; + } else if ((tmp = typeCalloc(char, n3 + 10)) == 0) { + done = TRUE; + } else { + init_mb(state); + wcstombs(tmp, wch, n3); + for (i3 = 0; i3 < n3; ++i3) + str[i++] = tmp[i3]; + free(tmp); + } + } + free(wch); + if (done) + break; + } + } +#else str[i++] = CharOf(win->_line[row].text[col]); +#endif if (++col > win->_maxx) { col = 0; if (++row > win->_maxy) diff --git a/ncurses/base/lib_mouse.c b/ncurses/base/lib_mouse.c index b2fc9d54..7bb20de5 100644 --- a/ncurses/base/lib_mouse.c +++ b/ncurses/base/lib_mouse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,15 +29,18 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * - * and: Thomas E. Dickey 1996-2003 * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* * This module is intended to encapsulate ncurses's interface to pointing * devices. * - * The first method used is xterm's internal mouse-tracking facility. - * The second is Alessandro Rubini's GPM server. + * The primary method used is xterm's internal mouse-tracking facility. + * Additional methods depend on the platform: + * Alessandro Rubini's GPM server (Linux) + * sysmouse (FreeBSD) + * special-purpose mouse interface for OS/2 EMX. * * Notes for implementors of new mouse-interface methods: * @@ -76,7 +79,7 @@ #include -MODULE_ID("$Id: lib_mouse.c,v 1.68 2003/11/08 21:50:50 tom Exp $") +MODULE_ID("$Id: lib_mouse.c,v 1.77 2005/09/10 22:58:57 tom Exp $") #include #include @@ -86,8 +89,19 @@ MODULE_ID("$Id: lib_mouse.c,v 1.68 2003/11/08 21:50:50 tom Exp $") #undef buttons /* term.h defines this, and gpm uses it! */ #include #include /* defines KG_* macros */ +/* use dynamic loader to avoid linkage dependency */ +#include +#ifdef RTLD_NOW +#define my_RTLD RTLD_NOW +#else +#ifdef RTLD_LAZY +#define my_RTLD RTLD_LAZY +#else +make an error #endif #endif +#endif +#endif /* USE_GPM_SUPPORT */ #if USE_SYSMOUSE #undef buttons /* symbol conflict in consio.h */ @@ -99,30 +113,60 @@ MODULE_ID("$Id: lib_mouse.c,v 1.68 2003/11/08 21:50:50 tom Exp $") #else #include #endif -#endif /* use_SYSMOUSE */ +#endif /* use_SYSMOUSE */ #define MY_TRACE TRACE_ICALLS|TRACE_IEVENT -#define MASK_RELEASE(x) ((001 << (6 * ((x) - 1)))) -#define MASK_PRESS(x) ((002 << (6 * ((x) - 1)))) -#define MASK_CLICK(x) ((004 << (6 * ((x) - 1)))) -#define MASK_DOUBLE_CLICK(x) ((010 << (6 * ((x) - 1)))) -#define MASK_TRIPLE_CLICK(x) ((020 << (6 * ((x) - 1)))) -#define MASK_RESERVED_EVENT(x) ((040 << (6 * ((x) - 1)))) - -#define BUTTON_CLICKED (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED) -#define BUTTON_PRESSED (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED) -#define BUTTON_RELEASED (BUTTON1_RELEASED | BUTTON2_RELEASED | BUTTON3_RELEASED) +#define MASK_RELEASE(x) NCURSES_MOUSE_MASK(x, 001) +#define MASK_PRESS(x) NCURSES_MOUSE_MASK(x, 002) +#define MASK_CLICK(x) NCURSES_MOUSE_MASK(x, 004) +#define MASK_DOUBLE_CLICK(x) NCURSES_MOUSE_MASK(x, 010) +#define MASK_TRIPLE_CLICK(x) NCURSES_MOUSE_MASK(x, 020) +#define MASK_RESERVED_EVENT(x) NCURSES_MOUSE_MASK(x, 040) + +#if NCURSES_MOUSE_VERSION == 1 +#define BUTTON_CLICKED (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED | BUTTON4_CLICKED) +#define BUTTON_PRESSED (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED) +#define BUTTON_RELEASED (BUTTON1_RELEASED | BUTTON2_RELEASED | BUTTON3_RELEASED | BUTTON4_RELEASED) +#define BUTTON_DOUBLE_CLICKED (BUTTON1_DOUBLE_CLICKED | BUTTON2_DOUBLE_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON4_DOUBLE_CLICKED) +#define BUTTON_TRIPLE_CLICKED (BUTTON1_TRIPLE_CLICKED | BUTTON2_TRIPLE_CLICKED | BUTTON3_TRIPLE_CLICKED | BUTTON4_TRIPLE_CLICKED) +#define MAX_BUTTONS 4 +#else +#define BUTTON_CLICKED (BUTTON1_CLICKED | BUTTON2_CLICKED | BUTTON3_CLICKED | BUTTON4_CLICKED | BUTTON5_CLICKED) +#define BUTTON_PRESSED (BUTTON1_PRESSED | BUTTON2_PRESSED | BUTTON3_PRESSED | BUTTON4_PRESSED | BUTTON5_PRESSED) +#define BUTTON_RELEASED (BUTTON1_RELEASED | BUTTON2_RELEASED | BUTTON3_RELEASED | BUTTON4_RELEASED | BUTTON5_RELEASED) +#define BUTTON_DOUBLE_CLICKED (BUTTON1_DOUBLE_CLICKED | BUTTON2_DOUBLE_CLICKED | BUTTON3_DOUBLE_CLICKED | BUTTON4_DOUBLE_CLICKED | BUTTON5_DOUBLE_CLICKED) +#define BUTTON_TRIPLE_CLICKED (BUTTON1_TRIPLE_CLICKED | BUTTON2_TRIPLE_CLICKED | BUTTON3_TRIPLE_CLICKED | BUTTON4_TRIPLE_CLICKED | BUTTON5_TRIPLE_CLICKED) +#define MAX_BUTTONS 5 +#endif #define INVALID_EVENT -1 #define NORMAL_EVENT 0 #if USE_GPM_SUPPORT #ifndef LINT -static Gpm_Connect gpm_connect; -#endif + +#ifndef LIBGPM_SONAME +#define LIBGPM_SONAME "libgpm.so" #endif +#define GET_DLSYM(name) (my_##name = (TYPE_##name) dlsym(obj, #name)) + +static Gpm_Connect gpm_connect; + +typedef int *TYPE_gpm_fd; +typedef int (*TYPE_Gpm_Open) (Gpm_Connect *, int); +typedef int (*TYPE_Gpm_Close) (void); +typedef int (*TYPE_Gpm_GetEvent) (Gpm_Event *); + +static TYPE_gpm_fd my_gpm_fd; +static TYPE_Gpm_Open my_Gpm_Open; +static TYPE_Gpm_Close my_Gpm_Close; +static TYPE_Gpm_GetEvent my_Gpm_GetEvent; + +#endif /* LINT */ +#endif /* USE_GPM_SUPPORT */ + static mmask_t eventmask; /* current event mask */ static bool _nc_mouse_parse(int); @@ -247,12 +291,6 @@ mouse_server(unsigned long ignored GCC_UNUSED) DosExit(EXIT_THREAD, 0L); } -static void -server_state(const int state) -{ /* It would be nice to implement pointer-off and stop looping... */ - mouse_activated = state; -} - #endif /* USE_EMX_MOUSE */ #if USE_SYSMOUSE @@ -312,7 +350,7 @@ handle_sysmouse(int sig GCC_UNUSED) work->y = the_mouse.u.data.y / SP->_sysmouse_char_height; } } -#endif +#endif /* USE_SYSMOUSE */ static int initialized; @@ -325,35 +363,113 @@ init_xterm_mouse(void) SP->_mouse_xtermcap = "\033[?1000%?%p1%{1}%=%th%el%;"; } -#if !USE_EMX_MOUSE static void enable_xterm_mouse(int enable) { +#if USE_EMX_MOUSE + mouse_activated = enable; +#else putp(tparm(SP->_mouse_xtermcap, enable)); +#endif + SP->_mouse_active = enable; } -#endif /* !USE_EMX_MOUSE */ - -static void -initialize_mousetype(void) -{ - static const char *xterm_kmous = "\033[M"; - /* Try gpm first, because gpm may be configured to run in xterm */ #if USE_GPM_SUPPORT +static int +allow_gpm_mouse(void) +{ /* GPM does printf's without checking if stdout is a terminal */ if (isatty(fileno(stdout))) { + char *env = getenv("TERM"); + /* GPM checks the beginning of the $TERM variable to decide if + * it should pass xterm events through. There is no real advantage + * in allowing GPM to do this. + */ + if (env == 0 || strncmp(env, "xterm", 5)) + return TRUE; + } + return FALSE; +} + +static bool +enable_gpm_mouse(int enable) +{ + bool result; + + T((T_CALLED("enable_gpm_mouse(%d)"), enable)); + + if (enable && !SP->_mouse_active) { /* GPM: initialize connection to gpm server */ gpm_connect.eventMask = GPM_DOWN | GPM_UP; gpm_connect.defaultMask = ~(gpm_connect.eventMask | GPM_HARD); gpm_connect.minMod = 0; - gpm_connect.maxMod = ~((1 << KG_SHIFT) | (1 << KG_SHIFTL) | (1 << KG_SHIFTR)); - if (Gpm_Open(&gpm_connect, 0) >= 0) { /* returns the file-descriptor */ + gpm_connect.maxMod = (unsigned short) (~((1 << KG_SHIFT) | + (1 << KG_SHIFTL) | + (1 << KG_SHIFTR))); + /* + * Note: GPM hardcodes \E[?1001s and \E[?1000h during its open. + * The former is recognized by wscons (SunOS), and the latter by + * xterm. Those will not show up in ncurses' traces. + */ + result = (my_Gpm_Open(&gpm_connect, 0) >= 0); + SP->_mouse_active = result; + T(("GPM open %s", result ? "succeeded" : "failed")); + } else { + if (!enable && SP->_mouse_active) { + /* GPM: close connection to gpm server */ + my_Gpm_Close(); + SP->_mouse_active = FALSE; + T(("GPM closed")); + } + result = FALSE; + } + returnBool(result); +} +#endif /* USE_GPM_SUPPORT */ + +static void +initialize_mousetype(void) +{ + static const char *xterm_kmous = "\033[M"; + + T((T_CALLED("initialize_mousetype()"))); + + /* Try gpm first, because gpm may be configured to run in xterm */ +#if USE_GPM_SUPPORT + if (allow_gpm_mouse()) { + static bool first = TRUE; + static bool found = FALSE; + + if (first) { + void *obj; + first = FALSE; + + if ((obj = dlopen(LIBGPM_SONAME, my_RTLD)) != 0) { + if (GET_DLSYM(gpm_fd) == 0 || + GET_DLSYM(Gpm_Open) == 0 || + GET_DLSYM(Gpm_Close) == 0 || + GET_DLSYM(Gpm_GetEvent) == 0) { + T(("GPM initialization failed: %s", dlerror())); + dlclose(obj); + } else { + found = TRUE; + } + } + } + + /* + * The gpm_fd file-descriptor may be negative (xterm). So we have to + * maintain our notion of whether the mouse connection is active + * without testing the file-descriptor. + */ + if (found && enable_gpm_mouse(TRUE)) { SP->_mouse_type = M_GPM; - SP->_mouse_fd = gpm_fd; - return; + SP->_mouse_fd = *my_gpm_fd; + T(("GPM mouse_fd %d", SP->_mouse_fd)); + returnVoid; } } -#endif +#endif /* USE_GPM_SUPPORT */ /* OS/2 VIO */ #if USE_EMX_MOUSE @@ -364,7 +480,7 @@ initialize_mousetype(void) if (pipe(handles) < 0) { perror("mouse pipe error"); - return; + returnVoid; } else { int rc; @@ -388,14 +504,13 @@ initialize_mousetype(void) mouse_server, 0, 0, 8192); if (rc) { printf("mouse thread error %d=%#x", rc, rc); - return; } else { SP->_mouse_type = M_XTERM; - return; } + returnVoid; } } -#endif +#endif /* USE_EMX_MOUSE */ #if USE_SYSMOUSE { @@ -456,7 +571,7 @@ initialize_mousetype(void) if (SP->_sysmouse_char_height <= 0) SP->_sysmouse_char_height = 16; SP->_mouse_type = M_SYSMOUSE; - return; + returnVoid; } } } @@ -466,22 +581,21 @@ initialize_mousetype(void) if (key_mouse != 0) { if (!strcmp(key_mouse, xterm_kmous)) { init_xterm_mouse(); - return; } } else if (strstr(cur_term->type.term_names, "xterm") != 0) { (void) _nc_add_to_try(&(SP->_keytry), xterm_kmous, KEY_MOUSE); init_xterm_mouse(); - return; } + returnVoid; } -static void +static bool _nc_mouse_init(void) /* initialize the mouse */ { int i; - if (!initialized) { + if (!initialized && (SP != 0)) { initialized = TRUE; TR(MY_TRACE, ("_nc_mouse_init() called")); @@ -493,6 +607,7 @@ _nc_mouse_init(void) T(("_nc_mouse_init() set mousetype to %d", SP->_mouse_type)); } + return initialized; } /* @@ -500,7 +615,7 @@ _nc_mouse_init(void) * fifo_push() in lib_getch.c */ static bool -_nc_mouse_event(SCREEN * sp GCC_UNUSED) +_nc_mouse_event(SCREEN *sp GCC_UNUSED) { bool result = FALSE; @@ -530,7 +645,7 @@ _nc_mouse_event(SCREEN * sp GCC_UNUSED) /* query server for event, return TRUE if we find one */ Gpm_Event ev; - if (Gpm_GetEvent(&ev) == 1) { + if (my_Gpm_GetEvent(&ev) == 1) { /* there's only one mouse... */ eventp->id = NORMAL_EVENT; @@ -599,9 +714,10 @@ _nc_mouse_event(SCREEN * sp GCC_UNUSED) } static bool -_nc_mouse_inline(SCREEN * sp) +_nc_mouse_inline(SCREEN *sp) /* mouse report received in the keyboard stream -- parse its info */ { + int b; bool result = FALSE; TR(MY_TRACE, ("_nc_mouse_inline() called")); @@ -639,8 +755,10 @@ _nc_mouse_inline(SCREEN * sp) * (End quote) By the time we get here, we've eaten the * key prefix. FYI, the loop below is necessary because * mouse click info isn't guaranteed to present as a - * single clist item. It always does under Linux but often - * fails to under Solaris. + * single clist item. + * + * Wheel mice may return buttons 4 and 5 when the wheel is turned. + * We encode those as button presses. */ for (grabbed = 0; grabbed < 3; grabbed += res) { @@ -679,11 +797,19 @@ _nc_mouse_inline(SCREEN * sp) switch (kbuf[0] & 0x3) { case 0x0: - PRESS_POSITION(1); + if (kbuf[0] & 64) + eventp->bstate = MASK_PRESS(4); + else + PRESS_POSITION(1); break; case 0x1: - PRESS_POSITION(2); +#if NCURSES_MOUSE_VERSION == 2 + if (kbuf[0] & 64) + eventp->bstate = MASK_PRESS(5); + else +#endif + PRESS_POSITION(2); break; case 0x2: @@ -700,12 +826,10 @@ _nc_mouse_inline(SCREEN * sp) */ if (prev & (BUTTON_PRESSED | BUTTON_RELEASED)) { eventp->bstate = BUTTON_RELEASED; - if (!(prev & BUTTON1_PRESSED)) - eventp->bstate &= ~BUTTON1_RELEASED; - if (!(prev & BUTTON2_PRESSED)) - eventp->bstate &= ~BUTTON2_RELEASED; - if (!(prev & BUTTON3_PRESSED)) - eventp->bstate &= ~BUTTON3_RELEASED; + for (b = 1; b <= MAX_BUTTONS; ++b) { + if (!(prev & MASK_PRESS(b))) + eventp->bstate &= ~MASK_RELEASE(b); + } } else { /* * XFree86 xterm will return a stream of release-events to @@ -751,7 +875,8 @@ mouse_activate(bool on) if (!on && !initialized) return; - _nc_mouse_init(); + if (!_nc_mouse_init()) + return; if (on) { @@ -761,20 +886,20 @@ mouse_activate(bool on) keyok(KEY_MOUSE, on); #endif TPUTS_TRACE("xterm mouse initialization"); -#if USE_EMX_MOUSE - server_state(1); -#else enable_xterm_mouse(1); -#endif break; #if USE_GPM_SUPPORT case M_GPM: - SP->_mouse_fd = gpm_fd; + if (enable_gpm_mouse(1)) { + SP->_mouse_fd = *my_gpm_fd; + T(("GPM mouse_fd %d", SP->_mouse_fd)); + } break; #endif #if USE_SYSMOUSE case M_SYSMOUSE: signal(SIGUSR2, handle_sysmouse); + SP->_mouse_active = TRUE; break; #endif case M_NONE: @@ -788,25 +913,22 @@ mouse_activate(bool on) SP->_mouse_parse = _nc_mouse_parse; SP->_mouse_resume = _nc_mouse_resume; SP->_mouse_wrap = _nc_mouse_wrap; - } else { switch (SP->_mouse_type) { case M_XTERM: TPUTS_TRACE("xterm mouse deinitialization"); -#if USE_EMX_MOUSE - server_state(0); -#else enable_xterm_mouse(0); -#endif break; #if USE_GPM_SUPPORT case M_GPM: + enable_gpm_mouse(0); break; #endif #if USE_SYSMOUSE case M_SYSMOUSE: signal(SIGUSR2, SIG_IGN); + SP->_mouse_active = FALSE; break; #endif case M_NONE: @@ -828,6 +950,7 @@ _nc_mouse_parse(int runcount) { MEVENT *ep, *runp, *next, *prev = PREV(eventp); int n; + int b; bool merge; TR(MY_TRACE, ("_nc_mouse_parse(%d) called", runcount)); @@ -883,32 +1006,27 @@ _nc_mouse_parse(int runcount) do { merge = FALSE; for (ep = runp; (next = NEXT(ep)) != eventp; ep = next) { + +#define MASK_CHANGED(x) (!(ep->bstate & MASK_PRESS(x)) \ + == !(next->bstate & MASK_RELEASE(x))) + if (ep->x == next->x && ep->y == next->y && (ep->bstate & BUTTON_PRESSED) - && (!(ep->bstate & BUTTON1_PRESSED) - == !(next->bstate & BUTTON1_RELEASED)) - && (!(ep->bstate & BUTTON2_PRESSED) - == !(next->bstate & BUTTON2_RELEASED)) - && (!(ep->bstate & BUTTON3_PRESSED) - == !(next->bstate & BUTTON3_RELEASED)) + && MASK_CHANGED(1) + && MASK_CHANGED(2) + && MASK_CHANGED(3) + && MASK_CHANGED(4) +#if NCURSES_MOUSE_VERSION == 2 + && MASK_CHANGED(5) +#endif ) { - if ((eventmask & BUTTON1_CLICKED) - && (ep->bstate & BUTTON1_PRESSED)) { - ep->bstate &= ~BUTTON1_PRESSED; - ep->bstate |= BUTTON1_CLICKED; - merge = TRUE; - } - if ((eventmask & BUTTON2_CLICKED) - && (ep->bstate & BUTTON2_PRESSED)) { - ep->bstate &= ~BUTTON2_PRESSED; - ep->bstate |= BUTTON2_CLICKED; - merge = TRUE; - } - if ((eventmask & BUTTON3_CLICKED) - && (ep->bstate & BUTTON3_PRESSED)) { - ep->bstate &= ~BUTTON3_PRESSED; - ep->bstate |= BUTTON3_CLICKED; - merge = TRUE; + for (b = 1; b <= MAX_BUTTONS; ++b) { + if ((eventmask & MASK_CLICK(b)) + && (ep->bstate & MASK_PRESS(b))) { + ep->bstate &= ~MASK_PRESS(b); + ep->bstate |= MASK_CLICK(b); + merge = TRUE; + } } if (merge) next->id = INVALID_EVENT; @@ -958,51 +1076,28 @@ _nc_mouse_parse(int runcount) /* merge click events forward */ if ((ep->bstate & BUTTON_CLICKED) && (follower->bstate & BUTTON_CLICKED)) { - if ((eventmask & BUTTON1_DOUBLE_CLICKED) - && (follower->bstate & BUTTON1_CLICKED)) { - follower->bstate &= ~BUTTON1_CLICKED; - follower->bstate |= BUTTON1_DOUBLE_CLICKED; - merge = TRUE; - } - if ((eventmask & BUTTON2_DOUBLE_CLICKED) - && (follower->bstate & BUTTON2_CLICKED)) { - follower->bstate &= ~BUTTON2_CLICKED; - follower->bstate |= BUTTON2_DOUBLE_CLICKED; - merge = TRUE; - } - if ((eventmask & BUTTON3_DOUBLE_CLICKED) - && (follower->bstate & BUTTON3_CLICKED)) { - follower->bstate &= ~BUTTON3_CLICKED; - follower->bstate |= BUTTON3_DOUBLE_CLICKED; - merge = TRUE; + for (b = 1; b <= MAX_BUTTONS; ++b) { + if ((eventmask & MASK_DOUBLE_CLICK(b)) + && (follower->bstate & MASK_CLICK(b))) { + follower->bstate &= ~MASK_CLICK(b); + follower->bstate |= MASK_DOUBLE_CLICK(b); + merge = TRUE; + } } if (merge) ep->id = INVALID_EVENT; } /* merge double-click events forward */ - if ((ep->bstate & - (BUTTON1_DOUBLE_CLICKED - | BUTTON2_DOUBLE_CLICKED - | BUTTON3_DOUBLE_CLICKED)) + if ((ep->bstate & BUTTON_DOUBLE_CLICKED) && (follower->bstate & BUTTON_CLICKED)) { - if ((eventmask & BUTTON1_TRIPLE_CLICKED) - && (follower->bstate & BUTTON1_CLICKED)) { - follower->bstate &= ~BUTTON1_CLICKED; - follower->bstate |= BUTTON1_TRIPLE_CLICKED; - merge = TRUE; - } - if ((eventmask & BUTTON2_TRIPLE_CLICKED) - && (follower->bstate & BUTTON2_CLICKED)) { - follower->bstate &= ~BUTTON2_CLICKED; - follower->bstate |= BUTTON2_TRIPLE_CLICKED; - merge = TRUE; - } - if ((eventmask & BUTTON3_TRIPLE_CLICKED) - && (follower->bstate & BUTTON3_CLICKED)) { - follower->bstate &= ~BUTTON3_CLICKED; - follower->bstate |= BUTTON3_TRIPLE_CLICKED; - merge = TRUE; + for (b = 1; b <= MAX_BUTTONS; ++b) { + if ((eventmask & MASK_TRIPLE_CLICK(b)) + && (follower->bstate & MASK_CLICK(b))) { + follower->bstate &= ~MASK_CLICK(b); + follower->bstate |= MASK_TRIPLE_CLICK(b); + merge = TRUE; + } } if (merge) ep->id = INVALID_EVENT; @@ -1050,7 +1145,7 @@ _nc_mouse_parse(int runcount) } static void -_nc_mouse_wrap(SCREEN * sp GCC_UNUSED) +_nc_mouse_wrap(SCREEN *sp GCC_UNUSED) /* release mouse -- called by endwin() before shellout/exit */ { TR(MY_TRACE, ("_nc_mouse_wrap() called")); @@ -1063,6 +1158,8 @@ _nc_mouse_wrap(SCREEN * sp GCC_UNUSED) #if USE_GPM_SUPPORT /* GPM: pass all mouse events to next client */ case M_GPM: + if (eventmask) + mouse_activate(FALSE); break; #endif #if USE_SYSMOUSE @@ -1076,7 +1173,7 @@ _nc_mouse_wrap(SCREEN * sp GCC_UNUSED) } static void -_nc_mouse_resume(SCREEN * sp GCC_UNUSED) +_nc_mouse_resume(SCREEN *sp GCC_UNUSED) /* re-connect to mouse -- called by doupdate() after shellout */ { TR(MY_TRACE, ("_nc_mouse_resume() called")); @@ -1091,6 +1188,8 @@ _nc_mouse_resume(SCREEN * sp GCC_UNUSED) #if USE_GPM_SUPPORT case M_GPM: /* GPM: reclaim our event set */ + if (eventmask) + mouse_activate(TRUE); break; #endif @@ -1155,7 +1254,7 @@ mousemask(mmask_t newmask, mmask_t * oldmask) { mmask_t result = 0; - T((T_CALLED("mousemask(%#lx,%p)"), newmask, oldmask)); + T((T_CALLED("mousemask(%#lx,%p)"), (unsigned long) newmask, oldmask)); if (oldmask) *oldmask = eventmask; @@ -1164,15 +1263,14 @@ mousemask(mmask_t newmask, mmask_t * oldmask) returnBits(0); _nc_mouse_init(); - if (SP->_mouse_type != M_NONE) { + if (SP != 0 && SP->_mouse_type != M_NONE) { eventmask = newmask & (REPORT_MOUSE_POSITION | BUTTON_ALT | BUTTON_CTRL | BUTTON_SHIFT | BUTTON_PRESSED | BUTTON_RELEASED | BUTTON_CLICKED - | BUTTON1_DOUBLE_CLICKED | BUTTON1_TRIPLE_CLICKED - | BUTTON2_DOUBLE_CLICKED | BUTTON2_TRIPLE_CLICKED - | BUTTON3_DOUBLE_CLICKED | BUTTON3_TRIPLE_CLICKED); + | BUTTON_DOUBLE_CLICKED + | BUTTON_TRIPLE_CLICKED); mouse_activate(eventmask != 0); diff --git a/ncurses/base/lib_move.c b/ncurses/base/lib_move.c index e917eb78..652c44d7 100644 --- a/ncurses/base/lib_move.c +++ b/ncurses/base/lib_move.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -40,16 +41,14 @@ #include -MODULE_ID("$Id: lib_move.c,v 1.11 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_move.c,v 1.12 2004/12/04 21:50:07 tom Exp $") NCURSES_EXPORT(int) wmove(WINDOW *win, int y, int x) { T((T_CALLED("wmove(%p,%d,%d)"), win, y, x)); - if (win && - x >= 0 && x <= win->_maxx && - y >= 0 && y <= win->_maxy) { + if (LEGALYX(win, y, x)) { win->_curx = (NCURSES_SIZE_T) x; win->_cury = (NCURSES_SIZE_T) y; diff --git a/ncurses/base/lib_newterm.c b/ncurses/base/lib_newterm.c index 41bbc4ee..ad7b122b 100644 --- a/ncurses/base/lib_newterm.c +++ b/ncurses/base/lib_newterm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -47,7 +48,7 @@ #include /* clear_screen, cup & friends, cur_term */ #include -MODULE_ID("$Id: lib_newterm.c,v 1.57 2002/10/20 00:10:56 Philippe.Blain Exp $") +MODULE_ID("$Id: lib_newterm.c,v 1.58 2004/08/14 20:36:39 tom Exp $") #ifndef ONLCR /* Allows compilation under the QNX 4.2 OS */ #define ONLCR 0 @@ -102,7 +103,7 @@ filter(void) } NCURSES_EXPORT(SCREEN *) -newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) +newterm(NCURSES_CONST char *name, FILE *ofp, FILE *ifp) { int errret; int slk_format = _nc_slk_format; @@ -198,5 +199,13 @@ newterm(NCURSES_CONST char *name, FILE * ofp, FILE * ifp) _nc_signal_handler(TRUE); +#if USE_SIZECHANGE + /* + * Pretend we received a SIGWINCH, just in case we're starting up in a + * terminal that cannot initialize its size properly (Debian #265631). + */ + SP->_sig_winch = TRUE; +#endif + returnSP(SP); } diff --git a/ncurses/base/lib_newwin.c b/ncurses/base/lib_newwin.c index aa8959ca..c0980ad5 100644 --- a/ncurses/base/lib_newwin.c +++ b/ncurses/base/lib_newwin.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -40,7 +41,7 @@ #include -MODULE_ID("$Id: lib_newwin.c,v 1.34 2002/08/18 00:12:30 tom Exp $") +MODULE_ID("$Id: lib_newwin.c,v 1.36 2005/04/09 15:23:04 tom Exp $") static WINDOW * remove_window_from_screen(WINDOW *win) @@ -120,9 +121,6 @@ newwin(int num_lines, int num_columns, int begy, int begx) if (num_columns == 0) num_columns = screen_columns - begx; - if (num_columns + begx > SP->_columns || num_lines + begy > SP->_lines_avail) - returnWin(0); - if ((win = _nc_makenew(num_lines, num_columns, begy, begx, 0)) == 0) returnWin(0); @@ -212,6 +210,9 @@ _nc_makenew(int num_lines, int num_columns, int begy, int begx, int flags) T(("_nc_makenew(%d,%d,%d,%d)", num_lines, num_columns, begy, begx)); + if (SP == 0) + return 0; + if (!dimension_limit(num_lines) || !dimension_limit(num_columns)) return 0; diff --git a/ncurses/base/lib_pad.c b/ncurses/base/lib_pad.c index 97b2d357..67adbf6d 100644 --- a/ncurses/base/lib_pad.c +++ b/ncurses/base/lib_pad.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -40,7 +40,7 @@ #include -MODULE_ID("$Id: lib_pad.c,v 1.38 2002/08/03 23:29:26 Philippe.Blain Exp $") +MODULE_ID("$Id: lib_pad.c,v 1.39 2004/10/23 18:48:09 tom Exp $") NCURSES_EXPORT(WINDOW *) newpad(int l, int c) @@ -202,7 +202,7 @@ pnoutrefresh */ if (j == pmincol && j > 0 - && isnac(ch)) { + && isWidecExt(ch)) { SetChar(ch, L(' '), AttrOf(oline->text[j - 1])); } #endif diff --git a/ncurses/base/lib_printw.c b/ncurses/base/lib_printw.c index 03ec6429..7cccf563 100644 --- a/ncurses/base/lib_printw.c +++ b/ncurses/base/lib_printw.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -39,7 +39,7 @@ #include -MODULE_ID("$Id: lib_printw.c,v 1.15 2003/02/08 20:50:13 tom Exp $") +MODULE_ID("$Id: lib_printw.c,v 1.16 2005/06/11 19:30:51 tom Exp $") NCURSES_EXPORT(int) printw(const char *fmt,...) @@ -129,8 +129,7 @@ vwprintw(WINDOW *win, const char *fmt, va_list argp) char *buf; int code = ERR; - T((T_CALLED("vwprintw(%p,%s,%p)"), - win, _nc_visbuf(fmt), argp)); + T((T_CALLED("vwprintw(%p,%s,va_list)"), win, _nc_visbuf(fmt))); if ((buf = _nc_printf_string(fmt, argp)) != 0) { code = waddstr(win, buf); diff --git a/ncurses/base/lib_refresh.c b/ncurses/base/lib_refresh.c index e5908a39..5d8eab54 100644 --- a/ncurses/base/lib_refresh.c +++ b/ncurses/base/lib_refresh.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -40,7 +41,7 @@ #include -MODULE_ID("$Id: lib_refresh.c,v 1.32 2002/05/26 00:17:04 tom Exp $") +MODULE_ID("$Id: lib_refresh.c,v 1.33 2005/04/09 15:20:58 tom Exp $") NCURSES_EXPORT(int) wrefresh(WINDOW *win) @@ -49,7 +50,9 @@ wrefresh(WINDOW *win) T((T_CALLED("wrefresh(%p)"), win)); - if (win == curscr) { + if (win == 0) { + code = ERR; + } else if (win == curscr) { curscr->_clear = TRUE; code = doupdate(); } else if ((code = wnoutrefresh(win)) == OK) { diff --git a/ncurses/base/lib_scroll.c b/ncurses/base/lib_scroll.c index f8e16baf..ec462c9e 100644 --- a/ncurses/base/lib_scroll.c +++ b/ncurses/base/lib_scroll.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2001,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -43,11 +43,14 @@ #include -MODULE_ID("$Id: lib_scroll.c,v 1.24 2003/07/26 23:25:26 tom Exp $") +MODULE_ID("$Id: lib_scroll.c,v 1.25 2004/12/11 18:28:51 tom Exp $") NCURSES_EXPORT(void) -_nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, - NCURSES_SIZE_T const bottom, NCURSES_CH_T blank) +_nc_scroll_window(WINDOW *win, + int const n, + NCURSES_SIZE_T const top, + NCURSES_SIZE_T const bottom, + NCURSES_CH_T blank) { int limit; int line; @@ -110,6 +113,22 @@ _nc_scroll_window(WINDOW *win, int const n, NCURSES_SIZE_T const top, } } touchline(win, top, bottom - top + 1); + + if_WIDEC({ + if (WINDOW_EXT(win, addch_used) != 0) { + int next = WINDOW_EXT(win, addch_y) + n; + if (next < 0 || next > win->_maxy) { + TR(TRACE_VIRTPUT, + ("Alert discarded multibyte on scroll")); + WINDOW_EXT(win, addch_y) = 0; + } else { + TR(TRACE_VIRTPUT, ("scrolled working position to %d,%d", + WINDOW_EXT(win, addch_y), + WINDOW_EXT(win, addch_x))); + WINDOW_EXT(win, addch_y) = next; + } + } + }) } NCURSES_EXPORT(int) diff --git a/ncurses/base/lib_set_term.c b/ncurses/base/lib_set_term.c index 91f82767..0d5471e1 100644 --- a/ncurses/base/lib_set_term.c +++ b/ncurses/base/lib_set_term.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * - * and: Thomas E. Dickey 1996-2003 * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -44,10 +44,10 @@ #include /* cur_term */ #include -MODULE_ID("$Id: lib_set_term.c,v 1.81 2003/11/15 23:57:01 tom Exp $") +MODULE_ID("$Id: lib_set_term.c,v 1.85 2005/01/22 17:36:01 tom Exp $") NCURSES_EXPORT(SCREEN *) -set_term(SCREEN * screenp) +set_term(SCREEN *screenp) { SCREEN *oldSP; @@ -81,7 +81,7 @@ _nc_free_keytry(struct tries *kt) * Free the storage associated with the given SCREEN sp. */ NCURSES_EXPORT(void) -delscreen(SCREEN * sp) +delscreen(SCREEN *sp) { SCREEN **scan = &_nc_screen_chain; int i; @@ -118,6 +118,8 @@ delscreen(SCREEN * sp) _nc_free_keytry(sp->_key_ok); sp->_key_ok = 0; + FreeIfNeeded(sp->_current_attr); + FreeIfNeeded(sp->_color_table); FreeIfNeeded(sp->_color_pairs); @@ -162,13 +164,13 @@ static ripoff_t *rsp = rippedoff; #define N_RIPS SIZEOF(SP->_rippedoff) static bool -no_mouse_event(SCREEN * sp GCC_UNUSED) +no_mouse_event(SCREEN *sp GCC_UNUSED) { return FALSE; } static bool -no_mouse_inline(SCREEN * sp GCC_UNUSED) +no_mouse_inline(SCREEN *sp GCC_UNUSED) { return FALSE; } @@ -180,12 +182,12 @@ no_mouse_parse(int code GCC_UNUSED) } static void -no_mouse_resume(SCREEN * sp GCC_UNUSED) +no_mouse_resume(SCREEN *sp GCC_UNUSED) { } static void -no_mouse_wrap(SCREEN * sp GCC_UNUSED) +no_mouse_wrap(SCREEN *sp GCC_UNUSED) { } @@ -221,9 +223,13 @@ _nc_setupscreen(short slines, short const scolumns, FILE *output) if (!_nc_alloc_screen()) returnCode(ERR); + T(("created SP %p", SP)); SP->_next_screen = _nc_screen_chain; _nc_screen_chain = SP; + if ((SP->_current_attr = typeCalloc(NCURSES_CH_T, 1)) == 0) + returnCode(ERR); + #ifdef __DJGPP__ T(("setting output mode to binary")); fflush(output); @@ -392,9 +398,9 @@ _nc_setupscreen(short slines, short const scolumns, FILE *output) SP->_screen_acs_fix = (_nc_unicode_locale() && _nc_locale_breaks_acs()); { char *env = _nc_get_locale(); - SP->_posix_locale = ((env == 0) - || !strcmp(env, "C") - || !strcmp(env, "POSIX")); + SP->_legacy_coding = ((env == 0) + || !strcmp(env, "C") + || !strcmp(env, "POSIX")); } #endif diff --git a/ncurses/base/lib_slk.c b/ncurses/base/lib_slk.c index 4bdf8afc..5609e3b5 100644 --- a/ncurses/base/lib_slk.c +++ b/ncurses/base/lib_slk.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,8 +27,12 @@ ****************************************************************************/ /**************************************************************************** - * Author: Zeyd M. Ben-Halim 1992,1995 * - * and: Eric S. Raymond * + * Authors: * + * Gerhard Fuernkranz 1993 (original) * + * Zeyd M. Ben-Halim 1992,1995 (sic) * + * Eric S. Raymond * + * Juergen Pfeifer 1996-on * + * Thomas E. Dickey * ****************************************************************************/ /* @@ -41,7 +45,7 @@ #include #include /* num_labels, label_*, plab_norm */ -MODULE_ID("$Id: lib_slk.c,v 1.28 2003/05/24 21:10:28 tom Exp $") +MODULE_ID("$Id: lib_slk.c,v 1.30 2005/01/08 21:56:36 tom Exp $") /* * We'd like to move these into the screen context structure, but cannot, @@ -109,9 +113,9 @@ _nc_slk_initialize(WINDOW *stwin, int cols) * work. */ if ((no_color_video & 1) == 0) - SP->_slk->attr = A_STANDOUT; + SetAttr(SP->_slk->attr, A_STANDOUT); else - SP->_slk->attr = A_REVERSE; + SetAttr(SP->_slk->attr, A_REVERSE); SP->_slk->maxlab = ((num_labels > 0) ? num_labels @@ -131,14 +135,15 @@ _nc_slk_initialize(WINDOW *stwin, int cols) max_length = SP->_slk->maxlen; for (i = 0; i < SP->_slk->labcnt; i++) { + size_t used = max_length + 1; - if ((SP->_slk->ent[i].ent_text = (char *)_nc_doalloc(0, max_length + 1)) == 0) + if ((SP->_slk->ent[i].ent_text = (char *) _nc_doalloc(0, used)) == 0) returnCode(slk_failed()); - memset(SP->_slk->ent[i].ent_text, 0, max_length + 1); + memset(SP->_slk->ent[i].ent_text, 0, used); - if ((SP->_slk->ent[i].form_text = (char *)_nc_doalloc(0, max_length + 1)) == 0) + if ((SP->_slk->ent[i].form_text = (char *) _nc_doalloc(0, used)) == 0) returnCode(slk_failed()); - memset(SP->_slk->ent[i].form_text, 0, max_length + 1); + memset(SP->_slk->ent[i].form_text, 0, used); memset(SP->_slk->ent[i].form_text, ' ', max_length); SP->_slk->ent[i].visible = (i < SP->_slk->maxlab); diff --git a/ncurses/base/lib_slkatr_set.c b/ncurses/base/lib_slkatr_set.c index 45cc89cb..3bff940a 100644 --- a/ncurses/base/lib_slkatr_set.c +++ b/ncurses/base/lib_slkatr_set.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -28,27 +28,31 @@ /**************************************************************************** * Author: Juergen Pfeifer, 1998 * + * and: Thomas E. Dickey 2005 * ****************************************************************************/ /* * lib_slkatr_set.c * Soft key routines. - * Set the labels attributes + * Set the label's attributes */ #include -MODULE_ID("$Id: lib_slkatr_set.c,v 1.7 2003/10/25 15:27:03 tom Exp $") +MODULE_ID("$Id: lib_slkatr_set.c,v 1.9 2005/01/08 22:59:37 tom Exp $") NCURSES_EXPORT(int) -slk_attr_set -(const attr_t attr, short color_pair_number, void *opts) +slk_attr_set(const attr_t attr, short color_pair_number, void *opts) { T((T_CALLED("slk_attr_set(%s,%d)"), _traceattr(attr), color_pair_number)); if (SP != 0 && SP->_slk != 0 && !opts && color_pair_number >= 0 && color_pair_number < COLOR_PAIRS) { - SP->_slk->attr = attr; - toggle_attr_on(SP->_slk->attr, COLOR_PAIR(color_pair_number)); + TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP->_slk->attr)))); + SetAttr(SP->_slk->attr, attr); + if (color_pair_number > 0) { + SetPair(SP->_slk->attr, color_pair_number); + } + TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP->_slk->attr)))); returnCode(OK); } else returnCode(ERR); diff --git a/ncurses/base/lib_slkatrof.c b/ncurses/base/lib_slkatrof.c index c271c342..14b4c3bf 100644 --- a/ncurses/base/lib_slkatrof.c +++ b/ncurses/base/lib_slkatrof.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,8 +27,8 @@ ****************************************************************************/ /**************************************************************************** - * Author: Zeyd M. Ben-Halim 1992,1995 * - * and: Eric S. Raymond * + * Author: Juergen Pfeifer, 1997 * + * and: Thomas E. Dickey 2005 * ****************************************************************************/ /* @@ -38,7 +38,7 @@ */ #include -MODULE_ID("$Id: lib_slkatrof.c,v 1.6 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_slkatrof.c,v 1.8 2005/01/08 23:01:32 tom Exp $") NCURSES_EXPORT(int) slk_attroff(const chtype attr) @@ -46,7 +46,12 @@ slk_attroff(const chtype attr) T((T_CALLED("slk_attroff(%s)"), _traceattr(attr))); if (SP != 0 && SP->_slk != 0) { - toggle_attr_off(SP->_slk->attr, attr); + TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP->_slk->attr)))); + RemAttr(SP->_slk->attr, attr); + if ((attr & A_COLOR) != 0) { + SetPair(SP->_slk->attr, 0); + } + TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP->_slk->attr)))); returnCode(OK); } else returnCode(ERR); diff --git a/ncurses/base/lib_slkatron.c b/ncurses/base/lib_slkatron.c index d174b039..90add86d 100644 --- a/ncurses/base/lib_slkatron.c +++ b/ncurses/base/lib_slkatron.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,8 +27,8 @@ ****************************************************************************/ /**************************************************************************** - * Author: Zeyd M. Ben-Halim 1992,1995 * - * and: Eric S. Raymond * + * Author: Juergen Pfeifer, 1997 * + * and: Thomas E. Dickey 2005 * ****************************************************************************/ /* @@ -38,7 +38,7 @@ */ #include -MODULE_ID("$Id: lib_slkatron.c,v 1.6 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_slkatron.c,v 1.8 2005/01/08 23:02:01 tom Exp $") NCURSES_EXPORT(int) slk_attron(const chtype attr) @@ -46,7 +46,12 @@ slk_attron(const chtype attr) T((T_CALLED("slk_attron(%s)"), _traceattr(attr))); if (SP != 0 && SP->_slk != 0) { - toggle_attr_on(SP->_slk->attr, attr); + TR(TRACE_ATTRS, ("... current %s", _tracech_t(CHREF(SP->_slk->attr)))); + AddAttr(SP->_slk->attr, attr); + if ((attr & A_COLOR) != 0) { + SetPair(SP->_slk->attr, PAIR_NUMBER(attr)); + } + TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP->_slk->attr)))); returnCode(OK); } else returnCode(ERR); diff --git a/ncurses/base/lib_slkatrset.c b/ncurses/base/lib_slkatrset.c index cda74cad..8da9981b 100644 --- a/ncurses/base/lib_slkatrset.c +++ b/ncurses/base/lib_slkatrset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,8 +27,8 @@ ****************************************************************************/ /**************************************************************************** - * Author: Zeyd M. Ben-Halim 1992,1995 * - * and: Eric S. Raymond * + * Author: Juergen Pfeifer, 1997 * + * and: Thomas E. Dickey 2005 * ****************************************************************************/ /* @@ -38,7 +38,7 @@ */ #include -MODULE_ID("$Id: lib_slkatrset.c,v 1.6 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_slkatrset.c,v 1.7 2005/01/08 21:46:47 tom Exp $") NCURSES_EXPORT(int) slk_attrset(const chtype attr) @@ -46,7 +46,7 @@ slk_attrset(const chtype attr) T((T_CALLED("slk_attrset(%s)"), _traceattr(attr))); if (SP != 0 && SP->_slk != 0) { - SP->_slk->attr = attr; + SetAttr(SP->_slk->attr, attr); returnCode(OK); } else returnCode(ERR); diff --git a/ncurses/base/lib_slkattr.c b/ncurses/base/lib_slkattr.c index 5044a08d..da82ee5b 100644 --- a/ncurses/base/lib_slkattr.c +++ b/ncurses/base/lib_slkattr.c @@ -27,8 +27,8 @@ ****************************************************************************/ /**************************************************************************** - * Author: Zeyd M. Ben-Halim 1992,1995 * - * and: Eric S. Raymond * + * Author: Juergen Pfeifer, 1997 * + * and: Thomas E. Dickey 2005 * ****************************************************************************/ /* @@ -38,7 +38,7 @@ */ #include -MODULE_ID("$Id: lib_slkattr.c,v 1.5 2000/12/10 02:43:27 tom Exp $") +MODULE_ID("$Id: lib_slkattr.c,v 1.6 2005/01/08 21:44:28 tom Exp $") NCURSES_EXPORT(attr_t) slk_attr(void) @@ -46,7 +46,11 @@ slk_attr(void) T((T_CALLED("slk_attr()"))); if (SP != 0 && SP->_slk != 0) { - returnAttr(SP->_slk->attr); + attr_t result = AttrOf(SP->_slk->attr) & ALL_BUT_COLOR; + int pair = GetPair(SP->_slk->attr); + + result |= COLOR_PAIR(pair); + returnAttr(result); } else returnAttr(0); } diff --git a/ncurses/base/lib_slkcolor.c b/ncurses/base/lib_slkcolor.c index d7af4a25..b677b65a 100644 --- a/ncurses/base/lib_slkcolor.c +++ b/ncurses/base/lib_slkcolor.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -28,14 +28,17 @@ /**************************************************************************** * Author: Juergen Pfeifer, 1998 * + * and: Thomas E. Dickey 2005 * ****************************************************************************/ /* * lib_slkcolor.c + * Soft key routines. + * Set the label's color */ #include -MODULE_ID("$Id: lib_slkcolor.c,v 1.9 2003/10/25 15:27:03 tom Exp $") +MODULE_ID("$Id: lib_slkcolor.c,v 1.12 2005/01/28 21:11:53 tom Exp $") NCURSES_EXPORT(int) slk_color(short color_pair_number) @@ -44,8 +47,9 @@ slk_color(short color_pair_number) if (SP != 0 && SP->_slk != 0 && color_pair_number >= 0 && color_pair_number < COLOR_PAIRS) { - T(("... current %ld", (long) PAIR_NUMBER(SP->_slk->attr))); - toggle_attr_on(SP->_slk->attr, COLOR_PAIR(color_pair_number)); + TR(TRACE_ATTRS, ("... current is %s", _tracech_t(CHREF(SP->_slk->attr)))); + SetPair(SP->_slk->attr, color_pair_number); + TR(TRACE_ATTRS, ("new attribute is %s", _tracech_t(CHREF(SP->_slk->attr)))); returnCode(OK); } else returnCode(ERR); diff --git a/ncurses/base/lib_slkrefr.c b/ncurses/base/lib_slkrefr.c index 9040cc04..19f36403 100644 --- a/ncurses/base/lib_slkrefr.c +++ b/ncurses/base/lib_slkrefr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,8 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Juergen Pfeifer 1996-on * + * and: Thomas E. Dickey * ****************************************************************************/ /* @@ -38,7 +40,7 @@ #include #include /* num_labels, label_*, plab_norm */ -MODULE_ID("$Id: lib_slkrefr.c,v 1.11 2003/03/29 22:53:48 tom Exp $") +MODULE_ID("$Id: lib_slkrefr.c,v 1.13 2005/01/08 21:46:31 tom Exp $") /* * Write the soft labels to the soft-key window. @@ -59,10 +61,10 @@ slk_intern_refresh(SLK * slk) } } else { wmove(slk->win, SLK_LINES(fmt) - 1, slk->ent[i].ent_x); - if (SP && SP->_slk) - wattrset(slk->win, SP->_slk->attr); - waddnstr(slk->win, slk->ent[i].form_text, - MAX_SKEY_LEN(fmt)); + if (SP && SP->_slk) { + wattrset(slk->win, AttrOf(SP->_slk->attr)); + } + waddstr(slk->win, slk->ent[i].form_text); /* if we simulate SLK's, it's looking much more natural to use the current ATTRIBUTE also for the label window */ diff --git a/ncurses/base/lib_slkset.c b/ncurses/base/lib_slkset.c index 595a8ad1..47ef3823 100644 --- a/ncurses/base/lib_slkset.c +++ b/ncurses/base/lib_slkset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,8 +27,8 @@ ****************************************************************************/ /**************************************************************************** - * Author: Zeyd M. Ben-Halim 1992,1995 * - * and: Eric S. Raymond * + * Author: Juergen Pfeifer * + * and: Thomas E. Dickey * ****************************************************************************/ /* @@ -38,14 +38,20 @@ #include #include -MODULE_ID("$Id: lib_slkset.c,v 1.10 2003/04/12 21:32:16 tom Exp $") +#if USE_WIDEC_SUPPORT +#include +#endif + +MODULE_ID("$Id: lib_slkset.c,v 1.15 2005/04/16 17:47:34 tom Exp $") NCURSES_EXPORT(int) slk_set(int i, const char *astr, int format) { SLK *slk = SP->_slk; - size_t len; int offset; + int numchrs; + int numcols; + int limit; const char *str = astr; const char *p; @@ -55,24 +61,53 @@ slk_set(int i, const char *astr, int format) returnCode(ERR); if (str == NULL) str = ""; + --i; /* Adjust numbering of labels */ + limit = MAX_SKEY_LEN(SP->slk_format); while (isspace(UChar(*str))) str++; /* skip over leading spaces */ p = str; + +#if USE_WIDEC_SUPPORT + numcols = 0; + while (*p != 0) { + mbstate_t state; + wchar_t wc; + size_t need; + + init_mb(state); + need = mbrtowc(0, p, strlen(p), &state); + if (need == (size_t) -1) + break; + mbrtowc(&wc, p, need, &state); + if (!iswprint((wint_t) wc)) + break; + if (wcwidth(wc) + numcols > limit) + break; + numcols += wcwidth(wc); + p += need; + } + numchrs = (p - str); +#else while (isprint(UChar(*p))) p++; /* The first non-print stops */ - --i; /* Adjust numbering of labels */ + numcols = (p - str); + if (numcols > limit) + numcols = limit; + numchrs = numcols; +#endif - len = (size_t) (p - str); - if (len > (size_t) slk->maxlen) - len = slk->maxlen; - if (len == 0) - slk->ent[i].ent_text[0] = 0; - else - strncpy(slk->ent[i].ent_text, str, len)[len] = 0; - memset(slk->ent[i].form_text, ' ', (unsigned) slk->maxlen); - slk->ent[i].ent_text[slk->maxlen] = 0; + FreeIfNeeded(slk->ent[i].ent_text); + if ((slk->ent[i].ent_text = strdup(str)) == 0) + returnCode(ERR); + slk->ent[i].ent_text[numchrs] = '\0'; + + if ((slk->ent[i].form_text = (char *) _nc_doalloc(slk->ent[i].form_text, + (unsigned) (limit + + numchrs + 1)) + ) == 0) + returnCode(ERR); switch (format) { default: @@ -80,16 +115,28 @@ slk_set(int i, const char *astr, int format) offset = 0; break; case 1: /* centered */ - offset = (slk->maxlen - len) / 2; + offset = (limit - numcols) / 2; break; case 2: /* right-justified */ - offset = slk->maxlen - len; + offset = limit - numcols; break; } + if (offset <= 0) + offset = 0; + else + memset(slk->ent[i].form_text, ' ', (unsigned) offset); + memcpy(slk->ent[i].form_text + offset, slk->ent[i].ent_text, - len); - slk->ent[i].form_text[slk->maxlen] = 0; + (unsigned) numchrs); + + if (offset < limit) { + memset(slk->ent[i].form_text + offset + numchrs, + ' ', + (unsigned) (limit - (offset + numcols))); + } + + slk->ent[i].form_text[numchrs - numcols + limit] = 0; slk->ent[i].dirty = TRUE; returnCode(OK); } diff --git a/ncurses/base/lib_wattroff.c b/ncurses/base/lib_wattroff.c index 2cfe6947..9ac331ae 100644 --- a/ncurses/base/lib_wattroff.c +++ b/ncurses/base/lib_wattroff.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -41,14 +42,18 @@ #include #include -MODULE_ID("$Id: lib_wattroff.c,v 1.7 2002/07/20 17:07:16 tom Exp $") +MODULE_ID("$Id: lib_wattroff.c,v 1.8 2005/01/29 21:20:03 tom Exp $") NCURSES_EXPORT(int) wattr_off(WINDOW *win, attr_t at, void *opts GCC_UNUSED) { T((T_CALLED("wattr_off(%p,%s)"), win, _traceattr(at))); if (win) { - T(("... current %s", _traceattr(win->_attrs))); + T(("... current %s (%d)", _traceattr(win->_attrs), GET_WINDOW_PAIR(win))); + if_EXT_COLORS({ + if (at & A_COLOR) + win->_color = 0; + }); toggle_attr_off(win->_attrs, at); returnCode(OK); } else diff --git a/ncurses/base/lib_wattron.c b/ncurses/base/lib_wattron.c index 5d1a6a9d..1d3b24a7 100644 --- a/ncurses/base/lib_wattron.c +++ b/ncurses/base/lib_wattron.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -41,14 +42,18 @@ #include #include -MODULE_ID("$Id: lib_wattron.c,v 1.7 2002/07/20 17:07:16 tom Exp $") +MODULE_ID("$Id: lib_wattron.c,v 1.8 2005/01/29 21:23:08 tom Exp $") NCURSES_EXPORT(int) wattr_on(WINDOW *win, attr_t at, void *opts GCC_UNUSED) { T((T_CALLED("wattr_on(%p,%s)"), win, _traceattr(at))); - if (win) { - T(("... current %s", _traceattr(win->_attrs))); + if (win != 0) { + T(("... current %s (%d)", _traceattr(win->_attrs), GET_WINDOW_PAIR(win))); + if_EXT_COLORS({ + if (at & A_COLOR) + win->_color = PAIR_NUMBER(at); + }); toggle_attr_on(win->_attrs, at); returnCode(OK); } else diff --git a/ncurses/base/resizeterm.c b/ncurses/base/resizeterm.c index e5b852c7..09ba6007 100644 --- a/ncurses/base/resizeterm.c +++ b/ncurses/base/resizeterm.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -41,18 +41,40 @@ #include #include -MODULE_ID("$Id: resizeterm.c,v 1.15 2002/12/28 01:21:34 tom Exp $") +MODULE_ID("$Id: resizeterm.c,v 1.17 2004/07/31 20:24:38 tom Exp $") #define stolen_lines (screen_lines - SP->_lines_avail) static int current_lines; static int current_cols; +#ifdef TRACE +static void +show_window_sizes(const char *name) +{ + WINDOWLIST *wp; + + _tracef("%s resizing: %2d x %2d (%2d x %2d)", name, LINES, COLS, + screen_lines, screen_columns); + for (wp = _nc_windows; wp != 0; wp = wp->next) { + _tracef(" window %p is %2d x %2d at %2d,%2d", + &(wp->win), + wp->win._maxy + 1, + wp->win._maxx + 1, + wp->win._begy, + wp->win._begx); + } +} +#endif + NCURSES_EXPORT(bool) is_term_resized(int ToLines, int ToCols) { - return (ToLines != screen_lines - || ToCols != screen_columns); + T((T_CALLED("is_term_resized(%d, %d)"), ToLines, ToCols)); + returnCode(ToLines > 0 + && ToCols > 0 + && (ToLines != screen_lines + || ToCols != screen_columns)); } /* @@ -162,6 +184,7 @@ decrease_size(int ToLines, int ToCols, int stolen) if (!(win->_flags & _ISPAD)) { if (child_depth(win) == depth) { + found = TRUE; if (adjust_window(win, ToLines, ToCols, stolen) != OK) returnCode(ERR); } @@ -194,6 +217,7 @@ increase_size(int ToLines, int ToCols, int stolen) if (!(win->_flags & _ISPAD)) { if (parent_depth(win) == depth) { + found = TRUE; if (adjust_window(win, ToLines, ToCols, stolen) != OK) returnCode(ERR); } @@ -222,6 +246,10 @@ resize_term(int ToLines, int ToCols) int myLines = current_lines = screen_lines; int myCols = current_cols = screen_columns; +#ifdef TRACE + if (_nc_tracing & TRACE_UPDATE) + show_window_sizes("before"); +#endif if (ToLines > screen_lines) { increase_size(myLines = ToLines, myCols, was_stolen); current_lines = myLines; @@ -250,6 +278,13 @@ resize_term(int ToLines, int ToCols) if (SP->newhash) { FreeAndNull(SP->newhash); } +#ifdef TRACE + if (_nc_tracing & TRACE_UPDATE) { + LINES = ToLines - was_stolen; + COLS = ToCols; + show_window_sizes("after"); + } +#endif } /* diff --git a/ncurses/base/tries.c b/ncurses/base/tries.c index 3ae47898..7e60e2c8 100644 --- a/ncurses/base/tries.c +++ b/ncurses/base/tries.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -39,7 +39,7 @@ #include -MODULE_ID("$Id: tries.c,v 1.19 2003/05/17 23:11:24 tom Exp $") +MODULE_ID("$Id: tries.c,v 1.20 2005/04/30 19:14:18 tom Exp $") /* * Expand a keycode into the string that it corresponds to, returning null if @@ -71,7 +71,7 @@ _nc_expand_try(struct tries *tree, unsigned short code, int *count, size_t len) if ((result[len] = ptr->ch) == 0) *((unsigned char *) (result + len)) = 128; #ifdef TRACE - if (len == 0) + if (len == 0 && _nc_tracing != 0) _tracef("expand_key %s %s", _tracechar(code), _nc_visbuf(result)); #endif } diff --git a/ncurses/base/version.c b/ncurses/base/version.c index 6e7a9870..ef83967d 100644 --- a/ncurses/base/version.c +++ b/ncurses/base/version.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999-2000,2004 Free Software Foundation, Inc. * + * Copyright (c) 1999-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,11 +32,11 @@ #include -MODULE_ID("$Id: version.c,v 1.5 2004/01/10 21:18:17 tom Exp $") +MODULE_ID("$Id: version.c,v 1.6 2005/01/02 01:23:54 tom Exp $") NCURSES_EXPORT(const char *) curses_version(void) { T((T_CALLED("curses_version()"))); - returnPtr("ncurses " NCURSES_VERSION_STRING); + returnCPtr("ncurses " NCURSES_VERSION_STRING); } diff --git a/ncurses/base/vsscanf.c b/ncurses/base/vsscanf.c index 4d082ee4..e6253c3a 100644 --- a/ncurses/base/vsscanf.c +++ b/ncurses/base/vsscanf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -38,7 +38,7 @@ #if !HAVE_VSSCANF -MODULE_ID("$Id: vsscanf.c,v 1.17 2003/05/24 21:10:28 tom Exp $") +MODULE_ID("$Id: vsscanf.c,v 1.18 2004/04/03 20:27:02 tom Exp $") #if !(HAVE_VFSCANF || HAVE__DOSCAN) @@ -271,7 +271,7 @@ vsscanf(const char *str, const char *format, va_list ap) chunk = ctest; } else if ((otest = other_ch(format[n])) != oUnknown) { other = otest; - } else if (isalpha(format[n])) { + } else if (isalpha(UChar(format[n]))) { state = sFinal; chunk = cError; } diff --git a/ncurses/curses.priv.h b/ncurses/curses.priv.h index 12492b27..93bf4497 100644 --- a/ncurses/curses.priv.h +++ b/ncurses/curses.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,12 +29,12 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * - * and: Thomas E. Dickey 1996-2002 * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* - * $Id: curses.priv.h,v 1.255 2004/02/01 01:05:58 Stanislav.Ievlev Exp $ + * $Id: curses.priv.h,v 1.286 2005/09/10 22:34:50 tom Exp $ * * curses.priv.h * @@ -78,6 +78,11 @@ extern "C" { # include #endif +#include +#include + +#include + #ifndef PATH_MAX # if defined(_POSIX_PATH_MAX) # define PATH_MAX _POSIX_PATH_MAX @@ -88,11 +93,6 @@ extern "C" { # endif #endif -#include -#include - -#include - #if DECL_ERRNO extern int errno; #endif @@ -209,14 +209,6 @@ struct tries { unsigned short value; /* code of string so far. 0 if none. */ }; -/* - * Definitions for color pairs - */ -#define C_SHIFT 8 /* we need more bits than there are colors */ -#define C_MASK ((1 << C_SHIFT) - 1) - -#define PAIR_OF(fg, bg) ((((fg) & C_MASK) << C_SHIFT) | ((bg) & C_MASK)) - /* * Common/troublesome character definitions */ @@ -258,7 +250,56 @@ color_t; #include /* we'll use -Ipath directive to get the right one! */ #include +#include + +#if NCURSES_EXT_COLORS && USE_WIDEC_SUPPORT +#define if_EXT_COLORS(stmt) stmt +#define NetPair(value,p) (value).ext_color = (p), \ + AttrOf(value) &= ALL_BUT_COLOR, \ + AttrOf(value) |= (A_COLOR & COLOR_PAIR((p > 255) ? 255 : p)) +#define SetPair(value,p) (value).ext_color = (p) +#define GetPair(value) (value).ext_color +#define unColor(n) (AttrOf(n) & ALL_BUT_COLOR) +#define GET_WINDOW_PAIR(w) (w)->_color +#define SET_WINDOW_PAIR(w,p) (w)->_color = (p) +#define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b) && GetPair(a) == GetPair(b)) +#define VIDATTR(attr, pair) vid_attr(attr, pair, 0) +#else +#define if_EXT_COLORS(stmt) /* nothing */ +#define SetPair(value,p) RemAttr(value, A_COLOR), \ + SetAttr(value, AttrOf(value) | (A_COLOR & COLOR_PAIR(p))) +#define GetPair(value) PAIR_NUMBER(AttrOf(value)) +#define unColor(n) (AttrOf(n) & ALL_BUT_COLOR) +#define GET_WINDOW_PAIR(w) PAIR_NUMBER((w)->_attrs) +#define SET_WINDOW_PAIR(w,p) (w)->_attrs &= ALL_BUT_COLOR, \ + (w)->_attrs |= (A_COLOR & COLOR_PAIR(p)) +#define SameAttrOf(a,b) (AttrOf(a) == AttrOf(b)) +#define VIDATTR(attr, pair) vidattr(attr) +#endif + +#define SCREEN_ATTRS(s) (*((s)->_current_attr)) +#define GET_SCREEN_PAIR(s) GetPair(SCREEN_ATTRS(s)) +#define SET_SCREEN_PAIR(s,p) SetPair(SCREEN_ATTRS(s), p) + +/* + * Definitions for color pairs + */ +typedef unsigned colorpair_t; /* type big enough to store PAIR_OF() */ +#define C_SHIFT 9 /* we need more bits than there are colors */ +#define C_MASK ((1 << C_SHIFT) - 1) +#define PAIR_OF(fg, bg) ((((fg) & C_MASK) << C_SHIFT) | ((bg) & C_MASK)) +#define isDefaultColor(c) ((c) >= COLOR_DEFAULT || (c) < 0) +#define COLOR_DEFAULT C_MASK + +#ifdef USE_TERMLIB + +#undef NCURSES_CH_T /* this is not a termlib feature */ +#define NCURSES_CH_T void /* ...but we need a pointer in SCREEN */ + +#endif /* USE_TERMLIB */ + +#ifndef USE_TERMLIB struct ldat { NCURSES_CH_T *text; /* text of the line */ @@ -266,6 +307,7 @@ struct ldat NCURSES_SIZE_T lastchar; /* last changed character in the line */ NCURSES_SIZE_T oldindex; /* index of the line at last update */ }; +#endif /* USE_TERMLIB */ typedef enum { M_XTERM = -1 /* use xterm's mouse tracking? */ @@ -279,9 +321,23 @@ typedef enum { } MouseType; /* - * Structure for soft labels. + * Structures for scrolling. + */ + +typedef struct { + unsigned long hashval; + int oldcount, newcount; + int oldindex, newindex; +} HASHMAP; + +/* + * Structures for soft labels. */ +struct _SLK; + +#ifndef USE_TERMLIB + typedef struct { char *ent_text; /* text for the label */ @@ -291,7 +347,7 @@ typedef struct char visible; /* field is visible */ } slk_ent; -typedef struct { +typedef struct _SLK { char dirty; /* all labels have changed */ char hidden; /* soft labels are hidden */ WINDOW *win; @@ -299,14 +355,10 @@ typedef struct { short maxlab; /* number of available labels */ short labcnt; /* number of allocated labels */ short maxlen; /* length of labels */ - chtype attr; /* soft label attribute */ + NCURSES_CH_T attr; /* soft label attribute */ } SLK; -typedef struct { - unsigned long hashval; - int oldcount, newcount; - int oldindex, newindex; -} HASHMAP; +#endif /* USE_TERMLIB */ typedef struct { int line; /* lines to take, < 0 => from bottom*/ @@ -314,6 +366,10 @@ typedef struct { WINDOW *w; /* maybe we need this for cleanup */ } ripoff_t; +/* + * The SCREEN structure. + */ + struct screen { int _ifd; /* input file ptr for screen */ FILE *_ofp; /* output file ptr for screen */ @@ -339,14 +395,14 @@ struct screen { bool _keypad_on; /* keypad mode is currently on */ bool _called_wgetch; /* check for recursion in wgetch() */ - int _fifo[FIFO_SIZE]; /* input push-back buffer */ + int _fifo[FIFO_SIZE]; /* input push-back buffer */ short _fifohead, /* head of fifo queue */ _fifotail, /* tail of fifo queue */ _fifopeek, /* where to peek for next char */ _fifohold; /* set if breakout marked */ int _endwin; /* are we out of window mode? */ - attr_t _current_attr; /* terminal attribute current set */ + NCURSES_CH_T *_current_attr; /* holds current attributes set */ int _coloron; /* is color enabled? */ int _color_defs; /* are colors modified */ int _cursor; /* visibility of the cursor */ @@ -359,7 +415,7 @@ struct screen { /* > 1 if in halfdelay mode */ int _echo; /* True if echo on */ int _use_meta; /* use the meta key? */ - SLK *_slk; /* ptr to soft key struct / NULL */ + struct _SLK *_slk; /* ptr to soft key struct / NULL */ int slk_format; /* selected format for this screen */ /* cursor movement costs; units are 10ths of milliseconds */ #if NCURSES_NO_PADDING @@ -409,7 +465,7 @@ struct screen { /* used in lib_color.c */ color_t *_color_table; /* screen's color palette */ int _color_count; /* count of colors in palette */ - unsigned short *_color_pairs; /* screen's color pair list */ + colorpair_t *_color_pairs; /* screen's color pair list */ int _pair_count; /* count of color pairs */ #if NCURSES_EXT_FUNCS bool _default_color; /* use default colors */ @@ -448,6 +504,7 @@ struct screen { void (*_mouse_resume)(SCREEN *); void (*_mouse_wrap) (SCREEN *); int _mouse_fd; /* file-descriptor, if any */ + bool _mouse_active; /* true if initialized */ NCURSES_CONST char *_mouse_xtermcap; /* string to enable/disable mouse */ #if USE_SYSMOUSE MEVENT _sysmouse_fifo[FIFO_SIZE]; @@ -483,7 +540,7 @@ struct screen { /* hashes for old and new lines */ unsigned long *oldhash, *newhash; - HASHMAP *hashtab; + HASHMAP *hashtab; int hashtab_len; bool _cleanup; /* cleanup after int/quit signal */ @@ -493,9 +550,10 @@ struct screen { * UTF-8, but do not permit ACS at the same time (see tty_update.c). */ #if USE_WIDEC_SUPPORT - bool _posix_locale; + bool _legacy_coding; bool _screen_acs_fix; #endif + bool _screen_acs_map[ACS_LEN]; }; extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; @@ -509,17 +567,25 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; WINDOWLIST *next; #ifdef _XOPEN_SOURCE_EXTENDED char addch_work[(MB_LEN_MAX * 9) + 1]; - int addch_used; - int addch_x; - int addch_y; + unsigned addch_used; /* number of bytes in addch_work[] */ + int addch_x; /* x-position for addch_work[] */ + int addch_y; /* y-position for addch_work[] */ #endif }; #define WINDOW_EXT(win,field) (((WINDOWLIST *)(win))->field) +/* usually in */ +#ifndef UCHAR_MAX +#define UCHAR_MAX 255 +#endif + /* The terminfo source is assumed to be 7-bit ASCII */ #define is7bits(c) ((unsigned)(c) < 128) +/* Checks for isprint() should be done on 8-bit characters (non-wide) */ +#define is8bits(c) ((unsigned)(c) <= UCHAR_MAX) + #ifndef min #define min(a,b) ((a) > (b) ? (b) : (a)) #endif @@ -585,18 +651,31 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; #endif #if USE_WIDEC_SUPPORT /* { */ +#define isEILSEQ(status) ((status == (size_t)-1) && (errno == EILSEQ)) + +#define init_mb(state) memset(&state, 0, sizeof(state)) + +#if NCURSES_EXT_COLORS +#define NulColor , 0 +#else +#define NulColor /* nothing */ +#endif + #define NulChar 0,0,0,0 /* FIXME: see CCHARW_MAX */ #define CharOf(c) ((c).chars[0]) #define AttrOf(c) ((c).attr) -#define AddAttr(c,a) (c).attr |= a -#define RemAttr(c,a) (c).attr &= ~(a) -#define SetAttr(c,a) (c).attr = a -#define NewChar(ch) { ChAttrOf(ch), { ChCharOf(ch), NulChar } } -#define NewChar2(c,a) { a, { c, NulChar } } +#define AddAttr(c,a) AttrOf(c) |= a +#define RemAttr(c,a) AttrOf(c) &= ~(a) +#define SetAttr(c,a) AttrOf(c) = a +#define NewChar(ch) { ChAttrOf(ch), { ChCharOf(ch), NulChar } NulColor } +#define NewChar2(c,a) { a, { c, NulChar } NulColor } #define CharEq(a,b) (!memcmp(&a, &b, sizeof(a))) -#define SetChar(ch,c,a) do { \ +#define SetChar(ch,c,a) do { \ NCURSES_CH_T *_cp = &ch; \ - memset(_cp,0,sizeof(ch)); _cp->chars[0] = c; _cp->attr = a; \ + memset(_cp, 0, sizeof(ch)); \ + _cp->chars[0] = c; \ + _cp->attr = a; \ + if_EXT_COLORS(SetPair(ch, PAIR_NUMBER(a))); \ } while (0) #define CHREF(wch) (&wch) #define CHDEREF(wch) (*wch) @@ -604,9 +683,9 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; #define CARG_CH_T const NCURSES_CH_T * #define PUTC_DATA char PUTC_buf[MB_LEN_MAX]; int PUTC_i, PUTC_n; \ mbstate_t PUT_st; wchar_t PUTC_ch -#define PUTC_INIT memset (&PUT_st, '\0', sizeof (PUT_st)); \ +#define PUTC_INIT init_mb (PUT_st); \ PUTC_i = 0 -#define PUTC(ch,b) do { if(!isnac(ch)) { \ +#define PUTC(ch,b) do { if(!isWidecExt(ch)) { \ if (Charable(ch)) { \ fputc(CharOf(ch), b); \ TRACE_OUTCHARS(1); \ @@ -627,14 +706,27 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; TRACE_OUTCHARS(PUTC_i); \ } } } while (0) -#define BLANK { WA_NORMAL, ' ' } +#define BLANK { WA_NORMAL, {' '} NulColor } +#define ZEROS { WA_NORMAL, {'\0'} NulColor } #define ISBLANK(ch) ((ch).chars[0] == L' ' && (ch).chars[1] == L'\0') -#define WA_NAC 1 -#define isnac(ch) (AttrOf(ch) & WA_NAC) + /* + * Wide characters cannot be represented in the A_CHARTEXT mask of + * attr_t's but an application might have set a narrow character there. + * But even in that case, it would only be a printable character, or + * zero. Otherwise we can use those bits to tell if a cell is the + * first or extension part of a wide character. + */ +#define WidecExt(ch) (AttrOf(ch) & A_CHARTEXT) +#define isWidecBase(ch) (WidecExt(ch) == 1) +#define isWidecExt(ch) (WidecExt(ch) > 1 && WidecExt(ch) < 32) +#define SetWidecExt(dst, ext) AttrOf(dst) &= ~A_CHARTEXT, \ + AttrOf(dst) |= (ext + 1) + #define if_WIDEC(code) code -#define Charable(ch) ((SP != 0 && SP->_posix_locale) \ - || (!isnac(ch) && \ +#define Charable(ch) ((SP != 0 && SP->_legacy_coding) \ + || (AttrOf(ch) & A_ALTCHARSET) \ + || (!isWidecExt(ch) && \ (ch).chars[1] == L'\0' && \ _nc_is_charable(CharOf(ch)))) @@ -657,9 +749,10 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; #define PUTC(a,b) do { data = CharOf(ch); putc(data,b); } while (0) #define BLANK (' '|A_NORMAL) +#define ZEROS ('\0'|A_NORMAL) #define ISBLANK(ch) (CharOf(ch) == ' ') -#define isnac(ch) (0) +#define isWidecExt(ch) (0) #define if_WIDEC(code) /* nothing */ #define L(ch) ch @@ -674,6 +767,11 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; #define CHANGED -1 +#define LEGALYX(w, y, x) \ + ((w) != 0 && \ + ((x) >= 0 && (x) <= (w)->_maxx && \ + (y) >= 0 && (y) <= (w)->_maxy)) + #define CHANGED_CELL(line,col) \ if (line->firstchar == _NOCHANGE) \ line->firstchar = line->lastchar = col; \ @@ -730,17 +828,21 @@ extern NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain; #define TPUTS_TRACE(s) _nc_tputs_trace = s; #define TRACE_RETURN(value,type) return _nc_retrace_##type(value) -#define returnAttr(code) TRACE_RETURN(code,attr_t) -#define returnChar(code) TRACE_RETURN(code,chtype) -#define returnBool(code) TRACE_RETURN(code,bool) -#define returnBits(code) TRACE_RETURN(code,unsigned) -#define returnCode(code) TRACE_RETURN(code,int) -#define returnPtr(code) TRACE_RETURN(code,ptr) -#define returnSP(code) TRACE_RETURN(code,sp) -#define returnVoid T((T_RETURN(""))); return -#define returnWin(code) TRACE_RETURN(code,win) +#define returnAttr(code) TRACE_RETURN(code,attr_t) +#define returnBits(code) TRACE_RETURN(code,unsigned) +#define returnBool(code) TRACE_RETURN(code,bool) +#define returnCPtr(code) TRACE_RETURN(code,cptr) +#define returnCVoidPtr(code) TRACE_RETURN(code,cvoid_ptr) +#define returnChar(code) TRACE_RETURN(code,chtype) +#define returnCode(code) TRACE_RETURN(code,int) +#define returnPtr(code) TRACE_RETURN(code,ptr) +#define returnSP(code) TRACE_RETURN(code,sp) +#define returnVoid T((T_RETURN(""))); return +#define returnVoidPtr(code) TRACE_RETURN(code,void_ptr) +#define returnWin(code) TRACE_RETURN(code,win) extern NCURSES_EXPORT(NCURSES_BOOL) _nc_retrace_bool (NCURSES_BOOL); +extern NCURSES_EXPORT(NCURSES_CONST void *) _nc_retrace_cvoid_ptr (NCURSES_CONST void *); extern NCURSES_EXPORT(SCREEN *) _nc_retrace_sp (SCREEN *); extern NCURSES_EXPORT(WINDOW *) _nc_retrace_win (WINDOW *); extern NCURSES_EXPORT(attr_t) _nc_retrace_attr_t (attr_t); @@ -749,8 +851,10 @@ extern NCURSES_EXPORT(char *) _nc_trace_ttymode(TTY *tty); extern NCURSES_EXPORT(char *) _nc_varargs (const char *, va_list); extern NCURSES_EXPORT(chtype) _nc_retrace_chtype (chtype); extern NCURSES_EXPORT(const char *) _nc_altcharset_name(attr_t, chtype); +extern NCURSES_EXPORT(const char *) _nc_retrace_cptr (const char *); extern NCURSES_EXPORT(int) _nc_retrace_int (int); extern NCURSES_EXPORT(unsigned) _nc_retrace_unsigned (unsigned); +extern NCURSES_EXPORT(void *) _nc_retrace_void_ptr (void *); extern NCURSES_EXPORT(void) _nc_fifo_dump (void); extern NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace; extern NCURSES_EXPORT_VAR(long) _nc_outchars; @@ -771,15 +875,18 @@ extern NCURSES_EXPORT(const char *) _nc_viscbuf (const cchar_t *, int); #define TR(n, a) #define TPUTS_TRACE(s) -#define returnAttr(code) return code -#define returnBits(code) return code -#define returnBool(code) return code -#define returnChar(code) return code -#define returnCode(code) return code -#define returnPtr(code) return code -#define returnSP(code) return code -#define returnVoid return -#define returnWin(code) return code +#define returnAttr(code) return code +#define returnBits(code) return code +#define returnBool(code) return code +#define returnCPtr(code) return code +#define returnCVoidPtr(code) return code +#define returnChar(code) return code +#define returnCode(code) return code +#define returnPtr(code) return code +#define returnSP(code) return code +#define returnVoid return +#define returnVoidPtr(code) return code +#define returnWin(code) return code #endif /* TRACE/!TRACE */ @@ -791,29 +898,23 @@ extern NCURSES_EXPORT(void) name (void); \ NCURSES_EXPORT(void) name (void) { } #define ALL_BUT_COLOR ((chtype)~(A_COLOR)) -#define IGNORE_COLOR_OFF FALSE #define NONBLANK_ATTR (A_NORMAL|A_BOLD|A_DIM|A_BLINK) #define XMC_CHANGES(c) ((c) & SP->_xmc_suppress) #define toggle_attr_on(S,at) {\ - if (PAIR_NUMBER(at) > 0)\ + if (PAIR_NUMBER(at) > 0) {\ (S) = ((S) & ALL_BUT_COLOR) | (at);\ - else\ + } else {\ (S) |= (at);\ + }\ TR(TRACE_ATTRS, ("new attribute is %s", _traceattr((S))));} #define toggle_attr_off(S,at) {\ - if (IGNORE_COLOR_OFF == TRUE) {\ - if (PAIR_NUMBER(at) == 0xff) /* turn off color */\ - (S) &= ~(at);\ - else /* leave color alone */\ - (S) &= ~((at)&ALL_BUT_COLOR);\ + if (PAIR_NUMBER(at) > 0) {\ + (S) &= ~(at|A_COLOR);\ } else {\ - if (PAIR_NUMBER(at) > 0x00) /* turn off color */\ - (S) &= ~(at|A_COLOR);\ - else /* leave color alone */\ - (S) &= ~(at);\ + (S) &= ~(at);\ }\ TR(TRACE_ATTRS, ("new attribute is %s", _traceattr((S))));} @@ -834,11 +935,11 @@ extern NCURSES_EXPORT(void) name (void); \ : INFINITY))) #if USE_XMC_SUPPORT -#define UpdateAttrs(a) if (SP->_current_attr != (a)) { \ - attr_t chg = SP->_current_attr; \ - vidattr((a)); \ +#define UpdateAttrs(c) if (!SameAttrOf(SCREEN_ATTRS(SP), c)) { \ + attr_t chg = AttrOf(SCREEN_ATTRS(SP)); \ + VIDATTR(AttrOf(c), GetPair(c)); \ if (magic_cookie_glitch > 0 \ - && XMC_CHANGES((chg ^ SP->_current_attr))) { \ + && XMC_CHANGES((chg ^ AttrOf(SCREEN_ATTRS(SP))))) { \ T(("%s @%d before glitch %d,%d", \ __FILE__, __LINE__, \ SP->_cursrow, \ @@ -847,8 +948,8 @@ extern NCURSES_EXPORT(void) name (void); \ } \ } #else -#define UpdateAttrs(a) if (SP->_current_attr != (a)) \ - vidattr((a)); +#define UpdateAttrs(c) if (!SameAttrOf(SCREEN_ATTRS(SP), c)) \ + VIDATTR(AttrOf(c), GetPair(c)); #endif /* @@ -884,7 +985,7 @@ extern NCURSES_EXPORT(int) _nc_InsCharCost (int); #undef UpdateAttrs #define UpdateAttrs(c) _nc_UpdateAttrs(c) -extern NCURSES_EXPORT(void) _nc_UpdateAttrs (chtype); +extern NCURSES_EXPORT(void) _nc_UpdateAttrs (NCURSES_CH_T); #else @@ -917,8 +1018,13 @@ extern NCURSES_EXPORT(void) _nc_linedump (void); extern NCURSES_EXPORT(void) _nc_init_acs (void); /* corresponds to traditional 'init_acs()' */ extern NCURSES_EXPORT(int) _nc_msec_cost (const char *const, int); /* used by 'tack' program */ -/* lib_addstr.c */ +/* lib_addch.c */ #if USE_WIDEC_SUPPORT +NCURSES_EXPORT(int) _nc_build_wch(WINDOW *win, ARG_CH_T ch); +#endif + +/* lib_addstr.c */ +#if USE_WIDEC_SUPPORT && !defined(USE_TERMLIB) extern NCURSES_EXPORT(int) _nc_wchstrlen(const cchar_t *); #endif @@ -929,7 +1035,7 @@ extern NCURSES_EXPORT(bool) _nc_reset_colors(void); extern NCURSES_EXPORT(int) _nc_wgetch(WINDOW *, unsigned long *, int EVENTLIST_2nd(_nc_eventlist *)); /* lib_insch.c */ -extern NCURSES_EXPORT(void) _nc_insert_ch(WINDOW *, chtype); +extern NCURSES_EXPORT(int) _nc_insert_ch(WINDOW *, chtype); /* lib_mvcur.c */ #define INFINITY 1000000 /* cost: too high to use */ @@ -955,6 +1061,7 @@ extern NCURSES_EXPORT(int) _nc_has_mouse (void); extern NCURSES_EXPORT(char *) _nc_get_locale(void); extern NCURSES_EXPORT(int) _nc_unicode_locale(void); extern NCURSES_EXPORT(int) _nc_locale_breaks_acs(void); +extern NCURSES_EXPORT(int) _nc_setupterm(NCURSES_CONST char *, int , int *, bool); /* lib_wacs.c */ #if USE_WIDEC_SUPPORT @@ -975,16 +1082,6 @@ extern NCURSES_EXPORT(string_desc *) _nc_str_copy (string_desc *, string_desc *) extern NCURSES_EXPORT(bool) _nc_safe_strcat (string_desc *, const char *); extern NCURSES_EXPORT(bool) _nc_safe_strcpy (string_desc *, const char *); -extern NCURSES_EXPORT(void) _nc_mvcur_init (void); -extern NCURSES_EXPORT(void) _nc_mvcur_resume (void); -extern NCURSES_EXPORT(void) _nc_mvcur_wrap (void); - -extern NCURSES_EXPORT(int) _nc_scrolln (int, int, int, int); - -extern NCURSES_EXPORT(void) _nc_screen_init (void); -extern NCURSES_EXPORT(void) _nc_screen_resume (void); -extern NCURSES_EXPORT(void) _nc_screen_wrap (void); - #if !HAVE_STRSTR #define strstr _nc_strstr extern NCURSES_EXPORT(char *) _nc_strstr (const char *, const char *); @@ -1000,7 +1097,7 @@ extern NCURSES_EXPORT(int) _nc_remove_key (struct tries **, unsigned short); extern NCURSES_EXPORT(int) _nc_remove_string (struct tries **, const char *); /* elsewhere ... */ -extern NCURSES_EXPORT(NCURSES_CH_T) _nc_render (WINDOW *, NCURSES_CH_T); +extern NCURSES_EXPORT(ENTRY *) _nc_delink_entry(ENTRY *, TERMTYPE *); extern NCURSES_EXPORT(WINDOW *) _nc_makenew (int, int, int, int, int); extern NCURSES_EXPORT(char *) _nc_home_terminfo (void); extern NCURSES_EXPORT(char *) _nc_trace_buf (int, size_t); @@ -1014,9 +1111,9 @@ extern NCURSES_EXPORT(int) _nc_ospeed (int); extern NCURSES_EXPORT(int) _nc_outch (int); extern NCURSES_EXPORT(int) _nc_setupscreen (short, short const, FILE *); extern NCURSES_EXPORT(int) _nc_timed_wait(int, int, int * EVENTLIST_2nd(_nc_eventlist *)); -extern NCURSES_EXPORT(int) _nc_waddch_nosync (WINDOW *, const NCURSES_CH_T); extern NCURSES_EXPORT(void) _nc_do_color (int, int, bool, int (*)(int)); extern NCURSES_EXPORT(void) _nc_flush (void); +extern NCURSES_EXPORT(void) _nc_free_entry(ENTRY *, TERMTYPE *); extern NCURSES_EXPORT(void) _nc_freeall (void); extern NCURSES_EXPORT(void) _nc_hash_map (void); extern NCURSES_EXPORT(void) _nc_init_keytry (void); @@ -1024,12 +1121,31 @@ extern NCURSES_EXPORT(void) _nc_keep_tic_dir (const char *); extern NCURSES_EXPORT(void) _nc_make_oldhash (int i); extern NCURSES_EXPORT(void) _nc_scroll_oldhash (int n, int top, int bot); extern NCURSES_EXPORT(void) _nc_scroll_optimize (void); -extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, short const, short const, NCURSES_CH_T); extern NCURSES_EXPORT(void) _nc_set_buffer (FILE *, bool); extern NCURSES_EXPORT(void) _nc_signal_handler (bool); extern NCURSES_EXPORT(void) _nc_synchook (WINDOW *); extern NCURSES_EXPORT(void) _nc_trace_tries (struct tries *); +#if NO_LEAKS +extern NCURSES_EXPORT(void) _nc_alloc_entry_leaks(void); +extern NCURSES_EXPORT(void) _nc_captoinfo_leaks(void); +extern NCURSES_EXPORT(void) _nc_comp_scan_leaks(void); +#endif + +#ifndef USE_TERMLIB +extern NCURSES_EXPORT(NCURSES_CH_T) _nc_render (WINDOW *, NCURSES_CH_T); +extern NCURSES_EXPORT(int) _nc_waddch_nosync (WINDOW *, const NCURSES_CH_T); +extern NCURSES_EXPORT(void) _nc_scroll_window (WINDOW *, int const, short const, short const, NCURSES_CH_T); +#endif + +#if USE_WIDEC_SUPPORT && !defined(USE_TERMLIB) +#ifdef linux +extern NCURSES_EXPORT(size_t) _nc_wcrtomb (char *, wchar_t, mbstate_t *); +#else +#define _nc_wcrtomb(s,wc,ps) wcrtomb(s,wc,ps) +#endif +#endif + #if USE_SIZECHANGE extern NCURSES_EXPORT(void) _nc_update_screensize (void); #endif diff --git a/ncurses/llib-lncurses b/ncurses/llib-lncurses index efe7bc7c..072a6539 100644 --- a/ncurses/llib-lncurses +++ b/ncurses/llib-lncurses @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1996-2003,2004 * + * Author: Thomas E. Dickey 1996-2004,2005 * ****************************************************************************/ /* LINTLIBRARY */ @@ -48,6 +48,8 @@ void _nc_linedump(void) /* ./tty/hashmap.c */ +#include + #undef _nc_hash_map void _nc_hash_map(void) { /* void */ } @@ -59,8 +61,8 @@ void _nc_make_oldhash( #undef _nc_scroll_oldhash void _nc_scroll_oldhash( - int n, - int top, + int n, + int top, int bot) { /* void */ } @@ -70,25 +72,25 @@ void _nc_scroll_oldhash( #undef _nc_render chtype _nc_render( - WINDOW *win, + WINDOW *win, chtype ch) { return(*(chtype *)0); } #undef _nc_waddch_nosync int _nc_waddch_nosync( - WINDOW *win, + WINDOW *win, const chtype c) { return(*(int *)0); } #undef waddch int waddch( - WINDOW *win, + WINDOW *win, const chtype ch) { return(*(int *)0); } #undef wechochar int wechochar( - WINDOW *win, + WINDOW *win, const chtype ch) { return(*(int *)0); } @@ -96,15 +98,15 @@ int wechochar( #undef waddnstr int waddnstr( - WINDOW *win, - const char *astr, + WINDOW *win, + const char *astr, int n) { return(*(int *)0); } #undef waddchnstr int waddchnstr( - WINDOW *win, - const chtype *astr, + WINDOW *win, + const chtype *astr, int n) { return(*(int *)0); } @@ -118,13 +120,13 @@ int beep(void) #undef wbkgdset void wbkgdset( - WINDOW *win, + WINDOW *win, chtype ch) { /* void */ } #undef wbkgd int wbkgd( - WINDOW *win, + WINDOW *win, chtype ch) { return(*(int *)0); } @@ -132,14 +134,14 @@ int wbkgd( #undef wborder int wborder( - WINDOW *win, - chtype ls, - chtype rs, - chtype ts, - chtype bs, - chtype tl, - chtype tr, - chtype bl, + WINDOW *win, + chtype ls, + chtype rs, + chtype ts, + chtype bs, + chtype tl, + chtype tr, + chtype bl, chtype br) { return(*(int *)0); } @@ -147,10 +149,10 @@ int wborder( #undef wchgat int wchgat( - WINDOW *win, - int n, - attr_t attr, - short color, + WINDOW *win, + int n, + attr_t attr, + short color, const void *opts) { return(*(int *)0); } @@ -165,7 +167,7 @@ int wclear( #undef clearok int clearok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } @@ -202,16 +204,16 @@ int start_color(void) #undef init_pair int init_pair( - short pair, - short f, + short pair, + short f, short b) { return(*(int *)0); } #undef init_color int init_color( - short color, - short r, - short g, + short color, + short r, + short g, short b) { return(*(int *)0); } @@ -225,24 +227,24 @@ NCURSES_BOOL has_colors(void) #undef color_content int color_content( - short color, - short *r, - short *g, + short color, + short *r, + short *g, short *b) { return(*(int *)0); } #undef pair_content int pair_content( - short pair, - short *f, + short pair, + short *f, short *b) { return(*(int *)0); } #undef _nc_do_color void _nc_do_color( - int old_pair, - int pair, - NCURSES_BOOL reverse, + int old_pair, + int pair, + NCURSES_BOOL reverse, int (*outc)( int p1)) { /* void */ } @@ -251,8 +253,8 @@ void _nc_do_color( #undef wcolor_set int wcolor_set( - WINDOW *win, - short color_pair_number, + WINDOW *win, + short color_pair_number, void *opts) { return(*(int *)0); } @@ -308,7 +310,7 @@ int addch( #undef addchnstr int addchnstr( - const chtype *a1, + const chtype *a1, int z) { return(*(int *)0); } @@ -319,7 +321,7 @@ int addchstr( #undef addnstr int addnstr( - const char *a1, + const char *a1, int z) { return(*(int *)0); } @@ -345,27 +347,27 @@ int attrset( #undef attr_get int attr_get( - attr_t *a1, - short *a2, + attr_t *a1, + short *a2, void *z) { return(*(int *)0); } #undef attr_off int attr_off( - attr_t a1, + attr_t a1, void *z) { return(*(int *)0); } #undef attr_on int attr_on( - attr_t a1, + attr_t a1, void *z) { return(*(int *)0); } #undef attr_set int attr_set( - attr_t a1, - short a2, + attr_t a1, + short a2, void *z) { return(*(int *)0); } @@ -381,28 +383,28 @@ void bkgdset( #undef border int border( - chtype a1, - chtype a2, - chtype a3, - chtype a4, - chtype a5, - chtype a6, - chtype a7, + chtype a1, + chtype a2, + chtype a3, + chtype a4, + chtype a5, + chtype a6, + chtype a7, chtype z) { return(*(int *)0); } #undef box int box( - WINDOW *a1, - chtype a2, + WINDOW *a1, + chtype a2, chtype z) { return(*(int *)0); } #undef chgat int chgat( - int a1, - attr_t a2, - short a3, + int a1, + attr_t a2, + short a3, const void *z) { return(*(int *)0); } @@ -420,7 +422,7 @@ int clrtoeol(void) #undef color_set int color_set( - short a1, + short a1, void *z) { return(*(int *)0); } @@ -457,7 +459,7 @@ int getch(void) #undef getnstr int getnstr( - char *a1, + char *a1, int z) { return(*(int *)0); } @@ -468,7 +470,7 @@ int getstr( #undef hline int hline( - chtype a1, + chtype a1, int z) { return(*(int *)0); } @@ -478,7 +480,7 @@ chtype inch(void) #undef inchnstr int inchnstr( - chtype *a1, + chtype *a1, int z) { return(*(int *)0); } @@ -489,7 +491,7 @@ int inchstr( #undef innstr int innstr( - char *a1, + char *a1, int z) { return(*(int *)0); } @@ -509,7 +511,7 @@ int insertln(void) #undef insnstr int insnstr( - const char *a1, + const char *a1, int z) { return(*(int *)0); } @@ -525,323 +527,323 @@ int instr( #undef move int move( - int a1, + int a1, int z) { return(*(int *)0); } #undef mvaddch int mvaddch( - int a1, - int a2, + int a1, + int a2, const chtype z) { return(*(int *)0); } #undef mvaddchnstr int mvaddchnstr( - int a1, - int a2, - const chtype *a3, + int a1, + int a2, + const chtype *a3, int z) { return(*(int *)0); } #undef mvaddchstr int mvaddchstr( - int a1, - int a2, + int a1, + int a2, const chtype *z) { return(*(int *)0); } #undef mvaddnstr int mvaddnstr( - int a1, - int a2, - const char *a3, + int a1, + int a2, + const char *a3, int z) { return(*(int *)0); } #undef mvaddstr int mvaddstr( - int a1, - int a2, + int a1, + int a2, const char *z) { return(*(int *)0); } #undef mvchgat int mvchgat( - int a1, - int a2, - int a3, - attr_t a4, - short a5, + int a1, + int a2, + int a3, + attr_t a4, + short a5, const void *z) { return(*(int *)0); } #undef mvdelch int mvdelch( - int a1, + int a1, int z) { return(*(int *)0); } #undef mvgetch int mvgetch( - int a1, + int a1, int z) { return(*(int *)0); } #undef mvgetnstr int mvgetnstr( - int a1, - int a2, - char *a3, + int a1, + int a2, + char *a3, int z) { return(*(int *)0); } #undef mvgetstr int mvgetstr( - int a1, - int a2, + int a1, + int a2, char *z) { return(*(int *)0); } #undef mvhline int mvhline( - int a1, - int a2, - chtype a3, + int a1, + int a2, + chtype a3, int z) { return(*(int *)0); } #undef mvinch chtype mvinch( - int a1, + int a1, int z) { return(*(chtype *)0); } #undef mvinchnstr int mvinchnstr( - int a1, - int a2, - chtype *a3, + int a1, + int a2, + chtype *a3, int z) { return(*(int *)0); } #undef mvinchstr int mvinchstr( - int a1, - int a2, + int a1, + int a2, chtype *z) { return(*(int *)0); } #undef mvinnstr int mvinnstr( - int a1, - int a2, - char *a3, + int a1, + int a2, + char *a3, int z) { return(*(int *)0); } #undef mvinsch int mvinsch( - int a1, - int a2, + int a1, + int a2, chtype z) { return(*(int *)0); } #undef mvinsnstr int mvinsnstr( - int a1, - int a2, - const char *a3, + int a1, + int a2, + const char *a3, int z) { return(*(int *)0); } #undef mvinsstr int mvinsstr( - int a1, - int a2, + int a1, + int a2, const char *z) { return(*(int *)0); } #undef mvinstr int mvinstr( - int a1, - int a2, + int a1, + int a2, char *z) { return(*(int *)0); } #undef mvvline int mvvline( - int a1, - int a2, - chtype a3, + int a1, + int a2, + chtype a3, int z) { return(*(int *)0); } #undef mvwaddch int mvwaddch( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const chtype z) { return(*(int *)0); } #undef mvwaddchnstr int mvwaddchnstr( - WINDOW *a1, - int a2, - int a3, - const chtype *a4, + WINDOW *a1, + int a2, + int a3, + const chtype *a4, int z) { return(*(int *)0); } #undef mvwaddchstr int mvwaddchstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const chtype *z) { return(*(int *)0); } #undef mvwaddnstr int mvwaddnstr( - WINDOW *a1, - int a2, - int a3, - const char *a4, + WINDOW *a1, + int a2, + int a3, + const char *a4, int z) { return(*(int *)0); } #undef mvwaddstr int mvwaddstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const char *z) { return(*(int *)0); } #undef mvwchgat int mvwchgat( - WINDOW *a1, - int a2, - int a3, - int a4, - attr_t a5, - short a6, + WINDOW *a1, + int a2, + int a3, + int a4, + attr_t a5, + short a6, const void *z) { return(*(int *)0); } #undef mvwdelch int mvwdelch( - WINDOW *a1, - int a2, + WINDOW *a1, + int a2, int z) { return(*(int *)0); } #undef mvwgetch int mvwgetch( - WINDOW *a1, - int a2, + WINDOW *a1, + int a2, int z) { return(*(int *)0); } #undef mvwgetnstr int mvwgetnstr( - WINDOW *a1, - int a2, - int a3, - char *a4, + WINDOW *a1, + int a2, + int a3, + char *a4, int z) { return(*(int *)0); } #undef mvwgetstr int mvwgetstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, char *z) { return(*(int *)0); } #undef mvwhline int mvwhline( - WINDOW *a1, - int a2, - int a3, - chtype a4, + WINDOW *a1, + int a2, + int a3, + chtype a4, int z) { return(*(int *)0); } #undef mvwinch chtype mvwinch( - WINDOW *a1, - int a2, + WINDOW *a1, + int a2, int z) { return(*(chtype *)0); } #undef mvwinchnstr int mvwinchnstr( - WINDOW *a1, - int a2, - int a3, - chtype *a4, + WINDOW *a1, + int a2, + int a3, + chtype *a4, int z) { return(*(int *)0); } #undef mvwinchstr int mvwinchstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, chtype *z) { return(*(int *)0); } #undef mvwinnstr int mvwinnstr( - WINDOW *a1, - int a2, - int a3, - char *a4, + WINDOW *a1, + int a2, + int a3, + char *a4, int z) { return(*(int *)0); } #undef mvwinsch int mvwinsch( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, chtype z) { return(*(int *)0); } #undef mvwinsnstr int mvwinsnstr( - WINDOW *a1, - int a2, - int a3, - const char *a4, + WINDOW *a1, + int a2, + int a3, + const char *a4, int z) { return(*(int *)0); } #undef mvwinsstr int mvwinsstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const char *z) { return(*(int *)0); } #undef mvwinstr int mvwinstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, char *z) { return(*(int *)0); } #undef mvwvline int mvwvline( - WINDOW *a1, - int a2, - int a3, - chtype a4, + WINDOW *a1, + int a2, + int a3, + chtype a4, int z) { return(*(int *)0); } @@ -871,7 +873,7 @@ int scroll( #undef setscrreg int setscrreg( - int a1, + int a1, int z) { return(*(int *)0); } @@ -890,8 +892,8 @@ void timeout( #undef touchline int touchline( - WINDOW *a1, - int a2, + WINDOW *a1, + int a2, int z) { return(*(int *)0); } @@ -907,67 +909,67 @@ int untouchwin( #undef vline int vline( - chtype a1, + chtype a1, int z) { return(*(int *)0); } #undef vw_printw int vw_printw( - WINDOW *a1, - const char *a2, + WINDOW *a1, + const char *a2, va_list z) { return(*(int *)0); } #undef vw_scanw int vw_scanw( - WINDOW *a1, - char *a2, + WINDOW *a1, + char *a2, va_list z) { return(*(int *)0); } #undef waddchstr int waddchstr( - WINDOW *a1, + WINDOW *a1, const chtype *z) { return(*(int *)0); } #undef waddstr int waddstr( - WINDOW *a1, + WINDOW *a1, const char *z) { return(*(int *)0); } #undef wattron int wattron( - WINDOW *a1, + WINDOW *a1, int z) { return(*(int *)0); } #undef wattroff int wattroff( - WINDOW *a1, + WINDOW *a1, int z) { return(*(int *)0); } #undef wattrset int wattrset( - WINDOW *a1, + WINDOW *a1, int z) { return(*(int *)0); } #undef wattr_get int wattr_get( - WINDOW *a1, - attr_t *a2, - short *a3, + WINDOW *a1, + attr_t *a2, + short *a3, void *z) { return(*(int *)0); } #undef wattr_set int wattr_set( - WINDOW *a1, - attr_t a2, - short a3, + WINDOW *a1, + attr_t a2, + short a3, void *z) { return(*(int *)0); } @@ -978,13 +980,13 @@ int wdeleteln( #undef wgetstr int wgetstr( - WINDOW *a1, + WINDOW *a1, char *z) { return(*(int *)0); } #undef winchstr int winchstr( - WINDOW *a1, + WINDOW *a1, chtype *z) { return(*(int *)0); } @@ -995,13 +997,13 @@ int winsertln( #undef winsstr int winsstr( - WINDOW *a1, + WINDOW *a1, const char *z) { return(*(int *)0); } #undef winstr int winstr( - WINDOW *a1, + WINDOW *a1, char *z) { return(*(int *)0); } @@ -1016,10 +1018,10 @@ int wstandend( { return(*(int *)0); } #undef mouse_trafo -NCURSES_BOOL mouse_trafo( - int *a1, - int *a2, - NCURSES_BOOL z) +NCURSES_BOOL mouse_trafo( + int *a1, + int *a2, + NCURSES_BOOL z) { return(*(NCURSES_BOOL *)0); } /* ./base/lib_getch.c */ @@ -1031,8 +1033,8 @@ int ESCDELAY; #undef _nc_wgetch int _nc_wgetch( - WINDOW *win, - unsigned long *result, + WINDOW *win, + unsigned long *result, int use_meta) { return(*(int *)0); } @@ -1045,8 +1047,8 @@ int wgetch( #undef wgetnstr int wgetnstr( - WINDOW *win, - char *str, + WINDOW *win, + char *str, int maxlen) { return(*(int *)0); } @@ -1054,8 +1056,8 @@ int wgetnstr( #undef whline int whline( - WINDOW *win, - chtype ch, + WINDOW *win, + chtype ch, int n) { return(*(int *)0); } @@ -1063,7 +1065,7 @@ int whline( #undef immedok void immedok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { /* void */ } @@ -1071,8 +1073,8 @@ void immedok( #undef winchnstr int winchnstr( - WINDOW *win, - chtype *str, + WINDOW *win, + chtype *str, int n) { return(*(int *)0); } @@ -1085,29 +1087,31 @@ WINDOW *initscr(void) /* ./base/lib_insch.c */ #undef _nc_insert_ch -void _nc_insert_ch( - WINDOW *win, +int _nc_insert_ch( + WINDOW *win, chtype ch) - { /* void */ } + { return(*(int *)0); } #undef winsch int winsch( - WINDOW *win, + WINDOW *win, chtype c) { return(*(int *)0); } -#undef winsnstr -int winsnstr( - WINDOW *win, - const char *s, - int n) - { return(*(int *)0); } - /* ./base/lib_insdel.c */ #undef winsdelln int winsdelln( - WINDOW *win, + WINDOW *win, + int n) + { return(*(int *)0); } + +/* ./base/lib_insnstr.c */ + +#undef winsnstr +int winsnstr( + WINDOW *win, + const char *s, int n) { return(*(int *)0); } @@ -1115,8 +1119,8 @@ int winsdelln( #undef winnstr int winnstr( - WINDOW *win, - char *str, + WINDOW *win, + char *str, int n) { return(*(int *)0); } @@ -1130,7 +1134,7 @@ NCURSES_BOOL isendwin(void) #undef leaveok int leaveok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } @@ -1148,14 +1152,14 @@ int ungetmouse( #undef mousemask mmask_t mousemask( - mmask_t newmask, + mmask_t newmask, mmask_t *oldmask) { return(*(mmask_t *)0); } #undef wenclose NCURSES_BOOL wenclose( - const WINDOW *win, - int y, + const WINDOW *win, + int y, int x) { return(*(NCURSES_BOOL *)0); } @@ -1170,9 +1174,9 @@ int _nc_has_mouse(void) #undef wmouse_trafo NCURSES_BOOL wmouse_trafo( - const WINDOW *win, - int *pY, - int *pX, + const WINDOW *win, + int *pY, + int *pX, NCURSES_BOOL to_screen) { return(*(NCURSES_BOOL *)0); } @@ -1180,8 +1184,8 @@ NCURSES_BOOL wmouse_trafo( #undef wmove int wmove( - WINDOW *win, - int y, + WINDOW *win, + int y, int x) { return(*(int *)0); } @@ -1189,7 +1193,7 @@ int wmove( #undef _nc_msec_cost int _nc_msec_cost( - const char *const cap, + const char *const cap, int affcnt) { return(*(int *)0); } @@ -1207,9 +1211,9 @@ void _nc_mvcur_wrap(void) #undef mvcur int mvcur( - int yold, - int xold, - int ynew, + int yold, + int xold, + int ynew, int xnew) { return(*(int *)0); } @@ -1220,8 +1224,8 @@ int _nc_optimize_enable; #undef mvwin int mvwin( - WINDOW *win, - int by, + WINDOW *win, + int by, int bx) { return(*(int *)0); } @@ -1233,8 +1237,8 @@ void filter(void) #undef newterm SCREEN *newterm( - char *name, - FILE *ofp, + char *name, + FILE *ofp, FILE *ifp) { return(*(SCREEN **)0); } @@ -1247,36 +1251,36 @@ int _nc_freewin( #undef newwin WINDOW *newwin( - int num_lines, - int num_columns, - int begy, + int num_lines, + int num_columns, + int begy, int begx) { return(*(WINDOW **)0); } #undef derwin WINDOW *derwin( - WINDOW *orig, - int num_lines, - int num_columns, - int begy, + WINDOW *orig, + int num_lines, + int num_columns, + int begy, int begx) { return(*(WINDOW **)0); } #undef subwin WINDOW *subwin( - WINDOW *w, - int l, - int c, - int y, + WINDOW *w, + int l, + int c, + int y, int x) { return(*(WINDOW **)0); } #undef _nc_makenew WINDOW *_nc_makenew( - int num_lines, - int num_columns, - int begy, - int begx, + int num_lines, + int num_columns, + int begy, + int begx, int flags) { return(*(WINDOW **)0); } @@ -1294,26 +1298,26 @@ int nonl(void) #undef overlay int overlay( - const WINDOW *win1, + const WINDOW *win1, WINDOW *win2) { return(*(int *)0); } #undef overwrite int overwrite( - const WINDOW *win1, + const WINDOW *win1, WINDOW *win2) { return(*(int *)0); } #undef copywin int copywin( - const WINDOW *src, - WINDOW *dst, - int sminrow, - int smincol, - int dminrow, - int dmincol, - int dmaxrow, - int dmaxcol, + const WINDOW *src, + WINDOW *dst, + int sminrow, + int smincol, + int dminrow, + int dmincol, + int dmaxrow, + int dmaxcol, int over) { return(*(int *)0); } @@ -1321,44 +1325,44 @@ int copywin( #undef newpad WINDOW *newpad( - int l, + int l, int c) { return(*(WINDOW **)0); } #undef subpad WINDOW *subpad( - WINDOW *orig, - int l, - int c, - int begy, + WINDOW *orig, + int l, + int c, + int begy, int begx) { return(*(WINDOW **)0); } #undef prefresh int prefresh( - WINDOW *win, - int pminrow, - int pmincol, - int sminrow, - int smincol, - int smaxrow, + WINDOW *win, + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, int smaxcol) { return(*(int *)0); } #undef pnoutrefresh int pnoutrefresh( - WINDOW *win, - int pminrow, - int pmincol, - int sminrow, - int smincol, - int smaxrow, + WINDOW *win, + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, int smaxcol) { return(*(int *)0); } #undef pechochar int pechochar( - WINDOW *pad, + WINDOW *pad, const chtype ch) { return(*(int *)0); } @@ -1366,38 +1370,38 @@ int pechochar( #undef printw int printw( - const char *fmt, + const char *fmt, ...) { return(*(int *)0); } #undef wprintw int wprintw( - WINDOW *win, - const char *fmt, + WINDOW *win, + const char *fmt, ...) { return(*(int *)0); } #undef mvprintw int mvprintw( - int y, - int x, - const char *fmt, + int y, + int x, + const char *fmt, ...) { return(*(int *)0); } #undef mvwprintw int mvwprintw( - WINDOW *win, - int y, - int x, - const char *fmt, + WINDOW *win, + int y, + int x, + const char *fmt, ...) { return(*(int *)0); } #undef vwprintw int vwprintw( - WINDOW *win, - const char *fmt, + WINDOW *win, + const char *fmt, va_list argp) { return(*(int *)0); } @@ -1405,8 +1409,8 @@ int vwprintw( #undef wredrawln int wredrawln( - WINDOW *win, - int beg, + WINDOW *win, + int beg, int num) { return(*(int *)0); } @@ -1426,8 +1430,8 @@ int wnoutrefresh( #undef restartterm int restartterm( - char *termp, - int filenum, + char *termp, + int filenum, int *errret) { return(*(int *)0); } @@ -1435,38 +1439,38 @@ int restartterm( #undef vwscanw int vwscanw( - WINDOW *win, - char *fmt, + WINDOW *win, + char *fmt, va_list argp) { return(*(int *)0); } #undef scanw int scanw( - char *fmt, + char *fmt, ...) { return(*(int *)0); } #undef wscanw int wscanw( - WINDOW *win, - char *fmt, + WINDOW *win, + char *fmt, ...) { return(*(int *)0); } #undef mvscanw int mvscanw( - int y, - int x, - char *fmt, + int y, + int x, + char *fmt, ...) { return(*(int *)0); } #undef mvwscanw int mvwscanw( - WINDOW *win, - int y, - int x, - char *fmt, + WINDOW *win, + int y, + int x, + char *fmt, ...) { return(*(int *)0); } @@ -1479,7 +1483,7 @@ WINDOW *getwin( #undef putwin int putwin( - WINDOW *win, + WINDOW *win, FILE *filep) { return(*(int *)0); } @@ -1507,16 +1511,16 @@ int scr_set( #undef _nc_scroll_window void _nc_scroll_window( - WINDOW *win, - int const n, - short const top, - short const bottom, + WINDOW *win, + int const n, + short const top, + short const bottom, chtype blank) { /* void */ } #undef wscrl int wscrl( - WINDOW *win, + WINDOW *win, int n) { return(*(int *)0); } @@ -1524,7 +1528,7 @@ int wscrl( #undef scrollok int scrollok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } @@ -1532,8 +1536,8 @@ int scrollok( #undef wsetscrreg int wsetscrreg( - WINDOW *win, - int top, + WINDOW *win, + int top, int bottom) { return(*(int *)0); } @@ -1551,24 +1555,24 @@ void delscreen( #undef _nc_setupscreen int _nc_setupscreen( - short slines, - short const scolumns, + short slines, + short const scolumns, FILE *output) { return(*(int *)0); } #undef _nc_ripoffline int _nc_ripoffline( - int line, + int line, int (*init)( - WINDOW *p1, + WINDOW *p1, int p2)) { return(*(int *)0); } #undef ripoffline int ripoffline( - int line, + int line, int (*init)( - WINDOW *p1, + WINDOW *p1, int p2)) { return(*(int *)0); } @@ -1579,7 +1583,7 @@ int _nc_slk_format; #undef _nc_slk_initialize int _nc_slk_initialize( - WINDOW *stwin, + WINDOW *stwin, int cols) { return(*(int *)0); } @@ -1591,8 +1595,8 @@ int slk_restore(void) #undef slk_attr_set int slk_attr_set( - const attr_t attr, - short color_pair_number, + const attr_t attr, + short color_pair_number, void *opts) { return(*(int *)0); } @@ -1664,8 +1668,8 @@ int slk_refresh(void) #undef slk_set int slk_set( - int i, - const char *astr, + int i, + const char *astr, int format) { return(*(int *)0); } @@ -1679,7 +1683,7 @@ int slk_touch(void) #undef is_linetouched NCURSES_BOOL is_linetouched( - WINDOW *win, + WINDOW *win, int line) { return(*(NCURSES_BOOL *)0); } @@ -1690,9 +1694,9 @@ NCURSES_BOOL is_wintouched( #undef wtouchln int wtouchln( - WINDOW *win, - int y, - int n, + WINDOW *win, + int y, + int n, int changed) { return(*(int *)0); } @@ -1700,7 +1704,7 @@ int wtouchln( #undef _traceattr2 char *_traceattr2( - int bufnum, + int bufnum, attr_t newmode) { return(*(char **)0); } @@ -1716,13 +1720,13 @@ attr_t _nc_retrace_attr_t( #undef _nc_altcharset_name const char *_nc_altcharset_name( - attr_t attr, + attr_t attr, chtype ch) { return(*(const char **)0); } #undef _tracechtype2 char *_tracechtype2( - int bufnum, + int bufnum, chtype ch) { return(*(char **)0); } @@ -1740,7 +1744,7 @@ chtype _nc_retrace_chtype( #undef _tracedump void _tracedump( - const char *name, + const char *name, WINDOW *win) { /* void */ } @@ -1775,7 +1779,7 @@ int ungetch( #undef vidputs int vidputs( - chtype newmode, + chtype newmode, int (*outc)( int p1)) { return(*(int *)0); } @@ -1793,8 +1797,8 @@ chtype termattrs(void) #undef wvline int wvline( - WINDOW *win, - chtype ch, + WINDOW *win, + chtype ch, int n) { return(*(int *)0); } @@ -1802,8 +1806,8 @@ int wvline( #undef wattr_off int wattr_off( - WINDOW *win, - attr_t at, + WINDOW *win, + attr_t at, void *opts) { return(*(int *)0); } @@ -1811,8 +1815,8 @@ int wattr_off( #undef wattr_on int wattr_on( - WINDOW *win, - attr_t at, + WINDOW *win, + attr_t at, void *opts) { return(*(int *)0); } @@ -1832,14 +1836,14 @@ void _nc_synchook( #undef mvderwin int mvderwin( - WINDOW *win, - int y, + WINDOW *win, + int y, int x) { return(*(int *)0); } #undef syncok int syncok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL bf) { return(*(int *)0); } @@ -1873,7 +1877,7 @@ struct panelhook *_nc_panelhook(void) #undef _nc_printf_string char *_nc_printf_string( - const char *fmt, + const char *fmt, va_list ap) { return(*(char **)0); } @@ -1888,9 +1892,9 @@ int doupdate(void) #undef _nc_scrolln int _nc_scrolln( - int n, - int top, - int bot, + int n, + int top, + int bot, int maxy) { return(*(int *)0); } @@ -1913,9 +1917,13 @@ void _nc_do_xmc_glitch( /* ./trace/varargs.c */ +typedef enum { + atUnknown = 0, atInteger, atFloat, atPoint, atString +} ARGTYPE; + #undef _nc_varargs char *_nc_varargs( - const char *fmt, + const char *fmt, va_list ap) { return(*(char **)0); } @@ -1939,25 +1947,17 @@ void _nc_vsscanf(void) void _nc_freeall(void) { /* void */ } -/* ./base/define_key.c */ - -#undef define_key -int define_key( - const char *str, - int keycode) - { return(*(int *)0); } - /* ./expanded.c */ #undef _nc_toggle_attr_on void _nc_toggle_attr_on( - attr_t *S, + attr_t *S, attr_t at) { /* void */ } #undef _nc_toggle_attr_off void _nc_toggle_attr_off( - attr_t *S, + attr_t *S, attr_t at) { /* void */ } @@ -1976,29 +1976,6 @@ void _nc_UpdateAttrs( chtype c) { /* void */ } -/* ./base/key_defined.c */ - -#undef key_defined -int key_defined( - const char *str) - { return(*(int *)0); } - -/* ./base/keybound.c */ - -#undef keybound -char *keybound( - int code, - int count) - { return(*(char **)0); } - -/* ./base/keyok.c */ - -#undef keyok -int keyok( - int c, - NCURSES_BOOL flag) - { return(*(int *)0); } - /* ./base/lib_dft_fgbg.c */ #undef use_default_colors @@ -2007,7 +1984,7 @@ int use_default_colors(void) #undef assume_default_colors int assume_default_colors( - int fg, + int fg, int bg) { return(*(int *)0); } @@ -2015,7 +1992,7 @@ int assume_default_colors( #undef mcprint int mcprint( - char *data, + char *data, int len) { return(*(int *)0); } @@ -2023,19 +2000,19 @@ int mcprint( #undef is_term_resized NCURSES_BOOL is_term_resized( - int ToLines, + int ToLines, int ToCols) { return(*(NCURSES_BOOL *)0); } #undef resize_term int resize_term( - int ToLines, + int ToLines, int ToCols) { return(*(int *)0); } #undef resizeterm int resizeterm( - int ToLines, + int ToLines, int ToCols) { return(*(int *)0); } @@ -2046,45 +2023,19 @@ void _nc_trace_xnames( TERMTYPE *tp) { /* void */ } -/* ./base/tries.c */ - -#undef _nc_expand_try -char *_nc_expand_try( - struct tries *tree, - unsigned short code, - int *count, - size_t len) - { return(*(char **)0); } - -#undef _nc_remove_key -int _nc_remove_key( - struct tries **tree, - unsigned short code) - { return(*(int *)0); } - -#undef _nc_remove_string -int _nc_remove_string( - struct tries **tree, - const char *string) - { return(*(int *)0); } - -/* ./base/version.c */ - -#undef curses_version -const char *curses_version(void) - { return(*(const char **)0); } - /* ./base/wresize.c */ #undef wresize int wresize( - WINDOW *win, - int ToLines, + WINDOW *win, + int ToLines, int ToCols) { return(*(int *)0); } /* ./tinfo/access.c */ +#include + #undef _nc_rootname char *_nc_rootname( char *path) @@ -2102,7 +2053,7 @@ char *_nc_basename( #undef _nc_access int _nc_access( - const char *path, + const char *path, int mode) { return(*(int *)0); } @@ -2114,8 +2065,8 @@ int _nc_env_access(void) #undef _nc_add_to_try void _nc_add_to_try( - struct tries **tree, - const char *str, + struct tries **tree, + const char *str, unsigned short code) { /* void */ } @@ -2138,13 +2089,13 @@ char *_nc_save_str( #undef _nc_wrap_entry void _nc_wrap_entry( - ENTRY *const ep, + ENTRY *const ep, NCURSES_BOOL copy_strings) { /* void */ } #undef _nc_merge_entry void _nc_merge_entry( - TERMTYPE *const to, + TERMTYPE *const to, TERMTYPE *const from) { /* void */ } @@ -2152,13 +2103,13 @@ void _nc_merge_entry( #undef _nc_align_termtype void _nc_align_termtype( - TERMTYPE *to, + TERMTYPE *to, TERMTYPE *from) { /* void */ } #undef _nc_copy_termtype void _nc_copy_termtype( - TERMTYPE *dst, + TERMTYPE *dst, TERMTYPE *src) { /* void */ } @@ -2166,15 +2117,15 @@ void _nc_copy_termtype( #undef _nc_captoinfo char *_nc_captoinfo( - const char *cap, - const char *s, + const char *cap, + const char *s, int const parameterized) { return(*(char **)0); } #undef _nc_infotocap char *_nc_infotocap( - const char *cap, - const char *str, + const char *cap, + const char *str, int const parameterized) { return(*(char **)0); } @@ -2236,19 +2187,19 @@ void _nc_get_type( #undef _nc_warning void _nc_warning( - const char *const fmt, + const char *const fmt, ...) { /* void */ } #undef _nc_err_abort void _nc_err_abort( - const char *const fmt, + const char *const fmt, ...) { /* void */ } #undef _nc_syserr_abort void _nc_syserr_abort( - const char *const fmt, + const char *const fmt, ...) { /* void */ } @@ -2256,8 +2207,8 @@ void _nc_syserr_abort( #undef _nc_tic_expand char *_nc_tic_expand( - const char *srcp, - NCURSES_BOOL tic_format, + const char *srcp, + NCURSES_BOOL tic_format, int numbers) { return(*(char **)0); } @@ -2267,19 +2218,23 @@ char *_nc_tic_expand( #undef _nc_find_entry struct name_table_entry const *_nc_find_entry( - const char *string, + const char *string, const struct name_table_entry *const *hash_table) { return(*(struct name_table_entry const **)0); } #undef _nc_find_type_entry struct name_table_entry const *_nc_find_type_entry( - const char *string, - int type, + const char *string, + int type, const struct name_table_entry *table) { return(*(struct name_table_entry const **)0); } /* ./tinfo/comp_parse.c */ +#undef _nc_check_termtype2 +void (*_nc_check_termtype2)( + TERMTYPE *p1, + NCURSES_BOOL p2); #undef _nc_check_termtype void (*_nc_check_termtype)( TERMTYPE *p1); @@ -2293,22 +2248,40 @@ void _nc_free_entries( ENTRY *headp) { /* void */ } +#undef _nc_delink_entry +ENTRY *_nc_delink_entry( + ENTRY *headp, + TERMTYPE *tterm) + { return(*(ENTRY **)0); } + +#undef _nc_free_entry +void _nc_free_entry( + ENTRY *headp, + TERMTYPE *tterm) + { /* void */ } + #undef _nc_entry_match NCURSES_BOOL _nc_entry_match( - char *n1, + char *n1, char *n2) { return(*(NCURSES_BOOL *)0); } #undef _nc_read_entry_source void _nc_read_entry_source( - FILE *fp, - char *buf, - int literal, - NCURSES_BOOL silent, + FILE *fp, + char *buf, + int literal, + NCURSES_BOOL silent, NCURSES_BOOL (*hook)( ENTRY *p1)) { /* void */ } +#undef _nc_resolve_uses2 +int _nc_resolve_uses2( + NCURSES_BOOL fullresolve, + NCURSES_BOOL literal) + { return(*(int *)0); } + #undef _nc_resolve_uses int _nc_resolve_uses( NCURSES_BOOL fullresolve) @@ -2331,16 +2304,22 @@ struct token _nc_curr_token; #undef _nc_disable_period NCURSES_BOOL _nc_disable_period; +#undef _nc_reset_input +void _nc_reset_input( + FILE *fp, + char *buf) + { /* void */ } + #undef _nc_get_token int _nc_get_token( NCURSES_BOOL silent) { return(*(int *)0); } #undef _nc_trans_string -char _nc_trans_string( - char *ptr, +int _nc_trans_string( + char *ptr, char *last) - { return(*(char *)0); } + { return(*(int *)0); } #undef _nc_push_token void _nc_push_token( @@ -2352,17 +2331,11 @@ void _nc_panic_mode( char ch) { /* void */ } -#undef _nc_reset_input -void _nc_reset_input( - FILE *fp, - char *buf) - { /* void */ } - /* ./tinfo/doalloc.c */ #undef _nc_doalloc void *_nc_doalloc( - void *oldp, + void *oldp, size_t amount) { return(*(void **)0); } @@ -2429,6 +2402,11 @@ void _nc_init_acs(void) #include +struct speed { + int s; + int sp; +}; + #undef _nc_baudrate int _nc_baudrate( int OSpeed) @@ -2524,13 +2502,13 @@ int napms( #undef idlok int idlok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } #undef idcok void idcok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { /* void */ } @@ -2541,31 +2519,31 @@ int halfdelay( #undef nodelay int nodelay( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } #undef notimeout int notimeout( - WINDOW *win, + WINDOW *win, NCURSES_BOOL f) { return(*(int *)0); } #undef wtimeout void wtimeout( - WINDOW *win, + WINDOW *win, int delay) { /* void */ } #undef keypad int keypad( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } #undef meta int meta( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } @@ -2617,13 +2595,15 @@ void noqiflush(void) #undef intrflush int intrflush( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/lib_setup.c */ +#include #include +#include #undef ttytype char ttytype[256]; @@ -2655,10 +2635,18 @@ int _nc_unicode_locale(void) int _nc_locale_breaks_acs(void) { return(*(int *)0); } +#undef _nc_setupterm +int _nc_setupterm( + char *tname, + int Filedes, + int *errret, + NCURSES_BOOL reuse) + { return(*(int *)0); } + #undef setupterm int setupterm( - char *tname, - int Filedes, + char *tname, + int Filedes, int *errret) { return(*(int *)0); } @@ -2671,7 +2659,7 @@ char *BC; #undef tgetent int tgetent( - char *bufp, + char *bufp, const char *name) { return(*(int *)0); } @@ -2693,7 +2681,7 @@ int tgetnum( #undef tgetstr char *tgetstr( - char *id, + char *id, char **area) { return(*(char **)0); } @@ -2707,8 +2695,8 @@ char *termname(void) #undef tgoto char *tgoto( - const char *string, - int x, + const char *string, + int x, int y) { return(*(char **)0); } @@ -2731,19 +2719,27 @@ char *tigetstr( /* ./tinfo/lib_tparm.c */ +typedef struct { + union { + int num; + char *str; + } data; + NCURSES_BOOL num_type; +} stack_frame; + #undef _nc_tparm_err int _nc_tparm_err; #undef _nc_tparm_analyze int _nc_tparm_analyze( - const char *string, - char *p_is_s[9], + const char *string, + char *p_is_s[9], int *popcount) { return(*(int *)0); } #undef tparm char *tparm( - char *string, + char *string, ...) { return(*(char **)0); } @@ -2777,8 +2773,8 @@ int putp( #undef tputs int tputs( - const char *string, - int affcnt, + const char *string, + int affcnt, int (*outc)( int p1)) { return(*(int *)0); } @@ -2799,7 +2795,7 @@ void trace( #undef _tracef void _tracef( - const char *fmt, + const char *fmt, ...) { /* void */ } @@ -2823,6 +2819,21 @@ char *_nc_retrace_ptr( char *code) { return(*(char **)0); } +#undef _nc_retrace_cptr +const char *_nc_retrace_cptr( + const char *code) + { return(*(const char **)0); } + +#undef _nc_retrace_cvoid_ptr +void *_nc_retrace_cvoid_ptr( + void *code) + { return(*(void **)0); } + +#undef _nc_retrace_void_ptr +void *_nc_retrace_void_ptr( + void *code) + { return(*(void **)0); } + #undef _nc_retrace_sp SCREEN *_nc_retrace_sp( SCREEN *code) @@ -2835,6 +2846,11 @@ WINDOW *_nc_retrace_win( /* ./trace/lib_tracebits.c */ +typedef struct { + unsigned int val; + const char *name; +} BITNAMES; + #undef _nc_trace_ttymode char *_nc_trace_ttymode( struct termios *tty) @@ -2891,8 +2907,8 @@ int resetty(void) #undef _nc_timed_wait int _nc_timed_wait( - int mode, - int milliseconds, + int mode, + int milliseconds, int *timeleft) { return(*(int *)0); } @@ -2905,8 +2921,8 @@ char *_nc_first_name( #undef _nc_name_match int _nc_name_match( - const char *const namelst, - const char *const name, + const char *const namelst, + const char *const name, const char *const delim) { return(*(int *)0); } @@ -2929,17 +2945,22 @@ char *const strfnames[] = {0}; #undef _nc_parse_entry int _nc_parse_entry( - struct entry *entryp, - int literal, + struct entry *entryp, + int literal, NCURSES_BOOL silent) { return(*(int *)0); } #undef _nc_capcmp int _nc_capcmp( - const char *s, + const char *s, const char *t) { return(*(int *)0); } +typedef struct { + const char *from; + const char *to; +} assoc; + /* ./tinfo/read_entry.c */ #undef _nc_tic_dir @@ -2954,22 +2975,25 @@ void _nc_keep_tic_dir( #undef _nc_read_file_entry int _nc_read_file_entry( - const char *const filename, + const char *const filename, TERMTYPE *ptr) { return(*(int *)0); } #undef _nc_read_entry int _nc_read_entry( - const char *const tn, - char *const filename, + const char *const tn, + char *const filename, TERMTYPE *const tp) { return(*(int *)0); } /* ./tinfo/read_termcap.c */ +#include +#include + #undef _nc_read_termcap_entry int _nc_read_termcap_entry( - const char *const tn, + const char *const tn, TERMTYPE *const tp) { return(*(int *)0); } @@ -2977,7 +3001,7 @@ int _nc_read_termcap_entry( #undef _nc_set_buffer void _nc_set_buffer( - FILE *ofp, + FILE *ofp, NCURSES_BOOL buffered) { /* void */ } @@ -2985,46 +3009,51 @@ void _nc_set_buffer( #undef _nc_str_init string_desc *_nc_str_init( - string_desc *dst, - char *src, + string_desc *dst, + char *src, size_t len) { return(*(string_desc **)0); } #undef _nc_str_null string_desc *_nc_str_null( - string_desc *dst, + string_desc *dst, size_t len) { return(*(string_desc **)0); } #undef _nc_str_copy string_desc *_nc_str_copy( - string_desc *dst, + string_desc *dst, string_desc *src) { return(*(string_desc **)0); } #undef _nc_safe_strcat NCURSES_BOOL _nc_safe_strcat( - string_desc *dst, + string_desc *dst, const char *src) { return(*(NCURSES_BOOL *)0); } #undef _nc_safe_strcpy NCURSES_BOOL _nc_safe_strcpy( - string_desc *dst, + string_desc *dst, const char *src) { return(*(NCURSES_BOOL *)0); } /* ./trace/trace_buf.c */ +typedef struct { + char *text; + size_t size; +} LIST; + #undef _nc_trace_buf char *_nc_trace_buf( - int bufnum, + int bufnum, size_t want) { return(*(char **)0); } #undef _nc_trace_bufcat char *_nc_trace_bufcat( - int bufnum, + int bufnum, const char *value) { return(*(char **)0); } @@ -3035,6 +3064,35 @@ void _nc_trace_tries( struct tries *tree) { /* void */ } +/* ./base/tries.c */ + +#undef _nc_expand_try +char *_nc_expand_try( + struct tries *tree, + unsigned short code, + int *count, + size_t len) + { return(*(char **)0); } + +#undef _nc_remove_key +int _nc_remove_key( + struct tries **tree, + unsigned short code) + { return(*(int *)0); } + +#undef _nc_remove_string +int _nc_remove_string( + struct tries **tree, + const char *string) + { return(*(int *)0); } + +/* ./tinfo/trim_sgr0.c */ + +#undef _nc_trim_sgr0 +char *_nc_trim_sgr0( + TERMTYPE *tp) + { return(*(char **)0); } + /* ./unctrl.c */ #undef unctrl @@ -3046,7 +3104,7 @@ char *unctrl( #undef _nc_visbuf2 const char *_nc_visbuf2( - int bufnum, + int bufnum, const char *buf) { return(*(const char **)0); } @@ -3057,7 +3115,7 @@ const char *_nc_visbuf( #undef _nc_visbufn const char *_nc_visbufn( - const char *buf, + const char *buf, int len) { return(*(const char **)0); } @@ -3076,3 +3134,40 @@ void _nc_write_entry( #undef _nc_tic_written int _nc_tic_written(void) { return(*(int *)0); } + +/* ./base/define_key.c */ + +#undef define_key +int define_key( + const char *str, + int keycode) + { return(*(int *)0); } + +/* ./base/key_defined.c */ + +#undef key_defined +int key_defined( + const char *str) + { return(*(int *)0); } + +/* ./base/keybound.c */ + +#undef keybound +char *keybound( + int code, + int count) + { return(*(char **)0); } + +/* ./base/keyok.c */ + +#undef keyok +int keyok( + int c, + NCURSES_BOOL flag) + { return(*(int *)0); } + +/* ./base/version.c */ + +#undef curses_version +const char *curses_version(void) + { return(*(const char **)0); } diff --git a/ncurses/llib-lncursesw b/ncurses/llib-lncursesw index ab8b1d4f..be5d8645 100644 --- a/ncurses/llib-lncursesw +++ b/ncurses/llib-lncursesw @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2001-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 2001-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 2001-2004 * + * Author: Thomas E. Dickey 2001-2005 * ****************************************************************************/ /* LINTLIBRARY */ @@ -48,6 +48,8 @@ void _nc_linedump(void) /* ./tty/hashmap.c */ +#include + #undef _nc_hash_map void _nc_hash_map(void) { /* void */ } @@ -59,8 +61,8 @@ void _nc_make_oldhash( #undef _nc_scroll_oldhash void _nc_scroll_oldhash( - int n, - int top, + int n, + int top, int bot) { /* void */ } @@ -70,25 +72,31 @@ void _nc_scroll_oldhash( #undef _nc_render cchar_t _nc_render( - WINDOW *win, + WINDOW *win, cchar_t ch) { return(*(cchar_t *)0); } +#undef _nc_build_wch +int _nc_build_wch( + WINDOW *win, + cchar_t *ch) + { return(*(int *)0); } + #undef _nc_waddch_nosync int _nc_waddch_nosync( - WINDOW *win, + WINDOW *win, const cchar_t c) { return(*(int *)0); } #undef waddch int waddch( - WINDOW *win, + WINDOW *win, const chtype ch) { return(*(int *)0); } #undef wechochar int wechochar( - WINDOW *win, + WINDOW *win, const chtype ch) { return(*(int *)0); } @@ -96,15 +104,15 @@ int wechochar( #undef waddnstr int waddnstr( - WINDOW *win, - const char *astr, + WINDOW *win, + const char *astr, int n) { return(*(int *)0); } #undef waddchnstr int waddchnstr( - WINDOW *win, - const chtype *astr, + WINDOW *win, + const chtype *astr, int n) { return(*(int *)0); } @@ -115,15 +123,15 @@ int _nc_wchstrlen( #undef wadd_wchnstr int wadd_wchnstr( - WINDOW *win, - const cchar_t *astr, + WINDOW *win, + const cchar_t *astr, int n) { return(*(int *)0); } #undef waddnwstr int waddnwstr( - WINDOW *win, - const wchar_t *str, + WINDOW *win, + const wchar_t *str, int n) { return(*(int *)0); } @@ -137,25 +145,25 @@ int beep(void) #undef wbkgrndset void wbkgrndset( - WINDOW *win, + WINDOW *win, const cchar_t *ch) { /* void */ } #undef wbkgdset void wbkgdset( - WINDOW *win, + WINDOW *win, chtype ch) { /* void */ } #undef wbkgrnd int wbkgrnd( - WINDOW *win, + WINDOW *win, const cchar_t *ch) { return(*(int *)0); } #undef wbkgd int wbkgd( - WINDOW *win, + WINDOW *win, chtype ch) { return(*(int *)0); } @@ -163,14 +171,14 @@ int wbkgd( #undef wborder int wborder( - WINDOW *win, - chtype ls, - chtype rs, - chtype ts, - chtype bs, - chtype tl, - chtype tr, - chtype bl, + WINDOW *win, + chtype ls, + chtype rs, + chtype ts, + chtype bs, + chtype tl, + chtype tr, + chtype bl, chtype br) { return(*(int *)0); } @@ -178,10 +186,10 @@ int wborder( #undef wchgat int wchgat( - WINDOW *win, - int n, - attr_t attr, - short color, + WINDOW *win, + int n, + attr_t attr, + short color, const void *opts) { return(*(int *)0); } @@ -196,7 +204,7 @@ int wclear( #undef clearok int clearok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } @@ -233,16 +241,16 @@ int start_color(void) #undef init_pair int init_pair( - short pair, - short f, + short pair, + short f, short b) { return(*(int *)0); } #undef init_color int init_color( - short color, - short r, - short g, + short color, + short r, + short g, short b) { return(*(int *)0); } @@ -256,24 +264,24 @@ NCURSES_BOOL has_colors(void) #undef color_content int color_content( - short color, - short *r, - short *g, + short color, + short *r, + short *g, short *b) { return(*(int *)0); } #undef pair_content int pair_content( - short pair, - short *f, + short pair, + short *f, short *b) { return(*(int *)0); } #undef _nc_do_color void _nc_do_color( - int old_pair, - int pair, - NCURSES_BOOL reverse, + int old_pair, + int pair, + NCURSES_BOOL reverse, int (*outc)( int p1)) { /* void */ } @@ -282,8 +290,8 @@ void _nc_do_color( #undef wcolor_set int wcolor_set( - WINDOW *win, - short color_pair_number, + WINDOW *win, + short color_pair_number, void *opts) { return(*(int *)0); } @@ -339,7 +347,7 @@ int addch( #undef addchnstr int addchnstr( - const chtype *a1, + const chtype *a1, int z) { return(*(int *)0); } @@ -350,7 +358,7 @@ int addchstr( #undef addnstr int addnstr( - const char *a1, + const char *a1, int z) { return(*(int *)0); } @@ -376,27 +384,27 @@ int attrset( #undef attr_get int attr_get( - attr_t *a1, - short *a2, + attr_t *a1, + short *a2, void *z) { return(*(int *)0); } #undef attr_off int attr_off( - attr_t a1, + attr_t a1, void *z) { return(*(int *)0); } #undef attr_on int attr_on( - attr_t a1, + attr_t a1, void *z) { return(*(int *)0); } #undef attr_set int attr_set( - attr_t a1, - short a2, + attr_t a1, + short a2, void *z) { return(*(int *)0); } @@ -412,28 +420,28 @@ void bkgdset( #undef border int border( - chtype a1, - chtype a2, - chtype a3, - chtype a4, - chtype a5, - chtype a6, - chtype a7, + chtype a1, + chtype a2, + chtype a3, + chtype a4, + chtype a5, + chtype a6, + chtype a7, chtype z) { return(*(int *)0); } #undef box int box( - WINDOW *a1, - chtype a2, + WINDOW *a1, + chtype a2, chtype z) { return(*(int *)0); } #undef chgat int chgat( - int a1, - attr_t a2, - short a3, + int a1, + attr_t a2, + short a3, const void *z) { return(*(int *)0); } @@ -451,7 +459,7 @@ int clrtoeol(void) #undef color_set int color_set( - short a1, + short a1, void *z) { return(*(int *)0); } @@ -488,7 +496,7 @@ int getch(void) #undef getnstr int getnstr( - char *a1, + char *a1, int z) { return(*(int *)0); } @@ -499,7 +507,7 @@ int getstr( #undef hline int hline( - chtype a1, + chtype a1, int z) { return(*(int *)0); } @@ -509,7 +517,7 @@ chtype inch(void) #undef inchnstr int inchnstr( - chtype *a1, + chtype *a1, int z) { return(*(int *)0); } @@ -520,7 +528,7 @@ int inchstr( #undef innstr int innstr( - char *a1, + char *a1, int z) { return(*(int *)0); } @@ -540,7 +548,7 @@ int insertln(void) #undef insnstr int insnstr( - const char *a1, + const char *a1, int z) { return(*(int *)0); } @@ -556,323 +564,323 @@ int instr( #undef move int move( - int a1, + int a1, int z) { return(*(int *)0); } #undef mvaddch int mvaddch( - int a1, - int a2, + int a1, + int a2, const chtype z) { return(*(int *)0); } #undef mvaddchnstr int mvaddchnstr( - int a1, - int a2, - const chtype *a3, + int a1, + int a2, + const chtype *a3, int z) { return(*(int *)0); } #undef mvaddchstr int mvaddchstr( - int a1, - int a2, + int a1, + int a2, const chtype *z) { return(*(int *)0); } #undef mvaddnstr int mvaddnstr( - int a1, - int a2, - const char *a3, + int a1, + int a2, + const char *a3, int z) { return(*(int *)0); } #undef mvaddstr int mvaddstr( - int a1, - int a2, + int a1, + int a2, const char *z) { return(*(int *)0); } #undef mvchgat int mvchgat( - int a1, - int a2, - int a3, - attr_t a4, - short a5, + int a1, + int a2, + int a3, + attr_t a4, + short a5, const void *z) { return(*(int *)0); } #undef mvdelch int mvdelch( - int a1, + int a1, int z) { return(*(int *)0); } #undef mvgetch int mvgetch( - int a1, + int a1, int z) { return(*(int *)0); } #undef mvgetnstr int mvgetnstr( - int a1, - int a2, - char *a3, + int a1, + int a2, + char *a3, int z) { return(*(int *)0); } #undef mvgetstr int mvgetstr( - int a1, - int a2, + int a1, + int a2, char *z) { return(*(int *)0); } #undef mvhline int mvhline( - int a1, - int a2, - chtype a3, + int a1, + int a2, + chtype a3, int z) { return(*(int *)0); } #undef mvinch chtype mvinch( - int a1, + int a1, int z) { return(*(chtype *)0); } #undef mvinchnstr int mvinchnstr( - int a1, - int a2, - chtype *a3, + int a1, + int a2, + chtype *a3, int z) { return(*(int *)0); } #undef mvinchstr int mvinchstr( - int a1, - int a2, + int a1, + int a2, chtype *z) { return(*(int *)0); } #undef mvinnstr int mvinnstr( - int a1, - int a2, - char *a3, + int a1, + int a2, + char *a3, int z) { return(*(int *)0); } #undef mvinsch int mvinsch( - int a1, - int a2, + int a1, + int a2, chtype z) { return(*(int *)0); } #undef mvinsnstr int mvinsnstr( - int a1, - int a2, - const char *a3, + int a1, + int a2, + const char *a3, int z) { return(*(int *)0); } #undef mvinsstr int mvinsstr( - int a1, - int a2, + int a1, + int a2, const char *z) { return(*(int *)0); } #undef mvinstr int mvinstr( - int a1, - int a2, + int a1, + int a2, char *z) { return(*(int *)0); } #undef mvvline int mvvline( - int a1, - int a2, - chtype a3, + int a1, + int a2, + chtype a3, int z) { return(*(int *)0); } #undef mvwaddch int mvwaddch( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const chtype z) { return(*(int *)0); } #undef mvwaddchnstr int mvwaddchnstr( - WINDOW *a1, - int a2, - int a3, - const chtype *a4, + WINDOW *a1, + int a2, + int a3, + const chtype *a4, int z) { return(*(int *)0); } #undef mvwaddchstr int mvwaddchstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const chtype *z) { return(*(int *)0); } #undef mvwaddnstr int mvwaddnstr( - WINDOW *a1, - int a2, - int a3, - const char *a4, + WINDOW *a1, + int a2, + int a3, + const char *a4, int z) { return(*(int *)0); } #undef mvwaddstr int mvwaddstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const char *z) { return(*(int *)0); } #undef mvwchgat int mvwchgat( - WINDOW *a1, - int a2, - int a3, - int a4, - attr_t a5, - short a6, + WINDOW *a1, + int a2, + int a3, + int a4, + attr_t a5, + short a6, const void *z) { return(*(int *)0); } #undef mvwdelch int mvwdelch( - WINDOW *a1, - int a2, + WINDOW *a1, + int a2, int z) { return(*(int *)0); } #undef mvwgetch int mvwgetch( - WINDOW *a1, - int a2, + WINDOW *a1, + int a2, int z) { return(*(int *)0); } #undef mvwgetnstr int mvwgetnstr( - WINDOW *a1, - int a2, - int a3, - char *a4, + WINDOW *a1, + int a2, + int a3, + char *a4, int z) { return(*(int *)0); } #undef mvwgetstr int mvwgetstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, char *z) { return(*(int *)0); } #undef mvwhline int mvwhline( - WINDOW *a1, - int a2, - int a3, - chtype a4, + WINDOW *a1, + int a2, + int a3, + chtype a4, int z) { return(*(int *)0); } #undef mvwinch chtype mvwinch( - WINDOW *a1, - int a2, + WINDOW *a1, + int a2, int z) { return(*(chtype *)0); } #undef mvwinchnstr int mvwinchnstr( - WINDOW *a1, - int a2, - int a3, - chtype *a4, + WINDOW *a1, + int a2, + int a3, + chtype *a4, int z) { return(*(int *)0); } #undef mvwinchstr int mvwinchstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, chtype *z) { return(*(int *)0); } #undef mvwinnstr int mvwinnstr( - WINDOW *a1, - int a2, - int a3, - char *a4, + WINDOW *a1, + int a2, + int a3, + char *a4, int z) { return(*(int *)0); } #undef mvwinsch int mvwinsch( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, chtype z) { return(*(int *)0); } #undef mvwinsnstr int mvwinsnstr( - WINDOW *a1, - int a2, - int a3, - const char *a4, + WINDOW *a1, + int a2, + int a3, + const char *a4, int z) { return(*(int *)0); } #undef mvwinsstr int mvwinsstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const char *z) { return(*(int *)0); } #undef mvwinstr int mvwinstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, char *z) { return(*(int *)0); } #undef mvwvline int mvwvline( - WINDOW *a1, - int a2, - int a3, - chtype a4, + WINDOW *a1, + int a2, + int a3, + chtype a4, int z) { return(*(int *)0); } @@ -902,19 +910,19 @@ int scroll( #undef setscrreg int setscrreg( - int a1, + int a1, int z) { return(*(int *)0); } #undef slk_attr_off int slk_attr_off( - const attr_t a1, + const attr_t a1, void *z) { return(*(int *)0); } #undef slk_attr_on int slk_attr_on( - attr_t a1, + attr_t a1, void *z) { return(*(int *)0); } @@ -933,8 +941,8 @@ void timeout( #undef touchline int touchline( - WINDOW *a1, - int a2, + WINDOW *a1, + int a2, int z) { return(*(int *)0); } @@ -950,67 +958,67 @@ int untouchwin( #undef vline int vline( - chtype a1, + chtype a1, int z) { return(*(int *)0); } #undef vw_printw int vw_printw( - WINDOW *a1, - const char *a2, + WINDOW *a1, + const char *a2, va_list z) { return(*(int *)0); } #undef vw_scanw int vw_scanw( - WINDOW *a1, - char *a2, + WINDOW *a1, + char *a2, va_list z) { return(*(int *)0); } #undef waddchstr int waddchstr( - WINDOW *a1, + WINDOW *a1, const chtype *z) { return(*(int *)0); } #undef waddstr int waddstr( - WINDOW *a1, + WINDOW *a1, const char *z) { return(*(int *)0); } #undef wattron int wattron( - WINDOW *a1, + WINDOW *a1, int z) { return(*(int *)0); } #undef wattroff int wattroff( - WINDOW *a1, + WINDOW *a1, int z) { return(*(int *)0); } #undef wattrset int wattrset( - WINDOW *a1, + WINDOW *a1, int z) { return(*(int *)0); } #undef wattr_get int wattr_get( - WINDOW *a1, - attr_t *a2, - short *a3, + WINDOW *a1, + attr_t *a2, + short *a3, void *z) { return(*(int *)0); } #undef wattr_set int wattr_set( - WINDOW *a1, - attr_t a2, - short a3, + WINDOW *a1, + attr_t a2, + short a3, void *z) { return(*(int *)0); } @@ -1021,13 +1029,13 @@ int wdeleteln( #undef wgetstr int wgetstr( - WINDOW *a1, + WINDOW *a1, char *z) { return(*(int *)0); } #undef winchstr int winchstr( - WINDOW *a1, + WINDOW *a1, chtype *z) { return(*(int *)0); } @@ -1038,13 +1046,13 @@ int winsertln( #undef winsstr int winsstr( - WINDOW *a1, + WINDOW *a1, const char *z) { return(*(int *)0); } #undef winstr int winstr( - WINDOW *a1, + WINDOW *a1, char *z) { return(*(int *)0); } @@ -1065,7 +1073,7 @@ int add_wch( #undef add_wchnstr int add_wchnstr( - const cchar_t *a1, + const cchar_t *a1, int z) { return(*(int *)0); } @@ -1076,7 +1084,7 @@ int add_wchstr( #undef addnwstr int addnwstr( - const wchar_t *a1, + const wchar_t *a1, int z) { return(*(int *)0); } @@ -1097,20 +1105,20 @@ void bkgrndset( #undef border_set int border_set( - const cchar_t *a1, - const cchar_t *a2, - const cchar_t *a3, - const cchar_t *a4, - const cchar_t *a5, - const cchar_t *a6, - const cchar_t *a7, + const cchar_t *a1, + const cchar_t *a2, + const cchar_t *a3, + const cchar_t *a4, + const cchar_t *a5, + const cchar_t *a6, + const cchar_t *a7, const cchar_t *z) { return(*(int *)0); } #undef box_set int box_set( - WINDOW *a1, - const cchar_t *a2, + WINDOW *a1, + const cchar_t *a2, const cchar_t *z) { return(*(int *)0); } @@ -1136,13 +1144,13 @@ int getbkgrnd( #undef getn_wstr int getn_wstr( - wint_t *a1, + wint_t *a1, int z) { return(*(int *)0); } #undef hline_set int hline_set( - const cchar_t *a1, + const cchar_t *a1, int z) { return(*(int *)0); } @@ -1153,7 +1161,7 @@ int in_wch( #undef in_wchnstr int in_wchnstr( - cchar_t *a1, + cchar_t *a1, int z) { return(*(int *)0); } @@ -1164,13 +1172,13 @@ int in_wchstr( #undef innwstr int innwstr( - wchar_t *a1, + wchar_t *a1, int z) { return(*(int *)0); } #undef ins_nwstr int ins_nwstr( - const wchar_t *a1, + const wchar_t *a1, int z) { return(*(int *)0); } @@ -1191,331 +1199,331 @@ int inwstr( #undef mvadd_wch int mvadd_wch( - int a1, - int a2, + int a1, + int a2, const cchar_t *z) { return(*(int *)0); } #undef mvadd_wchnstr int mvadd_wchnstr( - int a1, - int a2, - const cchar_t *a3, + int a1, + int a2, + const cchar_t *a3, int z) { return(*(int *)0); } #undef mvadd_wchstr int mvadd_wchstr( - int a1, - int a2, + int a1, + int a2, const cchar_t *z) { return(*(int *)0); } #undef mvaddnwstr int mvaddnwstr( - int a1, - int a2, - const wchar_t *a3, + int a1, + int a2, + const wchar_t *a3, int z) { return(*(int *)0); } #undef mvaddwstr int mvaddwstr( - int a1, - int a2, + int a1, + int a2, const wchar_t *z) { return(*(int *)0); } #undef mvget_wch int mvget_wch( - int a1, - int a2, + int a1, + int a2, wint_t *z) { return(*(int *)0); } #undef mvget_wstr int mvget_wstr( - int a1, - int a2, + int a1, + int a2, wint_t *z) { return(*(int *)0); } #undef mvgetn_wstr int mvgetn_wstr( - int a1, - int a2, - wint_t *a3, + int a1, + int a2, + wint_t *a3, int z) { return(*(int *)0); } #undef mvhline_set int mvhline_set( - int a1, - int a2, - const cchar_t *a3, + int a1, + int a2, + const cchar_t *a3, int z) { return(*(int *)0); } #undef mvin_wch int mvin_wch( - int a1, - int a2, + int a1, + int a2, cchar_t *z) { return(*(int *)0); } #undef mvin_wchnstr int mvin_wchnstr( - int a1, - int a2, - cchar_t *a3, + int a1, + int a2, + cchar_t *a3, int z) { return(*(int *)0); } #undef mvin_wchstr int mvin_wchstr( - int a1, - int a2, + int a1, + int a2, cchar_t *z) { return(*(int *)0); } #undef mvinnwstr int mvinnwstr( - int a1, - int a2, - wchar_t *a3, + int a1, + int a2, + wchar_t *a3, int z) { return(*(int *)0); } #undef mvins_nwstr int mvins_nwstr( - int a1, - int a2, - const wchar_t *a3, + int a1, + int a2, + const wchar_t *a3, int z) { return(*(int *)0); } #undef mvins_wch int mvins_wch( - int a1, - int a2, + int a1, + int a2, const cchar_t *z) { return(*(int *)0); } #undef mvins_wstr int mvins_wstr( - int a1, - int a2, + int a1, + int a2, const wchar_t *z) { return(*(int *)0); } #undef mvinwstr int mvinwstr( - int a1, - int a2, + int a1, + int a2, wchar_t *z) { return(*(int *)0); } #undef mvvline_set int mvvline_set( - int a1, - int a2, - const cchar_t *a3, + int a1, + int a2, + const cchar_t *a3, int z) { return(*(int *)0); } #undef mvwadd_wch int mvwadd_wch( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const cchar_t *z) { return(*(int *)0); } #undef mvwadd_wchnstr int mvwadd_wchnstr( - WINDOW *a1, - int a2, - int a3, - const cchar_t *a4, + WINDOW *a1, + int a2, + int a3, + const cchar_t *a4, int z) { return(*(int *)0); } #undef mvwadd_wchstr int mvwadd_wchstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const cchar_t *z) { return(*(int *)0); } #undef mvwaddnwstr int mvwaddnwstr( - WINDOW *a1, - int a2, - int a3, - const wchar_t *a4, + WINDOW *a1, + int a2, + int a3, + const wchar_t *a4, int z) { return(*(int *)0); } #undef mvwaddwstr int mvwaddwstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const wchar_t *z) { return(*(int *)0); } #undef mvwget_wch int mvwget_wch( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, wint_t *z) { return(*(int *)0); } #undef mvwget_wstr int mvwget_wstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, wint_t *z) { return(*(int *)0); } #undef mvwgetn_wstr int mvwgetn_wstr( - WINDOW *a1, - int a2, - int a3, - wint_t *a4, + WINDOW *a1, + int a2, + int a3, + wint_t *a4, int z) { return(*(int *)0); } #undef mvwhline_set int mvwhline_set( - WINDOW *a1, - int a2, - int a3, - const cchar_t *a4, + WINDOW *a1, + int a2, + int a3, + const cchar_t *a4, int z) { return(*(int *)0); } #undef mvwin_wch int mvwin_wch( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, cchar_t *z) { return(*(int *)0); } #undef mvwin_wchnstr int mvwin_wchnstr( - WINDOW *a1, - int a2, - int a3, - cchar_t *a4, + WINDOW *a1, + int a2, + int a3, + cchar_t *a4, int z) { return(*(int *)0); } #undef mvwin_wchstr int mvwin_wchstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, cchar_t *z) { return(*(int *)0); } #undef mvwinnwstr int mvwinnwstr( - WINDOW *a1, - int a2, - int a3, - wchar_t *a4, + WINDOW *a1, + int a2, + int a3, + wchar_t *a4, int z) { return(*(int *)0); } #undef mvwins_nwstr int mvwins_nwstr( - WINDOW *a1, - int a2, - int a3, - const wchar_t *a4, + WINDOW *a1, + int a2, + int a3, + const wchar_t *a4, int z) { return(*(int *)0); } #undef mvwins_wch int mvwins_wch( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const cchar_t *z) { return(*(int *)0); } #undef mvwins_wstr int mvwins_wstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, const wchar_t *z) { return(*(int *)0); } #undef mvwinwstr int mvwinwstr( - WINDOW *a1, - int a2, - int a3, + WINDOW *a1, + int a2, + int a3, wchar_t *z) { return(*(int *)0); } #undef mvwvline_set int mvwvline_set( - WINDOW *a1, - int a2, - int a3, - const cchar_t *a4, + WINDOW *a1, + int a2, + int a3, + const cchar_t *a4, int z) { return(*(int *)0); } #undef vline_set int vline_set( - const cchar_t *a1, + const cchar_t *a1, int z) { return(*(int *)0); } #undef wadd_wchstr int wadd_wchstr( - WINDOW *a1, + WINDOW *a1, const cchar_t *z) { return(*(int *)0); } #undef waddwstr int waddwstr( - WINDOW *a1, + WINDOW *a1, const wchar_t *z) { return(*(int *)0); } #undef wget_wstr int wget_wstr( - WINDOW *a1, + WINDOW *a1, wint_t *z) { return(*(int *)0); } #undef win_wchstr int win_wchstr( - WINDOW *a1, + WINDOW *a1, cchar_t *z) { return(*(int *)0); } #undef wins_wstr int wins_wstr( - WINDOW *a1, + WINDOW *a1, const wchar_t *z) { return(*(int *)0); } #undef mouse_trafo -NCURSES_BOOL mouse_trafo( - int *a1, - int *a2, - NCURSES_BOOL z) +NCURSES_BOOL mouse_trafo( + int *a1, + int *a2, + NCURSES_BOOL z) { return(*(NCURSES_BOOL *)0); } /* ./base/lib_getch.c */ @@ -1527,8 +1535,8 @@ int ESCDELAY; #undef _nc_wgetch int _nc_wgetch( - WINDOW *win, - unsigned long *result, + WINDOW *win, + unsigned long *result, int use_meta) { return(*(int *)0); } @@ -1541,8 +1549,8 @@ int wgetch( #undef wgetnstr int wgetnstr( - WINDOW *win, - char *str, + WINDOW *win, + char *str, int maxlen) { return(*(int *)0); } @@ -1550,8 +1558,8 @@ int wgetnstr( #undef whline int whline( - WINDOW *win, - chtype ch, + WINDOW *win, + chtype ch, int n) { return(*(int *)0); } @@ -1559,7 +1567,7 @@ int whline( #undef immedok void immedok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { /* void */ } @@ -1567,8 +1575,8 @@ void immedok( #undef winchnstr int winchnstr( - WINDOW *win, - chtype *str, + WINDOW *win, + chtype *str, int n) { return(*(int *)0); } @@ -1581,29 +1589,31 @@ WINDOW *initscr(void) /* ./base/lib_insch.c */ #undef _nc_insert_ch -void _nc_insert_ch( - WINDOW *win, +int _nc_insert_ch( + WINDOW *win, chtype ch) - { /* void */ } + { return(*(int *)0); } #undef winsch int winsch( - WINDOW *win, + WINDOW *win, chtype c) { return(*(int *)0); } -#undef winsnstr -int winsnstr( - WINDOW *win, - const char *s, - int n) - { return(*(int *)0); } - /* ./base/lib_insdel.c */ #undef winsdelln int winsdelln( - WINDOW *win, + WINDOW *win, + int n) + { return(*(int *)0); } + +/* ./base/lib_insnstr.c */ + +#undef winsnstr +int winsnstr( + WINDOW *win, + const char *s, int n) { return(*(int *)0); } @@ -1611,8 +1621,8 @@ int winsdelln( #undef winnstr int winnstr( - WINDOW *win, - char *str, + WINDOW *win, + char *str, int n) { return(*(int *)0); } @@ -1626,7 +1636,7 @@ NCURSES_BOOL isendwin(void) #undef leaveok int leaveok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } @@ -1644,14 +1654,14 @@ int ungetmouse( #undef mousemask mmask_t mousemask( - mmask_t newmask, + mmask_t newmask, mmask_t *oldmask) { return(*(mmask_t *)0); } #undef wenclose NCURSES_BOOL wenclose( - const WINDOW *win, - int y, + const WINDOW *win, + int y, int x) { return(*(NCURSES_BOOL *)0); } @@ -1666,9 +1676,9 @@ int _nc_has_mouse(void) #undef wmouse_trafo NCURSES_BOOL wmouse_trafo( - const WINDOW *win, - int *pY, - int *pX, + const WINDOW *win, + int *pY, + int *pX, NCURSES_BOOL to_screen) { return(*(NCURSES_BOOL *)0); } @@ -1676,8 +1686,8 @@ NCURSES_BOOL wmouse_trafo( #undef wmove int wmove( - WINDOW *win, - int y, + WINDOW *win, + int y, int x) { return(*(int *)0); } @@ -1685,7 +1695,7 @@ int wmove( #undef _nc_msec_cost int _nc_msec_cost( - const char *const cap, + const char *const cap, int affcnt) { return(*(int *)0); } @@ -1703,9 +1713,9 @@ void _nc_mvcur_wrap(void) #undef mvcur int mvcur( - int yold, - int xold, - int ynew, + int yold, + int xold, + int ynew, int xnew) { return(*(int *)0); } @@ -1716,8 +1726,8 @@ int _nc_optimize_enable; #undef mvwin int mvwin( - WINDOW *win, - int by, + WINDOW *win, + int by, int bx) { return(*(int *)0); } @@ -1729,8 +1739,8 @@ void filter(void) #undef newterm SCREEN *newterm( - char *name, - FILE *ofp, + char *name, + FILE *ofp, FILE *ifp) { return(*(SCREEN **)0); } @@ -1743,36 +1753,36 @@ int _nc_freewin( #undef newwin WINDOW *newwin( - int num_lines, - int num_columns, - int begy, + int num_lines, + int num_columns, + int begy, int begx) { return(*(WINDOW **)0); } #undef derwin WINDOW *derwin( - WINDOW *orig, - int num_lines, - int num_columns, - int begy, + WINDOW *orig, + int num_lines, + int num_columns, + int begy, int begx) { return(*(WINDOW **)0); } #undef subwin WINDOW *subwin( - WINDOW *w, - int l, - int c, - int y, + WINDOW *w, + int l, + int c, + int y, int x) { return(*(WINDOW **)0); } #undef _nc_makenew WINDOW *_nc_makenew( - int num_lines, - int num_columns, - int begy, - int begx, + int num_lines, + int num_columns, + int begy, + int begx, int flags) { return(*(WINDOW **)0); } @@ -1790,26 +1800,26 @@ int nonl(void) #undef overlay int overlay( - const WINDOW *win1, + const WINDOW *win1, WINDOW *win2) { return(*(int *)0); } #undef overwrite int overwrite( - const WINDOW *win1, + const WINDOW *win1, WINDOW *win2) { return(*(int *)0); } #undef copywin int copywin( - const WINDOW *src, - WINDOW *dst, - int sminrow, - int smincol, - int dminrow, - int dmincol, - int dmaxrow, - int dmaxcol, + const WINDOW *src, + WINDOW *dst, + int sminrow, + int smincol, + int dminrow, + int dmincol, + int dmaxrow, + int dmaxcol, int over) { return(*(int *)0); } @@ -1817,44 +1827,44 @@ int copywin( #undef newpad WINDOW *newpad( - int l, + int l, int c) { return(*(WINDOW **)0); } #undef subpad WINDOW *subpad( - WINDOW *orig, - int l, - int c, - int begy, + WINDOW *orig, + int l, + int c, + int begy, int begx) { return(*(WINDOW **)0); } #undef prefresh int prefresh( - WINDOW *win, - int pminrow, - int pmincol, - int sminrow, - int smincol, - int smaxrow, + WINDOW *win, + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, int smaxcol) { return(*(int *)0); } #undef pnoutrefresh int pnoutrefresh( - WINDOW *win, - int pminrow, - int pmincol, - int sminrow, - int smincol, - int smaxrow, + WINDOW *win, + int pminrow, + int pmincol, + int sminrow, + int smincol, + int smaxrow, int smaxcol) { return(*(int *)0); } #undef pechochar int pechochar( - WINDOW *pad, + WINDOW *pad, const chtype ch) { return(*(int *)0); } @@ -1862,38 +1872,38 @@ int pechochar( #undef printw int printw( - const char *fmt, + const char *fmt, ...) { return(*(int *)0); } #undef wprintw int wprintw( - WINDOW *win, - const char *fmt, + WINDOW *win, + const char *fmt, ...) { return(*(int *)0); } #undef mvprintw int mvprintw( - int y, - int x, - const char *fmt, + int y, + int x, + const char *fmt, ...) { return(*(int *)0); } #undef mvwprintw int mvwprintw( - WINDOW *win, - int y, - int x, - const char *fmt, + WINDOW *win, + int y, + int x, + const char *fmt, ...) { return(*(int *)0); } #undef vwprintw int vwprintw( - WINDOW *win, - const char *fmt, + WINDOW *win, + const char *fmt, va_list argp) { return(*(int *)0); } @@ -1901,8 +1911,8 @@ int vwprintw( #undef wredrawln int wredrawln( - WINDOW *win, - int beg, + WINDOW *win, + int beg, int num) { return(*(int *)0); } @@ -1922,8 +1932,8 @@ int wnoutrefresh( #undef restartterm int restartterm( - char *termp, - int filenum, + char *termp, + int filenum, int *errret) { return(*(int *)0); } @@ -1931,38 +1941,38 @@ int restartterm( #undef vwscanw int vwscanw( - WINDOW *win, - char *fmt, + WINDOW *win, + char *fmt, va_list argp) { return(*(int *)0); } #undef scanw int scanw( - char *fmt, + char *fmt, ...) { return(*(int *)0); } #undef wscanw int wscanw( - WINDOW *win, - char *fmt, + WINDOW *win, + char *fmt, ...) { return(*(int *)0); } #undef mvscanw int mvscanw( - int y, - int x, - char *fmt, + int y, + int x, + char *fmt, ...) { return(*(int *)0); } #undef mvwscanw int mvwscanw( - WINDOW *win, - int y, - int x, - char *fmt, + WINDOW *win, + int y, + int x, + char *fmt, ...) { return(*(int *)0); } @@ -1975,7 +1985,7 @@ WINDOW *getwin( #undef putwin int putwin( - WINDOW *win, + WINDOW *win, FILE *filep) { return(*(int *)0); } @@ -2003,16 +2013,16 @@ int scr_set( #undef _nc_scroll_window void _nc_scroll_window( - WINDOW *win, - int const n, - short const top, - short const bottom, + WINDOW *win, + int const n, + short const top, + short const bottom, cchar_t blank) { /* void */ } #undef wscrl int wscrl( - WINDOW *win, + WINDOW *win, int n) { return(*(int *)0); } @@ -2020,7 +2030,7 @@ int wscrl( #undef scrollok int scrollok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } @@ -2028,8 +2038,8 @@ int scrollok( #undef wsetscrreg int wsetscrreg( - WINDOW *win, - int top, + WINDOW *win, + int top, int bottom) { return(*(int *)0); } @@ -2047,24 +2057,24 @@ void delscreen( #undef _nc_setupscreen int _nc_setupscreen( - short slines, - short const scolumns, + short slines, + short const scolumns, FILE *output) { return(*(int *)0); } #undef _nc_ripoffline int _nc_ripoffline( - int line, + int line, int (*init)( - WINDOW *p1, + WINDOW *p1, int p2)) { return(*(int *)0); } #undef ripoffline int ripoffline( - int line, + int line, int (*init)( - WINDOW *p1, + WINDOW *p1, int p2)) { return(*(int *)0); } @@ -2075,7 +2085,7 @@ int _nc_slk_format; #undef _nc_slk_initialize int _nc_slk_initialize( - WINDOW *stwin, + WINDOW *stwin, int cols) { return(*(int *)0); } @@ -2087,8 +2097,8 @@ int slk_restore(void) #undef slk_attr_set int slk_attr_set( - const attr_t attr, - short color_pair_number, + const attr_t attr, + short color_pair_number, void *opts) { return(*(int *)0); } @@ -2158,10 +2168,12 @@ int slk_refresh(void) /* ./base/lib_slkset.c */ +#include + #undef slk_set int slk_set( - int i, - const char *astr, + int i, + const char *astr, int format) { return(*(int *)0); } @@ -2175,7 +2187,7 @@ int slk_touch(void) #undef is_linetouched NCURSES_BOOL is_linetouched( - WINDOW *win, + WINDOW *win, int line) { return(*(NCURSES_BOOL *)0); } @@ -2186,9 +2198,9 @@ NCURSES_BOOL is_wintouched( #undef wtouchln int wtouchln( - WINDOW *win, - int y, - int n, + WINDOW *win, + int y, + int n, int changed) { return(*(int *)0); } @@ -2196,7 +2208,7 @@ int wtouchln( #undef _traceattr2 char *_traceattr2( - int bufnum, + int bufnum, attr_t newmode) { return(*(char **)0); } @@ -2212,13 +2224,13 @@ attr_t _nc_retrace_attr_t( #undef _nc_altcharset_name const char *_nc_altcharset_name( - attr_t attr, + attr_t attr, chtype ch) { return(*(const char **)0); } #undef _tracechtype2 char *_tracechtype2( - int bufnum, + int bufnum, chtype ch) { return(*(char **)0); } @@ -2234,7 +2246,7 @@ chtype _nc_retrace_chtype( #undef _tracecchar_t2 char *_tracecchar_t2( - int bufnum, + int bufnum, const cchar_t *ch) { return(*(char **)0); } @@ -2247,7 +2259,7 @@ char *_tracecchar_t( #undef _tracedump void _tracedump( - const char *name, + const char *name, WINDOW *win) { /* void */ } @@ -2282,7 +2294,7 @@ int ungetch( #undef vidputs int vidputs( - chtype newmode, + chtype newmode, int (*outc)( int p1)) { return(*(int *)0); } @@ -2300,8 +2312,8 @@ chtype termattrs(void) #undef wvline int wvline( - WINDOW *win, - chtype ch, + WINDOW *win, + chtype ch, int n) { return(*(int *)0); } @@ -2309,8 +2321,8 @@ int wvline( #undef wattr_off int wattr_off( - WINDOW *win, - attr_t at, + WINDOW *win, + attr_t at, void *opts) { return(*(int *)0); } @@ -2318,8 +2330,8 @@ int wattr_off( #undef wattr_on int wattr_on( - WINDOW *win, - attr_t at, + WINDOW *win, + attr_t at, void *opts) { return(*(int *)0); } @@ -2339,14 +2351,14 @@ void _nc_synchook( #undef mvderwin int mvderwin( - WINDOW *win, - int y, + WINDOW *win, + int y, int x) { return(*(int *)0); } #undef syncok int syncok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL bf) { return(*(int *)0); } @@ -2380,7 +2392,7 @@ struct panelhook *_nc_panelhook(void) #undef _nc_printf_string char *_nc_printf_string( - const char *fmt, + const char *fmt, va_list ap) { return(*(char **)0); } @@ -2395,9 +2407,9 @@ int doupdate(void) #undef _nc_scrolln int _nc_scrolln( - int n, - int top, - int bot, + int n, + int top, + int bot, int maxy) { return(*(int *)0); } @@ -2420,9 +2432,13 @@ void _nc_do_xmc_glitch( /* ./trace/varargs.c */ +typedef enum { + atUnknown = 0, atInteger, atFloat, atPoint, atString +} ARGTYPE; + #undef _nc_varargs char *_nc_varargs( - const char *fmt, + const char *fmt, va_list ap) { return(*(char **)0); } @@ -2467,13 +2483,13 @@ wint_t _nc_to_widechar( #undef wadd_wch int wadd_wch( - WINDOW *win, + WINDOW *win, const cchar_t *wch) { return(*(int *)0); } #undef wecho_wchar int wecho_wchar( - WINDOW *win, + WINDOW *win, const cchar_t *wch) { return(*(int *)0); } @@ -2481,14 +2497,14 @@ int wecho_wchar( #undef wborder_set int wborder_set( - WINDOW *win, - const cchar_t *ls, - const cchar_t *rs, - const cchar_t *ts, - const cchar_t *bs, - const cchar_t *tl, - const cchar_t *tr, - const cchar_t *bl, + WINDOW *win, + const cchar_t *ls, + const cchar_t *rs, + const cchar_t *ts, + const cchar_t *bs, + const cchar_t *tl, + const cchar_t *tr, + const cchar_t *bl, const cchar_t *br) { return(*(int *)0); } @@ -2496,19 +2512,19 @@ int wborder_set( #undef setcchar int setcchar( - cchar_t *wcval, - const wchar_t *wch, - const attr_t attrs, - short color_pair, + cchar_t *wcval, + const wchar_t *wch, + const attr_t attrs, + short color_pair, const void *opts) { return(*(int *)0); } #undef getcchar int getcchar( - const cchar_t *wcval, - wchar_t *wch, - attr_t *attrs, - short *color_pair, + const cchar_t *wcval, + wchar_t *wch, + attr_t *attrs, + short *color_pair, void *opts) { return(*(int *)0); } @@ -2516,7 +2532,7 @@ int getcchar( #undef wget_wch int wget_wch( - WINDOW *win, + WINDOW *win, wint_t *result) { return(*(int *)0); } @@ -2536,8 +2552,8 @@ int killwchar( #undef wgetn_wstr int wgetn_wstr( - WINDOW *win, - wint_t *str, + WINDOW *win, + wint_t *str, int maxlen) { return(*(int *)0); } @@ -2545,8 +2561,8 @@ int wgetn_wstr( #undef whline_set int whline_set( - WINDOW *win, - const cchar_t *ch, + WINDOW *win, + const cchar_t *ch, int n) { return(*(int *)0); } @@ -2554,7 +2570,7 @@ int whline_set( #undef win_wch int win_wch( - WINDOW *win, + WINDOW *win, cchar_t *wcval) { return(*(int *)0); } @@ -2562,8 +2578,8 @@ int win_wch( #undef win_wchnstr int win_wchnstr( - WINDOW *win, - cchar_t *wchstr, + WINDOW *win, + cchar_t *wchstr, int n) { return(*(int *)0); } @@ -2571,14 +2587,14 @@ int win_wchnstr( #undef wins_wch int wins_wch( - WINDOW *win, + WINDOW *win, const cchar_t *wch) { return(*(int *)0); } #undef wins_nwstr int wins_nwstr( - WINDOW *win, - const wchar_t *wstr, + WINDOW *win, + const wchar_t *wstr, int n) { return(*(int *)0); } @@ -2586,14 +2602,14 @@ int wins_nwstr( #undef winnwstr int winnwstr( - WINDOW *win, - wchar_t *wstr, + WINDOW *win, + wchar_t *wstr, int n) { return(*(int *)0); } #undef winwstr int winwstr( - WINDOW *win, + WINDOW *win, wchar_t *wstr) { return(*(int *)0); } @@ -2601,7 +2617,7 @@ int winwstr( #undef pecho_wchar int pecho_wchar( - WINDOW *pad, + WINDOW *pad, const cchar_t *wch) { return(*(int *)0); } @@ -2609,13 +2625,20 @@ int pecho_wchar( #undef slk_wset int slk_wset( - int i, - const wchar_t *astr, + int i, + const wchar_t *astr, int format) { return(*(int *)0); } /* ./widechar/lib_unget_wch.c */ +#undef _nc_wcrtomb +size_t _nc_wcrtomb( + char *target, + wchar_t source, + mbstate_t *state) + { return(*(size_t *)0); } + #undef unget_wch int unget_wch( const wchar_t wch) @@ -2625,17 +2648,17 @@ int unget_wch( #undef vid_puts int vid_puts( - attr_t newmode, - short pair, - void *opts, + attr_t newmode, + short pair, + void *opts, int (*outc)( int p1)) { return(*(int *)0); } #undef vid_attr int vid_attr( - attr_t newmode, - short pair, + attr_t newmode, + short pair, void *opts) { return(*(int *)0); } @@ -2647,8 +2670,8 @@ attr_t term_attrs(void) #undef wvline_set int wvline_set( - WINDOW *win, - const cchar_t *ch, + WINDOW *win, + const cchar_t *ch, int n) { return(*(int *)0); } @@ -2668,25 +2691,17 @@ wchar_t *wunctrl( cchar_t *wc) { return(*(wchar_t **)0); } -/* ./base/define_key.c */ - -#undef define_key -int define_key( - const char *str, - int keycode) - { return(*(int *)0); } - /* ./expanded.c */ #undef _nc_toggle_attr_on void _nc_toggle_attr_on( - attr_t *S, + attr_t *S, attr_t at) { /* void */ } #undef _nc_toggle_attr_off void _nc_toggle_attr_off( - attr_t *S, + attr_t *S, attr_t at) { /* void */ } @@ -2702,32 +2717,9 @@ int _nc_InsCharCost( #undef _nc_UpdateAttrs void _nc_UpdateAttrs( - chtype c) + cchar_t c) { /* void */ } -/* ./base/key_defined.c */ - -#undef key_defined -int key_defined( - const char *str) - { return(*(int *)0); } - -/* ./base/keybound.c */ - -#undef keybound -char *keybound( - int code, - int count) - { return(*(char **)0); } - -/* ./base/keyok.c */ - -#undef keyok -int keyok( - int c, - NCURSES_BOOL flag) - { return(*(int *)0); } - /* ./base/lib_dft_fgbg.c */ #undef use_default_colors @@ -2736,7 +2728,7 @@ int use_default_colors(void) #undef assume_default_colors int assume_default_colors( - int fg, + int fg, int bg) { return(*(int *)0); } @@ -2744,7 +2736,7 @@ int assume_default_colors( #undef mcprint int mcprint( - char *data, + char *data, int len) { return(*(int *)0); } @@ -2752,19 +2744,19 @@ int mcprint( #undef is_term_resized NCURSES_BOOL is_term_resized( - int ToLines, + int ToLines, int ToCols) { return(*(NCURSES_BOOL *)0); } #undef resize_term int resize_term( - int ToLines, + int ToLines, int ToCols) { return(*(int *)0); } #undef resizeterm int resizeterm( - int ToLines, + int ToLines, int ToCols) { return(*(int *)0); } @@ -2775,45 +2767,19 @@ void _nc_trace_xnames( TERMTYPE *tp) { /* void */ } -/* ./base/tries.c */ - -#undef _nc_expand_try -char *_nc_expand_try( - struct tries *tree, - unsigned short code, - int *count, - size_t len) - { return(*(char **)0); } - -#undef _nc_remove_key -int _nc_remove_key( - struct tries **tree, - unsigned short code) - { return(*(int *)0); } - -#undef _nc_remove_string -int _nc_remove_string( - struct tries **tree, - const char *string) - { return(*(int *)0); } - -/* ./base/version.c */ - -#undef curses_version -const char *curses_version(void) - { return(*(const char **)0); } - /* ./base/wresize.c */ #undef wresize int wresize( - WINDOW *win, - int ToLines, + WINDOW *win, + int ToLines, int ToCols) { return(*(int *)0); } /* ./tinfo/access.c */ +#include + #undef _nc_rootname char *_nc_rootname( char *path) @@ -2831,7 +2797,7 @@ char *_nc_basename( #undef _nc_access int _nc_access( - const char *path, + const char *path, int mode) { return(*(int *)0); } @@ -2843,8 +2809,8 @@ int _nc_env_access(void) #undef _nc_add_to_try void _nc_add_to_try( - struct tries **tree, - const char *str, + struct tries **tree, + const char *str, unsigned short code) { /* void */ } @@ -2867,13 +2833,13 @@ char *_nc_save_str( #undef _nc_wrap_entry void _nc_wrap_entry( - ENTRY *const ep, + ENTRY *const ep, NCURSES_BOOL copy_strings) { /* void */ } #undef _nc_merge_entry void _nc_merge_entry( - TERMTYPE *const to, + TERMTYPE *const to, TERMTYPE *const from) { /* void */ } @@ -2881,13 +2847,13 @@ void _nc_merge_entry( #undef _nc_align_termtype void _nc_align_termtype( - TERMTYPE *to, + TERMTYPE *to, TERMTYPE *from) { /* void */ } #undef _nc_copy_termtype void _nc_copy_termtype( - TERMTYPE *dst, + TERMTYPE *dst, TERMTYPE *src) { /* void */ } @@ -2895,15 +2861,15 @@ void _nc_copy_termtype( #undef _nc_captoinfo char *_nc_captoinfo( - const char *cap, - const char *s, + const char *cap, + const char *s, int const parameterized) { return(*(char **)0); } #undef _nc_infotocap char *_nc_infotocap( - const char *cap, - const char *str, + const char *cap, + const char *str, int const parameterized) { return(*(char **)0); } @@ -2965,19 +2931,19 @@ void _nc_get_type( #undef _nc_warning void _nc_warning( - const char *const fmt, + const char *const fmt, ...) { /* void */ } #undef _nc_err_abort void _nc_err_abort( - const char *const fmt, + const char *const fmt, ...) { /* void */ } #undef _nc_syserr_abort void _nc_syserr_abort( - const char *const fmt, + const char *const fmt, ...) { /* void */ } @@ -2985,8 +2951,8 @@ void _nc_syserr_abort( #undef _nc_tic_expand char *_nc_tic_expand( - const char *srcp, - NCURSES_BOOL tic_format, + const char *srcp, + NCURSES_BOOL tic_format, int numbers) { return(*(char **)0); } @@ -2996,19 +2962,23 @@ char *_nc_tic_expand( #undef _nc_find_entry struct name_table_entry const *_nc_find_entry( - const char *string, + const char *string, const struct name_table_entry *const *hash_table) { return(*(struct name_table_entry const **)0); } #undef _nc_find_type_entry struct name_table_entry const *_nc_find_type_entry( - const char *string, - int type, + const char *string, + int type, const struct name_table_entry *table) { return(*(struct name_table_entry const **)0); } /* ./tinfo/comp_parse.c */ +#undef _nc_check_termtype2 +void (*_nc_check_termtype2)( + TERMTYPE *p1, + NCURSES_BOOL p2); #undef _nc_check_termtype void (*_nc_check_termtype)( TERMTYPE *p1); @@ -3022,22 +2992,40 @@ void _nc_free_entries( ENTRY *headp) { /* void */ } +#undef _nc_delink_entry +ENTRY *_nc_delink_entry( + ENTRY *headp, + TERMTYPE *tterm) + { return(*(ENTRY **)0); } + +#undef _nc_free_entry +void _nc_free_entry( + ENTRY *headp, + TERMTYPE *tterm) + { /* void */ } + #undef _nc_entry_match NCURSES_BOOL _nc_entry_match( - char *n1, + char *n1, char *n2) { return(*(NCURSES_BOOL *)0); } #undef _nc_read_entry_source void _nc_read_entry_source( - FILE *fp, - char *buf, - int literal, - NCURSES_BOOL silent, + FILE *fp, + char *buf, + int literal, + NCURSES_BOOL silent, NCURSES_BOOL (*hook)( ENTRY *p1)) { /* void */ } +#undef _nc_resolve_uses2 +int _nc_resolve_uses2( + NCURSES_BOOL fullresolve, + NCURSES_BOOL literal) + { return(*(int *)0); } + #undef _nc_resolve_uses int _nc_resolve_uses( NCURSES_BOOL fullresolve) @@ -3060,16 +3048,22 @@ struct token _nc_curr_token; #undef _nc_disable_period NCURSES_BOOL _nc_disable_period; +#undef _nc_reset_input +void _nc_reset_input( + FILE *fp, + char *buf) + { /* void */ } + #undef _nc_get_token int _nc_get_token( NCURSES_BOOL silent) { return(*(int *)0); } #undef _nc_trans_string -char _nc_trans_string( - char *ptr, +int _nc_trans_string( + char *ptr, char *last) - { return(*(char *)0); } + { return(*(int *)0); } #undef _nc_push_token void _nc_push_token( @@ -3081,17 +3075,11 @@ void _nc_panic_mode( char ch) { /* void */ } -#undef _nc_reset_input -void _nc_reset_input( - FILE *fp, - char *buf) - { /* void */ } - /* ./tinfo/doalloc.c */ #undef _nc_doalloc void *_nc_doalloc( - void *oldp, + void *oldp, size_t amount) { return(*(void **)0); } @@ -3158,6 +3146,11 @@ void _nc_init_acs(void) #include +struct speed { + int s; + int sp; +}; + #undef _nc_baudrate int _nc_baudrate( int OSpeed) @@ -3258,13 +3251,13 @@ int napms( #undef idlok int idlok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } #undef idcok void idcok( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { /* void */ } @@ -3275,31 +3268,31 @@ int halfdelay( #undef nodelay int nodelay( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } #undef notimeout int notimeout( - WINDOW *win, + WINDOW *win, NCURSES_BOOL f) { return(*(int *)0); } #undef wtimeout void wtimeout( - WINDOW *win, + WINDOW *win, int delay) { /* void */ } #undef keypad int keypad( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } #undef meta int meta( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } @@ -3351,13 +3344,15 @@ void noqiflush(void) #undef intrflush int intrflush( - WINDOW *win, + WINDOW *win, NCURSES_BOOL flag) { return(*(int *)0); } /* ./tinfo/lib_setup.c */ +#include #include +#include #undef ttytype char ttytype[256]; @@ -3389,10 +3384,18 @@ int _nc_unicode_locale(void) int _nc_locale_breaks_acs(void) { return(*(int *)0); } +#undef _nc_setupterm +int _nc_setupterm( + char *tname, + int Filedes, + int *errret, + NCURSES_BOOL reuse) + { return(*(int *)0); } + #undef setupterm int setupterm( - char *tname, - int Filedes, + char *tname, + int Filedes, int *errret) { return(*(int *)0); } @@ -3405,7 +3408,7 @@ char *BC; #undef tgetent int tgetent( - char *bufp, + char *bufp, const char *name) { return(*(int *)0); } @@ -3427,7 +3430,7 @@ int tgetnum( #undef tgetstr char *tgetstr( - char *id, + char *id, char **area) { return(*(char **)0); } @@ -3441,8 +3444,8 @@ char *termname(void) #undef tgoto char *tgoto( - const char *string, - int x, + const char *string, + int x, int y) { return(*(char **)0); } @@ -3465,19 +3468,27 @@ char *tigetstr( /* ./tinfo/lib_tparm.c */ +typedef struct { + union { + int num; + char *str; + } data; + NCURSES_BOOL num_type; +} stack_frame; + #undef _nc_tparm_err int _nc_tparm_err; #undef _nc_tparm_analyze int _nc_tparm_analyze( - const char *string, - char *p_is_s[9], + const char *string, + char *p_is_s[9], int *popcount) { return(*(int *)0); } #undef tparm char *tparm( - char *string, + char *string, ...) { return(*(char **)0); } @@ -3511,8 +3522,8 @@ int putp( #undef tputs int tputs( - const char *string, - int affcnt, + const char *string, + int affcnt, int (*outc)( int p1)) { return(*(int *)0); } @@ -3533,7 +3544,7 @@ void trace( #undef _tracef void _tracef( - const char *fmt, + const char *fmt, ...) { /* void */ } @@ -3557,6 +3568,21 @@ char *_nc_retrace_ptr( char *code) { return(*(char **)0); } +#undef _nc_retrace_cptr +const char *_nc_retrace_cptr( + const char *code) + { return(*(const char **)0); } + +#undef _nc_retrace_cvoid_ptr +void *_nc_retrace_cvoid_ptr( + void *code) + { return(*(void **)0); } + +#undef _nc_retrace_void_ptr +void *_nc_retrace_void_ptr( + void *code) + { return(*(void **)0); } + #undef _nc_retrace_sp SCREEN *_nc_retrace_sp( SCREEN *code) @@ -3569,6 +3595,11 @@ WINDOW *_nc_retrace_win( /* ./trace/lib_tracebits.c */ +typedef struct { + unsigned int val; + const char *name; +} BITNAMES; + #undef _nc_trace_ttymode char *_nc_trace_ttymode( struct termios *tty) @@ -3625,8 +3656,8 @@ int resetty(void) #undef _nc_timed_wait int _nc_timed_wait( - int mode, - int milliseconds, + int mode, + int milliseconds, int *timeleft) { return(*(int *)0); } @@ -3639,8 +3670,8 @@ char *_nc_first_name( #undef _nc_name_match int _nc_name_match( - const char *const namelst, - const char *const name, + const char *const namelst, + const char *const name, const char *const delim) { return(*(int *)0); } @@ -3663,17 +3694,22 @@ char *const strfnames[] = {0}; #undef _nc_parse_entry int _nc_parse_entry( - struct entry *entryp, - int literal, + struct entry *entryp, + int literal, NCURSES_BOOL silent) { return(*(int *)0); } #undef _nc_capcmp int _nc_capcmp( - const char *s, + const char *s, const char *t) { return(*(int *)0); } +typedef struct { + const char *from; + const char *to; +} assoc; + /* ./tinfo/read_entry.c */ #undef _nc_tic_dir @@ -3688,22 +3724,25 @@ void _nc_keep_tic_dir( #undef _nc_read_file_entry int _nc_read_file_entry( - const char *const filename, + const char *const filename, TERMTYPE *ptr) { return(*(int *)0); } #undef _nc_read_entry int _nc_read_entry( - const char *const tn, - char *const filename, + const char *const tn, + char *const filename, TERMTYPE *const tp) { return(*(int *)0); } /* ./tinfo/read_termcap.c */ +#include +#include + #undef _nc_read_termcap_entry int _nc_read_termcap_entry( - const char *const tn, + const char *const tn, TERMTYPE *const tp) { return(*(int *)0); } @@ -3711,7 +3750,7 @@ int _nc_read_termcap_entry( #undef _nc_set_buffer void _nc_set_buffer( - FILE *ofp, + FILE *ofp, NCURSES_BOOL buffered) { /* void */ } @@ -3719,46 +3758,51 @@ void _nc_set_buffer( #undef _nc_str_init string_desc *_nc_str_init( - string_desc *dst, - char *src, + string_desc *dst, + char *src, size_t len) { return(*(string_desc **)0); } #undef _nc_str_null string_desc *_nc_str_null( - string_desc *dst, + string_desc *dst, size_t len) { return(*(string_desc **)0); } #undef _nc_str_copy string_desc *_nc_str_copy( - string_desc *dst, + string_desc *dst, string_desc *src) { return(*(string_desc **)0); } #undef _nc_safe_strcat NCURSES_BOOL _nc_safe_strcat( - string_desc *dst, + string_desc *dst, const char *src) { return(*(NCURSES_BOOL *)0); } #undef _nc_safe_strcpy NCURSES_BOOL _nc_safe_strcpy( - string_desc *dst, + string_desc *dst, const char *src) { return(*(NCURSES_BOOL *)0); } /* ./trace/trace_buf.c */ +typedef struct { + char *text; + size_t size; +} LIST; + #undef _nc_trace_buf char *_nc_trace_buf( - int bufnum, + int bufnum, size_t want) { return(*(char **)0); } #undef _nc_trace_bufcat char *_nc_trace_bufcat( - int bufnum, + int bufnum, const char *value) { return(*(char **)0); } @@ -3769,6 +3813,35 @@ void _nc_trace_tries( struct tries *tree) { /* void */ } +/* ./base/tries.c */ + +#undef _nc_expand_try +char *_nc_expand_try( + struct tries *tree, + unsigned short code, + int *count, + size_t len) + { return(*(char **)0); } + +#undef _nc_remove_key +int _nc_remove_key( + struct tries **tree, + unsigned short code) + { return(*(int *)0); } + +#undef _nc_remove_string +int _nc_remove_string( + struct tries **tree, + const char *string) + { return(*(int *)0); } + +/* ./tinfo/trim_sgr0.c */ + +#undef _nc_trim_sgr0 +char *_nc_trim_sgr0( + TERMTYPE *tp) + { return(*(char **)0); } + /* ./unctrl.c */ #undef unctrl @@ -3780,7 +3853,7 @@ char *unctrl( #undef _nc_visbuf2 const char *_nc_visbuf2( - int bufnum, + int bufnum, const char *buf) { return(*(const char **)0); } @@ -3791,13 +3864,13 @@ const char *_nc_visbuf( #undef _nc_visbufn const char *_nc_visbufn( - const char *buf, + const char *buf, int len) { return(*(const char **)0); } #undef _nc_viswbuf2 const char *_nc_viswbuf2( - int bufnum, + int bufnum, const wchar_t *buf) { return(*(const char **)0); } @@ -3808,20 +3881,25 @@ const char *_nc_viswbuf( #undef _nc_viswbufn const char *_nc_viswbufn( - const wchar_t *buf, + const wchar_t *buf, int len) { return(*(const char **)0); } +#undef _nc_viswibuf +const char *_nc_viswibuf( + const wint_t *buf) + { return(*(const char **)0); } + #undef _nc_viscbuf2 const char *_nc_viscbuf2( - int bufnum, - const cchar_t *buf, + int bufnum, + const cchar_t *buf, int len) { return(*(const char **)0); } #undef _nc_viscbuf const char *_nc_viscbuf( - const cchar_t *buf, + const cchar_t *buf, int len) { return(*(const char **)0); } @@ -3840,3 +3918,40 @@ void _nc_write_entry( #undef _nc_tic_written int _nc_tic_written(void) { return(*(int *)0); } + +/* ./base/define_key.c */ + +#undef define_key +int define_key( + const char *str, + int keycode) + { return(*(int *)0); } + +/* ./base/key_defined.c */ + +#undef key_defined +int key_defined( + const char *str) + { return(*(int *)0); } + +/* ./base/keybound.c */ + +#undef keybound +char *keybound( + int code, + int count) + { return(*(char **)0); } + +/* ./base/keyok.c */ + +#undef keyok +int keyok( + int c, + NCURSES_BOOL flag) + { return(*(int *)0); } + +/* ./base/version.c */ + +#undef curses_version +const char *curses_version(void) + { return(*(const char **)0); } diff --git a/ncurses/modules b/ncurses/modules index bd08c392..c300274e 100644 --- a/ncurses/modules +++ b/ncurses/modules @@ -1,6 +1,6 @@ -# $Id: modules,v 1.100 2004/01/10 19:08:23 tom Exp $ +# $Id: modules,v 1.104 2005/08/20 20:02:44 tom Exp $ ############################################################################## -# Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -61,6 +61,7 @@ lib_inchstr lib $(base) lib_initscr lib $(base) $(INCDIR)/tic.h lib_insch lib $(base) lib_insdel lib $(base) +lib_insnstr lib $(base) lib_instr lib $(base) lib_isendwin lib $(base) lib_leaveok lib $(base) @@ -97,7 +98,6 @@ lib_slkrefr lib $(base) ../include/term.h lib_slkset lib $(base) lib_slktouch lib $(base) lib_touch lib $(base) -lib_traceatr lib $(trace) ../include/term.h lib_tracedmp lib $(trace) lib_tracemse lib $(trace) lib_tstp lib $(serial) $(srcdir)/SigAction.h @@ -145,16 +145,11 @@ lib_wunctrl lib $(wide) # Extensions to the base library @ ext_funcs -define_key lib $(base) expanded lib . -key_defined lib $(base) -keybound lib $(base) -keyok lib $(base) lib_dft_fgbg lib $(base) ../include/term.h lib_print lib $(tinfo) ../include/term.h resizeterm lib $(base) ../include/term.h trace_xnames lib $(trace) ../include/term.h $(INCDIR)/term_entry.h -tries lib $(base) wresize lib $(base) ../include/term.h # Support for termcap (and tic, etc.), which can be a separate library @@ -196,6 +191,7 @@ lib_ti lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h lib_tparm lib $(tinfo) ../include/term.h $(INCDIR)/tic.h lib_tputs lib $(tinfo) ../include/term.h $(INCDIR)/tic.h lib_trace lib $(trace) $(INCDIR)/tic.h +lib_traceatr lib $(trace) ../include/term.h lib_tracebits lib $(trace) ../include/term.h lib_tracechr lib $(trace) lib_ttyflags lib $(tinfo) ../include/term.h @@ -209,10 +205,16 @@ setbuf lib $(tinfo) strings lib $(tinfo) trace_buf lib $(trace) trace_tries lib $(trace) +tries lib $(base) +trim_sgr0 lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h unctrl lib . visbuf lib $(trace) $(INCDIR)/tic.h write_entry lib $(tinfo) ../include/term.h $(INCDIR)/term_entry.h $(INCDIR)/tic.h # Extensions to the termlib library @ ext_tinfo +define_key lib $(base) +key_defined lib $(base) +keybound lib $(base) +keyok lib $(base) version lib $(base) diff --git a/ncurses/tinfo/alloc_entry.c b/ncurses/tinfo/alloc_entry.c index 2ff0cdf1..3af5f5d8 100644 --- a/ncurses/tinfo/alloc_entry.c +++ b/ncurses/tinfo/alloc_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * - * and: Thomas E. Dickey 1996-2003 * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -48,7 +48,7 @@ #include #include -MODULE_ID("$Id: alloc_entry.c,v 1.40 2003/11/08 21:29:54 tom Exp $") +MODULE_ID("$Id: alloc_entry.c,v 1.45 2005/06/04 22:07:53 tom Exp $") #define ABSENT_OFFSET -1 #define CANCELLED_OFFSET -2 @@ -59,11 +59,18 @@ static char *stringbuf; /* buffer for string capabilities */ static size_t next_free; /* next free character in stringbuf */ NCURSES_EXPORT(void) -_nc_init_entry(TERMTYPE * const tp) +_nc_init_entry(TERMTYPE *const tp) /* initialize a terminal type data block */ { unsigned i; +#if NO_LEAKS + if (tp == 0 && stringbuf != 0) { + FreeAndNull(stringbuf); + return; + } +#endif + if (stringbuf == 0) stringbuf = (char *) malloc(MAX_STRTAB); @@ -106,20 +113,32 @@ _nc_copy_entry(ENTRY * oldp) return newp; } +/* save a copy of string in the string buffer */ NCURSES_EXPORT(char *) _nc_save_str(const char *const string) -/* save a copy of string in the string buffer */ { + char *result = 0; size_t old_next_free = next_free; size_t len = strlen(string) + 1; - if (next_free + len < MAX_STRTAB) { + if (len == 1 && next_free != 0) { + /* + * Cheat a little by making an empty string point to the end of the + * previous string. + */ + if (next_free < MAX_STRTAB) { + result = (stringbuf + next_free - 1); + } + } else if (next_free + len < MAX_STRTAB) { strcpy(&stringbuf[next_free], string); DEBUG(7, ("Saved string %s", _nc_visbuf(string))); DEBUG(7, ("at location %d", (int) next_free)); next_free += len; + result = (stringbuf + old_next_free); + } else { + _nc_warning("Too much data, some is lost"); } - return (stringbuf + old_next_free); + return result; } NCURSES_EXPORT(void) @@ -211,7 +230,7 @@ _nc_wrap_entry(ENTRY * const ep, bool copy_strings) } NCURSES_EXPORT(void) -_nc_merge_entry(TERMTYPE * const to, TERMTYPE * const from) +_nc_merge_entry(TERMTYPE *const to, TERMTYPE *const from) /* merge capabilities from `from' entry into `to' entry */ { unsigned i; @@ -220,7 +239,7 @@ _nc_merge_entry(TERMTYPE * const to, TERMTYPE * const from) _nc_align_termtype(to, from); #endif for_each_boolean(i, from) { - if (to->Booleans[i] != CANCELLED_BOOLEAN) { + if (to->Booleans[i] != (char) CANCELLED_BOOLEAN) { int mergebool = from->Booleans[i]; if (mergebool == CANCELLED_BOOLEAN) @@ -257,3 +276,12 @@ _nc_merge_entry(TERMTYPE * const to, TERMTYPE * const from) } } } + +#if NO_LEAKS +NCURSES_EXPORT(void) +_nc_alloc_entry_leaks(void) +{ + FreeAndNull(stringbuf); + next_free = 0; +} +#endif diff --git a/ncurses/tinfo/captoinfo.c b/ncurses/tinfo/captoinfo.c index e2c81308..84d43a9c 100644 --- a/ncurses/tinfo/captoinfo.c +++ b/ncurses/tinfo/captoinfo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -92,7 +93,7 @@ #include #include -MODULE_ID("$Id: captoinfo.c,v 1.45 2003/11/08 21:28:04 tom Exp $") +MODULE_ID("$Id: captoinfo.c,v 1.47 2005/06/04 22:06:43 tom Exp $") #define MAX_PUSHED 16 /* max # args we can push onto the stack */ @@ -276,7 +277,7 @@ getparm(int parm, int n) * % translations if 1 * pad translations if >=0 */ -char * +NCURSES_EXPORT(char *) _nc_captoinfo(const char *cap, const char *s, int const parameterized) { const char *capstart; @@ -636,7 +637,7 @@ save_tc_inequality(char *bufptr, int c1, int c2) * Convert a terminfo string to termcap format. Parameters are as in * _nc_captoinfo(). */ -char * +NCURSES_EXPORT(char *) _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameterized) { int seenone = 0, seentwo = 0, saw_m = 0, saw_n = 0; @@ -678,6 +679,7 @@ _nc_infotocap(const char *cap GCC_UNUSED, const char *str, int const parameteriz --str; } else if (str[0] == '%' && str[1] == '%') { /* escaped '%' */ bufptr = save_string(bufptr, "%%"); + ++str; } else if (*str != '%' || (parameterized < 1)) { bufptr = save_char(bufptr, *str); } else if (sscanf(str, "%%?%%{%d}%%>%%t%%{%d}%%+%%;", &c1, &c2) == 2) { @@ -833,4 +835,11 @@ main(int argc, char *argv[]) } #endif /* MAIN */ -/* captoinfo.c ends here */ +#if NO_LEAKS +NCURSES_EXPORT(void) +_nc_captoinfo_leaks(void) +{ + FreeAndNull(my_string); + my_length = 0; +} +#endif diff --git a/ncurses/tinfo/comp_error.c b/ncurses/tinfo/comp_error.c index ce1eaf56..d29f027e 100644 --- a/ncurses/tinfo/comp_error.c +++ b/ncurses/tinfo/comp_error.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -40,7 +41,7 @@ #include -MODULE_ID("$Id: comp_error.c,v 1.25 2002/09/07 20:05:07 tom Exp $") +MODULE_ID("$Id: comp_error.c,v 1.29 2005/08/20 19:22:36 tom Exp $") NCURSES_EXPORT_VAR(bool) _nc_suppress_warnings = FALSE; NCURSES_EXPORT_VAR(int) _nc_curr_line = 0; /* current line # in input */ @@ -49,6 +50,12 @@ NCURSES_EXPORT_VAR(int) _nc_curr_col = 0; /* current column # in input */ static const char *sourcename; static char *termtype; +NCURSES_EXPORT(const char *) +_nc_get_source(void) +{ + return sourcename; +} + NCURSES_EXPORT(void) _nc_set_source(const char *const name) { @@ -70,7 +77,14 @@ _nc_set_type(const char *const name) NCURSES_EXPORT(void) _nc_get_type(char *name) { - strcpy(name, termtype != 0 ? termtype : ""); +#if NO_LEAKS + if (name == 0 && termtype != 0) { + FreeAndNull(termtype); + return; + } +#endif + if (name != 0) + strcpy(name, termtype != 0 ? termtype : ""); } static inline void diff --git a/ncurses/tinfo/comp_hash.c b/ncurses/tinfo/comp_hash.c index dabc0c55..d4d9eaa6 100644 --- a/ncurses/tinfo/comp_hash.c +++ b/ncurses/tinfo/comp_hash.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2001,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -37,6 +38,7 @@ * */ +#define USE_TERMLIB 1 #include #include @@ -48,7 +50,7 @@ #define DEBUG(level, params) /*nothing */ #endif -MODULE_ID("$Id: comp_hash.c,v 1.26 2003/11/08 21:58:36 tom Exp $") +MODULE_ID("$Id: comp_hash.c,v 1.28 2005/08/20 19:58:18 tom Exp $") static int hash_function(const char *); @@ -101,8 +103,7 @@ _nc_make_hash_table(struct name_table_entry *table, * */ -static -int +static int hash_function(const char *string) { long sum = 0; @@ -128,8 +129,8 @@ hash_function(const char *string) #ifndef MAIN_PROGRAM NCURSES_EXPORT(struct name_table_entry const *) -_nc_find_entry -(const char *string, const struct name_table_entry *const *hash_table) +_nc_find_entry(const char *string, + const struct name_table_entry *const *hash_table) { int hashvalue; struct name_table_entry const *ptr; @@ -159,10 +160,9 @@ _nc_find_entry */ NCURSES_EXPORT(struct name_table_entry const *) -_nc_find_type_entry -(const char *string, - int type, - const struct name_table_entry *table) +_nc_find_type_entry(const char *string, + int type, + const struct name_table_entry *table) { struct name_table_entry const *ptr; diff --git a/ncurses/tinfo/comp_parse.c b/ncurses/tinfo/comp_parse.c index 203276cd..643c9af5 100644 --- a/ncurses/tinfo/comp_parse.c +++ b/ncurses/tinfo/comp_parse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,18 +29,19 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* * comp_parse.c -- parser driver loop and use handling. * * _nc_read_entry_source(FILE *, literal, bool, bool (*hook)()) - * _nc_resolve_uses(void) + * _nc_resolve_uses2(void) * _nc_free_entries(void) * * Use this code by calling _nc_read_entry_source() on as many source * files as you like (either terminfo or termcap syntax). If you - * want use-resolution, call _nc_resolve_uses(). To free the list + * want use-resolution, call _nc_resolve_uses2(). To free the list * storage, do _nc_free_entries(). * */ @@ -52,8 +53,12 @@ #include #include -MODULE_ID("$Id: comp_parse.c,v 1.57 2003/10/25 22:25:36 tom Exp $") +MODULE_ID("$Id: comp_parse.c,v 1.60 2005/06/04 21:42:44 tom Exp $") +static void sanity_check2(TERMTYPE *, bool); +NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype2) (TERMTYPE *, bool) = sanity_check2; + +/* obsolete: 20040705 */ static void sanity_check(TERMTYPE *); NCURSES_IMPEXP void NCURSES_API(*_nc_check_termtype) (TERMTYPE *) = sanity_check; @@ -102,24 +107,42 @@ NCURSES_EXPORT(void) _nc_free_entries(ENTRY * headp) /* free the allocated storage consumed by list entries */ { - ENTRY *ep, *next; + while (_nc_head != 0) { + _nc_free_entry(headp, &(headp->tterm)); + } +} - for (ep = headp; ep; ep = next) { - /* - * This conditional lets us disconnect storage from the list. - * To do this, copy an entry out of the list, then null out - * the string-table member in the original and any use entries - * it references. - */ - FreeIfNeeded(ep->tterm.str_table); +NCURSES_EXPORT(ENTRY *) +_nc_delink_entry(ENTRY * headp, TERMTYPE *tterm) +/* delink the allocated storage for the given list entry */ +{ + ENTRY *ep, *last; + + for (last = 0, ep = headp; ep != 0; last = ep, ep = ep->next) { + if (&(ep->tterm) == tterm) { + if (last != 0) + last->next = ep->next; + else + headp = ep->next; + if (ep == _nc_head) + _nc_head = 0; + if (ep == _nc_tail) + _nc_tail = 0; + break; + } + } + return ep; +} - next = ep->next; +NCURSES_EXPORT(void) +_nc_free_entry(ENTRY * headp, TERMTYPE *tterm) +/* free the allocated storage consumed by the given list entry */ +{ + ENTRY *ep; + if ((ep = _nc_delink_entry(headp, tterm)) != 0) { + _nc_free_termtype(&(ep->tterm)); free(ep); - if (ep == _nc_head) - _nc_head = 0; - if (ep == _nc_tail) - _nc_tail = 0; } } @@ -188,10 +211,14 @@ _nc_read_entry_source(FILE *fp, char *buf, * use references to disk, so as to avoid chewing up a lot of * core when the resolution code could fetch entries off disk. */ - if (hook != NULLHOOK && (*hook) (&thisentry)) + if (hook != NULLHOOK && (*hook) (&thisentry)) { immediate++; - else + } else { enqueue(&thisentry); + FreeIfNeeded(thisentry.tterm.Booleans); + FreeIfNeeded(thisentry.tterm.Numbers); + FreeIfNeeded(thisentry.tterm.Strings); + } } if (_nc_tail) { @@ -211,7 +238,7 @@ _nc_read_entry_source(FILE *fp, char *buf, } NCURSES_EXPORT(int) -_nc_resolve_uses(bool fullresolve) +_nc_resolve_uses2(bool fullresolve, bool literal) /* try to resolve all use capabilities */ { ENTRY *qp, *rp, *lastread = 0; @@ -406,7 +433,7 @@ _nc_resolve_uses(bool fullresolve) for_entry_list(qp) { _nc_curr_line = qp->startline; _nc_set_type(_nc_first_name(qp->tterm.term_names)); - _nc_check_termtype(&qp->tterm); + _nc_check_termtype2(&qp->tterm, literal); } DEBUG(2, ("SANITY CHECK FINISHED")); } @@ -414,6 +441,13 @@ _nc_resolve_uses(bool fullresolve) return (TRUE); } +/* obsolete: 20040705 */ +NCURSES_EXPORT(int) +_nc_resolve_uses(bool fullresolve) +{ + return _nc_resolve_uses2(fullresolve, FALSE); +} + /* * This bit of legerdemain turns all the terminfo variable names into * references to locations in the arrays Booleans, Numbers, and Strings --- @@ -424,7 +458,7 @@ _nc_resolve_uses(bool fullresolve) #define CUR tp-> static void -sanity_check(TERMTYPE * tp) +sanity_check2(TERMTYPE *tp, bool literal) { if (!PRESENT(exit_attribute_mode)) { #ifdef __UNUSED__ /* this casts too wide a net */ @@ -448,15 +482,17 @@ sanity_check(TERMTYPE * tp) /* we do this check/fix in postprocess_termcap(), but some packagers * prefer to bypass it... */ - if (acs_chars == 0 - && enter_alt_charset_mode != 0 - && exit_alt_charset_mode != 0) - acs_chars = strdup(VT_ACSC); + if (!literal) { + if (acs_chars == 0 + && enter_alt_charset_mode != 0 + && exit_alt_charset_mode != 0) + acs_chars = strdup(VT_ACSC); + ANDMISSING(enter_alt_charset_mode, acs_chars); + ANDMISSING(exit_alt_charset_mode, acs_chars); + } /* listed in structure-member order of first argument */ PAIRED(enter_alt_charset_mode, exit_alt_charset_mode); - ANDMISSING(enter_alt_charset_mode, acs_chars); - ANDMISSING(exit_alt_charset_mode, acs_chars); ANDMISSING(enter_blink_mode, exit_attribute_mode); ANDMISSING(enter_bold_mode, exit_attribute_mode); PAIRED(exit_ca_mode, enter_ca_mode); @@ -479,3 +515,10 @@ sanity_check(TERMTYPE * tp) #endif ANDMISSING(set_color_pair, initialize_pair); } + +/* obsolete: 20040705 */ +static void +sanity_check(TERMTYPE *tp) +{ + sanity_check2(tp, FALSE); +} diff --git a/ncurses/tinfo/comp_scan.c b/ncurses/tinfo/comp_scan.c index c819edca..a57af76c 100644 --- a/ncurses/tinfo/comp_scan.c +++ b/ncurses/tinfo/comp_scan.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996 on * ****************************************************************************/ /* @@ -50,7 +51,7 @@ #include #include -MODULE_ID("$Id: comp_scan.c,v 1.66 2003/12/14 00:32:40 tom Exp $") +MODULE_ID("$Id: comp_scan.c,v 1.76 2005/06/04 22:04:45 tom Exp $") /* * Maximum length of string capability we'll accept before raising an error. @@ -94,11 +95,193 @@ NCURSES_EXPORT_VAR(bool) _nc_disable_period = FALSE; /* used by tic -a option */ #endif -static bool end_of_stream(void); -static int last_char(void); -static int next_char(void); -static long stream_pos(void); -static void push_back(char c); +/***************************************************************************** + * + * Character-stream handling + * + *****************************************************************************/ + +#define LEXBUFSIZ 1024 + +static char *bufptr; /* otherwise, the input buffer pointer */ +static char *bufstart; /* start of buffer so we can compute offsets */ +static FILE *yyin; /* scanner's input file descriptor */ + +/* + * _nc_reset_input() + * + * Resets the input-reading routines. Used on initialization, + * or after a seek has been done. Exactly one argument must be + * non-null. + */ + +NCURSES_EXPORT(void) +_nc_reset_input(FILE *fp, char *buf) +{ + pushtype = NO_PUSHBACK; + if (pushname != 0) + pushname[0] = '\0'; + yyin = fp; + bufstart = bufptr = buf; + _nc_curr_file_pos = 0L; + if (fp != 0) + _nc_curr_line = 0; + _nc_curr_col = 0; +} + +/* + * int last_char() + * + * Returns the final nonblank character on the current input buffer + */ +static int +last_char(void) +{ + size_t len = strlen(bufptr); + while (len--) { + if (!isspace(UChar(bufptr[len]))) + return bufptr[len]; + } + return 0; +} + +/* + * int next_char() + * + * Returns the next character in the input stream. Comments and leading + * white space are stripped. + * + * The global state variable 'firstcolumn' is set TRUE if the character + * returned is from the first column of the input line. + * + * The global variable _nc_curr_line is incremented for each new line. + * The global variable _nc_curr_file_pos is set to the file offset of the + * beginning of each line. + */ + +static int +next_char(void) +{ + static char *result; + static size_t allocated; + int the_char; + + if (!yyin) { + if (result != 0) { + FreeAndNull(result); + FreeAndNull(pushname); + allocated = 0; + } + /* + * An string with an embedded null will truncate the input. This is + * intentional (we don't read binary files here). + */ + if (bufptr == 0 || *bufptr == '\0') + return (EOF); + if (*bufptr == '\n') { + _nc_curr_line++; + _nc_curr_col = 0; + } else if (*bufptr == '\t') { + _nc_curr_col = (_nc_curr_col | 7); + } + } else if (!bufptr || !*bufptr) { + /* + * In theory this could be recoded to do its I/O one character at a + * time, saving the buffer space. In practice, this turns out to be + * quite hard to get completely right. Try it and see. If you + * succeed, don't forget to hack push_back() correspondingly. + */ + size_t used; + size_t len; + + do { + bufstart = 0; + used = 0; + do { + if (used + (LEXBUFSIZ / 4) >= allocated) { + allocated += (allocated + LEXBUFSIZ); + result = typeRealloc(char, allocated, result); + if (result == 0) + return (EOF); + } + if (used == 0) + _nc_curr_file_pos = ftell(yyin); + + if (fgets(result + used, (int) (allocated - used), yyin) != 0) { + bufstart = result; + if (used == 0) { + _nc_curr_line++; + _nc_curr_col = 0; + } + } else { + if (used != 0) + strcat(result, "\n"); + } + if ((bufptr = bufstart) != 0) { + used = strlen(bufptr); + while (iswhite(*bufptr)) { + if (*bufptr == '\t') { + _nc_curr_col = (_nc_curr_col | 7) + 1; + } else { + _nc_curr_col++; + } + bufptr++; + } + + /* + * Treat a trailing the same as a so we + * can read files on OS/2, etc. + */ + if ((len = strlen(bufptr)) > 1) { + if (bufptr[len - 1] == '\n' + && bufptr[len - 2] == '\r') { + len--; + bufptr[len - 1] = '\n'; + bufptr[len] = '\0'; + } + } + } else { + return (EOF); + } + } while (bufptr[len - 1] != '\n'); /* complete a line */ + } while (result[0] == '#'); /* ignore comments */ + } else if (*bufptr == '\t') { + _nc_curr_col = (_nc_curr_col | 7); + } + + first_column = (bufptr == bufstart); + if (first_column) + had_newline = FALSE; + + _nc_curr_col++; + the_char = *bufptr++; + return UChar(the_char); +} + +static void +push_back(char c) +/* push a character back onto the input stream */ +{ + if (bufptr == bufstart) + _nc_syserr_abort("Can't backspace off beginning of line"); + *--bufptr = c; + _nc_curr_col--; +} + +static long +stream_pos(void) +/* return our current character position in the input stream */ +{ + return (yyin ? ftell(yyin) : (bufptr ? bufptr - bufstart : 0)); +} + +static bool +end_of_stream(void) +/* are we at end of input? */ +{ + return ((yyin ? feof(yyin) : (bufptr && *bufptr == '\0')) + ? TRUE : FALSE); +} /* Assume we may be looking at a termcap-style continuation */ static inline int @@ -161,6 +344,10 @@ _nc_get_token(bool silent) long number; long token_start; unsigned found; +#ifdef TRACE + int old_line; + int old_col; +#endif if (pushtype != NO_PUSHBACK) { int retval = pushtype; @@ -178,7 +365,11 @@ _nc_get_token(bool silent) } if (end_of_stream()) { + yyin = 0; + next_char(); /* frees its allocated memory */ if (buffer != 0) { + if (_nc_curr_token.tk_name == buffer) + _nc_curr_token.tk_name = 0; FreeAndNull(buffer); } return (EOF); @@ -194,6 +385,10 @@ _nc_get_token(bool silent) ch = eat_escaped_newline(ch); +#ifdef TRACE + old_line = _nc_curr_line; + old_col = _nc_curr_col; +#endif if (ch == EOF) type = EOF; else { @@ -219,13 +414,13 @@ _nc_get_token(bool silent) } /* have to make some punctuation chars legal for terminfo */ - if (!isalnum(ch) + if (!isalnum(UChar(ch)) #if NCURSES_EXT_FUNCS && !(ch == '.' && _nc_disable_period) #endif && !strchr(terminfo_punct, (char) ch)) { if (!silent) - _nc_warning("Illegal character (expected alphanumeric or %s) - %s", + _nc_warning("Illegal character (expected alphanumeric or %s) - '%s'", terminfo_punct, unctrl((chtype) ch)); _nc_panic_mode(separator); goto start_token; @@ -234,6 +429,10 @@ _nc_get_token(bool silent) if (buffer == 0) buffer = typeMalloc(char, MAX_ENTRY_SIZE); +#ifdef TRACE + old_line = _nc_curr_line; + old_col = _nc_curr_col; +#endif ptr = buffer; *(ptr++) = ch; @@ -247,7 +446,7 @@ _nc_get_token(bool silent) after_list = 0; while ((ch = next_char()) != '\n') { if (ch == EOF) { - _nc_err_abort(MSG_NO_MEMORY); + _nc_err_abort(MSG_NO_INPUTS); } else if (ch == '|') { after_list = ptr; if (after_name == 0) @@ -351,7 +550,7 @@ _nc_get_token(bool silent) had_newline = FALSE; } while ((ch = next_char()) != EOF) { - if (!isalnum(ch)) { + if (!isalnum(UChar(ch))) { if (_nc_syntax == SYN_TERMINFO) { if (ch != '_') break; @@ -416,7 +615,7 @@ _nc_get_token(bool silent) /* just to get rid of the compiler warning */ type = UNDEF; if (!silent) - _nc_warning("Illegal character - %s", unctrl((chtype) ch)); + _nc_warning("Illegal character - '%s'", unctrl((chtype) ch)); } } /* end else (first_column == FALSE) */ } /* end else (ch != EOF) */ @@ -427,6 +626,11 @@ _nc_get_token(bool silent) if (dot_flag == TRUE) DEBUG(8, ("Commented out ")); + if (_nc_tracing >= DEBUG_LEVEL(8)) { + _tracef("parsed %d.%d to %d.%d", + old_line, old_col, + _nc_curr_line, _nc_curr_col); + } if (_nc_tracing >= DEBUG_LEVEL(7)) { switch (type) { case BOOLEAN: @@ -471,8 +675,9 @@ _nc_get_token(bool silent) type = _nc_get_token(silent); DEBUG(3, ("token: `%s', class %d", - _nc_curr_token.tk_name != 0 ? _nc_curr_token.tk_name : - "", + ((_nc_curr_token.tk_name != 0) + ? _nc_curr_token.tk_name + : ""), type)); return (type); @@ -497,7 +702,7 @@ _nc_get_token(bool silent) * */ -NCURSES_EXPORT(char) +NCURSES_EXPORT(int) _nc_trans_string(char *ptr, char *last) { int count = 0; @@ -518,7 +723,7 @@ _nc_trans_string(char *ptr, char *last) _nc_err_abort(MSG_NO_INPUTS); if (!(is7bits(ch) && isprint(ch))) { - _nc_warning("Illegal ^ character - %s", unctrl(ch)); + _nc_warning("Illegal ^ character - '%s'", unctrl(ch)); } if (ch == '?') { *(ptr++) = '\177'; @@ -613,7 +818,7 @@ _nc_trans_string(char *ptr, char *last) continue; default: - _nc_warning("Illegal character %s in \\ sequence", + _nc_warning("Illegal character '%s' in \\ sequence", unctrl(ch)); /* FALLTHRU */ case '|': @@ -623,13 +828,21 @@ _nc_trans_string(char *ptr, char *last) } /* end else if (ch == '\\') */ else if (ch == '\n' && (_nc_syntax == SYN_TERMINFO)) { - /* newlines embedded in a terminfo string are ignored */ + /* + * Newlines embedded in a terminfo string are ignored, provided + * that the next line begins with whitespace. + */ ignored = TRUE; } else { *(ptr++) = (char) ch; } if (!ignored) { + if (_nc_curr_col <= 1) { + push_back(ch); + ch = '\n'; + break; + } last_ch = ch; count++; } @@ -668,7 +881,10 @@ _nc_push_token(int tokclass) _nc_get_type(pushname); DEBUG(3, ("pushing token: `%s', class %d", - _nc_curr_token.tk_name, pushtype)); + ((_nc_curr_token.tk_name != 0) + ? _nc_curr_token.tk_name + : ""), + pushtype)); } /* @@ -688,171 +904,10 @@ _nc_panic_mode(char ch) } } -/***************************************************************************** - * - * Character-stream handling - * - *****************************************************************************/ - -#define LEXBUFSIZ 1024 - -static char *bufptr; /* otherwise, the input buffer pointer */ -static char *bufstart; /* start of buffer so we can compute offsets */ -static FILE *yyin; /* scanner's input file descriptor */ - -/* - * _nc_reset_input() - * - * Resets the input-reading routines. Used on initialization, - * or after a seek has been done. Exactly one argument must be - * non-null. - */ - +#if NO_LEAKS NCURSES_EXPORT(void) -_nc_reset_input(FILE *fp, char *buf) +_nc_comp_scan_leaks(void) { - pushtype = NO_PUSHBACK; - if (pushname != 0) - pushname[0] = '\0'; - yyin = fp; - bufstart = bufptr = buf; - _nc_curr_file_pos = 0L; - if (fp != 0) - _nc_curr_line = 0; - _nc_curr_col = 0; -} - -/* - * int last_char() - * - * Returns the final nonblank character on the current input buffer - */ -static int -last_char(void) -{ - size_t len = strlen(bufptr); - while (len--) { - if (!isspace(UChar(bufptr[len]))) - return bufptr[len]; - } - return 0; -} - -/* - * int next_char() - * - * Returns the next character in the input stream. Comments and leading - * white space are stripped. - * - * The global state variable 'firstcolumn' is set TRUE if the character - * returned is from the first column of the input line. - * - * The global variable _nc_curr_line is incremented for each new line. - * The global variable _nc_curr_file_pos is set to the file offset of the - * beginning of each line. - */ - -static int -next_char(void) -{ - if (!yyin) { - /* - * An string with an embedded null will truncate the input. This is - * intentional (we don't read binary files here). - */ - if (*bufptr == '\0') - return (EOF); - if (*bufptr == '\n') { - _nc_curr_line++; - _nc_curr_col = 0; - } - } else if (!bufptr || !*bufptr) { - /* - * In theory this could be recoded to do its I/O one character at a - * time, saving the buffer space. In practice, this turns out to be - * quite hard to get completely right. Try it and see. If you - * succeed, don't forget to hack push_back() correspondingly. - */ - static char *result; - static size_t allocated; - size_t used; - size_t len; - - do { - bufstart = 0; - used = 0; - do { - if (used + (LEXBUFSIZ / 4) >= allocated) { - allocated += (allocated + LEXBUFSIZ); - result = typeRealloc(char, allocated, result); - if (result == 0) - return (EOF); - } - if (used == 0) - _nc_curr_file_pos = ftell(yyin); - - if (fgets(result + used, allocated - used, yyin) != 0) { - bufstart = result; - if (used == 0) { - _nc_curr_line++; - _nc_curr_col = 0; - } - } else { - if (used != 0) - strcat(result, "\n"); - } - if ((bufptr = bufstart) != 0) { - used = strlen(bufptr); - while (iswhite(*bufptr)) - bufptr++; - - /* - * Treat a trailing the same as a so we - * can read files on OS/2, etc. - */ - if ((len = strlen(bufptr)) > 1) { - if (bufptr[len - 1] == '\n' - && bufptr[len - 2] == '\r') { - len--; - bufptr[len - 1] = '\n'; - bufptr[len] = '\0'; - } - } - } else { - return (EOF); - } - } while (bufptr[len - 1] != '\n'); /* complete a line */ - } while (result[0] == '#'); /* ignore comments */ - } - - first_column = (bufptr == bufstart); - if (first_column) - had_newline = FALSE; - - _nc_curr_col++; - return (*bufptr++); -} - -static void -push_back(char c) -/* push a character back onto the input stream */ -{ - if (bufptr == bufstart) - _nc_syserr_abort("Can't backspace off beginning of line"); - *--bufptr = c; -} - -static long -stream_pos(void) -/* return our current character position in the input stream */ -{ - return (yyin ? ftell(yyin) : (bufptr ? bufptr - bufstart : 0)); -} - -static bool -end_of_stream(void) -/* are we at end of input? */ -{ - return ((yyin ? feof(yyin) : (bufptr && *bufptr == '\0')) - ? TRUE : FALSE); + FreeAndNull(pushname); } +#endif diff --git a/ncurses/tinfo/free_ttype.c b/ncurses/tinfo/free_ttype.c index 08dac4ec..2e714e48 100644 --- a/ncurses/tinfo/free_ttype.c +++ b/ncurses/tinfo/free_ttype.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1999-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -43,10 +43,10 @@ #include #include -MODULE_ID("$Id: free_ttype.c,v 1.10 2003/08/09 21:22:03 tom Exp $") +MODULE_ID("$Id: free_ttype.c,v 1.11 2005/06/04 21:54:50 tom Exp $") NCURSES_EXPORT(void) -_nc_free_termtype(TERMTYPE * ptr) +_nc_free_termtype(TERMTYPE *ptr) { T(("_nc_free_termtype(%s)", ptr->term_names)); @@ -89,6 +89,7 @@ _nc_free_termtype(TERMTYPE * ptr) FreeIfNeeded(ptr->ext_Names); #endif memset(ptr, 0, sizeof(TERMTYPE)); + _nc_free_entry(_nc_head, ptr); } #if NCURSES_XNAMES diff --git a/ncurses/tinfo/home_terminfo.c b/ncurses/tinfo/home_terminfo.c index fac19bf5..ce6576a8 100644 --- a/ncurses/tinfo/home_terminfo.c +++ b/ncurses/tinfo/home_terminfo.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1998,2000,2004 * + * Author: Thomas E. Dickey 1998,2000,2004,2005 * ****************************************************************************/ /* @@ -37,7 +37,7 @@ #include #include -MODULE_ID("$Id: home_terminfo.c,v 1.8 2004/01/14 02:18:16 tom Exp $") +MODULE_ID("$Id: home_terminfo.c,v 1.9 2005/07/02 19:43:38 tom Exp $") #define my_length (strlen(home) + sizeof(PRIVATE_INFO)) @@ -46,6 +46,7 @@ MODULE_ID("$Id: home_terminfo.c,v 1.8 2004/01/14 02:18:16 tom Exp $") NCURSES_EXPORT(char *) _nc_home_terminfo(void) { + char *result = 0; #ifdef USE_HOME_TERMINFO char *home; static char *temp = 0; @@ -60,8 +61,8 @@ _nc_home_terminfo(void) (void) sprintf(temp, PRIVATE_INFO, home); } } - return temp; + result = temp; } #endif - return 0; + return result; } diff --git a/ncurses/tinfo/init_keytry.c b/ncurses/tinfo/init_keytry.c index cf840e8e..c151fd9f 100644 --- a/ncurses/tinfo/init_keytry.c +++ b/ncurses/tinfo/init_keytry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1999-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -28,11 +28,15 @@ #include -#include /* keypad_xmit, keypad_local, meta_on, meta_off */ - /* cursor_visible,cursor_normal,cursor_invisible */ +#include +/* keypad_xmit, keypad_local, meta_on, meta_off */ +/* cursor_visible,cursor_normal,cursor_invisible */ + #include /* struct tinfo_fkeys */ -MODULE_ID("$Id: init_keytry.c,v 1.5 2000/12/10 02:55:07 tom Exp $") +#include + +MODULE_ID("$Id: init_keytry.c,v 1.7 2005/04/30 19:32:03 tom Exp $") /* ** _nc_init_keytry() @@ -69,12 +73,38 @@ _nc_init_keytry(void) * mouse_activate() (which will call keyok()) are first called. */ - for (n = 0; _nc_tinfo_fkeys[n].code; n++) - if (_nc_tinfo_fkeys[n].offset < STRCOUNT) - _nc_add_to_try(&(SP->_keytry), - CUR Strings[_nc_tinfo_fkeys[n].offset], - _nc_tinfo_fkeys[n].code); + if (SP != 0) { + for (n = 0; _nc_tinfo_fkeys[n].code; n++) { + if (_nc_tinfo_fkeys[n].offset < STRCOUNT) { + _nc_add_to_try(&(SP->_keytry), + CUR Strings[_nc_tinfo_fkeys[n].offset], + _nc_tinfo_fkeys[n].code); + } + } +#if NCURSES_XNAMES + /* + * Add any of the extended strings to the tries if their name begins + * with 'k', i.e., they follow the convention of other terminfo key + * names. + */ + { + TERMTYPE *tp = &(SP->_term->type); + for (n = STRCOUNT; n < NUM_STRINGS(tp); ++n) { + char *name = ExtStrname(tp, n, strnames); + char *value = tp->Strings[n]; + if (name != 0 + && *name == 'k' + && value != 0 + && key_defined(value) == 0) { + _nc_add_to_try(&(SP->_keytry), + value, + n - STRCOUNT + KEY_MAX); + } + } + } +#endif #ifdef TRACE - _nc_trace_tries(SP->_keytry); + _nc_trace_tries(SP->_keytry); #endif + } } diff --git a/ncurses/tinfo/lib_acs.c b/ncurses/tinfo/lib_acs.c index 3b017450..745b055e 100644 --- a/ncurses/tinfo/lib_acs.c +++ b/ncurses/tinfo/lib_acs.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,12 +29,13 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ #include #include /* ena_acs, acs_chars */ -MODULE_ID("$Id: lib_acs.c,v 1.25 2002/12/28 16:26:46 tom Exp $") +MODULE_ID("$Id: lib_acs.c,v 1.27 2004/10/16 15:42:40 tom Exp $") #if BROKEN_LINKER NCURSES_EXPORT_VAR(chtype *) @@ -70,6 +71,7 @@ _nc_init_acs(void) for (j = 1; j < ACS_LEN; ++j) { real_map[j] = 0; fake_map[j] = A_ALTCHARSET | j; + SP->_screen_acs_map[j] = FALSE; } } else { for (j = 1; j < ACS_LEN; ++j) { @@ -119,6 +121,9 @@ _nc_init_acs(void) if (_nc_unicode_locale() && _nc_locale_breaks_acs()) { acs_chars = NULL; ena_acs = NULL; + enter_alt_charset_mode = NULL; + exit_alt_charset_mode = NULL; + set_attributes = NULL; } #endif @@ -134,6 +139,8 @@ _nc_init_acs(void) while (i + 1 < length) { if (acs_chars[i] != 0 && UChar(acs_chars[i]) < ACS_LEN) { real_map[UChar(acs_chars[i])] = UChar(acs_chars[i + 1]) | A_ALTCHARSET; + if (SP != 0) + SP->_screen_acs_map[UChar(acs_chars[i])] = TRUE; } i += 2; } @@ -152,6 +159,10 @@ _nc_init_acs(void) } } show[m] = 0; + if (acs_chars == NULL || strcmp(acs_chars, show)) + _tracef("%s acs_chars %s", + (acs_chars == NULL) ? "NULL" : "READ", + _nc_visbuf(acs_chars)); _tracef("%s acs_chars %s", (acs_chars == NULL) ? "NULL" diff --git a/ncurses/tinfo/lib_data.c b/ncurses/tinfo/lib_data.c index 87d60edf..34f033a7 100644 --- a/ncurses/tinfo/lib_data.c +++ b/ncurses/tinfo/lib_data.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -40,18 +41,15 @@ #include -MODULE_ID("$Id: lib_data.c,v 1.16 2000/12/10 02:55:07 tom Exp $") +MODULE_ID("$Id: lib_data.c,v 1.17 2005/01/22 17:39:22 tom Exp $") /* * OS/2's native linker complains if we don't initialize public data when * constructing a dll (reported by J.J.G.Ripoll). */ -NCURSES_EXPORT_VAR(WINDOW *) -stdscr = 0; -NCURSES_EXPORT_VAR(WINDOW *) -curscr = 0; -NCURSES_EXPORT_VAR(WINDOW *) -newscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) stdscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) curscr = 0; +NCURSES_EXPORT_VAR(WINDOW *) newscr = 0; NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain = 0; @@ -66,7 +64,7 @@ NCURSES_EXPORT_VAR(SCREEN *) _nc_screen_chain = 0; * module coupling that increases the size of the executable. */ #if BROKEN_LINKER - static SCREEN *my_screen; +static SCREEN *my_screen; NCURSES_EXPORT(SCREEN *) _nc_screen(void) @@ -81,11 +79,11 @@ _nc_alloc_screen(void) } NCURSES_EXPORT(void) -_nc_set_screen(SCREEN * sp) +_nc_set_screen(SCREEN *sp) { my_screen = sp; } #else -NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data... */ +NCURSES_EXPORT_VAR(SCREEN *) SP = NULL; /* Some linkers require initialized data... */ #endif diff --git a/ncurses/tinfo/lib_kernel.c b/ncurses/tinfo/lib_kernel.c index 84d40d6b..89dc1e80 100644 --- a/ncurses/tinfo/lib_kernel.c +++ b/ncurses/tinfo/lib_kernel.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -48,13 +48,13 @@ #include #include /* cur_term */ -MODULE_ID("$Id: lib_kernel.c,v 1.23 2003/01/26 00:24:53 tom Exp $") +MODULE_ID("$Id: lib_kernel.c,v 1.24 2004/05/08 17:11:21 tom Exp $") static int _nc_vdisable(void) { int value = -1; -#if defined(_POSIX_VDISABLE) && defined(HAVE_UNISTD_H) +#if defined(_POSIX_VDISABLE) && HAVE_UNISTD_H value = _POSIX_VDISABLE; #endif #if defined(_PC_VDISABLE) diff --git a/ncurses/tinfo/lib_napms.c b/ncurses/tinfo/lib_napms.c index 1003fa41..926afa83 100644 --- a/ncurses/tinfo/lib_napms.c +++ b/ncurses/tinfo/lib_napms.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -49,7 +49,7 @@ #endif #endif -MODULE_ID("$Id: lib_napms.c,v 1.14 2003/11/30 00:54:29 Philippe.Blain Exp $") +MODULE_ID("$Id: lib_napms.c,v 1.15 2005/04/03 13:58:14 tom Exp $") NCURSES_EXPORT(int) napms(int ms) @@ -59,10 +59,9 @@ napms(int ms) #if HAVE_NANOSLEEP { struct timespec request, remaining; - int err; request.tv_sec = ms / 1000; request.tv_nsec = (ms % 1000) * 1000000; - while ((err = nanosleep(&request, &remaining)) == -1 + while (nanosleep(&request, &remaining) == -1 && errno == EINTR) { request = remaining; } diff --git a/ncurses/tinfo/lib_options.c b/ncurses/tinfo/lib_options.c index 0edf9d5a..eae856a2 100644 --- a/ncurses/tinfo/lib_options.c +++ b/ncurses/tinfo/lib_options.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * - * and: Thomas E. Dickey 1996-2003 * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -43,7 +43,7 @@ #include -MODULE_ID("$Id: lib_options.c,v 1.47 2003/10/25 19:51:38 tom Exp $") +MODULE_ID("$Id: lib_options.c,v 1.48 2005/01/22 21:13:34 tom Exp $") NCURSES_EXPORT(int) idlok(WINDOW *win, bool flag) @@ -159,43 +159,44 @@ meta(WINDOW *win GCC_UNUSED, bool flag) NCURSES_EXPORT(int) curs_set(int vis) { - int cursor = SP->_cursor; + int result = ERR; T((T_CALLED("curs_set(%d)"), vis)); - - if (vis < 0 || vis > 2) - returnCode(ERR); - - if (vis == cursor) - returnCode(cursor); - - switch (vis) { - case 2: - if (cursor_visible) { - TPUTS_TRACE("cursor_visible"); - putp(cursor_visible); - } else - returnCode(ERR); - break; - case 1: - if (cursor_normal) { - TPUTS_TRACE("cursor_normal"); - putp(cursor_normal); - } else - returnCode(ERR); - break; - case 0: - if (cursor_invisible) { - TPUTS_TRACE("cursor_invisible"); - putp(cursor_invisible); - } else - returnCode(ERR); - break; + if (SP != 0 && vis >= 0 && vis <= 2) { + int cursor = SP->_cursor; + + if (vis == cursor) { + result = cursor; + } else { + result = (cursor == -1 ? 1 : cursor); + switch (vis) { + case 2: + if (cursor_visible) { + TPUTS_TRACE("cursor_visible"); + putp(cursor_visible); + } else + result = ERR; + break; + case 1: + if (cursor_normal) { + TPUTS_TRACE("cursor_normal"); + putp(cursor_normal); + } else + result = ERR; + break; + case 0: + if (cursor_invisible) { + TPUTS_TRACE("cursor_invisible"); + putp(cursor_invisible); + } else + result = ERR; + break; + } + SP->_cursor = vis; + _nc_flush(); + } } - SP->_cursor = vis; - _nc_flush(); - - returnCode(cursor == -1 ? 1 : cursor); + returnCode(result); } NCURSES_EXPORT(int) @@ -258,10 +259,12 @@ _nc_keypad(bool flag) _nc_flush(); } - if (flag && SP != 0 && !SP->_tried) { - _nc_init_keytry(); - SP->_tried = TRUE; + if (SP != 0) { + if (flag && !SP->_tried) { + _nc_init_keytry(); + SP->_tried = TRUE; + } + SP->_keypad_on = flag; } - SP->_keypad_on = flag; return (OK); } diff --git a/ncurses/tinfo/lib_setup.c b/ncurses/tinfo/lib_setup.c index 05caca22..4b0ec46e 100644 --- a/ncurses/tinfo/lib_setup.c +++ b/ncurses/tinfo/lib_setup.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -47,9 +47,13 @@ #define _POSIX_SOURCE #endif +#if HAVE_LOCALE_H +#include +#endif + #include /* lines, columns, cur_term */ -MODULE_ID("$Id: lib_setup.c,v 1.79 2003/12/27 18:24:26 tom Exp $") +MODULE_ID("$Id: lib_setup.c,v 1.88 2005/03/12 19:41:45 tom Exp $") /**************************************************************************** * @@ -73,6 +77,10 @@ MODULE_ID("$Id: lib_setup.c,v 1.79 2003/12/27 18:24:26 tom Exp $") # include #endif +#if HAVE_LANGINFO_CODESET +#include +#endif + /* * SCO defines TIOCGSIZE and the corresponding struct. Other systems (SunOS, * Solaris, IRIX) define TIOCGWINSZ and struct winsize. @@ -205,11 +213,24 @@ _nc_get_screensize(int *linep, int *colp) NCURSES_EXPORT(void) _nc_update_screensize(void) { - int my_lines, my_cols; + int old_lines = lines; + int new_lines; + int old_cols = columns; + int new_cols; + + _nc_get_screensize(&new_lines, &new_cols); - _nc_get_screensize(&my_lines, &my_cols); - if (SP != 0 && SP->_resize != 0) - SP->_resize(my_lines, my_cols); + /* + * See is_term_resized() and resizeterm(). + * We're doing it this way because those functions belong to the upper + * ncurses library, while this resides in the lower terminfo library. + */ + if (SP != 0 + && SP->_resize != 0) { + if ((new_lines != old_lines) || (new_cols != old_cols)) + SP->_resize(new_lines, new_cols); + SP->_sig_winch = FALSE; + } } #endif @@ -237,7 +258,7 @@ _nc_update_screensize(void) #if USE_DATABASE || USE_TERMCAP static int -grab_entry(const char *const tn, TERMTYPE * const tp) +grab_entry(const char *const tn, TERMTYPE *const tp) /* return 1 if entry found, 0 if not found, -1 if database not accessible */ { #if USE_DATABASE @@ -318,18 +339,27 @@ do_prototype(void) } /* - * Check if we are running in a UTF-8 locale. + * Find the locale which is in effect. */ NCURSES_EXPORT(char *) _nc_get_locale(void) { char *env; +#if HAVE_LOCALE_H + /* + * This is preferable to using getenv() since it ensures that we are using + * the locale which was actually initialized by the application. + */ + env = setlocale(LC_CTYPE, 0); +#else if (((env = getenv("LC_ALL")) != 0 && *env != '\0') || ((env = getenv("LC_CTYPE")) != 0 && *env != '\0') || ((env = getenv("LANG")) != 0 && *env != '\0')) { - return env; + ; } - return 0; +#endif + T(("_nc_get_locale %s", _nc_visbuf(env))); + return env; } /* @@ -338,14 +368,26 @@ _nc_get_locale(void) NCURSES_EXPORT(int) _nc_unicode_locale(void) { + int result = 0; +#if HAVE_LANGINFO_CODESET + char *env = nl_langinfo(CODESET); + result = !strcmp(env, "UTF-8"); + T(("_nc_unicode_locale(%s) ->%d", env, result)); +#else char *env = _nc_get_locale(); if (env != 0) { - if (strstr(env, ".UTF-8") != 0) - return 1; + if (strstr(env, ".UTF-8") != 0) { + result = 1; + T(("_nc_unicode_locale(%s) ->%d", env, result)); + } } - return 0; +#endif + return result; } +#define CONTROL_N(s) ((s) != 0 && strstr(s, "\016") != 0) +#define CONTROL_O(s) ((s) != 0 && strstr(s, "\017") != 0) + /* * Check for known broken cases where a UTF-8 locale breaks the alternate * character set. @@ -353,30 +395,33 @@ _nc_unicode_locale(void) NCURSES_EXPORT(int) _nc_locale_breaks_acs(void) { - char *env = getenv("TERM"); - if (env != 0) { + char *env; + + if ((env = getenv("NCURSES_NO_UTF8_ACS")) != 0) { + return atoi(env); + } else if ((env = getenv("TERM")) != 0) { if (strstr(env, "linux")) return 1; /* always broken */ if (strstr(env, "screen") != 0 && ((env = getenv("TERMCAP")) != 0 && strstr(env, "screen") != 0) && strstr(env, "hhII00") != 0) { - return 1; + if (CONTROL_N(enter_alt_charset_mode) || + CONTROL_O(enter_alt_charset_mode) || + CONTROL_N(set_attributes) || + CONTROL_O(set_attributes)) + return 1; } } return 0; } /* - * setupterm(termname, Filedes, errret) - * - * Find and read the appropriate object file for the terminal - * Make cur_term point to the structure. - * + * This entrypoint is called from tgetent() to allow special a case of reusing + * the same TERMINAL data (see comment). */ - NCURSES_EXPORT(int) -setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) +_nc_setupterm(NCURSES_CONST char *tname, int Filedes, int *errret, bool reuse) { int status; @@ -419,7 +464,8 @@ setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) * however applications that are working around the problem will still work * properly with this feature). */ - if (cur_term != 0 + if (reuse + && cur_term != 0 && cur_term->Filedes == Filedes && cur_term->_termname != 0 && !strcmp(cur_term->_termname, tname) @@ -500,3 +546,17 @@ setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) } returnCode(OK); } + +/* + * setupterm(termname, Filedes, errret) + * + * Find and read the appropriate object file for the terminal + * Make cur_term point to the structure. + * + */ + +NCURSES_EXPORT(int) +setupterm(NCURSES_CONST char *tname, int Filedes, int *errret) +{ + return _nc_setupterm(tname, Filedes, errret, FALSE); +} diff --git a/ncurses/tinfo/lib_termcap.c b/ncurses/tinfo/lib_termcap.c index d03488cf..c92e9ab4 100644 --- a/ncurses/tinfo/lib_termcap.c +++ b/ncurses/tinfo/lib_termcap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * * * * some of the code in here was contributed by: * * Magnus Bengtsson, d6mbeng@dtek.chalmers.se (Nov'93) * @@ -43,66 +44,12 @@ #include -MODULE_ID("$Id: lib_termcap.c,v 1.44 2003/05/24 21:10:28 tom Exp $") - -#define CSI 233 -#define ESC 033 /* ^[ */ -#define L_BRACK '[' -#define SHIFT_OUT 017 /* ^N */ +MODULE_ID("$Id: lib_termcap.c,v 1.51 2005/07/16 23:12:51 tom Exp $") NCURSES_EXPORT_VAR(char *) UP = 0; NCURSES_EXPORT_VAR(char *) BC = 0; -static char *fix_me = 0; - -static char * -set_attribute_9(int flag) -{ - const char *result; - - if ((result = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag)) == 0) - result = ""; - return strdup(result); -} - -static int -is_csi(char *s) -{ - if (UChar(s[0]) == CSI) - return 1; - else if (s[0] == ESC && s[1] == L_BRACK) - return 2; - return 0; -} - -static char * -skip_zero(char *s) -{ - if (s[0] == '0') { - if (s[1] == ';') - s += 2; - else if (isalpha(UChar(s[1]))) - s += 1; - } - return s; -} - -static bool -similar_sgr(char *a, char *b) -{ - int csi_a = is_csi(a); - int csi_b = is_csi(b); - - if (csi_a != 0 && csi_b != 0 && csi_a == csi_b) { - a += csi_a; - b += csi_b; - if (*a != *b) { - a = skip_zero(a); - b = skip_zero(b); - } - } - return strcmp(a, b) == 0; -} +static char *fix_me = 0; /* this holds the filtered sgr0 string */ /*************************************************************************** * @@ -124,14 +71,15 @@ tgetent(char *bufp GCC_UNUSED, const char *name) { int errcode; + START_TRACE(); T((T_CALLED("tgetent()"))); - setupterm((NCURSES_CONST char *) name, STDOUT_FILENO, &errcode); + _nc_setupterm((NCURSES_CONST char *) name, STDOUT_FILENO, &errcode, TRUE); PC = 0; UP = 0; BC = 0; - fix_me = 0; + fix_me = 0; /* don't free it - application may still use */ if (errcode == 1) { @@ -147,66 +95,14 @@ tgetent(char *bufp GCC_UNUSED, const char *name) if (backspace_if_not_bs != NULL) BC = backspace_if_not_bs; - /* - * While 'sgr0' is the "same" as termcap 'me', there is a compatibility - * issue. The sgr/sgr0 capabilities include setting/clearing alternate - * character set mode. A termcap application cannot use sgr, so sgr0 - * strings that reset alternate character set mode will be - * misinterpreted. Here, we remove those from the more common - * ISO/ANSI/VT100 entries, which have sgr0 agreeing with sgr. - */ - if (exit_attribute_mode != 0 - && set_attributes != 0) { - char *on = set_attribute_9(1); - char *off = set_attribute_9(0); - char *tmp; - size_t i, j, k; - - if (similar_sgr(off, exit_attribute_mode) - && !similar_sgr(off, on)) { - TR(TRACE_DATABASE, ("adjusting sgr0 : %s", _nc_visbuf(off))); - FreeIfNeeded(fix_me); - fix_me = off; - for (i = 0; off[i] != '\0'; ++i) { - if (on[i] != off[i]) { - j = strlen(off); - k = strlen(on); - while (j != 0 - && k != 0 - && off[j - 1] == on[k - 1]) { - --j, --k; - } - while (off[j] != '\0') { - off[i++] = off[j++]; - } - off[i] = '\0'; - break; - } - } - /* SGR 10 would reset to normal font */ - if ((i = is_csi(off)) != 0 - && off[strlen(off) - 1] == 'm') { - tmp = skip_zero(off + i); - if (tmp[0] == '1' - && skip_zero(tmp + 1) != tmp + 1) { - i = tmp - off; - if (off[i - 1] == ';') - i--; - j = skip_zero(tmp + 1) - off; - while (off[j] != '\0') { - off[i++] = off[j++]; - } - off[i] = '\0'; - } - } - TR(TRACE_DATABASE, ("...adjusted me : %s", _nc_visbuf(fix_me))); - if (!strcmp(fix_me, exit_attribute_mode)) { - TR(TRACE_DATABASE, ("...same result, discard")); + FreeIfNeeded(fix_me); + if ((fix_me = _nc_trim_sgr0(&(cur_term->type))) != 0) { + if (!strcmp(fix_me, exit_attribute_mode)) { + if (fix_me != exit_attribute_mode) { free(fix_me); - fix_me = 0; } + fix_me = 0; } - free(on); } (void) baudrate(); /* sets ospeed as a side-effect */ diff --git a/ncurses/tinfo/make_keys.c b/ncurses/tinfo/make_keys.c index 3c98da23..8f6243c9 100644 --- a/ncurses/tinfo/make_keys.c +++ b/ncurses/tinfo/make_keys.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,9 +35,11 @@ * making the output show the indices into the TERMTYPE Strings array. Doing * it that way lets us cut down on the size of the init_keytry() function. */ + +#define USE_TERMLIB 1 #include -MODULE_ID("$Id: make_keys.c,v 1.10 2000/12/10 02:55:08 tom Exp $") +MODULE_ID("$Id: make_keys.c,v 1.12 2005/08/20 19:58:18 tom Exp $") #include @@ -66,7 +68,7 @@ lookup(const char *name) } static void -make_keys(FILE * ifp, FILE * ofp) +make_keys(FILE *ifp, FILE *ofp) { char buffer[BUFSIZ]; char from[BUFSIZ]; @@ -92,7 +94,7 @@ make_keys(FILE * ifp, FILE * ofp) } static void -write_list(FILE * ofp, const char **list) +write_list(FILE *ofp, const char **list) { while (*list != 0) fprintf(ofp, "%s\n", *list++); diff --git a/ncurses/tinfo/name_match.c b/ncurses/tinfo/name_match.c index 9d8e390d..fee3ba3b 100644 --- a/ncurses/tinfo/name_match.c +++ b/ncurses/tinfo/name_match.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999,2000,2001 Free Software Foundation, Inc. * + * Copyright (c) 1999-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,7 +34,7 @@ #include #include -MODULE_ID("$Id: name_match.c,v 1.12 2002/08/31 21:48:41 Philippe.Blain Exp $") +MODULE_ID("$Id: name_match.c,v 1.15 2005/01/22 21:47:25 tom Exp $") /* * _nc_first_name(char *names) @@ -49,6 +49,14 @@ _nc_first_name(const char *const sp) static char *buf; register unsigned n; +#if NO_LEAKS + if (sp == 0) { + if (buf != 0) + FreeAndNull(buf); /* for leak-testing */ + return 0; + } +#endif + if (buf == 0) buf = typeMalloc(char, MAX_NAME_SIZE + 1); for (n = 0; n < MAX_NAME_SIZE; n++) { @@ -67,8 +75,7 @@ _nc_first_name(const char *const sp) */ NCURSES_EXPORT(int) -_nc_name_match -(const char *const namelst, const char *const name, const char *const delim) +_nc_name_match(const char *const namelst, const char *const name, const char *const delim) { const char *s, *d, *t; int code, found; diff --git a/ncurses/tinfo/parse_entry.c b/ncurses/tinfo/parse_entry.c index 578e86ee..eed3d044 100644 --- a/ncurses/tinfo/parse_entry.c +++ b/ncurses/tinfo/parse_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * - * and: Thomas E. Dickey 1996-2003 * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -48,7 +48,7 @@ #include #include -MODULE_ID("$Id: parse_entry.c,v 1.60 2003/11/08 21:57:09 tom Exp $") +MODULE_ID("$Id: parse_entry.c,v 1.62 2005/06/02 22:04:32 tom Exp $") #ifdef LINT static short const parametrized[] = @@ -232,7 +232,11 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent) * 2-character name, but was instead the first alias after that. */ ptr = _nc_curr_token.tk_name; - if (_nc_syntax == SYN_TERMCAP) { + if (_nc_syntax == SYN_TERMCAP +#if NCURSES_XNAMES + && !_nc_user_definable +#endif + ) { if (ptr[2] == '|') { ptr += 3; _nc_curr_token.tk_name[2] = '\0'; @@ -367,22 +371,25 @@ _nc_parse_entry(struct entry *entryp, int literal, bool silent) */ /* tell max_attributes from arrow_key_map */ - if (token_type == NUMBER && !strcmp("ma", _nc_curr_token.tk_name)) + if (token_type == NUMBER + && !strcmp("ma", _nc_curr_token.tk_name)) { entry_ptr = _nc_find_type_entry("ma", NUMBER, _nc_get_table(_nc_syntax != 0)); - /* map terminfo's string MT to MT */ - else if (token_type == STRING && !strcmp("MT", _nc_curr_token.tk_name)) + /* map terminfo's string MT to MT */ + } else if (token_type == STRING + && !strcmp("MT", _nc_curr_token.tk_name)) { entry_ptr = _nc_find_type_entry("MT", STRING, _nc_get_table(_nc_syntax != 0)); - /* treat strings without following "=" as empty strings */ - else if (token_type == BOOLEAN && entry_ptr->nte_type == STRING) + /* treat strings without following "=" as empty strings */ + } else if (token_type == BOOLEAN + && entry_ptr->nte_type == STRING) { token_type = STRING; - /* we couldn't recover; skip this token */ - else { + /* we couldn't recover; skip this token */ + } else { if (!silent) { const char *type_name; switch (entry_ptr->nte_type) { @@ -616,7 +623,7 @@ static const char C_HT[] = "\t"; #define CUR tp-> static void -postprocess_termcap(TERMTYPE * tp, bool has_base) +postprocess_termcap(TERMTYPE *tp, bool has_base) { char buf[MAX_LINE * 2 + 2]; string_desc result; @@ -896,7 +903,7 @@ postprocess_termcap(TERMTYPE * tp, bool has_base) } static void -postprocess_terminfo(TERMTYPE * tp) +postprocess_terminfo(TERMTYPE *tp) { /* * TERMINFO-TO-TERMINFO MAPPINGS FOR SOURCE TRANSLATION diff --git a/ncurses/tinfo/read_entry.c b/ncurses/tinfo/read_entry.c index 363b9970..abc8a765 100644 --- a/ncurses/tinfo/read_entry.c +++ b/ncurses/tinfo/read_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * - * and: Thomas E. Dickey * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -42,12 +42,14 @@ #include #include -MODULE_ID("$Id: read_entry.c,v 1.79 2004/01/11 01:57:05 tom Exp $") +MODULE_ID("$Id: read_entry.c,v 1.81 2005/06/02 22:04:32 tom Exp $") #if !HAVE_TELL #define tell(fd) lseek(fd, 0, SEEK_CUR) /* lseek() is POSIX, but not tell() */ #endif +#define TYPE_CALLOC(type,elts) typeCalloc(type, (unsigned)(elts)) + /* * int * _nc_read_file_entry(filename, ptr) @@ -146,13 +148,14 @@ convert_strings(char *buf, char **Strings, int count, int size, char *table) } } -#define read_shorts(fd, buf, count) (read(fd, buf, (count)*2) == (count)*2) +#define read_shorts(fd, buf, count) \ + (read(fd, buf, (unsigned) (count)*2) == (int) (count)*2) #define even_boundary(value) \ if ((value) % 2 != 0) read(fd, buf, 1) static int -read_termtype(int fd, TERMTYPE * ptr) +read_termtype(int fd, TERMTYPE *ptr) /* return 1 if read, 0 if not found or garbled */ { int name_size, bool_count, num_count, str_count, str_size; @@ -204,7 +207,7 @@ read_termtype(int fd, TERMTYPE * ptr) memset(buf + have, 0, want - have); } buf[want] = '\0'; - ptr->term_names = typeCalloc(char, strlen(buf) + 1); + ptr->term_names = TYPE_CALLOC(char, strlen(buf) + 1); if (ptr->term_names == NULL) { return (0); } @@ -213,7 +216,7 @@ read_termtype(int fd, TERMTYPE * ptr) lseek(fd, (off_t) (have - MAX_NAME_SIZE), 1); /* grab the booleans */ - if ((ptr->Booleans = typeCalloc(char, max(BOOLCOUNT, bool_count))) == 0 + if ((ptr->Booleans = TYPE_CALLOC(char, max(BOOLCOUNT, bool_count))) == 0 || read(fd, ptr->Booleans, (unsigned) bool_count) < bool_count) { return (0); } @@ -227,13 +230,13 @@ read_termtype(int fd, TERMTYPE * ptr) even_boundary(name_size + bool_count); /* grab the numbers */ - if ((ptr->Numbers = typeCalloc(short, max(NUMCOUNT, num_count))) == 0 + if ((ptr->Numbers = TYPE_CALLOC(short, max(NUMCOUNT, num_count))) == 0 || !read_shorts(fd, buf, num_count)) { return (0); } convert_shorts(buf, ptr->Numbers, num_count); - if ((ptr->Strings = typeCalloc(char *, max(STRCOUNT, str_count))) == 0) + if ((ptr->Strings = TYPE_CALLOC(char *, max(STRCOUNT, str_count))) == 0) return (0); if (str_count) { @@ -263,10 +266,10 @@ read_termtype(int fd, TERMTYPE * ptr) int ext_str_count = LOW_MSB(buf + 4); int ext_str_size = LOW_MSB(buf + 6); int ext_str_limit = LOW_MSB(buf + 8); - int need = (ext_bool_count + ext_num_count + ext_str_count); + unsigned need = (ext_bool_count + ext_num_count + ext_str_count); int base = 0; - if (need >= (int) sizeof(buf) + if (need >= sizeof(buf) || ext_str_size >= (int) sizeof(buf) || ext_str_limit >= (int) sizeof(buf) || ext_bool_count < 0 @@ -317,7 +320,7 @@ read_termtype(int fd, TERMTYPE * ptr) if (ext_str_limit) { if ((ptr->ext_str_table = typeMalloc(char, ext_str_limit)) == 0) return (0); - if (read(fd, ptr->ext_str_table, ext_str_limit) != ext_str_limit) + if (read(fd, ptr->ext_str_table, (unsigned) ext_str_limit) != ext_str_limit) return (0); TR(TRACE_DATABASE, ("first extended-string is %s", _nc_visbuf(ptr->ext_str_table))); } @@ -342,12 +345,14 @@ read_termtype(int fd, TERMTYPE * ptr) } if (need) { - if ((ptr->ext_Names = typeCalloc(char *, need)) == 0) + if ((ptr->ext_Names = TYPE_CALLOC(char *, need)) == 0) return (0); TR(TRACE_DATABASE, ("ext_NAMES starting @%d in extended_strings, first = %s", base, _nc_visbuf(ptr->ext_str_table + base))); - convert_strings(buf + (2 * ext_str_count), ptr->ext_Names, need, + convert_strings(buf + (2 * ext_str_count), + ptr->ext_Names, + (int) need, ext_str_limit, ptr->ext_str_table + base); } @@ -378,7 +383,7 @@ read_termtype(int fd, TERMTYPE * ptr) } NCURSES_EXPORT(int) -_nc_read_file_entry(const char *const filename, TERMTYPE * ptr) +_nc_read_file_entry(const char *const filename, TERMTYPE *ptr) /* return 1 if read, 0 if not found or garbled */ { int code, fd = -1; @@ -389,8 +394,9 @@ _nc_read_file_entry(const char *const filename, TERMTYPE * ptr) code = 0; } else { T(("read terminfo %s", filename)); - if ((code = read_termtype(fd, ptr)) == 0) + if ((code = read_termtype(fd, ptr)) == 0) { _nc_free_termtype(ptr); + } close(fd); } @@ -403,7 +409,7 @@ _nc_read_file_entry(const char *const filename, TERMTYPE * ptr) */ static int _nc_read_tic_entry(char *const filename, - const char *const dir, const char *ttn, TERMTYPE * const tp) + const char *const dir, const char *ttn, TERMTYPE *const tp) { int need = 2 + strlen(dir) + strlen(ttn); @@ -419,7 +425,7 @@ _nc_read_tic_entry(char *const filename, */ static int _nc_read_terminfo_dirs(const char *dirs, char *const filename, const char *const - ttn, TERMTYPE * const tp) + ttn, TERMTYPE *const tp) { char *list, *a; const char *b; @@ -460,7 +466,7 @@ _nc_read_terminfo_dirs(const char *dirs, char *const filename, const char *const */ NCURSES_EXPORT(int) -_nc_read_entry(const char *const tn, char *const filename, TERMTYPE * const tp) +_nc_read_entry(const char *const tn, char *const filename, TERMTYPE *const tp) { char *envp; char ttn[PATH_MAX]; diff --git a/ncurses/tinfo/read_termcap.c b/ncurses/tinfo/read_termcap.c index e226b69d..a5d5a2cd 100644 --- a/ncurses/tinfo/read_termcap.c +++ b/ncurses/tinfo/read_termcap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -57,7 +58,7 @@ #include #include -MODULE_ID("$Id: read_termcap.c,v 1.61 2003/11/08 20:22:45 tom Exp $") +MODULE_ID("$Id: read_termcap.c,v 1.67 2005/06/04 21:49:20 tom Exp $") #if !PURE_TERMINFO @@ -74,10 +75,10 @@ MODULE_ID("$Id: read_termcap.c,v 1.61 2003/11/08 20:22:45 tom Exp $") #define TC_SYS_ERR -3 #define TC_REF_LOOP -4 -static char * +static NCURSES_CONST char * get_termpath(void) { - char *result; + NCURSES_CONST char *result; if (!use_terminfo_vars() || (result = getenv("TERMPATH")) == 0) result = TERMPATH; @@ -720,7 +721,7 @@ get_tc_token(char **srcp, int *endp) if (*s == '\0') { break; } else if (*s++ == '\n') { - while (isspace(*s)) + while (isspace(UChar(*s))) s++; } else { found = TRUE; @@ -734,7 +735,7 @@ get_tc_token(char **srcp, int *endp) break; } base = s; - } else if (isgraph(ch)) { + } else if (isgraph(UChar(ch))) { found = TRUE; } } @@ -754,7 +755,7 @@ copy_tc_token(char *dst, const char *src, size_t len) while ((ch = *src++) != '\0') { if (ch == '\\' && *src == '\n') { - while (isspace(*src)) + while (isspace(UChar(*src))) src++; continue; } @@ -784,7 +785,7 @@ _nc_tgetent(char *bp, char **sourcename, int *lineno, const char *name) char pathbuf[PBUFSIZ]; /* holds raw path of filenames */ char *pathvec[PVECSIZ]; /* to point to names in pathbuf */ char **pvec; /* holds usable tail of path vector */ - char *termpath; + NCURSES_CONST char *termpath; string_desc desc; fname = pathvec; @@ -932,7 +933,7 @@ add_tc(char *termpaths[], char *path, int count) #endif /* !USE_GETCAP */ NCURSES_EXPORT(int) -_nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) +_nc_read_termcap_entry(const char *const tn, TERMTYPE *const tp) { int found = FALSE; ENTRY *ep; @@ -1047,7 +1048,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) * Probably /etc/termcap is a symlink to /usr/share/misc/termcap. * Avoid reading the same file twice. */ -#ifdef HAVE_LINK +#if HAVE_LINK for (j = 0; j < filecount; j++) { bool omit = FALSE; if (stat(termpaths[j], &test_stat[j]) != 0 @@ -1112,7 +1113,7 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) return (ERR); /* resolve all use references */ - _nc_resolve_uses(TRUE); + _nc_resolve_uses2(TRUE, FALSE); /* find a terminal matching tn, if we can */ #if USE_GETCAP_CACHE @@ -1122,13 +1123,12 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) for_entry_list(ep) { if (_nc_name_match(ep->tterm.term_names, tn, "|:")) { /* - * Make a local copy of the terminal capabilities. Free all - * entry storage except the string table for the loaded type - * (which we disconnected from the list by NULLing out - * ep->tterm.str_table above). + * Make a local copy of the terminal capabilities, delinked + * from the list. */ *tp = ep->tterm; - ep->tterm.str_table = (char *) 0; + _nc_delink_entry(_nc_head, &(ep->tterm)); + free(ep); /* * OK, now try to write the type to user's terminfo directory. @@ -1154,7 +1154,6 @@ _nc_read_termcap_entry(const char *const tn, TERMTYPE * const tp) } #endif - _nc_free_entries(_nc_head); return (found); } #else diff --git a/ncurses/tinfo/trim_sgr0.c b/ncurses/tinfo/trim_sgr0.c new file mode 100644 index 00000000..7e7d15df --- /dev/null +++ b/ncurses/tinfo/trim_sgr0.c @@ -0,0 +1,328 @@ +/**************************************************************************** + * Copyright (c) 2005 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/**************************************************************************** + * Author: Thomas Dickey * + ****************************************************************************/ + +#include + +#include + +#include +#include + +MODULE_ID("$Id: trim_sgr0.c,v 1.5 2005/07/17 00:13:24 tom Exp $") + +#undef CUR +#define CUR tp-> + +#define CSI 233 +#define ESC 033 /* ^[ */ +#define L_BRACK '[' + +static char * +set_attribute_9(TERMTYPE *tp, int flag) +{ + const char *result; + + if ((result = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, flag)) == 0) + result = ""; + return strdup(result); +} + +static int +is_csi(const char *s) +{ + if (UChar(s[0]) == CSI) + return 1; + else if (s[0] == ESC && s[1] == L_BRACK) + return 2; + return 0; +} + +static char * +skip_zero(char *s) +{ + if (s[0] == '0') { + if (s[1] == ';') + s += 2; + else if (isalpha(UChar(s[1]))) + s += 1; + } + return s; +} + +static const char * +skip_delay(const char *s) +{ + if (s[0] == '$' && s[1] == '<') { + s += 2; + while ((*s != '\0') && (isdigit(*s) || *s == '/')) + ++s; + if (*s == '>') + ++s; + } + return s; +} + +/* + * Improve similar_sgr a little by moving the attr-string from the beginning + * to the end of the s-string. + */ +static bool +rewrite_sgr(char *s, char *attr) +{ + if (PRESENT(s)) { + if (PRESENT(attr)) { + unsigned len_s = strlen(s); + unsigned len_a = strlen(attr); + + if (len_s > len_a && !strncmp(attr, s, len_a)) { + unsigned n; + TR(TRACE_DATABASE, ("rewrite:\n\t%s", s)); + for (n = 0; n < len_s - len_a; ++n) { + s[n] = s[n + len_a]; + } + strcpy(s + n, attr); + TR(TRACE_DATABASE, ("to:\n\t%s", s)); + } + } + return TRUE; + } + return FALSE; /* oops */ +} + +static bool +similar_sgr(char *a, char *b) +{ + bool result = FALSE; + int csi_a = is_csi(a); + int csi_b = is_csi(b); + unsigned len_a; + unsigned len_b; + + TR(TRACE_DATABASE, ("similar_sgr:\n\t%s\n\t%s", + _nc_visbuf2(1, a), + _nc_visbuf2(2, b))); + if (csi_a != 0 && csi_b != 0 && csi_a == csi_b) { + a += csi_a; + b += csi_b; + if (*a != *b) { + a = skip_zero(a); + b = skip_zero(b); + } + } + len_a = strlen(a); + len_b = strlen(b); + if (len_a && len_b) { + if (len_a > len_b) + result = (strncmp(a, b, len_b) == 0); + else + result = (strncmp(a, b, len_a) == 0); + } + TR(TRACE_DATABASE, ("...similar_sgr: %d\n\t%s\n\t%s", result, + _nc_visbuf2(1, a), + _nc_visbuf2(2, b))); + return result; +} + +static unsigned +chop_out(char *string, unsigned i, unsigned j) +{ + TR(TRACE_DATABASE, ("chop_out %d..%d from %s", i, j, _nc_visbuf(string))); + while (string[j] != '\0') { + string[i++] = string[j++]; + } + string[i] = '\0'; + return i; +} + +/* + * Compare, ignoring delays. Some of the delay values are inconsistent, and + * we do not want to be stopped by that. + * + * Returns the number of chars from 'full' that we matched. If any mismatch + * occurs, return zero. + */ +static int +compare_part(const char *part, const char *full) +{ + const char *next_part; + const char *next_full; + int used_full = 0; + int used_delay = 0; + + while (*part != 0) { + if (*part != *full) { + used_full = 0; + break; + } + + /* + * Adjust the return-value to allow the rare case of + * stringstring + * to remove the whole piece. The most common case is a delay at the + * end of the string. The adjusted string will retain the delay, which + * is conservative. + */ + if (used_delay != 0) { + used_full += used_delay; + used_delay = 0; + } + if (*part == '$' && *full == '$') { + next_part = skip_delay(part); + next_full = skip_delay(full); + if (next_part != part && next_full != full) { + used_delay += (next_full - full); + full = next_full; + part = next_part; + continue; + } + } + ++used_full; + ++part; + ++full; + } + return used_full; +} + +/* + * While 'sgr0' is the "same" as termcap 'me', there is a compatibility issue. + * The sgr/sgr0 capabilities include setting/clearing alternate character set + * mode. A termcap application cannot use sgr, so sgr0 strings that reset + * alternate character set mode will be misinterpreted. Here, we remove those + * from the more common ISO/ANSI/VT100 entries, which have sgr0 agreeing with + * sgr. + * + * This function returns the modified sgr0 if it can be modified, a null if + * an error occurs, or the original sgr0 if no change is needed. + */ +NCURSES_EXPORT(char *) +_nc_trim_sgr0(TERMTYPE *tp) +{ + char *result = exit_attribute_mode; + + T((T_CALLED("_nc_trim_sgr0()"))); + + if (PRESENT(exit_attribute_mode) + && PRESENT(set_attributes)) { + bool found = FALSE; + char *on = set_attribute_9(tp, 1); + char *off = set_attribute_9(tp, 0); + char *end = strdup(exit_attribute_mode); + char *tmp; + size_t i, j, k; + + TR(TRACE_DATABASE, ("checking if we can trim sgr0 based on sgr")); + TR(TRACE_DATABASE, ("sgr0 %s", _nc_visbuf(end))); + TR(TRACE_DATABASE, ("sgr(9:off) %s", _nc_visbuf(off))); + TR(TRACE_DATABASE, ("sgr(9:on) %s", _nc_visbuf(on))); + + if (!rewrite_sgr(on, enter_alt_charset_mode) + || !rewrite_sgr(off, exit_alt_charset_mode) + || !rewrite_sgr(end, exit_alt_charset_mode)) { + FreeIfNeeded(on); + FreeIfNeeded(off); + FreeIfNeeded(end); + } else if (similar_sgr(off, end) + && !similar_sgr(off, on)) { + TR(TRACE_DATABASE, ("adjusting sgr(9:off) : %s", _nc_visbuf(off))); + result = off; + /* + * If rmacs is a substring of sgr(0), remove that chunk. + */ + if (exit_alt_charset_mode != 0) { + TR(TRACE_DATABASE, ("scan for rmacs %s", _nc_visbuf(exit_alt_charset_mode))); + j = strlen(off); + k = strlen(exit_alt_charset_mode); + if (j > k) { + for (i = 0; i <= (j - k); ++i) { + int k2 = compare_part(exit_alt_charset_mode, off + i); + if (k2 != 0) { + found = TRUE; + chop_out(off, i, i + k2); + break; + } + } + } + } + /* + * SGR 10 would reset to normal font. + */ + if (!found) { + if ((i = is_csi(off)) != 0 + && off[strlen(off) - 1] == 'm') { + TR(TRACE_DATABASE, ("looking for SGR 10 in %s", + _nc_visbuf(off))); + tmp = skip_zero(off + i); + if (tmp[0] == '1' + && skip_zero(tmp + 1) != tmp + 1) { + i = tmp - off; + if (off[i - 1] == ';') + i--; + j = skip_zero(tmp + 1) - off; + i = chop_out(off, i, j); + found = TRUE; + } + } + } + if (!found + && (tmp = strstr(end, off)) != 0 + && strcmp(end, off) != 0) { + i = tmp - end; + j = strlen(off); + tmp = strdup(end); + chop_out(tmp, i, j); + free(off); + result = tmp; + } + TR(TRACE_DATABASE, ("...adjusted sgr0 : %s", _nc_visbuf(result))); + if (!strcmp(result, exit_attribute_mode)) { + TR(TRACE_DATABASE, ("...same result, discard")); + free(result); + result = exit_attribute_mode; + } + } else { + /* + * Either the sgr does not reference alternate character set, + * or it is incorrect. That's too hard to decide right now. + */ + free(off); + } + free(end); + free(on); + } else { + /* + * Possibly some applications are confused if sgr0 contains rmacs, + * but that would be a different bug report -TD + */ + } + + returnPtr(result); +} diff --git a/ncurses/trace/lib_trace.c b/ncurses/trace/lib_trace.c index 8a5d7e6a..19e9e451 100644 --- a/ncurses/trace/lib_trace.c +++ b/ncurses/trace/lib_trace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -40,9 +41,9 @@ #include -MODULE_ID("$Id: lib_trace.c,v 1.53 2003/11/23 00:39:30 tom Exp $") +MODULE_ID("$Id: lib_trace.c,v 1.58 2005/04/16 16:15:24 tom Exp $") -NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */ +NCURSES_EXPORT_VAR(unsigned) _nc_tracing = 0; /* always define this */ #ifdef TRACE NCURSES_EXPORT_VAR(const char *) _nc_tputs_trace = ""; @@ -108,7 +109,7 @@ _tracef(const char *fmt,...) va_list ap; bool before = FALSE; bool after = FALSE; - int doit = _nc_tracing; + unsigned doit = _nc_tracing; int save_err = errno; if (strlen(fmt) >= sizeof(Called) - 1) { @@ -179,9 +180,33 @@ _nc_retrace_ptr(char *code) return code; } +/* Trace 'const char*' return-values */ +NCURSES_EXPORT(const char *) +_nc_retrace_cptr(const char *code) +{ + T((T_RETURN("%s"), _nc_visbuf(code))); + return code; +} + +/* Trace 'NCURSES_CONST void*' return-values */ +NCURSES_EXPORT(NCURSES_CONST void *) +_nc_retrace_cvoid_ptr(NCURSES_CONST void *code) +{ + T((T_RETURN("%p"), code)); + return code; +} + +/* Trace 'void*' return-values */ +NCURSES_EXPORT(void *) +_nc_retrace_void_ptr(void *code) +{ + T((T_RETURN("%p"), code)); + return code; +} + /* Trace 'SCREEN *' return-values */ NCURSES_EXPORT(SCREEN *) -_nc_retrace_sp(SCREEN * code) +_nc_retrace_sp(SCREEN *code) { T((T_RETURN("%p"), code)); return code; diff --git a/ncurses/trace/lib_traceatr.c b/ncurses/trace/lib_traceatr.c index a9c53c9f..a162c7be 100644 --- a/ncurses/trace/lib_traceatr.c +++ b/ncurses/trace/lib_traceatr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas Dickey 1996-2003 * + * Author: Thomas Dickey 1996-on * * and: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * ****************************************************************************/ @@ -39,15 +39,35 @@ #include #include /* acs_chars */ -MODULE_ID("$Id: lib_traceatr.c,v 1.48 2004/01/25 22:31:38 tom Exp $") +MODULE_ID("$Id: lib_traceatr.c,v 1.53 2005/08/20 20:21:20 tom Exp $") -#define COLOR_OF(c) (c < 0 || c > 7 ? "default" : colors[c].name) +#define COLOR_OF(c) ((c < 0) ? "default" : (c > 7 ? color_of(c) : colors[c].name)) #ifdef TRACE static const char l_brace[] = {L_BRACE, 0}; static const char r_brace[] = {R_BRACE, 0}; +#ifndef USE_TERMLIB +static char * +color_of(int c) +{ + static char buffer[2][80]; + static int sel; + static int last = -1; + + if (c != last) { + last = c; + sel = !sel; + if (c == COLOR_DEFAULT) + strcpy(buffer[sel], "default"); + else + sprintf(buffer[sel], "color%d", c); + } + return buffer[sel]; +} +#endif /* !USE_TERMLIB */ + NCURSES_EXPORT(char *) _traceattr2(int bufnum, attr_t newmode) { @@ -73,7 +93,9 @@ _traceattr2(int bufnum, attr_t newmode) { A_COLOR, "A_COLOR" }, /* *INDENT-ON* */ - }, + } +#ifndef USE_TERMLIB + , colors[] = { /* *INDENT-OFF* */ @@ -87,7 +109,9 @@ _traceattr2(int bufnum, attr_t newmode) { COLOR_WHITE, "COLOR_WHITE" }, /* *INDENT-ON* */ - }; + } +#endif /* !USE_TERMLIB */ + ; size_t n; unsigned save_nc_tracing = _nc_tracing; _nc_tracing = 0; @@ -102,6 +126,10 @@ _traceattr2(int bufnum, attr_t newmode) if (names[n].val == A_COLOR) { short pairnum = PAIR_NUMBER(newmode); +#ifdef USE_TERMLIB + /* pair_content lives in libncurses */ + (void) sprintf(temp, "{%d}", pairnum); +#else short fg, bg; if (pair_content(pairnum, &fg, &bg) == OK) { @@ -113,6 +141,7 @@ _traceattr2(int bufnum, attr_t newmode) } else { (void) sprintf(temp, "{%d}", pairnum); } +#endif buf = _nc_trace_bufcat(bufnum, temp); } } @@ -220,7 +249,7 @@ _tracechtype2(int bufnum, chtype ch) if ((found = _nc_altcharset_name(ChAttrOf(ch), ch)) != 0) { (void) _nc_trace_bufcat(bufnum, found); } else - (void) _nc_trace_bufcat(bufnum, _tracechar(ChCharOf(ch))); + (void) _nc_trace_bufcat(bufnum, _tracechar((int)ChCharOf(ch))); if (ChAttrOf(ch) != A_NORMAL) { (void) _nc_trace_bufcat(bufnum, " | "); @@ -259,8 +288,9 @@ _tracecchar_t2 (int bufnum, const cchar_t *ch) if ((found = _nc_altcharset_name(attr, CharOfD(ch))) != 0) { (void) _nc_trace_bufcat(bufnum, found); attr &= ~A_ALTCHARSET; - } else if (isnac(CHDEREF(ch))) { + } else if (isWidecExt(CHDEREF(ch))) { (void) _nc_trace_bufcat(bufnum, "{NAC}"); + attr &= ~A_CHARTEXT; } else { PUTC_DATA; int n; diff --git a/ncurses/trace/lib_tracechr.c b/ncurses/trace/lib_tracechr.c index 5ceeed2a..34a2bb61 100644 --- a/ncurses/trace/lib_tracechr.c +++ b/ncurses/trace/lib_tracechr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -38,21 +39,21 @@ #include -MODULE_ID("$Id: lib_tracechr.c,v 1.10 2003/06/14 11:05:42 tom Exp $") +MODULE_ID("$Id: lib_tracechr.c,v 1.12 2005/04/16 16:55:46 tom Exp $") #ifdef TRACE NCURSES_EXPORT(char *) _tracechar(int ch) { static char result[40]; - char *name; + NCURSES_CONST char *name; if (ch > KEY_MIN || ch < 0) { name = keyname(ch); if (name == 0 || *name == '\0') name = "NULL"; (void) sprintf(result, "'%.30s' = %#03o", name, ch); - } else if (!isprint(ch) || ch > 255) { + } else if (!is8bits(ch) || !isprint(UChar(ch))) { /* * workaround for glibc bug: * sprintf changes the result from unctrl() to an empty string if it @@ -60,7 +61,7 @@ _tracechar(int ch) */ (void) sprintf(result, "%#03o", ch); } else { - name = unctrl(ch); + name = unctrl((chtype) ch); if (name == 0 || *name == 0) name = "null"; /* shouldn't happen */ (void) sprintf(result, "'%.30s' = %#03o", name, ch); diff --git a/ncurses/trace/lib_tracedmp.c b/ncurses/trace/lib_tracedmp.c index c63cb564..b5d758bd 100644 --- a/ncurses/trace/lib_tracedmp.c +++ b/ncurses/trace/lib_tracedmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1996-2001 * + * Author: Thomas E. Dickey 1996-on * * and: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * ****************************************************************************/ @@ -39,7 +39,7 @@ #include #include -MODULE_ID("$Id: lib_tracedmp.c,v 1.25 2002/09/22 22:21:38 tom Exp $") +MODULE_ID("$Id: lib_tracedmp.c,v 1.26 2005/01/29 16:23:51 tom Exp $") #ifdef TRACE NCURSES_EXPORT(void) @@ -53,10 +53,13 @@ _tracedump(const char *name, WINDOW *win) /* compute narrowest possible display width */ for (width = i = 0; i <= win->_maxy; ++i) { n = 0; - for (j = 0; j <= win->_maxx; ++j) + for (j = 0; j <= win->_maxx; ++j) { if (CharOf(win->_line[i].text[j]) != L(' ') - || AttrOf(win->_line[i].text[j]) != A_NORMAL) + || AttrOf(win->_line[i].text[j]) != A_NORMAL + || GetPair(win->_line[i].text[j]) != 0) { n = j; + } + } if (n > width) width = n; @@ -99,15 +102,25 @@ _tracedump(const char *name, WINDOW *win) /* dump A_COLOR part, will screw up if there are more than 96 */ havecolors = FALSE; for (j = 0; j < width; ++j) - if (AttrOf(win->_line[n].text[j]) & A_COLOR) { + if (GetPair(win->_line[n].text[j]) != 0) { havecolors = TRUE; break; } if (havecolors) { ep = buf; - for (j = 0; j < width; ++j) - ep[j] = UChar(AttrOf(win->_line[n].text[j]) >> - NCURSES_ATTR_SHIFT) + ' '; + for (j = 0; j < width; ++j) { + int pair = GetPair(win->_line[n].text[j]); + if (pair >= 52) + ep[j] = '?'; + else if (pair >= 36) + ep[j] = pair + 'A'; + else if (pair >= 10) + ep[j] = pair + 'a'; + else if (pair >= 1) + ep[j] = pair + '0'; + else + ep[j] = ' '; + } ep[j] = '\0'; _tracef("%*s[%2d]%*s='%s'", (int) strlen(name), "colors", n, 8, " ", buf); diff --git a/ncurses/trace/lib_tracemse.c b/ncurses/trace/lib_tracemse.c index f4a100b6..98290a1e 100644 --- a/ncurses/trace/lib_tracemse.c +++ b/ncurses/trace/lib_tracemse.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000,2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -37,48 +38,81 @@ #include -MODULE_ID("$Id: lib_tracemse.c,v 1.10 2002/01/12 22:32:25 tom Exp $") +MODULE_ID("$Id: lib_tracemse.c,v 1.12 2005/06/11 19:53:50 tom Exp $") #ifdef TRACE NCURSES_EXPORT(char *) _tracemouse(MEVENT const *ep) { - static char buf[80]; + /* + * hmm - format is no longer than 80 columns, there are 5 numbers that + * could at most have 10 digits, and the mask contains no more than 32 bits + * with each bit representing less than 15 characters. Usually the whole + * string is less than 80 columns, but this buffer size is an absolute + * limit. + */ + static char buf[80 + (5 * 10) + (32 * 15)]; (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", - ep->id, ep->x, ep->y, ep->z, ep->bstate); + ep->id, + ep->x, + ep->y, + ep->z, + (unsigned long) ep->bstate); #define SHOW(m, s) if ((ep->bstate & m) == m) strcat(strcat(buf, s), ", ") + SHOW(BUTTON1_RELEASED, "release-1"); SHOW(BUTTON1_PRESSED, "press-1"); SHOW(BUTTON1_CLICKED, "click-1"); SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1"); SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1"); +#if NCURSES_MOUSE_VERSION == 1 SHOW(BUTTON1_RESERVED_EVENT, "reserved-1"); +#endif + SHOW(BUTTON2_RELEASED, "release-2"); SHOW(BUTTON2_PRESSED, "press-2"); SHOW(BUTTON2_CLICKED, "click-2"); SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2"); SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2"); +#if NCURSES_MOUSE_VERSION == 1 SHOW(BUTTON2_RESERVED_EVENT, "reserved-2"); +#endif + SHOW(BUTTON3_RELEASED, "release-3"); SHOW(BUTTON3_PRESSED, "press-3"); SHOW(BUTTON3_CLICKED, "click-3"); SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3"); SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3"); +#if NCURSES_MOUSE_VERSION == 1 SHOW(BUTTON3_RESERVED_EVENT, "reserved-3"); +#endif + SHOW(BUTTON4_RELEASED, "release-4"); SHOW(BUTTON4_PRESSED, "press-4"); SHOW(BUTTON4_CLICKED, "click-4"); SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4"); SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4"); +#if NCURSES_MOUSE_VERSION == 1 SHOW(BUTTON4_RESERVED_EVENT, "reserved-4"); +#endif + +#if NCURSES_MOUSE_VERSION == 2 + SHOW(BUTTON5_RELEASED, "release-5"); + SHOW(BUTTON5_PRESSED, "press-5"); + SHOW(BUTTON5_CLICKED, "click-5"); + SHOW(BUTTON5_DOUBLE_CLICKED, "doubleclick-5"); + SHOW(BUTTON5_TRIPLE_CLICKED, "tripleclick-5"); +#endif + SHOW(BUTTON_CTRL, "ctrl"); SHOW(BUTTON_SHIFT, "shift"); SHOW(BUTTON_ALT, "alt"); SHOW(ALL_MOUSE_EVENTS, "all-events"); SHOW(REPORT_MOUSE_POSITION, "position"); + #undef SHOW if (buf[strlen(buf) - 1] == ' ') diff --git a/ncurses/trace/visbuf.c b/ncurses/trace/visbuf.c index ed8f872e..6a836b40 100644 --- a/ncurses/trace/visbuf.c +++ b/ncurses/trace/visbuf.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2001-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 2001-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1996-2004 * + * Author: Thomas E. Dickey 1996-on * * and: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * ****************************************************************************/ @@ -41,7 +41,7 @@ #include #include -MODULE_ID("$Id: visbuf.c,v 1.9 2004/02/03 01:16:37 tom Exp $") +MODULE_ID("$Id: visbuf.c,v 1.14 2005/08/20 20:01:20 tom Exp $") static char * _nc_vischar(char *tp, unsigned c) @@ -68,7 +68,7 @@ _nc_vischar(char *tp, unsigned c) *tp++ = '^'; *tp++ = '@' + c; } else { - sprintf(tp, "\\%03lo", ChCharOf(c)); + sprintf(tp, "\\%03lo", (unsigned long) ChCharOf(c)); tp += strlen(tp); } *tp = 0; @@ -128,8 +128,22 @@ _nc_visbufn(const char *buf, int len) #if USE_WIDEC_SUPPORT #ifdef TRACE + +#if defined(USE_TERMLIB) +#define _nc_wchstrlen _my_wchstrlen +static int +_nc_wchstrlen(const cchar_t *s) +{ + int result = 0; + while (CharOf(s[result]) != L'\0') { + result++; + } + return result; +} +#endif + static const char * -_nc_viswbuf2n(int bufnum, const wchar_t * buf, int len) +_nc_viswbuf2n(int bufnum, const wchar_t *buf, int len) { char *vbuf; char *tp; @@ -168,25 +182,47 @@ _nc_viswbuf2n(int bufnum, const wchar_t * buf, int len) } NCURSES_EXPORT(const char *) -_nc_viswbuf2(int bufnum, const wchar_t * buf) +_nc_viswbuf2(int bufnum, const wchar_t *buf) { return _nc_viswbuf2n(bufnum, buf, -1); } NCURSES_EXPORT(const char *) -_nc_viswbuf(const wchar_t * buf) +_nc_viswbuf(const wchar_t *buf) { return _nc_viswbuf2(0, buf); } NCURSES_EXPORT(const char *) -_nc_viswbufn(const wchar_t * buf, int len) +_nc_viswbufn(const wchar_t *buf, int len) { return _nc_viswbuf2n(0, buf, len); } +/* this special case is used for wget_wstr() */ +NCURSES_EXPORT(const char *) +_nc_viswibuf(const wint_t *buf) +{ + static wchar_t *mybuf; + static unsigned mylen; + unsigned n; + + for (n = 0; buf[n] != 0; ++n) ; + if (mylen < ++n) { + mylen = n + 80; + if (mybuf != 0) + mybuf = typeRealloc(wchar_t, mylen, mybuf); + else + mybuf = typeMalloc(wchar_t, mylen); + } + for (n = 0; buf[n] != 0; ++n) + mybuf[n] = (wchar_t) buf[n]; + + return _nc_viswbuf2(0, mybuf); +} + NCURSES_EXPORT(const char *) -_nc_viscbuf2(int bufnum, const cchar_t * buf, int len) +_nc_viscbuf2(int bufnum, const cchar_t *buf, int len) { char *result = _nc_trace_buf(bufnum, BUFSIZ); int n; @@ -198,7 +234,7 @@ _nc_viscbuf2(int bufnum, const cchar_t * buf, int len) len = _nc_wchstrlen(buf); for (n = 1; n < len; n++) { - if (AttrOf(buf[n]) != AttrOf(buf[0])) { + if (!SameAttrOf(buf[n], buf[0])) { same = FALSE; break; } @@ -218,7 +254,7 @@ _nc_viscbuf2(int bufnum, const cchar_t * buf, int len) if ((found = _nc_altcharset_name(attr, CharOfD(buf))) != 0) { result = _nc_trace_bufcat(bufnum, found); attr &= ~A_ALTCHARSET; - } else if (!isnac(CHDEREF(buf))) { + } else if (!isWidecExt(CHDEREF(buf))) { PUTC_DATA; PUTC_INIT; @@ -260,7 +296,7 @@ _nc_viscbuf2(int bufnum, const cchar_t * buf, int len) } NCURSES_EXPORT(const char *) -_nc_viscbuf(const cchar_t * buf, int len) +_nc_viscbuf(const cchar_t *buf, int len) { return _nc_viscbuf2(0, buf, len); } diff --git a/ncurses/tty/MKexpanded.sh b/ncurses/tty/MKexpanded.sh index 8e4a6c6c..bf9acf21 100755 --- a/ncurses/tty/MKexpanded.sh +++ b/ncurses/tty/MKexpanded.sh @@ -1,6 +1,6 @@ #! /bin/sh ############################################################################## -# Copyright (c) 1998,2000 Free Software Foundation, Inc. # +# Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -29,7 +29,7 @@ # # Author: Thomas E. Dickey 1997 # -# $Id: MKexpanded.sh,v 1.10 2000/12/10 00:24:33 tom Exp $ +# $Id: MKexpanded.sh,v 1.11 2005/01/02 01:06:40 tom Exp $ # # Script to generate 'expanded.c', a dummy source that contains functions # corresponding to complex macros used in this library. By making functions, @@ -84,7 +84,7 @@ NCURSES_EXPORT(int) _nc_InsCharCost (int count) { return InsCharCost(count); } -NCURSES_EXPORT(void) _nc_UpdateAttrs (chtype c) +NCURSES_EXPORT(void) _nc_UpdateAttrs (NCURSES_CH_T c) { UpdateAttrs(c); } diff --git a/ncurses/tty/hashmap.c b/ncurses/tty/hashmap.c index ba53786a..d6087861 100644 --- a/ncurses/tty/hashmap.c +++ b/ncurses/tty/hashmap.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -70,7 +70,7 @@ AUTHOR #include #include /* for back_color_erase */ -MODULE_ID("$Id: hashmap.c,v 1.46 2002/09/07 18:13:15 tom Exp $") +MODULE_ID("$Id: hashmap.c,v 1.47 2005/01/29 21:27:58 tom Exp $") #ifdef HASHDEBUG @@ -143,7 +143,7 @@ update_cost_from_blank(NCURSES_CH_T * to) NCURSES_CH_T blank = NewChar2(BLANK_TEXT, BLANK_ATTR); if (back_color_erase) - AddAttr(blank, (AttrOf(stdscr->_nc_bkgd) & A_COLOR)); + SetPair(blank, GetPair(stdscr->_nc_bkgd)); for (i = TEXTWIDTH; i > 0; i--) if (!(CharEq(blank, *to++))) diff --git a/ncurses/tty/lib_mvcur.c b/ncurses/tty/lib_mvcur.c index 43ea8e51..bdc4b565 100644 --- a/ncurses/tty/lib_mvcur.c +++ b/ncurses/tty/lib_mvcur.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -154,7 +155,7 @@ #include #include -MODULE_ID("$Id: lib_mvcur.c,v 1.97 2003/12/27 16:43:59 tom Exp $") +MODULE_ID("$Id: lib_mvcur.c,v 1.103 2005/06/11 19:30:15 tom Exp $") #define WANT_CHAR(y, x) SP->_newscr->_line[y].text[x] /* desired state */ #define BAUDRATE cur_term->_baudrate /* bits per second */ @@ -589,9 +590,11 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int && n > 0 && n < (int) check.s_size && vcost == 0 - && str[0] == '\0' - && isdigit(CharOf(WANT_CHAR(to_y, from_x)))) - ovw = FALSE; + && str[0] == '\0') { + int wanted = CharOf(WANT_CHAR(to_y, from_x)); + if (is8bits(wanted) && isdigit(wanted)) + ovw = FALSE; + } #endif /* * If we have no attribute changes, overwrite is cheaper. @@ -606,7 +609,7 @@ relative_move(string_desc * target, int from_y, int from_x, int to_y, int for (i = 0; i < n; i++) { NCURSES_CH_T ch = WANT_CHAR(to_y, from_x + i); - if (AttrOf(ch) != SP->_current_attr + if (!SameAttrOf(ch, SCREEN_ATTRS(SP)) #if USE_WIDEC_SUPPORT || !Charable(ch) #endif @@ -845,7 +848,7 @@ NCURSES_EXPORT(int) mvcur(int yold, int xold, int ynew, int xnew) /* optimized cursor move from (yold, xold) to (ynew, xnew) */ { - attr_t oldattr; + NCURSES_CH_T oldattr; int code; TR(TRACE_CALLS | TRACE_MOVE, (T_CALLED("mvcur(%d,%d,%d,%d)"), @@ -872,12 +875,13 @@ mvcur(int yold, int xold, int ynew, int xnew) * character set -- these have a strong tendency to screw up the CR & * LF used for local character motions! */ - oldattr = SP->_current_attr; - if ((oldattr & A_ALTCHARSET) - || (oldattr && !move_standout_mode)) { + oldattr = SCREEN_ATTRS(SP); + if ((AttrOf(oldattr) & A_ALTCHARSET) + || (AttrOf(oldattr) && !move_standout_mode)) { TR(TRACE_CHARPUT, ("turning off (%#lx) %s before move", - oldattr, _traceattr(oldattr))); - (void) vidattr(A_NORMAL); + (unsigned long) AttrOf(oldattr), + _traceattr(AttrOf(oldattr)))); + (void) VIDATTR(A_NORMAL, 0); } if (xold >= screen_columns) { @@ -927,10 +931,11 @@ mvcur(int yold, int xold, int ynew, int xnew) /* * Restore attributes if we disabled them before moving. */ - if (oldattr != SP->_current_attr) { + if (!SameAttrOf(oldattr, SCREEN_ATTRS(SP))) { TR(TRACE_CHARPUT, ("turning on (%#lx) %s after move", - oldattr, _traceattr(oldattr))); - (void) vidattr(oldattr); + (unsigned long) AttrOf(oldattr), + _traceattr(AttrOf(oldattr)))); + (void) VIDATTR(AttrOf(oldattr), GetPair(oldattr)); } } returnCode(code); diff --git a/ncurses/tty/lib_twait.c b/ncurses/tty/lib_twait.c index 7402a103..2a3b7e2f 100644 --- a/ncurses/tty/lib_twait.c +++ b/ncurses/tty/lib_twait.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -61,7 +61,7 @@ # endif #endif -MODULE_ID("$Id: lib_twait.c,v 1.49 2003/11/30 00:34:36 Philippe.Blain Exp $") +MODULE_ID("$Id: lib_twait.c,v 1.50 2004/09/25 22:53:43 tom Exp $") static long _nc_gettime(bool first) @@ -226,7 +226,7 @@ _nc_timed_wait(int mode, } #endif - result = poll(fds, count, milliseconds); + result = poll(fds, (unsigned) count, milliseconds); #ifdef NCURSES_WGETCH_EVENTS if ((mode & 4) && evl) { diff --git a/ncurses/tty/lib_vidattr.c b/ncurses/tty/lib_vidattr.c index 00611f4e..afcc7971 100644 --- a/ncurses/tty/lib_vidattr.c +++ b/ncurses/tty/lib_vidattr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999,2000,2001 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996 on * ****************************************************************************/ /* @@ -64,7 +65,7 @@ #include #include -MODULE_ID("$Id: lib_vidattr.c,v 1.39 2001/08/26 00:40:46 Philippe.Blain Exp $") +MODULE_ID("$Id: lib_vidattr.c,v 1.44 2005/01/22 22:15:44 tom Exp $") #define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) @@ -87,8 +88,7 @@ MODULE_ID("$Id: lib_vidattr.c,v 1.39 2001/08/26 00:40:46 Philippe.Blain Exp $") } NCURSES_EXPORT(int) -vidputs -(chtype newmode, int (*outc) (int)) +vidputs(chtype newmode, int (*outc) (int)) { static attr_t previous_attr = A_NORMAL; attr_t turn_on, turn_off; @@ -105,7 +105,7 @@ vidputs /* this allows us to go on whether or not newterm() has been called */ if (SP) - previous_attr = SP->_current_attr; + previous_attr = AttrOf(SCREEN_ATTRS(SP)); TR(TRACE_ATTRS, ("previous attribute was %s", _traceattr(previous_attr))); @@ -177,7 +177,7 @@ vidputs TurnOff(A_STANDOUT, exit_standout_mode); } } - previous_attr &= ~A_COLOR; + previous_attr &= ALL_BUT_COLOR; } SetColorsIf((pair != 0) || fix_pair0, previous_attr); @@ -194,7 +194,7 @@ vidputs (newmode & A_INVIS) != 0, (newmode & A_PROTECT) != 0, (newmode & A_ALTCHARSET) != 0), 1, outc); - previous_attr &= ~A_COLOR; + previous_attr &= ALL_BUT_COLOR; } SetColorsIf((pair != 0) || fix_pair0, previous_attr); } else { @@ -213,8 +213,8 @@ vidputs if (turn_off && exit_attribute_mode) { doPut(exit_attribute_mode); - turn_on |= (newmode & (chtype) (~A_COLOR)); - previous_attr &= ~A_COLOR; + turn_on |= (newmode & ALL_BUT_COLOR); + previous_attr &= ALL_BUT_COLOR; } SetColorsIf((pair != 0) || fix_pair0, previous_attr); @@ -229,22 +229,12 @@ vidputs TurnOn(A_PROTECT, enter_protected_mode); TurnOn(A_INVIS, enter_secure_mode); TurnOn(A_UNDERLINE, enter_underline_mode); -#ifdef enter_horizontal_hl_mode +#if USE_WIDEC_SUPPORT TurnOn(A_HORIZONTAL, enter_horizontal_hl_mode); -#endif -#ifdef enter_left_hl_mode TurnOn(A_LEFT, enter_left_hl_mode); -#endif -#ifdef enter_low_hl_mode TurnOn(A_LOW, enter_low_hl_mode); -#endif -#ifdef enter_right_hl_mode TurnOn(A_RIGHT, enter_right_hl_mode); -#endif -#ifdef enter_top_hl_mode TurnOn(A_TOP, enter_top_hl_mode); -#endif -#ifdef enter_vertical_hl_mode TurnOn(A_VERTICAL, enter_vertical_hl_mode); #endif /* *INDENT-ON* */ @@ -255,7 +245,7 @@ vidputs newmode |= A_REVERSE; if (SP) - SP->_current_attr = newmode; + SetAttr(SCREEN_ATTRS(SP), newmode); else previous_attr = newmode; diff --git a/ncurses/tty/tty_display.h b/ncurses/tty/tty_display.h index 3322f747..4c45a084 100644 --- a/ncurses/tty/tty_display.h +++ b/ncurses/tty/tty_display.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -30,7 +30,7 @@ #define TTY_DISPLAY_H 1 /* - * $Id: tty_display.h,v 1.5 2003/08/02 22:59:07 Philippe.Blain Exp $ + * $Id: tty_display.h,v 1.6 2005/01/01 23:41:12 tom Exp $ */ extern NCURSES_EXPORT(bool) _nc_tty_beep (void); extern NCURSES_EXPORT(bool) _nc_tty_check_resize (void); @@ -118,7 +118,7 @@ struct tty_display_data { : INFINITY))) #if USE_XMC_SUPPORT -#define UpdateAttrs(c) if (D->_current_attr != AttrOf(c)) { \ +#define UpdateAttrs(c) if (!SameAttrOf(D->_current_attr, AttrOf(c))) { \ attr_t chg = D->_current_attr; \ vidattr(AttrOf(c)); \ if (magic_cookie_glitch > 0 \ @@ -131,7 +131,7 @@ struct tty_display_data { } \ } #else -#define UpdateAttrs(c) if (D->_current_attr != AttrOf(c)) \ +#define UpdateAttrs(c) if (!SameAttrOf(D->_current_attr, AttrOf(c))) \ vidattr(AttrOf(c)); #endif diff --git a/ncurses/tty/tty_update.c b/ncurses/tty/tty_update.c index 78dc78cd..408ebe3b 100644 --- a/ncurses/tty/tty_update.c +++ b/ncurses/tty/tty_update.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * - * and: Thomas E. Dickey 1996-2004 * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /*----------------------------------------------------------------- @@ -74,7 +74,7 @@ #include #include -MODULE_ID("$Id: tty_update.c,v 1.205 2004/02/07 18:02:42 tom Exp $") +MODULE_ID("$Id: tty_update.c,v 1.220 2005/08/13 17:12:32 tom Exp $") /* * This define controls the line-breakout optimization. Every once in a @@ -89,6 +89,8 @@ MODULE_ID("$Id: tty_update.c,v 1.205 2004/02/07 18:02:42 tom Exp $") #define FILL_BCE() (SP->_coloron && !SP->_default_color && !back_color_erase) +static const NCURSES_CH_T normal = NewChar2(BLANK_TEXT, BLANK_ATTR); + /* * Enable checking to see if doupdate and friends are tracking the true * cursor position correctly. NOTE: this is a debugging hack which will @@ -183,7 +185,7 @@ PutAttrChar(CARG_CH_T ch) NCURSES_CH_T my_ch; PUTC_DATA; NCURSES_CH_T tilde; - NCURSES_ATTR_T attr = AttrOfD(ch); + NCURSES_CH_T attr = CHDEREF(ch); TR(TRACE_CHARPUT, ("PutAttrChar(%s) at (%d, %d)", _tracech_t(ch), @@ -192,8 +194,10 @@ PutAttrChar(CARG_CH_T ch) /* * If this is not a valid character, there is nothing more to do. */ - if (isnac(CHDEREF(ch))) + if (isWidecExt(CHDEREF(ch))) { + TR(TRACE_CHARPUT, ("...skip")); return; + } /* * Determine the number of character cells which the 'ch' value will use * on the screen. It should be at least one. @@ -201,8 +205,9 @@ PutAttrChar(CARG_CH_T ch) if ((chlen = wcwidth(CharOf(CHDEREF(ch)))) <= 0) { static NCURSES_CH_T blank = NewChar(BLANK_TEXT); - if (isprint(CharOf(CHDEREF(ch))) - || (SP->_posix_locale && CharOf(CHDEREF(ch)) >= 160)) { + if (is8bits(CharOf(CHDEREF(ch))) + && (isprint(CharOf(CHDEREF(ch))) + || (SP->_legacy_coding && CharOf(CHDEREF(ch)) >= 160))) { ; } else { ch = CHREF(blank); @@ -212,7 +217,7 @@ PutAttrChar(CARG_CH_T ch) } #endif - if ((attr & A_ALTCHARSET) + if ((AttrOf(attr) & A_ALTCHARSET) && SP->_acs_map != 0 && CharOfD(ch) < ACS_LEN) { my_ch = CHDEREF(ch); /* work around const param */ @@ -224,21 +229,30 @@ PutAttrChar(CARG_CH_T ch) * normal one to be broken (by mis-design ;-). */ if (SP->_screen_acs_fix - && SP->_acs_map[CharOf(my_ch)] & A_ALTCHARSET) { - attr &= ~(A_ALTCHARSET); + && SP->_screen_acs_map[CharOf(my_ch)]) { + RemAttr(attr, A_ALTCHARSET); my_ch = _nc_wacs[CharOf(my_ch)]; } #endif - if (attr & A_ALTCHARSET) { - chtype temp = UChar(SP->_acs_map[CharOfD(ch)]); + /* + * If we (still) have alternate character set, it is the normal 8bit + * flavor. The _screen_acs_map[] array tells if the character was + * really in acs_chars, needed because of the way wide/normal line + * drawing flavors are integrated. + */ + if (AttrOf(attr) & A_ALTCHARSET) { + int j = CharOfD(ch); + chtype temp = UChar(SP->_acs_map[j]); + + if (!(SP->_screen_acs_map[j])) + RemAttr(attr, A_ALTCHARSET); if (temp != 0) - SetChar(my_ch, temp, attr); - RemAttr(my_ch, A_ALTCHARSET); + SetChar(my_ch, temp, AttrOf(attr)); } ch = CHREF(my_ch); } if (tilde_glitch && (CharOfD(ch) == L('~'))) { - SetChar(tilde, L('`'), attr); + SetChar(tilde, L('`'), AttrOf(attr)); ch = CHREF(tilde); } @@ -404,13 +418,15 @@ can_clear_with(ARG_CH_T ch) { if (!back_color_erase && SP->_coloron) { #if NCURSES_EXT_FUNCS + int pair; + if (!SP->_default_color) return FALSE; if (SP->_default_fg != C_MASK || SP->_default_bg != C_MASK) return FALSE; - if (AttrOfD(ch) & A_COLOR) { + if ((pair = GetPair(CHDEREF(ch))) != 0) { short fg, bg; - pair_content(PAIR_NUMBER(AttrOfD(ch)), &fg, &bg); + pair_content(pair, &fg, &bg); if (fg != C_MASK || bg != C_MASK) return FALSE; } @@ -471,7 +487,7 @@ EmitRange(const NCURSES_CH_T * ntext, int num) if (erase_chars && runcount > SP->_ech_cost + SP->_cup_ch_cost && can_clear_with(CHREF(ntext0))) { - UpdateAttrs(AttrOf(ntext0)); + UpdateAttrs(ntext0); putp(tparm(erase_chars, runcount)); /* @@ -491,7 +507,7 @@ EmitRange(const NCURSES_CH_T * ntext, int num) if (wrap_possible) rep_count--; - UpdateAttrs(AttrOf(ntext0)); + UpdateAttrs(ntext0); tputs(tparm(repeat_char, CharOf(ntext0), rep_count), rep_count, _nc_outch); SP->_curscol += rep_count; @@ -535,7 +551,7 @@ PutRange(const NCURSES_CH_T * otext, if (otext != ntext && (last - first + 1) > SP->_inline_cost) { for (j = first, same = 0; j <= last; j++) { - if (!same && isnac(otext[j])) + if (!same && isWidecExt(otext[j])) continue; if (CharEq(otext[j], ntext[j])) { same++; @@ -833,7 +849,7 @@ doupdate(void) * Keep the physical screen in normal mode in case we get other * processes writing to the screen. */ - UpdateAttrs(A_NORMAL); + UpdateAttrs(normal); _nc_flush(); curscr->_attrs = newscr->_attrs; @@ -928,7 +944,7 @@ ClrToEOL(NCURSES_CH_T blank, bool needclear) } if (needclear) { - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("clr_eol"); if (clr_eol && SP->_el_cost <= (screen_columns - SP->_curscol)) { putp(clr_eol); @@ -954,7 +970,7 @@ ClrToEOS(NCURSES_CH_T blank) row = SP->_cursrow; col = SP->_curscol; - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("clr_eos"); tputs(clr_eos, screen_lines - row, _nc_outch); @@ -1059,14 +1075,12 @@ TransformLine(int const lineno) int n; bool attrchanged = FALSE; - TR(TRACE_UPDATE, ("TransformLine(%d) called", lineno)); + TR(TRACE_UPDATE, (T_CALLED("TransformLine(%d)"), lineno)); /* copy new hash value to old one */ if (SP->oldhash && SP->newhash) SP->oldhash[lineno] = SP->newhash[lineno]; -#define ColorOf(n) (AttrOf(n) & A_COLOR) -#define unColor(n) (AttrOf(n) & ALL_BUT_COLOR) /* * If we have colors, there is the possibility of having two color pairs * that display as the same colors. For instance, Lynx does this. Check @@ -1074,24 +1088,19 @@ TransformLine(int const lineno) * they are equivalent. */ if (SP->_coloron) { - attr_t oldColor; - attr_t newColor; int oldPair; int newPair; for (n = 0; n < screen_columns; n++) { if (!CharEq(newLine[n], oldLine[n])) { - oldColor = ColorOf(oldLine[n]); - newColor = ColorOf(newLine[n]); - if (oldColor != newColor + oldPair = GetPair(oldLine[n]); + newPair = GetPair(newLine[n]); + if (oldPair != newPair && unColor(oldLine[n]) == unColor(newLine[n])) { - oldPair = PAIR_NUMBER(oldColor); - newPair = PAIR_NUMBER(newColor); if (oldPair < COLOR_PAIRS && newPair < COLOR_PAIRS && SP->_color_pairs[oldPair] == SP->_color_pairs[newPair]) { - RemAttr(oldLine[n], A_COLOR); - AddAttr(oldLine[n], ColorOf(newLine[n])); + SetPair(oldLine[n], GetPair(newLine[n])); } } } @@ -1101,7 +1110,7 @@ TransformLine(int const lineno) if (ceol_standout_glitch && clr_eol) { firstChar = 0; while (firstChar < screen_columns) { - if (AttrOf(newLine[firstChar]) != AttrOf(oldLine[firstChar])) { + if (!SameAttrOf(newLine[firstChar], oldLine[firstChar])) { attrchanged = TRUE; break; } @@ -1193,12 +1202,12 @@ TransformLine(int const lineno) if (nFirstChar >= screen_columns && SP->_el_cost <= SP->_el1_cost) { GoTo(lineno, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("clr_eol"); putp(clr_eol); } else { GoTo(lineno, nFirstChar - 1); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("clr_bol"); putp(clr_bol); } @@ -1214,8 +1223,10 @@ TransformLine(int const lineno) firstChar++; } /* if there wasn't one, we're done */ - if (firstChar >= screen_columns) + if (firstChar >= screen_columns) { + TR(TRACE_UPDATE, (T_RETURN(""))); return; + } blank = newLine[screen_columns - 1]; @@ -1234,6 +1245,7 @@ TransformLine(int const lineno) newLine + firstChar, (nLastChar - firstChar + 1) * sizeof(NCURSES_CH_T)); } + TR(TRACE_UPDATE, (T_RETURN(""))); return; } @@ -1273,7 +1285,7 @@ TransformLine(int const lineno) /* can be -1 if no characters differ */ while (CharEq(newLine[nLastChar], oldLine[oLastChar])) { /* don't split a wide char */ - if (isnac(newLine[nLastChar]) && + if (isWidecExt(newLine[nLastChar]) && !CharEq(newLine[nLastChar - 1], oldLine[oLastChar - 1])) break; nLastChar--; @@ -1290,9 +1302,15 @@ TransformLine(int const lineno) if (oLastChar < nLastChar) { int m = max(nLastNonblank, oLastNonblank); +#if USE_WIDEC_SUPPORT + while (isWidecExt(newLine[n + 1]) && n) { + --n; + --oLastChar; + } +#endif GoTo(lineno, n + 1); - if (InsCharCost(nLastChar - oLastChar) - > (m - n)) { + if ((nLastChar < nLastNonblank) + || InsCharCost(nLastChar - oLastChar) > (m - n)) { PutRange(oldLine, newLine, lineno, n + 1, m); } else { InsStr(&newLine[n + 1], nLastChar - oLastChar); @@ -1314,7 +1332,7 @@ TransformLine(int const lineno) * setting the video attributes from * the last character on the row. */ - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); DelChar(oLastChar - nLastChar); } } @@ -1326,6 +1344,8 @@ TransformLine(int const lineno) memcpy(oldLine + firstChar, newLine + firstChar, (screen_columns - firstChar) * sizeof(NCURSES_CH_T)); + TR(TRACE_UPDATE, (T_RETURN(""))); + return; } /* @@ -1346,7 +1366,7 @@ ClearScreen(NCURSES_CH_T blank) #if NCURSES_EXT_FUNCS if (SP->_coloron && !SP->_default_color) { - _nc_do_color((int) COLOR_PAIR(SP->_current_attr), 0, FALSE, _nc_outch); + _nc_do_color(GET_SCREEN_PAIR(SP), 0, FALSE, _nc_outch); if (!back_color_erase) { fast_clear = FALSE; } @@ -1355,7 +1375,7 @@ ClearScreen(NCURSES_CH_T blank) if (fast_clear) { if (clear_screen) { - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("clear_screen"); putp(clear_screen); SP->_cursrow = SP->_curscol = 0; @@ -1364,13 +1384,13 @@ ClearScreen(NCURSES_CH_T blank) SP->_cursrow = SP->_curscol = -1; GoTo(0, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("clr_eos"); tputs(clr_eos, screen_lines, _nc_outch); } else if (clr_eol) { SP->_cursrow = SP->_curscol = -1; - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); for (i = 0; i < screen_lines; i++) { GoTo(i, 0); TPUTS_TRACE("clr_eol"); @@ -1379,7 +1399,7 @@ ClearScreen(NCURSES_CH_T blank) GoTo(0, 0); } } else { - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); for (i = 0; i < screen_lines; i++) { GoTo(i, 0); for (j = 0; j < screen_columns; j++) @@ -1515,34 +1535,34 @@ scroll_csr_forward(int n, int top, int bot, int miny, int maxy, NCURSES_CH_T bla if (n == 1 && scroll_forward && top == miny && bot == maxy) { GoTo(bot, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("scroll_forward"); putp(scroll_forward); } else if (n == 1 && delete_line && bot == maxy) { GoTo(top, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("delete_line"); putp(delete_line); } else if (parm_index && top == miny && bot == maxy) { GoTo(bot, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("parm_index"); tputs(tparm(parm_index, n, 0), n, _nc_outch); } else if (parm_delete_line && bot == maxy) { GoTo(top, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("parm_delete_line"); tputs(tparm(parm_delete_line, n, 0), n, _nc_outch); } else if (scroll_forward && top == miny && bot == maxy) { GoTo(bot, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); for (i = 0; i < n; i++) { TPUTS_TRACE("scroll_forward"); putp(scroll_forward); } } else if (delete_line && bot == maxy) { GoTo(top, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); for (i = 0; i < n; i++) { TPUTS_TRACE("delete_line"); putp(delete_line); @@ -1573,34 +1593,34 @@ scroll_csr_backward(int n, int top, int bot, int miny, int maxy, if (n == 1 && scroll_reverse && top == miny && bot == maxy) { GoTo(top, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("scroll_reverse"); putp(scroll_reverse); } else if (n == 1 && insert_line && bot == maxy) { GoTo(top, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("insert_line"); putp(insert_line); } else if (parm_rindex && top == miny && bot == maxy) { GoTo(top, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("parm_rindex"); tputs(tparm(parm_rindex, n, 0), n, _nc_outch); } else if (parm_insert_line && bot == maxy) { GoTo(top, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); TPUTS_TRACE("parm_insert_line"); tputs(tparm(parm_insert_line, n, 0), n, _nc_outch); } else if (scroll_reverse && top == miny && bot == maxy) { GoTo(top, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); for (i = 0; i < n; i++) { TPUTS_TRACE("scroll_reverse"); putp(scroll_reverse); } } else if (insert_line && bot == maxy) { GoTo(top, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); for (i = 0; i < n; i++) { TPUTS_TRACE("insert_line"); putp(insert_line); @@ -1632,7 +1652,7 @@ scroll_idl(int n, int del, int ins, NCURSES_CH_T blank) return ERR; GoTo(del, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); if (n == 1 && delete_line) { TPUTS_TRACE("delete_line"); putp(delete_line); @@ -1647,7 +1667,7 @@ scroll_idl(int n, int del, int ins, NCURSES_CH_T blank) } GoTo(ins, 0); - UpdateAttrs(AttrOf(blank)); + UpdateAttrs(blank); if (n == 1 && insert_line) { TPUTS_TRACE("insert_line"); putp(insert_line); @@ -1800,7 +1820,7 @@ NCURSES_EXPORT(void) _nc_screen_resume(void) { /* make sure terminal is in a sane known state */ - SP->_current_attr = A_NORMAL; + SetAttr(SCREEN_ATTRS(SP), A_NORMAL); newscr->_clear = TRUE; /* reset color pairs and definitions */ @@ -1848,7 +1868,7 @@ _nc_screen_init(void) NCURSES_EXPORT(void) _nc_screen_wrap(void) { - UpdateAttrs(A_NORMAL); + UpdateAttrs(normal); #if NCURSES_EXT_FUNCS if (SP->_coloron && !SP->_default_color) { @@ -1871,7 +1891,7 @@ _nc_screen_wrap(void) NCURSES_EXPORT(void) _nc_do_xmc_glitch(attr_t previous) { - attr_t chg = XMC_CHANGES(previous ^ SP->_current_attr); + attr_t chg = XMC_CHANGES(previous ^ AttrOf(SCREEN_ATTRS(SP))); while (chg != 0) { if (chg & 1) { diff --git a/ncurses/widechar/charable.c b/ncurses/widechar/charable.c index 7e7dfe67..cf724078 100644 --- a/ncurses/widechar/charable.c +++ b/ncurses/widechar/charable.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2003 Free Software Foundation, Inc. * + * Copyright (c) 2003-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -32,13 +32,13 @@ #include -MODULE_ID("$Id: charable.c,v 1.2 2003/07/05 18:04:08 tom Exp $") +MODULE_ID("$Id: charable.c,v 1.4 2005/04/16 18:08:56 tom Exp $") NCURSES_EXPORT(bool) _nc_is_charable(wchar_t ch) { bool result; #if HAVE_WCTOB - result = (wctob(ch) == ch); + result = (wctob((wint_t) ch) == ch); #else result = (_nc_to_char(ch) >= 0); #endif @@ -67,10 +67,13 @@ NCURSES_EXPORT(wint_t) _nc_to_widechar(int ch) #if HAVE_BTOWC result = btowc(ch); #elif HAVE_MBTOWC + wchar_t convert; char temp[2]; temp[0] = ch; temp[1] = '\0'; - if (mbtowc((wchar_t *) (&result), temp, 1) != 1) + if (mbtowc(&convert, temp, 1) >= 0) + result = convert; + else result = WEOF; #endif return result; diff --git a/ncurses/widechar/lib_add_wch.c b/ncurses/widechar/lib_add_wch.c index 8d4346ef..29dc5eb1 100644 --- a/ncurses/widechar/lib_add_wch.c +++ b/ncurses/widechar/lib_add_wch.c @@ -35,7 +35,7 @@ #include -MODULE_ID("$Id: lib_add_wch.c,v 1.2 2004/02/07 17:53:33 tom Exp $") +MODULE_ID("$Id: lib_add_wch.c,v 1.4 2004/09/19 00:33:51 tom Exp $") NCURSES_EXPORT(int) wadd_wch(WINDOW *win, const cchar_t * wch) @@ -54,12 +54,12 @@ wadd_wch(WINDOW *win, const cchar_t * wch) break; if ((PUTC_n = wcrtomb(PUTC_buf, PUTC_ch, &PUT_st)) <= 0) { code = ERR; - if (PUTC_ch < 256) - code = waddch(win, UChar(PUTC_ch)); + if (is8bits(PUTC_ch)) + code = waddch(win, UChar(PUTC_ch) | wch->attr); break; } for (n = 0; n < PUTC_n; n++) { - if ((code = waddch(win, UChar(PUTC_buf[n]))) == ERR) { + if ((code = waddch(win, UChar(PUTC_buf[n]) | wch->attr)) == ERR) { break; } } @@ -89,12 +89,12 @@ wecho_wchar(WINDOW *win, const cchar_t * wch) break; if ((PUTC_n = wcrtomb(PUTC_buf, PUTC_ch, &PUT_st)) <= 0) { code = ERR; - if (PUTC_ch < 256) - code = waddch(win, UChar(PUTC_ch)); + if (is8bits(PUTC_ch)) + code = waddch(win, UChar(PUTC_ch) | wch->attr); break; } for (n = 0; n < PUTC_n; n++) { - if ((code = waddch(win, UChar(PUTC_buf[n]))) == ERR) { + if ((code = waddch(win, UChar(PUTC_buf[n]) | wch->attr)) == ERR) { break; } } diff --git a/ncurses/widechar/lib_cchar.c b/ncurses/widechar/lib_cchar.c index 75dbf4a5..b6458ee4 100644 --- a/ncurses/widechar/lib_cchar.c +++ b/ncurses/widechar/lib_cchar.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2001-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 2001-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,17 +35,20 @@ #include -MODULE_ID("$Id: lib_cchar.c,v 1.8 2003/05/25 00:07:41 tom Exp $") +MODULE_ID("$Id: lib_cchar.c,v 1.11 2005/01/29 21:29:16 tom Exp $") /* * The SuSv2 description leaves some room for interpretation. We'll assume wch - * is L'\0' terminated, contains at most one character with strictly positive - * width, which must be the first, and contains no characters of negative - * width. + * points to a string which is L'\0' terminated, contains at least one + * character with strictly positive width, which must be the first, and + * contains no characters of negative width. */ NCURSES_EXPORT(int) -setcchar(cchar_t * wcval, const wchar_t * wch, const attr_t attrs, - short color_pair, const void *opts) +setcchar(cchar_t *wcval, + const wchar_t *wch, + const attr_t attrs, + short color_pair, + const void *opts) { int i; int len; @@ -54,10 +57,13 @@ setcchar(cchar_t * wcval, const wchar_t * wch, const attr_t attrs, TR(TRACE_CCALLS, (T_CALLED("setcchar(%p,%s,%ld,%d,%p)"), wcval, _nc_viswbuf(wch), attrs, color_pair, opts)); - if (opts != NULL || (len = wcslen(wch)) > CCHARW_MAX + len = wcslen(wch); + if (opts != NULL || (len > 1 && wcwidth(wch[0]) < 0)) { code = ERR; } else { + if (len > CCHARW_MAX) + len = CCHARW_MAX; /* * If we have a following spacing-character, stop at that point. We @@ -73,7 +79,8 @@ setcchar(cchar_t * wcval, const wchar_t * wch, const attr_t attrs, memset(wcval, 0, sizeof(*wcval)); if (len != 0) { - SetAttr(*wcval, attrs | color_pair); + SetAttr(*wcval, attrs | COLOR_PAIR(color_pair)); + SetPair(CHDEREF(wcval), color_pair); memcpy(&wcval->chars, wch, len * sizeof(wchar_t)); TR(TRACE_CCALLS, ("copy %d wchars, first is %s", len, _tracecchar_t(wcval))); @@ -85,8 +92,11 @@ setcchar(cchar_t * wcval, const wchar_t * wch, const attr_t attrs, } NCURSES_EXPORT(int) -getcchar(const cchar_t * wcval, wchar_t * wch, attr_t * attrs, - short *color_pair, void *opts) +getcchar(const cchar_t *wcval, + wchar_t *wch, + attr_t *attrs, + short *color_pair, + void *opts) { wchar_t *wp; int len; @@ -105,8 +115,8 @@ getcchar(const cchar_t * wcval, wchar_t * wch, attr_t * attrs, } else if (attrs == 0 || color_pair == 0) { code = ERR; } else if (len >= 0) { - *attrs = AttrOf(*wcval); - *color_pair = AttrOf(*wcval) & A_COLOR; + *attrs = AttrOf(*wcval) & A_ATTRIBUTES; + *color_pair = GetPair(*wcval); wmemcpy(wch, wcval->chars, (unsigned) len); wch[len] = L'\0'; code = OK; diff --git a/ncurses/widechar/lib_get_wch.c b/ncurses/widechar/lib_get_wch.c index 24300f6e..68127e92 100644 --- a/ncurses/widechar/lib_get_wch.c +++ b/ncurses/widechar/lib_get_wch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002,2004 Free Software Foundation, Inc. * + * Copyright (c) 2002-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 2002,2004 * + * Author: Thomas E. Dickey 2002-on * ****************************************************************************/ /* @@ -38,36 +38,39 @@ */ #include +#include -MODULE_ID("$Id: lib_get_wch.c,v 1.6 2004/01/18 01:18:17 tom Exp $") +MODULE_ID("$Id: lib_get_wch.c,v 1.12 2005/08/13 18:51:43 tom Exp $") #if HAVE_MBTOWC && HAVE_MBLEN #define reset_mbytes(state) mblen(NULL, 0), mbtowc(NULL, NULL, 0) #define count_mbytes(buffer,length,state) mblen(buffer,length) #define check_mbytes(wch,buffer,length,state) \ - (int) mbtowc(&wch, buffer, count) + (int) mbtowc(&wch, buffer, length) +#define state_unused #elif HAVE_MBRTOWC && HAVE_MBRLEN -#define reset_mbytes(state) memset(&state, 0, sizeof(state)) +#define reset_mbytes(state) init_mb(state) #define count_mbytes(buffer,length,state) mbrlen(buffer,length,&state) #define check_mbytes(wch,buffer,length,state) \ - (int) mbrtowc(&wch, buffer, count, &state) + (int) mbrtowc(&wch, buffer, length, &state) #else make an error #endif NCURSES_EXPORT(int) -wget_wch(WINDOW *win, wint_t * result) +wget_wch(WINDOW *win, wint_t *result) { int code; char buffer[(MB_LEN_MAX * 9) + 1]; /* allow some redundant shifts */ int status; - mbstate_t state; size_t count = 0; unsigned long value; wchar_t wch; +#ifndef state_unused + mbstate_t state; +#endif T((T_CALLED("wget_wch(%p)"), win)); - (void) state; /* * We can get a stream of single-byte characters and KEY_xxx codes from @@ -87,12 +90,12 @@ wget_wch(WINDOW *win, wint_t * result) * would be worth the effort. */ if (count != 0) { - ungetch(value); + ungetch((int) value); code = ERR; } break; } else if (count + 1 >= sizeof(buffer)) { - ungetch(value); + ungetch((int) value); code = ERR; break; } else { @@ -103,6 +106,7 @@ wget_wch(WINDOW *win, wint_t * result) reset_mbytes(state); if (check_mbytes(wch, buffer, count, state) != status) { code = ERR; /* the two calls should match */ + ungetch((int) value); } value = wch; break; diff --git a/ncurses/widechar/lib_get_wstr.c b/ncurses/widechar/lib_get_wstr.c index 906e02a6..bf39aa1a 100644 --- a/ncurses/widechar/lib_get_wstr.c +++ b/ncurses/widechar/lib_get_wstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 2002-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 2002 * + * Author: Thomas E. Dickey * ****************************************************************************/ /* @@ -40,23 +40,38 @@ #include #include -MODULE_ID("$Id: lib_get_wstr.c,v 1.6 2003/05/17 21:33:03 tom Exp $") +MODULE_ID("$Id: lib_get_wstr.c,v 1.8 2004/10/16 21:55:36 tom Exp $") + +static int +wadd_wint(WINDOW *win, wint_t *src) +{ + cchar_t tmp; + wchar_t wch[2]; + + wch[0] = *src; + wch[1] = 0; + setcchar(&tmp, wch, A_NORMAL, 0, NULL); + return wadd_wch(win, &tmp); +} /* * This wipes out the last character, no matter whether it was a tab, control * or other character, and handles reverse wraparound. */ -static wchar_t * -WipeOut(WINDOW *win, int y, int x, wchar_t * first, wchar_t * last, bool echoed) +static wint_t * +WipeOut(WINDOW *win, int y, int x, wint_t *first, wint_t *last, bool echoed) { if (last > first) { *--last = '\0'; if (echoed) { int y1 = win->_cury; int x1 = win->_curx; + int n; wmove(win, y, x); - waddwstr(win, first); + for (n = 0; first[n] != 0; ++n) { + wadd_wint(win, first + n); + } getyx(win, y, x); while (win->_cury < y1 || (win->_cury == y1 && win->_curx < x1)) @@ -69,14 +84,14 @@ WipeOut(WINDOW *win, int y, int x, wchar_t * first, wchar_t * last, bool echoed) } NCURSES_EXPORT(int) -wgetn_wstr(WINDOW *win, wint_t * str, int maxlen) +wgetn_wstr(WINDOW *win, wint_t *str, int maxlen) { TTY buf; bool oldnl, oldecho, oldraw, oldcbreak; wint_t erasec; wint_t killc; - wchar_t *oldstr; - wchar_t *tmpstr; + wint_t *oldstr = str; + wint_t *tmpstr = str; wint_t ch; int y, x, code; @@ -99,10 +114,6 @@ wgetn_wstr(WINDOW *win, wint_t * str, int maxlen) erasec = erasechar(); killc = killchar(); - assert(sizeof(wchar_t) == sizeof(wint_t)); - oldstr = (wchar_t *) str; - tmpstr = (wchar_t *) str; - getyx(win, y, x); if (is_wintouched(win) || (win->_flags & _HASMOVED)) @@ -160,10 +171,8 @@ wgetn_wstr(WINDOW *win, wint_t * str, int maxlen) *tmpstr = 0; if (oldecho == TRUE) { int oldy = win->_cury; - cchar_t tmp; - setcchar(&tmp, tmpstr - 1, A_NORMAL, 0, NULL); - if (wadd_wch(win, &tmp) == ERR) { + if (wadd_wint(win, tmpstr - 1) == ERR) { /* * We can't really use the lower-right corner for input, * since it'll mess up bookkeeping for erases. @@ -210,13 +219,13 @@ wgetn_wstr(WINDOW *win, wint_t * str, int maxlen) *tmpstr = 0; if (code == ERR) { if (tmpstr == oldstr) { - *tmpstr++ = (wchar_t) WEOF; + *tmpstr++ = WEOF; *tmpstr = 0; } returnCode(ERR); } - T(("wgetn_wstr returns %s", _nc_viswbuf(oldstr))); + T(("wgetn_wstr returns %s", _nc_viswibuf(oldstr))); returnCode(OK); } diff --git a/ncurses/widechar/lib_in_wch.c b/ncurses/widechar/lib_in_wch.c index 5e110cb6..39af409d 100644 --- a/ncurses/widechar/lib_in_wch.c +++ b/ncurses/widechar/lib_in_wch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002 Free Software Foundation, Inc. * + * Copyright (c) 2002,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas Dickey 2002 * + * Author: Thomas Dickey 2002,2004 * ****************************************************************************/ /* @@ -39,7 +39,7 @@ #include -MODULE_ID("$Id: lib_in_wch.c,v 1.2 2002/08/03 20:23:29 tom Exp $") +MODULE_ID("$Id: lib_in_wch.c,v 1.3 2004/05/16 00:13:52 tom Exp $") NCURSES_EXPORT(int) win_wch(WINDOW *win, cchar_t * wcval) @@ -56,5 +56,6 @@ win_wch(WINDOW *win, cchar_t * wcval) } else { code = ERR; } - returnCode(code); + TR(TRACE_CCALLS, (T_RETURN("%d"), code)); + return (code); } diff --git a/ncurses/widechar/lib_in_wchnstr.c b/ncurses/widechar/lib_in_wchnstr.c index a757e727..41ba18cc 100644 --- a/ncurses/widechar/lib_in_wchnstr.c +++ b/ncurses/widechar/lib_in_wchnstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002 Free Software Foundation, Inc. * + * Copyright (c) 2002,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas Dickey 2002 * + * Author: Thomas Dickey 2002,2004 * ****************************************************************************/ /* @@ -39,22 +39,28 @@ #include -MODULE_ID("$Id: lib_in_wchnstr.c,v 1.2 2002/08/03 20:38:45 tom Exp $") +MODULE_ID("$Id: lib_in_wchnstr.c,v 1.3 2004/05/16 00:12:30 tom Exp $") NCURSES_EXPORT(int) win_wchnstr(WINDOW *win, cchar_t * wchstr, int n) { int code = OK; - TR(TRACE_CCALLS, (T_CALLED("win_wchnstr(%p,%p,%d)"), win, wchstr, n)); + TR(TRACE_CALLS, (T_CALLED("win_wchnstr(%p,%p,%d)"), win, wchstr, n)); if (win != 0 && wchstr != 0) { + int row, col; + int j; + + getyx(win, row, col); if (n < 0) { n = getmaxx(win) + 1 - getcurx(win); } - while (n-- > 0) - win_wch(win, wchstr++); + for (j = 0; j < n; ++j) { + wchstr[j] = win->_line[row].text[col + j]; + } + T(("result = %s", _nc_viscbuf(wchstr, n))); } else { code = ERR; } diff --git a/ncurses/widechar/lib_ins_wch.c b/ncurses/widechar/lib_ins_wch.c index 6417eea2..7bc7ac8c 100644 --- a/ncurses/widechar/lib_ins_wch.c +++ b/ncurses/widechar/lib_ins_wch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 2002-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -39,33 +39,43 @@ #include -MODULE_ID("$Id: lib_ins_wch.c,v 1.3 2003/03/29 21:52:29 tom Exp $") +MODULE_ID("$Id: lib_ins_wch.c,v 1.7 2005/09/17 19:25:13 tom Exp $") /* * Insert the given character, updating the current location to simplify * inserting a string. */ -static void -_nc_insert_wch(WINDOW *win, const cchar_t * wch) +static int +_nc_insert_wch(WINDOW *win, const cchar_t *wch) { + int cells = wcwidth(CharOf(CHDEREF(wch))); + int cell; + + if (cells <= 0) + cells = 1; + if (win->_curx <= win->_maxx) { struct ldat *line = &(win->_line[win->_cury]); NCURSES_CH_T *end = &(line->text[win->_curx]); NCURSES_CH_T *temp1 = &(line->text[win->_maxx]); - NCURSES_CH_T *temp2 = temp1 - 1; + NCURSES_CH_T *temp2 = temp1 - cells; CHANGED_TO_EOL(line, win->_curx, win->_maxx); while (temp1 > end) *temp1-- = *temp2--; *temp1 = _nc_render(win, *wch); + for (cell = 1; cell < cells; ++cell) { + SetWidecExt(temp1[cell], cell); + } win->_curx++; } + return OK; } NCURSES_EXPORT(int) -wins_wch(WINDOW *win, const cchar_t * wch) +wins_wch(WINDOW *win, const cchar_t *wch) { NCURSES_SIZE_T oy; NCURSES_SIZE_T ox; @@ -77,18 +87,17 @@ wins_wch(WINDOW *win, const cchar_t * wch) oy = win->_cury; ox = win->_curx; - _nc_insert_wch(win, wch); + code = _nc_insert_wch(win, wch); win->_curx = ox; win->_cury = oy; _nc_synchook(win); - code = OK; } returnCode(code); } NCURSES_EXPORT(int) -wins_nwstr(WINDOW *win, const wchar_t * wstr, int n) +wins_nwstr(WINDOW *win, const wchar_t *wstr, int n) { int code = ERR; NCURSES_SIZE_T oy; @@ -101,11 +110,14 @@ wins_nwstr(WINDOW *win, const wchar_t * wstr, int n) && wstr != 0) { if (n < 1) n = wcslen(wstr); + code = OK; if (n > 0) { oy = win->_cury; ox = win->_curx; for (cp = wstr; *cp && ((cp - wstr) < n); cp++) { - if (wcwidth(*cp) > 1) { + int len = wcwidth(*cp); + + if (len != 1) { cchar_t tmp_cchar; wchar_t tmp_wchar = *cp; memset(&tmp_cchar, 0, sizeof(tmp_cchar)); @@ -114,17 +126,19 @@ wins_nwstr(WINDOW *win, const wchar_t * wstr, int n) WA_NORMAL, 0, (void *) 0); - _nc_insert_wch(win, &tmp_cchar); + code = _nc_insert_wch(win, &tmp_cchar); } else { - _nc_insert_ch(win, *cp); /* tabs, other ASCII stuff */ + /* tabs, other ASCII stuff */ + code = _nc_insert_ch(win, (chtype) (*cp)); } + if (code != OK) + break; } win->_curx = ox; win->_cury = oy; _nc_synchook(win); } - code = OK; } returnCode(code); } diff --git a/ncurses/widechar/lib_inwstr.c b/ncurses/widechar/lib_inwstr.c index 91b1e0f1..2207a5f5 100644 --- a/ncurses/widechar/lib_inwstr.c +++ b/ncurses/widechar/lib_inwstr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002 Free Software Foundation, Inc. * + * Copyright (c) 2002,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas Dickey 2002 * + * Author: Thomas Dickey * ****************************************************************************/ /* @@ -39,10 +39,10 @@ #include -MODULE_ID("$Id: lib_inwstr.c,v 1.3 2002/10/06 00:56:36 tom Exp $") +MODULE_ID("$Id: lib_inwstr.c,v 1.4 2004/10/23 20:41:28 tom Exp $") NCURSES_EXPORT(int) -winnwstr(WINDOW *win, wchar_t * wstr, int n) +winnwstr(WINDOW *win, wchar_t *wstr, int n) { int row, col, inx; int count = 0; @@ -57,7 +57,7 @@ winnwstr(WINDOW *win, wchar_t * wstr, int n) text = win->_line[row].text; while (count < n && count != ERR) { - if (!isnac(text[col])) { + if (!isWidecExt(text[col])) { for (inx = 0; (inx < CCHARW_MAX) && ((wch = text[col].chars[inx]) != 0); ++inx) { @@ -90,7 +90,7 @@ winnwstr(WINDOW *win, wchar_t * wstr, int n) * it does not define what happens for a negative count with winnwstr(). */ NCURSES_EXPORT(int) -winwstr(WINDOW *win, wchar_t * wstr) +winwstr(WINDOW *win, wchar_t *wstr) { int result = OK; T((T_CALLED("winwstr(%p,%p)"), win, wstr)); diff --git a/ncurses/widechar/lib_slk_wset.c b/ncurses/widechar/lib_slk_wset.c index cda5eae3..646b5d9e 100644 --- a/ncurses/widechar/lib_slk_wset.c +++ b/ncurses/widechar/lib_slk_wset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 2003-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey, 2003 * + * Author: Thomas E. Dickey * ****************************************************************************/ /* @@ -36,114 +36,37 @@ */ #include -#ifdef HAVE_WCTYPE_H +#if HAVE_WCTYPE_H #include #endif -MODULE_ID("$Id: lib_slk_wset.c,v 1.6 2004/01/03 21:14:03 tom Exp $") +MODULE_ID("$Id: lib_slk_wset.c,v 1.11 2005/01/16 01:03:53 tom Exp $") NCURSES_EXPORT(int) -slk_wset(int i, const wchar_t * astr, int format) +slk_wset(int i, const wchar_t *astr, int format) { - static wchar_t empty[] = - {L'\0'}; int result = ERR; - SLK *slk = SP->_slk; - int offset; size_t arglen; - const wchar_t *p; + const wchar_t *str; + char *mystr; + mbstate_t state; T((T_CALLED("slk_wset(%d, %s, %d)"), i, _nc_viswbuf(astr), format)); - if (astr == 0) - astr = empty; - arglen = wcslen(astr); - while (iswspace(*astr)) { - --arglen; - ++astr; /* skip over leading spaces */ - } - p = astr; - while (iswprint(*p)) - p++; /* The first non-print stops */ - - arglen = (size_t) (p - astr); - - if (slk != NULL && - i >= 1 && - i <= slk->labcnt && - format >= 0 && - format <= 2) { - char *new_text; - size_t n; - size_t used = 0; - int mycols; - mbstate_t state; - - --i; /* Adjust numbering of labels */ - - /* - * Reduce the actual number of columns to fit in the label field. - */ - while (arglen != 0 && wcswidth(astr, arglen) > slk->maxlen) { - --arglen; - } - mycols = wcswidth(astr, arglen); - - /* - * translate the wide-character string to multibyte form. - */ - memset(&state, 0, sizeof(state)); - - if ((new_text = (char *) _nc_doalloc(0, MB_LEN_MAX * arglen)) == 0) - returnCode(ERR); - - for (n = 0; n < arglen; ++n) { - used += wcrtomb(new_text + used, astr[n], &state); - } - new_text[used] = '\0'; - - if (used >= (size_t) (slk->maxlen + 1)) { - if ((slk->ent[i].ent_text = (char *) _nc_doalloc(slk->ent[i].ent_text, - used + 1)) == 0) - returnCode(ERR); - if ((slk->ent[i].form_text = (char *) _nc_doalloc(slk->ent[i].form_text, - used + 1)) == 0) - returnCode(ERR); - } - - (void) strcpy(slk->ent[i].ent_text, new_text); - free(new_text); - - sprintf(slk->ent[i].form_text, "%*s", (size_t) slk->maxlen, " "); - - switch (format) { - default: - case 0: /* left-aligned */ - offset = 0; - break; - case 1: /* centered */ - offset = (slk->maxlen - mycols) / 2; - break; - case 2: /* right-aligned */ - offset = slk->maxlen - mycols; - break; - } - if (offset < 0) - offset = 0; - strcpy(slk->ent[i].form_text + offset, - slk->ent[i].ent_text); - /* - * Pad the display with blanks on the right, unless it is already - * right-aligned. - */ - if (format != 2 && mycols < slk->maxlen) { - sprintf(slk->ent[i].form_text + offset + used, - "%*s", - slk->maxlen - (mycols - offset), - " "); + init_mb(state); + str = astr; + if ((arglen = wcsrtombs(NULL, &str, 0, &state)) != (size_t) -1) { + if ((mystr = (char *) _nc_doalloc(0, arglen + 1)) != 0) { + str = astr; + if (wcsrtombs(mystr, &str, arglen, &state) != (size_t) -1) { + /* glibc documentation claims that the terminating L'\0' + * is written, but it is not... + */ + mystr[arglen] = 0; + result = slk_set(i, mystr, format); + } + free(mystr); } - slk->ent[i].dirty = TRUE; - result = OK; } returnCode(result); } diff --git a/ncurses/widechar/lib_unget_wch.c b/ncurses/widechar/lib_unget_wch.c index f4d0c518..62ec89d7 100644 --- a/ncurses/widechar/lib_unget_wch.c +++ b/ncurses/widechar/lib_unget_wch.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 2002-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -39,7 +39,26 @@ #include -MODULE_ID("$Id: lib_unget_wch.c,v 1.5 2003/07/05 19:46:51 tom Exp $") +MODULE_ID("$Id: lib_unget_wch.c,v 1.7 2004/12/05 01:21:31 tom Exp $") + +#ifdef linux +/* + * glibc's wcrtomb() function is broken - does not return the proper value + * when target is null (noted for glibc 2.3.2). This is a workaround. + */ +NCURSES_EXPORT(size_t) +_nc_wcrtomb(char *target, wchar_t source, mbstate_t * state) +{ + if (target == 0) { + wchar_t temp[2]; + const wchar_t *tempp = temp; + temp[0] = source; + temp[1] = 0; + return wcsrtombs(NULL, &tempp, 0, state); + } + return wcrtomb(target, source, state); +} +#endif NCURSES_EXPORT(int) unget_wch(const wchar_t wch) @@ -51,15 +70,15 @@ unget_wch(const wchar_t wch) T((T_CALLED("unget_wch(%#lx)"), (unsigned long) wch)); - memset(&state, 0, sizeof(state)); - length = wcrtomb(0, wch, &state); + init_mb(state); + length = _nc_wcrtomb(0, wch, &state); if (length != (size_t) (-1) && length != 0) { char *string; if ((string = (char *) malloc(length)) != 0) { - memset(&state, 0, sizeof(state)); + init_mb(state); wcrtomb(string, wch, &state); for (n = (int) (length - 1); n >= 0; --n) { diff --git a/ncurses/widechar/lib_vid_attr.c b/ncurses/widechar/lib_vid_attr.c index 06e7880d..c41a09ff 100644 --- a/ncurses/widechar/lib_vid_attr.c +++ b/ncurses/widechar/lib_vid_attr.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002 Free Software Foundation, Inc. * + * Copyright (c) 2002-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,68 +27,248 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 2002 * + * Author: Thomas E. Dickey * ****************************************************************************/ #include #include -MODULE_ID("$Id: lib_vid_attr.c,v 1.1 2002/05/11 20:55:26 tom Exp $") +MODULE_ID("$Id: lib_vid_attr.c,v 1.3 2005/01/29 18:34:00 tom Exp $") -#define set_color(mode, pair) mode &= ~A_COLOR; mode |= COLOR_PAIR(pair) +#define doPut(mode) TPUTS_TRACE(#mode); tputs(mode, 1, outc) + +#define TurnOn(mask,mode) \ + if ((turn_on & mask) && mode) { doPut(mode); } + +#define TurnOff(mask,mode) \ + if ((turn_off & mask) && mode) { doPut(mode); turn_off &= ~mask; } + + /* if there is no current screen, assume we *can* do color */ +#define SetColorsIf(why, old_attr, old_pair) \ + if (can_color && (why)) { \ + TR(TRACE_ATTRS, ("old pair = %d -- new pair = %d", old_pair, pair)); \ + if ((pair != old_pair) \ + || (fix_pair0 && (pair == 0)) \ + || (reverse ^ ((old_attr & A_REVERSE) != 0))) { \ + _nc_do_color(old_pair, pair, reverse, outc); \ + } \ + } + +#define set_color(mode, pair) mode &= ALL_BUT_COLOR; mode |= COLOR_PAIR(pair) NCURSES_EXPORT(int) vid_puts(attr_t newmode, short pair, void *opts GCC_UNUSED, int (*outc) (int)) { +#if NCURSES_EXT_COLORS + static attr_t previous_attr = A_NORMAL; + static int previous_pair = 0; + + attr_t turn_on, turn_off; + bool reverse = FALSE; + bool can_color = (SP == 0 || SP->_coloron); +#if NCURSES_EXT_FUNCS + bool fix_pair0 = (SP != 0 && SP->_coloron && !SP->_default_color); +#else +#define fix_pair0 FALSE +#endif + + T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair)); + + /* this allows us to go on whether or not newterm() has been called */ + if (SP) { + previous_attr = AttrOf(SCREEN_ATTRS(SP)); + previous_pair = GetPair(SCREEN_ATTRS(SP)); + } + + TR(TRACE_ATTRS, ("previous attribute was %s, %d", + _traceattr(previous_attr), previous_pair)); + +#if !USE_XMC_SUPPORT + if ((SP != 0) + && (magic_cookie_glitch > 0)) + newmode &= ~(SP->_xmc_suppress); +#endif + + /* + * If we have a terminal that cannot combine color with video + * attributes, use the colors in preference. + */ + if ((pair != 0 + || fix_pair0) + && (no_color_video > 0)) { + /* + * If we had chosen the A_xxx definitions to correspond to the + * no_color_video mask, we could simply shift it up and mask off the + * attributes. But we did not (actually copied Solaris' definitions). + * However, this is still simpler/faster than a lookup table. + * + * The 63 corresponds to A_STANDOUT, A_UNDERLINE, A_REVERSE, A_BLINK, + * A_DIM, A_BOLD which are 1:1 with no_color_video. The bits that + * correspond to A_INVIS, A_PROTECT (192) must be shifted up 1 and + * A_ALTCHARSET (256) down 2 to line up. We use the NCURSES_BITS + * macro so this will work properly for the wide-character layout. + */ + unsigned value = no_color_video; + attr_t mask = NCURSES_BITS((value & 63) + | ((value & 192) << 1) + | ((value & 256) >> 2), 8); + + if ((mask & A_REVERSE) != 0 + && (newmode & A_REVERSE) != 0) { + reverse = TRUE; + mask &= ~A_REVERSE; + } + newmode &= ~mask; + } + + if (newmode == previous_attr + && pair == previous_pair) + returnCode(OK); + + if (reverse) { + newmode &= ~A_REVERSE; + } + + turn_off = (~newmode & previous_attr) & ALL_BUT_COLOR; + turn_on = (newmode & ~previous_attr) & ALL_BUT_COLOR; + + SetColorsIf(((pair == 0) && !fix_pair0), previous_attr, previous_pair); + + if (newmode == A_NORMAL) { + if ((previous_attr & A_ALTCHARSET) && exit_alt_charset_mode) { + doPut(exit_alt_charset_mode); + previous_attr &= ~A_ALTCHARSET; + } + if (previous_attr) { + if (exit_attribute_mode) { + doPut(exit_attribute_mode); + } else { + if (!SP || SP->_use_rmul) { + TurnOff(A_UNDERLINE, exit_underline_mode); + } + if (!SP || SP->_use_rmso) { + TurnOff(A_STANDOUT, exit_standout_mode); + } + } + previous_attr &= ALL_BUT_COLOR; + previous_pair = 0; + } + + SetColorsIf((pair != 0) || fix_pair0, previous_attr, previous_pair); + } else if (set_attributes) { + if (turn_on || turn_off) { + TPUTS_TRACE("set_attributes"); + tputs(tparm(set_attributes, + (newmode & A_STANDOUT) != 0, + (newmode & A_UNDERLINE) != 0, + (newmode & A_REVERSE) != 0, + (newmode & A_BLINK) != 0, + (newmode & A_DIM) != 0, + (newmode & A_BOLD) != 0, + (newmode & A_INVIS) != 0, + (newmode & A_PROTECT) != 0, + (newmode & A_ALTCHARSET) != 0), 1, outc); + previous_attr &= ALL_BUT_COLOR; + previous_pair = 0; + } + SetColorsIf((pair != 0) || fix_pair0, previous_attr, previous_pair); + } else { + + TR(TRACE_ATTRS, ("turning %s off", _traceattr(turn_off))); + + TurnOff(A_ALTCHARSET, exit_alt_charset_mode); + + if (!SP || SP->_use_rmul) { + TurnOff(A_UNDERLINE, exit_underline_mode); + } + + if (!SP || SP->_use_rmso) { + TurnOff(A_STANDOUT, exit_standout_mode); + } + + if (turn_off && exit_attribute_mode) { + doPut(exit_attribute_mode); + turn_on |= (newmode & ALL_BUT_COLOR); + previous_attr &= ALL_BUT_COLOR; + previous_pair = 0; + } + SetColorsIf((pair != 0) || fix_pair0, previous_attr, previous_pair); + + TR(TRACE_ATTRS, ("turning %s on", _traceattr(turn_on))); + /* *INDENT-OFF* */ + TurnOn(A_ALTCHARSET, enter_alt_charset_mode); + TurnOn(A_BLINK, enter_blink_mode); + TurnOn(A_BOLD, enter_bold_mode); + TurnOn(A_DIM, enter_dim_mode); + TurnOn(A_REVERSE, enter_reverse_mode); + TurnOn(A_STANDOUT, enter_standout_mode); + TurnOn(A_PROTECT, enter_protected_mode); + TurnOn(A_INVIS, enter_secure_mode); + TurnOn(A_UNDERLINE, enter_underline_mode); +#if USE_WIDEC_SUPPORT + TurnOn(A_HORIZONTAL, enter_horizontal_hl_mode); + TurnOn(A_LEFT, enter_left_hl_mode); + TurnOn(A_LOW, enter_low_hl_mode); + TurnOn(A_RIGHT, enter_right_hl_mode); + TurnOn(A_TOP, enter_top_hl_mode); + TurnOn(A_VERTICAL, enter_vertical_hl_mode); +#endif + /* *INDENT-ON* */ + + } + + if (reverse) + newmode |= A_REVERSE; + + if (SP) { + SetAttr(SCREEN_ATTRS(SP), newmode); + SetPair(SCREEN_ATTRS(SP), pair); + } else { + previous_attr = newmode; + previous_pair = pair; + } + + returnCode(OK); +#else T((T_CALLED("vid_puts(%s,%d)"), _traceattr(newmode), pair)); set_color(newmode, pair); returnCode(vidputs(newmode, outc)); +#endif } #undef vid_attr NCURSES_EXPORT(int) -vid_attr(attr_t newmode, short pair, void *opts GCC_UNUSED) +vid_attr(attr_t newmode, short pair, void *opts) { T((T_CALLED("vid_attr(%s,%d)"), _traceattr(newmode), pair)); - set_color(newmode, pair); - returnCode(vidputs(newmode, _nc_outch)); + returnCode(vid_puts(newmode, pair, opts, _nc_outch)); } +/* + * This implementation uses the same mask values for A_xxx and WA_xxx, so + * we can use termattrs() for part of the logic. + */ NCURSES_EXPORT(attr_t) term_attrs(void) { - attr_t attrs = WA_NORMAL; + attr_t attrs; T((T_CALLED("term_attrs()"))); - if (enter_alt_charset_mode) - attrs |= WA_ALTCHARSET; - - if (enter_blink_mode) - attrs |= WA_BLINK; - - if (enter_bold_mode) - attrs |= WA_BOLD; - - if (enter_dim_mode) - attrs |= WA_DIM; - - if (enter_reverse_mode) - attrs |= WA_REVERSE; - - if (enter_standout_mode) - attrs |= WA_STANDOUT; - - if (enter_protected_mode) - attrs |= WA_PROTECT; - - if (enter_secure_mode) - attrs |= WA_INVIS; - - if (enter_underline_mode) - attrs |= WA_UNDERLINE; + attrs = termattrs(); - if (SP->_coloron) - attrs |= A_COLOR; + /* these are only supported for wide-character mode */ + if (enter_horizontal_hl_mode) + attrs |= WA_HORIZONTAL; + if (enter_left_hl_mode) + attrs |= WA_LEFT; + if (enter_low_hl_mode) + attrs |= WA_LOW; + if (enter_right_hl_mode) + attrs |= WA_RIGHT; + if (enter_top_hl_mode) + attrs |= WA_TOP; + if (enter_vertical_hl_mode) + attrs |= WA_VERTICAL; returnAttr(attrs); } diff --git a/ncurses/widechar/lib_wunctrl.c b/ncurses/widechar/lib_wunctrl.c index 89430e56..cd7c56ca 100644 --- a/ncurses/widechar/lib_wunctrl.c +++ b/ncurses/widechar/lib_wunctrl.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2001,2003 Free Software Foundation, Inc. * + * Copyright (c) 2001-2003,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -37,16 +37,17 @@ #if USE_WIDEC_SUPPORT -MODULE_ID("$Id: lib_wunctrl.c,v 1.7 2003/07/05 17:01:43 tom Exp $") +MODULE_ID("$Id: lib_wunctrl.c,v 1.8 2005/04/16 18:10:44 tom Exp $") NCURSES_EXPORT(wchar_t *) -wunctrl(cchar_t * wc) +wunctrl(cchar_t *wc) { static wchar_t str[5], *sp; if (Charable(*wc)) { - const char *p; - for (p = unctrl(_nc_to_char(CharOf(*wc))), sp = str; *p;) + const char *p = unctrl((unsigned) _nc_to_char((wint_t) CharOf(*wc))); + + for (sp = str; *p;) *sp++ = _nc_to_widechar(*p++); return str; } else diff --git a/panel/llib-lpanel b/panel/llib-lpanel index 42bb0f53..de49c234 100644 --- a/panel/llib-lpanel +++ b/panel/llib-lpanel @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1997,2002 * + * Author: Thomas E. Dickey 1997,2002,2005 * ****************************************************************************/ /* LINTLIBRARY */ @@ -35,6 +35,11 @@ #include "panel.priv.h" +#undef _nc_retrace_panel +PANEL *_nc_retrace_panel( + PANEL *pan) + { return(*(PANEL **)0); } + #undef _nc_my_visbuf const char *_nc_my_visbuf( const void *ptr) diff --git a/panel/llib-lpanelw b/panel/llib-lpanelw index 0c05a1e4..48bd1e0d 100644 --- a/panel/llib-lpanelw +++ b/panel/llib-lpanelw @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2002 Free Software Foundation, Inc. * + * Copyright (c) 2002,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,7 +27,7 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 2002 * + * Author: Thomas E. Dickey 2002,2005 * ****************************************************************************/ /* LINTLIBRARY */ @@ -35,6 +35,11 @@ #include "panel.priv.h" +#undef _nc_retrace_panel +PANEL *_nc_retrace_panel( + PANEL *pan) + { return(*(PANEL **)0); } + #undef _nc_my_visbuf const char *_nc_my_visbuf( const void *ptr) diff --git a/panel/p_above.c b/panel/p_above.c index 36e67d2b..32495f62 100644 --- a/panel/p_above.c +++ b/panel/p_above.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,17 +35,18 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_above.c,v 1.4 2000/12/10 02:20:44 tom Exp $") +MODULE_ID("$Id: p_above.c,v 1.6 2005/02/19 16:44:57 tom Exp $") NCURSES_EXPORT(PANEL *) -panel_above (const PANEL *pan) +panel_above(const PANEL * pan) { - if(!pan) + T((T_CALLED("panel_above(%p)"), pan)); + if (!pan) { /* if top and bottom are equal, we have no or only the pseudo panel; - if not, we return the panel above the pseudo panel */ - return(EMPTY_STACK() ? (PANEL*)0 : _nc_bottom_panel->above); + if not, we return the panel above the pseudo panel */ + returnPanel(EMPTY_STACK()? (PANEL *) 0 : _nc_bottom_panel->above); } else - return(pan->above); + returnPanel(pan->above); } diff --git a/panel/p_below.c b/panel/p_below.c index 5420ff9e..c4b24101 100644 --- a/panel/p_below.c +++ b/panel/p_below.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -35,19 +35,20 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_below.c,v 1.4 2000/12/10 02:20:44 tom Exp $") +MODULE_ID("$Id: p_below.c,v 1.6 2005/02/19 16:45:10 tom Exp $") -NCURSES_EXPORT(PANEL*) -panel_below (const PANEL *pan) +NCURSES_EXPORT(PANEL *) +panel_below(const PANEL * pan) { - if(!pan) + T((T_CALLED("panel_below(%p)"), pan)); + if (!pan) { /* if top and bottom are equal, we have no or only the pseudo panel */ - return(EMPTY_STACK() ? (PANEL*)0 : _nc_top_panel); + returnPanel(EMPTY_STACK()? (PANEL *) 0 : _nc_top_panel); } else { /* we must not return the pseudo panel */ - return(Is_Pseudo(pan->below) ? (PANEL*) 0 : pan->below); + returnPanel(Is_Pseudo(pan->below) ? (PANEL *) 0 : pan->below); } } diff --git a/panel/p_bottom.c b/panel/p_bottom.c index 0928e77e..b861fd9b 100644 --- a/panel/p_bottom.c +++ b/panel/p_bottom.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,35 +36,37 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_bottom.c,v 1.9 2001/02/24 23:46:33 tom Exp $") +MODULE_ID("$Id: p_bottom.c,v 1.11 2005/02/19 16:38:16 tom Exp $") NCURSES_EXPORT(int) -bottom_panel (PANEL *pan) +bottom_panel(PANEL * pan) { int err = OK; - if (pan) { + T((T_CALLED("bottom_panel(%p)"), pan)); + if (pan) + { + if (!Is_Bottom(pan)) + { - if(!Is_Bottom(pan)) { - - dBug(("--> bottom_panel %s", USER_PTR(pan->user))); - - HIDE_PANEL(pan,err,OK); - assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); - - dStack("",1,pan); - - pan->below = _nc_bottom_panel; - pan->above = _nc_bottom_panel->above; - if (pan->above) - pan->above->below = pan; - _nc_bottom_panel->above = pan; - - dStack("",9,pan); + dBug(("--> bottom_panel %s", USER_PTR(pan->user))); + + HIDE_PANEL(pan, err, OK); + assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); + + dStack("", 1, pan); + + pan->below = _nc_bottom_panel; + pan->above = _nc_bottom_panel->above; + if (pan->above) + pan->above->below = pan; + _nc_bottom_panel->above = pan; + + dStack("", 9, pan); + } } - } else err = ERR; - - return(err); + + returnCode(err); } diff --git a/panel/p_delete.c b/panel/p_delete.c index 1d4670ef..24ee26b4 100644 --- a/panel/p_delete.c +++ b/panel/p_delete.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,19 +36,22 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_delete.c,v 1.6 2001/02/24 23:46:41 tom Exp $") +MODULE_ID("$Id: p_delete.c,v 1.8 2005/02/19 16:38:45 tom Exp $") NCURSES_EXPORT(int) -del_panel (PANEL *pan) +del_panel(PANEL * pan) { int err = OK; - if(pan) + + T((T_CALLED("del_panel(%p)"), pan)); + if (pan) { dBug(("--> del_panel %s", USER_PTR(pan->user))); - HIDE_PANEL(pan,err,OK); + HIDE_PANEL(pan, err, OK); free((void *)pan); } else err = ERR; - return(err); + + returnCode(err); } diff --git a/panel/p_hidden.c b/panel/p_hidden.c index d5d13f37..624c07da 100644 --- a/panel/p_hidden.c +++ b/panel/p_hidden.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,12 +36,13 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_hidden.c,v 1.5 2000/12/10 02:20:44 tom Exp $") +MODULE_ID("$Id: p_hidden.c,v 1.7 2005/02/19 16:39:17 tom Exp $") NCURSES_EXPORT(int) -panel_hidden (const PANEL *pan) +panel_hidden(const PANEL * pan) { - if(!pan) - return(ERR); - return(IS_LINKED(pan) ? FALSE : TRUE); -} + T((T_CALLED("panel_hidden(%p)"), pan)); + if (!pan) + returnCode(ERR); + returnCode(IS_LINKED(pan) ? FALSE : TRUE); +} diff --git a/panel/p_hide.c b/panel/p_hide.c index 75599737..08d8853a 100644 --- a/panel/p_hide.c +++ b/panel/p_hide.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,22 +36,23 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_hide.c,v 1.7 2001/02/24 23:46:45 tom Exp $") +MODULE_ID("$Id: p_hide.c,v 1.9 2005/02/19 16:39:41 tom Exp $") NCURSES_EXPORT(int) -hide_panel (register PANEL *pan) +hide_panel(register PANEL * pan) { int err = OK; - if(!pan) - return(ERR); + T((T_CALLED("hide_panel(%p)"), pan)); + if (!pan) + returnCode(ERR); dBug(("--> hide_panel %s", USER_PTR(pan->user))); - dStack("",1,pan); + dStack("", 1, pan); - HIDE_PANEL(pan,err,ERR); + HIDE_PANEL(pan, err, ERR); - dStack("",9,pan); + dStack("", 9, pan); - return(err); + returnCode(err); } diff --git a/panel/p_move.c b/panel/p_move.c index d7dbd2ea..3818e8cb 100644 --- a/panel/p_move.c +++ b/panel/p_move.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,21 +36,21 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_move.c,v 1.7 2001/02/24 23:41:35 tom Exp $") +MODULE_ID("$Id: p_move.c,v 1.9 2005/02/19 16:46:49 tom Exp $") NCURSES_EXPORT(int) -move_panel (PANEL *pan, int starty, int startx) +move_panel(PANEL * pan, int starty, int startx) { - if(!pan) - return(ERR); + T((T_CALLED("move_panel(%p,%d,%d)"), pan, starty, startx)); - if (IS_LINKED(pan)) { - Touchpan(pan); - PANEL_UPDATE(pan,(PANEL*)0); - } + if (!pan) + returnCode(ERR); - if (mvwin(pan->win,starty,startx)) - return(ERR); + if (IS_LINKED(pan)) + { + Touchpan(pan); + PANEL_UPDATE(pan, (PANEL *) 0); + } - return(OK); + returnCode(mvwin(pan->win, starty, startx)); } diff --git a/panel/p_new.c b/panel/p_new.c index 3dfd8069..3e48e369 100644 --- a/panel/p_new.c +++ b/panel/p_new.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,61 +36,65 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_new.c,v 1.6 2000/12/10 02:20:44 tom Exp $") +MODULE_ID("$Id: p_new.c,v 1.8 2005/02/19 16:41:03 tom Exp $") #ifdef TRACE -static char* stdscr_id; -static char* new_id; +static char *stdscr_id; +static char *new_id; #endif /*+------------------------------------------------------------------------- Get root (i.e. stdscr's) panel. Establish the pseudo panel for stdscr if necessary. --------------------------------------------------------------------------*/ -static PANEL* +static PANEL * root_panel(void) { - if(_nc_stdscr_pseudo_panel == (PANEL*)0) + if (_nc_stdscr_pseudo_panel == (PANEL *) 0) { - + assert(stdscr && !_nc_bottom_panel && !_nc_top_panel); - _nc_stdscr_pseudo_panel = (PANEL*)malloc(sizeof(PANEL)); - if (_nc_stdscr_pseudo_panel != 0) { - PANEL* pan = _nc_stdscr_pseudo_panel; - WINDOW* win = stdscr; - pan->win = win; - pan->below = (PANEL*)0; - pan->above = (PANEL*)0; + _nc_stdscr_pseudo_panel = (PANEL *) malloc(sizeof(PANEL)); + if (_nc_stdscr_pseudo_panel != 0) + { + PANEL *pan = _nc_stdscr_pseudo_panel; + WINDOW *win = stdscr; + + pan->win = win; + pan->below = (PANEL *) 0; + pan->above = (PANEL *) 0; #ifdef TRACE - if (!stdscr_id) - stdscr_id = strdup("stdscr"); - pan->user = stdscr_id; + if (!stdscr_id) + stdscr_id = strdup("stdscr"); + pan->user = stdscr_id; #else - pan->user = (void*)0; + pan->user = (void *)0; #endif - _nc_bottom_panel = _nc_top_panel = pan; - } + _nc_bottom_panel = _nc_top_panel = pan; + } } return _nc_stdscr_pseudo_panel; } NCURSES_EXPORT(PANEL *) -new_panel (WINDOW *win) +new_panel(WINDOW *win) { - PANEL *pan = (PANEL*)0; + PANEL *pan = (PANEL *) 0; + + T((T_CALLED("new_panel(%p)"), win)); if (!win) - return(pan); + returnPanel(pan); if (!_nc_stdscr_pseudo_panel) (void)root_panel(); assert(_nc_stdscr_pseudo_panel); - if (!(win->_flags & _ISPAD) && (pan = (PANEL*)malloc(sizeof(PANEL)))) + if (!(win->_flags & _ISPAD) && (pan = (PANEL *) malloc(sizeof(PANEL)))) { pan->win = win; - pan->above = (PANEL *)0; - pan->below = (PANEL *)0; + pan->above = (PANEL *) 0; + pan->below = (PANEL *) 0; #ifdef TRACE if (!new_id) new_id = strdup("new"); @@ -100,5 +104,5 @@ new_panel (WINDOW *win) #endif (void)show_panel(pan); } - return(pan); + returnPanel(pan); } diff --git a/panel/p_replace.c b/panel/p_replace.c index a3b88cbf..5d0d295c 100644 --- a/panel/p_replace.c +++ b/panel/p_replace.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,20 +36,23 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_replace.c,v 1.7 2001/02/24 23:41:38 tom Exp $") +MODULE_ID("$Id: p_replace.c,v 1.9 2005/02/19 16:41:31 tom Exp $") NCURSES_EXPORT(int) -replace_panel (PANEL *pan, WINDOW *win) +replace_panel(PANEL * pan, WINDOW *win) { - if(!pan) - return(ERR); - - if (IS_LINKED(pan)) { - Touchpan(pan); - PANEL_UPDATE(pan,(PANEL*)0); - } - + T((T_CALLED("replace_panel(%p,%p)"), pan, win)); + + if (!pan) + returnCode(ERR); + + if (IS_LINKED(pan)) + { + Touchpan(pan); + PANEL_UPDATE(pan, (PANEL *) 0); + } + pan->win = win; - return(OK); + returnCode(OK); } diff --git a/panel/p_show.c b/panel/p_show.c index 0e1968fd..35eee237 100644 --- a/panel/p_show.c +++ b/panel/p_show.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,32 +36,34 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_show.c,v 1.9 2001/02/24 23:46:50 tom Exp $") +MODULE_ID("$Id: p_show.c,v 1.11 2005/02/19 16:42:02 tom Exp $") NCURSES_EXPORT(int) -show_panel (PANEL *pan) -{ +show_panel(PANEL * pan) +{ int err = OK; - if(!pan) - return(ERR); + T((T_CALLED("show_panel(%p)"), pan)); + + if (!pan) + returnCode(ERR); if (Is_Top(pan)) - return(OK); + returnCode(OK); dBug(("--> show_panel %s", USER_PTR(pan->user))); - HIDE_PANEL(pan,err,OK); + HIDE_PANEL(pan, err, OK); - dStack("",1,pan); + dStack("", 1, pan); assert(_nc_bottom_panel == _nc_stdscr_pseudo_panel); _nc_top_panel->above = pan; - pan->below = _nc_top_panel; - pan->above = (PANEL *)0; + pan->below = _nc_top_panel; + pan->above = (PANEL *) 0; _nc_top_panel = pan; - - dStack("",9,pan); - return(OK); + dStack("", 9, pan); + + returnCode(OK); } diff --git a/panel/p_top.c b/panel/p_top.c index aa7d9d42..8bd1d9fb 100644 --- a/panel/p_top.c +++ b/panel/p_top.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,10 +36,11 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_top.c,v 1.3 2000/12/10 02:20:44 tom Exp $") +MODULE_ID("$Id: p_top.c,v 1.5 2005/02/19 16:42:23 tom Exp $") NCURSES_EXPORT(int) -top_panel (PANEL *pan) +top_panel(PANEL * pan) { - return(show_panel(pan)); + T((T_CALLED("top_panel(%p)"), pan)); + returnCode(show_panel(pan)); } diff --git a/panel/p_update.c b/panel/p_update.c index 1a03739d..59677181 100644 --- a/panel/p_update.c +++ b/panel/p_update.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,18 +36,19 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_update.c,v 1.7 2001/02/24 23:41:42 tom Exp $") +MODULE_ID("$Id: p_update.c,v 1.9 2005/02/19 16:49:47 tom Exp $") NCURSES_EXPORT(void) -update_panels (void) +update_panels(void) { PANEL *pan; + T((T_CALLED("update_panels()"))); dBug(("--> update_panels")); pan = _nc_bottom_panel; - while(pan && pan->above) + while (pan && pan->above) { - PANEL_UPDATE(pan,pan->above); + PANEL_UPDATE(pan, pan->above); pan = pan->above; } @@ -57,4 +58,6 @@ update_panels (void) Wnoutrefresh(pan); pan = pan->above; } + + returnVoid; } diff --git a/panel/p_user.c b/panel/p_user.c index de1ec7dd..ffa25f85 100644 --- a/panel/p_user.c +++ b/panel/p_user.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,21 +36,21 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_user.c,v 1.4 2000/12/10 02:20:44 tom Exp $") +MODULE_ID("$Id: p_user.c,v 1.6 2005/02/19 16:52:44 tom Exp $") NCURSES_EXPORT(int) -set_panel_userptr -(PANEL *pan, NCURSES_CONST void *uptr) +set_panel_userptr(PANEL * pan, NCURSES_CONST void *uptr) { - if(!pan) - return(ERR); + T((T_CALLED("set_panel_userptr(%p,%p)"), pan, uptr)); + if (!pan) + returnCode(ERR); pan->user = uptr; - return(OK); + returnCode(OK); } -NCURSES_EXPORT(NCURSES_CONST void*) -panel_userptr (const PANEL *pan) +NCURSES_EXPORT(NCURSES_CONST void *) +panel_userptr(const PANEL * pan) { - return(pan ? pan->user : (NCURSES_CONST void *)0); + T((T_CALLED("panel_userptr(%p)"), pan)); + returnCVoidPtr(pan ? pan->user : (NCURSES_CONST void *)0); } - diff --git a/panel/p_win.c b/panel/p_win.c index 2b9f5b0c..e7d2cea8 100644 --- a/panel/p_win.c +++ b/panel/p_win.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -36,14 +36,11 @@ */ #include "panel.priv.h" -MODULE_ID("$Id: p_win.c,v 1.3 2000/12/10 02:20:43 tom Exp $") +MODULE_ID("$Id: p_win.c,v 1.5 2005/02/19 16:44:16 tom Exp $") NCURSES_EXPORT(WINDOW *) -panel_window (const PANEL *pan) +panel_window(const PANEL * pan) { - return(pan ? pan->win : (WINDOW *)0); + T((T_CALLED("panel_window(%p)"), pan)); + returnWin(pan ? pan->win : (WINDOW *)0); } - - - - diff --git a/panel/panel.c b/panel/panel.c index a56d57ef..16a8083d 100644 --- a/panel/panel.c +++ b/panel/panel.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -34,37 +34,51 @@ /* panel.c -- implementation of panels library, some core routines */ #include "panel.priv.h" -MODULE_ID("$Id: panel.c,v 1.20 2001/02/24 23:17:26 tom Exp $") +MODULE_ID("$Id: panel.c,v 1.23 2005/02/19 18:04:31 tom Exp $") +/*+------------------------------------------------------------------------- + _nc_retrace_panel (pan) +--------------------------------------------------------------------------*/ +#ifdef TRACE +NCURSES_EXPORT(PANEL *) +_nc_retrace_panel(PANEL * pan) +{ + T((T_RETURN("%p"), pan)); + return pan; +} +#endif + +/*+------------------------------------------------------------------------- + _nc_my_visbuf(ptr) +--------------------------------------------------------------------------*/ #ifdef TRACE #ifndef TRACE_TXT NCURSES_EXPORT(const char *) -_nc_my_visbuf (const void *ptr) +_nc_my_visbuf(const void *ptr) { - char temp[32]; - if (ptr != 0) - sprintf(temp, "ptr:%p", ptr); - else - strcpy(temp, ""); - return _nc_visbuf(temp); + char temp[32]; + + if (ptr != 0) + sprintf(temp, "ptr:%p", ptr); + else + strcpy(temp, ""); + return _nc_visbuf(temp); } #endif #endif - /*+------------------------------------------------------------------------- dPanel(text,pan) --------------------------------------------------------------------------*/ #ifdef TRACE NCURSES_EXPORT(void) -_nc_dPanel -(const char *text, const PANEL *pan) +_nc_dPanel(const char *text, const PANEL * pan) { - _tracef("%s id=%s b=%s a=%s y=%d x=%d", - text, USER_PTR(pan->user), - (pan->below) ? USER_PTR(pan->below->user) : "--", - (pan->above) ? USER_PTR(pan->above->user) : "--", - PSTARTY(pan), PSTARTX(pan)); + _tracef("%s id=%s b=%s a=%s y=%d x=%d", + text, USER_PTR(pan->user), + (pan->below) ? USER_PTR(pan->below->user) : "--", + (pan->above) ? USER_PTR(pan->above->user) : "--", + PSTARTY(pan), PSTARTX(pan)); } #endif @@ -73,21 +87,20 @@ _nc_dPanel --------------------------------------------------------------------------*/ #ifdef TRACE NCURSES_EXPORT(void) -_nc_dStack -(const char *fmt, int num, const PANEL *pan) +_nc_dStack(const char *fmt, int num, const PANEL * pan) { char s80[80]; - sprintf(s80,fmt,num,pan); - _tracef("%s b=%s t=%s",s80, - (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user) : "--", - (_nc_top_panel) ? USER_PTR(_nc_top_panel->user) : "--"); - if(pan) + sprintf(s80, fmt, num, pan); + _tracef("%s b=%s t=%s", s80, + (_nc_bottom_panel) ? USER_PTR(_nc_bottom_panel->user) : "--", + (_nc_top_panel) ? USER_PTR(_nc_top_panel->user) : "--"); + if (pan) _tracef("pan id=%s", USER_PTR(pan->user)); pan = _nc_bottom_panel; - while(pan) + while (pan) { - dPanel("stk",pan); + dPanel("stk", pan); pan = pan->above; } } @@ -98,9 +111,9 @@ _nc_dStack --------------------------------------------------------------------------*/ #ifdef TRACE NCURSES_EXPORT(void) -_nc_Wnoutrefresh (const PANEL *pan) +_nc_Wnoutrefresh(const PANEL * pan) { - dPanel("wnoutrefresh",pan); + dPanel("wnoutrefresh", pan); wnoutrefresh(pan->win); } #endif @@ -110,9 +123,9 @@ _nc_Wnoutrefresh (const PANEL *pan) --------------------------------------------------------------------------*/ #ifdef TRACE NCURSES_EXPORT(void) -_nc_Touchpan (const PANEL *pan) +_nc_Touchpan(const PANEL * pan) { - dPanel("Touchpan",pan); + dPanel("Touchpan", pan); touchwin(pan->win); } #endif @@ -122,19 +135,23 @@ _nc_Touchpan (const PANEL *pan) --------------------------------------------------------------------------*/ #ifdef TRACE NCURSES_EXPORT(void) -_nc_Touchline -(const PANEL *pan, int start, int count) +_nc_Touchline(const PANEL * pan, int start, int count) { char s80[80]; - sprintf(s80,"Touchline s=%d c=%d",start,count); - dPanel(s80,pan); - touchline(pan->win,start,count); + + sprintf(s80, "Touchline s=%d c=%d", start, count); + dPanel(s80, pan); + touchline(pan->win, start, count); } #endif #ifndef TRACE # ifndef __GNUC__ /* Some C compilers need something defined in a source file */ - void _nc_dummy_panel(void) { } +extern void _nc_dummy_panel(void); +void +_nc_dummy_panel(void) +{ +} # endif #endif diff --git a/panel/panel.priv.h b/panel/panel.priv.h index 7097d842..0c426048 100644 --- a/panel/panel.priv.h +++ b/panel/panel.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -26,7 +26,7 @@ * authorization. * ****************************************************************************/ -/* $Id: panel.priv.h,v 1.19 2001/06/02 23:31:05 tom Exp $ */ +/* $Id: panel.priv.h,v 1.20 2005/02/19 17:16:54 tom Exp $ */ #ifndef NCURSES_PANEL_PRIV_H #define NCURSES_PANEL_PRIV_H 1 @@ -72,6 +72,9 @@ # define USER_PTR(ptr) _nc_my_visbuf((const char *)ptr) # endif +# define returnPanel(code) TRACE_RETURN(code,panel) + + extern NCURSES_EXPORT(PANEL *) _nc_retrace_panel (PANEL *); extern NCURSES_EXPORT(void) _nc_dPanel (const char*, const PANEL*); extern NCURSES_EXPORT(void) _nc_dStack (const char*, int, const PANEL*); extern NCURSES_EXPORT(void) _nc_Wnoutrefresh (const PANEL*); @@ -85,6 +88,7 @@ # define Touchpan(pan) _nc_Touchpan(pan) # define Touchline(pan,start,count) _nc_Touchline(pan,start,count) #else /* !TRACE */ +# define returnPanel(code) return code # define dBug(x) # define dPanel(text,pan) # define dStack(fmt,num,pan) @@ -98,7 +102,7 @@ #define _nc_bottom_panel _nc_panelhook()->bottom_panel #define EMPTY_STACK() (_nc_top_panel==_nc_bottom_panel) -#define Is_Bottom(p) (((p)!=(PANEL*)0) && !EMPTY_STACK() && (_nc_bottom_panel->above==(p))) +#define Is_Bottom(p) (((p)!=(PANEL*)0) && !EMPTY_STACK() && (_nc_bottom_panel->above==(p))) #define Is_Top(p) (((p)!=(PANEL*)0) && !EMPTY_STACK() && (_nc_top_panel==(p))) #define Is_Pseudo(p) ((p) && ((p)==_nc_bottom_panel)) @@ -138,9 +142,9 @@ /*+------------------------------------------------------------------------- Walk through the panel stack starting at the given location and check for intersections; overlapping panels are "touched", so they - are incrementally overwriting cells that should be hidden. + are incrementally overwriting cells that should be hidden. If the "touch" flag is set, the panel gets touched before it is - updated. + updated. ---------------------------------------------------------------------------*/ #define PANEL_UPDATE(pan,panstart)\ { PANEL* pan2 = ((panstart) ? (panstart) : _nc_bottom_panel);\ diff --git a/progs/Makefile.in b/progs/Makefile.in index c40cd00c..f67bfff0 100644 --- a/progs/Makefile.in +++ b/progs/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.62 2003/11/01 22:45:57 tom Exp $ +# $Id: Makefile.in,v 1.65 2005/09/25 00:42:08 tom Exp $ ############################################################################## -# Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -53,6 +53,7 @@ o = .@OBJEXT@ MODEL = ../@DFT_OBJ_SUBDIR@ DESTDIR = @DESTDIR@ +top_srcdir = @top_srcdir@ srcdir = @srcdir@ prefix = @prefix@ exec_prefix = @exec_prefix@ @@ -79,7 +80,7 @@ CC = @CC@ CPP = @CPP@ CFLAGS = @CFLAGS@ -INCDIR = $(srcdir)/../include +INCDIR = $(top_srcdir)/include CPPFLAGS = -I../progs -I$(srcdir) -DHAVE_CONFIG_H @CPPFLAGS@ CCFLAGS = $(CPPFLAGS) $(CFLAGS) @@ -95,7 +96,7 @@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) LD = @LD@ LINK = @LINK_PROGS@ $(LIBTOOL_LINK) $(CC) LDFLAGS = @EXTRA_LDFLAGS@ \ - @PROG_ARGS@ @LDFLAGS@ @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ + @TINFO_ARGS@ @LDFLAGS@ @LD_MODEL@ @LIBS@ LDFLAGS_LIBTOOL = $(LDFLAGS) $(CFLAGS_LIBTOOL) LDFLAGS_NORMAL = $(LDFLAGS) $(CFLAGS_NORMAL) @@ -123,6 +124,12 @@ TESTPROGS = mvcur$x tctest$x hardscroll$x hashmap$x # Default library, for linking applications DEPS_CURSES = ../lib/@LIB_PREFIX@ncurses@DFT_DEP_SUFFIX@ +HEADER_DEPS = \ + ../include/curses.h \ + $(INCDIR)/term_entry.h \ + $(INCDIR)/tic.h \ + $(INCDIR)/nc_alloc.h + ################################################################################ all: $(AUTO_SRC) $(PROGS) diff --git a/progs/clear.c b/progs/clear.c index d27b6254..da30bcc4 100644 --- a/progs/clear.c +++ b/progs/clear.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998 Free Software Foundation, Inc. * + * Copyright (c) 1998,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -38,9 +38,7 @@ #include -#include - -MODULE_ID("$Id: clear.c,v 1.8 1998/09/26 11:42:50 tom Exp $") +MODULE_ID("$Id: clear.c,v 1.9 2005/09/25 00:46:43 tom Exp $") static int putch(int c) { diff --git a/progs/dump_entry.c b/progs/dump_entry.c index 48ef4881..6187d5b1 100644 --- a/progs/dump_entry.c +++ b/progs/dump_entry.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -39,7 +39,7 @@ #include "termsort.c" /* this C file is generated */ #include /* so is this */ -MODULE_ID("$Id: dump_entry.c,v 1.66 2003/05/24 22:43:59 tom Exp $") +MODULE_ID("$Id: dump_entry.c,v 1.70 2005/07/23 20:03:30 tom Exp $") #define INDENT 8 #define DISCARD(string) string = ABSENT_STRING @@ -59,11 +59,14 @@ static int column; /* current column, limited by 'width' */ static int oldcol; /* last value of column before wrap */ static bool pretty; /* true if we format if-then-else strings */ +static char *save_sgr; +static char *save_acsc; + static DYNBUF outbuf; static DYNBUF tmpbuf; /* indirection pointers for implementing sort and display modes */ -static const int *bool_indirect, *num_indirect, *str_indirect; +static const PredIdx *bool_indirect, *num_indirect, *str_indirect; static NCURSES_CONST char *const *bool_names; static NCURSES_CONST char *const *num_names; static NCURSES_CONST char *const *str_names; @@ -262,7 +265,7 @@ dump_init(const char *version, int mode, int sort, int twidth, int traceval, static TERMTYPE *cur_type; static int -dump_predicate(int type, int idx) +dump_predicate(PredType type, PredIdx idx) /* predicate function to use for ordinary decompilation */ { switch (type) { @@ -282,7 +285,7 @@ dump_predicate(int type, int idx) return (FALSE); /* pacify compiler */ } -static void set_obsolete_termcaps(TERMTYPE * tp); +static void set_obsolete_termcaps(TERMTYPE *tp); /* is this the index of a function key string? */ #define FNKEY(i) (((i)<= 65 && (i)>= 75) || ((i)<= 216 && (i)>= 268)) @@ -296,7 +299,7 @@ static void set_obsolete_termcaps(TERMTYPE * tp); #define STR_IDX(name) (&(name) - &(CUR Strings[0])) static bool -version_filter(int type, int idx) +version_filter(PredType type, PredIdx idx) /* filter out capabilities we may want to suppress */ { switch (tversion) { @@ -498,21 +501,24 @@ fmt_complex(char *src, int level) return src; } +#define SAME_CAP(n,cap) (&tterm->Strings[n] == &cap) + int -fmt_entry(TERMTYPE * tterm, - int (*pred) (int type, int idx), +fmt_entry(TERMTYPE *tterm, + PredFunc pred, bool content_only, bool suppress_untranslatable, bool infodump, int numbers) { - int i, j; + PredIdx i, j; char buffer[MAX_TERMINFO_LENGTH]; + char *capability; NCURSES_CONST char *name; int predval, len; - int num_bools = 0; - int num_values = 0; - int num_strings = 0; + PredIdx num_bools = 0; + PredIdx num_values = 0; + PredIdx num_strings = 0; bool outcount = 0; #define WRAP_CONCAT \ @@ -607,51 +613,79 @@ fmt_entry(TERMTYPE * tterm, for_each_string(j, tterm) { i = StrIndirect(j); name = ExtStrname(tterm, i, str_names); + capability = tterm->Strings[i]; if (!version_filter(STRING, i)) continue; else if (isObsolete(outform, name)) continue; +#if NCURSES_XNAMES /* - * Some older versions of vi want rmir/smir to be defined - * for ich/ich1 to work. If they're not defined, force - * them to be output as defined and empty. + * Extended names can be longer than 2 characters, but termcap programs + * cannot read those (filter them out). */ + if (outform == F_TERMCAP && (strlen(name) > 2)) + continue; +#endif + if (outform == F_TERMCAP) { - if (insert_character || parm_ich) { - if (&tterm->Strings[i] == &enter_insert_mode + /* + * Some older versions of vi want rmir/smir to be defined + * for ich/ich1 to work. If they're not defined, force + * them to be output as defined and empty. + */ + if (PRESENT(insert_character) || PRESENT(parm_ich)) { + if (SAME_CAP(i, enter_insert_mode) && enter_insert_mode == ABSENT_STRING) { (void) strcpy(buffer, "im="); WRAP_CONCAT; continue; } - if (&tterm->Strings[i] == &exit_insert_mode + if (SAME_CAP(i, exit_insert_mode) && exit_insert_mode == ABSENT_STRING) { (void) strcpy(buffer, "ei="); WRAP_CONCAT; continue; } } + /* + * termcap applications such as screen will be confused if sgr0 + * is translated to a string containing rmacs. Filter that out. + */ + if (PRESENT(exit_attribute_mode)) { + if (SAME_CAP(i, exit_attribute_mode)) { + char *trimmed_sgr0; + char *my_sgr = set_attributes; + + set_attributes = save_sgr; + + trimmed_sgr0 = _nc_trim_sgr0(tterm); + if (strcmp(capability, trimmed_sgr0)) + capability = trimmed_sgr0; + + set_attributes = my_sgr; + } + } } predval = pred(STRING, i); buffer[0] = '\0'; if (predval != FAIL) { - if (tterm->Strings[i] != ABSENT_STRING + if (capability != ABSENT_STRING && i + 1 > num_strings) num_strings = i + 1; - if (!VALID_STRING(tterm->Strings[i])) { + if (!VALID_STRING(capability)) { sprintf(buffer, "%s@", name); WRAP_CONCAT; } else if (outform == F_TERMCAP || outform == F_TCONVERR) { int params = ((i < (int) SIZEOF(parametrized)) ? parametrized[i] : 0); - char *srccap = _nc_tic_expand(tterm->Strings[i], TRUE, numbers); + char *srccap = _nc_tic_expand(capability, TRUE, numbers); char *cv = _nc_infotocap(name, srccap, params); if (cv == 0) { @@ -677,10 +711,10 @@ fmt_entry(TERMTYPE * tterm, } else { sprintf(buffer, "%s=%s", name, cv); } - len += strlen(tterm->Strings[i]) + 1; + len += strlen(capability) + 1; WRAP_CONCAT; } else { - char *src = _nc_tic_expand(tterm->Strings[i], + char *src = _nc_tic_expand(capability, outform == F_TERMINFO, numbers); strcpy_DYN(&tmpbuf, 0); @@ -693,11 +727,14 @@ fmt_entry(TERMTYPE * tterm, } else { strcpy_DYN(&tmpbuf, src); } - len += strlen(tterm->Strings[i]) + 1; + len += strlen(capability) + 1; wrap_concat(tmpbuf.text); outcount = TRUE; } } + /* e.g., trimmed_sgr0 */ + if (capability != tterm->Strings[i]) + free(capability); } len += num_strings * 2; @@ -786,7 +823,7 @@ fmt_entry(TERMTYPE * tterm, } static bool -kill_string(TERMTYPE * tterm, char *cap) +kill_string(TERMTYPE *tterm, char *cap) { int n; for (n = 0; n < NUM_STRINGS(tterm); ++n) { @@ -799,9 +836,9 @@ kill_string(TERMTYPE * tterm, char *cap) } static char * -find_string(TERMTYPE * tterm, char *name) +find_string(TERMTYPE *tterm, char *name) { - int n; + PredIdx n; for (n = 0; n < NUM_STRINGS(tterm); ++n) { if (version_filter(STRING, n) && !strcmp(name, strnames[n])) { @@ -820,7 +857,7 @@ find_string(TERMTYPE * tterm, char *name) * make it smaller. */ static int -kill_labels(TERMTYPE * tterm, int target) +kill_labels(TERMTYPE *tterm, int target) { int n; int result = 0; @@ -845,7 +882,7 @@ kill_labels(TERMTYPE * tterm, int target) * make it smaller. */ static int -kill_fkeys(TERMTYPE * tterm, int target) +kill_fkeys(TERMTYPE *tterm, int target) { int n; int result = 0; @@ -874,12 +911,12 @@ kill_fkeys(TERMTYPE * tterm, int target) #define SHOW_WHY if (!already_used) PRINTF int -dump_entry(TERMTYPE * tterm, +dump_entry(TERMTYPE *tterm, bool suppress_untranslatable, bool limited, int already_used, int numbers, - int (*pred) (int type, int idx)) + PredFunc pred) /* dump a single entry */ { int len, critlen; @@ -898,6 +935,9 @@ dump_entry(TERMTYPE * tterm, } critlen -= already_used; + save_sgr = set_attributes; + save_acsc = acs_chars; + if (((len = FMT_ENTRY()) > critlen) && limited) { if (!suppress_untranslatable) { @@ -911,10 +951,31 @@ dump_entry(TERMTYPE * tterm, * is really just an optimization hack. Another good candidate is * acsc since it is both long and unused by BSD termcap. */ - char *oldsgr = set_attributes; - char *oldacsc = acs_chars; bool changed = FALSE; +#if NCURSES_XNAMES + /* + * Extended names are most likely function-key definitions. Drop + * those first. + */ + int n; + for (n = STRCOUNT; n < NUM_STRINGS(tterm); n++) { + char *name = ExtStrname(tterm, n, strnames); + + if (VALID_STRING(tterm->Strings[n])) { + set_attributes = ABSENT_STRING; + /* we remove long names anyway - only report the short */ + if (strlen(name) <= 2) { + SHOW_WHY("# (%s removed to fit entry within %d bytes)\n", + name, + critlen); + } + changed = TRUE; + if ((len = FMT_ENTRY()) <= critlen) + break; + } + } +#endif if (VALID_STRING(set_attributes)) { set_attributes = ABSENT_STRING; SHOW_WHY("# (sgr removed to fit entry within %d bytes)\n", @@ -959,8 +1020,8 @@ dump_entry(TERMTYPE * tterm, } tversion = oldversion; } - set_attributes = oldsgr; - acs_chars = oldacsc; + set_attributes = save_sgr; + acs_chars = save_acsc; } } @@ -982,11 +1043,12 @@ dump_uses(const char *name, bool infodump) } void -compare_entry(void (*hook) (int t, int i, const char *name), TERMTYPE * tp - GCC_UNUSED, bool quiet) +compare_entry(void (*hook) (PredType t, PredIdx i, const char *name), + TERMTYPE *tp GCC_UNUSED, + bool quiet) /* compare two entries */ { - int i, j; + PredIdx i, j; NCURSES_CONST char *name; if (!quiet) @@ -1041,7 +1103,7 @@ compare_entry(void (*hook) (int t, int i, const char *name), TERMTYPE * tp #define CUR tp-> static void -set_obsolete_termcaps(TERMTYPE * tp) +set_obsolete_termcaps(TERMTYPE *tp) { #include "capdefaults.c" } @@ -1051,7 +1113,7 @@ set_obsolete_termcaps(TERMTYPE * tp) * unique. */ void -repair_acsc(TERMTYPE * tp) +repair_acsc(TERMTYPE *tp) { if (VALID_STRING(acs_chars)) { size_t n, m; diff --git a/progs/dump_entry.h b/progs/dump_entry.h index bf67ddd8..1f4a52a1 100644 --- a/progs/dump_entry.h +++ b/progs/dump_entry.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,1999 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,13 +29,19 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* + * $Id: dump_entry.h,v 1.27 2004/12/04 15:37:17 tom Exp $ + * * Dump control definitions and variables */ +#ifndef DUMP_ENTRY_H +#define DUMP_ENTRY_H 1 + /* capability output formats */ #define F_TERMINFO 0 /* use terminfo names */ #define F_VARIABLE 1 /* use C variable names */ @@ -56,12 +62,18 @@ #define CMP_STRING 2 /* comparison on strings */ #define CMP_USE 3 /* comparison on use capabilities */ +typedef unsigned PredType; +typedef int PredIdx; +typedef int (*PredFunc)(PredType, PredIdx); + extern NCURSES_CONST char *nametrans(const char *); extern void dump_init(const char *, int, int, int, int, bool); -extern int fmt_entry(TERMTYPE *, int (*)(int, int), bool, bool, bool, int); -extern int dump_entry(TERMTYPE *, bool, bool, int, int, int (*)(int, int)); +extern int fmt_entry(TERMTYPE *, PredFunc, bool, bool, bool, int); +extern int dump_entry(TERMTYPE *, bool, bool, int, int, PredFunc); extern int dump_uses(const char *, bool); -extern void compare_entry(void (*)(int, int, const char *), TERMTYPE *, bool); +extern void compare_entry(void (*)(PredType, PredIdx, const char *), TERMTYPE *, bool); extern void repair_acsc(TERMTYPE * tp); #define FAIL -1 + +#endif /* DUMP_ENTRY_H */ diff --git a/progs/infocmp.c b/progs/infocmp.c index e5751fb4..ee422d29 100644 --- a/progs/infocmp.c +++ b/progs/infocmp.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -38,10 +39,9 @@ #include -#include #include -MODULE_ID("$Id: infocmp.c,v 1.71 2003/10/18 18:01:54 tom Exp $") +MODULE_ID("$Id: infocmp.c,v 1.79 2005/09/25 00:39:43 tom Exp $") #define L_CURL "{" #define R_CURL "}" @@ -66,6 +66,7 @@ static int termcount; /* count of terminal entries */ static bool limited = TRUE; /* "-r" option is not set */ static bool quiet = FALSE; +static bool literal = FALSE; static const char *bool_sep = ":"; static const char *s_absent = "NULL"; static const char *s_cancel = "NULL"; @@ -87,11 +88,10 @@ static bool ignorepads; /* ignore pad prefixes when diffing */ #if NO_LEAKS #undef ExitProgram -static void -ExitProgram(int code) GCC_NORETURN; +static void ExitProgram(int code) GCC_NORETURN; /* prototype is to get gcc to accept the noreturn attribute */ - static void - ExitProgram(int code) +static void +ExitProgram(int code) { while (termcount-- > 0) _nc_free_termtype(&entries[termcount].tterm); @@ -120,7 +120,7 @@ canonical_name(char *ptr, char *buf) ***************************************************************************/ static int -capcmp(unsigned idx, const char *s, const char *t) +capcmp(PredIdx idx, const char *s, const char *t) /* capability comparison function */ { if (!VALID_STRING(s) && !VALID_STRING(t)) @@ -135,7 +135,7 @@ capcmp(unsigned idx, const char *s, const char *t) } static int -use_predicate(int type, int idx) +use_predicate(unsigned type, PredIdx idx) /* predicate function to use for use decompilation */ { ENTRY *ep; @@ -245,7 +245,7 @@ useeq(ENTRY * e1, ENTRY * e2) } static bool -entryeq(TERMTYPE * t1, TERMTYPE * t2) +entryeq(TERMTYPE *t1, TERMTYPE *t2) /* are two entries equivalent? */ { unsigned i; @@ -259,7 +259,7 @@ entryeq(TERMTYPE * t1, TERMTYPE * t2) return (FALSE); for (i = 0; i < NUM_STRINGS(t1); i++) - if (capcmp(i, t1->Strings[i], t2->Strings[i])) + if (capcmp((PredIdx) i, t1->Strings[i], t2->Strings[i])) return (FALSE); return (TRUE); @@ -332,7 +332,7 @@ dump_string(char *val, char *buf) } static void -compare_predicate(int type, int idx, const char *name) +compare_predicate(PredType type, PredIdx idx, const char *name) /* predicate function to use for entry difference reports */ { register ENTRY *e1 = &entries[0]; @@ -474,14 +474,26 @@ static const assoc std_caps[] = {"\033)A", "ISO UK G1"}, /* enable UK chars for G1 */ {"\033)B", "ISO US G1"}, /* enable US chars for G1 */ - /* these are DEC private modes widely supported by emulators */ + /* these are DEC private controls widely supported by emulators */ {"\033=", "DECPAM"}, /* application keypad mode */ {"\033>", "DECPNM"}, /* normal keypad mode */ {"\033<", "DECANSI"}, /* enter ANSI mode */ + {"\033[!p", "DECSTR"}, /* soft reset */ + {"\033 F", "S7C1T"}, /* 7-bit controls */ {(char *) 0, (char *) 0} }; +static const assoc std_modes[] = +/* ECMA \E[ ... [hl] modes recognized by many emulators */ +{ + {"2", "AM"}, /* keyboard action mode */ + {"4", "IRM"}, /* insert/replace mode */ + {"12", "SRM"}, /* send/receive mode */ + {"20", "LNM"}, /* linefeed mode */ + {(char *) 0, (char *) 0} +}; + static const assoc private_modes[] = /* DEC \E[ ... [hl] modes recognized by many emulators */ { @@ -532,13 +544,25 @@ static const assoc ecma_highlights[] = {(char *) 0, (char *) 0} }; +static int +skip_csi(const char *cap) +{ + int result = 0; + if (cap[0] == '\033' && cap[1] == '[') + result = 2; + else if (UChar(cap[0]) == 0233) + result = 1; + return result; +} + static void -analyze_string(const char *name, const char *cap, TERMTYPE * tp) +analyze_string(const char *name, const char *cap, TERMTYPE *tp) { char buf[MAX_TERMINFO_LENGTH]; char buf2[MAX_TERMINFO_LENGTH]; const char *sp, *ep; const assoc *ap; + int tp_lines = tp->Numbers[2]; if (cap == ABSENT_STRING || cap == CANCELLED_STRING) return; @@ -547,6 +571,7 @@ analyze_string(const char *name, const char *cap, TERMTYPE * tp) buf[0] = '\0'; for (sp = cap; *sp; sp++) { int i; + int csi; size_t len = 0; const char *expansion = 0; @@ -586,26 +611,68 @@ analyze_string(const char *name, const char *cap, TERMTYPE * tp) } /* now check the standard capabilities */ - if (!expansion) + if (!expansion) { + csi = skip_csi(sp); for (ap = std_caps; ap->from; ap++) { - len = strlen(ap->from); + size_t adj = csi ? 2 : 0; - if (strncmp(ap->from, sp, len) == 0) { + len = strlen(ap->from); + if (len > adj + && strncmp(ap->from + adj, sp + csi, len - adj) == 0) { expansion = ap->to; + len -= adj; + len += csi; break; } } + } + + /* now check for standard-mode sequences */ + if (!expansion + && (csi = skip_csi(sp)) != 0 + && (len = strspn(sp + csi, "0123456789;")) + && ((sp[csi + len] == 'h') || (sp[csi + len] == 'l'))) { + char buf3[MAX_TERMINFO_LENGTH]; + + (void) strcpy(buf2, (sp[csi + len] == 'h') ? "ECMA+" : "ECMA-"); + (void) strncpy(buf3, sp + csi, len); + len += csi + 1; + buf3[len] = '\0'; + + ep = strtok(buf3, ";"); + do { + bool found = FALSE; + + for (ap = std_modes; ap->from; ap++) { + size_t tlen = strlen(ap->from); + + if (strncmp(ap->from, ep, tlen) == 0) { + (void) strcat(buf2, ap->to); + found = TRUE; + break; + } + } + + if (!found) + (void) strcat(buf2, ep); + (void) strcat(buf2, ";"); + } while + ((ep = strtok((char *) 0, ";"))); + buf2[strlen(buf2) - 1] = '\0'; + expansion = buf2; + } /* now check for private-mode sequences */ if (!expansion - && sp[0] == '\033' && sp[1] == '[' && sp[2] == '?' - && (len = strspn(sp + 3, "0123456789;")) - && ((sp[3 + len] == 'h') || (sp[3 + len] == 'l'))) { + && (csi = skip_csi(sp)) != 0 + && sp[csi] == '?' + && (len = strspn(sp + csi + 1, "0123456789;")) + && ((sp[csi + 1 + len] == 'h') || (sp[csi + 1 + len] == 'l'))) { char buf3[MAX_TERMINFO_LENGTH]; - (void) strcpy(buf2, (sp[3 + len] == 'h') ? "DEC+" : "DEC-"); - (void) strncpy(buf3, sp + 3, len); - len += 4; + (void) strcpy(buf2, (sp[csi + 1 + len] == 'h') ? "DEC+" : "DEC-"); + (void) strncpy(buf3, sp + csi + 1, len); + len += csi + 2; buf3[len] = '\0'; ep = strtok(buf3, ";"); @@ -633,14 +700,14 @@ analyze_string(const char *name, const char *cap, TERMTYPE * tp) /* now check for ECMA highlight sequences */ if (!expansion - && sp[0] == '\033' && sp[1] == '[' - && (len = strspn(sp + 2, "0123456789;")) - && sp[2 + len] == 'm') { + && (csi = skip_csi(sp)) != 0 + && (len = strspn(sp + csi, "0123456789;")) != 0 + && sp[csi + len] == 'm') { char buf3[MAX_TERMINFO_LENGTH]; (void) strcpy(buf2, "SGR:"); - (void) strncpy(buf3, sp + 2, len); - len += 3; + (void) strncpy(buf3, sp + csi, len); + len += csi + 1; buf3[len] = '\0'; ep = strtok(buf3, ";"); @@ -666,20 +733,46 @@ analyze_string(const char *name, const char *cap, TERMTYPE * tp) buf2[strlen(buf2) - 1] = '\0'; expansion = buf2; } + + if (!expansion + && (csi = skip_csi(sp)) != 0 + && sp[csi] == 'm') { + len = csi + 1; + (void) strcpy(buf2, "SGR:"); + strcat(buf2, ecma_highlights[0].to); + expansion = buf2; + } + /* now check for scroll region reset */ - if (!expansion) { - (void) sprintf(buf2, "\033[1;%dr", tp->Numbers[2]); - len = strlen(buf2); - if (strncmp(buf2, sp, len) == 0) + if (!expansion + && (csi = skip_csi(sp)) != 0) { + if (sp[csi] == 'r') { expansion = "RSR"; + len = 1; + } else { + (void) sprintf(buf2, "1;%dr", tp_lines); + len = strlen(buf2); + if (strncmp(buf2, sp + csi, len) == 0) + expansion = "RSR"; + } + len += csi; } /* now check for home-down */ - if (!expansion) { - (void) sprintf(buf2, "\033[%d;1H", tp->Numbers[2]); + if (!expansion + && (csi = skip_csi(sp)) != 0) { + (void) sprintf(buf2, "%d;1H", tp_lines); len = strlen(buf2); - if (strncmp(buf2, sp, len) == 0) + if (strncmp(buf2, sp + csi, len) == 0) { expansion = "LL"; + } else { + (void) sprintf(buf2, "%dH", tp_lines); + len = strlen(buf2); + if (strncmp(buf2, sp + csi, len) == 0) { + expansion = "LL"; + } + } + len += csi; } /* now look at the expansion we got, if any */ @@ -723,13 +816,13 @@ file_comparison(int argc, char *argv[]) /* parse entries out of the source file */ _nc_set_source(argv[n]); - _nc_read_entry_source(stdin, NULL, TRUE, FALSE, NULLHOOK); + _nc_read_entry_source(stdin, NULL, TRUE, literal, NULLHOOK); if (itrace) (void) fprintf(stderr, "Resolving file %d...\n", n - 0); /* maybe do use resolution */ - if (!_nc_resolve_uses(!limited)) { + if (!_nc_resolve_uses2(!limited, literal)) { (void) fprintf(stderr, "There are unresolved use entries in %s:\n", argv[n]); @@ -898,6 +991,7 @@ usage(void) ," -L use long names" ," -R subset (see manpage)" ," -T eliminate size limits (test)" + ," -U eliminate post-processing of entries" ," -V print version" #if NCURSES_XNAMES ," -a with -F, list commented-out caps" @@ -923,6 +1017,9 @@ usage(void) ," -u produce source with 'use='" ," -v number (verbose)" ," -w number (width)" +#if NCURSES_XNAMES + ," -x treat unknown capabilities as user-defined" +#endif }; const size_t first = 3; const size_t last = SIZEOF(tbl); @@ -973,7 +1070,7 @@ string_variable(const char *type) /* dump C initializers for the terminal type */ static void -dump_initializers(TERMTYPE * term) +dump_initializers(TERMTYPE *term) { unsigned n; int size; @@ -1030,7 +1127,7 @@ dump_initializers(TERMTYPE * term) str = "CANCELLED_BOOLEAN"; break; } - (void) printf("\t/* %3d: %-8s */\t%s,\n", + (void) printf("\t/* %3u: %-8s */\t%s,\n", n, ExtBoolname(term, n, boolnames), str); } (void) printf("%s;\n", R_CURL); @@ -1051,14 +1148,14 @@ dump_initializers(TERMTYPE * term) str = buf; break; } - (void) printf("\t/* %3d: %-8s */\t%s,\n", n, + (void) printf("\t/* %3u: %-8s */\t%s,\n", n, ExtNumname(term, n, numnames), str); } (void) printf("%s;\n", R_CURL); - size = sizeof(TERMTYPE) - + (NUM_BOOLEANS(term) * sizeof(term->Booleans[0])) - + (NUM_NUMBERS(term) * sizeof(term->Numbers[0])); + size = (sizeof(TERMTYPE) + + (NUM_BOOLEANS(term) * sizeof(term->Booleans[0])) + + (NUM_NUMBERS(term) * sizeof(term->Numbers[0]))); (void) printf("static char * %s[] = %s\n", name_initializer("string"), L_CURL); @@ -1071,7 +1168,7 @@ dump_initializers(TERMTYPE * term) else { str = string_variable(ExtStrname(term, n, strnames)); } - (void) printf("\t/* %3d: %-8s */\t%s,\n", n, + (void) printf("\t/* %3u: %-8s */\t%s,\n", n, ExtStrname(term, n, strnames), str); } (void) printf("%s;\n", R_CURL); @@ -1083,15 +1180,15 @@ dump_initializers(TERMTYPE * term) (void) printf("static char * %s[] = %s\n", name_initializer("string_ext"), L_CURL); for (n = BOOLCOUNT; n < NUM_BOOLEANS(term); ++n) { - (void) printf("\t/* %3d: bool */\t\"%s\",\n", + (void) printf("\t/* %3u: bool */\t\"%s\",\n", n, ExtBoolname(term, n, boolnames)); } for (n = NUMCOUNT; n < NUM_NUMBERS(term); ++n) { - (void) printf("\t/* %3d: num */\t\"%s\",\n", + (void) printf("\t/* %3u: num */\t\"%s\",\n", n, ExtNumname(term, n, numnames)); } for (n = STRCOUNT; n < NUM_STRINGS(term); ++n) { - (void) printf("\t/* %3d: str */\t\"%s\",\n", + (void) printf("\t/* %3u: str */\t\"%s\",\n", n, ExtStrname(term, n, strnames)); } (void) printf("%s;\n", R_CURL); @@ -1101,7 +1198,7 @@ dump_initializers(TERMTYPE * term) /* dump C initializers for the terminal type */ static void -dump_termtype(TERMTYPE * term) +dump_termtype(TERMTYPE *term) { (void) printf("\t%s\n\t\t%s,\n", L_CURL, name_initializer("alias")); (void) printf("\t\t(char *)0,\t/* pointer to string table */\n"); @@ -1186,9 +1283,13 @@ main(int argc, char *argv[]) /* where is the terminfo database location going to default to? */ restdir = firstdir = 0; +#if NCURSES_XNAMES + use_extended_names(FALSE); +#endif + while ((c = getopt(argc, argv, - "1A:aB:CcdEeFfGgIiLlnpqR:rs:TtuVv:w:")) != EOF) + "1A:aB:CcdEeFfGgIiLlnpqR:rs:TtUuVv:w:x")) != EOF) switch (c) { case '1': mwidth = 0; @@ -1319,6 +1420,10 @@ main(int argc, char *argv[]) break; #endif + case 'U': + literal = TRUE; + break; + case 'u': compare = C_USEALL; break; @@ -1336,6 +1441,12 @@ main(int argc, char *argv[]) mwidth = optarg_to_number(); break; +#if NCURSES_XNAMES + case 'x': + use_extended_names(TRUE); + break; +#endif + default: usage(); } diff --git a/progs/modules b/progs/modules index 3d065a95..f8224649 100644 --- a/progs/modules +++ b/progs/modules @@ -1,7 +1,7 @@ -# $Id: modules,v 1.10 2000/01/02 01:30:45 tom Exp $ +# $Id: modules,v 1.12 2005/09/25 00:54:22 tom Exp $ # Program modules (some are in ncurses lib!) ############################################################################## -# Copyright (c) 1998-2000 Free Software Foundation, Inc. # +# Copyright (c) 1998-2000,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -32,10 +32,10 @@ # @ base -clear progs $(srcdir) ../include/term.h -tic progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h -toe progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h -dump_entry progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h ../include/parametrized.h $(INCDIR)/capdefaults.c termsort.c -infocmp progs $(srcdir) ../include/term.h $(INCDIR)/tic.h $(srcdir)/dump_entry.h -tput progs $(srcdir) ../include/term.h -tset progs $(srcdir) ../include/term.h +clear progs $(srcdir) $(HEADER_DEPS) +tic progs $(srcdir) $(HEADER_DEPS) transform.h $(srcdir)/dump_entry.h +toe progs $(srcdir) $(HEADER_DEPS) $(srcdir)/dump_entry.h +dump_entry progs $(srcdir) $(HEADER_DEPS) $(srcdir)/dump_entry.h ../include/parametrized.h $(INCDIR)/capdefaults.c termsort.c +infocmp progs $(srcdir) $(HEADER_DEPS) $(srcdir)/dump_entry.h +tput progs $(srcdir) $(HEADER_DEPS) transform.h termsort.c +tset progs $(srcdir) $(HEADER_DEPS) transform.h $(srcdir)/dump_entry.h ../include/termcap.h diff --git a/progs/progs.priv.h b/progs/progs.priv.h index 9d13b3c7..604c56be 100644 --- a/progs/progs.priv.h +++ b/progs/progs.priv.h @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2000 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,10 +27,10 @@ ****************************************************************************/ /**************************************************************************** - * Author: Thomas E. Dickey 1997,1998 * + * Author: Thomas E. Dickey 1997-on * ****************************************************************************/ /* - * $Id: progs.priv.h,v 1.27 2001/06/18 18:43:52 tom Exp $ + * $Id: progs.priv.h,v 1.29 2005/08/06 20:05:32 tom Exp $ * * progs.priv.h * @@ -52,10 +52,6 @@ #if HAVE_UNISTD_H #include -#else -# if HAVE_LIBC_H -# include -# endif #endif #if HAVE_SYS_BSDTYPES_H @@ -71,8 +67,17 @@ #if HAVE_DIRENT_H # include # define NAMLEN(dirent) strlen((dirent)->d_name) +# if defined(_FILE_OFFSET_BITS) && defined(HAVE_STRUCT_DIRENT64) +# if !defined(_LP64) && (_FILE_OFFSET_BITS == 64) +# define DIRENT struct dirent64 +# else +# define DIRENT struct dirent +# endif +# else +# define DIRENT struct dirent +# endif #else -# define dirent direct +# define DIRENT struct direct # define NAMLEN(dirent) (dirent)->d_namlen # if HAVE_SYS_NDIR_H # include diff --git a/progs/tic.c b/progs/tic.c index 6312b5c6..a918efd7 100644 --- a/progs/tic.c +++ b/progs/tic.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -42,23 +42,48 @@ #include #include -#include #include -MODULE_ID("$Id: tic.c,v 1.109 2003/12/06 17:36:57 tom Exp $") +MODULE_ID("$Id: tic.c,v 1.125 2005/09/25 00:39:43 tom Exp $") const char *_nc_progname = "tic"; static FILE *log_fp; static FILE *tmp_fp; +static bool capdump = FALSE; /* running as infotocap? */ +static bool infodump = FALSE; /* running as captoinfo? */ static bool showsummary = FALSE; static const char *to_remove; -static int tparm_errs; -static void (*save_check_termtype) (TERMTYPE *); -static void check_termtype(TERMTYPE * tt); - -static const char usage_string[] = "[-V] [-v[n]] [-e names] [-o dir] [-R name] [-CILNTcfrswx1] source-file\n"; +static void (*save_check_termtype) (TERMTYPE *, bool); +static void check_termtype(TERMTYPE *tt, bool); + +static const char usage_string[] = "\ +[-e names] \ +[-o dir] \ +[-R name] \ +[-v[n]] \ +[-V] \ +[-w[n]] \ +[-\ +1\ +a\ +C\ +c\ +f\ +G\ +g\ +I\ +L\ +N\ +r\ +s\ +T\ +t\ +U\ +x\ +] \ +source-file\n"; static void cleanup(void) @@ -109,6 +134,7 @@ usage(void) #if NCURSES_XNAMES " -t suppress commented-out capabilities", #endif + " -U suppress post-processing of entries", " -V print version", " -v[n] set verbosity level", " -w[n] set format width for translation output", @@ -381,7 +407,7 @@ make_namelist(char *src) if (showsummary) { fprintf(log_fp, "Entries that will be compiled:\n"); for (n = 0; dst[n] != 0; n++) - fprintf(log_fp, "%d:%s\n", n + 1, dst[n]); + fprintf(log_fp, "%u:%s\n", n + 1, dst[n]); } return dst; } @@ -436,9 +462,8 @@ main(int argc, char *argv[]) int width = 60; bool formatted = FALSE; /* reformat complex strings? */ + bool literal = FALSE; /* suppress post-processing? */ int numbers = 0; /* format "%'char'" to/from "%{number}" */ - bool infodump = FALSE; /* running as captoinfo? */ - bool capdump = FALSE; /* running as infotocap? */ bool forceresolve = FALSE; /* force resolution */ bool limited = TRUE; char *tversion = (char *) NULL; @@ -470,7 +495,7 @@ main(int argc, char *argv[]) * be optional. */ while ((this_opt = getopt(argc, argv, - "0123456789CILNR:TVace:fGgo:rstvwx")) != EOF) { + "0123456789CILNR:TUVace:fGgo:rstvwx")) != EOF) { if (isdigit(this_opt)) { switch (last_opt) { case 'v': @@ -505,6 +530,7 @@ main(int argc, char *argv[]) break; case 'N': smart_defaults = FALSE; + literal = TRUE; break; case 'R': tversion = optarg; @@ -512,6 +538,9 @@ main(int argc, char *argv[]) case 'T': limited = FALSE; break; + case 'U': + literal = TRUE; + break; case 'V': puts(curses_version()); return EXIT_SUCCESS; @@ -567,8 +596,8 @@ main(int argc, char *argv[]) set_trace_level(debug_level); if (_nc_tracing) { - save_check_termtype = _nc_check_termtype; - _nc_check_termtype = check_termtype; + save_check_termtype = _nc_check_termtype2; + _nc_check_termtype2 = check_termtype; } #if !HAVE_BIG_CORE /* @@ -585,7 +614,7 @@ main(int argc, char *argv[]) (void) fprintf(stderr, "Sorry, -e can't be used without -I or -C\n"); cleanup(); - return EXIT_FAILURE; + ExitProgram(EXIT_FAILURE); } #endif /* HAVE_BIG_CORE */ @@ -597,7 +626,7 @@ main(int argc, char *argv[]) _nc_progname, _nc_progname, usage_string); - return EXIT_FAILURE; + ExitProgram(EXIT_FAILURE); } } else { if (infodump == TRUE) { @@ -628,7 +657,7 @@ main(int argc, char *argv[]) _nc_progname, usage_string); cleanup(); - return EXIT_FAILURE; + ExitProgram(EXIT_FAILURE); } } @@ -653,14 +682,16 @@ main(int argc, char *argv[]) _nc_set_writedir(outdir); #endif /* HAVE_BIG_CORE */ _nc_read_entry_source(tmp_fp, (char *) NULL, - !smart_defaults, FALSE, - (check_only || infodump || capdump) ? NULLHOOK : immedhook); + !smart_defaults || literal, FALSE, + ((check_only || infodump || capdump) + ? NULLHOOK + : immedhook)); /* do use resolution */ if (check_only || (!infodump && !capdump) || forceresolve) { - if (!_nc_resolve_uses(TRUE) && !check_only) { + if (!_nc_resolve_uses2(TRUE, literal) && !check_only) { cleanup(); - return EXIT_FAILURE; + ExitProgram(EXIT_FAILURE); } } @@ -754,7 +785,7 @@ main(int argc, char *argv[]) fprintf(log_fp, "No entries written\n"); } cleanup(); - return (EXIT_SUCCESS); + ExitProgram(EXIT_SUCCESS); } /* @@ -772,7 +803,7 @@ TERMINAL *cur_term; /* tweak to avoid linking lib_cur_term.c */ * Check if the alternate character-set capabilities are consistent. */ static void -check_acs(TERMTYPE * tp) +check_acs(TERMTYPE *tp) { if (VALID_STRING(acs_chars)) { const char *boxes = "lmkjtuvwqxn"; @@ -808,7 +839,7 @@ check_acs(TERMTYPE * tp) * Check if the color capabilities are consistent */ static void -check_colors(TERMTYPE * tp) +check_colors(TERMTYPE *tp) { if ((max_colors > 0) != (max_pairs > 0) || ((max_colors > max_pairs) && (initialize_pair == 0))) @@ -821,12 +852,12 @@ check_colors(TERMTYPE * tp) if (VALID_STRING(set_foreground) && VALID_STRING(set_a_foreground) - && !strcmp(set_foreground, set_a_foreground)) + && !_nc_capcmp(set_foreground, set_a_foreground)) _nc_warning("expected setf/setaf to be different"); if (VALID_STRING(set_background) && VALID_STRING(set_a_background) - && !strcmp(set_background, set_a_background)) + && !_nc_capcmp(set_background, set_a_background)) _nc_warning("expected setb/setab to be different"); /* see: has_colors() */ @@ -877,7 +908,7 @@ keypad_index(const char *string) * is mapped inconsistently. */ static void -check_keypad(TERMTYPE * tp) +check_keypad(TERMTYPE *tp) { char show[80]; @@ -1075,7 +1106,7 @@ expected_params(const char *name) * markers. */ static void -check_params(TERMTYPE * tp, const char *name, char *value) +check_params(TERMTYPE *tp, const char *name, char *value) { int expected = expected_params(name); int actual = 0; @@ -1135,6 +1166,43 @@ skip_delay(char *s) return s; } +/* + * Skip a delay altogether, e.g., when comparing a simple string to sgr, + * the latter may have a worst-case delay on the end. + */ +static char * +ignore_delays(char *s) +{ + int delaying = 0; + + do { + switch (*s) { + case '$': + if (delaying == 0) + delaying = 1; + break; + case '<': + if (delaying == 1) + delaying = 2; + break; + case '\0': + delaying = 0; + break; + default: + if (delaying) { + s = skip_delay(s); + if (*s == '>') + ++s; + delaying = 0; + } + break; + } + if (delaying) + ++s; + } while (delaying); + return s; +} + /* * An sgr string may contain several settings other than the one we're * interested in, essentially sgr0 + rmacs + whatever. As long as the @@ -1197,23 +1265,27 @@ similar_sgr(int num, char *a, char *b) a++; b++; } - return TRUE; + /* ignore delays on the end of the string */ + a = ignore_delays(a); + return ((num != 0) || (*a == 0)); } -static void -check_sgr(TERMTYPE * tp, char *zero, int num, char *cap, const char *name) +static char * +check_sgr(TERMTYPE *tp, char *zero, int num, char *cap, const char *name) { - char *test = tparm(set_attributes, - num == 1, - num == 2, - num == 3, - num == 4, - num == 5, - num == 6, - num == 7, - num == 8, - num == 9); - tparm_errs += _nc_tparm_err; + char *test; + + _nc_tparm_err = 0; + test = tparm(set_attributes, + num == 1, + num == 2, + num == 3, + num == 4, + num == 5, + num == 6, + num == 7, + num == 8, + num == 9); if (test != 0) { if (PRESENT(cap)) { if (!similar_sgr(num, test, cap)) { @@ -1222,21 +1294,47 @@ check_sgr(TERMTYPE * tp, char *zero, int num, char *cap, const char *name) name, _nc_visbuf2(1, cap), num, _nc_visbuf2(2, test)); } - } else if (strcmp(test, zero)) { + } else if (_nc_capcmp(test, zero)) { _nc_warning("sgr(%d) present, but not %s", num, name); } } else if (PRESENT(cap)) { _nc_warning("sgr(%d) missing, but %s present", num, name); } + if (_nc_tparm_err) + _nc_warning("stack error in sgr(%d) string", num); + return test; } #define CHECK_SGR(num,name) check_sgr(tp, zero, num, name, #name) +#ifdef TRACE +/* + * If tic is compiled with TRACE, we'll be able to see the output from the + * DEBUG() macro. But since it doesn't use traceon(), it always goes to + * the standard error. Use this function to make it simpler to follow the + * resulting debug traces. + */ +static void +show_where(unsigned level) +{ + if (_nc_tracing >= level) { + char my_name[256]; + _nc_get_type(my_name); + fprintf(stderr, "\"%s\", line %d, '%s' ", + _nc_get_source(), + _nc_curr_line, my_name); + } +} + +#else +#define show_where(level) /* nothing */ +#endif + /* other sanity-checks (things that we don't want in the normal * logic that reads a terminfo entry) */ static void -check_termtype(TERMTYPE * tp) +check_termtype(TERMTYPE *tp, bool literal) { bool conflict = FALSE; unsigned j, k; @@ -1247,37 +1345,39 @@ check_termtype(TERMTYPE * tp) * a given string (e.g., KEY_END and KEY_LL). But curses will only * return one (the last one assigned). */ - memset(fkeys, 0, sizeof(fkeys)); - for (j = 0; _nc_tinfo_fkeys[j].code; j++) { - char *a = tp->Strings[_nc_tinfo_fkeys[j].offset]; - bool first = TRUE; - if (!VALID_STRING(a)) - continue; - for (k = j + 1; _nc_tinfo_fkeys[k].code; k++) { - char *b = tp->Strings[_nc_tinfo_fkeys[k].offset]; - if (!VALID_STRING(b) - || fkeys[k]) + if (!(_nc_syntax == SYN_TERMCAP && capdump)) { + memset(fkeys, 0, sizeof(fkeys)); + for (j = 0; _nc_tinfo_fkeys[j].code; j++) { + char *a = tp->Strings[_nc_tinfo_fkeys[j].offset]; + bool first = TRUE; + if (!VALID_STRING(a)) continue; - if (!strcmp(a, b)) { - fkeys[j] = 1; - fkeys[k] = 1; - if (first) { - if (!conflict) { - _nc_warning("Conflicting key definitions (using the last)"); - conflict = TRUE; + for (k = j + 1; _nc_tinfo_fkeys[k].code; k++) { + char *b = tp->Strings[_nc_tinfo_fkeys[k].offset]; + if (!VALID_STRING(b) + || fkeys[k]) + continue; + if (!_nc_capcmp(a, b)) { + fkeys[j] = 1; + fkeys[k] = 1; + if (first) { + if (!conflict) { + _nc_warning("Conflicting key definitions (using the last)"); + conflict = TRUE; + } + fprintf(stderr, "... %s is the same as %s", + keyname((int) _nc_tinfo_fkeys[j].code), + keyname((int) _nc_tinfo_fkeys[k].code)); + first = FALSE; + } else { + fprintf(stderr, ", %s", + keyname((int) _nc_tinfo_fkeys[k].code)); } - fprintf(stderr, "... %s is the same as %s", - keyname(_nc_tinfo_fkeys[j].code), - keyname(_nc_tinfo_fkeys[k].code)); - first = FALSE; - } else { - fprintf(stderr, ", %s", - keyname(_nc_tinfo_fkeys[k].code)); } } + if (!first) + fprintf(stderr, "\n"); } - if (!first) - fprintf(stderr, "\n"); } for (j = 0; j < NUM_STRINGS(tp); j++) { @@ -1298,7 +1398,7 @@ check_termtype(TERMTYPE * tp) ANDMISSING(cursor_visible, cursor_normal); if (PRESENT(cursor_visible) && PRESENT(cursor_normal) - && !strcmp(cursor_visible, cursor_normal)) + && !_nc_capcmp(cursor_visible, cursor_normal)) _nc_warning("cursor_visible is same as cursor_normal"); /* @@ -1309,24 +1409,75 @@ check_termtype(TERMTYPE * tp) ANDMISSING(change_scroll_region, save_cursor); ANDMISSING(change_scroll_region, restore_cursor); - tparm_errs = 0; if (PRESENT(set_attributes)) { - char *zero = tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, 0); - - zero = strdup(zero); - CHECK_SGR(1, enter_standout_mode); - CHECK_SGR(2, enter_underline_mode); - CHECK_SGR(3, enter_reverse_mode); - CHECK_SGR(4, enter_blink_mode); - CHECK_SGR(5, enter_dim_mode); - CHECK_SGR(6, enter_bold_mode); - CHECK_SGR(7, enter_secure_mode); - CHECK_SGR(8, enter_protected_mode); - CHECK_SGR(9, enter_alt_charset_mode); - free(zero); - if (tparm_errs) - _nc_warning("stack error in sgr string"); + char *zero = 0; + + _nc_tparm_err = 0; + if (PRESENT(exit_attribute_mode)) { + zero = strdup(CHECK_SGR(0, exit_attribute_mode)); + } else { + zero = strdup(tparm(set_attributes, 0, 0, 0, 0, 0, 0, 0, 0, 0)); + } + if (_nc_tparm_err) + _nc_warning("stack error in sgr(0) string"); + + if (zero != 0) { + CHECK_SGR(1, enter_standout_mode); + CHECK_SGR(2, enter_underline_mode); + CHECK_SGR(3, enter_reverse_mode); + CHECK_SGR(4, enter_blink_mode); + CHECK_SGR(5, enter_dim_mode); + CHECK_SGR(6, enter_bold_mode); + CHECK_SGR(7, enter_secure_mode); + CHECK_SGR(8, enter_protected_mode); + CHECK_SGR(9, enter_alt_charset_mode); + free(zero); + } else { + _nc_warning("sgr(0) did not return a value"); + } + } else if (PRESENT(exit_attribute_mode) && + set_attributes != CANCELLED_STRING) { + if (_nc_syntax == SYN_TERMINFO) + _nc_warning("missing sgr string"); + } + + if (PRESENT(exit_attribute_mode)) { + char *check_sgr0 = _nc_trim_sgr0(tp); + + if (check_sgr0 == 0 || *check_sgr0 == '\0') { + _nc_warning("trimmed sgr0 is empty"); + } else { + show_where(2); + if (check_sgr0 != exit_attribute_mode) { + DEBUG(2, + ("will trim sgr0\n\toriginal sgr0=%s\n\ttrimmed sgr0=%s", + _nc_visbuf2(1, exit_attribute_mode), + _nc_visbuf2(2, check_sgr0))); + free(check_sgr0); + } else { + DEBUG(2, + ("will not trim sgr0\n\toriginal sgr0=%s", + _nc_visbuf(exit_attribute_mode))); + } + } } +#ifdef TRACE + show_where(2); + if (!auto_right_margin) { + DEBUG(2, + ("can write to lower-right directly")); + } else if (PRESENT(enter_am_mode) && PRESENT(exit_am_mode)) { + DEBUG(2, + ("can write to lower-right by suppressing automargin")); + } else if ((PRESENT(enter_insert_mode) && PRESENT(exit_insert_mode)) + || PRESENT(insert_character) || PRESENT(parm_ich)) { + DEBUG(2, + ("can write to lower-right by using inserts")); + } else { + DEBUG(2, + ("cannot write to lower-right")); + } +#endif /* * Some standard applications (e.g., vi) and some non-curses @@ -1343,5 +1494,5 @@ check_termtype(TERMTYPE * tp) * Finally, do the non-verbose checks */ if (save_check_termtype != 0) - save_check_termtype(tp); + save_check_termtype(tp, literal); } diff --git a/progs/toe.c b/progs/toe.c index abeffde1..91777db7 100644 --- a/progs/toe.c +++ b/progs/toe.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -41,9 +42,8 @@ #include #include -#include -MODULE_ID("$Id: toe.c,v 1.27 2002/10/06 01:22:05 tom Exp $") +MODULE_ID("$Id: toe.c,v 1.29 2005/09/25 00:39:43 tom Exp $") #define isDotname(name) (!strcmp(name, ".") || !strcmp(name, "..")) @@ -237,7 +237,7 @@ typelist(int eargc, char *eargv[], for (i = 0; i < eargc; i++) { DIR *termdir; - struct dirent *subdir; + DIRENT *subdir; if ((termdir = opendir(eargv[i])) == 0) { (void) fflush(stdout); @@ -253,7 +253,7 @@ typelist(int eargc, char *eargv[], char buf[PATH_MAX]; char name_1[PATH_MAX]; DIR *entrydir; - struct dirent *entry; + DIRENT *entry; strncpy(name_1, subdir->d_name, len)[len] = '\0'; if (isDotname(name_1)) diff --git a/progs/tput.c b/progs/tput.c index 70b762f7..18b2d165 100644 --- a/progs/tput.c +++ b/progs/tput.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -45,7 +45,7 @@ #endif #include -MODULE_ID("$Id: tput.c,v 1.34 2004/01/16 23:23:11 Daniel.Jacobowitz Exp $") +MODULE_ID("$Id: tput.c,v 1.35 2005/04/03 14:25:32 tom Exp $") #define PUTS(s) fputs(s, stdout) #define PUTCHAR(c) putchar(c) @@ -151,7 +151,6 @@ tput(int argc, char *argv[]) int i, j, c; int status; FILE *f; - int token = UNDEF; if ((name = argv[0]) == 0) name = ""; @@ -295,7 +294,6 @@ tput(int argc, char *argv[]) } else if ((s = tigetstr(name)) == CANCELLED_STRING) { quit(4, "unknown terminfo capability '%s'", name); } else if (s != ABSENT_STRING) { - token = STRING; if (argc > 1) { int k; int popcount; @@ -360,7 +358,6 @@ main(int argc, char **argv) int c; char buf[BUFSIZ]; int result = 0; - int err; check_aliases(prg_name = _nc_rootname(argv[0])); @@ -428,7 +425,7 @@ main(int argc, char **argv) argvec[argnum] = 0; if (argnum != 0 - && (err = tput(argnum, argvec)) != 0) { + && tput(argnum, argvec) != 0) { if (result == 0) result = 4; /* will return value >4 */ ++result; diff --git a/progs/tset.c b/progs/tset.c index f67931f0..41a35fcd 100644 --- a/progs/tset.c +++ b/progs/tset.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,6 +29,7 @@ /**************************************************************************** * Author: Zeyd M. Ben-Halim 1992,1995 * * and: Eric S. Raymond * + * and: Thomas E. Dickey 1996-on * ****************************************************************************/ /* @@ -99,11 +100,10 @@ char *ttyname(int fd); #include #endif -#include /* for bool typedef */ #include #include -MODULE_ID("$Id: tset.c,v 0.56 2003/12/06 17:21:01 tom Exp $") +MODULE_ID("$Id: tset.c,v 1.60 2005/09/25 00:43:52 tom Exp $") extern char **environ; @@ -114,6 +114,9 @@ const char *_nc_progname = "tset"; static TTY mode, oldmode, original; +static bool opt_c; /* set control-chars */ +static bool opt_w; /* set window-size */ + static bool can_restore = FALSE; static bool isreset = FALSE; /* invoked as reset */ static int terasechar = -1; /* new erase character */ @@ -151,7 +154,7 @@ err(const char *fmt,...) { va_list ap; va_start(ap, fmt); - (void) fprintf(stderr, "tset: "); + (void) fprintf(stderr, "%s: ", _nc_progname); (void) vfprintf(stderr, fmt, ap); va_end(ap); exit_error(); @@ -162,7 +165,15 @@ static void failed(const char *msg) { char temp[BUFSIZ]; - perror(strncat(strcpy(temp, "tset: "), msg, sizeof(temp) - 10)); + unsigned len = strlen(_nc_progname) + 2; + + if (len < sizeof(temp) - 12) { + strcpy(temp, _nc_progname); + strcat(temp, ": "); + } else { + strcpy(temp, "tset: "); + } + perror(strncat(temp, msg, sizeof(temp) - strlen(temp) - 2)); exit_error(); /* NOTREACHED */ } @@ -603,13 +614,13 @@ get_termcap_entry(char *userarg) while (setupterm((NCURSES_CONST char *) ttype, STDOUT_FILENO, &errret) != OK) { if (errret == 0) { - (void) fprintf(stderr, "tset: unknown terminal type %s\n", - ttype); + (void) fprintf(stderr, "%s: unknown terminal type %s\n", + _nc_progname, ttype); ttype = 0; } else { (void) fprintf(stderr, - "tset: can't initialize terminal type %s (error %d)\n", - ttype, errret); + "%s: can't initialize terminal type %s (error %d)\n", + _nc_progname, ttype, errret); ttype = 0; } ttype = askuser(ttype); @@ -972,10 +983,10 @@ set_tabs() * used to try a bunch of half-clever things * with cup and hpa, for an average saving of * somewhat less than two character times per - * tab stop, less that .01 sec at 2400cps. We + * tab stop, less than .01 sec at 2400cps. We * lost all this cruft because it seemed to be * introducing some odd bugs. - * ----------12345678----------- */ + * -----------12345678----------- */ (void) fputs(" ", stderr); tputs(set_tab, 0, outc); } @@ -1021,9 +1032,9 @@ report(const char *name, int which, unsigned def) (void) fprintf(stderr, "backspace.\n"); else if (newer < 040) { newer ^= 0100; - (void) fprintf(stderr, "control-%c (^%c).\n", newer, newer); + (void) fprintf(stderr, "control-%c (^%c).\n", UChar(newer), UChar(newer)); } else - (void) fprintf(stderr, "%c.\n", newer); + (void) fprintf(stderr, "%c.\n", UChar(newer)); } #endif @@ -1062,10 +1073,28 @@ obsolete(char **argv) } static void -usage(const char *pname) +usage(void) { - (void) fprintf(stderr, - "usage: %s [-IQVrs] [-] [-e ch] [-i ch] [-k ch] [-m mapping] [terminal]", pname); + static const char *tbl[] = + { + "" + ,"Options:" + ," -c set control characters" + ," -e ch erase character" + ," -I no initialization strings" + ," -i ch interrupt character" + ," -k ch kill character" + ," -m mapping map identifier to type" + ," -Q do not output control key settings" + ," -r display term on stderr" + ," -s output TERM set command" + ," -V print curses-version" + ," -w set window-size" + }; + unsigned n; + (void) fprintf(stderr, "Usage: %s [options] [terminal]\n", _nc_progname); + for (n = 0; n < sizeof(tbl) / sizeof(tbl[0]); ++n) + fprintf(stderr, "%s\n", tbl[n]); exit_error(); /* NOTREACHED */ } @@ -1088,28 +1117,12 @@ main(int argc, char **argv) const char *p; const char *ttype; - if (GET_TTY(STDERR_FILENO, &mode) < 0) - failed("standard error"); - can_restore = TRUE; - original = oldmode = mode; -#ifdef TERMIOS - ospeed = cfgetospeed(&mode); -#else - ospeed = mode.sg_ospeed; -#endif - - p = _nc_rootname(*argv); - if (!strcmp(p, PROG_RESET)) { - isreset = TRUE; - reset_mode(); - } - obsolete(argv); noinit = noset = quiet = Sflag = sflag = showterm = 0; - while ((ch = getopt(argc, argv, "a:d:e:Ii:k:m:np:qQSrsV")) != EOF) { + while ((ch = getopt(argc, argv, "a:cd:e:Ii:k:m:np:qQSrsVw")) != EOF) { switch (ch) { - case 'q': /* display term only */ - noset = 1; + case 'c': /* set control-chars */ + opt_c = TRUE; break; case 'a': /* OBSOLETE: map identifier to type */ add_mapping("arpanet", optarg); @@ -1140,28 +1153,54 @@ main(int argc, char **argv) case 'Q': /* don't output control key settings */ quiet = 1; break; - case 'S': /* OBSOLETE: output TERM & TERMCAP */ - Sflag = 1; + case 'q': /* display term only */ + noset = 1; break; case 'r': /* display term on stderr */ showterm = 1; break; + case 'S': /* OBSOLETE: output TERM & TERMCAP */ + Sflag = 1; + break; case 's': /* output TERM set command */ sflag = 1; break; - case 'V': + case 'V': /* print curses-version */ puts(curses_version()); return EXIT_SUCCESS; + case 'w': /* set window-size */ + opt_w = TRUE; + break; case '?': default: - usage(*argv); + usage(); } } + + _nc_progname = _nc_rootname(*argv); argc -= optind; argv += optind; if (argc > 1) - usage(*argv); + usage(); + + if (!opt_c && !opt_w) + opt_c = opt_w = TRUE; + + if (GET_TTY(STDERR_FILENO, &mode) < 0) + failed("standard error"); + can_restore = TRUE; + original = oldmode = mode; +#ifdef TERMIOS + ospeed = cfgetospeed(&mode); +#else + ospeed = mode.sg_ospeed; +#endif + + if (!strcmp(_nc_progname, PROG_RESET)) { + isreset = TRUE; + reset_mode(); + } ttype = get_termcap_entry(*argv); @@ -1170,24 +1209,28 @@ main(int argc, char **argv) tlines = lines; #if defined(TIOCGWINSZ) && defined(TIOCSWINSZ) - /* Set window size */ - (void) ioctl(STDERR_FILENO, TIOCGWINSZ, &win); - if (win.ws_row == 0 && win.ws_col == 0 && - tlines > 0 && tcolumns > 0) { - win.ws_row = tlines; - win.ws_col = tcolumns; - (void) ioctl(STDERR_FILENO, TIOCSWINSZ, &win); + if (opt_w) { + /* Set window size */ + (void) ioctl(STDERR_FILENO, TIOCGWINSZ, &win); + if (win.ws_row == 0 && win.ws_col == 0 && + tlines > 0 && tcolumns > 0) { + win.ws_row = tlines; + win.ws_col = tcolumns; + (void) ioctl(STDERR_FILENO, TIOCSWINSZ, &win); + } } #endif - set_control_chars(); - set_conversions(); + if (opt_c) { + set_control_chars(); + set_conversions(); - if (!noinit) - set_init(); + if (!noinit) + set_init(); - /* Set the modes if they've changed. */ - if (memcmp(&mode, &oldmode, sizeof(mode))) { - SET_TTY(STDERR_FILENO, &mode); + /* Set the modes if they've changed. */ + if (memcmp(&mode, &oldmode, sizeof(mode))) { + SET_TTY(STDERR_FILENO, &mode); + } } } diff --git a/tack/COPYING b/tack/COPYING index 60549be5..b6f92f3d 100644 --- a/tack/COPYING +++ b/tack/COPYING @@ -2,7 +2,7 @@ Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc. - 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. @@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. - Copyright (C) 19yy + Copyright (C) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -305,7 +305,7 @@ the "copyright" line and a pointer to where the full notice is found. You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software - Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA Also add information on how to contact you by electronic and paper mail. @@ -313,7 +313,7 @@ Also add information on how to contact you by electronic and paper mail. If the program is interactive, make it output a short notice like this when it starts in an interactive mode: - Gnomovision version 69, Copyright (C) 19yy name of author + Gnomovision version 69, Copyright (C) year name of author Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. diff --git a/tack/Makefile.in b/tack/Makefile.in index dd7b8b2e..b278f7dd 100644 --- a/tack/Makefile.in +++ b/tack/Makefile.in @@ -1,4 +1,4 @@ -# $Id: Makefile.in,v 1.31 2003/11/01 22:46:24 tom Exp $ +# $Id: Makefile.in,v 1.35 2005/06/18 23:01:59 tom Exp $ # Makefile for tack # # The variable 'srcdir' refers to the source-distribution, and can be set with @@ -26,7 +26,7 @@ prefix = @prefix@ exec_prefix = @exec_prefix@ bindir = @bindir@ libdir = @libdir@ -mandir = @mandir@/man1 +mandir = @mandir@ includedir = @includedir@ datadir = @datadir@ @@ -64,7 +64,7 @@ CFLAGS_DEFAULT = $(CFLAGS_@DFT_UPR_MODEL@) LD = @LD@ LINK = @LINK_PROGS@ $(LIBTOOL_LINK) $(CC) LDFLAGS = @EXTRA_LDFLAGS@ \ - @PROG_ARGS@ @LDFLAGS@ @LD_MODEL@ @LIBS@ @EXTRA_LIBS@ + @TINFO_ARGS@ @LDFLAGS@ @LD_MODEL@ @LIBS@ LDFLAGS_LIBTOOL = $(LDFLAGS) $(CFLAGS_LIBTOOL) LDFLAGS_NORMAL = $(LDFLAGS) $(CFLAGS_NORMAL) @@ -96,15 +96,17 @@ libs \ install.libs \ uninstall.libs: +EDITARGS = $(DESTDIR)$(mandir) $(srcdir) $(srcdir)/*.[0-9]* + install.tack: $(PROGS) \ $(DESTDIR)$(bindir) \ $(DESTDIR)$(mandir) $(LIBTOOL_INSTALL) $(INSTALL_PROGRAM) tack$x $(DESTDIR)$(bindir)/tack$x - $(INSTALL_DATA) $(srcdir)/tack.1 $(DESTDIR)$(mandir)/tack.1 + sh ../edit_man.sh normal installing $(EDITARGS) uninstall.tack: -@$(LIBTOOL_UNINSTALL) rm -f $(DESTDIR)$(bindir)/tack$x - -@rm -f $(DESTDIR)$(mandir)/tack.1 + -sh ../edit_man.sh normal removing $(EDITARGS) $(DESTDIR)$(bindir) \ $(DESTDIR)$(mandir) : diff --git a/tack/ansi.c b/tack/ansi.c index 807bc539..bdbd4337 100644 --- a/tack/ansi.c +++ b/tack/ansi.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include -MODULE_ID("$Id: ansi.c,v 1.9 2001/06/18 18:44:17 tom Exp $") +MODULE_ID("$Id: ansi.c,v 1.10 2005/09/17 19:49:16 tom Exp $") /* * Standalone tests for ANSI terminals. Three entry points: diff --git a/tack/charset.c b/tack/charset.c index 991401f3..f1a066e2 100644 --- a/tack/charset.c +++ b/tack/charset.c @@ -1,27 +1,27 @@ /* ** Copyright (C) 1991, 1997-2000 Free Software Foundation, Inc. -** +** ** This file is part of TACK. -** +** ** TACK is free software; you can redistribute it and/or modify ** it under the terms of the GNU General Public License as published by ** the Free Software Foundation; either version 2, or (at your option) ** any later version. -** +** ** TACK is distributed in the hope that it will be useful, ** but WITHOUT ANY WARRANTY; without even the implied warranty of ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ** GNU General Public License for more details. -** +** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include -MODULE_ID("$Id: charset.c,v 1.8 2001/06/18 18:44:26 tom Exp $") +MODULE_ID("$Id: charset.c,v 1.10 2005/09/17 19:49:16 tom Exp $") /* Menu definitions for alternate character set and SGR tests. @@ -194,7 +194,7 @@ charset_dsl( } -void +void eat_cookie(void) { /* put a blank if this is not a magic cookie terminal */ @@ -203,7 +203,7 @@ eat_cookie(void) } -void +void put_mode(char *s) { /* send the attribute string (with or without % execution) */ @@ -285,7 +285,7 @@ charset_sgr( } put_crlf(); -#ifdef max_attributes +#ifdef max_attributes if (max_attributes >= 0) { sprintf(temp, "(ma) Maximum attributes %d ", max_attributes); ptext(temp); @@ -488,20 +488,20 @@ test_acs( #ifdef ACS_ULCORNER maybe_wait(5); put_mode(enter_alt_charset_mode); - put_this(ACS_ULCORNER); - put_this(ACS_TTEE); - put_this(ACS_URCORNER); - put_this(ACS_ULCORNER); - put_this(ACS_HLINE); - put_this(ACS_URCORNER); + put_that(ACS_ULCORNER); + put_that(ACS_TTEE); + put_that(ACS_URCORNER); + put_that(ACS_ULCORNER); + put_that(ACS_HLINE); + put_that(ACS_URCORNER); char_count += 6; put_mode(exit_alt_charset_mode); put_crlf(); put_mode(enter_alt_charset_mode); - put_this(ACS_LTEE); - put_this(ACS_PLUS); - put_this(ACS_RTEE); - put_this(ACS_VLINE); + put_that(ACS_LTEE); + put_that(ACS_PLUS); + put_that(ACS_RTEE); + put_that(ACS_VLINE); if (magic_cookie_glitch >= 1) put_this(' '); else { @@ -509,18 +509,18 @@ test_acs( put_this(' '); put_mode(enter_alt_charset_mode); } - put_this(ACS_VLINE); + put_that(ACS_VLINE); char_count += 6; put_mode(exit_alt_charset_mode); put_str(" Here are 2 boxes"); put_crlf(); put_mode(enter_alt_charset_mode); - put_this(ACS_LLCORNER); - put_this(ACS_BTEE); - put_this(ACS_LRCORNER); - put_this(ACS_LLCORNER); - put_this(ACS_HLINE); - put_this(ACS_LRCORNER); + put_that(ACS_LLCORNER); + put_that(ACS_BTEE); + put_that(ACS_LRCORNER); + put_that(ACS_LLCORNER); + put_that(ACS_HLINE); + put_that(ACS_LRCORNER); char_count += 6; put_mode(exit_alt_charset_mode); put_crlf(); diff --git a/tack/color.c b/tack/color.c index 17f71f0b..fa2d5d91 100644 --- a/tack/color.c +++ b/tack/color.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include -MODULE_ID("$Id: color.c,v 1.5 2004/01/16 23:14:25 Jochen.Voss Exp $") +MODULE_ID("$Id: color.c,v 1.6 2005/09/17 19:49:16 tom Exp $") /* * Color terminal tests. Has only one entry point: test_color(). diff --git a/tack/control.c b/tack/control.c index 4a85384b..54736d36 100644 --- a/tack/control.c +++ b/tack/control.c @@ -15,8 +15,8 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include @@ -25,7 +25,7 @@ #include #endif -MODULE_ID("$Id: control.c,v 1.3 2000/03/04 21:10:59 tom Exp $") +MODULE_ID("$Id: control.c,v 1.8 2005/09/17 19:49:16 tom Exp $") /* terminfo test program control subroutines */ @@ -40,11 +40,11 @@ int test_complete; /* counts number of tests completed */ char txt_longer_test_time[80]; /* +) use longer time */ char txt_shorter_test_time[80]; /* -) use shorter time */ -int pad_test_duration = 1; /* number of seconds for a pad test */ +static int pad_test_duration = 1; /* number of seconds for a pad test */ int auto_pad_mode; /* run the time tests */ int no_alarm_event; /* TRUE if the alarm has not gone off yet */ -int usec_run_time; /* length of last test in microseconds */ -MY_TIMER stop_watch[MAX_TIMERS]; /* Hold the start timers */ +unsigned long usec_run_time; /* length of last test in microseconds */ +static MY_TIMER stop_watch[MAX_TIMERS]; /* Hold the start timers */ char txt_longer_augment[80]; /* >) use bigger augment */ char txt_shorter_augment[80]; /* <) use smaller augment */ @@ -66,16 +66,13 @@ int tx_index[TT_MAX]; /* String index */ int tx_delay[TT_MAX]; /* Number of milliseconds delay */ int txp; /* number of entries used */ int tx_characters; /* printing characters sent by test */ -int tx_cps; /* characters per second */ -struct test_list *tx_source; /* The test that generated this data */ - -extern struct test_menu pad_menu; /* Pad menu structure */ -extern struct test_list pad_test_list[]; +unsigned long tx_cps; /* characters per second */ +static struct test_list *tx_source; /* The test that generated this data */ #define RESULT_BLOCK 1024 static int blocks; /* number of result blocks available */ static struct test_results *results; /* pointer to next available */ -struct test_results *pads[STRCOUNT]; /* save pad results here */ +static struct test_results *pads[STRCOUNT]; /* save pad results here */ /* ** event_start(number) @@ -365,7 +362,7 @@ int sliding_scale( int dividend, int factor, - int divisor) + unsigned long divisor) { double d = dividend; @@ -500,7 +497,7 @@ show_cap_results( ptext(temp); while (r) { sprintf(temp, "$<%d>", r->delay / 1000); - put_columns(temp, strlen(temp), 10); + put_columns(temp, (int) strlen(temp), 10); r = r->next; } r = pads[x]; @@ -508,7 +505,7 @@ show_cap_results( if (r->reps > 1) { delay = r->delay / (r->reps * 100); sprintf(temp, "$<%d.%d*>", delay / 10, delay % 10); - put_columns(temp, strlen(temp), 10); + put_columns(temp, (int) strlen(temp), 10); } r = r->next; } @@ -544,9 +541,9 @@ dump_test_stats( put_crlf(); } } - sprintf(tbuf, "%011u", usec_run_time); - sprintf(temp, "Test time: %d.%s, characters per second %d, characters %d", - usec_run_time / 1000000, &tbuf[5], tx_cps, tx_characters); + sprintf(tbuf, "%011lu", usec_run_time); + sprintf(temp, "Test time: %lu.%s, characters per second %lu, characters %d", + usec_run_time / 1000000UL, &tbuf[5], tx_cps, tx_characters); ptextln(temp); for (i = 0; i < txp; i++) { if ((j = get_string_cap_byvalue(tx_cap[i])) >= 0) { diff --git a/tack/crum.c b/tack/crum.c index e66cc05e..1b72e1eb 100644 --- a/tack/crum.c +++ b/tack/crum.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include -MODULE_ID("$Id: crum.c,v 1.3 2000/03/04 21:09:18 tom Exp $") +MODULE_ID("$Id: crum.c,v 1.4 2005/09/17 19:49:16 tom Exp $") /* * Test cursor movement. diff --git a/tack/edit.c b/tack/edit.c index 2d1a780d..2e0dda2b 100644 --- a/tack/edit.c +++ b/tack/edit.c @@ -15,15 +15,15 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include #include #include -MODULE_ID("$Id: edit.c,v 1.8 2001/06/18 18:44:32 tom Exp $") +MODULE_ID("$Id: edit.c,v 1.10 2005/09/17 19:49:16 tom Exp $") /* * Terminfo edit features @@ -52,7 +52,7 @@ struct test_list edit_test_list[] = { }; static char change_pad_text[MAX_CHANGES][80]; -struct test_list change_pad_list[MAX_CHANGES] = { +static struct test_list change_pad_list[MAX_CHANGES] = { {MENU_LAST, 0, 0, 0, 0, 0, 0} }; @@ -65,15 +65,13 @@ struct test_menu change_pad_menu = { build_change_menu, change_pad_list, 0, 0, 0 }; -extern struct test_results *pads[STRCOUNT]; /* save pad results here */ - static TERMTYPE original_term; /* terminal type description */ static char flag_boolean[BOOLCOUNT]; /* flags for booleans */ static char flag_numerics[NUMCOUNT]; /* flags for numerics */ static char flag_strings[STRCOUNT]; /* flags for strings */ static int xon_index; /* Subscript for (xon) */ -int xon_shadow; +static int xon_shadow; static int start_display; /* the display has just started */ static int display_lines; /* number of lines displayed */ diff --git a/tack/fun.c b/tack/fun.c index fd895c37..58f8b254 100644 --- a/tack/fun.c +++ b/tack/fun.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include -MODULE_ID("$Id: fun.c,v 1.3 2000/03/04 20:29:21 tom Exp $") +MODULE_ID("$Id: fun.c,v 1.6 2005/09/17 19:49:16 tom Exp $") /* * Test the function keys on the terminal. The code for echo tests @@ -58,10 +58,6 @@ struct test_list printer_test_list[] = { #define MAX_STRINGS STRCOUNT -/* scan code externals */ -extern int scan_max; /* length of longest scan code */ -extern char **scan_up, **scan_down, **scan_name; -extern int *scan_tested, *scan_length; /* local definitions */ static const char *fk_name[MAX_STRINGS]; @@ -102,7 +98,7 @@ keys_tested( if (fk_label[i]) { sprintf(outbuf, "%s %s", fk_name[i] ? fk_name[i] : "??", fk_label[i]); - put_columns(outbuf, strlen(outbuf), 16); + put_columns(outbuf, (int) strlen(outbuf), 16); } } put_newlines(2); diff --git a/tack/init.c b/tack/init.c index ee9d7013..4df9d4e2 100644 --- a/tack/init.c +++ b/tack/init.c @@ -15,14 +15,14 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ /* initialization and wrapup code */ #include -MODULE_ID("$Id: init.c,v 1.4 2003/09/20 19:40:57 tom Exp $") +MODULE_ID("$Id: init.c,v 1.6 2005/09/17 19:49:16 tom Exp $") #if NCURSES_VERSION_MAJOR >= 5 || NCURSES_VERSION_PATCH >= 981219 #define _nc_get_curterm(p) _nc_get_tty_mode(p) @@ -170,7 +170,11 @@ display_basic(void) report_cap("ACK (u8)", user8); #endif - sprintf(temp, "\nTerminal size: %d x %d. Baud rate: %ld. Frame size: %d.%d", columns, lines, tty_baud_rate, tty_frame_size >> 1, (tty_frame_size & 1) * 5); + sprintf(temp, "\nTerminal size: %d x %d. Baud rate: %u. Frame size: %d.%d", + columns, lines, + tty_baud_rate, + tty_frame_size >> 1, + (tty_frame_size & 1) * 5); putln(temp); } diff --git a/tack/menu.c b/tack/menu.c index 6714d58d..b4c8c050 100644 --- a/tack/menu.c +++ b/tack/menu.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include -MODULE_ID("$Id: menu.c,v 1.2 2000/03/04 21:13:53 tom Exp $") +MODULE_ID("$Id: menu.c,v 1.3 2005/09/17 19:49:16 tom Exp $") /* Menu control diff --git a/tack/modes.c b/tack/modes.c index f370ba89..e80d62bf 100644 --- a/tack/modes.c +++ b/tack/modes.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include -MODULE_ID("$Id: modes.c,v 1.1 1998/01/10 00:29:53 tom Exp $") +MODULE_ID("$Id: modes.c,v 1.2 2005/09/17 19:49:16 tom Exp $") /* * Tests boolean flags and terminal modes. diff --git a/tack/output.c b/tack/output.c index 208210a2..71d6b160 100644 --- a/tack/output.c +++ b/tack/output.c @@ -15,15 +15,15 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ /* screen formatting and I/O utility functions */ #include #include -MODULE_ID("$Id: output.c,v 1.8 2003/10/25 20:43:43 tom Exp $") +MODULE_ID("$Id: output.c,v 1.10 2005/09/17 19:49:16 tom Exp $") /* globals */ long char_sent; /* number of characters sent */ @@ -34,7 +34,7 @@ int replace_mode; /* used to output replace mode padding */ int can_go_home; /* TRUE if we can fashion a home command */ int can_clear_screen; /* TRUE if we can somehow clear the screen */ int raw_characters_sent; /* Total output characters */ -int log_count; /* Number of characters on a log line */ +static int log_count; /* Number of characters on a log line */ /* translate mode default strings */ #define TM_carriage_return TM_string[0].value diff --git a/tack/pad.c b/tack/pad.c index 30ecf4b4..da1e3d78 100644 --- a/tack/pad.c +++ b/tack/pad.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include -MODULE_ID("$Id: pad.c,v 1.3 2003/10/18 22:11:29 tom Exp $") +MODULE_ID("$Id: pad.c,v 1.6 2005/09/17 19:49:16 tom Exp $") /* test the pad counts on the terminal */ @@ -61,8 +61,6 @@ static void pad_smso(struct test_list *, int *, int *); static void pad_smacs(struct test_list *, int *, int *); static void pad_crash(struct test_list *, int *, int *); -extern struct test_menu change_pad_menu; - /* Any command found in this list, executed from a "Done" prompt will force the default action to repeat rather than next. @@ -168,10 +166,8 @@ struct test_list pad_test_list[] = { {MENU_LAST, 0, 0, 0, 0, 0, 0} }; -extern int test_complete; /* counts number of tests completed */ - /* globals */ -int hzcc; /* horizontal character count */ +static int hzcc; /* horizontal character count */ char letter; /* current character being displayed */ int letter_number; /* points into letters[] */ int augment, repeats; /* number of characters (or lines) effected */ @@ -1759,7 +1755,7 @@ pad_csr_cup( put_str(every_line); } tt_putparm(change_scroll_region, 1, 0, lines - 1); - tt_putparm(cursor_address, 1, lines - 1, strlen(every_line)); + tt_putparm(cursor_address, 1, lines - 1, (int) strlen(every_line)); } while(still_testing()); pad_test_shutdown(t, 0); put_str(" "); diff --git a/tack/scan.c b/tack/scan.c index d9429c96..dbe684bd 100644 --- a/tack/scan.c +++ b/tack/scan.c @@ -15,31 +15,32 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ /* scan mode keyboard support */ #include -MODULE_ID("$Id: scan.c,v 1.2 1999/08/21 23:09:35 tom Exp $") +MODULE_ID("$Id: scan.c,v 1.5 2005/09/17 19:49:16 tom Exp $") -int scan_max; /* length of longest scan code */ +unsigned scan_max; /* length of longest scan code */ char **scan_up, **scan_down, **scan_name; -int *scan_tested, *scan_length, *scan_value; +unsigned *scan_tested, *scan_length; +static unsigned *scan_value; static int shift_state; static char *str; static int debug_char_count; -#define SHIFT_KEY 0x100 +#define SHIFT_KEY 0x100 #define CONTROL_KEY 0x200 -#define META_KEY 0x400 -#define CAPS_LOCK 0x800 +#define META_KEY 0x400 +#define CAPS_LOCK 0x800 static const struct { const char *name; - int type; + unsigned type; } scan_special[] = { {"", SHIFT_KEY}, {"", SHIFT_KEY}, @@ -102,6 +103,7 @@ scan_init(char *fn) char *s, *sl; FILE *fp; int ch, i, j; + unsigned len; char home[512]; if ((str = getenv("HOME"))) @@ -140,9 +142,9 @@ scan_init(char *fn) scan_up = (char **) malloc(sizeof(char *) * MAX_SCAN); scan_down = (char **) malloc(sizeof(char *) * MAX_SCAN); scan_name = (char **) malloc(sizeof(char *) * MAX_SCAN); - scan_tested = (int *) malloc(sizeof(int *) * MAX_SCAN); - scan_length = (int *) malloc(sizeof(int *) * MAX_SCAN); - scan_value = (int *) malloc(sizeof(int *) * MAX_SCAN); + scan_tested = (unsigned *) malloc(sizeof(unsigned *) * MAX_SCAN); + scan_length = (unsigned *) malloc(sizeof(unsigned *) * MAX_SCAN); + scan_value = (unsigned *) malloc(sizeof(unsigned *) * MAX_SCAN); scan_up[0] = scan_down[0] = scan_name[0] = (char *) 0; str = (char *) malloc(4096); /* buffer space */ sl = str + 4000; /* an upper limit */ @@ -165,11 +167,11 @@ scan_init(char *fn) scan_name[i] = str; scan_length[i] = strlen(scan_down[i]); - ch = strlen(scan_up[i]) + scan_length[i]; - if (ch > scan_max) - scan_max = ch; + len = strlen(scan_up[i]) + scan_length[i]; + if (len > scan_max) + scan_max = len; - scan_value[i] = scan_name[i][0]; + scan_value[i] = UChar(scan_name[i][0]); if (scan_name[i][1]) /* multi-character name */ for (j = 0; scan_special[j].name; j++) { if (!strcmp(scan_name[i], scan_special[j].name)) { @@ -202,7 +204,8 @@ int scan_key(void) { /* read a key and translate scan mode to ASCII */ - int i, j, ch; + unsigned i; + int j, ch; char buf[64]; for (i = 1;; i++) { diff --git a/tack/sync.c b/tack/sync.c index 6eb91b25..16366bdb 100644 --- a/tack/sync.c +++ b/tack/sync.c @@ -15,14 +15,14 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include #include -MODULE_ID("$Id: sync.c,v 1.3 2001/06/16 17:55:48 tom Exp $") +MODULE_ID("$Id: sync.c,v 1.8 2005/09/17 19:49:16 tom Exp $") /* terminal-synchronization and performance tests */ @@ -31,7 +31,7 @@ static void sync_lines(struct test_list *, int *, int *); static void sync_clear(struct test_list *, int *, int *); static void sync_summary(struct test_list *, int *, int *); -struct test_list sync_test_list[] = { +static struct test_list sync_test_list[] = { {MENU_NEXT, 0, 0, 0, "b) baud rate test", sync_home, 0}, {MENU_NEXT, 0, 0, 0, "l) scroll performance", sync_lines, 0}, {MENU_NEXT, 0, 0, 0, "c) clear screen performance", sync_clear, 0}, @@ -48,16 +48,16 @@ struct test_menu sync_menu = { }; int tty_can_sync; /* TRUE if tty_sync_error() returned FALSE */ -int tty_newline_rate; /* The number of newlines per second */ -int tty_clear_rate; /* The number of clear-screens per second */ -int tty_cps; /* The number of characters per second */ +static int tty_newline_rate; /* The number of newlines per second */ +static int tty_clear_rate; /* The number of clear-screens per second */ +unsigned long tty_cps; /* The number of characters per second */ #define TTY_ACK_SIZE 64 -int ACK_terminator; /* terminating ACK character */ -int ACK_length; /* length of ACK string */ -const char *tty_ENQ; /* enquire string */ -char tty_ACK[TTY_ACK_SIZE]; /* ACK response, set by tty_sync_error() */ +static int ACK_terminator; /* terminating ACK character */ +static int ACK_length; /* length of ACK string */ +static const char *tty_ENQ; /* enquire string */ +static char tty_ACK[TTY_ACK_SIZE]; /* ACK response, set by tty_sync_error() */ /***************************************************************************** * @@ -299,7 +299,7 @@ sync_home( if (tx_cps > tty_cps) { tty_cps = tx_cps; } - sprintf(temp, "%d characters per second. Baudrate %d ", tx_cps, j); + sprintf(temp, "%lu characters per second. Baudrate %d ", tx_cps, j); ptext(temp); generic_done_message(t, state, ch); } @@ -395,7 +395,7 @@ sync_summary( put_crlf(); ptextln("Terminal size characters/sec linefeeds/sec clears/sec"); sprintf(size, "%dx%d", columns, lines); - sprintf(temp, "%-10s%-11s%11d %11d %11d", tty_basename, size, + sprintf(temp, "%-10s%-11s%11lu %11d %11d", tty_basename, size, tty_cps, tty_newline_rate, tty_clear_rate); ptextln(temp); generic_done_message(t, state, ch); diff --git a/tack/sysdep.c b/tack/sysdep.c index d8b48023..78ae095e 100644 --- a/tack/sysdep.c +++ b/tack/sysdep.c @@ -15,8 +15,8 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ /* * Operating system dependent functions. We assume the POSIX API. @@ -24,6 +24,9 @@ * global has no effect. */ +#ifdef HAVE_CONFIG_H +#include +#endif #include /* include before curses.h to work around glibc bug */ #include @@ -46,7 +49,7 @@ #endif #endif -MODULE_ID("$Id: sysdep.c,v 1.11 2002/04/21 19:40:43 tom Exp $") +MODULE_ID("$Id: sysdep.c,v 1.15 2005/09/17 19:49:16 tom Exp $") #if DECL_ERRNO extern int errno; @@ -60,7 +63,7 @@ extern int errno; /* globals */ int tty_frame_size; /* asynch frame size times 2 */ -unsigned long tty_baud_rate; /* baud rate - bits per second */ +unsigned tty_baud_rate; /* baud rate - bits per second */ int not_a_tty; /* TRUE if output is not a tty (i.e. pipe) */ int nodelay_read; /* TRUE if NDELAY is set */ @@ -179,8 +182,8 @@ tty_set(void) #endif /* NL1 */ break; } - if (!(new_modes.c_oflag & ~OPOST)) - new_modes.c_oflag &= ~OPOST; + if (!(new_modes.c_oflag & (unsigned long) ~OPOST)) + new_modes.c_oflag &= (unsigned long) ~OPOST; #else new_modes.sg_flags |= RAW; if (not_a_tty) @@ -396,7 +399,7 @@ read_key(char *buf, int max) if (ask > max) { ask = max; } - if ((got = read(fileno(stdin), s, ask))) { + if ((got = read(fileno(stdin), s, (unsigned) ask))) { s += got; } else { break; @@ -497,5 +500,5 @@ set_alarm_clock( { signal(SIGALRM, alarm_event); no_alarm_event = 1; - (void) alarm(seconds); + (void) alarm((unsigned) seconds); } diff --git a/tack/tack.1 b/tack/tack.1 index be74e585..9d5ec93c 100644 --- a/tack/tack.1 +++ b/tack/tack.1 @@ -294,7 +294,7 @@ If you make changes to the terminfo entry \fBtack\fR will save the new terminfo to a file. The file will have the same name as the terminal name. .SH SEE ALSO -\fBterminfo\fR(\*n), \fBncurses\fR(3X), \fBtic\fR(1m), \fBinfocmp\fR(1m). +\fBterminfo\fR(\*n), \fBncurses\fR(3X), \fBtic\fR(1M), \fBinfocmp\fR(1M). You should also have the documentation supplied by the terminal manufacturer. .SH BUGS diff --git a/tack/tack.c b/tack/tack.c index f6e37d44..946a2fbf 100644 --- a/tack/tack.c +++ b/tack/tack.c @@ -15,13 +15,13 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ #include -MODULE_ID("$Id: tack.c,v 1.2 2001/10/28 01:05:35 tom Exp $") +MODULE_ID("$Id: tack.c,v 1.4 2005/09/17 19:49:16 tom Exp $") /* This program is designed to test terminfo, not curses. Therefore @@ -62,14 +62,12 @@ FILE *log_fp; /* Terminal logfile */ * *****************************************************************************/ -extern struct test_menu sync_menu; - static void tools_hex_echo(struct test_list *, int *, int *); static void tools_debug(struct test_list *, int *, int *); static char hex_echo_menu_entry[80]; -struct test_list tools_test_list[] = { +static struct test_list tools_test_list[] = { {0, 0, 0, 0, "s) ANSI status reports", tools_status, 0}, {0, 0, 0, 0, "g) ANSI SGR modes (bold, underline, reverse)", tools_sgr, 0}, {0, 0, 0, 0, "c) ANSI character sets", tools_charset, 0}, @@ -83,7 +81,7 @@ struct test_list tools_test_list[] = { {MENU_LAST, 0, 0, 0, 0, 0, 0} }; -struct test_menu tools_menu = { +static struct test_menu tools_menu = { 0, 'q', 0, "Tools Menu", "tools", 0, 0, tools_test_list, 0, 0, 0 }; @@ -115,24 +113,18 @@ static struct test_menu tty_menu = { tty_show_state, tty_test_list, 0, 0, 0 }; -extern struct test_list edit_test_list[]; - struct test_menu edit_menu = { 0, 'q', 0, "Edit terminfo menu", "edit", 0, 0, edit_test_list, 0, 0, 0 }; -extern struct test_list mode_test_list[]; - -struct test_menu mode_menu = { +static struct test_menu mode_menu = { 0, 'n', 0, "Test modes and glitches:", "mode", "n) run standard tests", 0, mode_test_list, 0, 0, 0 }; -extern struct test_list acs_test_list[]; - static struct test_menu acs_menu = { 0, 'n', 0, "Test alternate character set and graphics rendition:", @@ -140,17 +132,13 @@ static struct test_menu acs_menu = { 0, acs_test_list, 0, 0, 0 }; -extern struct test_list color_test_list[]; - -struct test_menu color_menu = { +static struct test_menu color_menu = { 0, 'n', 0, "Test color:", "color", "n) run standard tests", 0, color_test_list, 0, 0, 0 }; -extern struct test_list crum_test_list[]; - static struct test_menu crum_menu = { 0, 'n', 0, "Test cursor movement:", @@ -158,8 +146,6 @@ static struct test_menu crum_menu = { 0, crum_test_list, 0, 0, 0 }; -extern struct test_list funkey_test_list[]; - static struct test_menu funkey_menu = { 0, 'n', 0, "Test function keys:", @@ -167,8 +153,6 @@ static struct test_menu funkey_menu = { sync_test, funkey_test_list, 0, 0, 0 }; -extern struct test_list printer_test_list[]; - static struct test_menu printer_menu = { 0, 'n', 0, "Test printer:", @@ -177,7 +161,6 @@ static struct test_menu printer_menu = { }; static void pad_gen(struct test_list *, int *, int *); -extern struct test_list pad_test_list[]; static struct test_menu pad_menu = { 0, 'n', 0, @@ -203,7 +186,7 @@ static struct test_list normal_test_list[] = { }; -struct test_menu normal_menu = { +static struct test_menu normal_menu = { 0, 'n', 0, "Main test menu", "test", "n) run standard tests", 0, normal_test_list, 0, 0, 0 @@ -216,7 +199,7 @@ static void start_log(struct test_list *, int *, int *); static char logging_menu_entry[80] = "l) start logging"; -struct test_list start_test_list[] = { +static struct test_list start_test_list[] = { {0, 0, 0, 0, "b) display basic information", start_basic, 0}, {0, 0, 0, 0, "m) change modes", start_modes, 0}, {0, 0, 0, 0, "t) tools", start_tools, 0}, @@ -226,7 +209,7 @@ struct test_list start_test_list[] = { }; -struct test_menu start_menu = { +static struct test_menu start_menu = { 0, 'n', 0, "Main Menu", "tack", 0, 0, start_test_list, 0, 0, 0 }; @@ -319,7 +302,7 @@ tty_show_state( { put_crlf(); (void) sprintf(temp, - "Accepting %d bits, UNIX delays %d, XON/XOFF %sabled, speed %ld, translate %s, scan-code mode %s.", + "Accepting %d bits, UNIX delays %d, XON/XOFF %sabled, speed %u, translate %s, scan-code mode %s.", (char_mask == ALLOW_PARITY) ? 8 : 7, select_delay_type, select_xon_xoff ? "en" : "dis", diff --git a/tack/tack.h b/tack/tack.h index f8b244ce..da10bb5b 100644 --- a/tack/tack.h +++ b/tack/tack.h @@ -15,11 +15,11 @@ ** ** You should have received a copy of the GNU General Public License ** along with TACK; see the file COPYING. If not, write to -** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, -** Boston, MA 02111-1307, USA. +** the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +** Boston, MA 02110-1301, USA */ -/* $Id: tack.h,v 1.10 2003/10/18 22:26:59 tom Exp $ */ +/* $Id: tack.h,v 1.14 2005/09/17 19:49:16 tom Exp $ */ #ifndef NCURSES_TACK_H_incl #define NCURSES_TACK_H_incl 1 @@ -77,9 +77,9 @@ extern char tty_shortname[]; extern int tty_can_sync; extern int total_pads_sent; /* count pad characters sent */ extern int total_caps_sent; /* count caps sent */ -extern int total_printing_characters; /* count printing characters sent */ +extern int total_printing_characters; /* count printing characters sent */ extern int no_alarm_event; /* TRUE if the alarm has not gone off yet */ -extern int usec_run_time; /* length of last test in microseconds */ +extern unsigned long usec_run_time; /* length of last test in microseconds */ extern int raw_characters_sent; /* Total output characters */ /* Stopwatch event timers */ @@ -129,8 +129,8 @@ extern int select_delay_type; extern int select_xon_xoff; extern int tty_frame_size; -extern unsigned long tty_baud_rate; -extern int tty_cps; /* The number of characters per second */ +extern unsigned tty_baud_rate; +extern unsigned long tty_cps; /* The number of characters per second */ extern int not_a_tty, nodelay_read; extern int send_reset_init; @@ -194,7 +194,7 @@ extern int tx_delay[TT_MAX]; /* Number of milliseconds delay */ extern int tx_index[TT_MAX]; /* String index */ extern int txp; /* number of entries used */ extern int tx_characters; /* printing characters sent by test */ -extern int tx_cps; /* characters per second */ +extern unsigned long tx_cps; /* characters per second */ /* Menu control for tack. @@ -268,138 +268,156 @@ struct test_menu { #define REQUEST_PROMPT 256 -extern char prompt_string[80]; /* menu prompt storage */ -extern struct test_menu edit_menu; -extern struct test_list *augment_test; - /* tack.c */ +extern struct test_menu edit_menu; extern void show_usage(char *); extern void print_version(void); /* output.c */ -extern void tt_tputs(const char *, int); -extern void tt_putp(const char *); -extern void tt_putparm(NCURSES_CONST char *, int, int, int); -extern int tc_putp(const char *); +extern char *expand(const char *); +extern char *expand_command(const char *); +extern char *expand_to(char *, int); +extern char *hex_expand_to(char *, int); +extern char *print_expand(char *); +extern int getchp(int); +extern int getnext(int); extern int tc_putch(int); -extern void putchp(int); +extern int tc_putp(const char *); +extern int wait_here(void); +extern void go_home(void); +extern void home_down(void); +extern void maybe_wait(int); +extern void ptext(const char *); +extern void ptextln(const char *); +extern void put_clear(void); +extern void put_columns(const char *, int, int); extern void put_cr(void); extern void put_crlf(void); -extern void put_clear(void); extern void put_dec(char *, int); -extern void put_str(const char *); -extern void put_lf(void); extern void put_ind(void); +extern void put_lf(void); extern void put_newlines(int); -extern void put_columns(const char *, int, int); +extern void put_str(const char *); extern void put_this(int); +extern void putchp(int); extern void putln(const char *); -extern void ptext(const char *); -extern void ptextln(const char *); -extern void home_down(void); -extern void go_home(void); -extern void three_digit(char *, int); -extern int getchp(int); -extern char *expand(const char *); -extern char *expand_to(char *, int); -extern char *expand_command(const char *); -extern char *hex_expand_to(char *, int); -extern char *print_expand(char *); -extern void maybe_wait(int); -extern int wait_here(void); extern void read_string(char *, int); -extern int getnext(int); +extern void three_digit(char *, int); +extern void tt_putp(const char *); +extern void tt_putparm(NCURSES_CONST char *, int, int, int); +extern void tt_tputs(const char *, int); + +#define put_that(n) put_this((int) (n)) /* control.c */ -extern void event_start(int); -extern long event_time(int); +extern struct test_list color_test_list[]; extern char *liberated(char *); -extern void page_loop(void); -extern void control_init(void); +extern char txt_longer_augment[80]; +extern char txt_longer_test_time[80]; +extern char txt_shorter_augment[80]; +extern char txt_shorter_test_time[80]; extern int msec_cost(const char *const, int); extern int skip_pad_test(struct test_list *, int *, int *, const char *); -extern void pad_test_startup(int); +extern int sliding_scale(int, int, unsigned long); extern int still_testing(void); -extern void pad_test_shutdown(struct test_list *, int); +extern long event_time(int); +extern void control_init(void); extern void dump_test_stats(struct test_list *, int *, int *); +extern void event_start(int); +extern void longer_augment(struct test_list *, int *, int *); extern void longer_test_time(struct test_list *, int *, int *); -extern void shorter_test_time(struct test_list *, int *, int *); -extern char txt_longer_test_time[80]; -extern char txt_shorter_test_time[80]; +extern void pad_test_shutdown(struct test_list *, int); +extern void pad_test_startup(int); +extern void page_loop(void); extern void set_augment_txt(void); -extern void longer_augment(struct test_list *, int *, int *); extern void shorter_augment(struct test_list *, int *, int *); -extern char txt_longer_augment[80]; -extern char txt_shorter_augment[80]; -extern int sliding_scale(int, int, int); - -/* sync.c */ -extern void verify_time(void); -extern int tty_sync_error(void); -extern void flush_input(void); -extern void sync_test(struct test_menu *); -extern void sync_handshake(struct test_list *, int *, int *); +extern void shorter_test_time(struct test_list *, int *, int *); /* charset.c */ +extern struct test_list acs_test_list[]; extern void set_attr(int); extern void eat_cookie(void); extern void put_mode(char *); -/* init.c */ -extern void reset_init(void); -extern void display_basic(void); -extern void put_name(const char *, const char *); -extern void charset_can_test(void); -extern void curses_setup(char *); -extern void bye_kids(int); - -/* scan.c */ -extern int scan_key(void); -extern void scan_init(char *fn); +/* crum.c */ +extern struct test_list crum_test_list[]; /* ansi.c */ extern void tools_status(struct test_list *, int *, int *); extern void tools_charset(struct test_list *, int *, int *); extern void tools_sgr(struct test_list *, int *, int *); -/* pad.c */ +/* edit.c */ +extern struct test_menu change_pad_menu; +extern struct test_list edit_test_list[]; +extern char *get_string_cap_byname(const char *, const char **); +extern int cap_match(const char *names, const char *cap); +extern int get_string_cap_byvalue(const char *); +extern int user_modified(void); +extern void can_test(const char *, int); +extern void cap_index(const char *, int *); +extern void edit_init(void); +extern void save_info(struct test_list *, int *, int *); +extern void show_report(struct test_list *, int *, int *); /* fun.c */ +extern struct test_list funkey_test_list[]; +extern struct test_list printer_test_list[]; extern void enter_key(const char *, char *, char *); extern int tty_meta_prep(void); extern void tools_report(struct test_list *, int *, int *); +/* init.c */ +extern void reset_init(void); +extern void display_basic(void); +extern void put_name(const char *, const char *); +extern void charset_can_test(void); +extern void curses_setup(char *); +extern void bye_kids(int); + +/* scan.c */ +extern char **scan_up, **scan_down, **scan_name; +extern int scan_key(void); +extern unsigned scan_max; /* length of longest scan code */ +extern unsigned *scan_tested, *scan_length; +extern void scan_init(char *fn); + /* sysdep.c */ -extern void tty_set(void); -extern void tty_raw(int, int); -extern void tty_init(void); -extern void tty_reset(void); -extern void spin_flush(void); +extern int initial_stty_query(int); +extern int stty_query(int); +extern void ignoresig(void); extern void read_key(char *, int); extern void set_alarm_clock(int); -extern void ignoresig(void); -extern int stty_query(int); -extern int initial_stty_query(int); - -/* edit.c */ -extern int user_modified(void); -extern void save_info(struct test_list *, int *, int *); -extern void can_test(const char *, int); -extern void cap_index(const char *, int *); -extern int cap_match(const char *names, const char *cap); -extern void edit_init(void); -extern char *get_string_cap_byname(const char *, const char **); -extern int get_string_cap_byvalue(const char *); -extern void show_report(struct test_list *, int *, int *); +extern void spin_flush(void); +extern void tty_init(void); +extern void tty_raw(int, int); +extern void tty_reset(void); +extern void tty_set(void); /* menu.c */ -extern void menu_prompt(void); -extern void menu_can_scan(const struct test_menu *); -extern void menu_display(struct test_menu *, int *); +extern char prompt_string[80]; /* menu prompt storage */ +extern int subtest_menu(struct test_list *, int *, int *); +extern struct test_list *augment_test; extern void generic_done_message(struct test_list *, int *, int *); -extern void pad_done_message(struct test_list *, int *, int *); +extern void menu_can_scan(const struct test_menu *); extern void menu_clear_screen(struct test_list *, int *, int *); +extern void menu_display(struct test_menu *, int *); +extern void menu_prompt(void); extern void menu_reset_init(struct test_list *, int *, int *); -extern int subtest_menu(struct test_list *, int *, int *); +extern void pad_done_message(struct test_list *, int *, int *); + +/* modes.c */ +extern struct test_list mode_test_list[]; + +/* pad.c */ +extern struct test_list pad_test_list[]; + +/* sync.c */ +extern struct test_menu sync_menu; +extern int tty_sync_error(void); +extern void flush_input(void); +extern void sync_handshake(struct test_list *, int *, int *); +extern void sync_test(struct test_menu *); +extern void verify_time(void); #endif /* NCURSES_TACK_H_incl */ diff --git a/test/Makefile.in b/test/Makefile.in index e5cb7481..0165f4ff 100644 --- a/test/Makefile.in +++ b/test/Makefile.in @@ -1,6 +1,6 @@ -# $Id: Makefile.in,v 1.77 2003/12/07 01:36:16 tom Exp $ +# $Id: Makefile.in,v 1.84 2005/09/24 23:05:14 tom Exp $ ############################################################################## -# Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -77,7 +77,7 @@ MATH_LIB = @MATH_LIB@ LD = @LD@ LINK = @LINK_TESTS@ $(LIBTOOL_LINK) $(CC) $(CFLAGS) -LDFLAGS = @LD_MODEL@ @TEST_ARGS@ @LIBS@ @EXTRA_LIBS@ @LOCAL_LDFLAGS@ @LDFLAGS@ +LDFLAGS = @LD_MODEL@ @LOCAL_LDFLAGS@ @LDFLAGS@ LDFLAGS_LIBTOOL = $(LDFLAGS) $(CFLAGS_LIBTOOL) LDFLAGS_NORMAL = $(LDFLAGS) $(CFLAGS_NORMAL) @@ -85,12 +85,26 @@ LDFLAGS_DEBUG = $(LDFLAGS) $(CFLAGS_DEBUG) LDFLAGS_PROFILE = $(LDFLAGS) $(CFLAGS_PROFILE) LDFLAGS_SHARED = $(LDFLAGS) $(CFLAGS_SHARED) @LD_SHARED_OPTS@ -LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) +# use these for linking with all of the libraries +LIBS_DEFAULT = @TEST_ARGS@ @LIBS@ +LDFLAGS_DEFAULT = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_DEFAULT) + +# use these for linking with the (n)curses library +LIBS_CURSES = `echo "@TEST_ARGS@ @LIBS@" | sed -e 's/-lform.*-lpanel[^ ]*//'` +LDFLAGS_CURSES = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_CURSES) + +# use these for linking with the tinfo library if we have it, or curses library if not +LIBS_TINFO = @TINFO_ARGS@ @LIBS@ +LDFLAGS_TINFO = $(LDFLAGS_@DFT_UPR_MODEL@) $(LIBS_TINFO) LINT = @LINT@ LINT_OPTS = @LINT_OPTS@ LINT_LIBS = -lform -lmenu -lpanel -lncurses @LIBS@ +HEADER_DEPS = \ + ../include/curses.h \ + ../include/term.h + TESTS = \ background$x \ blue$x \ @@ -102,6 +116,7 @@ TESTS = \ demo_keyok$x \ demo_menus$x \ demo_panels$x \ + demo_termcap$x \ ditto$x \ dots$x \ filter$x \ @@ -131,29 +146,32 @@ all: $(TESTS) sources: +tags: + ctags *.[ch] + background$x: $(MODEL)/background$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/background$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/background$o $(LDFLAGS_CURSES) blue$x: $(MODEL)/blue$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/blue$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/blue$o $(LDFLAGS_CURSES) bs$x: $(MODEL)/bs$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/bs$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/bs$o $(LDFLAGS_CURSES) cardfile$x: $(MODEL)/cardfile$o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/cardfile$o $(LDFLAGS_DEFAULT) color_set$x: $(MODEL)/color_set$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/color_set$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/color_set$o $(LDFLAGS_CURSES) demo_defkey$x: $(MODEL)/demo_defkey$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/demo_defkey$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/demo_defkey$o $(LDFLAGS_CURSES) demo_forms$x: $(MODEL)/demo_forms$o $(MODEL)/edit_field$o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/demo_forms$o $(MODEL)/edit_field$o $(LDFLAGS_DEFAULT) demo_keyok$x: $(MODEL)/demo_keyok$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/demo_keyok$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/demo_keyok$o $(LDFLAGS_CURSES) demo_menus$x: $(MODEL)/demo_menus$o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/demo_menus$o $(LDFLAGS_DEFAULT) @@ -161,77 +179,80 @@ demo_menus$x: $(MODEL)/demo_menus$o $(LOCAL_LIBS) demo_panels$x: $(MODEL)/demo_panels$o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/demo_panels$o $(LDFLAGS_DEFAULT) +demo_termcap$x: $(MODEL)/demo_termcap$o $(LOCAL_LIBS) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/demo_termcap$o $(LDFLAGS_TINFO) + ditto$x: $(MODEL)/ditto$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/ditto$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/ditto$o $(LDFLAGS_CURSES) dots$x: $(MODEL)/dots$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/dots$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/dots$o $(LDFLAGS_TINFO) filter$x: $(MODEL)/filter$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/filter$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/filter$o $(LDFLAGS_CURSES) firework$x: $(MODEL)/firework$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/firework$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/firework$o $(LDFLAGS_CURSES) firstlast$x: $(MODEL)/firstlast$o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/firstlast$o $(LDFLAGS_DEFAULT) gdc$x: $(MODEL)/gdc$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/gdc$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/gdc$o $(LDFLAGS_CURSES) hanoi$x: $(MODEL)/hanoi$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/hanoi$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/hanoi$o $(LDFLAGS_CURSES) hashtest$x: $(MODEL)/hashtest$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/hashtest$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/hashtest$o $(LDFLAGS_CURSES) inserts$x: $(MODEL)/inserts$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/inserts$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/inserts$o $(LDFLAGS_CURSES) ins_wide$x: $(MODEL)/ins_wide$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/ins_wide$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/ins_wide$o $(LDFLAGS_CURSES) keynames$x: $(MODEL)/keynames$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/keynames$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/keynames$o $(LDFLAGS_CURSES) knight$x: $(MODEL)/knight$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/knight$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/knight$o $(LDFLAGS_CURSES) lrtest$x: $(MODEL)/lrtest$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/lrtest$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/lrtest$o $(LDFLAGS_CURSES) ncurses$x: $(MODEL)/ncurses$o $(LOCAL_LIBS) @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/ncurses$o $(LDFLAGS_DEFAULT) newdemo$x: $(MODEL)/newdemo$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/newdemo$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/newdemo$o $(LDFLAGS_CURSES) rain$x: $(MODEL)/rain$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/rain$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/rain$o $(LDFLAGS_CURSES) railroad$x: $(MODEL)/railroad$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/railroad$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/railroad$o $(LDFLAGS_TINFO) tclock$x: $(MODEL)/tclock$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/tclock$o $(LDFLAGS_DEFAULT) $(MATH_LIB) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/tclock$o $(LDFLAGS_CURSES) $(MATH_LIB) testaddch$x: $(MODEL)/testaddch$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/testaddch$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/testaddch$o $(LDFLAGS_CURSES) testcurs$x: $(MODEL)/testcurs$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/testcurs$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/testcurs$o $(LDFLAGS_CURSES) testscanw$x: $(MODEL)/testscanw$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/testscanw$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/testscanw$o $(LDFLAGS_CURSES) view$x: $(MODEL)/view$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/view$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/view$o $(LDFLAGS_CURSES) worm$x: $(MODEL)/worm$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/worm$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/worm$o $(LDFLAGS_CURSES) xmas$x: $(MODEL)/xmas$o $(LOCAL_LIBS) - @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/xmas$o $(LDFLAGS_DEFAULT) + @ECHO_LINK@ $(LINK) -o $@ $(MODEL)/xmas$o $(LDFLAGS_CURSES) libs \ install \ diff --git a/test/README b/test/README index 6c730e0c..90898e77 100644 --- a/test/README +++ b/test/README @@ -1,4 +1,4 @@ --- $Id: README,v 1.15 2003/07/05 19:17:49 tom Exp $ +-- $Id: README,v 1.24 2005/10/01 22:01:07 tom Exp $ ------------------------------------------------------------------------------- The programs in this directory are designed to test your newest toy :-) @@ -36,14 +36,14 @@ TYPE_ALNUM test: demo_forms TYPE_ALPHA test: demo_forms ncurses TYPE_ENUM test: demo_forms TYPE_INTEGER test: demo_forms -TYPE_IPV4 - +TYPE_IPV4 test: demo_forms TYPE_NUMERIC test: demo_forms TYPE_REGEXP test: demo_forms current_field test: demo_forms edit_field ncurses -data_ahead - -data_behind - +data_ahead test: demo_forms +data_behind test: demo_forms dup_field - -dynamic_field_info - +dynamic_field_info test: demo_forms field_arg - field_back - field_buffer test: cardfile demo_forms edit_field ncurses @@ -54,15 +54,15 @@ field_info test: ncurses field_init - field_just - field_opts test: demo_forms ncurses -field_opts_off test: cardfile -field_opts_on - +field_opts_off test: cardfile demo_forms +field_opts_on test: demo_forms field_pad - -field_status - +field_status test: demo_forms field_term - field_type test: demo_forms field_userptr test: ncurses form_driver test: cardfile demo_forms edit_field ncurses -form_fields test: cardfile +form_fields test: cardfile demo_forms form_init - form_opts - form_opts_off - @@ -75,7 +75,7 @@ form_term - form_userptr - form_win test: cardfile demo_forms edit_field ncurses free_field test: cardfile demo_forms ncurses -free_fieldtype - +free_fieldtype test: ncurses free_form test: cardfile demo_forms ncurses link_field - link_fieldtype - @@ -87,15 +87,15 @@ new_page - pos_form_cursor - post_form test: cardfile demo_forms ncurses scale_form test: demo_forms ncurses -set_current_field - +set_current_field test: demo_forms set_field_back test: cardfile demo_forms edit_field ncurses set_field_buffer test: cardfile demo_forms edit_field ncurses -set_field_fore - +set_field_fore test: demo_forms set_field_init - -set_field_just test: cardfile +set_field_just test: cardfile demo_forms set_field_opts test: demo_forms ncurses set_field_pad - -set_field_status - +set_field_status test: demo_forms set_field_term - set_field_type test: demo_forms ncurses set_field_userptr test: demo_forms ncurses @@ -109,18 +109,18 @@ set_form_sub test: cardfile demo_forms ncurses set_form_term - set_form_userptr - set_form_win test: cardfile demo_forms ncurses -set_max_field - +set_max_field test: demo_forms set_new_page test: demo_forms unpost_form test: cardfile demo_forms ncurses libmenu: ------- -current_item test: ncurses +current_item test: demo_menus ncurses free_item test: ncurses -free_menu test: ncurses -item_count - +free_menu test: demo_menus ncurses +item_count test: demo_menus item_description - -item_index test: ncurses +item_index test: demo_menus ncurses item_init - item_name test: ncurses item_opts - @@ -128,54 +128,54 @@ item_opts_off - item_opts_on - item_term - item_userptr - -item_value test: ncurses +item_value test: demo_menus ncurses item_visible - menu_back - -menu_driver test: ncurses +menu_driver test: demo_menus ncurses menu_fore - menu_format - menu_grey - menu_init - -menu_items test: ncurses +menu_items test: demo_menus ncurses menu_mark - menu_opts - -menu_opts_off test: ncurses -menu_opts_on - +menu_opts_off test: demo_menus ncurses +menu_opts_on test: demo_menus menu_pad - menu_pattern - menu_request_by_name - menu_request_name - -menu_spacing - +menu_spacing test: demo_menus menu_sub - menu_term - menu_userptr - -menu_win test: ncurses -new_item test: ncurses -new_menu test: ncurses +menu_win test: demo_menus ncurses +new_item test: demo_menus ncurses +new_menu test: demo_menus ncurses pos_menu_cursor lib: menu -post_menu test: ncurses -scale_menu test: ncurses +post_menu test: demo_menus ncurses +scale_menu test: demo_menus ncurses set_current_item - set_item_init - set_item_opts - set_item_term - set_item_userptr - -set_item_value test: ncurses -set_menu_back - -set_menu_fore - -set_menu_format test: ncurses +set_item_value test: demo_menus ncurses +set_menu_back test: demo_menus +set_menu_fore test: demo_menus +set_menu_format test: demo_menus ncurses set_menu_grey - set_menu_init - set_menu_items - -set_menu_mark - +set_menu_mark test: demo_menus set_menu_opts - set_menu_pad - set_menu_pattern - set_menu_spacing - -set_menu_sub test: ncurses +set_menu_sub test: demo_menus ncurses set_menu_term - set_menu_userptr - -set_menu_win test: ncurses +set_menu_win test: demo_menus ncurses set_top_row - top_row - unpost_menu test: ncurses @@ -184,18 +184,18 @@ libncurses: ---------- BC - COLORS test: ncurses xmas -COLOR_PAIR test: blue bs demo_forms filter firework gdc hanoi ins_wide inserts knight ncurses newdemo rain tclock testaddch testcurs view worm xmas +COLOR_PAIR test: background blue bs cardfile demo_forms demo_menus filter firework gdc hanoi ins_wide inserts knight ncurses newdemo rain tclock testaddch testcurs view worm xmas COLOR_PAIRS test: ncurses newdemo -COLS test: cardfile demo_defkey demo_forms demo_keyok edit_field firework hashtest ins_wide inserts lrtest ncurses newdemo rain tclock testcurs view worm +COLS test: cardfile demo_defkey demo_forms demo_keyok demo_menus edit_field firework hashtest ins_wide inserts lrtest ncurses newdemo rain tclock testcurs view worm ESCDELAY lib: ncurses -LINES test: cardfile demo_defkey demo_keyok edit_field firework hanoi hashtest ins_wide inserts lrtest ncurses newdemo rain tclock testcurs view worm xmas -PAIR_NUMBER lib: ncurses +LINES test: cardfile demo_defkey demo_keyok demo_menus edit_field firework hanoi hashtest ins_wide inserts lrtest ncurses newdemo rain tclock testcurs view worm xmas +PAIR_NUMBER test: ncurses PC lib: ncurses SP lib: ncurses TABSIZE lib: menu UP - acs_map test: gdc ins_wide inserts knight ncurses newdemo testcurs -add_wch - +add_wch test: ncurses add_wchnstr test: ncurses add_wchstr test: view addch test: blue bs ditto hashtest ncurses testaddch view worm @@ -204,37 +204,37 @@ addchstr - addnstr - addnwstr - addstr test: blue bs cardfile gdc hanoi lrtest ncurses -addwstr - +addwstr test: ncurses assume_default_colors test: ncurses -attr_get - +attr_get test: ncurses attr_off test: ncurses attr_on test: ncurses -attr_set - +attr_set test: ncurses attroff test: filter gdc ncurses tclock attron test: bs filter gdc ncurses attrset test: bs firework gdc hanoi ncurses rain tclock testaddch testcurs baudrate lib: ncurses -beep test: blue bs cardfile demo_forms edit_field hanoi ins_wide inserts knight ncurses tclock testcurs view xmas -bkgd test: demo_forms ncurses tclock view -bkgdset test: ncurses testaddch -bkgrnd - -bkgrndset - +beep test: blue bs cardfile demo_forms demo_menus edit_field hanoi ins_wide inserts knight ncurses tclock testcurs view xmas +bkgd test: background cardfile demo_forms ncurses tclock view +bkgdset test: background ncurses testaddch +bkgrnd test: ncurses +bkgrndset test: ncurses boolcodes progs: dump_entry boolfnames progs: dump_entry boolnames progs: dump_entry infocmp border - border_set - -box test: cardfile demo_forms edit_field ins_wide inserts lrtest ncurses newdemo testcurs +box test: cardfile demo_forms demo_menus edit_field ins_wide inserts lrtest ncurses newdemo testcurs box_set test: ncurses can_change_color test: ncurses -cbreak test: blue bs cardfile demo_defkey demo_forms demo_keyok ditto filter firework gdc hanoi hashtest ins_wide inserts knight lrtest ncurses newdemo tclock testcurs view worm xmas +cbreak test: background blue bs cardfile color_set demo_defkey demo_forms demo_keyok demo_menus ditto filter firework gdc hanoi hashtest ins_wide inserts knight lrtest ncurses newdemo tclock testcurs view worm xmas chgat - clear test: blue bs gdc ncurses testcurs xmas clearok test: bs knight -clrtobot test: ncurses +clrtobot test: demo_menus ncurses clrtoeol test: blue bs hanoi hashtest ncurses view color_content test: ncurses -color_set - +color_set test: color_set ncurses copywin test: testcurs cur_term test: dots lrtest progs: clear tic tput tset curs_set test: firework gdc hanoi lrtest newdemo rain tclock testcurs worm xmas @@ -248,14 +248,14 @@ delay_output - delch - deleteln - delscreen - -delwin test: cardfile demo_forms edit_field ncurses newdemo testcurs -derwin test: cardfile demo_forms ncurses +delwin test: cardfile demo_forms demo_menus edit_field ins_wide inserts ncurses newdemo testcurs +derwin test: cardfile demo_forms demo_menus ins_wide inserts ncurses doupdate test: cardfile edit_field ins_wide inserts knight ncurses dupwin test: edit_field echo test: bs hanoi ncurses testcurs testscanw echo_wchar test: ncurses echochar test: ncurses -endwin test: blue bs cardfile demo_defkey demo_forms demo_keyok ditto filter firework firstlast gdc hanoi hashtest ins_wide inserts knight lrtest ncurses newdemo rain tclock testaddch testcurs testscanw view worm xmas +endwin test: background blue bs cardfile color_set demo_defkey demo_forms demo_keyok demo_menus ditto filter firework firstlast gdc hanoi hashtest ins_wide inserts keynames knight lrtest ncurses newdemo rain tclock testaddch testcurs testscanw view worm xmas erase test: cardfile filter firework firstlast hanoi lrtest ncurses tclock testcurs erasechar lib: ncurses erasewchar - @@ -265,16 +265,16 @@ flushinp test: ncurses newdemo testcurs get_wch - get_wstr - getbkgd test: ncurses -getbkgrnd - -getcchar test: view -getch test: blue bs ditto firework firstlast hanoi hashtest lrtest rain tclock testaddch testcurs view worm xmas +getbkgrnd test: ncurses +getcchar test: ncurses view +getch test: background blue bs color_set ditto firework firstlast hanoi hashtest lrtest rain tclock testaddch testcurs view worm xmas getmouse test: bs knight ncurses getn_wstr - getnstr test: filter ncurses getstr - getwin test: ncurses halfdelay test: view -has_colors test: bs demo_forms filter firework gdc hanoi ins_wide inserts knight ncurses newdemo rain tclock testcurs view worm xmas +has_colors test: background bs cardfile color_set demo_forms demo_menus filter firework gdc hanoi ins_wide inserts knight ncurses newdemo rain tclock testcurs view worm xmas has_ic test: lrtest has_il lib: ncurses has_key lib: ncurses @@ -290,18 +290,18 @@ inch - inchnstr - inchstr - init_color test: ncurses -init_pair test: blue bs demo_forms filter firework gdc hanoi ins_wide inserts knight ncurses newdemo rain tclock testaddch testcurs view worm xmas -initscr test: blue bs cardfile demo_defkey demo_forms demo_keyok firework firstlast gdc hanoi hashtest ins_wide inserts knight lrtest ncurses newdemo rain tclock testaddch testcurs testscanw view worm xmas +init_pair test: background blue bs cardfile color_set demo_forms demo_menus filter firework gdc hanoi ins_wide inserts knight ncurses newdemo rain tclock testaddch testcurs view worm xmas +initscr test: background blue bs cardfile color_set demo_defkey demo_forms demo_keyok demo_menus firework firstlast gdc hanoi hashtest ins_wide inserts knight lrtest ncurses newdemo rain tclock testaddch testcurs testscanw view worm xmas innstr - innwstr - -ins_nwstr - -ins_wch - -ins_wstr - -insch - +ins_nwstr test: ins_wide +ins_wch test: ins_wide +ins_wstr test: ins_wide +insch test: ins_wide inserts insdelln - insertln - -insnstr - -insstr - +insnstr test: inserts +insstr test: inserts instr - intrflush test: demo_forms inwstr - @@ -314,17 +314,17 @@ key_name test: ncurses keybound test: demo_defkey keyname test: demo_defkey demo_keyok edit_field keynames ncurses testcurs view progs: tic keyok test: demo_keyok -keypad test: bs cardfile demo_defkey demo_forms demo_keyok edit_field filter firework hashtest ins_wide inserts knight lrtest ncurses tclock testcurs testscanw view +keypad test: bs cardfile demo_defkey demo_forms demo_keyok demo_menus edit_field filter firework hashtest ins_wide inserts keynames knight lrtest ncurses tclock testcurs testscanw view killchar lib: ncurses killwchar - leaveok test: hanoi longname test: testcurs progs: tput mcprint - meta test: ncurses -mouse_trafo - +mouse_trafo lib: menu mouseinterval - -mousemask test: bs knight ncurses -move test: blue bs cardfile gdc hanoi hashtest knight lrtest ncurses testscanw view worm xmas +mousemask test: bs demo_menus knight ncurses +move test: blue bs cardfile demo_menus gdc hanoi hashtest ins_wide inserts knight lrtest ncurses testscanw view worm xmas mvadd_wch test: ncurses mvadd_wchnstr - mvadd_wchstr - @@ -355,20 +355,20 @@ mvinchnstr test: gdc mvinchstr - mvinnstr - mvinnwstr - -mvins_nwstr - -mvins_wch - -mvins_wstr - -mvinsch - -mvinsnstr - -mvinsstr - +mvins_nwstr test: ins_wide +mvins_wch test: ins_wide +mvins_wstr test: ins_wide +mvinsch test: ins_wide inserts +mvinsnstr test: inserts +mvinsstr test: inserts mvinstr - mvinwstr - -mvprintw test: bs firework hanoi ncurses tclock view +mvprintw test: bs demo_menus firework hanoi ncurses tclock view mvscanw - mvvline test: ncurses mvvline_set test: ncurses mvwadd_wch - -mvwadd_wchnstr - +mvwadd_wchnstr lib: form mvwadd_wchstr - mvwaddch test: newdemo testcurs xmas mvwaddchnstr - @@ -389,18 +389,18 @@ mvwhline lib: ncurses mvwhline_set - mvwin test: cardfile testcurs xmas mvwin_wch - -mvwin_wchnstr - +mvwin_wchnstr lib: form mvwin_wchstr - mvwinch test: newdemo testcurs mvwinchnstr - mvwinchstr - mvwinnstr test: testcurs mvwinnwstr - -mvwins_nwstr - +mvwins_nwstr test: ins_wide mvwins_wch test: ins_wide mvwins_wstr test: ins_wide mvwinsch test: ins_wide inserts -mvwinsnstr - +mvwinsnstr test: inserts mvwinsstr test: inserts testcurs mvwinstr - mvwinwstr - @@ -408,18 +408,18 @@ mvwprintw test: ncurses testcurs mvwscanw test: testcurs mvwvline test: ins_wide inserts mvwvline_set - -napms test: firework gdc hanoi lrtest ncurses newdemo railroad rain tclock testcurs view worm xmas progs: tset +napms test: dots firework gdc hanoi lrtest ncurses newdemo railroad rain tclock testcurs view worm xmas progs: tset newpad test: edit_field ncurses testcurs newscr lib: ncurses -newterm test: ditto filter gdc -newwin test: cardfile demo_defkey demo_forms demo_keyok edit_field firstlast ins_wide inserts knight ncurses newdemo testcurs xmas +newterm test: ditto filter gdc keynames +newwin test: cardfile demo_defkey demo_forms demo_keyok demo_menus edit_field firstlast ins_wide inserts knight ncurses newdemo testcurs xmas nl test: demo_forms ncurses rain testcurs nocbreak test: testcurs nodelay test: firework gdc lrtest ncurses newdemo rain tclock view xmas -noecho test: bs cardfile demo_defkey demo_forms demo_keyok ditto firework firstlast gdc hanoi hashtest ins_wide inserts knight lrtest ncurses rain tclock testcurs view worm xmas +noecho test: background bs cardfile color_set demo_defkey demo_forms demo_keyok demo_menus ditto firework firstlast gdc hanoi hashtest ins_wide inserts knight lrtest ncurses rain tclock testcurs view worm xmas nonl test: bs demo_forms hashtest ncurses view worm xmas noqiflush - -noraw test: demo_forms ncurses testcurs +noraw test: demo_forms demo_menus ncurses testcurs notimeout - numcodes progs: dump_entry numfnames progs: dump_entry @@ -427,17 +427,18 @@ numnames progs: dump_entry infocmp ospeed progs: tset overlay test: testcurs xmas overwrite test: ncurses -pair_content lib: ncurses +pair_content test: background color_set +pecho_wchar - pechochar - pnoutrefresh test: edit_field ncurses prefresh test: testcurs -printw test: blue bs demo_defkey demo_keyok filter ncurses testcurs testscanw view +printw test: background blue bs color_set demo_defkey demo_keyok filter ncurses testcurs testscanw view putp progs: tput putwin test: ncurses qiflush - raw test: demo_forms ncurses testcurs redrawwin - -refresh test: blue bs demo_defkey demo_forms demo_keyok ditto filter firstlast gdc hanoi hashtest lrtest ncurses tclock testcurs view worm xmas +refresh test: blue bs demo_defkey demo_forms demo_keyok demo_menus ditto filter firstlast gdc hanoi hashtest lrtest ncurses tclock testcurs view worm xmas reset_prog_mode test: filter ncurses reset_shell_mode test: bs filter resetty - @@ -478,38 +479,38 @@ slk_touch test: ncurses slk_wset test: ncurses standend test: blue gdc ncurses worm standout test: blue ncurses -start_color test: blue bs demo_forms filter firework gdc hanoi ins_wide inserts knight ncurses newdemo rain tclock testaddch testcurs view worm xmas -stdscr test: bs demo_forms ditto filter firework gdc hanoi hashtest ins_wide inserts knight lrtest ncurses rain tclock testcurs testscanw view xmas +start_color test: background blue bs cardfile color_set demo_forms demo_menus filter firework gdc hanoi ins_wide inserts knight ncurses newdemo rain tclock testaddch testcurs view worm xmas +stdscr test: bs demo_forms ditto filter firework gdc hanoi hashtest ins_wide inserts keynames knight lrtest ncurses rain tclock testcurs testscanw view xmas strcodes progs: dump_entry strfnames progs: dump_entry strnames progs: dump_entry infocmp tic subpad test: testcurs subwin test: ncurses newdemo testcurs syncok - -term_attrs - +term_attrs test: ncurses termattrs test: ncurses testcurs termname test: testcurs -tgetent test: railroad -tgetflag - -tgetnum test: railroad -tgetstr test: railroad +tgetent test: demo_termcap railroad +tgetflag test: demo_termcap +tgetnum test: demo_termcap railroad +tgetstr test: demo_termcap railroad tgoto test: railroad tigetflag progs: tput tigetnum test: ncurses progs: tput tigetstr test: blue demo_defkey testcurs progs: tput timeout test: rain touchline lib: ncurses -touchwin test: edit_field filter firstlast ncurses xmas +touchwin test: demo_menus edit_field filter firstlast ins_wide inserts ncurses xmas tparm test: dots progs: tic tput tputs test: dots railroad progs: clear tset -trace test: hanoi hashtest lrtest ncurses testcurs view worm +trace test: demo_menus hanoi hashtest lrtest ncurses testcurs view worm ttytype lib: ncurses typeahead test: testcurs unctrl test: ncurses testcurs unget_wch - ungetch test: bs knight ungetmouse - -untouchwin - +untouchwin lib: form use_default_colors test: filter firework gdc hanoi knight ncurses rain tclock worm xmas use_env progs: tput use_extended_names progs: infocmp tic @@ -524,23 +525,23 @@ vw_scanw - vwprintw lib: ncurses vwscanw lib: ncurses wadd_wch lib: ncurses -wadd_wchnstr lib: ncurses +wadd_wchnstr lib: form wadd_wchstr - -waddch test: firstlast knight ncurses +waddch test: demo_forms firstlast knight ncurses waddchnstr lib: ncurses waddchstr - -waddnstr lib: form +waddnstr lib: menu waddnwstr test: ncurses waddstr test: demo_forms edit_field firstlast ins_wide knight ncurses testcurs waddwstr test: ins_wide wattr_get - -wattr_off lib: menu -wattr_on lib: menu +wattr_off lib: ncurses +wattr_on lib: ncurses wattr_set - wattroff test: demo_forms ncurses testcurs xmas wattron test: testcurs xmas wattrset test: demo_forms ncurses newdemo testcurs xmas -wbkgd test: demo_forms ncurses newdemo testcurs +wbkgd test: cardfile demo_forms ncurses newdemo testcurs wbkgdset test: ins_wide inserts ncurses wbkgrnd lib: ncurses wbkgrndset lib: ncurses @@ -560,28 +561,28 @@ wenclose lib: menu werase test: cardfile demo_forms edit_field firstlast knight ncurses newdemo testcurs xmas wget_wch test: ins_wide ncurses wget_wstr - -wgetch test: cardfile demo_defkey demo_keyok edit_field gdc inserts knight ncurses newdemo testcurs +wgetch test: cardfile demo_defkey demo_keyok demo_menus edit_field gdc inserts knight ncurses newdemo testcurs wgetn_wstr test: ncurses wgetnstr test: ncurses wgetstr - whline test: testcurs whline_set lib: ncurses -win_wch lib: ncurses -win_wchnstr lib: ncurses +win_wch lib: form +win_wchnstr lib: form win_wchstr - winch test: knight testcurs winchnstr lib: ncurses winchstr - winnstr test: demo_defkey winnwstr lib: ncurses -wins_nwstr lib: ncurses -wins_wch lib: ncurses -wins_wstr - -winsch test: testcurs -winsdelln lib: form +wins_nwstr test: ins_wide +wins_wch test: ins_wide +wins_wstr test: ins_wide +winsch test: ins_wide inserts testcurs +winsdelln lib: ncurses winsertln test: testcurs -winsnstr lib: form -winsstr - +winsnstr test: inserts +winsstr test: inserts winstr - winwstr lib: ncurses wmouse_trafo lib: menu @@ -589,7 +590,7 @@ wmove test: demo_defkey demo_keyok firstlast ins_wide inserts knight ncurses wnoutrefresh test: edit_field ins_wide inserts knight ncurses wprintw test: demo_defkey demo_forms demo_keyok edit_field ins_wide inserts knight ncurses testcurs wredrawln lib: ncurses -wrefresh test: demo_forms demo_keyok edit_field firstlast knight lrtest ncurses newdemo tclock testcurs view xmas +wrefresh test: demo_forms demo_keyok demo_menus edit_field firstlast knight lrtest ncurses newdemo tclock testcurs view xmas wresize test: cardfile ncurses wscanw test: testcurs wscrl test: ncurses testcurs view @@ -599,7 +600,7 @@ wstandout test: xmas wsyncdown lib: ncurses wsyncup lib: form wtimeout test: ncurses -wtouchln lib: form +wtouchln lib: ncurses wunctrl - wvline test: testcurs wvline_set lib: ncurses diff --git a/test/aclocal.m4 b/test/aclocal.m4 index 47928a05..2d3d9ed9 100644 --- a/test/aclocal.m4 +++ b/test/aclocal.m4 @@ -1,6 +1,88 @@ -dnl $Id: aclocal.m4,v 1.6 2003/10/19 00:09:23 tom Exp $ +dnl $Id: aclocal.m4,v 1.8 2005/02/27 00:02:01 tom Exp $ dnl --------------------------------------------------------------------------- dnl --------------------------------------------------------------------------- +dnl CF_ADD_CFLAGS version: 7 updated: 2004/04/25 17:48:30 +dnl ------------- +dnl Copy non-preprocessor flags to $CFLAGS, preprocessor flags to $CPPFLAGS +dnl The second parameter if given makes this macro verbose. +dnl +dnl Put any preprocessor definitions that use quoted strings in $EXTRA_CPPFLAGS, +dnl to simplify use of $CPPFLAGS in compiler checks, etc., that are easily +dnl confused by the quotes (which require backslashes to keep them usable). +AC_DEFUN([CF_ADD_CFLAGS], +[ +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $1 +do +case $cf_fix_cppflags in +no) + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[[^=]]*='\''\"[[^"]]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + *$cf_add_cflags) #(vi + ;; + *) #(vi + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + *) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[[^"]]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + ifelse($2,,,[CF_VERBOSE(add to \$CFLAGS $cf_new_cflags)]) + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + ifelse($2,,,[CF_VERBOSE(add to \$CPPFLAGS $cf_new_cppflags)]) + CPPFLAGS="$cf_new_cppflags $CPPFLAGS" +fi + +if test -n "$cf_new_extra_cppflags" ; then + ifelse($2,,,[CF_VERBOSE(add to \$EXTRA_CPPFLAGS $cf_new_extra_cppflags)]) + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + +AC_SUBST(EXTRA_CPPFLAGS) + +])dnl +dnl --------------------------------------------------------------------------- dnl CF_ADD_INCDIR version: 4 updated: 2002/12/21 14:25:52 dnl ------------- dnl Add an include-directory to $CPPFLAGS. Don't add /usr/include, since it's @@ -39,7 +121,77 @@ do done ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CHECK_CACHE version: 7 updated: 2001/12/19 00:50:10 +dnl CF_ANSI_CC_CHECK version: 9 updated: 2001/12/30 17:53:34 +dnl ---------------- +dnl This is adapted from the macros 'fp_PROG_CC_STDC' and 'fp_C_PROTOTYPES' +dnl in the sharutils 4.2 distribution. +AC_DEFUN([CF_ANSI_CC_CHECK], +[ +AC_CACHE_CHECK(for ${CC-cc} option to accept ANSI C, cf_cv_ansi_cc,[ +cf_cv_ansi_cc=no +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc +# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) +for cf_arg in "-DCC_HAS_PROTOS" \ + "" \ + -qlanglvl=ansi \ + -std1 \ + -Ae \ + "-Aa -D_HPUX_SOURCE" \ + -Xc +do + CF_ADD_CFLAGS($cf_arg) + AC_TRY_COMPILE( +[ +#ifndef CC_HAS_PROTOS +#if !defined(__STDC__) || (__STDC__ != 1) +choke me +#endif +#endif +],[ + int test (int i, double x); + struct s1 {int (*f) (int a);}; + struct s2 {int (*f) (double a);};], + [cf_cv_ansi_cc="$cf_arg"; break]) +done +CFLAGS="$cf_save_CFLAGS" +CPPFLAGS="$cf_save_CPPFLAGS" +]) + +if test "$cf_cv_ansi_cc" != "no"; then +if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then + CF_ADD_CFLAGS($cf_cv_ansi_cc) +else + AC_DEFINE(CC_HAS_PROTOS) +fi +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_ANSI_CC_REQD version: 3 updated: 1997/09/06 13:40:44 +dnl --------------- +dnl For programs that must use an ANSI compiler, obtain compiler options that +dnl will make it recognize prototypes. We'll do preprocessor checks in other +dnl macros, since tools such as unproto can fake prototypes, but only part of +dnl the preprocessor. +AC_DEFUN([CF_ANSI_CC_REQD], +[AC_REQUIRE([CF_ANSI_CC_CHECK]) +if test "$cf_cv_ansi_cc" = "no"; then + AC_ERROR( +[Your compiler does not appear to recognize prototypes. +You have the following choices: + a. adjust your compiler options + b. get an up-to-date compiler + c. use a wrapper such as unproto]) +fi +])dnl +dnl --------------------------------------------------------------------------- +dnl CF_CHECK_CACHE version: 10 updated: 2004/05/23 13:03:31 dnl -------------- dnl Check if we're accidentally using a cache from a different machine. dnl Derive the system name, as a check for reusing the autoconf cache. @@ -48,9 +200,12 @@ dnl If we've packaged config.guess and config.sub, run that (since it does a dnl better job than uname). Normally we'll use AC_CANONICAL_HOST, but allow dnl an extra parameter that we may override, e.g., for AC_CANONICAL_SYSTEM dnl which is useful in cross-compiles. +dnl +dnl Note: we would use $ac_config_sub, but that is one of the places where +dnl autoconf 2.5x broke compatibility with autoconf 2.13 AC_DEFUN([CF_CHECK_CACHE], [ -if test -f $srcdir/config.guess ; then +if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then ifelse([$1],,[AC_CANONICAL_HOST],[$1]) system_name="$host_os" else @@ -157,12 +312,13 @@ AC_CHECK_HEADERS($cf_cv_ncurses_header) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_CURSES_LIBS version: 22 updated: 2002/10/27 18:21:42 +dnl CF_CURSES_LIBS version: 23 updated: 2003/11/06 19:59:57 dnl -------------- dnl Look for the curses libraries. Older curses implementations may require dnl termcap/termlib to be linked as well. Call CF_CURSES_CPPFLAGS first. AC_DEFUN([CF_CURSES_LIBS],[ +AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl AC_MSG_CHECKING(if we have identified curses libraries) AC_TRY_LINK([#include <${cf_cv_ncurses_header-curses.h}>], [initscr(); tgoto("?", 0,0)], @@ -281,7 +437,7 @@ dnl ---------- dnl "dirname" is not portable, so we fake it with a shell script. AC_DEFUN([CF_DIRNAME],[$1=`echo $2 | sed -e 's%/[[^/]]*$%%'`])dnl dnl --------------------------------------------------------------------------- -dnl CF_FIND_LIBRARY version: 7 updated: 2000/04/13 21:38:04 +dnl CF_FIND_LIBRARY version: 8 updated: 2004/11/23 20:14:58 dnl --------------- dnl Look for a non-standard library, given parameters for AC_TRY_LINK. We dnl prefer a standard location, and use -L options only if we do not find the @@ -291,7 +447,7 @@ dnl $2 = library class, usually the same as library name dnl $3 = includes dnl $4 = code fragment to compile/link dnl $5 = corresponding function-name -dnl $6 = flag, nonnull if failure causes an error-exit +dnl $6 = flag, nonnull if failure should not cause an error-exit dnl dnl Sets the variable "$cf_libdir" as a side-effect, so we can see if we had dnl to use a -L option. @@ -353,7 +509,7 @@ rm -f core]) test "$cf_cv_func_curses_version" = yes && AC_DEFINE(HAVE_CURSES_VERSION) ]) dnl --------------------------------------------------------------------------- -dnl CF_GNU_SOURCE version: 3 updated: 2000/10/29 23:30:53 +dnl CF_GNU_SOURCE version: 4 updated: 2004/12/03 20:43:00 dnl ------------- dnl Check if we must define _GNU_SOURCE to get a reasonable value for dnl _XOPEN_SOURCE, upon which many POSIX definitions depend. This is a defect @@ -363,6 +519,9 @@ dnl dnl Well, yes we could work around it... AC_DEFUN([CF_GNU_SOURCE], [ +AC_REQUIRE([CF_INTEL_COMPILER]) + +if test "$INTEL_COMPILER" = no ; then AC_CACHE_CHECK(if we must define _GNU_SOURCE,cf_cv_gnu_source,[ AC_TRY_COMPILE([#include ],[ #ifndef _XOPEN_SOURCE @@ -381,6 +540,7 @@ make an error ]) ]) test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" +fi ])dnl dnl --------------------------------------------------------------------------- dnl CF_HEADER_PATH version: 8 updated: 2002/11/10 14:46:59 @@ -412,12 +572,54 @@ AC_DEFUN([CF_INHERIT_SCRIPT], test -f $1 || ( test -f ../$1 && cp ../$1 ./ ) ])dnl dnl --------------------------------------------------------------------------- +dnl CF_INTEL_COMPILER version: 1 updated: 2004/12/03 20:27:48 +dnl ----------------- +dnl Check if the given compiler is really the Intel compiler for Linux. +dnl It tries to imitate gcc, but does not return an error when it finds a +dnl mismatch between prototypes, e.g., as exercised by CF_MISSING_CHECK. +dnl +dnl This macro should be run "soon" after AC_PROG_CC, to ensure that it is +dnl not mistaken for gcc. +AC_DEFUN([CF_INTEL_COMPILER],[ +AC_REQUIRE([AC_PROG_CC]) + +INTEL_COMPILER=no + +if test "$GCC" = yes ; then + case $host_os in + linux*|gnu*) + AC_MSG_CHECKING(if this is really Intel compiler) + cf_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -no-gcc" + AC_TRY_COMPILE([],[ +#ifdef __INTEL_COMPILER +#else +make an error +#endif +],[INTEL_COMPILER=yes +cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" +],[]) + CFLAGS="$cf_save_CFLAGS" + AC_MSG_RESULT($INTEL_COMPILER) + ;; + esac +fi +])dnl +dnl --------------------------------------------------------------------------- dnl CF_LIBRARY_PATH version: 7 updated: 2002/11/10 14:46:59 dnl --------------- dnl Construct a search-list for a nonstandard library-file AC_DEFUN([CF_LIBRARY_PATH], [CF_SUBDIR_PATH($1,$2,lib)])dnl dnl --------------------------------------------------------------------------- +dnl CF_MSG_LOG version: 3 updated: 1997/09/07 14:05:52 +dnl ---------- +dnl Write a debug message to config.log, along with the line number in the +dnl configure script. +AC_DEFUN([CF_MSG_LOG],[ +echo "(line __oline__) testing $* ..." 1>&AC_FD_CC +])dnl +dnl --------------------------------------------------------------------------- dnl CF_NCURSES_CC_CHECK version: 3 updated: 2003/01/12 18:59:28 dnl ------------------- dnl Check if we can compile with ncurses' header file @@ -451,7 +653,7 @@ printf("old\n"); ,[$1=no]) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_CPPFLAGS version: 16 updated: 2002/12/29 18:30:46 +dnl CF_NCURSES_CPPFLAGS version: 17 updated: 2003/11/06 19:59:57 dnl ------------------- dnl Look for the SVr4 curses clone 'ncurses' in the standard places, adjusting dnl the CPPFLAGS variable so we can include its header. @@ -475,6 +677,7 @@ dnl wide-character version of ncurses is installed. AC_DEFUN([CF_NCURSES_CPPFLAGS], [AC_REQUIRE([CF_WITH_CURSES_DIR]) +AC_PROVIDE([CF_CURSES_CPPFLAGS])dnl cf_ncuhdr_root=ifelse($1,,ncurses,$1) test -n "$cf_cv_curses_dir" && \ @@ -549,7 +752,7 @@ esac CF_NCURSES_VERSION ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_LIBS version: 11 updated: 2002/12/22 14:22:25 +dnl CF_NCURSES_LIBS version: 12 updated: 2004/04/27 16:26:05 dnl --------------- dnl Look for the ncurses library. This is a little complicated on Linux, dnl because it may be linked with the gpm (general purpose mouse) library. @@ -579,7 +782,9 @@ case $host_os in #(vi freebsd*) # This is only necessary if you are linking against an obsolete # version of ncurses (but it should do no harm, since it's static). - AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"]) + if test "$cf_nculib_root" = ncurses ; then + AC_CHECK_LIB(mytinfo,tgoto,[cf_ncurses_LIBS="-lmytinfo $cf_ncurses_LIBS"]) + fi ;; esac @@ -615,13 +820,14 @@ CF_UPPER(cf_nculib_ROOT,HAVE_LIB$cf_nculib_root) AC_DEFINE_UNQUOTED($cf_nculib_ROOT) ])dnl dnl --------------------------------------------------------------------------- -dnl CF_NCURSES_VERSION version: 10 updated: 2002/10/27 18:21:42 +dnl CF_NCURSES_VERSION version: 11 updated: 2003/11/06 19:59:57 dnl ------------------ dnl Check for the version of ncurses, to aid in reporting bugs, etc. dnl Call CF_CURSES_CPPFLAGS first, or CF_NCURSES_CPPFLAGS. We don't use dnl AC_REQUIRE since that does not work with the shell's if/then/else/fi. AC_DEFUN([CF_NCURSES_VERSION], [ +AC_REQUIRE([CF_CURSES_CPPFLAGS])dnl AC_CACHE_CHECK(for ncurses version, cf_cv_ncurses_version,[ cf_cv_ncurses_version=no cf_tempfile=out$$ @@ -707,37 +913,63 @@ case ".[$]$1" in #(vi esac ])dnl dnl --------------------------------------------------------------------------- -dnl CF_PREDEFINE version: 1 updated: 2003/07/26 17:53:56 -dnl ------------ -dnl Add definitions to CPPFLAGS to ensure they're predefined for all compiles. +dnl CF_POSIX_C_SOURCE version: 3 updated: 2005/02/04 06:56:22 +dnl ----------------- +dnl Define _POSIX_C_SOURCE to the given level, and _POSIX_SOURCE if needed. dnl -dnl $1 = symbol to test -dnl $2 = value (if any) to use for a predefinition -AC_DEFUN([CF_PREDEFINE], +dnl POSIX.1-1990 _POSIX_SOURCE +dnl POSIX.1-1990 and _POSIX_SOURCE and +dnl POSIX.2-1992 C-Language _POSIX_C_SOURCE=2 +dnl Bindings Option +dnl POSIX.1b-1993 _POSIX_C_SOURCE=199309L +dnl POSIX.1c-1996 _POSIX_C_SOURCE=199506L +dnl X/Open 2000 _POSIX_C_SOURCE=200112L +dnl +dnl Parameters: +dnl $1 is the nominal value for _POSIX_C_SOURCE +AC_DEFUN([CF_POSIX_C_SOURCE], [ -AC_MSG_CHECKING(if we must define $1) -AC_TRY_COMPILE([#include -],[ -#ifndef $1 +cf_POSIX_C_SOURCE=ifelse($1,,199506L,$1) +AC_CACHE_CHECK(if we should define _POSIX_C_SOURCE,cf_cv_posix_c_source,[ + CF_MSG_LOG(if the symbol is already defined go no further) + AC_TRY_COMPILE([#include ],[ +#ifndef _POSIX_C_SOURCE make an error -#endif],[cf_result=no],[cf_result=yes]) -AC_MSG_RESULT($cf_result) - -if test "$cf_result" = yes ; then - CPPFLAGS="$CPPFLAGS ifelse($2,,-D$1,[-D$1=$2])" -elif test "x$2" != "x" ; then - AC_MSG_CHECKING(checking for compatible value versus $2) - AC_TRY_COMPILE([#include -],[ -#if $1-$2 < 0 +#endif], + [cf_cv_posix_c_source=no], + [cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in + .[[12]]??*) + cf_cv_posix_c_source="-U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + .2) + cf_cv_posix_c_source="-U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + .*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then + AC_TRY_COMPILE([#include ],[ +#ifdef _POSIX_SOURCE make an error -#endif],[cf_result=yes],[cf_result=no]) - AC_MSG_RESULT($cf_result) - if test "$cf_result" = no ; then - # perhaps we can override it - try... - CPPFLAGS="$CPPFLAGS -D$1=$2" - fi -fi +#endif],[], + cf_cv_posix_c_source="$cf_cv_posix_c_source -U_POSIX_SOURCE -D_POSIX_SOURCE") + fi + CF_MSG_LOG(ifdef from value $cf_POSIX_C_SOURCE) + cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source" + CF_MSG_LOG(if the second compile does not leave our definition intact error) + AC_TRY_COMPILE([#include ],[ +#ifndef _POSIX_C_SOURCE +make an error +#endif],, + [cf_cv_posix_c_source=no]) + CPPFLAGS="$cf_save" + ]) +]) +test "$cf_cv_posix_c_source" != no && CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source" ])dnl dnl --------------------------------------------------------------------------- dnl CF_SUBDIR_PATH version: 3 updated: 2002/12/29 18:30:46 @@ -862,6 +1094,13 @@ if test "$cf_cv_utf8_lib" = "add-on" ; then fi ])dnl dnl --------------------------------------------------------------------------- +dnl CF_VERBOSE version: 2 updated: 1997/09/05 10:45:14 +dnl ---------- +dnl Use AC_VERBOSE w/o the warnings +AC_DEFUN([CF_VERBOSE], +[test -n "$verbose" && echo " $1" 1>&AC_FD_MSG +])dnl +dnl --------------------------------------------------------------------------- dnl CF_WITH_CURSES_DIR version: 2 updated: 2002/11/10 14:46:59 dnl ------------------ dnl Wrapper for AC_ARG_WITH to specify directory under which to look for curses @@ -873,3 +1112,79 @@ AC_ARG_WITH(curses-dir, cf_cv_curses_dir=$withval], [cf_cv_curses_dir=no]) ])dnl +dnl --------------------------------------------------------------------------- +dnl CF_XOPEN_SOURCE version: 17 updated: 2005/02/06 12:07:45 +dnl --------------- +dnl Try to get _XOPEN_SOURCE defined properly that we can use POSIX functions, +dnl or adapt to the vendor's definitions to get equivalent functionality. +dnl +dnl Parameters: +dnl $1 is the nominal value for _XOPEN_SOURCE +dnl $2 is the nominal value for _POSIX_C_SOURCE +AC_DEFUN([CF_XOPEN_SOURCE],[ + +cf_XOPEN_SOURCE=ifelse($1,,500,$1) +cf_POSIX_C_SOURCE=ifelse($2,,199506L,$2) + +case $host_os in #(vi +aix[[45]]*) #(vi + CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE" + ;; +freebsd*) #(vi + # 5.x headers associate + # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L + # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L + cf_POSIX_C_SOURCE=200112L + cf_XOPEN_SOURCE=600 + CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + ;; +hpux*) #(vi + CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE" + ;; +irix[[56]].*) #(vi + CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE" + ;; +linux*|gnu*) #(vi + CF_GNU_SOURCE + ;; +mirbsd*) #(vi + # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks + ;; +netbsd*) #(vi + # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw + ;; +openbsd*) #(vi + # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw + ;; +osf[[45]]*) #(vi + CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE" + ;; +sco*) #(vi + # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer + ;; +solaris*) #(vi + CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__" + ;; +*) + AC_CACHE_CHECK(if we should define _XOPEN_SOURCE,cf_cv_xopen_source,[ + AC_TRY_COMPILE([#include ],[ +#ifndef _XOPEN_SOURCE +make an error +#endif], + [cf_cv_xopen_source=no], + [cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + AC_TRY_COMPILE([#include ],[ +#ifdef _XOPEN_SOURCE +make an error +#endif], + [cf_cv_xopen_source=no], + [cf_cv_xopen_source=$cf_XOPEN_SOURCE]) + CPPFLAGS="$cf_save" + ]) +]) +test "$cf_cv_xopen_source" != no && CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE -D_XOPEN_SOURCE=$cf_cv_xopen_source" + CF_POSIX_C_SOURCE($cf_POSIX_C_SOURCE) + ;; +esac +]) diff --git a/test/blue.c b/test/blue.c index cd0ccdaa..9cdb9125 100644 --- a/test/blue.c +++ b/test/blue.c @@ -13,13 +13,13 @@ * results, use the ncurses(3) library. On non-Intel machines, SVr4 curses is * just as good. * - * $Id: blue.c,v 1.24 2002/06/29 23:32:18 tom Exp $ + * $Id: blue.c,v 1.25 2005/05/28 21:38:03 tom Exp $ */ -#include - #include +#include + #define NOCARD (-1) #define ACE 0 diff --git a/test/bs.c b/test/bs.c index 749faf01..5b9f6ecd 100644 --- a/test/bs.c +++ b/test/bs.c @@ -7,13 +7,13 @@ * v2.0 featuring strict ANSI/POSIX conformance, November 1993. * v2.1 with ncurses mouse support, September 1995 * - * $Id: bs.c,v 1.39 2003/12/06 18:10:13 tom Exp $ + * $Id: bs.c,v 1.41 2005/05/28 21:38:24 tom Exp $ */ -#include - #include +#include + #ifndef SIGIOT #define SIGIOT SIGABRT #endif @@ -249,7 +249,7 @@ intro(void) /* VARARGS1 */ static void -prompt(int n, const char *f, const char *s) +prompt(int n, NCURSES_CONST char *f, const char *s) /* print a message at the prompt line */ { (void) move(PROMPTLINE + n, 0); diff --git a/test/cardfile.c b/test/cardfile.c index 08d33ed4..318342f0 100644 --- a/test/cardfile.c +++ b/test/cardfile.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999-2002,2003 Free Software Foundation, Inc. * + * Copyright (c) 1999-2003,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -27,9 +27,9 @@ ****************************************************************************/ /* - * Author: Thomas E. Dickey 1999 + * Author: Thomas E. Dickey * - * $Id: cardfile.c,v 1.23 2003/04/26 16:43:56 tom Exp $ + * $Id: cardfile.c,v 1.27 2004/11/06 19:33:39 tom Exp $ * * File format: text beginning in column 1 is a title; other text is content. */ @@ -43,6 +43,10 @@ #define VISIBLE_CARDS 10 #define OFFSET_CARD 2 +#define pair_1 1 +#define pair_2 2 + +#define isVisible(cardp) ((cardp)->panel != 0) enum { MY_CTRL_x = MAX_FORM_COMMAND @@ -61,6 +65,7 @@ typedef struct _card { } CARD; static CARD *all_cards; +static bool try_color = FALSE; static char default_name[] = "cardfile.dat"; #if !HAVE_STRDUP @@ -238,7 +243,8 @@ order_cards(CARD * first, int depth) if (first) { if (depth && first->link) order_cards(first->link, depth - 1); - top_panel(first->panel); + if (isVisible(first)) + top_panel(first->panel); } } @@ -248,8 +254,13 @@ order_cards(CARD * first, int depth) static CARD * next_card(CARD * now) { - if (now->link) - now = now->link; + if (now->link != 0) { + CARD *tst = now->link; + if (isVisible(tst)) + now = tst; + else + tst = next_card(tst); + } return now; } @@ -260,9 +271,24 @@ static CARD * prev_card(CARD * now) { CARD *p; - for (p = all_cards; p != 0; p = p->link) - if (p->link == now) + for (p = all_cards; p != 0; p = p->link) { + if (p->link == now) { + if (!isVisible(p)) + p = prev_card(p); return p; + } + } + return now; +} + +/* + * Returns the first card in the list that we will display. + */ +static CARD * +first_card(CARD * now) +{ + if (!isVisible(now)) + now = next_card(now); return now; } @@ -355,23 +381,38 @@ cardfile(char *fname) WINDOW *win; CARD *p; CARD *top_card; - int visible_cards = count_cards(); - int panel_wide = COLS - (visible_cards * OFFSET_CARD); - int panel_high = LINES - (visible_cards * OFFSET_CARD) - 5; - int form_wide = panel_wide - 2; - int form_high = panel_high - 2; - int y = (visible_cards - 1) * OFFSET_CARD; - int x = 0; + int visible_cards; + int panel_wide; + int panel_high; + int form_wide; + int form_high; + int y; + int x; int ch = ERR; int last_ch; int finished = FALSE; show_legend(); + /* decide how many cards we can display */ + visible_cards = count_cards(); + while ( + (panel_wide = COLS - (visible_cards * OFFSET_CARD)) < 10 || + (panel_high = LINES - (visible_cards * OFFSET_CARD) - 5) < 5) { + --visible_cards; + } + form_wide = panel_wide - 2; + form_high = panel_high - 2; + y = (visible_cards - 1) * OFFSET_CARD; + x = 0; + /* make a panel for each CARD */ for (p = all_cards; p != 0; p = p->link) { - win = newwin(panel_high, panel_wide, y, x); + if ((win = newwin(panel_high, panel_wide, y, x)) == 0) + break; + + wbkgd(win, COLOR_PAIR(pair_2)); keypad(win, TRUE); p->panel = new_panel(win); box(win, 0, 0); @@ -385,7 +426,8 @@ cardfile(char *fname) x += OFFSET_CARD; } - order_cards(top_card = all_cards, visible_cards); + top_card = first_card(all_cards); + order_cards(top_card, visible_cards); while (!finished) { update_panels(); @@ -432,6 +474,8 @@ cardfile(char *fname) FIELD **oldf = form_fields(p->form); WINDOW *olds = form_sub(p->form); + if (!isVisible(p)) + continue; win = form_win(p->form); /* move and resize the card as needed @@ -483,15 +527,17 @@ cardfile(char *fname) p = all_cards; all_cards = all_cards->link; - f = form_fields(p->form); - count = field_count(p->form); + if (isVisible(p)) { + f = form_fields(p->form); + count = field_count(p->form); - unpost_form(p->form); /* ...so we can free it */ - free_form(p->form); /* this also disconnects the fields */ + unpost_form(p->form); /* ...so we can free it */ + free_form(p->form); /* this also disconnects the fields */ - free_form_fields(f); + free_form_fields(f); - del_panel(p->panel); + del_panel(p->panel); + } free(p->title); free(p->content); free(p); @@ -499,6 +545,22 @@ cardfile(char *fname) #endif } +static void +usage(void) +{ + static const char *msg[] = + { + "Usage: view [options] file" + ,"" + ,"Options:" + ," -c use color if terminal supports it" + }; + size_t n; + for (n = 0; n < SIZEOF(msg); n++) + fprintf(stderr, "%s\n", msg[n]); + ExitProgram(EXIT_FAILURE); +} + /*******************************************************************************/ int @@ -508,11 +570,32 @@ main(int argc, char *argv[]) setlocale(LC_ALL, ""); + while ((n = getopt(argc, argv, "c")) != EOF) { + switch (n) { + case 'c': + try_color = TRUE; + break; + default: + usage(); + } + } + initscr(); cbreak(); noecho(); - if (argc > 1) { + if (try_color) { + if (has_colors()) { + start_color(); + init_pair(pair_1, COLOR_WHITE, COLOR_BLUE); + init_pair(pair_2, COLOR_WHITE, COLOR_CYAN); + bkgd(COLOR_PAIR(pair_1)); + } else { + try_color = FALSE; + } + } + + if (optind + 1 == argc) { for (n = 1; n < argc; n++) read_data(argv[n]); if (count_cards() == 0) diff --git a/test/color_set.c b/test/color_set.c index ed061486..4ff61674 100644 --- a/test/color_set.c +++ b/test/color_set.c @@ -1,9 +1,11 @@ /* - * $Id: color_set.c,v 1.2 2003/12/07 00:08:47 tom Exp $ + * $Id: color_set.c,v 1.3 2004/04/10 20:10:28 tom Exp $ */ #include +#ifdef HAVE_COLOR_SET + #define SHOW(n) ((n) == ERR ? "ERR" : "OK") int @@ -53,3 +55,11 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) ExitProgram(EXIT_SUCCESS); } +#else +int +main(void) +{ + printf("This program requires the curses color_set function\n"); + ExitProgram(EXIT_FAILURE); +} +#endif diff --git a/test/configure b/test/configure index 9f513733..0eff2626 100755 --- a/test/configure +++ b/test/configure @@ -553,7 +553,7 @@ ac_config_sub=$ac_aux_dir/config.sub ac_configure=$ac_aux_dir/configure # This should be Cygnus configure. -if test -f $srcdir/config.guess ; then +if test -f $srcdir/config.guess || test -f $ac_aux_dir/config.guess ; then # Make sure we can run config.sub. if ${CONFIG_SHELL-/bin/sh} $ac_config_sub sun4 >/dev/null 2>&1; then : @@ -945,7 +945,6 @@ DFT_DEP_SUFFIX="" DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'` DFT_UPR_MODEL="NORMAL" ECHO_LINK='@ echo linking $@ ... ;' -EXTRA_LIBS="" LD="ld" LDFLAGS_SHARED="" LD_MODEL="" @@ -963,6 +962,7 @@ LOCAL_LDFLAGS="" MATH_LIB="-lm" TEST_ARGS="" TEST_DEPS="" +TINFO_ARGS='$(LIBS_CURSES)' cf_cv_abi_version="" cf_cv_rel_version="" @@ -1089,14 +1089,304 @@ OBJEXT=$ac_cv_objext ac_objext=$ac_cv_objext + +echo $ac_n "checking for ${CC-cc} option to accept ANSI C""... $ac_c" 1>&6 +echo "configure:1095: checking for ${CC-cc} option to accept ANSI C" >&5 +if eval "test \"`echo '$''{'cf_cv_ansi_cc'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + +cf_cv_ansi_cc=no +cf_save_CFLAGS="$CFLAGS" +cf_save_CPPFLAGS="$CPPFLAGS" +# Don't try gcc -ansi; that turns off useful extensions and +# breaks some systems' header files. +# AIX -qlanglvl=ansi +# Ultrix and OSF/1 -std1 +# HP-UX -Aa -D_HPUX_SOURCE +# SVR4 -Xc +# UnixWare 1.2 (cannot use -Xc, since ANSI/POSIX clashes) +for cf_arg in "-DCC_HAS_PROTOS" \ + "" \ + -qlanglvl=ansi \ + -std1 \ + -Ae \ + "-Aa -D_HPUX_SOURCE" \ + -Xc +do + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_arg +do +case $cf_fix_cppflags in +no) + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + *$cf_add_cflags) #(vi + ;; + *) #(vi + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + *) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$cf_new_cppflags $CPPFLAGS" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + + + + + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_ansi_cc="$cf_arg"; break +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* +done +CFLAGS="$cf_save_CFLAGS" +CPPFLAGS="$cf_save_CPPFLAGS" + +fi + +echo "$ac_t""$cf_cv_ansi_cc" 1>&6 + +if test "$cf_cv_ansi_cc" != "no"; then +if test ".$cf_cv_ansi_cc" != ".-DCC_HAS_PROTOS"; then + +cf_fix_cppflags=no +cf_new_cflags= +cf_new_cppflags= +cf_new_extra_cppflags= + +for cf_add_cflags in $cf_cv_ansi_cc +do +case $cf_fix_cppflags in +no) + case $cf_add_cflags in #(vi + -undef|-nostdinc*|-I*|-D*|-U*|-E|-P|-C) #(vi + case $cf_add_cflags in + -D*) + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^-D[^=]*='\''\"[^"]*//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=yes + + if test $cf_fix_cppflags = yes ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + elif test "${cf_tst_cflags}" = "\"'" ; then + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + continue + fi + ;; + esac + case "$CPPFLAGS" in + *$cf_add_cflags) #(vi + ;; + *) #(vi + cf_new_cppflags="$cf_new_cppflags $cf_add_cflags" + ;; + esac + ;; + *) + cf_new_cflags="$cf_new_cflags $cf_add_cflags" + ;; + esac + ;; +yes) + cf_new_extra_cppflags="$cf_new_extra_cppflags $cf_add_cflags" + + cf_tst_cflags=`echo ${cf_add_cflags} |sed -e 's/^[^"]*"'\''//'` + + test "${cf_add_cflags}" != "${cf_tst_cflags}" \ + && test -z "${cf_tst_cflags}" \ + && cf_fix_cppflags=no + ;; +esac +done + +if test -n "$cf_new_cflags" ; then + + CFLAGS="$CFLAGS $cf_new_cflags" +fi + +if test -n "$cf_new_cppflags" ; then + + CPPFLAGS="$cf_new_cppflags $CPPFLAGS" +fi + +if test -n "$cf_new_extra_cppflags" ; then + + EXTRA_CPPFLAGS="$cf_new_extra_cppflags $EXTRA_CPPFLAGS" +fi + + + + +else + cat >> confdefs.h <<\EOF +#define CC_HAS_PROTOS 1 +EOF + +fi +fi + + +if test "$cf_cv_ansi_cc" = "no"; then + { echo "configure: error: Your compiler does not appear to recognize prototypes. +You have the following choices: + a. adjust your compiler options + b. get an up-to-date compiler + c. use a wrapper such as unproto" 1>&2; exit 1; } +fi + + + + +INTEL_COMPILER=no + +if test "$GCC" = yes ; then + case $host_os in + linux*|gnu*) + echo $ac_n "checking if this is really Intel compiler""... $ac_c" 1>&6 +echo "configure:1323: checking if this is really Intel compiler" >&5 + cf_save_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -no-gcc" + cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + INTEL_COMPILER=yes +cf_save_CFLAGS="$cf_save_CFLAGS -we147 -no-gcc" + +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 +fi +rm -f conftest* + CFLAGS="$cf_save_CFLAGS" + echo "$ac_t""$INTEL_COMPILER" 1>&6 + ;; + esac +fi + + + +cf_XOPEN_SOURCE=500 +cf_POSIX_C_SOURCE=199506L + +case $host_os in #(vi +aix[45]*) #(vi + CPPFLAGS="$CPPFLAGS -D_ALL_SOURCE" + ;; +freebsd*) #(vi + # 5.x headers associate + # _XOPEN_SOURCE=600 with _POSIX_C_SOURCE=200112L + # _XOPEN_SOURCE=500 with _POSIX_C_SOURCE=199506L + cf_POSIX_C_SOURCE=200112L + cf_XOPEN_SOURCE=600 + CPPFLAGS="$CPPFLAGS -D_BSD_TYPES -D__BSD_VISIBLE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + ;; +hpux*) #(vi + CPPFLAGS="$CPPFLAGS -D_HPUX_SOURCE" + ;; +irix[56].*) #(vi + CPPFLAGS="$CPPFLAGS -D_SGI_SOURCE" + ;; +linux*|gnu*) #(vi + + + +if test "$INTEL_COMPILER" = no ; then echo $ac_n "checking if we must define _GNU_SOURCE""... $ac_c" 1>&6 -echo "configure:1094: checking if we must define _GNU_SOURCE" >&5 +echo "configure:1384: checking if we must define _GNU_SOURCE" >&5 if eval "test \"`echo '$''{'cf_cv_gnu_source'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < int main() { @@ -1106,7 +1396,7 @@ make an error #endif ; return 0; } EOF -if { (eval echo configure:1110: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1400: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_gnu_source=no else @@ -1116,7 +1406,7 @@ else cf_save="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" cat > conftest.$ac_ext < int main() { @@ -1126,7 +1416,7 @@ make an error #endif ; return 0; } EOF -if { (eval echo configure:1130: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1420: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_gnu_source=no else @@ -1145,6 +1435,189 @@ fi echo "$ac_t""$cf_cv_gnu_source" 1>&6 test "$cf_cv_gnu_source" = yes && CPPFLAGS="$CPPFLAGS -D_GNU_SOURCE" +fi + + ;; +mirbsd*) #(vi + # setting _XOPEN_SOURCE or _POSIX_SOURCE breaks + ;; +netbsd*) #(vi + # setting _XOPEN_SOURCE breaks IPv6 for lynx on NetBSD 1.6, breaks xterm, is not needed for ncursesw + ;; +openbsd*) #(vi + # setting _XOPEN_SOURCE breaks xterm on OpenBSD 2.8, is not needed for ncursesw + ;; +osf[45]*) #(vi + CPPFLAGS="$CPPFLAGS -D_OSF_SOURCE" + ;; +sco*) #(vi + # setting _XOPEN_SOURCE breaks Lynx on SCO Unix / OpenServer + ;; +solaris*) #(vi + CPPFLAGS="$CPPFLAGS -D__EXTENSIONS__" + ;; +*) + echo $ac_n "checking if we should define _XOPEN_SOURCE""... $ac_c" 1>&6 +echo "configure:1462: checking if we should define _XOPEN_SOURCE" >&5 +if eval "test \"`echo '$''{'cf_cv_xopen_source'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + cat > conftest.$ac_ext < +int main() { + +#ifndef _XOPEN_SOURCE +make an error +#endif +; return 0; } +EOF +if { (eval echo configure:1478: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_xopen_source=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=$cf_XOPEN_SOURCE" + cat > conftest.$ac_ext < +int main() { + +#ifdef _XOPEN_SOURCE +make an error +#endif +; return 0; } +EOF +if { (eval echo configure:1498: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_xopen_source=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_xopen_source=$cf_XOPEN_SOURCE +fi +rm -f conftest* + CPPFLAGS="$cf_save" + +fi +rm -f conftest* + +fi + +echo "$ac_t""$cf_cv_xopen_source" 1>&6 +test "$cf_cv_xopen_source" != no && CPPFLAGS="$CPPFLAGS -U_XOPEN_SOURCE -D_XOPEN_SOURCE=$cf_cv_xopen_source" + +cf_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE +echo $ac_n "checking if we should define _POSIX_C_SOURCE""... $ac_c" 1>&6 +echo "configure:1520: checking if we should define _POSIX_C_SOURCE" >&5 +if eval "test \"`echo '$''{'cf_cv_posix_c_source'+set}'`\" = set"; then + echo $ac_n "(cached) $ac_c" 1>&6 +else + + +echo "(line 1526) testing if the symbol is already defined go no further ..." 1>&5 + + cat > conftest.$ac_ext < +int main() { + +#ifndef _POSIX_C_SOURCE +make an error +#endif +; return 0; } +EOF +if { (eval echo configure:1539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + rm -rf conftest* + cf_cv_posix_c_source=no +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_want_posix_source=no + case .$cf_POSIX_C_SOURCE in + .[12]??*) + cf_cv_posix_c_source="-U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + ;; + .2) + cf_cv_posix_c_source="-U_POSIX_C_SOURCE -D_POSIX_C_SOURCE=$cf_POSIX_C_SOURCE" + cf_want_posix_source=yes + ;; + .*) + cf_want_posix_source=yes + ;; + esac + if test "$cf_want_posix_source" = yes ; then + cat > conftest.$ac_ext < +int main() { + +#ifdef _POSIX_SOURCE +make an error +#endif +; return 0; } +EOF +if { (eval echo configure:1571: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_posix_c_source="$cf_cv_posix_c_source -U_POSIX_SOURCE -D_POSIX_SOURCE" +fi +rm -f conftest* + fi + +echo "(line 1582) testing ifdef from value $cf_POSIX_C_SOURCE ..." 1>&5 + + cf_save="$CPPFLAGS" + CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source" + +echo "(line 1587) testing if the second compile does not leave our definition intact error ..." 1>&5 + + cat > conftest.$ac_ext < +int main() { + +#ifndef _POSIX_C_SOURCE +make an error +#endif +; return 0; } +EOF +if { (eval echo configure:1600: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then + : +else + echo "configure: failed program was:" >&5 + cat conftest.$ac_ext >&5 + rm -rf conftest* + cf_cv_posix_c_source=no +fi +rm -f conftest* + CPPFLAGS="$cf_save" + +fi +rm -f conftest* + +fi + +echo "$ac_t""$cf_cv_posix_c_source" 1>&6 +test "$cf_cv_posix_c_source" != no && CPPFLAGS="$CPPFLAGS $cf_cv_posix_c_source" + + ;; +esac + @@ -1212,7 +1685,7 @@ curses) echo $ac_n "checking for extra include directories""... $ac_c" 1>&6 -echo "configure:1216: checking for extra include directories" >&5 +echo "configure:1689: checking for extra include directories" >&5 if eval "test \"`echo '$''{'cf_cv_curses_incdir'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1236,7 +1709,7 @@ echo "$ac_t""$cf_cv_curses_incdir" 1>&6 test "$cf_cv_curses_incdir" != no && CPPFLAGS="$cf_cv_curses_incdir $CPPFLAGS" echo $ac_n "checking if we have identified curses headers""... $ac_c" 1>&6 -echo "configure:1240: checking if we have identified curses headers" >&5 +echo "configure:1713: checking if we have identified curses headers" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_header'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1249,14 +1722,14 @@ for cf_header in \ ncurses/ncurses.h do cat > conftest.$ac_ext < int main() { initscr(); tgoto("?", 0,0) ; return 0; } EOF -if { (eval echo configure:1260: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:1733: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ncurses_header=$cf_header; break else @@ -1279,17 +1752,17 @@ for ac_hdr in $cf_cv_ncurses_header do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:1283: checking for $ac_hdr" >&5 +echo "configure:1756: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:1293: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:1766: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -1319,7 +1792,7 @@ done echo $ac_n "checking for ncurses version""... $ac_c" 1>&6 -echo "configure:1323: checking for ncurses version" >&5 +echo "configure:1796: checking for ncurses version" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1345,7 +1818,7 @@ Autoconf "old" #endif EOF cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" - { (eval echo configure:1349: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; } + { (eval echo configure:1822: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; } if test -f conftest.out ; then cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" @@ -1354,7 +1827,7 @@ EOF else cat > conftest.$ac_ext < @@ -1378,7 +1851,7 @@ int main() exit(0); } EOF -if { (eval echo configure:1382: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:1855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_ncurses_version=`cat $cf_tempfile` @@ -1402,16 +1875,16 @@ EOF echo $ac_n "checking if we have identified curses libraries""... $ac_c" 1>&6 -echo "configure:1406: checking if we have identified curses libraries" >&5 +echo "configure:1879: checking if we have identified curses libraries" >&5 cat > conftest.$ac_ext < int main() { initscr(); tgoto("?", 0,0) ; return 0; } EOF -if { (eval echo configure:1415: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1888: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else @@ -1427,7 +1900,7 @@ if test "$cf_result" = no ; then case $host_os in #(vi freebsd*) #(vi echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6 -echo "configure:1431: checking for tgoto in -lmytinfo" >&5 +echo "configure:1904: checking for tgoto in -lmytinfo" >&5 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1435,7 +1908,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmytinfo $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1923: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1469,7 +1942,7 @@ fi ;; hpux10.*|hpux11.*) #(vi echo $ac_n "checking for initscr in -lcur_colr""... $ac_c" 1>&6 -echo "configure:1473: checking for initscr in -lcur_colr" >&5 +echo "configure:1946: checking for initscr in -lcur_colr" >&5 ac_lib_var=`echo cur_colr'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1477,7 +1950,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lcur_colr $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:1965: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1511,7 +1984,7 @@ else echo "$ac_t""no" 1>&6 echo $ac_n "checking for initscr in -lHcurses""... $ac_c" 1>&6 -echo "configure:1515: checking for initscr in -lHcurses" >&5 +echo "configure:1988: checking for initscr in -lHcurses" >&5 ac_lib_var=`echo Hcurses'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1519,7 +1992,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lHcurses $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2007: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1583,12 +2056,12 @@ if test ".$ac_cv_func_initscr" != .yes ; then # Check for library containing tgoto. Do this before curses library # because it may be needed to link the test-case for initscr. echo $ac_n "checking for tgoto""... $ac_c" 1>&6 -echo "configure:1587: checking for tgoto" >&5 +echo "configure:2060: checking for tgoto" >&5 if eval "test \"`echo '$''{'ac_cv_func_tgoto'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2088: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_tgoto=yes" else @@ -1632,7 +2105,7 @@ else for cf_term_lib in $cf_check_list termcap termlib unknown do echo $ac_n "checking for tgoto in -l$cf_term_lib""... $ac_c" 1>&6 -echo "configure:1636: checking for tgoto in -l$cf_term_lib" >&5 +echo "configure:2109: checking for tgoto in -l$cf_term_lib" >&5 ac_lib_var=`echo $cf_term_lib'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1640,7 +2113,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$cf_term_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2128: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1681,7 +2154,7 @@ fi for cf_curs_lib in $cf_check_list xcurses jcurses unknown do echo $ac_n "checking for initscr in -l$cf_curs_lib""... $ac_c" 1>&6 -echo "configure:1685: checking for initscr in -l$cf_curs_lib" >&5 +echo "configure:2158: checking for initscr in -l$cf_curs_lib" >&5 ac_lib_var=`echo $cf_curs_lib'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -1689,7 +2162,7 @@ else ac_save_LIBS="$LIBS" LIBS="-l$cf_curs_lib $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2177: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -1726,16 +2199,16 @@ fi LIBS="-l$cf_curs_lib $cf_save_LIBS" if test "$cf_term_lib" = unknown ; then echo $ac_n "checking if we can link with $cf_curs_lib library""... $ac_c" 1>&6 -echo "configure:1730: checking if we can link with $cf_curs_lib library" >&5 +echo "configure:2203: checking if we can link with $cf_curs_lib library" >&5 cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF -if { (eval echo configure:1739: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2212: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else @@ -1751,16 +2224,16 @@ rm -f conftest* : elif test "$cf_term_lib" != predefined ; then echo $ac_n "checking if we need both $cf_curs_lib and $cf_term_lib libraries""... $ac_c" 1>&6 -echo "configure:1755: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 +echo "configure:2228: checking if we need both $cf_curs_lib and $cf_term_lib libraries" >&5 cat > conftest.$ac_ext < int main() { initscr(); tgoto((char *)0, 0, 0); ; return 0; } EOF -if { (eval echo configure:1764: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2237: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=no else @@ -1770,14 +2243,14 @@ else LIBS="-l$cf_curs_lib -l$cf_term_lib $cf_save_LIBS" cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF -if { (eval echo configure:1781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2254: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_result=yes else @@ -1807,7 +2280,7 @@ test "$cf_cv_curses_dir" != "no" && \ CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS" echo $ac_n "checking for $cf_ncuhdr_root header in include-path""... $ac_c" 1>&6 -echo "configure:1811: checking for $cf_ncuhdr_root header in include-path" >&5 +echo "configure:2284: checking for $cf_ncuhdr_root header in include-path" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1818,7 +2291,7 @@ else do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2316: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ncurses_h=$cf_header @@ -1862,7 +2335,7 @@ if test "$cf_cv_ncurses_h" != no ; then cf_cv_ncurses_header=$cf_cv_ncurses_h else echo $ac_n "checking for $cf_ncuhdr_root include-path""... $ac_c" 1>&6 -echo "configure:1866: checking for $cf_ncuhdr_root include-path" >&5 +echo "configure:2339: checking for $cf_ncuhdr_root include-path" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_h2'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -1957,14 +2430,14 @@ do cf_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat > conftest.$ac_ext < int main() { printf("Hello") ; return 0; } EOF -if { (eval echo configure:1968: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2441: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 @@ -1991,7 +2464,7 @@ done do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2489: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ncurses_h2=$cf_header @@ -2059,14 +2532,14 @@ do cf_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat > conftest.$ac_ext < int main() { printf("Hello") ; return 0; } EOF -if { (eval echo configure:2070: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:2543: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 @@ -2121,7 +2594,7 @@ esac echo $ac_n "checking for ncurses version""... $ac_c" 1>&6 -echo "configure:2125: checking for ncurses version" >&5 +echo "configure:2598: checking for ncurses version" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2147,7 +2620,7 @@ Autoconf "old" #endif EOF cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" - { (eval echo configure:2151: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; } + { (eval echo configure:2624: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; } if test -f conftest.out ; then cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" @@ -2156,7 +2629,7 @@ EOF else cat > conftest.$ac_ext < @@ -2180,7 +2653,7 @@ int main() exit(0); } EOF -if { (eval echo configure:2184: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:2657: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_ncurses_version=`cat $cf_tempfile` @@ -2211,7 +2684,7 @@ cf_nculib_root=ncurses cf_ncurses_LIBS="" cf_ncurses_SAVE="$LIBS" echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 -echo "configure:2215: checking for Gpm_Open in -lgpm" >&5 +echo "configure:2688: checking for Gpm_Open in -lgpm" >&5 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2219,7 +2692,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgpm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2707: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2246,7 +2719,7 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for initscr in -lgpm""... $ac_c" 1>&6 -echo "configure:2250: checking for initscr in -lgpm" >&5 +echo "configure:2723: checking for initscr in -lgpm" >&5 ac_lib_var=`echo gpm'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2254,7 +2727,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgpm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2742: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2295,8 +2768,9 @@ case $host_os in #(vi freebsd*) # This is only necessary if you are linking against an obsolete # version of ncurses (but it should do no harm, since it's static). - echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6 -echo "configure:2300: checking for tgoto in -lmytinfo" >&5 + if test "$cf_nculib_root" = ncurses ; then + echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6 +echo "configure:2774: checking for tgoto in -lmytinfo" >&5 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -2304,7 +2778,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmytinfo $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2793: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -2335,6 +2809,7 @@ else echo "$ac_t""no" 1>&6 fi + fi ;; esac @@ -2348,12 +2823,12 @@ else eval 'cf_cv_have_lib_'$cf_nculib_root'=no' cf_libdir="" echo $ac_n "checking for initscr""... $ac_c" 1>&6 -echo "configure:2352: checking for initscr" >&5 +echo "configure:2827: checking for initscr" >&5 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2855: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_initscr=yes" else @@ -2396,17 +2871,17 @@ else cf_save_LIBS="$LIBS" echo $ac_n "checking for initscr in -l$cf_nculib_root""... $ac_c" 1>&6 -echo "configure:2400: checking for initscr in -l$cf_nculib_root" >&5 +echo "configure:2875: checking for initscr in -l$cf_nculib_root" >&5 LIBS="-l$cf_nculib_root $LIBS" cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF -if { (eval echo configure:2410: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' @@ -2475,17 +2950,17 @@ test -d /usr && { for cf_libdir in $cf_search do echo $ac_n "checking for -l$cf_nculib_root in $cf_libdir""... $ac_c" 1>&6 -echo "configure:2479: checking for -l$cf_nculib_root in $cf_libdir" >&5 +echo "configure:2954: checking for -l$cf_nculib_root in $cf_libdir" >&5 LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF -if { (eval echo configure:2489: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:2964: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' @@ -2516,7 +2991,7 @@ fi if test -n "$cf_ncurses_LIBS" ; then echo $ac_n "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS""... $ac_c" 1>&6 -echo "configure:2520: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 +echo "configure:2995: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 cf_ncurses_SAVE="$LIBS" for p in $cf_ncurses_LIBS ; do q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` @@ -2525,14 +3000,14 @@ echo "configure:2520: checking if we can link $cf_nculib_root without $cf_ncurse fi done cat > conftest.$ac_ext < int main() { initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); ; return 0; } EOF -if { (eval echo configure:2536: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3011: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -2559,14 +3034,14 @@ ncursesw) cf_cv_libtype=w echo $ac_n "checking for multibyte character support""... $ac_c" 1>&6 -echo "configure:2563: checking for multibyte character support" >&5 +echo "configure:3038: checking for multibyte character support" >&5 if eval "test \"`echo '$''{'cf_cv_utf8_lib'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cf_save_LIBS="$LIBS" cat > conftest.$ac_ext < @@ -2574,7 +3049,7 @@ int main() { putwc(0,0); ; return 0; } EOF -if { (eval echo configure:2578: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3053: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_utf8_lib=yes else @@ -2583,7 +3058,7 @@ else rm -rf conftest* LIBS="-lutf8 $LIBS" cat > conftest.$ac_ext < @@ -2591,7 +3066,7 @@ int main() { putwc(0,0); ; return 0; } EOF -if { (eval echo configure:2595: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3070: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_utf8_lib=add-on else @@ -2620,128 +3095,6 @@ EOF fi -echo $ac_n "checking if we must define _XOPEN_SOURCE""... $ac_c" 1>&6 -echo "configure:2625: checking if we must define _XOPEN_SOURCE" >&5 -cat > conftest.$ac_ext < - -int main() { - -#ifndef _XOPEN_SOURCE -make an error -#endif -; return 0; } -EOF -if { (eval echo configure:2638: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - cf_result=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cf_result=yes -fi -rm -f conftest* -echo "$ac_t""$cf_result" 1>&6 - -if test "$cf_result" = yes ; then - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500" -elif test "x500" != "x" ; then - echo $ac_n "checking checking for compatible value versus 500""... $ac_c" 1>&6 -echo "configure:2654: checking checking for compatible value versus 500" >&5 - cat > conftest.$ac_ext < - -int main() { - -#if _XOPEN_SOURCE-500 < 0 -make an error -#endif -; return 0; } -EOF -if { (eval echo configure:2667: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - cf_result=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cf_result=no -fi -rm -f conftest* - echo "$ac_t""$cf_result" 1>&6 - if test "$cf_result" = no ; then - # perhaps we can override it - try... - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE=500" - fi -fi - - -echo $ac_n "checking if we must define _XOPEN_SOURCE_EXTENDED""... $ac_c" 1>&6 -echo "configure:2686: checking if we must define _XOPEN_SOURCE_EXTENDED" >&5 -cat > conftest.$ac_ext < - -int main() { - -#ifndef _XOPEN_SOURCE_EXTENDED -make an error -#endif -; return 0; } -EOF -if { (eval echo configure:2699: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - cf_result=no -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cf_result=yes -fi -rm -f conftest* -echo "$ac_t""$cf_result" 1>&6 - -if test "$cf_result" = yes ; then - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED" -elif test "x" != "x" ; then - echo $ac_n "checking checking for compatible value versus ""... $ac_c" 1>&6 -echo "configure:2715: checking checking for compatible value versus " >&5 - cat > conftest.$ac_ext < - -int main() { - -#if _XOPEN_SOURCE_EXTENDED- < 0 -make an error -#endif -; return 0; } -EOF -if { (eval echo configure:2728: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then - rm -rf conftest* - cf_result=yes -else - echo "configure: failed program was:" >&5 - cat conftest.$ac_ext >&5 - rm -rf conftest* - cf_result=no -fi -rm -f conftest* - echo "$ac_t""$cf_result" 1>&6 - if test "$cf_result" = no ; then - # perhaps we can override it - try... - CPPFLAGS="$CPPFLAGS -D_XOPEN_SOURCE_EXTENDED=" - fi -fi - - cf_ncuhdr_root=ncursesw @@ -2750,7 +3103,7 @@ test "$cf_cv_curses_dir" != "no" && \ CPPFLAGS="-I$cf_cv_curses_dir/include -I$cf_cv_curses_dir/include/$cf_ncuhdr_root $CPPFLAGS" echo $ac_n "checking for $cf_ncuhdr_root header in include-path""... $ac_c" 1>&6 -echo "configure:2754: checking for $cf_ncuhdr_root header in include-path" >&5 +echo "configure:3107: checking for $cf_ncuhdr_root header in include-path" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_h'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2761,7 +3114,7 @@ else do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3147: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ncurses_h=$cf_header @@ -2813,7 +3166,7 @@ if test "$cf_cv_ncurses_h" != no ; then cf_cv_ncurses_header=$cf_cv_ncurses_h else echo $ac_n "checking for $cf_ncuhdr_root include-path""... $ac_c" 1>&6 -echo "configure:2817: checking for $cf_ncuhdr_root include-path" >&5 +echo "configure:3170: checking for $cf_ncuhdr_root include-path" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_h2'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -2908,14 +3261,14 @@ do cf_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat > conftest.$ac_ext < int main() { printf("Hello") ; return 0; } EOF -if { (eval echo configure:2919: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3272: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 @@ -2942,7 +3295,7 @@ done do cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3328: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_ncurses_h2=$cf_header @@ -3018,14 +3371,14 @@ do cf_save_CPPFLAGS="$CPPFLAGS" CPPFLAGS="$CPPFLAGS -I$cf_add_incdir" cat > conftest.$ac_ext < int main() { printf("Hello") ; return 0; } EOF -if { (eval echo configure:3029: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:3382: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then : else echo "configure: failed program was:" >&5 @@ -3080,7 +3433,7 @@ esac echo $ac_n "checking for ncurses version""... $ac_c" 1>&6 -echo "configure:3084: checking for ncurses version" >&5 +echo "configure:3437: checking for ncurses version" >&5 if eval "test \"`echo '$''{'cf_cv_ncurses_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -3106,7 +3459,7 @@ Autoconf "old" #endif EOF cf_try="$ac_cpp conftest.$ac_ext 2>&5 | grep '^Autoconf ' >conftest.out" - { (eval echo configure:3110: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; } + { (eval echo configure:3463: \"$cf_try\") 1>&5; (eval $cf_try) 2>&5; } if test -f conftest.out ; then cf_out=`cat conftest.out | sed -e 's%^Autoconf %%' -e 's%^[^"]*"%%' -e 's%".*%%'` test -n "$cf_out" && cf_cv_ncurses_version="$cf_out" @@ -3115,7 +3468,7 @@ EOF else cat > conftest.$ac_ext < @@ -3139,7 +3492,7 @@ int main() exit(0); } EOF -if { (eval echo configure:3143: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:3496: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_ncurses_version=`cat $cf_tempfile` @@ -3170,7 +3523,7 @@ cf_nculib_root=ncursesw cf_ncurses_LIBS="" cf_ncurses_SAVE="$LIBS" echo $ac_n "checking for Gpm_Open in -lgpm""... $ac_c" 1>&6 -echo "configure:3174: checking for Gpm_Open in -lgpm" >&5 +echo "configure:3527: checking for Gpm_Open in -lgpm" >&5 ac_lib_var=`echo gpm'_'Gpm_Open | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3178,7 +3531,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgpm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3546: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3205,7 +3558,7 @@ fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 echo $ac_n "checking for initscr in -lgpm""... $ac_c" 1>&6 -echo "configure:3209: checking for initscr in -lgpm" >&5 +echo "configure:3562: checking for initscr in -lgpm" >&5 ac_lib_var=`echo gpm'_'initscr | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3213,7 +3566,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lgpm $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3581: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3254,8 +3607,9 @@ case $host_os in #(vi freebsd*) # This is only necessary if you are linking against an obsolete # version of ncurses (but it should do no harm, since it's static). - echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6 -echo "configure:3259: checking for tgoto in -lmytinfo" >&5 + if test "$cf_nculib_root" = ncurses ; then + echo $ac_n "checking for tgoto in -lmytinfo""... $ac_c" 1>&6 +echo "configure:3613: checking for tgoto in -lmytinfo" >&5 ac_lib_var=`echo mytinfo'_'tgoto | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3263,7 +3617,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmytinfo $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3632: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3294,6 +3648,7 @@ else echo "$ac_t""no" 1>&6 fi + fi ;; esac @@ -3307,12 +3662,12 @@ else eval 'cf_cv_have_lib_'$cf_nculib_root'=no' cf_libdir="" echo $ac_n "checking for initscr""... $ac_c" 1>&6 -echo "configure:3311: checking for initscr" >&5 +echo "configure:3666: checking for initscr" >&5 if eval "test \"`echo '$''{'ac_cv_func_initscr'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3694: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_initscr=yes" else @@ -3355,17 +3710,17 @@ else cf_save_LIBS="$LIBS" echo $ac_n "checking for initscr in -l$cf_nculib_root""... $ac_c" 1>&6 -echo "configure:3359: checking for initscr in -l$cf_nculib_root" >&5 +echo "configure:3714: checking for initscr in -l$cf_nculib_root" >&5 LIBS="-l$cf_nculib_root $LIBS" cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF -if { (eval echo configure:3369: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3724: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' @@ -3434,17 +3789,17 @@ test -d /usr && { for cf_libdir in $cf_search do echo $ac_n "checking for -l$cf_nculib_root in $cf_libdir""... $ac_c" 1>&6 -echo "configure:3438: checking for -l$cf_nculib_root in $cf_libdir" >&5 +echo "configure:3793: checking for -l$cf_nculib_root in $cf_libdir" >&5 LIBS="-L$cf_libdir -l$cf_nculib_root $cf_save_LIBS" cat > conftest.$ac_ext < int main() { initscr() ; return 0; } EOF -if { (eval echo configure:3448: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3803: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 eval 'cf_cv_have_lib_'$cf_nculib_root'=yes' @@ -3475,7 +3830,7 @@ fi if test -n "$cf_ncurses_LIBS" ; then echo $ac_n "checking if we can link $cf_nculib_root without $cf_ncurses_LIBS""... $ac_c" 1>&6 -echo "configure:3479: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 +echo "configure:3834: checking if we can link $cf_nculib_root without $cf_ncurses_LIBS" >&5 cf_ncurses_SAVE="$LIBS" for p in $cf_ncurses_LIBS ; do q=`echo $LIBS | sed -e "s%$p %%" -e "s%$p$%%"` @@ -3484,14 +3839,14 @@ echo "configure:3479: checking if we can link $cf_nculib_root without $cf_ncurse fi done cat > conftest.$ac_ext < int main() { initscr(); mousemask(0,0); tgoto((char *)0, 0, 0); ; return 0; } EOF -if { (eval echo configure:3495: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3850: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* echo "$ac_t""yes" 1>&6 else @@ -3518,27 +3873,27 @@ esac -echo $ac_n "checking for form_driver in -lform$cf_cv_libtype""... $ac_c" 1>&6 -echo "configure:3523: checking for form_driver in -lform$cf_cv_libtype" >&5 -ac_lib_var=`echo form$cf_cv_libtype'_'form_driver | sed 'y%./+-%__p_%'` +echo $ac_n "checking for new_panel in -lpanel$cf_cv_libtype""... $ac_c" 1>&6 +echo "configure:3878: checking for new_panel in -lpanel$cf_cv_libtype" >&5 +ac_lib_var=`echo panel$cf_cv_libtype'_'new_panel | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-lform$cf_cv_libtype $LIBS" +LIBS="-lpanel$cf_cv_libtype $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3897: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3553,20 +3908,20 @@ LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo form$cf_cv_libtype | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + ac_tr_lib=HAVE_LIB`echo panel$cf_cv_libtype | sed -e 's/[^a-zA-Z0-9_]/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` cat >> confdefs.h <&6 fi echo $ac_n "checking for menu_driver in -lmenu$cf_cv_libtype""... $ac_c" 1>&6 -echo "configure:3570: checking for menu_driver in -lmenu$cf_cv_libtype" >&5 +echo "configure:3925: checking for menu_driver in -lmenu$cf_cv_libtype" >&5 ac_lib_var=`echo menu$cf_cv_libtype'_'menu_driver | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 @@ -3574,7 +3929,7 @@ else ac_save_LIBS="$LIBS" LIBS="-lmenu$cf_cv_libtype $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3944: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3612,27 +3967,27 @@ else echo "$ac_t""no" 1>&6 fi -echo $ac_n "checking for new_panel in -lpanel$cf_cv_libtype""... $ac_c" 1>&6 -echo "configure:3617: checking for new_panel in -lpanel$cf_cv_libtype" >&5 -ac_lib_var=`echo panel$cf_cv_libtype'_'new_panel | sed 'y%./+-%__p_%'` +echo $ac_n "checking for form_driver in -lform$cf_cv_libtype""... $ac_c" 1>&6 +echo "configure:3972: checking for form_driver in -lform$cf_cv_libtype" >&5 +ac_lib_var=`echo form$cf_cv_libtype'_'form_driver | sed 'y%./+-%__p_%'` if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else ac_save_LIBS="$LIBS" -LIBS="-lpanel$cf_cv_libtype $LIBS" +LIBS="-lform$cf_cv_libtype $LIBS" cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:3991: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_lib_$ac_lib_var=yes" else @@ -3647,13 +4002,13 @@ LIBS="$ac_save_LIBS" fi if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then echo "$ac_t""yes" 1>&6 - ac_tr_lib=HAVE_LIB`echo panel$cf_cv_libtype | sed -e 's/[^a-zA-Z0-9_]/_/g' \ + ac_tr_lib=HAVE_LIB`echo form$cf_cv_libtype | sed -e 's/[^a-zA-Z0-9_]/_/g' \ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'` cat >> confdefs.h <&6 @@ -3661,12 +4016,12 @@ fi echo $ac_n "checking return type of signal handlers""... $ac_c" 1>&6 -echo "configure:3665: checking return type of signal handlers" >&5 +echo "configure:4020: checking return type of signal handlers" >&5 if eval "test \"`echo '$''{'ac_cv_type_signal'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3683,7 +4038,7 @@ int main() { int i; ; return 0; } EOF -if { (eval echo configure:3687: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4042: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_type_signal=void else @@ -3703,12 +4058,12 @@ EOF echo $ac_n "checking for ANSI C header files""... $ac_c" 1>&6 -echo "configure:3707: checking for ANSI C header files" >&5 +echo "configure:4062: checking for ANSI C header files" >&5 if eval "test \"`echo '$''{'ac_cv_header_stdc'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3716,7 +4071,7 @@ else #include EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3720: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4075: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3733,7 +4088,7 @@ rm -f conftest* if test $ac_cv_header_stdc = yes; then # SunOS 4.x string.h does not declare mem*, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -3751,7 +4106,7 @@ fi if test $ac_cv_header_stdc = yes; then # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. cat > conftest.$ac_ext < EOF @@ -3772,7 +4127,7 @@ if test "$cross_compiling" = yes; then : else cat > conftest.$ac_ext < #define ISLOWER(c) ('a' <= (c) && (c) <= 'z') @@ -3783,7 +4138,7 @@ if (XOR (islower (i), ISLOWER (i)) || toupper (i) != TOUPPER (i)) exit(2); exit (0); } EOF -if { (eval echo configure:3787: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4142: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then : else @@ -3807,12 +4162,12 @@ EOF fi echo $ac_n "checking whether time.h and sys/time.h may both be included""... $ac_c" 1>&6 -echo "configure:3811: checking whether time.h and sys/time.h may both be included" >&5 +echo "configure:4166: checking whether time.h and sys/time.h may both be included" >&5 if eval "test \"`echo '$''{'ac_cv_header_time'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < #include @@ -3821,7 +4176,7 @@ int main() { struct tm *tp; ; return 0; } EOF -if { (eval echo configure:3825: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4180: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* ac_cv_header_time=yes else @@ -3858,17 +4213,17 @@ unistd.h \ do ac_safe=`echo "$ac_hdr" | sed 'y%./+-%__p_%'` echo $ac_n "checking for $ac_hdr""... $ac_c" 1>&6 -echo "configure:3862: checking for $ac_hdr" >&5 +echo "configure:4217: checking for $ac_hdr" >&5 if eval "test \"`echo '$''{'ac_cv_header_$ac_safe'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < EOF ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out" -{ (eval echo configure:3872: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } +{ (eval echo configure:4227: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; } ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"` if test -z "$ac_err"; then rm -rf conftest* @@ -3911,12 +4266,12 @@ wresize \ do echo $ac_n "checking for $ac_func""... $ac_c" 1>&6 -echo "configure:3915: checking for $ac_func" >&5 +echo "configure:4270: checking for $ac_func" >&5 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4298: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* eval "ac_cv_func_$ac_func=yes" else @@ -3965,7 +4320,7 @@ done cat > conftest.$ac_ext < @@ -3986,7 +4341,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:3990: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4345: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cat >> confdefs.h <<\EOF #define NCURSES_EXT_FUNCS 1 @@ -4000,13 +4355,13 @@ rm -f conftest* echo $ac_n "checking if sys/time.h works with sys/select.h""... $ac_c" 1>&6 -echo "configure:4004: checking if sys/time.h works with sys/select.h" >&5 +echo "configure:4359: checking if sys/time.h works with sys/select.h" >&5 if eval "test \"`echo '$''{'cf_cv_sys_time_select'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else cat > conftest.$ac_ext < @@ -4021,7 +4376,7 @@ int main() { ; return 0; } EOF -if { (eval echo configure:4025: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4380: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_cv_sys_time_select=yes else @@ -4042,7 +4397,7 @@ EOF echo $ac_n "checking for function curses_version""... $ac_c" 1>&6 -echo "configure:4046: checking for function curses_version" >&5 +echo "configure:4401: checking for function curses_version" >&5 if eval "test \"`echo '$''{'cf_cv_func_curses_version'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4051,7 +4406,7 @@ if test "$cross_compiling" = yes; then cf_cv_func_curses_version=unknown else cat > conftest.$ac_ext < @@ -4063,7 +4418,7 @@ int main() } EOF -if { (eval echo configure:4067: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null +if { (eval echo configure:4422: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null then cf_cv_func_curses_version=yes @@ -4088,7 +4443,7 @@ EOF echo $ac_n "checking for alternate character set array""... $ac_c" 1>&6 -echo "configure:4092: checking for alternate character set array" >&5 +echo "configure:4447: checking for alternate character set array" >&5 if eval "test \"`echo '$''{'cf_cv_curses_acs_map'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4097,7 +4452,7 @@ cf_cv_curses_acs_map=unknown for name in acs_map _acs_map __acs_map _nc_acs_map do cat > conftest.$ac_ext < @@ -4108,7 +4463,7 @@ $name['k'] = ACS_PLUS ; return 0; } EOF -if { (eval echo configure:4112: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4467: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_curses_acs_map=$name; break else @@ -4129,7 +4484,7 @@ EOF echo $ac_n "checking for wide alternate character set array""... $ac_c" 1>&6 -echo "configure:4133: checking for wide alternate character set array" >&5 +echo "configure:4488: checking for wide alternate character set array" >&5 if eval "test \"`echo '$''{'cf_cv_curses_wacs_map'+set}'`\" = set"; then echo $ac_n "(cached) $ac_c" 1>&6 else @@ -4138,7 +4493,7 @@ else for name in wacs_map _wacs_map __wacs_map _nc_wacs do cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then +if { (eval echo configure:4508: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then rm -rf conftest* cf_cv_curses_wacs_map=$name break @@ -4165,9 +4520,9 @@ echo "$ac_t""$cf_cv_curses_wacs_map" 1>&6 echo $ac_n "checking for type attr_t in ${cf_cv_ncurses_header-curses.h}""... $ac_c" 1>&6 -echo "configure:4169: checking for type attr_t in ${cf_cv_ncurses_header-curses.h}" >&5 +echo "configure:4524: checking for type attr_t in ${cf_cv_ncurses_header-curses.h}" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4539: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_result=yes else @@ -4208,9 +4563,9 @@ fi echo $ac_n "checking for type mbstate_t in ${cf_cv_ncurses_header-curses.h}""... $ac_c" 1>&6 -echo "configure:4212: checking for type mbstate_t in ${cf_cv_ncurses_header-curses.h}" >&5 +echo "configure:4567: checking for type mbstate_t in ${cf_cv_ncurses_header-curses.h}" >&5 cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then +if { (eval echo configure:4582: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then rm -rf conftest* cf_result=yes else @@ -4250,6 +4605,9 @@ EOF fi +TEST_ARGS="$LIBS" +LIBS= + trap '' 1 2 15 cat > confcache <<\EOF @@ -4397,7 +4755,6 @@ s%@DFT_DEP_SUFFIX@%$DFT_DEP_SUFFIX%g s%@DFT_OBJ_SUBDIR@%$DFT_OBJ_SUBDIR%g s%@DFT_UPR_MODEL@%$DFT_UPR_MODEL%g s%@ECHO_LINK@%$ECHO_LINK%g -s%@EXTRA_LIBS@%$EXTRA_LIBS%g s%@LD@%$LD%g s%@LDFLAGS_SHARED@%$LDFLAGS_SHARED%g s%@LD_MODEL@%$LD_MODEL%g @@ -4415,10 +4772,12 @@ s%@LOCAL_LDFLAGS@%$LOCAL_LDFLAGS%g s%@MATH_LIB@%$MATH_LIB%g s%@TEST_ARGS@%$TEST_ARGS%g s%@TEST_DEPS@%$TEST_DEPS%g +s%@TINFO_ARGS@%$TINFO_ARGS%g s%@cf_cv_abi_version@%$cf_cv_abi_version%g s%@cf_cv_rel_version@%$cf_cv_rel_version%g s%@EXEEXT@%$EXEEXT%g s%@OBJEXT@%$OBJEXT%g +s%@EXTRA_CPPFLAGS@%$EXTRA_CPPFLAGS%g CEOF EOF diff --git a/test/configure.in b/test/configure.in index 3e015896..4175530c 100644 --- a/test/configure.in +++ b/test/configure.in @@ -1,5 +1,5 @@ dnl*************************************************************************** -dnl Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * +dnl Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * dnl * dnl Permission is hereby granted, free of charge, to any person obtaining a * dnl copy of this software and associated documentation files (the * @@ -28,7 +28,7 @@ dnl*************************************************************************** dnl dnl Author: Thomas E. Dickey 1996, etc. dnl -dnl $Id: configure.in,v 1.47 2004/01/31 00:07:01 tom Exp $ +dnl $Id: configure.in,v 1.51 2005/02/26 23:58:27 tom Exp $ dnl This is a simple configuration-script for the ncurses test programs that dnl allows the test-directory to be separately configured against a reference dnl system (i.e., sysvr4 curses) @@ -58,7 +58,6 @@ DFT_DEP_SUFFIX="" AC_SUBST(DFT_DEP_SUFFIX) DFT_OBJ_SUBDIR=`pwd|sed -e's:.*/::'` AC_SUBST(DFT_OBJ_SUBDIR) DFT_UPR_MODEL="NORMAL" AC_SUBST(DFT_UPR_MODEL) ECHO_LINK='@ echo linking $@ ... ;' AC_SUBST(ECHO_LINK) -EXTRA_LIBS="" AC_SUBST(EXTRA_LIBS) LD="ld" AC_SUBST(LD) LDFLAGS_SHARED="" AC_SUBST(LDFLAGS_SHARED) LD_MODEL="" AC_SUBST(LD_MODEL) @@ -76,6 +75,7 @@ LOCAL_LDFLAGS="" AC_SUBST(LOCAL_LDFLAGS) MATH_LIB="-lm" AC_SUBST(MATH_LIB) TEST_ARGS="" AC_SUBST(TEST_ARGS) TEST_DEPS="" AC_SUBST(TEST_DEPS) +TINFO_ARGS='$(LIBS_CURSES)' AC_SUBST(TINFO_ARGS) cf_cv_abi_version="" AC_SUBST(cf_cv_abi_version) cf_cv_rel_version="" AC_SUBST(cf_cv_rel_version) @@ -84,7 +84,10 @@ cf_cv_libtype= AC_EXEEXT AC_OBJEXT -CF_GNU_SOURCE + +CF_ANSI_CC_REQD +CF_XOPEN_SOURCE + CF_WITH_CURSES_DIR dnl SunOS 4.x @@ -118,8 +121,6 @@ ncurses) ncursesw) cf_cv_libtype=w CF_UTF8_LIB - CF_PREDEFINE(_XOPEN_SOURCE,500) - CF_PREDEFINE(_XOPEN_SOURCE_EXTENDED) CF_NCURSES_CPPFLAGS(ncursesw) CF_NCURSES_LIBS(ncursesw) LIB_NAME=ncursesw @@ -131,9 +132,9 @@ dnl installed conventionally (e.g., SunOS 5.x - solaris). dnl Autoconf builds up the $LIBS in reverse order -AC_CHECK_LIB(form$cf_cv_libtype,form_driver) -AC_CHECK_LIB(menu$cf_cv_libtype,menu_driver) AC_CHECK_LIB(panel$cf_cv_libtype,new_panel) +AC_CHECK_LIB(menu$cf_cv_libtype,menu_driver) +AC_CHECK_LIB(form$cf_cv_libtype,form_driver) AC_TYPE_SIGNAL @@ -193,6 +194,9 @@ CF_CURSES_WACS_MAP CF_CURSES_CHECK_TYPE(attr_t,long) CF_CURSES_CHECK_TYPE(mbstate_t,long) +TEST_ARGS="$LIBS" +LIBS= + dnl --------------------------------------------------------------------------- AC_OUTPUT(Makefile,[ diff --git a/test/demo_forms.c b/test/demo_forms.c index 03965aaf..72401dd9 100644 --- a/test/demo_forms.c +++ b/test/demo_forms.c @@ -1,5 +1,5 @@ /* - * $Id: demo_forms.c,v 1.3 2003/05/03 22:08:20 tom Exp $ + * $Id: demo_forms.c,v 1.18 2005/10/08 21:54:20 tom Exp $ * * Demonstrate a variety of functions from the form library. * Thomas Dickey - 2003/4/26 @@ -7,23 +7,15 @@ /* TYPE_ALNUM - TYPE_ENUM - -TYPE_INTEGER - -TYPE_IPV4 - -TYPE_NUMERIC - TYPE_REGEXP - -data_ahead - -data_behind - dup_field - -dynamic_field_info - field_arg - field_back - field_count - field_fore - field_init - field_just - -field_opts_on - field_pad - -field_status - field_term - field_type - form_init - @@ -40,11 +32,8 @@ link_fieldtype - move_field - new_page - pos_form_cursor - -set_current_field - -set_field_fore - set_field_init - set_field_pad - -set_field_status - set_field_term - set_fieldtype_arg - set_fieldtype_choice - @@ -63,14 +52,20 @@ set_max_field - #include +static int d_option = 0; +static int j_value = 0; +static int m_value = 0; +static int o_value = 0; +static char *t_value = 0; + static FIELD * make_label(int frow, int fcol, NCURSES_CONST char *label) { - FIELD *f = new_field(1, strlen(label), frow, fcol, 0, 0); + FIELD *f = new_field(1, (int) strlen(label), frow, fcol, 0, 0); if (f) { set_field_buffer(f, 0, label); - set_field_opts(f, field_opts(f) & ~O_ACTIVE); + set_field_opts(f, (int) (field_opts(f) & ~O_ACTIVE)); } return (f); } @@ -81,11 +76,32 @@ make_label(int frow, int fcol, NCURSES_CONST char *label) static FIELD * make_field(int frow, int fcol, int rows, int cols) { - FIELD *f = new_field(rows, cols, frow, fcol, 0, 1); + FIELD *f = new_field(rows, cols, frow, fcol, o_value, 1); if (f) { set_field_back(f, A_UNDERLINE); + /* + * If -j and -d options are combined, -j loses. It is documented in + * "Character User Interface Programming", page 12-15 that setting + * O_STATIC off makes the form library ignore justification. + */ + set_field_just(f, j_value); set_field_userptr(f, (void *) 0); + if (d_option) { + if (has_colors()) { + set_field_fore(f, COLOR_PAIR(2)); + } else { + set_field_fore(f, A_BOLD); + } + /* + * The field_opts_off() call dumps core with Solaris curses, + * but that is a known bug in Solaris' form library -TD + */ + field_opts_off(f, O_STATIC); + set_max_field(f, m_value); + } + if (t_value) + set_field_buffer(f, 0, t_value); } return (f); } @@ -126,17 +142,73 @@ erase_form(FORM * f) delwin(w); } +static void +show_insert_mode(bool insert_mode) +{ + mvaddstr(5, 57, (insert_mode + ? "form_status: insert " + : "form_status: overlay")); +} + +#define O_SELECTABLE (O_ACTIVE | O_VISIBLE) + +static FIELD * +another_field(FORM * form, FIELD * field) +{ + FIELD **f = form_fields(form); + FIELD *result = 0; + int n; + + for (n = 0; f[n] != 0; ++n) { + if (f[n] != field) { + result = f[n]; + field_opts_on(result, O_SELECTABLE); + break; + } + } + return result; +} + static int my_form_driver(FORM * form, int c) { + static bool insert_mode = TRUE; + FIELD *field; + switch (c) { - case EDIT_FIELD('q'): + case MY_QUIT: if (form_driver(form, REQ_VALIDATION) == E_OK) return (TRUE); break; - case EDIT_FIELD('h'): + case MY_HELP: help_edit_field(); break; + case MY_EDT_MODE: + if ((field = current_field(form)) != 0) { + set_current_field(form, another_field(form, field)); + if (field_opts(field) & O_EDIT) { + field_opts_off(field, O_EDIT); + set_field_status(field, 0); + } else { + field_opts_on(field, O_EDIT); + } + set_current_field(form, field); + } + break; + case MY_INS_MODE: + /* there should be a form_status() function, but there is none */ + if (!insert_mode) { + if (form_driver(form, REQ_INS_MODE) == E_OK) { + insert_mode = TRUE; + } + } else { + if (form_driver(form, REQ_OVL_MODE) == E_OK) { + insert_mode = FALSE; + } + } + show_insert_mode(insert_mode); + refresh(); + break; default: beep(); break; @@ -151,12 +223,18 @@ show_current_field(WINDOW *win, FORM * form) FIELDTYPE *type; char *buffer; int nbuf; + int field_rows, field_cols, field_max; if (has_colors()) { wbkgd(win, COLOR_PAIR(1)); } werase(win); - wprintw(win, "Cursor: %d,%d\n", form->currow, form->curcol); + wprintw(win, "Cursor: %d,%d", form->currow, form->curcol); + if (data_ahead(form)) + waddstr(win, " ahead"); + if (data_behind(form)) + waddstr(win, " behind"); + waddch(win, '\n'); if ((field = current_field(form)) != 0) { wprintw(win, "Field %d:", field_index(field)); if ((type = field_type(field)) != 0) { @@ -168,6 +246,10 @@ show_current_field(WINDOW *win, FORM * form) waddstr(win, "ENUM"); else if (type == TYPE_INTEGER) waddstr(win, "INTEGER"); +#ifdef NCURSES_VERSION + else if (type == TYPE_IPV4) + waddstr(win, "IPV4"); +#endif else if (type == TYPE_NUMERIC) waddstr(win, "NUMERIC"); else if (type == TYPE_REGEXP) @@ -175,6 +257,20 @@ show_current_field(WINDOW *win, FORM * form) else waddstr(win, "other"); } + + if (field_opts(field) & O_EDIT) + waddstr(win, " editable"); + else + waddstr(win, " readonly"); + + if (field_status(field)) + waddstr(win, " modified"); + + if (dynamic_field_info(field, &field_rows, &field_cols, &field_max) + != ERR) { + wprintw(win, " size %dx%d (max %d)", + field_rows, field_cols, field_max); + } waddstr(win, "\n"); for (nbuf = 0; nbuf <= 2; ++nbuf) { if ((buffer = field_buffer(field, nbuf)) != 0) { @@ -203,27 +299,55 @@ demo_forms(void) help_edit_field(); mvaddstr(4, 57, "Forms Entry Test"); + show_insert_mode(TRUE); refresh(); /* describe the form */ - for (pg = 0; pg < 3; ++pg) { + for (pg = 0; pg < 4; ++pg) { char label[80]; sprintf(label, "Sample Form Page %d", pg + 1); f[n++] = make_label(0, 15, label); set_new_page(f[n - 1], TRUE); - f[n++] = make_label(2, 0, "Last Name"); - f[n++] = make_field(3, 0, 1, 18); - set_field_type(f[n - 1], TYPE_ALPHA, 1); + switch (pg) { + default: + f[n++] = make_label(2, 0, "Last Name"); + f[n++] = make_field(3, 0, 1, 18); + set_field_type(f[n - 1], TYPE_ALPHA, 1); + + f[n++] = make_label(2, 20, "First Name"); + f[n++] = make_field(3, 20, 1, 12); + set_field_type(f[n - 1], TYPE_ALPHA, 1); + + f[n++] = make_label(2, 34, "Middle Name"); + f[n++] = make_field(3, 34, 1, 12); + set_field_type(f[n - 1], TYPE_ALPHA, 1); + break; + case 2: + f[n++] = make_label(2, 0, "Host Name"); + f[n++] = make_field(3, 0, 1, 18); + set_field_type(f[n - 1], TYPE_ALPHA, 1); + +#ifdef NCURSES_VERSION + f[n++] = make_label(2, 20, "IP Address"); + f[n++] = make_field(3, 20, 1, 12); + set_field_type(f[n - 1], TYPE_IPV4, 1); +#endif + + break; - f[n++] = make_label(2, 20, "First Name"); - f[n++] = make_field(3, 20, 1, 12); - set_field_type(f[n - 1], TYPE_ALPHA, 1); + case 3: + f[n++] = make_label(2, 0, "Four digits"); + f[n++] = make_field(3, 0, 1, 18); + set_field_type(f[n - 1], TYPE_INTEGER, 4, 0, 0); - f[n++] = make_label(2, 34, "Middle Name"); - f[n++] = make_field(3, 34, 1, 12); - set_field_type(f[n - 1], TYPE_ALPHA, 1); + f[n++] = make_label(2, 20, "Numeric"); + f[n++] = make_field(3, 20, 1, 12); + set_field_type(f[n - 1], TYPE_NUMERIC, 3, -10000.0, 100000000.0); + + break; + } f[n++] = make_label(5, 0, "Comments"); f[n++] = make_field(6, 0, 4, 46); @@ -262,9 +386,58 @@ demo_forms(void) nl(); } +static void +usage(void) +{ + static const char *tbl[] = + { + "Usage: demo_forms [options]" + ,"" + ," -d make fields dynamic" + ," -j value justify (1=left, 2=center, 3=right)" + ," -m value set maximum size of dynamic fields" + ," -o value specify number of offscreen rows in new_field()" + ," -t value specify text to fill fields initially" + }; + unsigned int j; + for (j = 0; j < SIZEOF(tbl); ++j) + fprintf(stderr, "%s\n", tbl[j]); + exit(EXIT_FAILURE); +} + int -main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +main(int argc, char *argv[]) { + int ch; + + setlocale(LC_ALL, ""); + + while ((ch = getopt(argc, argv, "dj:m:o:t:")) != EOF) { + switch (ch) { + case 'd': + d_option = TRUE; + break; + case 'j': + j_value = atoi(optarg); + if (j_value < NO_JUSTIFICATION + || j_value > JUSTIFY_RIGHT) + usage(); + break; + case 'm': + m_value = atoi(optarg); + break; + case 'o': + o_value = atoi(optarg); + break; + case 't': + t_value = optarg; + break; + default: + usage(); + + } + } + initscr(); cbreak(); noecho(); @@ -276,6 +449,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) if (has_colors()) { start_color(); init_pair(1, COLOR_WHITE, COLOR_BLUE); + init_pair(2, COLOR_GREEN, COLOR_BLACK); bkgd(COLOR_PAIR(1)); refresh(); } @@ -283,7 +457,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) demo_forms(); endwin(); - return EXIT_SUCCESS; + ExitProgram(EXIT_SUCCESS); } #else int diff --git a/test/demo_menus.c b/test/demo_menus.c index ad2cefe4..3e77c487 100644 --- a/test/demo_menus.c +++ b/test/demo_menus.c @@ -1,11 +1,10 @@ /* - * $Id: demo_menus.c,v 1.1 2003/04/26 22:10:43 tom Exp $ + * $Id: demo_menus.c,v 1.13 2005/10/01 15:54:31 tom Exp $ * * Demonstrate a variety of functions from the menu library. - * Thomas Dickey - 2003/4/26 + * Thomas Dickey - 2005/4/9 */ /* -item_count - item_description - item_init - item_opts - @@ -21,12 +20,10 @@ menu_grey - menu_init - menu_mark - menu_opts - -menu_opts_on - menu_pad - menu_pattern - menu_request_by_name - menu_request_name - -menu_spacing - menu_sub - menu_term - menu_userptr - @@ -35,12 +32,9 @@ set_item_init - set_item_opts - set_item_term - set_item_userptr - -set_menu_back - -set_menu_fore - set_menu_grey - set_menu_init - set_menu_items - -set_menu_mark - set_menu_opts - set_menu_pad - set_menu_pattern - @@ -57,10 +51,639 @@ top_row - #include +#include +#include + +#ifdef NCURSES_VERSION +#ifdef TRACE +static unsigned save_trace = TRACE_ORDINARY | TRACE_CALLS; +extern unsigned _nc_tracing; +static MENU *mpTrace; +#endif +#else +#undef TRACE +#endif + +typedef enum { + eUnknown = -1 + ,eFile = 0 + ,eSelect +#ifdef TRACE + ,eTrace +#endif +} MenuNo; + +#define MENU_Y 1 + +static MENU *mpBanner; +static MENU *mpFile; +static MENU *mpSelect; + +#if !HAVE_STRDUP +#define strdup my_strdup +static char * +strdup(char *s) +{ + char *p = (char *) malloc(strlen(s) + 1); + if (p) + strcpy(p, s); + return (p); +} +#endif /* not HAVE_STRDUP */ + +/* Common function to allow ^T to toggle trace-mode in the middle of a test + * so that trace-files can be made smaller. + */ +static int +wGetchar(WINDOW *win) +{ + int c; +#ifdef TRACE + while ((c = wgetch(win)) == CTRL('T')) { + if (_nc_tracing) { + save_trace = _nc_tracing; + _tracef("TOGGLE-TRACING OFF"); + _nc_tracing = 0; + } else { + _nc_tracing = save_trace; + } + trace(_nc_tracing); + if (_nc_tracing) + _tracef("TOGGLE-TRACING ON"); + } +#else + c = wgetch(win); +#endif + return c; +} +#define Getchar() wGetchar(stdscr) + +static int +menu_virtualize(int c) +{ + int result; + + if (c == '\n' || c == KEY_EXIT) + result = (MAX_COMMAND + 1); + else if (c == 'u') + result = (REQ_SCR_ULINE); + else if (c == 'd') + result = (REQ_SCR_DLINE); + else if (c == 'b' || c == KEY_NPAGE) + result = (REQ_SCR_UPAGE); + else if (c == 'f' || c == KEY_PPAGE) + result = (REQ_SCR_DPAGE); + else if (c == 'l' || c == KEY_LEFT || c == KEY_BTAB) + result = (REQ_LEFT_ITEM); + else if (c == 'n' || c == KEY_DOWN) + result = (REQ_NEXT_ITEM); + else if (c == 'p' || c == KEY_UP) + result = (REQ_PREV_ITEM); + else if (c == 'r' || c == KEY_RIGHT || c == '\t') + result = (REQ_RIGHT_ITEM); + else if (c == ' ') + result = (REQ_TOGGLE_ITEM); + else { + if (c != KEY_MOUSE) + beep(); + result = (c); + } + return result; +} + +static int +menu_getc(MENU * m) +{ + return wGetchar(menu_win(m)); +} + +static int +menu_offset(MenuNo number) +{ + int result = 0; + + if ((int) number >= 0) { + int spc_desc, spc_rows, spc_cols; + +#ifdef NCURSES_VERSION + menu_spacing(mpBanner, &spc_desc, &spc_rows, &spc_cols); +#else + spc_rows = 0; +#endif + + /* FIXME: MENU.itemlen seems the only way to get actual width of items */ + result = number * (mpBanner->itemlen + spc_rows); + } + return result; +} + +static MENU * +menu_create(ITEM ** items, int count, int ncols, MenuNo number) +{ + MENU *result; + WINDOW *menuwin; + int mrows, mcols; + int y = ((int) number >= 0) ? MENU_Y : 0; + int x = menu_offset(number); + int margin = (y == MENU_Y) ? 1 : 0; + int maxcol = (ncols + x) < COLS ? ncols : (COLS - x - 1); + int maxrow = (count + 1) / ncols; + + if ((maxrow + y) >= (LINES - 4)) + maxrow = LINES - 4 - y; + + result = new_menu(items); + + if (has_colors()) { + set_menu_fore(result, COLOR_PAIR(1)); + set_menu_back(result, COLOR_PAIR(2)); + } + + set_menu_format(result, maxrow, maxcol); + scale_menu(result, &mrows, &mcols); + + if (mcols + (2 * margin + x) >= COLS) + mcols = COLS - (2 * margin + x); + +#ifdef TRACE + if (number == eTrace) + menu_opts_off(result, O_ONEVALUE); + else + menu_opts_on(result, O_ONEVALUE); +#endif + + menuwin = newwin(mrows + (2 * margin), mcols + (2 * margin), y, x); + set_menu_win(result, menuwin); + keypad(menuwin, TRUE); + if (margin) + box(menuwin, 0, 0); + + set_menu_sub(result, derwin(menuwin, mrows, mcols, margin, margin)); + + post_menu(result); + + return result; +} + +static void +menu_destroy(MENU * m) +{ + ITEM **ip; + int count; + + if (m != 0) { + delwin(menu_win(m)); + + ip = menu_items(m); + count = item_count(m); + + free_menu(m); +#if 0 + if (count > 0) { + while (*ip) { + _tracef("freeing item %d:%d", ip - menu_items(m), count); + free_item(*ip++); + } + } +#endif + } +} + +/* force the given menu to appear */ +static void +menu_display(MENU * m) +{ + touchwin(menu_win(m)); + wrefresh(menu_win(m)); +} + +/*****************************************************************************/ + +static void +build_file_menu(MenuNo number) +{ + static const char *labels[] = + { + "Exit", + (char *) 0 + }; + static ITEM *items[SIZEOF(labels)]; + + ITEM **ip = items; + const char **ap; + + for (ap = labels; *ap; ap++) + *ip++ = new_item(*ap, ""); + *ip = (ITEM *) 0; + + mpFile = menu_create(items, SIZEOF(labels) - 1, 1, number); +} + +static int +perform_file_menu(int cmd) +{ + return menu_driver(mpFile, cmd); +} + +/*****************************************************************************/ + +static void +build_select_menu(MenuNo number, char *filename) +{ + static const char *labels[] = + { + "Lions", + "Tigers", + "Bears", + "(Oh my!)", + "Newts", + "Platypi", + "Lemurs", + "(Oh really?!)", + "Leopards", + "Panthers", + "Pumas", + "Lions, Tigers, Bears, (Oh my!), Newts, Platypi, Lemurs", + "Lions, Tigers, Bears, (Oh my!), Newts, Platypi, Lemurs, Lions, Tigers, Bears, (Oh my!), Newts, Platypi, Lemurs", + (char *) 0 + }; + static ITEM **items; + + ITEM **ip; + const char **ap = 0; + unsigned count = 0; + + if (filename != 0) { + struct stat sb; + if (stat(filename, &sb) == 0 + && (sb.st_mode & S_IFMT) == S_IFREG + && sb.st_size != 0) { + unsigned size = sb.st_size; + unsigned j, k; + char *blob = malloc(size + 1); + const char **list = (const char **) calloc(sizeof(*list), size + 1); + + items = (ITEM **) calloc(sizeof(ITEM *), size + 1); + if (blob != 0 && list != 0) { + FILE *fp = fopen(filename, "r"); + if (fp != 0) { + if (fread(blob, sizeof(char), size, fp) == size) { + bool mark = TRUE; + for (j = k = 0; j < size; ++j) { + if (mark) { + list[k++] = blob + j; + mark = FALSE; + } + if (blob[j] == '\n') { + blob[j] = '\0'; + if (k > 0 && *list[k - 1] == '\0') + --k; + mark = TRUE; + } else if (blob[j] == '\t') { + blob[j] = ' '; /* menu items are printable */ + } + } + list[k] = 0; + count = k; + ap = list; + } + fclose(fp); + } + } + } + } + if (ap == 0) { + count = SIZEOF(labels) - 1; + items = (ITEM **) calloc(count + 1, sizeof(*items)); + ap = labels; + } + + ip = items; + while (*ap != 0) + *ip++ = new_item(*ap++, ""); + *ip = 0; + + mpSelect = menu_create(items, (int) count, 1, number); +} + +static int +perform_select_menu(int cmd) +{ + return menu_driver(mpSelect, cmd); +} + +/*****************************************************************************/ + +#ifdef TRACE +#define T_TBL(name) { #name, name } +static struct { + const char *name; + unsigned mask; +} t_tbl[] = { + + T_TBL(TRACE_DISABLE), + T_TBL(TRACE_TIMES), + T_TBL(TRACE_TPUTS), + T_TBL(TRACE_UPDATE), + T_TBL(TRACE_MOVE), + T_TBL(TRACE_CHARPUT), + T_TBL(TRACE_ORDINARY), + T_TBL(TRACE_CALLS), + T_TBL(TRACE_VIRTPUT), + T_TBL(TRACE_IEVENT), + T_TBL(TRACE_BITS), + T_TBL(TRACE_ICALLS), + T_TBL(TRACE_CCALLS), + T_TBL(TRACE_DATABASE), + T_TBL(TRACE_ATTRS), + T_TBL(TRACE_MAXIMUM), + { + (char *) 0, 0 + } +}; + +static void +build_trace_menu(MenuNo number) +{ + static ITEM *items[SIZEOF(t_tbl)]; + + ITEM **ip = items; + int n; + + for (n = 0; t_tbl[n].name != 0; n++) + *ip++ = new_item(t_tbl[n].name, ""); + *ip = (ITEM *) 0; + + mpTrace = menu_create(items, SIZEOF(t_tbl) - 1, 2, number); +} + +static char * +tracetrace(unsigned tlevel) +{ + static char *buf; + int n; + + if (buf == 0) { + size_t need = 12; + for (n = 0; t_tbl[n].name != 0; n++) + need += strlen(t_tbl[n].name) + 2; + buf = (char *) malloc(need); + } + sprintf(buf, "0x%02x = {", tlevel); + if (tlevel == 0) { + sprintf(buf + strlen(buf), "%s, ", t_tbl[0].name); + } else { + for (n = 1; t_tbl[n].name != 0; n++) + if ((tlevel & t_tbl[n].mask) == t_tbl[n].mask) { + strcat(buf, t_tbl[n].name); + strcat(buf, ", "); + } + } + if (buf[strlen(buf) - 2] == ',') + buf[strlen(buf) - 2] = '\0'; + return (strcat(buf, "}")); +} + +/* fake a dynamically reconfigurable menu using the 0th entry to deselect + * the others + */ +static bool +update_trace_menu(MENU * m) +{ + ITEM **items; + ITEM *i, **p; + bool changed = FALSE; + + items = menu_items(m); + i = current_item(m); + if (i == items[0]) { + if (item_value(i)) { + for (p = items + 1; *p != 0; p++) + if (item_value(*p)) { + set_item_value(*p, FALSE); + changed = TRUE; + } + } + } + return changed; +} + +static int +perform_trace_menu(int cmd) +/* interactively set the trace level */ +{ + ITEM **ip; + unsigned newtrace; + int result; + + for (ip = menu_items(mpTrace); *ip; ip++) { + unsigned mask = t_tbl[item_index(*ip)].mask; + if (mask == 0) + set_item_value(*ip, _nc_tracing == 0); + else if ((mask & _nc_tracing) == mask) + set_item_value(*ip, TRUE); + } + + result = menu_driver(mpTrace, cmd); + + if (result == E_OK) { + if (update_trace_menu(mpTrace) || cmd == REQ_TOGGLE_ITEM) { + newtrace = 0; + for (ip = menu_items(mpTrace); *ip; ip++) { + if (item_value(*ip)) + newtrace |= t_tbl[item_index(*ip)].mask; + } + trace(newtrace); + _tracef("trace level interactively set to %s", tracetrace(_nc_tracing)); + + (void) mvprintw(LINES - 2, 0, + "Trace level is %s\n", tracetrace(_nc_tracing)); + refresh(); + } + } + return result; +} +#endif /* TRACE */ + +/*****************************************************************************/ + +static int +menu_number(void) +{ + return item_index(current_item(mpBanner)); +} + +static MENU * +current_menu(void) +{ + MENU *result; + + switch (menu_number()) { + case eFile: + result = mpFile; + break; + case eSelect: + result = mpSelect; + break; +#ifdef TRACE + case eTrace: + result = mpTrace; + break; +#endif + default: + result = 0; + break; + } + return result; +} + +static void +build_menus(char *filename) +{ + static const char *labels[] = + { + "File", + "Select", +#ifdef TRACE + "Trace", +#endif + (char *) 0 + }; + static ITEM *items[SIZEOF(labels)]; + + ITEM **ip = items; + const char **ap; + + for (ap = labels; *ap; ap++) + *ip++ = new_item(*ap, ""); + *ip = (ITEM *) 0; + + mpBanner = menu_create(items, SIZEOF(labels) - 1, SIZEOF(labels) - 1, eUnknown); + set_menu_mark(mpBanner, ">"); + + build_file_menu(eFile); + build_select_menu(eSelect, filename); +#ifdef TRACE + build_trace_menu(eTrace); +#endif +} + +static void +perform_menus(void) +{ + MENU *this_menu; + MENU *last_menu = mpFile; + int code = E_UNKNOWN_COMMAND, cmd, ch; + +#ifdef NCURSES_MOUSE_VERSION + mousemask(ALL_MOUSE_EVENTS, (mmask_t *) 0); +#endif + + menu_display(last_menu); + + for (;;) { + ch = menu_getc(mpBanner); + cmd = menu_virtualize(ch); + + switch (cmd) { + /* + * The banner menu acts solely to select one of the other menus. + * Move between its items, wrapping at the left/right limits. + */ + case REQ_LEFT_ITEM: + case REQ_RIGHT_ITEM: + code = menu_driver(mpBanner, cmd); + if (code == E_REQUEST_DENIED) { + if (menu_number() > 0) + code = menu_driver(mpBanner, REQ_FIRST_ITEM); + else + code = menu_driver(mpBanner, REQ_LAST_ITEM); + } + break; + default: + switch (menu_number()) { + case eFile: + code = perform_file_menu(cmd); + break; + case eSelect: + code = perform_select_menu(cmd); + break; +#ifdef TRACE + case eTrace: + code = perform_trace_menu(cmd); + break; +#endif + } + + if ((code == E_REQUEST_DENIED) && (cmd == KEY_MOUSE)) { + code = menu_driver(mpBanner, cmd); + } + + break; + } + + if (code == E_OK) { + this_menu = current_menu(); + if (this_menu != last_menu) { + move(1, 0); + clrtobot(); + box(menu_win(this_menu), 0, 0); + refresh(); + + /* force the current menu to appear */ + menu_display(this_menu); + + last_menu = this_menu; + } + } + wrefresh(menu_win(last_menu)); + if (code == E_UNKNOWN_COMMAND + || code == E_NOT_POSTED) { + if (menu_number() == eFile) + break; + beep(); + } + if (code == E_REQUEST_DENIED) + beep(); + continue; + } + +#ifdef NCURSES_MOUSE_VERSION + mousemask(0, (mmask_t *) 0); +#endif +} + +static void +destroy_menus(void) +{ + menu_destroy(mpFile); + menu_destroy(mpSelect); +#ifdef TRACE + menu_destroy(mpTrace); +#endif + menu_destroy(mpBanner); +} + int -main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +main(int argc, char *argv[]) { - printf("Not implemented - demo for menu library\n"); + setlocale(LC_ALL, ""); + + initscr(); + noraw(); + cbreak(); + noecho(); + + if (has_colors()) { + start_color(); + init_pair(1, COLOR_RED, COLOR_BLACK); + init_pair(2, COLOR_BLUE, COLOR_WHITE); + } + build_menus(argc > 1 ? argv[1] : 0); + perform_menus(); + destroy_menus(); + + endwin(); return EXIT_SUCCESS; } #else diff --git a/test/demo_termcap.c b/test/demo_termcap.c new file mode 100644 index 00000000..20a38e7e --- /dev/null +++ b/test/demo_termcap.c @@ -0,0 +1,157 @@ +/**************************************************************************** + * Copyright (c) 2005 Free Software Foundation, Inc. * + * * + * Permission is hereby granted, free of charge, to any person obtaining a * + * copy of this software and associated documentation files (the * + * "Software"), to deal in the Software without restriction, including * + * without limitation the rights to use, copy, modify, merge, publish, * + * distribute, distribute with modifications, sublicense, and/or sell * + * copies of the Software, and to permit persons to whom the Software is * + * furnished to do so, subject to the following conditions: * + * * + * The above copyright notice and this permission notice shall be included * + * in all copies or substantial portions of the Software. * + * * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * + * IN NO EVENT SHALL THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, * + * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR * + * THE USE OR OTHER DEALINGS IN THE SOFTWARE. * + * * + * Except as contained in this notice, the name(s) of the above copyright * + * holders shall not be used in advertising or otherwise to promote the * + * sale, use or other dealings in this Software without prior written * + * authorization. * + ****************************************************************************/ + +/* + * Author: Thomas E. Dickey + * + * $Id: demo_termcap.c,v 1.2 2005/04/30 14:57:54 tom Exp $ + * + * A simple demo of the termcap interface. + */ +#include + +#define isCapName(c) (isgraph(c) && strchr("^#=:\\", c) == 0) + +static void +dumpit(char *cap) +{ + /* + * One of the limitations of the termcap interface is that the library + * cannot determine the size of the buffer passed via tgetstr(), nor the + * amount of space remaining. This demo simply reuses the whole buffer + * for each call; a normal termcap application would try to use the buffer + * to hold all of the strings extracted from the terminal entry. + */ + char area[1024], *ap = area; + char *str; + int num; + + if ((str = tgetstr(cap, &ap)) != 0) { + /* + * Note that the strings returned are mostly terminfo format, since + * ncurses does not convert except for a handful of special cases. + */ + printf("str %s = ", cap); + while (*str != 0) { + int ch = UChar(*str++); + switch (ch) { + case '\177': + fputs("^?", stdout); + break; + case '\033': + fputs("\\E", stdout); + break; + case '\b': + fputs("\\b", stdout); + break; + case '\f': + fputs("\\f", stdout); + break; + case '\n': + fputs("\\n", stdout); + break; + case '\r': + fputs("\\r", stdout); + break; + case ' ': + fputs("\\s", stdout); + break; + case '\t': + fputs("\\t", stdout); + break; + case '^': + fputs("\\^", stdout); + break; + case ':': + fputs("\\072", stdout); + break; + case '\\': + fputs("\\\\", stdout); + break; + default: + if (isgraph(ch)) + fputc(ch, stdout); + else if (ch < 32) + printf("^%c", ch + '@'); + else + printf("\\%03o", ch); + break; + } + } + printf("\n"); + } else if ((num = tgetnum(cap)) >= 0) { + printf("num %s = %d\n", cap, num); + } else if ((num = tgetflag(cap)) != 0) { + printf("flg %s\n", cap); + } + fflush(stdout); +} + +static void +demo_termcap(char *name) +{ + char buffer[1024]; + + printf("Terminal type %s\n", name); + if (tgetent(buffer, name)) { + char cap[3]; + int c1, c2; + + cap[2] = 0; + for (c1 = 0; c1 < 256; ++c1) { + cap[0] = c1; + if (isCapName(c1)) { + for (c2 = 0; c2 < 256; ++c2) { + cap[1] = c2; + if (isCapName(c2)) { + dumpit(cap); + } + } + } + } + } +} + +int +main(int argc, char *argv[]) +{ + int n; + char *name; + + if (argc > 1) { + for (n = 1; n < argc; ++n) { + demo_termcap(argv[n]); + } + } else if ((name = getenv("TERM")) != 0) { + demo_termcap(name); + } else { + demo_termcap("dumb"); + } + + ExitProgram(EXIT_SUCCESS); +} diff --git a/test/ditto.c b/test/ditto.c index c2c6b26d..2a338d8b 100644 --- a/test/ditto.c +++ b/test/ditto.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998,2001 Free Software Foundation, Inc. * + * Copyright (c) 1998-2001,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey 1998 * - * $Id: ditto.c,v 1.4 2001/09/15 21:53:37 tom Exp $ + * $Id: ditto.c,v 1.5 2005/04/16 16:35:49 tom Exp $ * * The program illustrates how to set up multiple screens from a single * program. Invoke the program by specifying another terminal on the same @@ -80,9 +80,8 @@ open_tty(char *path) } int -main( - int argc GCC_UNUSED, - char *argv[]GCC_UNUSED) +main(int argc GCC_UNUSED, + char *argv[]GCC_UNUSED) { int j; int active_tty = 0; @@ -91,7 +90,7 @@ main( if (argc <= 1) usage(); - if ((data = (DITTO *) calloc(argc, sizeof(DITTO))) == 0) + if ((data = (DITTO *) calloc((unsigned) argc, sizeof(DITTO))) == 0) failed("calloc data"); data[0].input = stdin; @@ -107,10 +106,9 @@ main( */ for (j = 0; j < argc; j++) { active_tty++; - data[j].screen = newterm( - (char *) 0, /* assume $TERM is the same */ - data[j].output, - data[j].input); + data[j].screen = newterm((char *) 0, /* assume $TERM is the same */ + data[j].output, + data[j].input); if (data[j].screen == 0) failed("newterm"); cbreak(); @@ -132,7 +130,7 @@ main( break; for (j = 0; j < argc; j++) { set_term(data[j].screen); - addch(ch); + addch(UChar(ch)); refresh(); } } diff --git a/test/dots.c b/test/dots.c index 2e0190fc..d70ab3e0 100644 --- a/test/dots.c +++ b/test/dots.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1999-2001,2002 Free Software Foundation, Inc. * + * Copyright (c) 1999-2002,2004 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -29,14 +29,14 @@ /* * Author: Thomas E. Dickey 1999 * - * $Id: dots.c,v 1.8 2002/04/06 21:33:42 tom Exp $ + * $Id: dots.c,v 1.11 2005/05/28 21:38:45 tom Exp $ * * A simple demo of the terminfo interface. */ -#include - #include +#include + #define valid(s) ((s != 0) && s != (char *)-1) static bool interrupted = FALSE; @@ -101,7 +101,7 @@ main( if (signal(j, SIG_IGN) != SIG_IGN) signal(j, onsig); - srand(time(0)); + srand((unsigned) time(0)); setupterm((char *) 0, 1, (int *) 0); outs(clear_screen); outs(cursor_invisible); @@ -127,12 +127,16 @@ main( tputs(tparm2(set_a_foreground, z), 1, outc); } else { tputs(tparm2(set_a_background, z), 1, outc); + napms(1); } } else if (valid(exit_attribute_mode) && valid(enter_reverse_mode)) { - if (ranf() <= 0.01) - outs((ranf() > 0.6) ? enter_reverse_mode : - exit_attribute_mode); + if (ranf() <= 0.01) { + outs((ranf() > 0.6) + ? enter_reverse_mode + : exit_attribute_mode); + napms(1); + } } outc(p); fflush(stdout); diff --git a/test/edit_field.c b/test/edit_field.c index 780bdab8..d4fa7f76 100644 --- a/test/edit_field.c +++ b/test/edit_field.c @@ -1,5 +1,5 @@ /* - * $Id: edit_field.c,v 1.7 2003/05/17 23:16:13 tom Exp $ + * $Id: edit_field.c,v 1.11 2005/10/01 16:21:55 tom Exp $ * * A wrapper for form_driver() which keeps track of the user's editing changes * for each field, and makes the result available as a null-terminated string @@ -14,9 +14,6 @@ #include -#define MY_QUIT EDIT_FIELD('q') -#define MY_INS_MODE EDIT_FIELD('t') - static struct { int code; int result; @@ -77,6 +74,9 @@ static struct { { CTRL('S'), REQ_BEG_FIELD, "go to beginning of field" }, + { + CTRL('T'), MY_EDT_MODE, "toggle O_EDIT mode, clear field status", + }, { CTRL('U'), REQ_UP_FIELD, "move upward to field" }, @@ -102,7 +102,7 @@ static struct { CTRL(']'), MY_INS_MODE, "toggle REQ_INS_MODE/REQ_OVL_MODE", }, { - KEY_F(1), EDIT_FIELD('h'), "show this screen", + KEY_F(1), MY_HELP, "show this screen", }, { KEY_BACKSPACE, REQ_DEL_PREV, "delete previous character" @@ -181,7 +181,7 @@ help_edit_field(void) keypad(help, TRUE); keypad(data, TRUE); - waddstr(data, "Defined form-traversal keys:\n"); + waddstr(data, "Defined form edit/traversal keys:\n"); for (n = 0; n < SIZEOF(commands); ++n) { const char *name; #ifdef NCURSES_VERSION @@ -197,6 +197,32 @@ help_edit_field(void) do { switch (ch) { + case KEY_HOME: + y1 = 0; + break; + case KEY_END: + y1 = y2; + break; + case KEY_PREVIOUS: + case KEY_PPAGE: + if (y1 > 0) { + y1 -= high / 2; + if (y1 < 0) + y1 = 0; + } else { + beep(); + } + break; + case KEY_NEXT: + case KEY_NPAGE: + if (y1 < y2) { + y1 += high / 2; + if (y1 >= y2) + y1 = y2; + } else { + beep(); + } + break; case CTRL('P'): case KEY_UP: if (y1 > 0) diff --git a/test/edit_field.h b/test/edit_field.h index 89198383..c2e38ec0 100644 --- a/test/edit_field.h +++ b/test/edit_field.h @@ -1,5 +1,5 @@ /* - * $Id: edit_field.h,v 1.1 2003/04/26 22:54:50 tom Exp $ + * $Id: edit_field.h,v 1.3 2005/09/24 22:59:52 tom Exp $ * * Interface of edit_field.c */ @@ -11,6 +11,11 @@ #define EDIT_FIELD(c) (MAX_FORM_COMMAND + c) +#define MY_HELP EDIT_FIELD('h') +#define MY_QUIT EDIT_FIELD('q') +#define MY_EDT_MODE EDIT_FIELD('e') +#define MY_INS_MODE EDIT_FIELD('t') + extern void help_edit_field(void); extern int edit_field(FORM * form, int *result); diff --git a/test/filter.c b/test/filter.c index c3ea3c18..8fbda25e 100644 --- a/test/filter.c +++ b/test/filter.c @@ -29,7 +29,7 @@ /* * Author: Thomas E. Dickey 1998 * - * $Id: filter.c,v 1.7 2002/03/23 23:02:15 tom Exp $ + * $Id: filter.c,v 1.8 2004/06/05 21:57:30 tom Exp $ */ #include @@ -67,6 +67,8 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) char buffer[80]; attr_t underline; + setlocale(LC_ALL, ""); + filter(); (void) newterm((char *) 0, stdout, stdin); cbreak(); diff --git a/test/firework.c b/test/firework.c index 3d84c439..70099fb8 100644 --- a/test/firework.c +++ b/test/firework.c @@ -1,10 +1,10 @@ /* - * $Id: firework.c,v 1.20 2002/03/23 21:41:42 tom Exp $ + * $Id: firework.c,v 1.21 2005/05/28 21:39:04 tom Exp $ */ -#include - #include +#include + static int my_bg = COLOR_BLACK; static void diff --git a/test/firstlast.c b/test/firstlast.c index 6a79a33f..288f848d 100644 --- a/test/firstlast.c +++ b/test/firstlast.c @@ -2,7 +2,7 @@ * This test was written by Alexander V. Lukyanov to demonstrate difference * between ncurses 4.1 and SVR4 curses * - * $Id: firstlast.c,v 1.3 2001/09/15 21:46:34 tom Exp $ + * $Id: firstlast.c,v 1.4 2005/04/16 16:34:05 tom Exp $ */ #include @@ -13,7 +13,7 @@ fill(WINDOW *w, const char *str) const char *s; for (;;) { for (s = str; *s; s++) { - if (waddch(w, *s) == ERR) { + if (waddch(w, UChar(*s)) == ERR) { wmove(w, 0, 0); return; } @@ -22,9 +22,8 @@ fill(WINDOW *w, const char *str) } int -main( - int argc GCC_UNUSED, - char *argv[]GCC_UNUSED) +main(int argc GCC_UNUSED, + char *argv[]GCC_UNUSED) { WINDOW *large, *small; initscr(); diff --git a/test/gdc.c b/test/gdc.c index c466f2fd..83b3fd55 100644 --- a/test/gdc.c +++ b/test/gdc.c @@ -6,18 +6,22 @@ * modified 10-18-89 for curses (jrl) * 10-18-89 added signal handling * - * $Id: gdc.c,v 1.23 2002/08/10 19:20:14 tom Exp $ + * $Id: gdc.c,v 1.26 2005/05/28 21:39:39 tom Exp $ */ -#include - #include +#include + #define YBASE 10 #define XBASE 10 #define XLENGTH 54 #define YDEPTH 5 +#define PAIR_DIGITS 1 +#define PAIR_OTHERS 2 +#define PAIR_FRAMES 3 + static short disp[11] = { 075557, 011111, 071747, 071717, 055711, @@ -41,13 +45,13 @@ sighndl(int signo) } static void -drawbox(void) +drawbox(bool scrolling) { chtype bottom[XLENGTH + 1]; int n; if (hascolor) - attrset(COLOR_PAIR(3)); + attrset(COLOR_PAIR(PAIR_FRAMES)); mvaddch(YBASE - 1, XBASE - 1, ACS_ULCORNER); hline(ACS_HLINE, XLENGTH); @@ -55,8 +59,11 @@ drawbox(void) mvaddch(YBASE + YDEPTH, XBASE - 1, ACS_LLCORNER); mvinchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH); - for (n = 0; n < XLENGTH; n++) + for (n = 0; n < XLENGTH; n++) { + if (!scrolling) + bottom[n] &= ~A_COLOR; bottom[n] = ACS_HLINE | (bottom[n] & (A_ATTRIBUTES | A_COLOR)); + } mvaddchnstr(YBASE + YDEPTH, XBASE, bottom, XLENGTH); mvaddch(YBASE + YDEPTH, XBASE + XLENGTH, ACS_LRCORNER); @@ -67,7 +74,7 @@ drawbox(void) vline(ACS_VLINE, YDEPTH); if (hascolor) - attrset(COLOR_PAIR(2)); + attrset(COLOR_PAIR(PAIR_OTHERS)); } static void @@ -75,13 +82,13 @@ standt(int on) { if (on) { if (hascolor) { - attron(COLOR_PAIR(1)); + attron(COLOR_PAIR(PAIR_DIGITS)); } else { attron(A_STANDOUT); } } else { if (hascolor) { - attron(COLOR_PAIR(2)); + attron(COLOR_PAIR(PAIR_OTHERS)); } else { attroff(A_STANDOUT); } @@ -182,10 +189,10 @@ main(int argc, char *argv[]) if (use_default_colors() == OK) bg = -1; #endif - init_pair(1, COLOR_BLACK, COLOR_RED); - init_pair(2, COLOR_RED, bg); - init_pair(3, COLOR_WHITE, bg); - attrset(COLOR_PAIR(2)); + init_pair(PAIR_DIGITS, COLOR_BLACK, COLOR_RED); + init_pair(PAIR_OTHERS, COLOR_RED, bg); + init_pair(PAIR_FRAMES, COLOR_WHITE, bg); + attrset(COLOR_PAIR(PAIR_OTHERS)); } restart: @@ -193,7 +200,7 @@ main(int argc, char *argv[]) older[j] = newer[j] = next[j] = 0; clear(); - drawbox(); + drawbox(FALSE); do { char buf[30]; @@ -239,17 +246,17 @@ main(int argc, char *argv[]) } if (!s) { if (scrol) - drawbox(); + drawbox(TRUE); refresh(); /* * If we're scrolling, space out the refreshes to fake * movement. That's 7 frames, or 6 intervals, which would * be 166 msec if we spread it out over a second. It looks - * better (but will well on a slow terminal, e.g., less + * better (but will work on a slow terminal, e.g., less * than 9600bd) to squeeze that into a half-second, and use * half of 170 msec to ensure that the program doesn't eat * a lot of time when asking what time it is, at the top of - * this loop -TD + * this loop -T.Dickey */ if (scrol) napms(85); @@ -263,7 +270,7 @@ main(int argc, char *argv[]) mvaddstr(16, 30, buf); move(6, 0); - drawbox(); + drawbox(FALSE); refresh(); /* diff --git a/test/hashtest.c b/test/hashtest.c index 46a4f423..fbbcc725 100644 --- a/test/hashtest.c +++ b/test/hashtest.c @@ -3,7 +3,7 @@ * * Generate timing statistics for vertical-motion optimization. * - * $Id: hashtest.c,v 1.23 2002/10/19 22:11:24 tom Exp $ + * $Id: hashtest.c,v 1.24 2005/04/16 16:36:54 tom Exp $ */ #ifdef TRACE @@ -63,11 +63,11 @@ genlines(int base) move(0, 0); for (i = 0; i < head_lines; i++) for (j = 0; j < COLS; j++) - addch((j % 8 == 0) ? ('A' + j / 8) : '-'); + addch(UChar((j % 8 == 0) ? ('A' + j / 8) : '-')); move(head_lines, 0); for (i = head_lines; i < LINES - foot_lines; i++) { - int c = (base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1) + LO_CHAR; + chtype c = (base - LO_CHAR + i) % (HI_CHAR - LO_CHAR + 1) + LO_CHAR; int hi = (extend_corner || (i < LINES - 1)) ? COLS : COLS - 1; for (j = 0; j < hi; j++) addch(c); @@ -76,7 +76,7 @@ genlines(int base) for (i = LINES - foot_lines; i < LINES; i++) { move(i, 0); for (j = 0; j < (extend_corner ? COLS : COLS - 1); j++) - addch((j % 8 == 0) ? ('A' + j / 8) : '-'); + addch(UChar((j % 8 == 0) ? ('A' + j / 8) : '-')); } scrollok(stdscr, TRUE); diff --git a/test/ins_wide.c b/test/ins_wide.c index 6f3573f4..7660c5b7 100644 --- a/test/ins_wide.c +++ b/test/ins_wide.c @@ -1,5 +1,5 @@ /* - * $Id: ins_wide.c,v 1.3 2003/08/09 22:07:23 tom Exp $ + * $Id: ins_wide.c,v 1.6 2005/04/16 17:45:17 tom Exp $ * * Demonstrate the wins_wstr() and wins_wch functions. * Thomas Dickey - 2002/11/23 @@ -16,27 +16,66 @@ #include +#if USE_WIDEC_SUPPORT + +/* definitions to make it simpler to compare with inserts.c */ +#define InsNStr ins_nwstr +#define InsStr ins_wstr +#define MvInsNStr mvins_nwstr +#define MvInsStr mvins_wstr +#define MvWInsNStr mvwins_nwstr +#define MvWInsStr mvwins_wstr +#define WInsNStr wins_nwstr +#define WInsStr wins_wstr + #define TABSIZE 8 -#if USE_WIDEC_SUPPORT -static int margin = (2 * TABSIZE) - 1; +typedef enum { + oDefault = 0, + oMove = 1, + oWindow = 2, + oMoveWindow = 3 +} Options; + +static bool m_opt = FALSE; +static bool w_opt = FALSE; +static int n_opt = -1; static void -legend(WINDOW *win, wchar_t * buffer, int length) +legend(WINDOW *win, int level, Options state, wchar_t *buffer, int length) { + NCURSES_CONST char *showstate; + + switch (state) { + default: + case oDefault: + showstate = ""; + break; + case oMove: + showstate = " (mvXXX)"; + break; + case oWindow: + showstate = " (winXXX)"; + break; + case oMoveWindow: + showstate = " (mvwinXXX)"; + break; + } + wmove(win, 0, 0); wprintw(win, - "The Strings/Chars displays should match. Enter any characters.\n"); + "The Strings/Chars displays should match. Enter any characters, except:\n"); wprintw(win, - "Use down-arrow or ^N to repeat on the next line, 'q' to exit.\n"); + "down-arrow or ^N to repeat on next line, 'w' for inner window, 'q' to exit.\n"); wclrtoeol(win); - wprintw(win, "Inserted %d characters <", length); + wprintw(win, "Level %d,%s inserted %d characters <", level, + showstate, length); waddwstr(win, buffer); waddstr(win, ">"); } static int -ColOf(wchar_t * buffer, int length) +ColOf(wchar_t *buffer, int length, int margin) { int n; int result; @@ -63,7 +102,7 @@ ColOf(wchar_t * buffer, int length) result += 2; break; default: - ++result; + result += wcwidth(ch); if (ch < 32) ++result; break; @@ -72,36 +111,126 @@ ColOf(wchar_t * buffer, int length) return result; } -int -main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +static int +ConvertCh(chtype source, cchar_t *target) { - cchar_t tmp_cchar; wchar_t tmp_wchar[2]; + + tmp_wchar[0] = source; + tmp_wchar[1] = 0; + if (setcchar(target, tmp_wchar, A_NORMAL, 0, (void *) 0) == ERR) { + beep(); + return FALSE; + } + return TRUE; +} + +static int +MvWInsCh(WINDOW *win, int y, int x, chtype ch) +{ + int code; + cchar_t tmp_cchar; + + if (ConvertCh(ch, &tmp_cchar)) { + code = mvwins_wch(win, y, x, &tmp_cchar); + } else { + code = mvwinsch(win, y, x, ch); + } + return code; +} + +static int +MvInsCh(int y, int x, chtype ch) +{ + int code; + cchar_t tmp_cchar; + + if (ConvertCh(ch, &tmp_cchar)) { + code = mvins_wch(y, x, &tmp_cchar); + } else { + code = mvinsch(y, x, ch); + } + return code; +} + +static int +WInsCh(WINDOW *win, chtype ch) +{ + int code; + cchar_t tmp_cchar; + + if (ConvertCh(ch, &tmp_cchar)) { + code = wins_wch(win, &tmp_cchar); + } else { + code = winsch(win, ch); + } + return code; +} + +static int +InsCh(chtype ch) +{ + int code; + cchar_t tmp_cchar; + + if (ConvertCh(ch, &tmp_cchar)) { + code = ins_wch(&tmp_cchar); + } else { + code = insch(ch); + } + return code; +} + +#define LEN(n) ((length - (n) > n_opt) ? n_opt : (length - (n))) +static void +test_inserts(int level) +{ + static bool first = TRUE; + wint_t ch; int code; int limit; int row = 1; int col; + int row2, col2; int length; wchar_t buffer[BUFSIZ]; - WINDOW *work; - WINDOW *show; + WINDOW *look = 0; + WINDOW *work = 0; + WINDOW *show = 0; + int margin = (2 * TABSIZE) - 1; + Options option = ((m_opt ? oMove : oDefault) + | ((w_opt || (level > 0)) ? oWindow : oDefault)); + + if (first) { + static char cmd[80]; + setlocale(LC_ALL, ""); - putenv("TABSIZE=8"); - initscr(); - (void) cbreak(); /* take input chars one at a time, no wait for \n */ - (void) noecho(); /* don't echo input */ - keypad(stdscr, TRUE); + putenv(strcpy(cmd, "TABSIZE=8")); + + initscr(); + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) noecho(); /* don't echo input */ + keypad(stdscr, TRUE); + } limit = LINES - 5; - work = newwin(limit, COLS, 0, 0); - show = newwin(4, COLS, limit + 1, 0); + if (level > 0) { + look = newwin(limit, COLS - (2 * (level - 1)), 0, level - 1); + work = newwin(limit - 2, COLS - (2 * level), 1, level); + show = newwin(4, COLS, limit + 1, 0); + box(look, 0, 0); + wnoutrefresh(look); + limit -= 2; + } else { + work = stdscr; + show = derwin(stdscr, 4, COLS, limit + 1, 0); + } keypad(work, TRUE); for (col = margin + 1; col < COLS; col += TABSIZE) mvwvline(work, row, col, '.', limit - 2); - box(work, 0, 0); mvwvline(work, row, margin, ACS_VLINE, limit - 2); mvwvline(work, row, margin + 1, ACS_VLINE, limit - 2); limit /= 2; @@ -111,7 +240,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) wnoutrefresh(work); buffer[length = 0] = '\0'; - legend(show, buffer, length); + legend(show, level, option, buffer, length); wnoutrefresh(show); doupdate(); @@ -128,8 +257,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) while ((code = wget_wch(work, &ch)) != ERR) { - switch (code) { - case KEY_CODE_YES: + if (code == KEY_CODE_YES) { switch (ch) { case KEY_DOWN: ch = CTRL('N'); @@ -141,70 +269,222 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) beep(); continue; } + } else if (code == ERR) { + beep(); break; } if (ch == 'q') break; wmove(work, row, margin + 1); - if (ch == CTRL('N')) { + switch (ch) { + case 'w': + test_inserts(level + 1); + + touchwin(look); + touchwin(work); + touchwin(show); + + wnoutrefresh(look); + wnoutrefresh(work); + wnoutrefresh(show); + + doupdate(); + break; + case CTRL('N'): if (row < limit) { ++row; /* put the whole string in, all at once */ - mvwins_wstr(work, row, margin + 1, buffer); + col2 = margin + 1; + switch (option) { + case oDefault: + if (n_opt > 1) { + for (col = 0; col < length; col += n_opt) { + col2 = ColOf(buffer, col, margin); + if (move(row, col2) != ERR) { + InsNStr(buffer + col, LEN(col)); + } + } + } else { + if (move(row, col2) != ERR) { + InsStr(buffer); + } + } + break; + case oMove: + if (n_opt > 1) { + for (col = 0; col < length; col += n_opt) { + col2 = ColOf(buffer, col, margin); + MvInsNStr(row, col2, buffer + col, LEN(col)); + } + } else { + MvInsStr(row, col2, buffer); + } + break; + case oWindow: + if (n_opt > 1) { + for (col = 0; col < length; col += n_opt) { + col2 = ColOf(buffer, col, margin); + if (wmove(work, row, col2) != ERR) { + WInsNStr(work, buffer + col, LEN(col)); + } + } + } else { + if (wmove(work, row, col2) != ERR) { + WInsStr(work, buffer); + } + } + break; + case oMoveWindow: + if (n_opt > 1) { + for (col = 0; col < length; col += n_opt) { + col2 = ColOf(buffer, col, margin); + MvWInsNStr(work, row, col2, buffer + col, LEN(col)); + } + } else { + MvWInsStr(work, row, col2, buffer); + } + break; + } /* do the corresponding single-character insertion */ + row2 = limit + row; for (col = 0; col < length; ++col) { - memset(&tmp_cchar, 0, sizeof(tmp_cchar)); - if (setcchar(&tmp_cchar, - &(buffer[col]), - A_NORMAL, - 0, - (void *) 0) != ERR) { - mvwins_wch(work, limit + row, ColOf(buffer, col), &tmp_cchar); - } else { - beep(); /* even for tabs! */ - mvwinsch(work, - limit + row, - ColOf(buffer, col), buffer[col]); + col2 = ColOf(buffer, col, margin); + switch (option) { + case oDefault: + if (move(row2, col2) != ERR) { + InsCh((chtype) buffer[col]); + } + break; + case oMove: + MvInsCh(row2, col2, (chtype) buffer[col]); + break; + case oWindow: + if (wmove(work, row2, col2) != ERR) { + WInsCh(work, (chtype) buffer[col]); + } + break; + case oMoveWindow: + MvWInsCh(work, row2, col2, (chtype) buffer[col]); + break; } } } else { beep(); } - } else { + break; + case KEY_BACKSPACE: + ch = '\b'; + /* FALLTHRU */ + default: buffer[length++] = ch; buffer[length] = '\0'; + /* put the string in, one character at a time */ - mvwins_wstr(work, - row, - ColOf(buffer, length - 1), buffer + length - 1); + col = ColOf(buffer, length - 1, margin); + switch (option) { + case oDefault: + if (move(row, col) != ERR) { + InsStr(buffer + length - 1); + } + break; + case oMove: + MvInsStr(row, col, buffer + length - 1); + break; + case oWindow: + if (wmove(work, row, col) != ERR) { + WInsStr(work, buffer + length - 1); + } + break; + case oMoveWindow: + MvWInsStr(work, row, col, buffer + length - 1); + break; + } /* do the corresponding single-character insertion */ - tmp_wchar[0] = ch; - tmp_wchar[1] = 0; - if (setcchar(&tmp_cchar, - tmp_wchar, - A_NORMAL, - 0, - (void *) 0) != ERR) { - mvwins_wch(work, - limit + row, - ColOf(buffer, length - 1), &tmp_cchar); - } else { - beep(); /* even for tabs! */ - mvwinsch(work, - limit + row, - ColOf(buffer, length - 1), ch); + switch (option) { + case oDefault: + if (move(limit + row, col) != ERR) { + InsCh(ch); + } + break; + case oMove: + MvInsCh(limit + row, col, ch); + break; + case oWindow: + if (wmove(work, limit + row, col) != ERR) { + WInsCh(work, ch); + } + break; + case oMoveWindow: + MvWInsCh(work, limit + row, col, ch); + break; } + wnoutrefresh(work); - legend(show, buffer, length); + legend(show, level, option, buffer, length); wnoutrefresh(show); doupdate(); + break; + } + } + if (level > 0) { + delwin(show); + delwin(work); + delwin(look); + } +} + +static void +usage(void) +{ + static const char *tbl[] = + { + "Usage: inserts [options]" + ,"" + ,"Options:" + ," -n NUM limit string-inserts to NUM bytes on ^N replay" + ," -m perform wmove/move separately from insert-functions" + ," -w use window-parameter even when stdscr would be implied" + }; + unsigned n; + for (n = 0; n < SIZEOF(tbl); ++n) + fprintf(stderr, "%s\n", tbl[n]); + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + int ch; + + setlocale(LC_ALL, ""); + + while ((ch = getopt(argc, argv, "mn:w")) != EOF) { + switch (ch) { + case 'm': + m_opt = TRUE; + break; + case 'n': + n_opt = atoi(optarg); + if (n_opt == 0) + n_opt = -1; + break; + case 'w': + w_opt = TRUE; + break; + default: + usage(); + break; } } + if (optind < argc) + usage(); + + test_inserts(0); endwin(); ExitProgram(EXIT_SUCCESS); } diff --git a/test/inserts.c b/test/inserts.c index 990da1d4..b3b4857e 100644 --- a/test/inserts.c +++ b/test/inserts.c @@ -1,5 +1,5 @@ /* - * $Id: inserts.c,v 1.5 2003/08/09 22:07:06 tom Exp $ + * $Id: inserts.c,v 1.13 2005/04/16 15:56:42 tom Exp $ * * Demonstrate the winsstr() and winsch functions. * Thomas Dickey - 2002/10/19 @@ -7,24 +7,66 @@ #include +#define InsNStr insnstr +#define InsStr insstr +#define MvInsNStr mvinsnstr +#define MvInsStr mvinsstr +#define MvWInsNStr mvwinsnstr +#define MvWInsStr mvwinsstr +#define WInsNStr winsnstr +#define WInsStr winsstr + +#define InsCh insch +#define MvInsCh mvinsch +#define MvWInsCh mvwinsch +#define WInsCh winsch + #define TABSIZE 8 -static int margin = (2 * TABSIZE) - 1; +typedef enum { + oDefault = 0, + oMove = 1, + oWindow = 2, + oMoveWindow = 3 +} Options; + +static bool m_opt = FALSE; +static bool w_opt = FALSE; +static int n_opt = -1; static void -legend(WINDOW *win, char *buffer, int length) +legend(WINDOW *win, int level, Options state, char *buffer, int length) { + NCURSES_CONST char *showstate; + + switch (state) { + default: + case oDefault: + showstate = ""; + break; + case oMove: + showstate = " (mvXXX)"; + break; + case oWindow: + showstate = " (winXXX)"; + break; + case oMoveWindow: + showstate = " (mvwinXXX)"; + break; + } + wmove(win, 0, 0); wprintw(win, - "The Strings/Chars displays should match. Enter any characters.\n"); + "The Strings/Chars displays should match. Enter any characters, except:\n"); wprintw(win, - "Use down-arrow or ^N to repeat on the next line, 'q' to exit.\n"); + "down-arrow or ^N to repeat on next line, 'w' for inner window, 'q' to exit.\n"); wclrtoeol(win); - wprintw(win, "Inserted %d characters <%s>", length, buffer); + wprintw(win, "Level %d,%s inserted %d characters <%s>", level, + showstate, length, buffer); } static int -ColOf(char *buffer, int length) +ColOf(char *buffer, int length, int margin) { int n; int result; @@ -60,33 +102,55 @@ ColOf(char *buffer, int length) return result; } -int -main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +#define LEN(n) ((length - (n) > n_opt) ? n_opt : (length - (n))) +static void +test_inserts(int level) { + static bool first = TRUE; + int ch; int limit; int row = 1; int col; + int row2, col2; int length; char buffer[BUFSIZ]; - WINDOW *work; - WINDOW *show; + WINDOW *look = 0; + WINDOW *work = 0; + WINDOW *show = 0; + int margin = (2 * TABSIZE) - 1; + Options option = ((m_opt ? oMove : oDefault) + | ((w_opt || (level > 0)) ? oWindow : oDefault)); + + if (first) { + static char cmd[80]; + setlocale(LC_ALL, ""); + + putenv(strcpy(cmd, "TABSIZE=8")); - putenv("TABSIZE=8"); - initscr(); - (void) cbreak(); /* take input chars one at a time, no wait for \n */ - (void) noecho(); /* don't echo input */ - keypad(stdscr, TRUE); + initscr(); + (void) cbreak(); /* take input chars one at a time, no wait for \n */ + (void) noecho(); /* don't echo input */ + keypad(stdscr, TRUE); + } limit = LINES - 5; - work = newwin(limit, COLS, 0, 0); - show = newwin(4, COLS, limit + 1, 0); + if (level > 0) { + look = newwin(limit, COLS - (2 * (level - 1)), 0, level - 1); + work = newwin(limit - 2, COLS - (2 * level), 1, level); + show = newwin(4, COLS, limit + 1, 0); + box(look, 0, 0); + wnoutrefresh(look); + limit -= 2; + } else { + work = stdscr; + show = derwin(stdscr, 4, COLS, limit + 1, 0); + } keypad(work, TRUE); for (col = margin + 1; col < COLS; col += TABSIZE) mvwvline(work, row, col, '.', limit - 2); - box(work, 0, 0); mvwvline(work, row, margin, ACS_VLINE, limit - 2); mvwvline(work, row, margin + 1, ACS_VLINE, limit - 2); limit /= 2; @@ -96,7 +160,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) wnoutrefresh(work); buffer[length = 0] = '\0'; - legend(show, buffer, length); + legend(show, level, option, buffer, length); wnoutrefresh(show); doupdate(); @@ -112,18 +176,104 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) } while ((ch = wgetch(work)) != 'q') { + if (ch == ERR) { + beep(); + break; + } wmove(work, row, margin + 1); switch (ch) { + case 'w': + test_inserts(level + 1); + + touchwin(look); + touchwin(work); + touchwin(show); + + wnoutrefresh(look); + wnoutrefresh(work); + wnoutrefresh(show); + + doupdate(); + break; case CTRL('N'): case KEY_DOWN: if (row < limit) { ++row; /* put the whole string in, all at once */ - mvwinsstr(work, row, margin + 1, buffer); + col2 = margin + 1; + switch (option) { + case oDefault: + if (n_opt > 1) { + for (col = 0; col < length; col += n_opt) { + col2 = ColOf(buffer, col, margin); + if (move(row, col2) != ERR) { + InsNStr(buffer + col, LEN(col)); + } + } + } else { + if (move(row, col2) != ERR) { + InsStr(buffer); + } + } + break; + case oMove: + if (n_opt > 1) { + for (col = 0; col < length; col += n_opt) { + col2 = ColOf(buffer, col, margin); + MvInsNStr(row, col2, buffer + col, LEN(col)); + } + } else { + MvInsStr(row, col2, buffer); + } + break; + case oWindow: + if (n_opt > 1) { + for (col = 0; col < length; col += n_opt) { + col2 = ColOf(buffer, col, margin); + if (wmove(work, row, col2) != ERR) { + WInsNStr(work, buffer + col, LEN(col)); + } + } + } else { + if (wmove(work, row, col2) != ERR) { + WInsStr(work, buffer); + } + } + break; + case oMoveWindow: + if (n_opt > 1) { + for (col = 0; col < length; col += n_opt) { + col2 = ColOf(buffer, col, margin); + MvWInsNStr(work, row, col2, buffer + col, LEN(col)); + } + } else { + MvWInsStr(work, row, col2, buffer); + } + break; + } /* do the corresponding single-character insertion */ + row2 = limit + row; for (col = 0; col < length; ++col) { - mvwinsch(work, limit + row, ColOf(buffer, col), buffer[col]); + col2 = ColOf(buffer, col, margin); + switch (option) { + case oDefault: + if (move(row2, col2) != ERR) { + InsCh(UChar(buffer[col])); + } + break; + case oMove: + MvInsCh(row2, col2, UChar(buffer[col])); + break; + case oWindow: + if (wmove(work, row2, col2) != ERR) { + WInsCh(work, UChar(buffer[col])); + } + break; + case oMoveWindow: + MvWInsCh(work, row2, col2, UChar(buffer[col])); + break; + } } } else { beep(); @@ -139,24 +289,111 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) } buffer[length++] = ch; buffer[length] = '\0'; + /* put the string in, one character at a time */ - mvwinsstr(work, - row, - ColOf(buffer, length - 1), buffer + length - 1); + col = ColOf(buffer, length - 1, margin); + switch (option) { + case oDefault: + if (move(row, col) != ERR) { + InsStr(buffer + length - 1); + } + break; + case oMove: + MvInsStr(row, col, buffer + length - 1); + break; + case oWindow: + if (wmove(work, row, col) != ERR) { + WInsStr(work, buffer + length - 1); + } + break; + case oMoveWindow: + MvWInsStr(work, row, col, buffer + length - 1); + break; + } /* do the corresponding single-character insertion */ - mvwinsch(work, - limit + row, - ColOf(buffer, length - 1), ch); + switch (option) { + case oDefault: + if (move(limit + row, col) != ERR) { + InsCh(UChar(ch)); + } + break; + case oMove: + MvInsCh(limit + row, col, UChar(ch)); + break; + case oWindow: + if (wmove(work, limit + row, col) != ERR) { + WInsCh(work, UChar(ch)); + } + break; + case oMoveWindow: + MvWInsCh(work, limit + row, col, UChar(ch)); + break; + } + wnoutrefresh(work); - legend(show, buffer, length); + legend(show, level, option, buffer, length); wnoutrefresh(show); doupdate(); break; } } + if (level > 0) { + delwin(show); + delwin(work); + delwin(look); + } +} + +static void +usage(void) +{ + static const char *tbl[] = + { + "Usage: inserts [options]" + ,"" + ,"Options:" + ," -n NUM limit string-inserts to NUM bytes on ^N replay" + ," -m perform wmove/move separately from insert-functions" + ," -w use window-parameter even when stdscr would be implied" + }; + unsigned n; + for (n = 0; n < SIZEOF(tbl); ++n) + fprintf(stderr, "%s\n", tbl[n]); + ExitProgram(EXIT_FAILURE); +} + +int +main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) +{ + int ch; + + setlocale(LC_ALL, ""); + + while ((ch = getopt(argc, argv, "mn:w")) != EOF) { + switch (ch) { + case 'm': + m_opt = TRUE; + break; + case 'n': + n_opt = atoi(optarg); + if (n_opt == 0) + n_opt = -1; + break; + case 'w': + w_opt = TRUE; + break; + default: + usage(); + break; + } + } + if (optind < argc) + usage(); + + test_inserts(0); endwin(); ExitProgram(EXIT_SUCCESS); } diff --git a/test/keynames.c b/test/keynames.c index a61646c2..7dd944e6 100644 --- a/test/keynames.c +++ b/test/keynames.c @@ -1,5 +1,5 @@ /* - * $Id: keynames.c,v 1.5 2003/05/17 23:18:49 tom Exp $ + * $Id: keynames.c,v 1.7 2005/04/30 20:13:59 tom Exp $ */ #include @@ -8,7 +8,17 @@ int main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) { int n; - for (n = -1; n < 512; n++) { + + /* + * Get the terminfo entry into memory, and tell ncurses that we want to + * use function keys. That will make it add any user-defined keys that + * appear in the terminfo. + */ + newterm(getenv("TERM"), stderr, stdin); + keypad(stdscr, TRUE); + endwin(); + + for (n = -1; n < KEY_MAX + 512; n++) { const char *result = keyname(n); if (result != 0) printf("%d(%5o):%s\n", n, n, result); diff --git a/test/linux-color.dat b/test/linux-color.dat new file mode 100644 index 00000000..55302d4e --- /dev/null +++ b/test/linux-color.dat @@ -0,0 +1,21 @@ +# $Id: linux-color.dat,v 1.1 2004/05/22 23:42:45 tom Exp $ +# These values are derived from linux/drivers/char/vt.c (default_red[], +# default_grn[] and default_blu[]), commented +/* the default colour table, for VGA+ colour systems */ +scale:255 +0: 0 0 0 +1: 170 0 0 +2: 0 170 0 +3: 170 85 0 +4: 0 0 170 +5: 170 0 170 +6: 0 170 170 +7: 170 170 170 +8: 85 85 85 +9: 255 85 85 +10: 85 255 85 +11: 255 255 85 +12: 85 85 255 +13: 255 85 255 +14: 85 255 255 +15: 255 255 255 diff --git a/test/lrtest.c b/test/lrtest.c index 78dcaad2..c47bb4aa 100644 --- a/test/lrtest.c +++ b/test/lrtest.c @@ -2,12 +2,12 @@ * Test lower-right-hand corner access * * originally by Eric S. Raymond , written for animation - * and resizing -TD + * and resizing -T.Dickey * * This can't be part of the ncurses test-program, because ncurses rips off the * bottom line to do labels. * - * $Id: lrtest.c,v 1.19 2002/07/13 16:55:50 tom Exp $ + * $Id: lrtest.c,v 1.20 2004/08/07 16:08:01 tom Exp $ */ #include @@ -22,7 +22,7 @@ typedef struct { * really write to all positions properly. */ static void -show(MARK * m) +show(MARK *m) { mvaddch(m->y, m->x, m->value); if (m->mode == 0) { /* along the x-direction */ @@ -120,7 +120,7 @@ main( else if (ch == 'T') trace(0); else if (ch == 't') - trace(TRACE_CALLS|TRACE_ICALLS|TRACE_UPDATE); + trace(TRACE_CALLS | TRACE_ICALLS | TRACE_UPDATE); #endif #ifdef KEY_RESIZE else if (ch == KEY_RESIZE) { diff --git a/test/modules b/test/modules index 4de65f16..16d5ab09 100644 --- a/test/modules +++ b/test/modules @@ -1,7 +1,7 @@ # Test-Program modules -# $Id: modules,v 1.20 2003/12/07 00:01:23 tom Exp $ +# $Id: modules,v 1.23 2005/09/25 00:56:17 tom Exp $ ############################################################################## -# Copyright (c) 1998-2002,2003 Free Software Foundation, Inc. # +# Copyright (c) 1998-2003,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -28,42 +28,43 @@ # authorization. # ############################################################################## # -# Author: Thomas E. Dickey 1997-2003 +# Author: Thomas E. Dickey 1997-2005 # @ base -background progs $(srcdir) -blue progs $(srcdir) ../include/term.h -bs progs $(srcdir) -cardfile progs $(srcdir) ../include/panel.h ../include/form.h -color_set progs $(srcdir) -demo_defkey progs $(srcdir) -demo_keyok progs $(srcdir) -demo_forms progs $(srcdir) ../include/form.h -demo_menus progs $(srcdir) ../include/menu.h -demo_panels progs $(srcdir) ../include/panel.h -ditto progs $(srcdir) -dots progs $(srcdir) ../include/term.h -edit_field progs $(srcdir) -filter progs $(srcdir) ../include/form.h -firework progs $(srcdir) ../include/term.h -firstlast progs $(srcdir) -gdc progs $(srcdir) -hanoi progs $(srcdir) -hashtest progs $(srcdir) -ins_wide progs $(srcdir) -inserts progs $(srcdir) -keynames progs $(srcdir) -knight progs $(srcdir) -lrtest progs $(srcdir) -ncurses progs $(srcdir) ../include/panel.h ../include/menu.h ../include/form.h -newdemo progs $(srcdir) -railroad progs $(srcdir) ../include/termcap.h -rain progs $(srcdir) ../include/term.h -tclock progs $(srcdir) -testaddch progs $(srcdir) -testcurs progs $(srcdir) -testscanw progs $(srcdir) -view progs $(srcdir) -worm progs $(srcdir) -xmas progs $(srcdir) +background progs $(srcdir) $(HEADER_DEPS) +blue progs $(srcdir) $(HEADER_DEPS) +bs progs $(srcdir) $(HEADER_DEPS) +cardfile progs $(srcdir) $(HEADER_DEPS) ../include/panel.h ../include/form.h +color_set progs $(srcdir) $(HEADER_DEPS) +demo_defkey progs $(srcdir) $(HEADER_DEPS) +demo_keyok progs $(srcdir) $(HEADER_DEPS) +demo_forms progs $(srcdir) $(HEADER_DEPS) ../include/form.h $(srcdir)/edit_field.h +demo_menus progs $(srcdir) $(HEADER_DEPS) ../include/menu.h +demo_panels progs $(srcdir) $(HEADER_DEPS) ../include/panel.h +demo_termcap progs $(srcdir) $(HEADER_DEPS) +ditto progs $(srcdir) $(HEADER_DEPS) +dots progs $(srcdir) $(HEADER_DEPS) +edit_field progs $(srcdir) $(HEADER_DEPS) $(srcdir)/edit_field.h +filter progs $(srcdir) $(HEADER_DEPS) ../include/form.h +firework progs $(srcdir) $(HEADER_DEPS) +firstlast progs $(srcdir) $(HEADER_DEPS) +gdc progs $(srcdir) $(HEADER_DEPS) +hanoi progs $(srcdir) $(HEADER_DEPS) +hashtest progs $(srcdir) $(HEADER_DEPS) +ins_wide progs $(srcdir) $(HEADER_DEPS) +inserts progs $(srcdir) $(HEADER_DEPS) +keynames progs $(srcdir) $(HEADER_DEPS) +knight progs $(srcdir) $(HEADER_DEPS) +lrtest progs $(srcdir) $(HEADER_DEPS) +ncurses progs $(srcdir) $(HEADER_DEPS) ../include/panel.h ../include/menu.h ../include/form.h +newdemo progs $(srcdir) $(HEADER_DEPS) +railroad progs $(srcdir) $(HEADER_DEPS) +rain progs $(srcdir) $(HEADER_DEPS) +tclock progs $(srcdir) $(HEADER_DEPS) +testaddch progs $(srcdir) $(HEADER_DEPS) +testcurs progs $(srcdir) $(HEADER_DEPS) +testscanw progs $(srcdir) $(HEADER_DEPS) +view progs $(srcdir) $(HEADER_DEPS) +worm progs $(srcdir) $(HEADER_DEPS) +xmas progs $(srcdir) $(HEADER_DEPS) diff --git a/test/ncurses.c b/test/ncurses.c index 791c3a41..034bdf81 100644 --- a/test/ncurses.c +++ b/test/ncurses.c @@ -1,5 +1,5 @@ /**************************************************************************** - * Copyright (c) 1998-2003,2004 Free Software Foundation, Inc. * + * Copyright (c) 1998-2004,2005 Free Software Foundation, Inc. * * * * Permission is hereby granted, free of charge, to any person obtaining a * * copy of this software and associated documentation files (the * @@ -40,7 +40,7 @@ AUTHOR Author: Eric S. Raymond 1993 Thomas E. Dickey (beginning revision 1.27 in 1996). -$Id: ncurses.c,v 1.202 2004/02/07 20:24:08 tom Exp $ +$Id: ncurses.c,v 1.253 2005/10/01 16:00:56 tom Exp $ ***************************************************************************/ @@ -70,8 +70,8 @@ $Id: ncurses.c,v 1.202 2004/02/07 20:24:08 tom Exp $ #ifdef NCURSES_VERSION #ifdef TRACE -static int save_trace = TRACE_ORDINARY | TRACE_CALLS; -extern int _nc_tracing; +static unsigned save_trace = TRACE_ORDINARY | TRACE_CALLS; +extern unsigned _nc_tracing; #endif #else @@ -114,10 +114,21 @@ extern int _nc_tracing; #undef max_colors static int max_colors; /* the actual number of colors we'll use */ +static int min_colors; /* the minimum color code */ #undef max_pairs static int max_pairs; /* ...and the number of color pairs */ +typedef struct { + short red; + short green; + short blue; +} RGB_DATA; + +static RGB_DATA *all_colors; + +static void main_menu(bool); + /* The behavior of mvhline, mvvline for negative/zero length is unspecified, * though we can rely on negative x/y values to stop the macro. */ @@ -135,6 +146,14 @@ do_v_line(int y, int x, chtype c, int to) mvvline(y, x, c, (to) - (y)); } +static void +Repaint(void) +{ + touchwin(stdscr); + touchwin(curscr); + wrefresh(curscr); +} + /* Common function to allow ^T to toggle trace-mode in the middle of a test * so that trace-files can be made smaller. */ @@ -232,7 +251,7 @@ wGetstring(WINDOW *win, char *buffer, int limit) #if USE_WIDEC_SUPPORT static int -wGet_wchar(WINDOW *win, wint_t * result) +wGet_wchar(WINDOW *win, wint_t *result) { int c; #ifdef TRACE @@ -257,11 +276,12 @@ wGet_wchar(WINDOW *win, wint_t * result) /* replaces wgetn_wstr(), since we want to be able to edit values */ static void -wGet_wstring(WINDOW *win, wchar_t * buffer, int limit) +wGet_wstring(WINDOW *win, wchar_t *buffer, int limit) { int y0, x0, x; wint_t ch; bool done = FALSE; + bool fkey = FALSE; echo(); getyx(win, y0, x0); @@ -271,32 +291,46 @@ wGet_wstring(WINDOW *win, wchar_t * buffer, int limit) while (!done) { if (x > (int) wcslen(buffer)) x = (int) wcslen(buffer); + + /* clear the "window' */ + wmove(win, y0, x0); + wprintw(win, "%*s", limit, " "); + + /* write the existing buffer contents */ wmove(win, y0, x0); waddnwstr(win, buffer, limit); - if (x < limit) - wprintw(win, "%*s", limit - x, " "); - wmove(win, y0, x0 + x); + + /* positions the cursor past character 'x' */ + wmove(win, y0, x0); + waddnwstr(win, buffer, x); + switch (wGet_wchar(win, &ch)) { case KEY_CODE_YES: + fkey = TRUE; switch (ch) { case KEY_ENTER: ch = '\n'; + fkey = FALSE; break; case KEY_BACKSPACE: case KEY_DC: ch = '\b'; + fkey = FALSE; break; case KEY_LEFT: case KEY_RIGHT: break; default: - ch = (wint_t) - 1; + ch = (wint_t) -1; break; } + break; case OK: + fkey = FALSE; break; default: - ch = (wint_t) - 1; + ch = (wint_t) -1; + fkey = TRUE; break; } @@ -321,14 +355,14 @@ wGet_wstring(WINDOW *win, wchar_t * buffer, int limit) if (x > 0) { --x; } else { - flash(); + beep(); } break; case KEY_RIGHT: ++x; break; default: - if (!isprint(ch) || ch >= KEY_MIN) { + if (fkey) { beep(); } else if ((int) wcslen(buffer) < limit) { int j; @@ -337,7 +371,7 @@ wGet_wstring(WINDOW *win, wchar_t * buffer, int limit) } buffer[x++] = ch; } else { - flash(); + beep(); } } } @@ -378,44 +412,70 @@ ShellOut(bool message) } #ifdef NCURSES_MOUSE_VERSION +/* + * This function is the same as _tracemouse(), but we cannot count on that + * being available in the non-debug library. + */ static const char * mouse_decode(MEVENT const *ep) { - static char buf[80]; + static char buf[80 + (5 * 10) + (32 * 15)]; (void) sprintf(buf, "id %2d at (%2d, %2d, %2d) state %4lx = {", - ep->id, ep->x, ep->y, ep->z, ep->bstate); + ep->id, ep->x, ep->y, ep->z, (unsigned long) ep->bstate); #define SHOW(m, s) if ((ep->bstate & m)==m) {strcat(buf,s); strcat(buf, ", ");} + SHOW(BUTTON1_RELEASED, "release-1"); SHOW(BUTTON1_PRESSED, "press-1"); SHOW(BUTTON1_CLICKED, "click-1"); SHOW(BUTTON1_DOUBLE_CLICKED, "doubleclick-1"); SHOW(BUTTON1_TRIPLE_CLICKED, "tripleclick-1"); +#if NCURSES_MOUSE_VERSION == 1 SHOW(BUTTON1_RESERVED_EVENT, "reserved-1"); +#endif + SHOW(BUTTON2_RELEASED, "release-2"); SHOW(BUTTON2_PRESSED, "press-2"); SHOW(BUTTON2_CLICKED, "click-2"); SHOW(BUTTON2_DOUBLE_CLICKED, "doubleclick-2"); SHOW(BUTTON2_TRIPLE_CLICKED, "tripleclick-2"); +#if NCURSES_MOUSE_VERSION == 1 SHOW(BUTTON2_RESERVED_EVENT, "reserved-2"); +#endif + SHOW(BUTTON3_RELEASED, "release-3"); SHOW(BUTTON3_PRESSED, "press-3"); SHOW(BUTTON3_CLICKED, "click-3"); SHOW(BUTTON3_DOUBLE_CLICKED, "doubleclick-3"); SHOW(BUTTON3_TRIPLE_CLICKED, "tripleclick-3"); +#if NCURSES_MOUSE_VERSION == 1 SHOW(BUTTON3_RESERVED_EVENT, "reserved-3"); +#endif + SHOW(BUTTON4_RELEASED, "release-4"); SHOW(BUTTON4_PRESSED, "press-4"); SHOW(BUTTON4_CLICKED, "click-4"); SHOW(BUTTON4_DOUBLE_CLICKED, "doubleclick-4"); SHOW(BUTTON4_TRIPLE_CLICKED, "tripleclick-4"); +#if NCURSES_MOUSE_VERSION == 1 SHOW(BUTTON4_RESERVED_EVENT, "reserved-4"); +#endif + +#if NCURSES_MOUSE_VERSION == 2 + SHOW(BUTTON5_RELEASED, "release-5"); + SHOW(BUTTON5_PRESSED, "press-5"); + SHOW(BUTTON5_CLICKED, "click-5"); + SHOW(BUTTON5_DOUBLE_CLICKED, "doubleclick-5"); + SHOW(BUTTON5_TRIPLE_CLICKED, "tripleclick-5"); +#endif + SHOW(BUTTON_CTRL, "ctrl"); SHOW(BUTTON_SHIFT, "shift"); SHOW(BUTTON_ALT, "alt"); SHOW(ALL_MOUSE_EVENTS, "all-events"); SHOW(REPORT_MOUSE_POSITION, "position"); + #undef SHOW if (buf[strlen(buf) - 1] == ' ') @@ -525,7 +585,7 @@ remember_boxes(unsigned level, WINDOW *txt_win, WINDOW *box_win) * Resize both and paint the box in the parent. */ static void -resize_boxes(int level, WINDOW *win) +resize_boxes(unsigned level, WINDOW *win) { unsigned n; int base = 5; @@ -540,7 +600,7 @@ resize_boxes(int level, WINDOW *win) slk_clear(); slk_noutrefresh(); - for (n = 0; (int) n < level; ++n) { + for (n = 0; n < level; ++n) { wresize(winstack[n].frame, high, wide); wresize(winstack[n].text, high - 2, wide - 2); high -= 2; @@ -563,7 +623,7 @@ resize_boxes(int level, WINDOW *win) #endif static void -wgetch_test(int level, WINDOW *win, int delay) +wgetch_test(unsigned level, WINDOW *win, int delay) { char buf[BUFSIZ]; int first_y, first_x; @@ -571,7 +631,6 @@ wgetch_test(int level, WINDOW *win, int delay) int incount = 0; bool flags[256]; bool blocking = (delay < 0); - int y, x; memset(flags, FALSE, sizeof(flags)); flags[UChar('k')] = (win == stdscr); @@ -656,6 +715,7 @@ wgetch_test(int level, WINDOW *win, int delay) wprintw(win, "Key pressed: %04o ", c); #ifdef NCURSES_MOUSE_VERSION if (c == KEY_MOUSE) { + int y, x; MEVENT event; getmouse(&event); @@ -674,9 +734,9 @@ wgetch_test(int level, WINDOW *win, int delay) #endif (void) waddstr(win, keyname(c)); } else if (c > 0x80) { - int c2 = (c & 0x7f); + unsigned c2 = (c & 0x7f); if (isprint(c2)) - (void) wprintw(win, "M-%c", c2); + (void) wprintw(win, "M-%c", UChar(c2)); else (void) wprintw(win, "M-%s", unctrl(c2)); waddstr(win, " (high-half character)"); @@ -685,7 +745,7 @@ wgetch_test(int level, WINDOW *win, int delay) (void) wprintw(win, "%c (ASCII printable character)", c); else (void) wprintw(win, "%s (ASCII control character)", - unctrl(c)); + unctrl(UChar(c))); } wgetch_wrap(win, first_y); } @@ -749,7 +809,7 @@ getch_test(void) */ #ifdef KEY_RESIZE static void -resize_wide_boxes(int level, WINDOW *win) +resize_wide_boxes(unsigned level, WINDOW *win) { unsigned n; int base = 5; @@ -764,7 +824,7 @@ resize_wide_boxes(int level, WINDOW *win) slk_clear(); slk_noutrefresh(); - for (n = 0; (int) n < level; ++n) { + for (n = 0; n < level; ++n) { wresize(winstack[n].frame, high, wide); wresize(winstack[n].text, high - 2, wide - 2); high -= 2; @@ -785,7 +845,7 @@ resize_wide_boxes(int level, WINDOW *win) #endif /* KEY_RESIZE */ static char * -wcstos(const wchar_t * src) +wcstos(const wchar_t *src) { int need; mbstate_t state; @@ -794,9 +854,10 @@ wcstos(const wchar_t * src) memset(&state, 0, sizeof(state)); if ((need = wcsrtombs(0, &tmp, 0, &state)) > 0) { - result = (char *) calloc(need + 1, 1); + unsigned have = need; + result = (char *) calloc(have + 1, 1); tmp = src; - if (wcsrtombs(result, &tmp, need, &state) != (size_t) need) { + if (wcsrtombs(result, &tmp, have, &state) != have) { free(result); result = 0; } @@ -805,9 +866,10 @@ wcstos(const wchar_t * src) } static void -wget_wch_test(int level, WINDOW *win, int delay) +wget_wch_test(unsigned level, WINDOW *win, int delay) { - wchar_t buf[BUFSIZ]; + wchar_t wchar_buf[BUFSIZ]; + wint_t wint_buf[BUFSIZ]; int first_y, first_x; wint_t c; int incount = 0; @@ -850,13 +912,21 @@ wget_wch_test(int level, WINDOW *win, int delay) } else if (c == 'g') { waddstr(win, "getstr test: "); echo(); - wgetn_wstr(win, (wint_t *) buf, sizeof(buf) - 1); + code = wgetn_wstr(win, wint_buf, sizeof(wint_buf) - 1); noecho(); - if ((temp = wcstos(buf)) != 0) { - wprintw(win, "I saw %d characters:\n\t`%s'.", wcslen(buf), temp); - free(temp); + if (code == ERR) { + wprintw(win, "wgetn_wstr returns an error."); } else { - wprintw(win, "I saw %d characters (cannot convert).", wcslen(buf)); + int n; + for (n = 0; (wchar_buf[n] = wint_buf[n]) != 0; ++n) ; + if ((temp = wcstos(wchar_buf)) != 0) { + wprintw(win, "I saw %d characters:\n\t`%s'.", + wcslen(wchar_buf), temp); + free(temp); + } else { + wprintw(win, "I saw %d characters (cannot convert).", + wcslen(wchar_buf)); + } } wclrtoeol(win); wgetch_wrap(win, first_y); @@ -919,7 +989,7 @@ wget_wch_test(int level, WINDOW *win, int delay) resize_wide_boxes(level, win); } #endif - (void) waddstr(win, key_name(c)); + (void) waddstr(win, key_name((wchar_t) c)); } else { if (c < 256 && iscntrl(c)) { (void) wprintw(win, "%s (control character)", unctrl(c)); @@ -954,7 +1024,99 @@ get_wch_test(void) #define MAX_ATTRSTRING 31 #define LEN_ATTRSTRING 26 -static char attr_test_string[] = "abcde fghij klmno pqrst uvwxy z"; +static char attr_test_string[MAX_ATTRSTRING + 1]; + +static void +attr_legend(WINDOW *helpwin) +{ + int row = 1; + int col = 1; + + mvwprintw(helpwin, row++, col, + "q or ESC to exit."); + mvwprintw(helpwin, row++, col, + "^L repaints."); + ++row; + mvwprintw(helpwin, row++, col, + "Modify the test strings:"); + mvwprintw(helpwin, row++, col, + " A digit sets gaps on each side of displayed attributes"); + mvwprintw(helpwin, row++, col, + " shifts the text left/right. "); + ++row; + mvwprintw(helpwin, row++, col, + "Toggles:"); + if (has_colors()) { + mvwprintw(helpwin, row++, col, + " f/F/b/F toggle foreground/background background color"); + mvwprintw(helpwin, row++, col, + " t/T toggle text/background color attribute"); + } + mvwprintw(helpwin, row++, col, + " a/A toggle ACS (alternate character set) mapping"); + mvwprintw(helpwin, row++, col, + " v/V toggle video attribute to combine with each line"); +} + +static void +show_color_attr(int fg, int bg, int tx) +{ + if (has_colors()) { + printw(" Colors (fg %d, bg %d", fg, bg); + if (tx >= 0) + printw(", text %d", tx); + printw("),"); + } +} + +static bool +cycle_color_attr(int ch, int *fg, int *bg, int *tx) +{ + bool error = FALSE; + + if (has_colors()) { + switch (ch) { + case 'f': + *fg = (*fg + 1); + break; + case 'F': + *fg = (*fg - 1); + break; + case 'b': + *bg = (*bg + 1); + break; + case 'B': + *bg = (*bg - 1); + break; + case 't': + *tx = (*tx + 1); + break; + case 'T': + *tx = (*tx - 1); + break; + default: + beep(); + error = TRUE; + break; + } + if (*fg >= COLORS) + *fg = min_colors; + if (*fg < min_colors) + *fg = COLORS - 1; + if (*bg >= COLORS) + *bg = min_colors; + if (*bg < min_colors) + *bg = COLORS - 1; + if (*tx >= COLORS) + *tx = -1; + if (*tx < -1) + *tx = COLORS - 1; + } else { + beep(); + error = TRUE; + } + return error; +} static void adjust_attr_string(int adjust) @@ -964,7 +1126,7 @@ adjust_attr_string(int adjust) if (first >= ' ' && last <= '~') { /* 32..126 */ int j, k; - for (j = 0, k = first; k <= last; ++j, ++k) { + for (j = 0, k = first; j < MAX_ATTRSTRING && k <= last; ++j, ++k) { attr_test_string[j] = k; if (((k + 1 - first) % 5) == 0) { ++j; @@ -980,132 +1142,158 @@ adjust_attr_string(int adjust) } } +static void +init_attr_string(void) +{ + attr_test_string[0] = 'a'; + adjust_attr_string(0); +} + static int -show_attr(int row, int skip, chtype attr, const char *name) +show_attr(int row, int skip, bool arrow, chtype attr, const char *name) { int ncv = tigetnum("ncv"); - chtype test = attr & ~A_ALTCHARSET; + chtype test = attr & (chtype) (~A_ALTCHARSET); + if (arrow) + mvprintw(row, 5, "-->"); mvprintw(row, 8, "%s mode:", name); mvprintw(row, 24, "|"); if (skip) printw("%*s", skip, " "); - attrset(attr); /* - * If we're to write a string in the alternate character set, it is not - * sufficient to just set A_ALTCHARSET. We have to perform the mapping - * that corresponds. This is not needed for vt100-compatible devices - * because the acs_map[] is 1:1, but for PC-style devices such as Linux - * console, the acs_map[] is scattered about the range. - * - * The addch/addstr functions do not themselves do this mapping, since it - * is possible to turn off the A_ALTCHARSET flag for the characters which - * are added, and it would be an unexpected result to have the mapped - * characters visible on the screen. + * Just for testing, write text using the alternate character set one + * character at a time (to pass its rendition directly), and use the + * string operation for the other attributes. */ if (attr & A_ALTCHARSET) { const char *s; - int ch; + chtype ch; for (s = attr_test_string; *s != '\0'; ++s) { ch = UChar(*s); - addch(ch); + addch(ch | attr); } } else { + attrset(attr); addstr(attr_test_string); + attroff(attr); } - attroff(attr); if (skip) printw("%*s", skip, " "); printw("|"); if (test != A_NORMAL) { if (!(termattrs() & test)) { printw(" (N/A)"); - } else if (ncv > 0 && (getbkgd(stdscr) & A_COLOR)) { - static const chtype table[] = - { - A_STANDOUT, - A_UNDERLINE, - A_REVERSE, - A_BLINK, - A_DIM, - A_BOLD, - A_INVIS, - A_PROTECT, - A_ALTCHARSET - }; - unsigned n; - bool found = FALSE; - for (n = 0; n < SIZEOF(table); n++) { - if ((table[n] & attr) != 0 - && ((1 << n) & ncv) != 0) { - found = TRUE; - break; + } else { + if (ncv > 0 && (getbkgd(stdscr) & A_COLOR)) { + static const chtype table[] = + { + A_STANDOUT, + A_UNDERLINE, + A_REVERSE, + A_BLINK, + A_DIM, + A_BOLD, + A_INVIS, + A_PROTECT, + A_ALTCHARSET + }; + unsigned n; + bool found = FALSE; + for (n = 0; n < SIZEOF(table); n++) { + if ((table[n] & attr) != 0 + && ((1 << n) & ncv) != 0) { + found = TRUE; + break; + } } + if (found) + printw(" (NCV)"); } - if (found) - printw(" (NCV)"); + if ((termattrs() & test) != test) + printw(" (Part)"); } } return row + 2; } +/* *INDENT-OFF* */ +static const struct { + attr_t attr; + NCURSES_CONST char * name; +} attrs_to_test[] = { + { A_STANDOUT, "STANDOUT" }, + { A_REVERSE, "REVERSE" }, + { A_BOLD, "BOLD" }, + { A_UNDERLINE, "UNDERLINE" }, + { A_DIM, "DIM" }, + { A_BLINK, "BLINK" }, + { A_PROTECT, "PROTECT" }, + { A_INVIS, "INVISIBLE" }, + { A_NORMAL, "NORMAL" }, +}; +/* *INDENT-ON* */ static bool -attr_getc(int *skip, int *fg, int *bg, int *ac) +attr_getc(int *skip, int *fg, int *bg, int *tx, int *ac, unsigned *kc) { - int ch = Getchar(); - - if (isdigit(ch)) { - *skip = (ch - '0'); - } else if (ch == CTRL('L')) { - touchwin(stdscr); - touchwin(curscr); - wrefresh(curscr); - } else { - switch (ch) { - case 'a': - *ac = 0; - break; - case 'A': - *ac = A_ALTCHARSET; - break; - case '<': - adjust_attr_string(-1); - break; - case '>': - adjust_attr_string(1); - break; - default: - if (has_colors()) { - switch (ch) { - case 'f': - *fg = (*fg + 1); - break; - case 'F': - *fg = (*fg - 1); - break; - case 'b': - *bg = (*bg + 1); - break; - case 'B': - *bg = (*bg - 1); - break; - default: - return FALSE; + bool result = TRUE; + bool error = FALSE; + WINDOW *helpwin; + + do { + int ch = Getchar(); + + error = FALSE; + if (ch < 256 && isdigit(ch)) { + *skip = (ch - '0'); + } else { + switch (ch) { + case CTRL('L'): + Repaint(); + break; + case '?': + if ((helpwin = newwin(LINES - 1, COLS - 2, 0, 0)) != 0) { + box(helpwin, 0, 0); + attr_legend(helpwin); + wGetchar(helpwin); + delwin(helpwin); } - if (*fg >= max_colors) - *fg = 0; - if (*fg < 0) - *fg = max_colors - 1; - if (*bg >= max_colors) - *bg = 0; - if (*bg < 0) - *bg = max_colors - 1; + break; + case 'a': + *ac = 0; + break; + case 'A': + *ac = A_ALTCHARSET; + break; + case 'v': + if (*kc == 0) + *kc = SIZEOF(attrs_to_test) - 1; + else + *kc -= 1; + break; + case 'V': + *kc += 1; + if (*kc >= SIZEOF(attrs_to_test)) + *kc = 0; + break; + case '<': + adjust_attr_string(-1); + break; + case '>': + adjust_attr_string(1); + break; + case 'q': + case ESCAPE: + result = FALSE; + break; + default: + error = cycle_color_attr(ch, fg, bg, tx); + break; } - break; } - } - return TRUE; + } while (error); + return result; } static void @@ -1116,26 +1304,40 @@ attr_test(void) int skip = tigetnum("xmc"); int fg = COLOR_BLACK; /* color pair 0 is special */ int bg = COLOR_BLACK; + int tx = -1; int ac = 0; - bool *pairs = (bool *) calloc(max_pairs, sizeof(bool)); - pairs[0] = TRUE; + unsigned j, k; if (skip < 0) skip = 0; n = skip; /* make it easy */ + k = SIZEOF(attrs_to_test) - 1; + init_attr_string(); do { int row = 2; - int normal = A_NORMAL | BLANK; + chtype normal = A_NORMAL | BLANK; + chtype extras = ac; if (has_colors()) { - int pair = (fg * max_colors) + bg; - if (!pairs[pair]) { - init_pair(pair, fg, bg); - pairs[pair] = TRUE; + int pair = (fg != COLOR_BLACK || bg != COLOR_BLACK); + if (pair != 0) { + pair = 1; + if (init_pair(pair, fg, bg) == ERR) { + beep(); + } else { + normal |= COLOR_PAIR(pair); + } + } + if (tx >= 0) { + pair = 2; + if (init_pair(pair, tx, bg) == ERR) { + beep(); + } else { + extras |= COLOR_PAIR(pair); + } } - normal |= COLOR_PAIR(pair); } bkgd(normal); bkgdset(normal); @@ -1144,38 +1346,303 @@ attr_test(void) box(stdscr, 0, 0); mvaddstr(0, 20, "Character attribute test display"); - row = show_attr(row, n, ac | A_STANDOUT, "STANDOUT"); - row = show_attr(row, n, ac | A_REVERSE, "REVERSE"); - row = show_attr(row, n, ac | A_BOLD, "BOLD"); - row = show_attr(row, n, ac | A_UNDERLINE, "UNDERLINE"); - row = show_attr(row, n, ac | A_DIM, "DIM"); - row = show_attr(row, n, ac | A_BLINK, "BLINK"); - row = show_attr(row, n, ac | A_PROTECT, "PROTECT"); - row = show_attr(row, n, ac | A_INVIS, "INVISIBLE"); - row = show_attr(row, n, ac | A_NORMAL, "NORMAL"); + for (j = 0; j < SIZEOF(attrs_to_test); ++j) { + row = show_attr(row, n, j == k, + extras | + attrs_to_test[j].attr | + attrs_to_test[k].attr, + attrs_to_test[j].name); + } mvprintw(row, 8, "This terminal does %shave the magic-cookie glitch", tigetnum("xmc") > -1 ? "" : "not "); - mvprintw(row + 1, 8, - "Enter a digit to set gaps on each side of displayed attributes"); - mvprintw(row + 2, 8, - "^L repaints, shifts, "); - if (has_colors()) - printw("f/F/b/F toggle color (now %d/%d), a/A ACS (%d)", - fg, bg, ac != 0); - else - printw("a/A ACS (%d)", ac != 0); + mvprintw(row + 1, 8, "Enter '?' for help."); + show_color_attr(fg, bg, tx); + printw(" ACS (%d)", ac != 0); refresh(); - } while (attr_getc(&n, &fg, &bg, &ac)); + } while (attr_getc(&n, &fg, &bg, &tx, &ac, &k)); - free((char *) pairs); bkgdset(A_NORMAL | BLANK); erase(); endwin(); } +#if USE_WIDEC_SUPPORT +static wchar_t wide_attr_test_string[MAX_ATTRSTRING + 1]; + +static void +wide_adjust_attr_string(int adjust) +{ + int first = ((int) UChar(wide_attr_test_string[0])) + adjust; + int last = first + LEN_ATTRSTRING; + + if (first >= ' ' && last <= '~') { /* 32..126 */ + int j, k; + for (j = 0, k = first; j < MAX_ATTRSTRING && k <= last; ++j, ++k) { + wide_attr_test_string[j] = k; + if (((k + 1 - first) % 5) == 0) { + ++j; + if (j < MAX_ATTRSTRING) + wide_attr_test_string[j] = ' '; + } + } + while (j < MAX_ATTRSTRING) + wide_attr_test_string[j++] = ' '; + wide_attr_test_string[j] = '\0'; + } else { + beep(); + } +} + +static void +wide_init_attr_string(void) +{ + wide_attr_test_string[0] = 'a'; + wide_adjust_attr_string(0); +} + +static void +set_wide_background(short pair) +{ + cchar_t normal; + wchar_t blank[2]; + + blank[0] = ' '; + blank[1] = 0; + setcchar(&normal, blank, A_NORMAL, pair, 0); + bkgrnd(&normal); + bkgrndset(&normal); +} + +static attr_t +get_wide_background(void) +{ + attr_t result = A_NORMAL; + attr_t attr; + cchar_t ch; + short pair; + wchar_t wch; + + if (getbkgrnd(&ch) != ERR) { + if (getcchar(&ch, &wch, &attr, &pair, 0) != ERR) { + result = attr; + } + } + return result; +} + +static int +wide_show_attr(int row, int skip, bool arrow, chtype attr, short pair, const char *name) +{ + int ncv = tigetnum("ncv"); + chtype test = attr & ~WA_ALTCHARSET; + + if (arrow) + mvprintw(row, 5, "-->"); + mvprintw(row, 8, "%s mode:", name); + mvprintw(row, 24, "|"); + if (skip) + printw("%*s", skip, " "); + + /* + * Just for testing, write text using the alternate character set one + * character at a time (to pass its rendition directly), and use the + * string operation for the other attributes. + */ + if (attr & WA_ALTCHARSET) { + const wchar_t *s; + cchar_t ch; + + for (s = wide_attr_test_string; *s != L'\0'; ++s) { + wchar_t fill[2]; + fill[0] = *s; + fill[1] = L'\0'; + setcchar(&ch, fill, attr, pair, 0); + add_wch(&ch); + } + } else { + attr_t old_attr; + short old_pair; + + attr_get(&old_attr, &old_pair, 0); + attr_set(attr, pair, 0); + addwstr(wide_attr_test_string); + attr_set(old_attr, old_pair, 0); + } + if (skip) + printw("%*s", skip, " "); + printw("|"); + if (test != A_NORMAL) { + if (!(term_attrs() & test)) { + printw(" (N/A)"); + } else { + if (ncv > 0 && (get_wide_background() & A_COLOR)) { + static const attr_t table[] = + { + WA_STANDOUT, + WA_UNDERLINE, + WA_REVERSE, + WA_BLINK, + WA_DIM, + WA_BOLD, + WA_INVIS, + WA_PROTECT, + WA_ALTCHARSET + }; + unsigned n; + bool found = FALSE; + for (n = 0; n < SIZEOF(table); n++) { + if ((table[n] & attr) != 0 + && ((1 << n) & ncv) != 0) { + found = TRUE; + break; + } + } + if (found) + printw(" (NCV)"); + } + if ((term_attrs() & test) != test) + printw(" (Part)"); + } + } + return row + 2; +} + +static bool +wide_attr_getc(int *skip, int *fg, int *bg, int *tx, int *ac, unsigned *kc) +{ + bool result = TRUE; + bool error = FALSE; + WINDOW *helpwin; + + do { + int ch = Getchar(); + + error = FALSE; + if (ch < 256 && isdigit(ch)) { + *skip = (ch - '0'); + } else { + switch (ch) { + case CTRL('L'): + Repaint(); + break; + case '?': + if ((helpwin = newwin(LINES - 1, COLS - 2, 0, 0)) != 0) { + box_set(helpwin, 0, 0); + attr_legend(helpwin); + wGetchar(helpwin); + delwin(helpwin); + } + break; + case 'a': + *ac = 0; + break; + case 'A': + *ac = A_ALTCHARSET; + break; + case 'v': + if (*kc == 0) + *kc = SIZEOF(attrs_to_test) - 1; + else + *kc -= 1; + break; + case 'V': + *kc += 1; + if (*kc >= SIZEOF(attrs_to_test)) + *kc = 0; + break; + case '<': + wide_adjust_attr_string(-1); + break; + case '>': + wide_adjust_attr_string(1); + break; + case 'q': + case ESCAPE: + result = FALSE; + break; + default: + error = cycle_color_attr(ch, fg, bg, tx); + break; + } + } + } while (error); + return result; +} + +static void +wide_attr_test(void) +/* test text attributes using wide-character calls */ +{ + int n; + int skip = tigetnum("xmc"); + int fg = COLOR_BLACK; /* color pair 0 is special */ + int bg = COLOR_BLACK; + int tx = -1; + int ac = 0; + unsigned j, k; + + if (skip < 0) + skip = 0; + + n = skip; /* make it easy */ + k = SIZEOF(attrs_to_test) - 1; + wide_init_attr_string(); + + do { + int row = 2; + short pair = 0; + short extras = 0; + + if (has_colors()) { + pair = (fg != COLOR_BLACK || bg != COLOR_BLACK); + if (pair != 0) { + pair = 1; + if (init_pair(pair, fg, bg) == ERR) { + beep(); + } + } + extras = pair; + if (tx >= 0) { + extras = 2; + if (init_pair(extras, tx, bg) == ERR) { + beep(); + } + } + } + set_wide_background(pair); + erase(); + + box_set(stdscr, 0, 0); + mvaddstr(0, 20, "Character attribute test display"); + + for (j = 0; j < SIZEOF(attrs_to_test); ++j) { + row = wide_show_attr(row, n, j == k, + ac | + attrs_to_test[j].attr | + attrs_to_test[k].attr, + extras, + attrs_to_test[j].name); + } + + mvprintw(row, 8, + "This terminal does %shave the magic-cookie glitch", + tigetnum("xmc") > -1 ? "" : "not "); + mvprintw(row + 1, 8, "Enter '?' for help."); + show_color_attr(fg, bg, tx); + printw(" ACS (%d)", ac != 0); + + refresh(); + } while (wide_attr_getc(&n, &fg, &bg, &tx, &ac, &k)); + + set_wide_background(0); + erase(); + endwin(); +} +#endif + /**************************************************************************** * * Color support tests @@ -1203,55 +1670,378 @@ static NCURSES_CONST char *the_color_names[] = }; static void -show_color_name(int y, int x, int color) +show_color_name(int y, int x, int color, bool wide) { - if (max_colors > 8) - mvprintw(y, x, "%02d ", color); - else - mvaddstr(y, x, the_color_names[color]); + if (move(y, x) != ERR) { + char temp[80]; + int width = 8; + + if (wide) { + sprintf(temp, "%02d", color); + width = 4; + } else if (color >= 8) { + sprintf(temp, "[%02d]", color); + } else { + strcpy(temp, the_color_names[color]); + } + printw("%-*.*s", width, width, temp); + } } +static void +color_legend(WINDOW *helpwin) +{ + int row = 1; + int col = 1; + + mvwprintw(helpwin, row++, col, + "q or ESC to exit."); + ++row; + mvwprintw(helpwin, row++, col, + "Use up/down arrow to scroll through the display if it is"); + mvwprintw(helpwin, row++, col, + "longer than one screen. Control/N and Control/P can be used"); + mvwprintw(helpwin, row++, col, + "in place up up/down arrow. Use pageup/pagedown to scroll a"); + mvwprintw(helpwin, row++, col, + "full screen; control/B and control/F can be used here."); + ++row; + mvwprintw(helpwin, row++, col, + "Toggles:"); + mvwprintw(helpwin, row++, col, + " b/B toggle bold off/on"); + mvwprintw(helpwin, row++, col, + " n/N toggle text/number on/off"); + mvwprintw(helpwin, row++, col, + " w/W toggle width between 8/16 colors"); +} + +#define set_color_test(name, value) if (name != value) { name = value; base_row = 0; } + +/* generate a color test pattern */ static void color_test(void) +{ + int c; + int i; + int top = 0, width; + int base_row = 0; + int grid_top = top + 3; + int page_size = (LINES - grid_top); + int pairs_max = PAIR_NUMBER(A_COLOR) + 1; + int row_limit; + int per_row; + char numbered[80]; + const char *hello; + bool done = FALSE; + bool opt_bold = FALSE; + bool opt_wide = FALSE; + bool opt_nums = FALSE; + WINDOW *helpwin; + + if (pairs_max > COLOR_PAIRS) + pairs_max = COLOR_PAIRS; + + while (!done) { + int shown = 0; + + /* this assumes an 80-column line */ + if (opt_wide) { + width = 4; + hello = "Test"; + per_row = (COLORS > 8) ? 16 : 8; + } else { + width = 8; + hello = "Hello"; + per_row = 8; + } + + row_limit = (pairs_max + per_row - 1) / per_row; + + move(0, 0); + (void) printw("There are %d color pairs and %d colors\n", + pairs_max, COLORS); + + clrtobot(); + (void) mvprintw(top + 1, 0, + "%dx%d matrix of foreground/background colors, bold *%s*\n", + row_limit, + per_row, + opt_bold ? "on" : "off"); + + /* show color names/numbers across the top */ + for (i = 0; i < per_row; i++) + show_color_name(top + 2, (i + 1) * width, i, opt_wide); + + /* show a grid of colors, with color names/ numbers on the left */ + for (i = (base_row * per_row); i < pairs_max; i++) { + int row = grid_top + (i / per_row) - base_row; + int col = (i % per_row + 1) * width; + int pair = i; + + if (row >= 0 && move(row, col) != ERR) { + init_pair(pair, i % COLORS, i / COLORS); + attron((attr_t) COLOR_PAIR(pair)); + if (opt_bold) + attron((attr_t) A_BOLD); + + if (opt_nums) { + sprintf(numbered, "{%02X}", i); + hello = numbered; + } + printw("%-*.*s", width, width, hello); + attrset(A_NORMAL); + + if ((i % per_row) == 0 && (i % COLORS) == 0) { + show_color_name(row, 0, i / COLORS, opt_wide); + } + ++shown; + } else if (shown) { + break; + } + } + + switch (c = wGetchar(stdscr)) { + case 'b': + opt_bold = FALSE; + break; + case 'B': + opt_bold = TRUE; + break; + case 'n': + opt_nums = FALSE; + break; + case 'N': + opt_nums = TRUE; + break; + case ESCAPE: + case 'q': + done = TRUE; + continue; + case 'w': + set_color_test(opt_wide, FALSE); + break; + case 'W': + set_color_test(opt_wide, TRUE); + break; + case CTRL('p'): + case KEY_UP: + if (base_row <= 0) { + beep(); + } else { + base_row -= 1; + } + break; + case CTRL('n'): + case KEY_DOWN: + if (base_row + page_size >= row_limit) { + beep(); + } else { + base_row += 1; + } + break; + case CTRL('b'): + case KEY_PREVIOUS: + case KEY_PPAGE: + if (base_row <= 0) { + beep(); + } else { + base_row -= (page_size - 1); + if (base_row < 0) + base_row = 0; + } + break; + case CTRL('f'): + case KEY_NEXT: + case KEY_NPAGE: + if (base_row + page_size >= row_limit) { + beep(); + } else { + base_row += page_size - 1; + if (base_row + page_size >= row_limit) { + base_row = row_limit - page_size - 1; + } + } + break; + case '?': + if ((helpwin = newwin(LINES - 1, COLS - 2, 0, 0)) != 0) { + box(helpwin, 0, 0); + color_legend(helpwin); + wGetchar(helpwin); + delwin(helpwin); + } + break; + default: + beep(); + continue; + } + } + + erase(); + endwin(); +} + +#if USE_WIDEC_SUPPORT /* generate a color test pattern */ +static void +wide_color_test(void) { + int c; int i; - int base, top, width; + int top = 0, width; + int base_row = 0; + int grid_top = top + 3; + int page_size = (LINES - grid_top); + int pairs_max = COLOR_PAIRS; + int row_limit; + int per_row; + char numbered[80]; const char *hello; + bool done = FALSE; + bool opt_bold = FALSE; + bool opt_wide = FALSE; + bool opt_nums = FALSE; + WINDOW *helpwin; - refresh(); - (void) printw("There are %d color pairs\n", COLOR_PAIRS); + while (!done) { + int shown = 0; + + /* this assumes an 80-column line */ + if (opt_wide) { + width = 4; + hello = "Test"; + per_row = (COLORS > 8) ? 16 : 8; + } else { + width = 8; + hello = "Hello"; + per_row = 8; + } + + row_limit = (pairs_max + per_row - 1) / per_row; - width = (max_colors > 8) ? 4 : 8; - hello = (max_colors > 8) ? "Test" : "Hello"; + move(0, 0); + (void) printw("There are %d color pairs and %d colors\n", + pairs_max, COLORS); - for (base = 0; base < 2; base++) { - top = (max_colors > 8) ? 0 : base * (max_colors + 3); clrtobot(); (void) mvprintw(top + 1, 0, - "%dx%d matrix of foreground/background colors, bright *%s*\n", - max_colors, max_colors, - base ? "on" : "off"); - for (i = 0; i < max_colors; i++) - show_color_name(top + 2, (i + 1) * width, i); - for (i = 0; i < max_colors; i++) - show_color_name(top + 3 + i, 0, i); - for (i = 1; i < max_pairs; i++) { - init_pair(i, i % max_colors, i / max_colors); - attron((attr_t) COLOR_PAIR(i)); - if (base) - attron((attr_t) A_BOLD); - mvaddstr(top + 3 + (i / max_colors), (i % max_colors + 1) * - width, hello); - attrset(A_NORMAL); + "%dx%d matrix of foreground/background colors, bold *%s*\n", + row_limit, + per_row, + opt_bold ? "on" : "off"); + + /* show color names/numbers across the top */ + for (i = 0; i < per_row; i++) + show_color_name(top + 2, (i + 1) * width, i, opt_wide); + + /* show a grid of colors, with color names/ numbers on the left */ + for (i = (base_row * per_row); i < pairs_max; i++) { + int row = grid_top + (i / per_row) - base_row; + int col = (i % per_row + 1) * width; + int pair = i; + + if (row >= 0 && move(row, col) != ERR) { + init_pair(pair, i % COLORS, i / COLORS); + color_set(pair, NULL); + if (opt_bold) + attr_on((attr_t) A_BOLD, NULL); + + if (opt_nums) { + sprintf(numbered, "{%02X}", i); + hello = numbered; + } + printw("%-*.*s", width, width, hello); + attr_set(A_NORMAL, 0, NULL); + + if ((i % per_row) == 0 && (i % COLORS) == 0) { + show_color_name(row, 0, i / COLORS, opt_wide); + } + ++shown; + } else if (shown) { + break; + } + } + + switch (c = wGetchar(stdscr)) { + case 'b': + opt_bold = FALSE; + break; + case 'B': + opt_bold = TRUE; + break; + case 'n': + opt_nums = FALSE; + break; + case 'N': + opt_nums = TRUE; + break; + case ESCAPE: + case 'q': + done = TRUE; + continue; + case 'w': + set_color_test(opt_wide, FALSE); + break; + case 'W': + set_color_test(opt_wide, TRUE); + break; + case CTRL('p'): + case KEY_UP: + if (base_row <= 0) { + beep(); + } else { + base_row -= 1; + } + break; + case CTRL('n'): + case KEY_DOWN: + if (base_row + page_size >= row_limit) { + beep(); + } else { + base_row += 1; + } + break; + case CTRL('b'): + case KEY_PREVIOUS: + case KEY_PPAGE: + if (base_row <= 0) { + beep(); + } else { + base_row -= (page_size - 1); + if (base_row < 0) + base_row = 0; + } + break; + case CTRL('f'): + case KEY_NEXT: + case KEY_NPAGE: + if (base_row + page_size >= row_limit) { + beep(); + } else { + base_row += page_size - 1; + if (base_row + page_size >= row_limit) { + base_row = row_limit - page_size - 1; + } + } + break; + case '?': + if ((helpwin = newwin(LINES - 1, COLS - 2, 0, 0)) != 0) { + box(helpwin, 0, 0); + color_legend(helpwin); + wGetchar(helpwin); + delwin(helpwin); + } + break; + default: + beep(); + continue; } - if ((max_colors > 8) || base) - Pause(); } erase(); endwin(); } +#endif /* USE_WIDEC_SUPPORT */ static void change_color(int current, int field, int value, int usebase) @@ -1279,13 +2069,29 @@ change_color(int current, int field, int value, int usebase) beep(); } +static void +init_all_colors(void) +{ + int c; + for (c = 0; c < COLORS; ++c) + init_color(c, + all_colors[c].red, + all_colors[c].green, + all_colors[c].blue); +} + +#define scaled_rgb(n) ((255 * (n)) / 1000) + static void color_edit(void) /* display the color test pattern, without trying to edit colors */ { int i, this_c = 0, value = 0, current = 0, field = 0; int last_c; + int top_color = 0; + int page_size = (LINES - 6); + init_all_colors(); refresh(); for (i = 0; i < max_colors; i++) @@ -1300,23 +2106,19 @@ color_edit(void) mvaddstr(0, 20, "Color RGB Value Editing"); attroff(A_BOLD); - for (i = 0; i < max_colors; i++) { - mvprintw(2 + i, 0, "%c %-8s:", + for (i = top_color; + (i - top_color < page_size) + && (i < max_colors); i++) { + char numeric[80]; + sprintf(numeric, "[%d]", i); + mvprintw(2 + i - top_color, 0, "%c %-8s:", (i == current ? '>' : ' '), (i < (int) SIZEOF(the_color_names) - ? the_color_names[i] : "")); + ? the_color_names[i] : numeric)); attrset(COLOR_PAIR(i)); addstr(" "); attrset(A_NORMAL); - /* - * Note: this refresh should *not* be necessary! It works around - * a bug in attribute handling that apparently causes the A_NORMAL - * attribute sets to interfere with the actual emission of the - * color setting somehow. This needs to be fixed. - */ - refresh(); - color_content(i, &red, &green, &blue); addstr(" R = "); if (current == i && field == 0) @@ -1337,26 +2139,47 @@ color_edit(void) if (current == i && field == 2) attrset(A_NORMAL); attrset(A_NORMAL); - addstr(")"); + printw(" ( %3d %3d %3d )", + scaled_rgb(red), + scaled_rgb(green), + scaled_rgb(blue)); } - mvaddstr(max_colors + 3, 0, + mvaddstr(LINES - 3, 0, "Use up/down to select a color, left/right to change fields."); - mvaddstr(max_colors + 4, 0, + mvaddstr(LINES - 2, 0, "Modify field by typing nnn=, nnn-, or nnn+. ? for help."); - move(2 + current, 0); + move(2 + current - top_color, 0); last_c = this_c; this_c = Getchar(); - if (isdigit(this_c) && !isdigit(last_c)) + if (this_c < 256 && isdigit(this_c) && !isdigit(last_c)) value = 0; switch (this_c) { + case CTRL('b'): + case KEY_PPAGE: + if (current > 0) + current -= (page_size - 1); + else + beep(); + break; + + case CTRL('f'): + case KEY_NPAGE: + if (current < (max_colors - 1)) + current += (page_size - 1); + else + beep(); + break; + + case CTRL('p'): case KEY_UP: current = (current == 0 ? (max_colors - 1) : current - 1); break; + case CTRL('n'): case KEY_DOWN: current = (current == (max_colors - 1) ? 0 : current + 1); break; @@ -1407,12 +2230,19 @@ color_edit(void) P("To increment or decrement a value, use the same procedure, but finish"); P("with a `+' or `-'."); P(""); + P("Press 'm' to invoke the top-level menu with the current color settings."); P("To quit, do `x' or 'q'"); Pause(); erase(); break; + case 'm': + endwin(); + main_menu(FALSE); + refresh(); + break; + case 'x': case 'q': break; @@ -1421,12 +2251,28 @@ color_edit(void) beep(); break; } - mvprintw(LINES - 2, 0, "Number: %d", value); + + if (current < 0) + current = 0; + if (current >= max_colors) + current = max_colors - 1; + if (current < top_color) + top_color = current; + if (current - top_color >= page_size) + top_color = current - (page_size - 1); + + mvprintw(LINES - 1, 0, "Number: %d", value); clrtoeol(); } while (this_c != 'x' && this_c != 'q'); erase(); + + /* + * ncurses does not reset each color individually when calling endwin(). + */ + init_all_colors(); + endwin(); } @@ -1571,13 +2417,13 @@ slk_test(void) #if HAVE_SLK_COLOR case 'F': if (has_colors()) { - fg = (fg + 1) % max_colors; + fg = (fg + 1) % COLORS; new_color = TRUE; } break; case 'B': if (has_colors()) { - bg = (bg + 1) % max_colors; + bg = (bg + 1) % COLORS; new_color = TRUE; } break; @@ -1595,12 +2441,13 @@ slk_test(void) } #if USE_WIDEC_SUPPORT +#define SLKLEN 8 static void wide_slk_test(void) /* exercise the soft keys */ { int c, fmt = 1; - wchar_t buf[9]; + wchar_t buf[SLKLEN + 1]; char *s; short fg = COLOR_BLACK; short bg = COLOR_WHITE; @@ -1670,14 +2517,30 @@ wide_slk_test(void) (void) mvaddstr(SLK_WORK, 0, "Please enter the label value: "); *buf = 0; if ((s = slk_label(c - '0')) != 0) { - int j; - for (j = 0; j < 8; ++j) { - if ((buf[j] = UChar(s[j])) == 0) + char *temp = strdup(s); + size_t used = strlen(temp); + size_t want = SLKLEN; + size_t test; + mbstate_t state; + + buf[0] = L'\0'; + while (want > 0 && used != 0) { + const char *base = s; + memset(&state, 0, sizeof(state)); + test = mbsrtowcs(0, &base, 0, &state); + if (test == (size_t) -1) { + temp[--used] = 0; + } else if (test > want) { + temp[--used] = 0; + } else { + memset(&state, 0, sizeof(state)); + mbsrtowcs(buf, &base, want, &state); break; + } } - buf[j] = 0; + free(temp); } - wGet_wstring(stdscr, buf, 8); + wGet_wstring(stdscr, buf, SLKLEN); slk_wset((c - '0'), buf, fmt); slk_refresh(); move(SLK_WORK, 0); @@ -1690,13 +2553,13 @@ wide_slk_test(void) case 'F': if (has_colors()) { - fg = (fg + 1) % max_colors; + fg = (fg + 1) % COLORS; new_color = TRUE; } break; case 'B': if (has_colors()) { - bg = (bg + 1) % max_colors; + bg = (bg + 1) % COLORS; new_color = TRUE; } break; @@ -1723,11 +2586,11 @@ wide_slk_test(void) * terminal to perform functions. The remaining codes can be graphic. */ static void -show_upper_chars(int first) +show_upper_chars(unsigned first) { bool C1 = (first == 128); - int code; - int last = first + 31; + unsigned code; + unsigned last = first + 31; int reply; erase(); @@ -1741,7 +2604,7 @@ show_upper_chars(int first) int row = 4 + ((code - first) % 16); int col = ((code - first) / 16) * COLS / 2; char tmp[80]; - sprintf(tmp, "%3d (0x%x)", code, code); + sprintf(tmp, "%3u (0x%x)", code, code); mvprintw(row, col, "%*s: ", COLS / 4, tmp); if (C1) nodelay(stdscr, TRUE); @@ -1749,7 +2612,7 @@ show_upper_chars(int first) if (C1) { /* (yes, this _is_ crude) */ while ((reply = Getchar()) != ERR) { - addch(reply); + addch(UChar(reply)); napms(10); } nodelay(stdscr, FALSE); @@ -1850,6 +2713,9 @@ acs_display(void) do { switch (c) { + case CTRL('L'): + Repaint(); + break; case 'a': show_acs_chars(); break; @@ -1860,7 +2726,7 @@ acs_display(void) case '1': case '2': case '3': - show_upper_chars((c - '0') * 32 + 128); + show_upper_chars((unsigned) ((c - '0') * 32 + 128)); break; } mvprintw(LINES - 3, 0, @@ -1877,7 +2743,7 @@ acs_display(void) #if USE_WIDEC_SUPPORT static void -show_upper_widechars(int first, int repeat) +show_upper_widechars(int first, int repeat, int space) { cchar_t temp; wchar_t code; @@ -1902,6 +2768,14 @@ show_upper_widechars(int first, int repeat) mvprintw(row, col, "%*s: ", COLS / 4, tmp); setcchar(&temp, codes, attrs, 0, 0); do { + /* + * Give non-spacing characters something to combine with. If we + * don't, they'll bunch up in a heap on the space after the ":". + * Mark them with reverse-video to make them simpler to find on + * the display. + */ + if (wcwidth(code) == 0) + addch(space | A_REVERSE); /* * This could use add_wch(), but is done for comparison with the * normal 'f' test (and to make a test-case for echo_wchar()). @@ -1914,7 +2788,7 @@ show_upper_widechars(int first, int repeat) } static int -show_1_wacs(int n, const char *name, const cchar_t * code) +show_1_wacs(int n, const char *name, const cchar_t *code) { const int height = 16; int row = 4 + (n % height); @@ -2074,9 +2948,13 @@ wide_acs_display(void) int c = 'a'; int digit = 0; int repeat = 0; + int space = ' '; do { switch (c) { + case CTRL('L'): + Repaint(); + break; case 'a': show_wacs_chars(); break; @@ -2087,7 +2965,7 @@ wide_acs_display(void) show_utf8_chars(); break; default: - if (isdigit(c)) + if (c < 256 && isdigit(c)) digit = (c - '0'); else if (c == '+') ++digit; @@ -2097,11 +2975,13 @@ wide_acs_display(void) ++repeat; else if (c == '<' && repeat > 0) --repeat; + else if (c == '_') + space = (space == ' ') ? '_' : ' '; else { beep(); break; } - show_upper_widechars(digit * 32 + 128, repeat); + show_upper_widechars(digit * 32 + 128, repeat, space); break; } mvprintw(LINES - 2, 0, @@ -2125,7 +3005,7 @@ test_sgr_attributes(void) int pass; for (pass = 0; pass < 2; pass++) { - int normal = ((pass == 0 ? A_NORMAL : A_REVERSE)) | BLANK; + chtype normal = ((pass == 0 ? A_NORMAL : A_REVERSE)) | BLANK; /* Use non-default colors if possible to exercise bce a little */ if (has_colors()) { @@ -2740,7 +3620,7 @@ acs_and_scroll(void) ****************************************************************************/ #if USE_LIBPANEL -static unsigned long nap_msec = 1; +static int nap_msec = 1; static NCURSES_CONST char *mod[] = { @@ -2756,7 +3636,7 @@ static NCURSES_CONST char *mod[] = wait_a_while(msec) --------------------------------------------------------------------------*/ static void -wait_a_while(unsigned long msec GCC_UNUSED) +wait_a_while(int msec GCC_UNUSED) { #if HAVE_NAPMS if (nap_msec == 1) @@ -2766,8 +3646,8 @@ wait_a_while(unsigned long msec GCC_UNUSED) #else if (nap_msec == 1) wGetchar(stdscr); - else if (msec > 1000L) - sleep((int) msec / 1000L); + else if (msec > 1000) + sleep((unsigned) msec / 1000); else sleep(1); #endif @@ -2788,7 +3668,7 @@ saywhat(NCURSES_CONST char *text) mkpanel(rows,cols,tly,tlx) - alloc a win and panel and associate them --------------------------------------------------------------------------*/ static PANEL * -mkpanel(int color, int rows, int cols, int tly, int tlx) +mkpanel(unsigned color, int rows, int cols, int tly, int tlx) { WINDOW *win; PANEL *pan = 0; @@ -2846,7 +3726,7 @@ fill_panel(PANEL * pan) for (y = 2; y < getmaxy(win) - 1; y++) { for (x = 1; x < getmaxx(win) - 1; x++) { wmove(win, y, x); - waddch(win, num); + waddch(win, UChar(num)); } } } /* end of fill_panel */ @@ -3057,6 +3937,10 @@ demo_panels(void) saywhat("d5; press any key to continue"); rmpanel(p5); pflush(); + + rmpanel(p3); + pflush(); + wait_a_while(nap_msec); if (nap_msec == 1) break; @@ -3086,7 +3970,7 @@ panner_legend(int line) "Use arrow keys (or U,D,L,R) to pan, q to quit, ! to shell-out.", "Use +,- (or j,k) to grow/shrink the panner vertically.", "Use <,> (or h,l) to grow/shrink the panner horizontally.", - "Number repeats. Toggle legend:?, timer:t, scroll mark:s." + "Number repeats. Toggle legend:? filler:a timer:t scrollmark:s." }; int n = (SIZEOF(legend) - (LINES - line)); if (line < LINES && (n >= 0)) { @@ -3113,6 +3997,35 @@ panner_v_cleanup(int from_y, int from_x, int to_y) do_v_line(from_y, from_x, ' ', to_y); } +static void +fill_pad(WINDOW *panpad, bool pan_lines) +{ + int y, x; + unsigned gridcount = 0; + + wmove(panpad, 0, 0); + for (y = 0; y < getmaxy(panpad); y++) { + for (x = 0; x < getmaxx(panpad); x++) { + if (y % GRIDSIZE == 0 && x % GRIDSIZE == 0) { + if (y == 0 && x == 0) + waddch(panpad, pan_lines ? ACS_ULCORNER : '+'); + else if (y == 0) + waddch(panpad, pan_lines ? ACS_TTEE : '+'); + else if (y == 0 || x == 0) + waddch(panpad, pan_lines ? ACS_LTEE : '+'); + else + waddch(panpad, (chtype) ((pan_lines ? 'a' : 'A') + + (gridcount++ % 26))); + } else if (y % GRIDSIZE == 0) + waddch(panpad, pan_lines ? ACS_HLINE : '-'); + else if (x % GRIDSIZE == 0) + waddch(panpad, pan_lines ? ACS_VLINE : '|'); + else + waddch(panpad, ' '); + } + } +} + static void panner(WINDOW *pad, int top_x, int top_y, int porty, int portx, @@ -3122,6 +4035,7 @@ panner(WINDOW *pad, struct timeval before, after; bool timing = TRUE; #endif + bool pan_lines = FALSE; bool scrollers = TRUE; int basex = 0; int basey = 0; @@ -3160,6 +4074,12 @@ panner(WINDOW *pad, panner_legend(LINES - 2); panner_legend(LINES - 1); break; + case 'a': + pan_lines = !pan_lines; + fill_pad(pad, pan_lines); + pending_pan = FALSE; + break; + #if HAVE_GETTIMEOFDAY case 't': timing = !timing; @@ -3357,7 +4277,7 @@ panner(WINDOW *pad, gettimeofday(&after, 0); elapsed = (after.tv_sec + after.tv_usec / 1.0e6) - (before.tv_sec + before.tv_usec / 1.0e6); - move(LINES - 1, COLS - 20); + move(LINES - 1, COLS - 12); printw("Secs: %2.03f", elapsed); refresh(); } @@ -3446,8 +4366,6 @@ static void demo_pad(void) /* Demonstrate pads. */ { - int i, j; - unsigned gridcount = 0; WINDOW *panpad = newpad(PAD_HIGH, PAD_WIDE); if (panpad == 0) { @@ -3455,20 +4373,8 @@ demo_pad(void) return; } - for (i = 0; i < PAD_HIGH; i++) { - for (j = 0; j < PAD_WIDE; j++) - if (i % GRIDSIZE == 0 && j % GRIDSIZE == 0) { - if (i == 0 || j == 0) - waddch(panpad, '+'); - else - waddch(panpad, (chtype) ('A' + (gridcount++ % 26))); - } else if (i % GRIDSIZE == 0) - waddch(panpad, '-'); - else if (j % GRIDSIZE == 0) - waddch(panpad, '|'); - else - waddch(panpad, ' '); - } + fill_pad(panpad, FALSE); + panner_legend(LINES - 4); panner_legend(LINES - 3); panner_legend(LINES - 2); @@ -3626,7 +4532,19 @@ menu_virtualize(int c) static const char *animals[] = { - "Lions", "Tigers", "Bears", "(Oh my!)", "Newts", "Platypi", "Lemurs", + "Lions", + "Tigers", + "Bears", + "(Oh my!)", + "Newts", + "Platypi", + "Lemurs", + "(Oh really?!)", + "Leopards", + "Panthers", + "Pumas", + "Lions, Tigers, Bears, (Oh my!), Newts, Platypi, Lemurs", + "Lions, Tigers, Bears, (Oh my!), Newts, Platypi, Lemurs, Lions, Tigers, Bears, (Oh my!), Newts, Platypi, Lemurs", (char *) 0 }; @@ -3670,6 +4588,8 @@ menu_test(void) post_menu(m); while ((c = menu_driver(m, menu_virtualize(wGetchar(menuwin)))) != E_UNKNOWN_COMMAND) { + if (c == E_NOT_POSTED) + break; if (c == E_REQUEST_DENIED) beep(); continue; @@ -3695,7 +4615,7 @@ menu_test(void) #define T_TBL(name) { #name, name } static struct { const char *name; - int mask; + unsigned mask; } t_tbl[] = { T_TBL(TRACE_DISABLE), @@ -3720,7 +4640,7 @@ static struct { }; static char * -tracetrace(int tlevel) +tracetrace(unsigned tlevel) { static char *buf; int n; @@ -3792,7 +4712,8 @@ trace_set(void) MENU *m; ITEM *items[SIZEOF(t_tbl)]; ITEM **ip = items; - int mrows, mcols, newtrace; + int mrows, mcols; + unsigned newtrace; int n; WINDOW *menuwin; @@ -3824,7 +4745,7 @@ trace_set(void) post_menu(m); for (ip = menu_items(m); *ip; ip++) { - int mask = t_tbl[item_index(*ip)].mask; + unsigned mask = t_tbl[item_index(*ip)].mask; if (mask == 0) set_item_value(*ip, _nc_tracing == 0); else if ((mask & _nc_tracing) == mask) @@ -3865,11 +4786,11 @@ trace_set(void) static FIELD * make_label(int frow, int fcol, NCURSES_CONST char *label) { - FIELD *f = new_field(1, strlen(label), frow, fcol, 0, 0); + FIELD *f = new_field(1, (int) strlen(label), frow, fcol, 0, 0); if (f) { set_field_buffer(f, 0, label); - set_field_opts(f, field_opts(f) & ~O_ACTIVE); + set_field_opts(f, (int) (field_opts(f) & ~O_ACTIVE)); } return (f); } @@ -3931,7 +4852,7 @@ edit_secure(FIELD * me, int c) strcpy(temp, field_buffer(me, 1)); len = (long) (char *) field_userptr(me); if (c <= KEY_MAX) { - if (isgraph(c)) { + if (isgraph(c) && (len + 1) < (int) sizeof(temp)) { temp[len++] = c; temp[len] = 0; set_field_buffer(me, 1, temp); @@ -4102,12 +5023,14 @@ form_virtualize(FORM * f, WINDOW *w) int c = wGetchar(w); unsigned n; FIELD *me = current_field(f); + bool current = TRUE; if (c == CTRL(']')) { - if (mode == REQ_INS_MODE) + if (mode == REQ_INS_MODE) { mode = REQ_OVL_MODE; - else + } else { mode = REQ_INS_MODE; + } c = mode; } else { for (n = 0; n < SIZEOF(lookup); n++) { @@ -4117,15 +5040,38 @@ form_virtualize(FORM * f, WINDOW *w) } } } + mvprintw(0, COLS - 6, "(%s)", mode == REQ_INS_MODE ? "INS" : "OVL"); /* * Force the field that the user is typing into to be in reverse video, * while the other fields are shown underlined. */ - if (c <= KEY_MAX) { + switch (c) { + case REQ_BEG_FIELD: + case REQ_CLR_EOF: + case REQ_CLR_EOL: + case REQ_CLR_FIELD: + case REQ_DEL_CHAR: + case REQ_DEL_LINE: + case REQ_DEL_PREV: + case REQ_DEL_WORD: + case REQ_END_FIELD: + case REQ_INS_CHAR: + case REQ_INS_LINE: + case REQ_LEFT_CHAR: + case REQ_LEFT_FIELD: + case REQ_NEXT_WORD: + case REQ_RIGHT_CHAR: + current = TRUE; + break; + default: + current = (c < KEY_MAX); + break; + } + if (current) { c = edit_secure(me, c); set_field_back(me, A_REVERSE); - } else if (c <= MAX_FORM_COMMAND) { + } else { c = edit_secure(me, c); set_field_back(me, A_UNDERLINE); } @@ -4222,7 +5168,7 @@ demo_forms(void) unsigned n = 0; move(18, 0); - addstr("Defined form-traversal keys: ^Q/ESC- exit form\n"); + addstr("Defined edit/traversal keys: ^Q/ESC- exit form\n"); addstr("^N -- go to next field ^P -- go to previous field\n"); addstr("Home -- go to first field End -- go to last field\n"); addstr("^L -- go to field to left ^R -- go to field to right\n"); @@ -4232,7 +5178,7 @@ demo_forms(void) addstr("^H -- delete previous char ^Y -- delete line\n"); addstr("^G -- delete current word ^C -- clear to end of line\n"); addstr("^K -- clear to end of field ^X -- clear field\n"); - addstr("Arrow keys move within a field as you would expect."); + addstr("Arrow keys move within a field as you would expect. ^] toggles overlay mode."); mvaddstr(4, 57, "Forms Entry Test"); @@ -4290,6 +5236,8 @@ demo_forms(void) free_form(form); for (c = 0; f[c] != 0; c++) free_field(f[c]); + free_fieldtype(fty_middle); + free_fieldtype(fty_passwd); noraw(); nl(); } @@ -4311,7 +5259,7 @@ fillwin(WINDOW *win, char ch) for (y = 0; y < y1; y++) { wmove(win, y, 0); for (x = 0; x < x1; x++) - waddch(win, ch); + waddch(win, UChar(ch)); } } @@ -4327,7 +5275,7 @@ crosswin(WINDOW *win, char ch) if (((x > (x1 - 1) / 3) && (x <= (2 * (x1 - 1)) / 3)) || (((y > (y1 - 1) / 3) && (y <= (2 * (y1 - 1)) / 3)))) { wmove(win, y, x); - waddch(win, ch); + waddch(win, UChar(ch)); } } } @@ -4436,6 +5384,12 @@ do_single_test(const char c) attr_test(); break; +#if USE_WIDEC_SUPPORT + case 'B': + wide_attr_test(); + break; +#endif + case 'c': if (!has_colors()) Cannot("does not support color."); @@ -4443,6 +5397,15 @@ do_single_test(const char c) color_test(); break; +#if USE_WIDEC_SUPPORT + case 'C': + if (!has_colors()) + Cannot("does not support color."); + else + wide_color_test(); + break; +#endif + case 'd': if (!has_colors()) Cannot("does not support color."); @@ -4542,7 +5505,10 @@ usage(void) ," -e fmt specify format for soft-keys test (e)" ," -f rip-off footer line (can repeat)" ," -h rip-off header line (can repeat)" + ," -p file rgb values to use in 'd' rather than ncurses's builtin" +#if USE_LIBPANEL ," -s msec specify nominal time for panel-demo (default: 1, to hold)" +#endif #ifdef TRACE ," -t mask specify default trace-level (may toggle with ^T)" #endif @@ -4594,14 +5560,122 @@ rip_header(WINDOW *win, int cols) return OK; } +static void +main_menu(bool top) +{ + int command; + + do { + (void) puts("This is the ncurses main menu"); + (void) puts("a = keyboard and mouse input test"); +#if USE_WIDEC_SUPPORT + (void) puts("A = wide-character keyboard and mouse input test"); +#endif + (void) puts("b = character attribute test"); +#if USE_WIDEC_SUPPORT + (void) puts("B = wide-character attribute test"); +#endif + (void) puts("c = color test pattern"); +#if USE_WIDEC_SUPPORT + (void) puts("C = color test pattern using wide-character calls"); +#endif + if (top) + (void) puts("d = edit RGB color values"); + (void) puts("e = exercise soft keys"); +#if USE_WIDEC_SUPPORT + (void) puts("E = exercise soft keys using wide-characters"); +#endif + (void) puts("f = display ACS characters"); +#if USE_WIDEC_SUPPORT + (void) puts("F = display Wide-ACS characters"); +#endif + (void) puts("g = display windows and scrolling"); + (void) puts("i = test of flushinp()"); + (void) puts("k = display character attributes"); +#if USE_LIBMENU + (void) puts("m = menu code test"); +#endif +#if USE_LIBPANEL + (void) puts("o = exercise panels library"); + (void) puts("p = exercise pad features"); + (void) puts("q = quit"); +#endif +#if USE_LIBFORM + (void) puts("r = exercise forms code"); +#endif + (void) puts("s = overlapping-refresh test"); +#if USE_LIBMENU && defined(TRACE) + (void) puts("t = set trace level"); +#endif + (void) puts("? = repeat this command summary"); + + (void) fputs("> ", stdout); + (void) fflush(stdout); /* necessary under SVr4 curses */ + + /* + * This used to be an 'fgets()' call. However (on Linux, at least) + * mixing stream I/O and 'read()' (used in the library) causes the + * input stream to be flushed when switching between the two. + */ + command = 0; + for (;;) { + char ch; + if (read(fileno(stdin), &ch, 1) <= 0) { + if (command == 0) + command = 'q'; + break; + } else if (command == 0 && !isspace(UChar(ch))) { + command = ch; + } else if (ch == '\n' || ch == '\r') { + if ((command == 'd') && !top) { + (void) fputs("Do not nest test-d\n", stdout); + command = 0; + } + if (command != 0) + break; + (void) fputs("> ", stdout); + (void) fflush(stdout); + } + } + + if (do_single_test(command)) { + /* + * This may be overkill; it's intended to reset everything back + * to the initial terminal modes so that tests don't get in + * each other's way. + */ + flushinp(); + set_terminal_modes(); + reset_prog_mode(); + clear(); + refresh(); + endwin(); + if (command == '?') { + (void) puts("This is the ncurses capability tester."); + (void) + puts("You may select a test from the main menu by typing the"); + (void) + puts("key letter of the choice (the letter to left of the =)"); + (void) + puts("at the > prompt. The commands `x' or `q' will exit."); + } + continue; + } + } while + (command != 'q'); +} + /*+------------------------------------------------------------------------- main(argc,argv) --------------------------------------------------------------------------*/ +#define okCOLOR(n) ((n) >= 0 && (n) < max_colors) +#define okRGB(n) ((n) >= 0 && (n) <= 1000) + int main(int argc, char *argv[]) { - int command, c; + int c; int my_e_param = 1; #ifdef NCURSES_VERSION int default_fg = COLOR_WHITE; @@ -4609,10 +5683,11 @@ main(int argc, char *argv[]) bool assumed_colors = FALSE; bool default_colors = FALSE; #endif + char *palette_file = 0; setlocale(LC_ALL, ""); - while ((c = getopt(argc, argv, "a:de:fhs:t:")) != EOF) { + while ((c = getopt(argc, argv, "a:de:fhp:s:t:")) != EOF) { switch (c) { #ifdef NCURSES_VERSION case 'a': @@ -4639,6 +5714,9 @@ main(int argc, char *argv[]) case 'h': ripoffline(1, rip_header); break; + case 'p': + palette_file = optarg; + break; #if USE_LIBPANEL case 's': nap_msec = atol(optarg); @@ -4646,7 +5724,7 @@ main(int argc, char *argv[]) #endif #ifdef TRACE case 't': - save_trace = atoi(optarg); + save_trace = strtol(optarg, 0, 0); break; #endif default: @@ -4685,21 +5763,57 @@ main(int argc, char *argv[]) if (has_colors()) { start_color(); #ifdef NCURSES_VERSION_PATCH - max_colors = COLORS > 16 ? 16 : COLORS; + max_colors = COLORS; /* was > 16 ? 16 : COLORS */ #if HAVE_USE_DEFAULT_COLORS - if (default_colors) + if (default_colors) { use_default_colors(); + min_colors = -1; + } #if NCURSES_VERSION_PATCH >= 20000708 else if (assumed_colors) assume_default_colors(default_fg, default_bg); #endif #endif #else /* normal SVr4 curses */ - max_colors = COLORS > 8 ? 8 : COLORS; + max_colors = COLORS; /* was > 8 ? 8 : COLORS */ #endif - max_pairs = (max_colors * max_colors); - if (max_pairs < COLOR_PAIRS) - max_pairs = COLOR_PAIRS; + max_pairs = COLOR_PAIRS; /* was > 256 ? 256 : COLOR_PAIRS */ + + if (can_change_color()) { + all_colors = (RGB_DATA *) malloc(max_colors * sizeof(RGB_DATA)); + for (c = 0; c < max_colors; ++c) { + color_content(c, + &all_colors[c].red, + &all_colors[c].green, + &all_colors[c].blue); + } + if (palette_file != 0) { + FILE *fp = fopen(palette_file, "r"); + if (fp != 0) { + char buffer[BUFSIZ]; + int red, green, blue; + int scale = 1000; + while (fgets(buffer, sizeof(buffer), fp) != 0) { + if (sscanf(buffer, "scale:%d", &c) == 1) { + scale = c; + } else if (sscanf(buffer, "%d:%d %d %d", + &c, + &red, + &green, + &blue) == 4 + && okCOLOR(c) + && okRGB(red) + && okRGB(green) + && okRGB(blue)) { + all_colors[c].red = (red * 1000) / scale; + all_colors[c].green = (green * 1000) / scale; + all_colors[c].blue = (blue * 1000) / scale; + } + } + fclose(fp); + } + } + } } set_terminal_modes(); def_prog_mode(); @@ -4721,93 +5835,7 @@ main(int argc, char *argv[]) (void) puts("Welcome to ncurses. Press ? for help."); #endif - do { - (void) puts("This is the ncurses main menu"); - (void) puts("a = keyboard and mouse input test"); -#if USE_WIDEC_SUPPORT - (void) puts("A = wide-character keyboard and mouse input test"); -#endif - (void) puts("b = character attribute test"); - (void) puts("c = color test pattern"); - (void) puts("d = edit RGB color values"); - (void) puts("e = exercise soft keys"); -#if USE_WIDEC_SUPPORT - (void) puts("E = exercise soft keys using wide-characters"); -#endif - (void) puts("f = display ACS characters"); -#if USE_WIDEC_SUPPORT - (void) puts("F = display Wide-ACS characters"); -#endif - (void) puts("g = display windows and scrolling"); - (void) puts("i = test of flushinp()"); - (void) puts("k = display character attributes"); -#if USE_LIBMENU - (void) puts("m = menu code test"); -#endif -#if USE_LIBPANEL - (void) puts("o = exercise panels library"); - (void) puts("p = exercise pad features"); - (void) puts("q = quit"); -#endif -#if USE_LIBFORM - (void) puts("r = exercise forms code"); -#endif - (void) puts("s = overlapping-refresh test"); -#if USE_LIBMENU && defined(TRACE) - (void) puts("t = set trace level"); -#endif - (void) puts("? = repeat this command summary"); - - (void) fputs("> ", stdout); - (void) fflush(stdout); /* necessary under SVr4 curses */ - - /* - * This used to be an 'fgets()' call. However (on Linux, at least) - * mixing stream I/O and 'read()' (used in the library) causes the - * input stream to be flushed when switching between the two. - */ - command = 0; - for (;;) { - char ch; - if (read(fileno(stdin), &ch, 1) <= 0) { - if (command == 0) - command = 'q'; - break; - } else if (command == 0 && !isspace(UChar(ch))) { - command = ch; - } else if (ch == '\n' || ch == '\r') { - if (command != 0) - break; - (void) fputs("> ", stdout); - (void) fflush(stdout); - } - } - - if (do_single_test(command)) { - /* - * This may be overkill; it's intended to reset everything back - * to the initial terminal modes so that tests don't get in - * each other's way. - */ - flushinp(); - set_terminal_modes(); - reset_prog_mode(); - clear(); - refresh(); - endwin(); - if (command == '?') { - (void) puts("This is the ncurses capability tester."); - (void) - puts("You may select a test from the main menu by typing the"); - (void) - puts("key letter of the choice (the letter to left of the =)"); - (void) - puts("at the > prompt. The commands `x' or `q' will exit."); - } - continue; - } - } while - (command != 'q'); + main_menu(TRUE); ExitProgram(EXIT_SUCCESS); } diff --git a/test/newdemo.c b/test/newdemo.c index 7f583389..21a8f64f 100644 --- a/test/newdemo.c +++ b/test/newdemo.c @@ -2,19 +2,19 @@ * newdemo.c - A demo program using PDCurses. The program illustrate * the use of colours for text output. * - * $Id: newdemo.c,v 1.24 2002/06/29 23:32:18 tom Exp $ + * $Id: newdemo.c,v 1.27 2005/05/28 21:40:00 tom Exp $ */ -#include - #include +#include + #define delay_output(x) napms(x) /* * The Australian map */ -const char *AusMap[16] = +static const char *AusMap[16] = { " A A ", " N.T. AAAAA AAAA ", @@ -35,7 +35,7 @@ const char *AusMap[16] = */ #define NMESSAGES 6 -NCURSES_CONST char *messages[] = +static NCURSES_CONST char *messages[] = { "Hello from the Land Down Under", "The Land of crocs. and a big Red Rock", @@ -90,8 +90,8 @@ set_colors(WINDOW *win, int pair, int foreground, int background) } } -static int -use_colors(WINDOW *win, int pair, int attrs) +static chtype +use_colors(WINDOW *win, int pair, chtype attrs) { if (has_colors()) { if (pair > COLOR_PAIRS) diff --git a/test/tclock.c b/test/tclock.c index c3cce6d3..394ee813 100644 --- a/test/tclock.c +++ b/test/tclock.c @@ -1,4 +1,4 @@ -/* $Id: tclock.c,v 1.24 2002/12/29 01:40:30 tom Exp $ */ +/* $Id: tclock.c,v 1.25 2005/04/16 16:39:27 tom Exp $ */ #include @@ -229,7 +229,7 @@ main(int argc GCC_UNUSED, char *argv[]GCC_UNUSED) lastbeep = t->tm_sec; if (has_colors()) { odd = !odd; - bkgd(odd ? COLOR_PAIR(4) : COLOR_PAIR(0)); + bkgd((chtype) (odd ? COLOR_PAIR(4) : COLOR_PAIR(0))); } beep(); } diff --git a/test/test.priv.h b/test/test.priv.h index a6df135a..85e14a04 100644 --- a/test/test.priv.h +++ b/test/test.priv.h @@ -29,7 +29,7 @@ /**************************************************************************** * Author: Thomas E. Dickey 1996 * ****************************************************************************/ -/* $Id: test.priv.h,v 1.46 2003/10/19 00:04:24 tom Exp $ */ +/* $Id: test.priv.h,v 1.48 2004/04/10 20:11:37 tom Exp $ */ #ifndef __TEST_PRIV_H #define __TEST_PRIV_H 1 @@ -136,6 +136,10 @@ #include #endif +#ifdef NCURSES_VERSION +#define HAVE_COLOR_SET 1 +#endif + #if NCURSES_NOMACROS #include #endif @@ -276,12 +280,12 @@ extern int optind; #endif /* out-of-band values for representing absent capabilities */ -#define ABSENT_BOOLEAN (-1) /* 255 */ +#define ABSENT_BOOLEAN ((signed char)-1) /* 255 */ #define ABSENT_NUMERIC (-1) #define ABSENT_STRING (char *)0 /* out-of-band values for representing cancels */ -#define CANCELLED_BOOLEAN (char)(-2) /* 254 */ +#define CANCELLED_BOOLEAN ((signed char)-2) /* 254 */ #define CANCELLED_NUMERIC (-2) #define CANCELLED_STRING (char *)(-1) diff --git a/test/testcurs.c b/test/testcurs.c index e8aa918e..00cf8b67 100644 --- a/test/testcurs.c +++ b/test/testcurs.c @@ -7,7 +7,7 @@ * wrs(5/28/93) -- modified to be consistent (perform identically) with either * PDCurses or under Unix System V, R4 * - * $Id: testcurs.c,v 1.32 2002/10/19 22:11:24 tom Exp $ + * $Id: testcurs.c,v 1.34 2005/04/16 16:19:12 tom Exp $ */ #include @@ -33,7 +33,7 @@ struct commands { }; typedef struct commands COMMAND; -const COMMAND command[] = +static const COMMAND command[] = { {"General Test", introTest}, {"Pad Test", padTest}, @@ -58,7 +58,7 @@ strdup(char *s) } #endif /* not HAVE_STRDUP */ -int width, height; +static int width, height; int main( @@ -158,7 +158,7 @@ Continue(WINDOW *win) int x1 = getmaxx(win); int y0 = y1 < 10 ? y1 : 10; int x0 = 1; - long save; + chtype save; save = mvwinch(win, y0, x1 - 1); @@ -358,7 +358,7 @@ inputTest(WINDOW *win) else if (isprint(c)) wprintw(win, "Key Pressed: %c", c); else - wprintw(win, "Key Pressed: %s", unctrl(c)); + wprintw(win, "Key Pressed: %s", unctrl(UChar(c))); #if defined(PDCURSES) if (c == KEY_MOUSE) { int button = 0; @@ -400,7 +400,8 @@ inputTest(WINDOW *win) repeat = 0; do { - static const char *fmt[] = { + static const char *fmt[] = + { "%d %10s", "%d %[a-zA-Z]s", "%d %[][a-zA-Z]s", @@ -689,12 +690,12 @@ padTest(WINDOW *dummy GCC_UNUSED) static void display_menu(int old_option, int new_option) { - register size_t i; + int i; attrset(A_NORMAL); mvaddstr(3, 20, "PDCurses Test Program"); - for (i = 0; i < MAX_OPTIONS; i++) + for (i = 0; i < (int) MAX_OPTIONS; i++) mvaddstr(5 + i, 25, command[i].text); if (old_option != (-1)) mvaddstr(5 + old_option, 25, command[old_option].text); diff --git a/test/tracemunch b/test/tracemunch index 451d17f3..1ea6f4b6 100755 --- a/test/tracemunch +++ b/test/tracemunch @@ -1,7 +1,7 @@ #!/usr/bin/perl -w -# $Id: tracemunch,v 1.3 2002/09/22 16:31:18 tom Exp $ +# $Id: tracemunch,v 1.6 2005/03/12 21:48:23 tom Exp $ ############################################################################## -# Copyright (c) 1998,2002 Free Software Foundation, Inc. # +# Copyright (c) 1998-2002,2005 Free Software Foundation, Inc. # # # # Permission is hereby granted, free of charge, to any person obtaining a # # copy of this software and associated documentation files (the "Software"), # @@ -32,22 +32,27 @@ # The error logs produced by ncurses with tracing enabled can be very tedious # to wade through. This script helps by compacting runs of log lines that # can be conveniently expressed as higher-level operations. -# +use strict; -$putattr="PutAttrChar\\('(.)' = 0x.., {A_NORMAL}\\) at \\(([0-9]+), ([0-9]+)\\)"; -$waddnstr="waddnstr\\(0x([0-9a-f]+),\"([^\"]+)\",[0-9]+\\) called {A_NORMAL}"; +our $putattr="PutAttrChar\\({{ '(.)' = 0[0-7]+ }}\\) at \\(([0-9]+), ([0-9]+)\\)"; +our $waddnstr="waddnstr\\(0x([0-9a-f]+),\"([^\"]+)\",[0-9]+\\) called {A_NORMAL}"; -$win_nums=0; +our $win_nums=0; +our $curscr=""; +our $newscr=""; +our $stdscr=""; +our @win_addr; sub transaddr { - $arg = $_[0]; + my $n; + my $arg = $_[0]; - $arg =~ s/$curscr/curscr/ if ($curscr); - $arg =~ s/$newscr/newscr/ if ($newscr); - $arg =~ s/$stdscr/stdscr/ if ($stdscr); + $arg =~ s/$curscr/curscr/g if ($curscr); + $arg =~ s/$newscr/newscr/g if ($newscr); + $arg =~ s/$stdscr/stdscr/g if ($stdscr); for $n (0..$#win_addr) { - $arg =~ s/$win_addr[$n]/window$n/ if $win_addr[$n]; + $arg =~ s/$win_addr[$n]/window$n/g if $win_addr[$n]; } return $arg; @@ -55,6 +60,10 @@ sub transaddr while () { + my $addr; + my $n; + my $awaiting; + CLASSIFY: { # Transform window pointer addresses so it's easier to compare logs $awaiting = "curscr" if ($_ =~ /creating curscr/); @@ -75,6 +84,7 @@ CLASSIFY: { $awaiting = ""; } elsif ($_ =~ /^\.\.\.deleted win=0x([0-9a-f]+)/) { $addr = "0x$1"; + $_ = &transaddr($_); if ($addr eq $curscr) { $curscr = ""; } elsif ($addr eq $newscr) { @@ -93,9 +103,9 @@ CLASSIFY: { # Compactify runs of PutAttrChar calls (TR_CHARPUT) if ($_ =~ /$putattr/) { - $putattr_chars = $1; - $starty = $2; - $startx = $3; + my $putattr_chars = $1; + my $starty = $2; + my $startx = $3; while () { if ($_ =~ /$putattr/) { @@ -111,8 +121,8 @@ CLASSIFY: { # Compactify runs of waddnstr calls (TR_CALLS) if ($_ =~ /$waddnstr/) { - $waddnstr_chars = $2; - $winaddr = $1; + my $waddnstr_chars = $2; + my $winaddr = $1; while () { if ($_ =~ /$waddnstr/ && $1 eq $winaddr) { @@ -121,7 +131,7 @@ CLASSIFY: { last; } } - $winaddstr = &transaddr($winaddr); + my $winaddstr = &transaddr($winaddr); print "RUN of waddnstr()s: $winaddr, \"$waddnstr_chars\"\n"; redo CLASSIFY; } @@ -129,8 +139,8 @@ CLASSIFY: { # More transformations can go here # Repeated runs of anything - $anyline = &transaddr($_); - $repeatcount = 1; + my $anyline = &transaddr($_); + my $repeatcount = 1; while () { if (&transaddr($_) eq $anyline) { $repeatcount++; diff --git a/test/view.c b/test/view.c index ce9b9b87..b484b5f9 100644 --- a/test/view.c +++ b/test/view.c @@ -23,12 +23,14 @@ * scroll operation worked, and the refresh() code only had to do a * partial repaint. * - * $Id: view.c,v 1.57 2003/05/17 21:58:43 tom Exp $ + * $Id: view.c,v 1.62 2005/05/28 21:40:25 tom Exp $ */ +#include + #include -#include +#undef CTRL /* conflict on AIX 5.2 with */ #if HAVE_TERMIOS_H # include @@ -69,8 +71,9 @@ static int shift = 0; static bool try_color = FALSE; static char *fname; -static NCURSES_CH_T **my_lines; +static NCURSES_CH_T **vec_lines; static NCURSES_CH_T **lptr; +static int num_lines; static void usage(void) @@ -164,7 +167,8 @@ ch_dup(char *src) if (setcchar(dst + k, wstr, 0, 0, NULL) == OK) ++k; } - setcchar(dst + k, L"", 0, 0, NULL); + wstr[0] = L'\0'; + setcchar(dst + k, wstr, 0, 0, NULL); #else dst[k] = 0; #endif @@ -180,7 +184,6 @@ main(int argc, char *argv[]) int i; int my_delay = 0; NCURSES_CH_T **olptr; - int length = 0; int value = 0; bool done = FALSE; bool got_number = FALSE; @@ -220,7 +223,7 @@ main(int argc, char *argv[]) #endif #ifdef TRACE case 'T': - trace(atoi(optarg)); + trace((unsigned) atoi(optarg)); break; case 't': trace(TRACE_CALLS); @@ -233,7 +236,7 @@ main(int argc, char *argv[]) if (optind + 1 != argc) usage(); - if ((my_lines = typeMalloc(NCURSES_CH_T *, MAXLINES + 2)) == 0) + if ((vec_lines = typeMalloc(NCURSES_CH_T *, MAXLINES + 2)) == 0) usage(); fname = argv[optind]; @@ -247,7 +250,7 @@ main(int argc, char *argv[]) #endif /* slurp the file */ - for (lptr = &my_lines[0]; (lptr - my_lines) < MAXLINES; lptr++) { + for (lptr = &vec_lines[0]; (lptr - vec_lines) < MAXLINES; lptr++) { char temp[BUFSIZ], *s, *d; int col; @@ -280,7 +283,7 @@ main(int argc, char *argv[]) *lptr = ch_dup(temp); } (void) fclose(fp); - length = lptr - my_lines; + num_lines = lptr - vec_lines; (void) initscr(); /* initialize the curses library */ keypad(stdscr, TRUE); /* enable keyboard mapping */ @@ -300,7 +303,7 @@ main(int argc, char *argv[]) } } - lptr = my_lines; + lptr = vec_lines; while (!done) { int n, c; @@ -323,7 +326,7 @@ main(int argc, char *argv[]) mvprintw(0, 0, "Count: "); clrtoeol(); } - addch(c); + addch(UChar(c)); value = 10 * value + (c - '0'); got_number = TRUE; } else @@ -342,7 +345,7 @@ main(int argc, char *argv[]) case 'n': olptr = lptr; for (i = 0; i < n; i++) - if ((lptr - my_lines) < (length - LINES + 1)) + if ((lptr - vec_lines) < (num_lines - LINES + 1)) lptr++; else break; @@ -353,7 +356,7 @@ main(int argc, char *argv[]) case 'p': olptr = lptr; for (i = 0; i < n; i++) - if (lptr > my_lines) + if (lptr > vec_lines) lptr--; else break; @@ -362,15 +365,15 @@ main(int argc, char *argv[]) case 'h': case KEY_HOME: - lptr = my_lines; + lptr = vec_lines; break; case 'e': case KEY_END: - if (length > LINES) - lptr = my_lines + length - LINES + 1; + if (num_lines > LINES) + lptr = vec_lines + num_lines - LINES + 1; else - lptr = my_lines; + lptr = vec_lines; break; case 'r': @@ -428,6 +431,15 @@ static RETSIGTYPE finish(int sig) { endwin(); +#if NO_LEAKS + if (vec_lines != 0) { + int n; + for (n = 0; n < num_lines; ++n) { + free(vec_lines[n]); + } + free(vec_lines); + } +#endif ExitProgram(sig != 0 ? EXIT_FAILURE : EXIT_SUCCESS); } @@ -491,7 +503,7 @@ show_all(const char *tag) scrollok(stdscr, FALSE); /* prevent screen from moving */ for (i = 1; i < LINES; i++) { move(i, 0); - printw("%3ld:", (long) (lptr + i - my_lines)); + printw("%3ld:", (long) (lptr + i - vec_lines)); clrtoeol(); if ((s = lptr[i - 1]) != 0) { int len = ch_len(s); diff --git a/test/worm.c b/test/worm.c index 651ccc15..3840a363 100644 --- a/test/worm.c +++ b/test/worm.c @@ -34,7 +34,7 @@ Options: traces will be dumped. The program stops and waits for one character of input at the beginning and end of the interval. - $Id: worm.c,v 1.37 2002/06/29 23:32:18 tom Exp $ + $Id: worm.c,v 1.39 2005/08/20 20:26:29 tom Exp $ */ #include @@ -60,7 +60,7 @@ static int length = 16, number = 3; static chtype trail = ' '; #ifdef TRACE -int generation, trace_start, trace_end, singlestep; +static int generation, trace_start, trace_end, singlestep; #endif /* TRACE */ /* *INDENT-OFF* */ static const struct options { @@ -361,7 +361,7 @@ main(int argc, char *argv[]) #endif /* * Make it simple to put this into single-step mode, or resume - * normal operation -TD + * normal operation -T.Dickey */ if (ch == 'q') { cleanup(); diff --git a/test/xmas.c b/test/xmas.c index c9f338c0..2ea08aef 100644 --- a/test/xmas.c +++ b/test/xmas.c @@ -92,7 +92,7 @@ /******************************************************************************/ /* - * $Id: xmas.c,v 1.19 2002/06/29 23:32:18 tom Exp $ + * $Id: xmas.c,v 1.20 2005/04/16 16:34:38 tom Exp $ */ #include @@ -156,7 +156,7 @@ set_color(WINDOW *win, chtype color) static bool *pairs; int n = (color + 1); if (pairs == 0) - pairs = (bool *) calloc(COLORS + 1, sizeof(bool)); + pairs = (bool *) calloc((unsigned) (COLORS + 1), sizeof(bool)); if (!pairs[n]) { init_pair(n, color, my_bg); pairs[n] = TRUE; diff --git a/test/xterm-16color.dat b/test/xterm-16color.dat new file mode 100644 index 00000000..728da92a --- /dev/null +++ b/test/xterm-16color.dat @@ -0,0 +1,26 @@ +# $Id: xterm-16color.dat,v 1.1 2004/05/22 23:14:42 tom Exp $ +# This illustrates the predefined colors for XFree86 xterm's "xterm-16color". +# If you set $TERM to "xterm-88color" (and have xterm compiled to support the +# 88-color or 256-color feature), you can use the ncurses 'd' screen to +# manipulate the colors shown in the screen. The 'd' screen is limited to +# the first 16 colors, and xterm happens to use the same first 16 colors in +# the extended color models that support initc. +# +# The colors shown are for xterm patch #189. +scale:255 +0: 0 0 0 black +1: 205 0 0 red3 +2: 0 205 0 green3 +3: 205 205 0 yellow3 +4: 30 144 255 DodgerBlue1 +5: 205 0 205 magenta3 +6: 0 205 205 cyan3 +7: 229 229 229 gray90 +8: 127 127 127 gray50 +9: 255 0 0 red +10: 0 255 0 green +11: 255 255 0 yellow +12: 99 184 255 SteelBlue1 +13: 255 0 255 magenta +14: 0 255 255 cyan +15: 255 255 255 white diff --git a/test/xterm-88color.dat b/test/xterm-88color.dat new file mode 100644 index 00000000..049bc021 --- /dev/null +++ b/test/xterm-88color.dat @@ -0,0 +1,98 @@ +# $Id: xterm-88color.dat,v 1.1 2005/01/28 21:11:53 tom Exp $ +# This illustrates the predefined colors for XFree86 xterm's "xterm-16color". +# If you set $TERM to "xterm-88color" (and have xterm compiled to support the +# 88-color or 256-color feature), you can use the ncurses 'd' screen to +# manipulate the colors shown in the screen. The 'd' screen is limited to +# the first 16 colors, and xterm happens to use the same first 16 colors in +# the extended color models that support initc. +# +# The colors shown are for xterm patch #189. +scale:255 +0: 0 0 0 black +1: 205 0 0 red3 +2: 0 205 0 green3 +3: 205 205 0 yellow3 +4: 30 144 255 DodgerBlue1 +5: 205 0 205 magenta3 +6: 0 205 205 cyan3 +7: 229 229 229 gray90 +8: 127 127 127 gray50 +9: 255 0 0 red +10: 0 255 0 green +11: 255 255 0 yellow +12: 99 184 255 SteelBlue1 +13: 255 0 255 magenta +14: 0 255 255 cyan +15: 255 255 255 white +16: 0 0 0 +17: 0 0 139 +18: 0 0 205 +19: 0 0 255 +20: 0 139 0 +21: 0 139 139 +22: 0 139 205 +23: 0 139 255 +24: 0 205 0 +25: 0 205 139 +26: 0 205 205 +27: 0 205 255 +28: 0 255 0 +29: 0 255 139 +30: 0 255 205 +31: 0 255 255 +32: 139 0 0 +33: 139 0 139 +34: 139 0 205 +35: 139 0 255 +36: 139 139 0 +37: 139 139 139 +38: 139 139 205 +39: 139 139 255 +40: 139 205 0 +41: 139 205 139 +42: 139 205 205 +43: 139 205 255 +44: 139 255 0 +45: 139 255 139 +46: 139 255 205 +47: 139 255 255 +48: 205 0 0 +49: 205 0 139 +50: 205 0 205 +51: 205 0 255 +52: 205 139 0 +53: 205 139 139 +54: 205 139 205 +55: 205 139 255 +56: 205 205 0 +57: 205 205 139 +58: 205 205 205 +59: 205 205 255 +60: 205 255 0 +61: 205 255 139 +62: 205 255 205 +63: 205 255 255 +64: 255 0 0 +65: 255 0 139 +66: 255 0 205 +67: 255 0 255 +68: 255 139 0 +69: 255 139 139 +70: 255 139 205 +71: 255 139 255 +72: 255 205 0 +73: 255 205 139 +74: 255 205 205 +75: 255 205 255 +76: 255 255 0 +77: 255 255 139 +78: 255 255 205 +79: 255 255 255 +80: 46 46 46 +81: 92 92 92 +82: 113 113 113 +83: 139 139 139 +84: 162 162 162 +85: 185 185 185 +86: 208 208 208 +87: 231 231 231 -- 2.44.0